Date: 4 Jan 1998 15:09:03 +0200 From: Vladimir Litovka <doka@grunt.vl.net.ua> To: freebsd-hackers@FreeBSD.ORG Subject: diff: Additional login capability Message-ID: <68o1lf$ivu$1@grunt.vl.net.ua>
index | next in thread | raw e-mail
Hello!
There is diff to /usr/src/usr.bin/login below. It adds shell arguments
processing to login, i.e. you can use arguments in shell field of
/etc/passwd. For example:
doka::1001:1001::0:0:Vladimir Litovka:/home/doka:/usr/local/bin/bash -r
uusys::2001:66::0:0:UUCP for sys:/var/spool/uucppublic:/etc/uucp/uudo sys
This ability must be activated by defining LOGIN_SHELL_ARGS in Makefile
(this already done in diff)
Please, mail your comments to doka@grunt.vl.net.ua
Thank you.
============= Cut here ==============
diff -c -r login/Makefile login.new/Makefile
*** login/Makefile Sun Jan 4 12:37:47 1998
--- login.new/Makefile Sun Jan 4 14:28:29 1998
***************
*** 10,15 ****
--- 10,17 ----
#Warning: requires src/libexec/login_* auth modules
#LC_AUTH=-DLOGIN_CAP_AUTH
CFLAGS+=-DSKEY -DLOGIN_ACCESS -DLOGALL -DLOGIN_CAP $(LC_AUTH)
+ # Comment out to disable shell arguments processing
+ CFLAGS+=-DLOGIN_SHELL_ARGS
.if defined(KLOGIN_PARANOID)
CFLAGS+=-DKLOGIN_PARANOID
diff -c -r login/README login.new/README
*** login/README Sun Jan 4 12:37:47 1998
--- login.new/README Sun Jan 4 14:24:35 1998
***************
*** 1,3 ****
--- 1,13 ----
+ This login has shell arguments processing. To activate this capability you
+ must define LOGIN_SHELL_ARGS and safely use arguments in shell field of
+ /etc/passwd
+
+ For example:
+
+ doka::1001:1001::0:0:Vladimir Litovka:/home/doka:/usr/local/bin/bash -r
+
+ -Vladimir Litovka <doka@grunt.vl.net.ua>
+
This login has additional functionalities. They are all based on (part of)
Wietse Venema's logdaemon package.
diff -c -r login/login.c login.new/login.c
*** login/login.c Sun Jan 4 12:37:47 1998
--- login.new/login.c Sun Jan 4 12:25:05 1998
***************
*** 172,177 ****
--- 172,180 ----
#ifdef SKEY
int permit_passwd = 0;
#endif /* SKEY */
+ #ifdef LOGIN_SHELL_ARGS
+ char **ap, *av[256];
+ #endif
(void)signal(SIGALRM, timedout);
(void)alarm(timeout);
***************
*** 800,806 ****
--- 803,822 ----
tbuf[0] = '-';
(void)strcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ? p + 1 : pwd->pw_shell);
+ #ifdef LOGIN_SHELL_ARGS
+ av[0]=tbuf;
+ if (p = strpbrk(tbuf, " \t")) {
+ *p = NULL; /* Cut argv[0] */
+ /* Omit shell and start at first argument */
+ p = strpbrk(shell, " \t");
+ *p++ = NULL; /* Cut arguments (for execvp), jump to next char */
+ for (ap = &av[1]; (*ap = strsep(&p, " \t")) != NULL; )
+ if (**ap != NULL) ap++;
+ }
+ execvp(shell, av);
+ #else
execlp(shell, tbuf, 0);
+ #endif
err(1, "%s", shell);
}
============= Cut here ==============
--
Vladimir Litovka <doka@grunt.vl.net.ua>, hostmaster of vl.net.ua
---------------- Don't trouble trouble until trouble troubles you
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?68o1lf$ivu$1>
