Merge pull request #450 from lnussel/master
useradd: assume uid 0 == root as fallback
This commit is contained in:
commit
535f54076c
@ -2507,14 +2507,14 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct passwd *pampw;
|
struct passwd *pampw;
|
||||||
pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
|
pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
|
||||||
if (pampw == NULL) {
|
if (pampw == NULL && getuid ()) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: Cannot determine your user name.\n"),
|
_("%s: Cannot determine your user name.\n"),
|
||||||
Prog);
|
Prog);
|
||||||
fail_exit (1);
|
fail_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = pam_start ("useradd", pampw->pw_name, &conv, &pamh);
|
retval = pam_start ("useradd", pampw?pampw->pw_name:"root", &conv, &pamh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PAM_SUCCESS == retval) {
|
if (PAM_SUCCESS == retval) {
|
||||||
|
Loading…
Reference in New Issue
Block a user