[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: busybox su does not update $USER and $LOGNAME
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2009-05-27 22:39:48
Message-ID: 200905280039.48437.vda.linux () googlemail ! com
[Download RAW message or body]

On Wednesday 27 May 2009 18:29, Pascal Bellard wrote:
> busybox su does not update $USER and $LOGNAME.
> 
> The fix:
> http://hg.slitaz.org/wok/rawfile/tip/busybox/stuff/busybox-1.12.0-su.u
> 
> --- busybox-1.12.0/libbb/setup_environment.c
> +++ busybox-1.12.0/libbb/setup_environment.c
> @@ -59,7 +59,7 @@
>         else if (change_env) {
>                 /* Set HOME, SHELL, and if not becoming a super-user,
>                    USER and LOGNAME.  */
> -               if (pw->pw_uid) {
> +               if (!pw->pw_uid) {
>   shortcut:
>                         xsetenv("USER",    pw->pw_name);
>                         xsetenv("LOGNAME", pw->pw_name);

But, Pascal, the comment says that this is intended.
$USER and $LOGNAME are set if we su'ing to non-root,
IOW, if pw->pw_uid != 0. That's what code does.

Is comment wrong too? Which version of su is known to
do it differently?
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic