xref: /illumos-gate/usr/src/head/userdefs.h (revision 6f1fa39e3cf1b335f342bbca41590e9d76ab29b7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
32  */
33 
34 #ifndef	_USERDEFS_H
35 #define	_USERDEFS_H
36 
37 #include <project.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * The definitions in this file are local to the OA&M subsystem.  General
45  * use is not encouraged.
46  */
47 
48 /* User/group default values */
49 #define	DEFGID		99	/* max reserved group id */
50 #define	DEFRID		99
51 #define	DEFPROJ		3
52 #define	DEFPROJNAME	"default"
53 #define	DEFGROUP	1
54 #define	DEFGNAME	"other"
55 #define	DEFPARENT	"/home"
56 #define	DEFSKL		"/etc/skel"
57 #define	DEFSHL		"/bin/sh"
58 #define	DEFROLESHL	"/bin/pfsh"
59 #define	DEFINACT	0
60 #define	DEFEXPIRE	""
61 #define	DEFAUTH		""
62 #define	DEFPROF		""
63 #define	DEFROLEPROF	"All"
64 #define	DEFROLE		""
65 #define	DEFLIMPRIV	""
66 #define	DEFDFLTPRIV	""
67 #define	DEFLOCK_AFTER_RETRIES	""
68 #define	DEFROLEAUTH	""
69 #define	DEFROLEROLEAUTH	"role"
70 
71 /* Defaults file keywords */
72 #define	RIDSTR		"defrid="
73 #define	GIDSTR		"defgroup="
74 #define	GNAMSTR		"defgname="
75 #define	PARSTR		"defparent="
76 #define	SKLSTR		"defskel="
77 #define	SHELLSTR	"defshell="
78 #define	INACTSTR	"definact="
79 #define	EXPIRESTR	"defexpire="
80 #define	AUTHSTR		"defauthorization="
81 #define	PROFSTR		"defprofile="
82 #define	ROLESTR		"defrole="
83 #define	PROJSTR		"defproj="
84 #define	PROJNMSTR	"defprojname="
85 #define	LIMPRSTR	"deflimitpriv="
86 #define	DFLTPRSTR	"defdefaultpriv="
87 #define	FHEADER		"#	Default values for useradd.  Changed "
88 #define	FHEADER_ROLE	"#	Default values for roleadd.  Changed "
89 #define	LOCK_AFTER_RETRIESSTR	"deflock_after_retries="
90 #define	ROLEAUTHSTR	"defroleauth="
91 
92 /* Defaults file */
93 #define	DEFFILE		"/usr/sadm/defadduser"
94 #define	DEFROLEFILE	"/usr/sadm/defaddrole"
95 #define	GROUP		"/etc/group"
96 
97 /* various limits */
98 #define	MAXGLEN		9	/* max length of group name */
99 #define	MAXDLEN		80	/* max length of a date string */
100 
101 /* defaults structure */
102 struct userdefs {
103 	int defrid;		/* highest reserved uid */
104 	int defgroup;		/* default group id */
105 	char *defgname;		/* default group name */
106 	char *defparent;	/* default base directory for new logins */
107 	char *defskel;		/* default skel directory */
108 	char *defshell;		/* default shell */
109 	int definact;		/* default inactive */
110 	char *defexpire;		/* default expire date */
111 	char *defauth;		/* default authorization */
112 	char *defprof;		/* default profile */
113 	char *defrole;		/* default role */
114 	projid_t defproj;	/* default project id */
115 	char *defprojname;	/* default project name */
116 	char *deflimpriv;	/* default limitpriv */
117 	char *defdfltpriv;	/* default defaultpriv */
118 	char *deflock_after_retries;	/* default lock_after_retries */
119 	char *defroleauth;		/* default roleauth */
120 
121 };
122 
123 /* exit() values for user/group commands */
124 
125 /* Everything succeeded */
126 #define	EX_SUCCESS	0
127 
128 /* No permission */
129 #define	EX_NO_PERM	1
130 
131 /* Command syntax error */
132 #define	EX_SYNTAX	2
133 
134 /* Invalid argument given */
135 #define	EX_BADARG	3
136 
137 /* A gid or uid already exists */
138 #define	EX_ID_EXISTS	4
139 
140 /* PASSWD and SHADOW are inconsistent with each other */
141 #define	EX_INCONSISTENT	5
142 
143 /* A group or user name  doesn't exist */
144 #define	EX_NAME_NOT_EXIST	6
145 
146 /* GROUP, PASSWD, or SHADOW file missing */
147 #define	EX_MISSING	7
148 
149 /* GROUP, PASSWD, or SHAWOW file is busy */
150 #define	EX_BUSY	8
151 
152 /* A group or user name already exists */
153 #define	EX_NAME_EXISTS	9
154 
155 /* Unable to update GROUP, PASSWD, or SHADOW file */
156 #define	EX_UPDATE	10
157 
158 /* Not enough space */
159 #define	EX_NOSPACE	11
160 
161 /* Unable to create/remove/move home directory */
162 #define	EX_HOMEDIR	12
163 
164 /* new login already in use */
165 #define	EX_NL_USED	13
166 
167 /* Unexpected failure */
168 #define	EX_FAILURE	14
169 
170 /* A user name is in a non-local name service */
171 #define	EX_NOT_LOCAL	15
172 
173 #ifdef	__cplusplus
174 }
175 #endif
176 
177 #endif	/* _USERDEFS_H */
178