[Pkg-shadow-commits] r2341 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Wed Sep 3 21:22:05 UTC 2008
Author: nekral-guest
Date: 2008-09-03 21:22:04 +0000 (Wed, 03 Sep 2008)
New Revision: 2341
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/userdel.c
Log:
* src/userdel.c: Log failures to remove the mailbox to syslog and
audit.
* src/userdel.c: Log successful removal of home directory to audit
only in case of success.
* src/userdel.c: Move the audit log of failure to remove the home
directory before the call to function that may exit.
* src/userdel.c: Document that errors is only used to count errors
during the removal of the home directory.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-09-03 21:02:32 UTC (rev 2340)
+++ upstream/trunk/ChangeLog 2008-09-03 21:22:04 UTC (rev 2341)
@@ -1,5 +1,16 @@
2008-09-03 Nicolas François <nicolas.francois at centraliens.net>
+ * src/userdel.c: Log failures to remove the mailbox to syslog and
+ audit.
+ * src/userdel.c: Log successful removal of home directory to audit
+ only in case of success.
+ * src/userdel.c: Move the audit log of failure to remove the home
+ directory before the call to function that may exit.
+ * src/userdel.c: Document that errors is only used to count errors
+ during the removal of the home directory.
+
+2008-09-03 Nicolas François <nicolas.francois at centraliens.net>
+
* src/useradd.c: Log errors to syslog in grp_update() since
changes have started to be reported to syslog.
* src/userdel.c: Fix some result parameters sent to
Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c 2008-09-03 21:02:32 UTC (rev 2340)
+++ upstream/trunk/src/userdel.c 2008-09-03 21:22:04 UTC (rev 2341)
@@ -695,12 +695,24 @@
}
snprintf (mailfile, sizeof mailfile, "%s/%s", maildir, user_name);
if (fflg) {
- unlink (mailfile); /* always remove, ignore errors */
+ if (unlink (mailfile) != 0) {
+ fprintf (stderr, _("%s: warning: can't remove %s: %s"), Prog, mailfile, strerror (errno));
+ SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
#ifdef WITH_AUDIT
- audit_logger (AUDIT_DEL_USER, Prog,
- "deleting mail file",
- user_name, (unsigned int) user_id, 1);
+ audit_logger (AUDIT_DEL_USER, Prog,
+ "deleting mail file",
+ user_name, (unsigned int) user_id, 0);
#endif
+ /* continue */
+ }
+#ifdef WITH_AUDIT
+ else
+ {
+ audit_logger (AUDIT_DEL_USER, Prog,
+ "deleting mail file",
+ user_name, (unsigned int) user_id, 1);
+ }
+#endif
return;
}
i = is_owner (user_id, mailfile);
@@ -729,7 +741,8 @@
/* continue */
}
#ifdef WITH_AUDIT
- else {
+ else
+ {
audit_logger (AUDIT_DEL_USER, Prog,
"deleting mail file",
user_name, (unsigned int) user_id, 1);
@@ -742,7 +755,7 @@
*/
int main (int argc, char **argv)
{
- int errors = 0;
+ int errors = 0; /* Error in the removal of the home directory */
#ifdef USE_PAM
pam_handle_t *pamh = NULL;
@@ -891,6 +904,7 @@
Prog, user_home, user_name);
rflg = 0;
errors++;
+ /* continue */
}
#ifdef EXTRA_CHECK_HOME_DIR
@@ -916,6 +930,7 @@
Prog, user_home, pwd->pw_name);
rflg = false;
errors++;
+ /* continue */
break;
}
}
@@ -928,19 +943,25 @@
fprintf (stderr,
_("%s: error removing directory %s\n"),
Prog, user_home);
+ errors++;
+ /* continue */
+ }
#ifdef WITH_AUDIT
+ else
+ {
audit_logger (AUDIT_DEL_USER, Prog,
"deleting home directory",
- user_name, (unsigned int) user_id, 0);
+ user_name, (unsigned int) user_id, 1);
+ }
#endif
- errors++;
- }
+ }
#ifdef WITH_AUDIT
+ if (0 != errors) {
audit_logger (AUDIT_DEL_USER, Prog,
"deleting home directory",
- user_name, (unsigned int) user_id, 1);
+ user_name, AUDIT_NO_ID, 0);
+ }
#endif
- }
/*
* Cancel any crontabs or at jobs. Have to do this before we remove
@@ -955,13 +976,6 @@
#ifdef USE_PAM
(void) pam_end (pamh, PAM_SUCCESS);
#endif /* USE_PAM */
-#ifdef WITH_AUDIT
- if (0 != errors) {
- audit_logger (AUDIT_DEL_USER, Prog,
- "deleting home directory",
- user_name, AUDIT_NO_ID, 0);
- }
-#endif
exit ((0 != errors) ? E_HOMEDIR : E_SUCCESS);
/* NOT REACHED */
}
More information about the Pkg-shadow-commits
mailing list