Project

General

Profile

Bug #117 ยป pw-createmailbox.patch

belczyk, 03/19/2006 08:08 PM

View differences:

pw.conf.5 19 Mar 2006 19:25:05 -0000
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
......
.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
pw.h 19 Mar 2006 18:32:08 -0000
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 */
};
pw_conf.c 19 Mar 2006 18:33:18 -0000
_UC_MAXGID,
_UC_EXPIRE,
_UC_PASSWORD,
_UC_MAILBOX,
_UC_FIELDS
};
......
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 */
};
......
"\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[] =
......
"maxgid",
"expire_days",
"password_days",
"createmailbox",
NULL
};
......
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;
......
sprintf(buf, "%d", config.password_days);
quote = 0;
break;
case _UC_MAILBOX:
val = boolean_str(config.create_mailbox);
break;
case _UC_NONE:
break;
}
pw_user.c 19 Mar 2006 18:33:33 -0000
* 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 */
    (1-1/1)