* src/newusers.c: Initially set the passwd's password to '*'

instead of 'x'. Only when it is confirmed that a shadow entry is
	(will be) added, set the passwd's password to 'x'.
	* src/newusers.c: An invalid line is an error. A failure needs to
	be reported.
This commit is contained in:
nekral-guest 2011-09-18 17:29:52 +00:00
parent a52a8d8a5d
commit 7b0116c5b4
2 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2011-09-18 Nicolas François <nicolas.francois@centraliens.net>
* src/newusers.c: Initially set the passwd's password to '*'
instead of 'x'. Only when it is confirmed that a shadow entry is
(will be) added, set the passwd's password to 'x'.
* src/newusers.c: An invalid line is an error. A failure needs to
be reported.
2011-09-18 Nicolas François <nicolas.francois@centraliens.net> 2011-09-18 Nicolas François <nicolas.francois@centraliens.net>
* src/gpasswd.c: Remove log_gpasswd_success_gshadow(). Writing in * src/gpasswd.c: Remove log_gpasswd_success_gshadow(). Writing in

View File

@ -2,7 +2,7 @@
* Copyright (c) 1990 - 1993, Julianne Frances Haugh * Copyright (c) 1990 - 1993, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz * Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2000 - 2006, Tomasz Kłoczko * Copyright (c) 2000 - 2006, Tomasz Kłoczko
* Copyright (c) 2007 - 2009, Nicolas François * Copyright (c) 2007 - 2011, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -268,7 +268,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
return -1; return -1;
} }
grent.gr_passwd = "x"; /* XXX warning: const */ grent.gr_passwd = "*"; /* XXX warning: const */
members[0] = NULL; members[0] = NULL;
grent.gr_mem = members; grent.gr_mem = members;
@ -287,16 +287,13 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
} }
#endif #endif
if (gr_update (&grent) == 0) {
return -1;
}
#ifdef SHADOWGRP #ifdef SHADOWGRP
if (is_shadow_grp) { if (is_shadow_grp) {
struct sgrp sgrent; struct sgrp sgrent;
char *admins[1]; char *admins[1];
sgrent.sg_name = grent.gr_name; sgrent.sg_name = grent.gr_name;
sgrent.sg_passwd = "*"; /* XXX warning: const */ sgrent.sg_passwd = "*"; /* XXX warning: const */
grent.gr_passwd = "x"; /* XXX warning: const */
admins[0] = NULL; admins[0] = NULL;
sgrent.sg_adm = admins; sgrent.sg_adm = admins;
sgrent.sg_mem = members; sgrent.sg_mem = members;
@ -307,6 +304,10 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
} }
#endif #endif
if (gr_update (&grent) == 0) {
return -1;
}
return 0; return 0;
} }
@ -890,6 +891,7 @@ int main (int argc, char **argv)
if (nfields != 6) { if (nfields != 6) {
fprintf (stderr, _("%s: line %d: invalid line\n"), fprintf (stderr, _("%s: line %d: invalid line\n"),
Prog, line); Prog, line);
errors++
continue; continue;
} }