]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Removed hard-coded default mail spool in useradd 231/head
authorGeoffrey Krug <geofkrug@amazon.com>
Wed, 12 Feb 2020 20:21:21 +0000 (20:21 +0000)
committerGeoffrey Krug <geofkrug@amazon.com>
Wed, 11 Mar 2020 20:00:09 +0000 (20:00 +0000)
The useradd program should be consistent with userdel and usermod and use the
MAIL_SPOOL_DIR variable as the default spool, if it is defined. Otherwise,
don't create a new mailbox, because it won't be cleaned up by userdel when run
with the -r flag.

src/useradd.c

index 645d4a40f204a9142396bfaafb875a367a9e1e88..62c743795fed94e6aa3c00c308ddca286fe54173 100644 (file)
@@ -2203,8 +2203,13 @@ static void create_mail (void)
                mode_t mode;
 
                spool = getdef_str ("MAIL_DIR");
+#ifdef MAIL_SPOOL_DIR
+               if ((NULL == spool) && (getdef_str ("MAIL_FILE") == NULL)) {
+                       spool = MAIL_SPOOL_DIR;
+               }
+#endif /* MAIL_SPOOL_DIR */
                if (NULL == spool) {
-                       spool = "/var/mail";
+                       return;
                }
                file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 2);
                if(prefix[0])