Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jan 1998 19:57:08 +1030
From:      Mike Smith <mike@smith.net.au>
To:        Vladimir Litovka <doka@grunt.vl.net.ua>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: diff: Additional login capability 
Message-ID:  <199801250927.TAA02416@word.smith.net.au>
In-Reply-To: Your message of "04 Jan 1998 15:09:03 %2B0200." <68o1lf$ivu$1@grunt.vl.net.ua> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
>  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:

Did anyone have any comments on this?  It looks basically sound modulo 
some style issues (and login is a cesspit in that regard anyway), and 
does indeed offer some value-add.

More to the point, if I commit a variant of this, who is going to 
complain?

(remainder of original post & diff follows).

> 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
> 

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\ 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801250927.TAA02416>