Deleted Added
full compact
pw_conf.c (20747) pw_conf.c (21330)
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: pw_conf.c,v 1.1.1.2 1996/12/10 23:59:00 joerg Exp $
26 * $Id: pw_conf.c,v 1.2 1996/12/21 15:35:42 davidn Exp $
27 */
28
29#include <string.h>
30#include <ctype.h>
31#include <fcntl.h>
32
33#include "pw.h"
34#include "pwupd.h"
35
36#define debugging 0
37
38enum {
39 _UC_NONE,
40 _UC_DEFAULTPWD,
41 _UC_REUSEUID,
42 _UC_REUSEGID,
27 */
28
29#include <string.h>
30#include <ctype.h>
31#include <fcntl.h>
32
33#include "pw.h"
34#include "pwupd.h"
35
36#define debugging 0
37
38enum {
39 _UC_NONE,
40 _UC_DEFAULTPWD,
41 _UC_REUSEUID,
42 _UC_REUSEGID,
43 _UC_NISPASSWD,
43 _UC_DOTDIR,
44 _UC_NEWMAIL,
45 _UC_LOGFILE,
46 _UC_HOMEROOT,
47 _UC_SHELLPATH,
48 _UC_SHELLS,
49 _UC_DEFAULTSHELL,
50 _UC_DEFAULTGROUP,

--- 25 unchanged lines hidden (view full) ---

76 "no", "false", "0", "off", NULL
77};
78
79static struct userconf config =
80{
81 0, /* Default password for new users? (nologin) */
82 0, /* Reuse uids? */
83 0, /* Reuse gids? */
44 _UC_DOTDIR,
45 _UC_NEWMAIL,
46 _UC_LOGFILE,
47 _UC_HOMEROOT,
48 _UC_SHELLPATH,
49 _UC_SHELLS,
50 _UC_DEFAULTSHELL,
51 _UC_DEFAULTGROUP,

--- 25 unchanged lines hidden (view full) ---

77 "no", "false", "0", "off", NULL
78};
79
80static struct userconf config =
81{
82 0, /* Default password for new users? (nologin) */
83 0, /* Reuse uids? */
84 0, /* Reuse gids? */
85 NULL, /* NIS version of the passwd file */
84 "/usr/share/skel", /* Where to obtain skeleton files */
85 NULL, /* Mail to send to new accounts */
86 "/var/log/userlog", /* Where to log changes */
87 "/home", /* Where to create home directory */
88 "/bin", /* Where shells are located */
89 system_shells, /* List of shells (first is default) */
90 bourne_shell, /* Default shell */
91 NULL, /* Default group name */

--- 6 unchanged lines hidden (view full) ---

98};
99
100static char const *comments[_UC_FIELDS] =
101{
102 "#\n# pw.conf - user/group configuration defaults\n#\n",
103 "\n# Password for new users? no=nologin yes=loginid none=blank random=random\n",
104 "\n# Reuse gaps in uid sequence? (yes or no)\n",
105 "\n# Reuse gaps in gid sequence? (yes or no)\n",
86 "/usr/share/skel", /* Where to obtain skeleton files */
87 NULL, /* Mail to send to new accounts */
88 "/var/log/userlog", /* Where to log changes */
89 "/home", /* Where to create home directory */
90 "/bin", /* Where shells are located */
91 system_shells, /* List of shells (first is default) */
92 bourne_shell, /* Default shell */
93 NULL, /* Default group name */

--- 6 unchanged lines hidden (view full) ---

100};
101
102static char const *comments[_UC_FIELDS] =
103{
104 "#\n# pw.conf - user/group configuration defaults\n#\n",
105 "\n# Password for new users? no=nologin yes=loginid none=blank random=random\n",
106 "\n# Reuse gaps in uid sequence? (yes or no)\n",
107 "\n# Reuse gaps in gid sequence? (yes or no)\n",
108 "\n# Path to the NIS passwd file (blank or 'no' for none)\n",
106 "\n# Obtain default dotfiles from this directory\n",
107 "\n# Mail this file to new user (/etc/newuser.msg or no)\n",
108 "\n# Log add/change/remove information in this file\n",
109 "\n# Root directory in which $HOME directory is created\n",
110 "\n# Colon separated list of directories containing valid shells\n",
111 "\n# Space separated list of available shells (without paths)\n",
112 "\n# Default shell (without path)\n",
113 "\n# Default group (leave blank for new group per user)\n",

--- 8 unchanged lines hidden (view full) ---

122};
123
124static char const *kwds[] =
125{
126 "",
127 "defaultpasswd",
128 "reuseuids",
129 "reusegids",
109 "\n# Obtain default dotfiles from this directory\n",
110 "\n# Mail this file to new user (/etc/newuser.msg or no)\n",
111 "\n# Log add/change/remove information in this file\n",
112 "\n# Root directory in which $HOME directory is created\n",
113 "\n# Colon separated list of directories containing valid shells\n",
114 "\n# Space separated list of available shells (without paths)\n",
115 "\n# Default shell (without path)\n",
116 "\n# Default group (leave blank for new group per user)\n",

--- 8 unchanged lines hidden (view full) ---

125};
126
127static char const *kwds[] =
128{
129 "",
130 "defaultpasswd",
131 "reuseuids",
132 "reusegids",
133 "nispasswd",
130 "skeleton",
131 "newmail",
132 "logfile",
133 "home",
134 "shellpath",
135 "shells",
136 "defaultshell",
137 "defaultgroup",

--- 123 unchanged lines hidden (view full) ---

261 config.default_password = boolean_val(q, 1);
262 break;
263 case _UC_REUSEUID:
264 config.reuse_uids = boolean_val(q, 0);
265 break;
266 case _UC_REUSEGID:
267 config.reuse_gids = boolean_val(q, 0);
268 break;
134 "skeleton",
135 "newmail",
136 "logfile",
137 "home",
138 "shellpath",
139 "shells",
140 "defaultshell",
141 "defaultgroup",

--- 123 unchanged lines hidden (view full) ---

265 config.default_password = boolean_val(q, 1);
266 break;
267 case _UC_REUSEUID:
268 config.reuse_uids = boolean_val(q, 0);
269 break;
270 case _UC_REUSEGID:
271 config.reuse_gids = boolean_val(q, 0);
272 break;
273 case _UC_NISPASSWD:
274 config.nispasswd = (q == NULL || !boolean_val(q, 1))
275 ? NULL : newstr(q);
276 break;
269 case _UC_DOTDIR:
270 config.dotdir = (q == NULL || !boolean_val(q, 1))
271 ? NULL : newstr(q);
272 break;
273 case _UC_NEWMAIL:
274 config.newmail = (q == NULL || !boolean_val(q, 1))
275 ? NULL : newstr(q);
276 break;

--- 102 unchanged lines hidden (view full) ---

379 val = boolean_str(config.default_password);
380 break;
381 case _UC_REUSEUID:
382 val = boolean_str(config.reuse_uids);
383 break;
384 case _UC_REUSEGID:
385 val = boolean_str(config.reuse_gids);
386 break;
277 case _UC_DOTDIR:
278 config.dotdir = (q == NULL || !boolean_val(q, 1))
279 ? NULL : newstr(q);
280 break;
281 case _UC_NEWMAIL:
282 config.newmail = (q == NULL || !boolean_val(q, 1))
283 ? NULL : newstr(q);
284 break;

--- 102 unchanged lines hidden (view full) ---

387 val = boolean_str(config.default_password);
388 break;
389 case _UC_REUSEUID:
390 val = boolean_str(config.reuse_uids);
391 break;
392 case _UC_REUSEGID:
393 val = boolean_str(config.reuse_gids);
394 break;
395 case _UC_NISPASSWD:
396 val = config.nispasswd ? config.nispasswd : "";
397 quote = 0;
398 break;
387 case _UC_DOTDIR:
388 val = config.dotdir ? config.dotdir : boolean_str(0);
389 break;
390 case _UC_NEWMAIL:
391 val = config.newmail ? config.newmail : boolean_str(0);
392 break;
393 case _UC_LOGFILE:
394 val = config.logfile ? config.logfile : boolean_str(0);

--- 86 unchanged lines hidden ---
399 case _UC_DOTDIR:
400 val = config.dotdir ? config.dotdir : boolean_str(0);
401 break;
402 case _UC_NEWMAIL:
403 val = config.newmail ? config.newmail : boolean_str(0);
404 break;
405 case _UC_LOGFILE:
406 val = config.logfile ? config.logfile : boolean_str(0);

--- 86 unchanged lines hidden ---