[Pkg-shadow-devel] Bug#347747: su: 'su - user cmd' doesn't read startup files anymore

Jan C. Nordholz jckn at gmx.net
Thu Jan 12 12:45:46 UTC 2006


Package: login
Version: 4.0.14-1
Severity: normal

Dear maintainers,

from bash's source, shell.c:

]  /* A non-interactive shell not named `sh' and not in posix mode reads and
]     executes commands from $BASH_ENV.  If `su' starts a shell with `-c cmd'
]     and `-su' as the name of the shell, we want to read the startup files.
]     No other non-interactive shells read any startup files. */

This was the case prior to 4.0.14: (tested on 4.0.13-7)

] s10:~# strace -eexecve,setuid32 -f su - backup echo \$SHELL
] execve("/bin/su", ["su", "-", "backup", "echo", "$SHELL"], [/* 18 vars */]) = 0
] setuid32(34)                            = 0
] execve("/bin/sh", ["-su", "-c", "echo $SHELL"], [/* 8 vars */]) = 0
]                    ^^^^^
] ...

Present behaviour:

] root at hejre:/home/jcn# strace -f -eexecve,setuid32 su - jcn echo \$SHELL
] execve("/bin/su", ["su", "-", "jcn", "echo", "$SHELL"], [/* 25 vars */]) = 0
] setuid32(1000)                          = 0
] Process 23014 attached (waiting for parent)
] Process 23014 resumed (parent 23013 ready)
] Process 23013 suspended
] [pid 23014] execve("/bin/bash", ["/bin/bash", "-c", "echo $SHELL"], [/* 8 vars */]) = 0
]                                  ^^^^^^^^^^^
] ...

This results in, among other things, $PATH being set to the wrong directory list.


Regards,

Jan

-- 
Jan C. Nordholz
<jckn At gmx net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/attachments/20060112/d9b2d584/attachment.pgp


More information about the Pkg-shadow-devel mailing list