mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
adduser: don't bomb out if shadow password file doesn't exist
(from Tito <farmatito@tiscali.it>)
This commit is contained in:
parent
219d14d514
commit
7695328575
@ -109,11 +109,13 @@ static int adduser(struct passwd *p)
|
||||
if (putpwent(p, file) == -1) {
|
||||
bb_perror_nomsg_and_die();
|
||||
}
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
fclose(file);
|
||||
|
||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
/* add to shadow if necessary */
|
||||
file = xfopen(bb_path_shadow_file, "a");
|
||||
file = fopen_or_warn(bb_path_shadow_file, "a");
|
||||
if (file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
fprintf(file, "%s:!:%ld:%d:%d:%d:::\n",
|
||||
p->pw_name, /* username */
|
||||
@ -121,7 +123,9 @@ static int adduser(struct passwd *p)
|
||||
0, /* sp->sp_min */
|
||||
99999, /* sp->sp_max */
|
||||
7); /* sp->sp_warn */
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
fclose(file);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* add to group */
|
||||
|
Loading…
Reference in New Issue
Block a user