Index: pw.conf.5 =================================================================== RCS file: /home/dcvs/src/usr.sbin/pw/pw.conf.5,v retrieving revision 1.2 diff -u -r1.2 pw.conf.5 --- pw.conf.5 17 Jun 2003 04:30:01 -0000 1.2 +++ pw.conf.5 19 Mar 2006 19:25:05 -0000 @@ -99,6 +99,8 @@ days after which account expires .It password_days days after which password expires +.It createmailbox +create mailbox for new users .El .Pp Valid values for @@ -281,6 +283,15 @@ .Ql \&0 in either field will disable the corresponding (account or password) expiration date. +.Pp +The +.Ar createmailbox +option is used when creating new account. +If enabled then user mailbox will be created unless +.Fl V +command line option was also specified. +Contents of an already existing mail file are preserved. +The default value for this option is yes. .Sh LIMITS The maximum line length of .Pa /etc/pw.conf Index: pw.h =================================================================== RCS file: /home/dcvs/src/usr.sbin/pw/pw.h,v retrieving revision 1.3 diff -u -r1.3 pw.h --- pw.h 7 May 2005 23:42:39 -0000 1.3 +++ pw.h 19 Mar 2006 18:32:08 -0000 @@ -92,6 +92,7 @@ gid_t min_gid, max_gid; /* Allowed range of gids */ int expire_days; /* Days to expiry */ int password_days; /* Days to password expiry */ + int create_mailbox; /* Create mailbox for new account? */ int numgroups; /* (internal) size of default_group array */ }; Index: pw_conf.c =================================================================== RCS file: /home/dcvs/src/usr.sbin/pw/pw_conf.c,v retrieving revision 1.2 diff -u -r1.2 pw_conf.c --- pw_conf.c 17 Jun 2003 04:30:02 -0000 1.2 +++ pw_conf.c 19 Mar 2006 18:33:18 -0000 @@ -57,6 +57,7 @@ _UC_MAXGID, _UC_EXPIRE, _UC_PASSWORD, + _UC_MAILBOX, _UC_FIELDS }; @@ -98,6 +99,7 @@ 1000, 32000, /* Allowed range of gids */ 0, /* Days until account expires */ 0, /* Days until password expires */ + 1, /* Create mailbox for new account */ 0 /* size of default_group array */ }; @@ -123,7 +125,8 @@ "\n# Range of valid default group ids\n", NULL, "\n# Days after which account expires (0=disabled)\n", - "\n# Days after which password expires (0=disabled)\n" + "\n# Days after which password expires (0=disabled)\n", + "\n# Create mailbox for new account? (yes or no)\n" }; static char const *kwds[] = @@ -149,6 +152,7 @@ "maxgid", "expire_days", "password_days", + "createmailbox", NULL }; @@ -349,6 +353,9 @@ if ((q = unquote(q)) != NULL && isdigit(*q)) config.password_days = atoi(q); break; + case _UC_MAILBOX: + config.create_mailbox = boolean_val(q, 1); + break; case _UC_FIELDS: case _UC_NONE: break; @@ -470,6 +477,9 @@ sprintf(buf, "%d", config.password_days); quote = 0; break; + case _UC_MAILBOX: + val = boolean_str(config.create_mailbox); + break; case _UC_NONE: break; } Index: pw_user.c =================================================================== RCS file: /home/dcvs/src/usr.sbin/pw/pw_user.c,v retrieving revision 1.4 diff -u -r1.4 pw_user.c --- pw_user.c 30 Nov 2004 20:12:21 -0000 1.4 +++ pw_user.c 19 Mar 2006 18:33:33 -0000 @@ -728,7 +728,7 @@ * doesn't hurt anything to create the empty mailfile */ if (mode == M_ADD) { - if (!PWALTDIR()) { + if (!PWALTDIR() && cnf->create_mailbox) { sprintf(line, "%s/%s", _PATH_MAILDIR, pwd->pw_name); close(open(line, O_RDWR | O_CREAT, 0600)); /* Preserve contents & * mtime */