busybox su does not update $USER and $LOGNAME

Denys Vlasenko vda.linux at googlemail.com
Wed May 27 22:39:48 UTC 2009


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


More information about the busybox mailing list