[Pkg-shadow-commits] r3576 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Nov 13 16:24:57 UTC 2011
Author: nekral-guest
Date: 2011-11-13 16:24:57 +0000 (Sun, 13 Nov 2011)
New Revision: 3576
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/chage.c
upstream/trunk/src/chfn.c
upstream/trunk/src/chgpasswd.c
upstream/trunk/src/chpasswd.c
upstream/trunk/src/chsh.c
upstream/trunk/src/groupadd.c
upstream/trunk/src/groupdel.c
upstream/trunk/src/groupmems.c
upstream/trunk/src/groupmod.c
upstream/trunk/src/newusers.c
upstream/trunk/src/useradd.c
upstream/trunk/src/userdel.c
upstream/trunk/src/usermod.c
Log:
* 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.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/ChangeLog 2011-11-13 16:24:57 UTC (rev 3576)
@@ -1,3 +1,17 @@
+2011-11-12 Nicolas François <nicolas.francois at centraliens.net>
+
+ * 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.
+
2011-11-11 Nicolas François <nicolas.francois at centraliens.net>
* src/pwck.c: Removed pw_opened.
Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/chage.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -556,13 +556,16 @@
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 (E_NOPERM);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
}
Modified: upstream/trunk/src/chfn.c
===================================================================
--- upstream/trunk/src/chfn.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/chfn.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -416,13 +416,16 @@
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);
+ }
exit (E_NOPERM);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
}
Modified: upstream/trunk/src/chgpasswd.c
===================================================================
--- upstream/trunk/src/chgpasswd.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/chgpasswd.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -286,13 +286,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
}
Modified: upstream/trunk/src/chpasswd.c
===================================================================
--- upstream/trunk/src/chpasswd.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/chpasswd.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -283,13 +283,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* ACCT_TOOLS_SETUID */
#endif /* USE_PAM */
}
Modified: upstream/trunk/src/chsh.c
===================================================================
--- upstream/trunk/src/chsh.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/chsh.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -325,13 +325,16 @@
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);
+ }
exit (E_NOPERM);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
}
Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/groupadd.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -549,13 +549,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
}
Modified: upstream/trunk/src/groupdel.c
===================================================================
--- upstream/trunk/src/groupdel.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/groupdel.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -407,13 +407,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
Modified: upstream/trunk/src/groupmems.c
===================================================================
--- upstream/trunk/src/groupmems.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/groupmems.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -379,7 +379,7 @@
(void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
(void) fputs (_(" -p, --purge purge all members from the group\n"), usageout);
(void) fputs (_(" -l, --list list the members of the group\n"), usageout);
- fail_exit (status);
+ exit (status);
}
/*
@@ -471,13 +471,16 @@
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 (1);
}
+ (void) pam_end (pamh, retval);
#endif
}
}
Modified: upstream/trunk/src/groupmod.c
===================================================================
--- upstream/trunk/src/groupmod.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/groupmod.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -784,13 +784,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
Modified: upstream/trunk/src/newusers.c
===================================================================
--- upstream/trunk/src/newusers.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/newusers.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -584,6 +584,11 @@
}
}
+ 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 @@
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 @@
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",
Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/useradd.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -1519,7 +1519,11 @@
{
memzero (grent, sizeof *grent);
grent->gr_name = (char *) user_name;
- grent->gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
+ if (is_shadow_grp) {
+ grent->gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
+ } else {
+ grent->gr_passwd = "!"; /* XXX warning: const */
+ }
grent->gr_gid = user_gid;
grent->gr_mem = &empty_list;
}
@@ -1929,13 +1933,16 @@
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 (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/userdel.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -923,13 +923,16 @@
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);
+ }
exit (E_PW_UPDATE);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c 2011-11-13 16:24:49 UTC (rev 3575)
+++ upstream/trunk/src/usermod.c 2011-11-13 16:24:57 UTC (rev 3576)
@@ -1849,13 +1849,16 @@
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);
+ }
exit (1);
}
+ (void) pam_end (pamh, retval);
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
More information about the Pkg-shadow-commits
mailing list