pw-createmailbox.patch

belczyk, 03/19/2006 08:08 PM

Download (3.46 KB)

View differences:

pw.conf.5 19 Mar 2006 19:25:05 -0000
99 99
days after which account expires
100 100
.It password_days
101 101
days after which password expires
102
.It createmailbox
103
create mailbox for new users
102 104
.El
103 105
.Pp
104 106
Valid values for
......
281 283
.Ql \&0
282 284
in either field will disable the corresponding (account or password)
283 285
expiration date.
286
.Pp
287
The
288
.Ar createmailbox
289
option is used when creating new account.
290
If enabled then user mailbox will be created unless 
291
.Fl V
292
command line option was also specified.
293
Contents of an already existing mail file are preserved.
294
The default value for this option is yes.
284 295
.Sh LIMITS
285 296
The maximum line length of
286 297
.Pa /etc/pw.conf
pw.h 19 Mar 2006 18:32:08 -0000
92 92
	gid_t	min_gid, max_gid;	/* Allowed range of gids */
93 93
	int	expire_days;		/* Days to expiry */
94 94
	int	password_days;		/* Days to password expiry */
95
	int	create_mailbox;		/* Create mailbox for new account? */
95 96
	int	numgroups;		/* (internal) size of default_group array */
96 97
};
97 98

  
pw_conf.c 19 Mar 2006 18:33:18 -0000
57 57
	_UC_MAXGID,
58 58
	_UC_EXPIRE,
59 59
	_UC_PASSWORD,
60
	_UC_MAILBOX,
60 61
	_UC_FIELDS
61 62
};
62 63

  
......
98 99
	1000, 32000,		/* Allowed range of gids */
99 100
	0,			/* Days until account expires */
100 101
	0,			/* Days until password expires */
102
	1,			/* Create mailbox for new account */
101 103
	0			/* size of default_group array */
102 104
};
103 105

  
......
123 125
	"\n# Range of valid default group ids\n",
124 126
	NULL,
125 127
	"\n# Days after which account expires (0=disabled)\n",
126
	"\n# Days after which password expires (0=disabled)\n"
128
	"\n# Days after which password expires (0=disabled)\n",
129
	"\n# Create mailbox for new account? (yes or no)\n"
127 130
};
128 131

  
129 132
static char const *kwds[] =
......
149 152
	"maxgid",
150 153
	"expire_days",
151 154
	"password_days",
155
	"createmailbox",
152 156
	NULL
153 157
};
154 158

  
......
349 353
					if ((q = unquote(q)) != NULL && isdigit(*q))
350 354
						config.password_days = atoi(q);
351 355
					break;
356
				case _UC_MAILBOX:
357
					config.create_mailbox = boolean_val(q, 1);
358
					break;
352 359
				case _UC_FIELDS:
353 360
				case _UC_NONE:
354 361
					break;
......
470 477
					sprintf(buf, "%d", config.password_days);
471 478
					quote = 0;
472 479
					break;
480
				case _UC_MAILBOX:
481
					val = boolean_str(config.create_mailbox);
482
					break;
473 483
				case _UC_NONE:
474 484
					break;
475 485
				}
pw_user.c 19 Mar 2006 18:33:33 -0000
728 728
	 * doesn't hurt anything to create the empty mailfile
729 729
	 */
730 730
	if (mode == M_ADD) {
731
		if (!PWALTDIR()) {
731
		if (!PWALTDIR() && cnf->create_mailbox) {
732 732
			sprintf(line, "%s/%s", _PATH_MAILDIR, pwd->pw_name);
733 733
			close(open(line, O_RDWR | O_CREAT, 0600));	/* Preserve contents &
734 734
									 * mtime */