* src/chage.c, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,

src/chsh.c, src/groupadd.c, src/groupdel.c, src/groupmems.c,
	src/groupmod.c, src/newusers.c, src/useradd.c, src/userdel.c,
	src/usermod.c: Provide the PAM error
	message instead of our own, and log error to syslog.
	* src/groupmems.c: Exit with exit rather than fail_exit in usage().
	* src/newusers.c: Check the number of arguments.
	* src/newusers.c: Do not create the home directory when it is not
	changed.
	* src/useradd.c: Set the group password to "!" rather "x" if there
	are no gshadow file.
This commit is contained in:
nekral-guest
2011-11-13 16:24:57 +00:00
parent 2ecea675ee
commit 57f9d5ae9c
14 changed files with 117 additions and 55 deletions

View File

@ -584,6 +584,11 @@ static void process_flags (int argc, char **argv)
}
}
if ( (optind != argc)
&& (optind + 1 != argc)) {
usage (EXIT_FAILURE);
}
if (argv[optind] != NULL) {
if (freopen (argv[optind], "r", stdin) == NULL) {
char buf[BUFSIZ];
@ -668,13 +673,16 @@ static void check_perms (void)
retval = pam_acct_mgmt (pamh, 0);
}
if (NULL != pamh) {
(void) pam_end (pamh, retval);
}
if (PAM_SUCCESS != retval) {
fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
fprintf (stderr, _("%s: PAM: %s\n"),
Prog, pam_strerror (pamh, retval));
SYSLOG((LOG_ERR, "%s", pam_strerror (pamh, retval)));
if (NULL != pamh) {
(void) pam_end (pamh, retval);
}
fail_exit (EXIT_FAILURE);
}
(void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
}
@ -1006,7 +1014,7 @@ int main (int argc, char **argv)
newpw.pw_shell = fields[6];
}
if ( ('\0' != newpw.pw_dir[0])
if ( ('\0' != fields[5][0])
&& (access (newpw.pw_dir, F_OK) != 0)) {
/* FIXME: should check for directory */
mode_t msk = 0777 & ~getdef_num ("UMASK",