From owner-freebsd-hackers Sun Jan 4 06:09:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA29757 for hackers-outgoing; Sun, 4 Jan 1998 06:09:57 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from grunt.vl.net.ua (daemon@grunt.vl.net.ua [193.124.76.209]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id GAA29485 for ; Sun, 4 Jan 1998 06:04:36 -0800 (PST) (envelope-from news@grunt.vl.net.ua) Received: from news by grunt.vl.net.ua with local (Exim 1.73 #1) id 0xopnc-00053r-00; Sun, 4 Jan 1998 15:09:04 +0200 To: freebsd-hackers@FreeBSD.ORG Subject: diff: Additional login capability Date: 4 Jan 1998 15:09:03 +0200 Message-ID: <68o1lf$ivu$1@grunt.vl.net.ua> X-Newsreader: TIN [UNIX 1.3 unoff BETA 970930; i386 FreeBSD 2.2.5-STABLE] X-Via: News-To-Mail v1.0 From: Vladimir Litovka Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk 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 + 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 , hostmaster of vl.net.ua ---------------- Don't trouble trouble until trouble troubles you