[Pkg-shadow-commits] r3333 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sat Jun 4 22:38:57 UTC 2011
Author: nekral-guest
Date: 2011-06-04 22:38:57 +0000 (Sat, 04 Jun 2011)
New Revision: 3333
Modified:
upstream/trunk/ChangeLog
upstream/trunk/NEWS
upstream/trunk/src/userdel.c
Log:
* NEWS, src/userdel.c: Check the existence of the user's mail
spool before trying to remove it. If it does not exist, a warning
is issued, but no failure.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-06-04 22:27:17 UTC (rev 3332)
+++ upstream/trunk/ChangeLog 2011-06-04 22:38:57 UTC (rev 3333)
@@ -1,3 +1,9 @@
+2011-06-04 Nicolas François <nicolas.francois at centraliens.net>
+
+ * NEWS, src/userdel.c: Check the existence of the user's mail
+ spool before trying to remove it. If it does not exist, a warning
+ is issued, but no failure.
+
2011-06-03 Nicolas François <nicolas.francois at centraliens.net>
* src/sulogin.c: Added Prog, needed because of the last xmalloc()
Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS 2011-06-04 22:27:17 UTC (rev 3332)
+++ upstream/trunk/NEWS 2011-06-04 22:38:57 UTC (rev 3333)
@@ -44,6 +44,9 @@
- useradd
* If the skeleton directory contained hardlinked files, copies of the
hardlink were removed from the skeleton directory.
+- userdel
+ * Check the existence of the user's mail spool before trying to remove
+ it. If it does not exist, a warning is issued, but no failure.
- usermod
* Accept options in any order (username not necessarily at the end)
Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c 2011-06-04 22:27:17 UTC (rev 3332)
+++ upstream/trunk/src/userdel.c 2011-06-04 22:38:57 UTC (rev 3333)
@@ -2,7 +2,7 @@
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2000 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2010, Nicolas François
+ * Copyright (c) 2007 - 2011, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -668,6 +668,28 @@
return 0;
}
snprintf (mailfile, sizeof mailfile, "%s/%s", maildir, user_name);
+
+ if (access (mailfile, F_OK) != 0) {
+ if (ENOENT == errno) {
+ fprintf (stderr,
+ _("%s: %s mail spool (%s) not found\n"),
+ Prog, user_name, user_home);
+ return 0;
+ } else {
+ fprintf (stderr,
+ _("%s: warning: can't remove %s: %s\n"),
+ 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,
+ SHADOW_AUDIT_FAILURE);
+#endif /* WITH_AUDIT */
+ return -1;
+ }
+ }
+
if (fflg) {
if (unlink (mailfile) != 0) {
fprintf (stderr,
More information about the Pkg-shadow-commits
mailing list