usermgmt.h revision 1.3 1 /* $NetBSD: usermgmt.h,v 1.3 1999/12/08 18:22:54 hubertf Exp $ */
2
3 /*
4 * Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Alistair G. Crooks.
17 * 4. The name of the author may not be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 #ifndef USERMGMT_H_
34 #define USERMGMT_H_
35
36 #define CONFFILE "/etc/usermgmt.conf"
37
38 #define DEF_GROUP "other"
39 #define DEF_BASEDIR "/home"
40 #define DEF_SKELDIR "/etc/skel"
41 #define DEF_SHELL "/bin/csh"
42 #define DEF_COMMENT ""
43 #define DEF_LOWUID 1000
44 #define DEF_HIGHUID 60000
45 #define DEF_INACTIVE 0
46 #define DEF_EXPIRE (char *) NULL
47
48 #ifndef MASTER
49 #define MASTER "/etc/master.passwd"
50 #endif
51
52 #ifndef ETCGROUP
53 #define ETCGROUP "/etc/group"
54 #endif
55
56 #ifndef WAITSECS
57 #define WAITSECS 10
58 #endif
59
60 #ifndef NOBODY_UID
61 #define NOBODY_UID 32767
62 #endif
63
64 /* some useful constants */
65 enum {
66 MaxShellNameLen = 256,
67 MaxFileNameLen = MAXPATHLEN,
68 MaxUserNameLen = 32,
69 MaxFieldNameLen = 32,
70 MaxCommandLen = 2048,
71 MaxEntryLen = 2048,
72 PasswordLength = 13,
73
74 LowGid = 1000,
75 HighGid = 60000
76 };
77
78 /* Full paths of programs used here */
79 #define CHOWN "/usr/sbin/chown"
80 #define CP "/bin/cp"
81 #define FALSE_PROG "/usr/bin/false"
82 #define MKDIR "/bin/mkdir"
83 #define MV "/bin/mv"
84 #define RM "/bin/rm"
85
86 #define UNSET_EXPIRY "Null (unset)"
87
88 /* this struct describes a uid range */
89 typedef struct range_t {
90 int r_from; /* low uid */
91 int r_to; /* high uid */
92 } range_t;
93
94 /* this struct encapsulates the user information */
95 typedef struct user_t {
96 int u_uid; /* uid of user */
97 char *u_password; /* encrypted password */
98 char *u_comment; /* comment field */
99 int u_homeset; /* home dir has been set */
100 char *u_home; /* home directory */
101 char *u_primgrp; /* primary group */
102 int u_groupc; /* # of secondary groups */
103 char *u_groupv[NGROUPS_MAX]; /* secondary groups */
104 char *u_shell; /* user's shell */
105 char *u_basedir; /* base directory for home */
106 char *u_expire; /* when password will expire */
107 int u_inactive; /* inactive */
108 int u_mkdir; /* make the home directory */
109 int u_dupuid; /* duplicate uids are allowed */
110 char *u_skeldir; /* directory for startup files */
111 unsigned u_rsize; /* size of range array */
112 unsigned u_rc; /* # of ranges */
113 range_t *u_rv; /* the ranges */
114 int u_preserve; /* preserve uids on deletion */
115 } user_t;
116
117 #endif
118