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 (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <string.h>
27 #include "stdusers.h"
28
29 /* LINTLIBRARY */
30
31 const struct stdlist usernames[] = {
32 { "root", 0 },
33 { "daemon", 1 },
34 { "bin", 2 },
35 { "sys", 3 },
36 { "adm", 4 },
37 { "uucp", 5 },
38 { "nuucp", 9 },
39 { "dladm", 15 },
40 { "netadm", 16 },
41 { "netcfg", 17 },
42 { "smmsp", 25 },
43 { "listen", 37 },
44 { "gdm", 50 },
45 { "lp", 71 },
46 { "mysql", 70 },
47 { "openldap", 75 },
48 { "webservd", 80 },
49 { "postgres", 90 },
50 { "nobody", 60001 },
51 { "noaccess", 60002 },
52 { "nobody4", 65534 },
53 { NULL, 0 }
54 };
55
56 const struct stdlist groupnames[] = {
57 { "root", 0 },
58 { "other", 1 },
59 { "bin", 2 },
60 { "sys", 3 },
61 { "adm", 4 },
62 { "uucp", 5 },
63 { "mail", 6 },
64 { "tty", 7 },
65 { "lp", 8 },
66 { "nuucp", 9 },
67 { "staff", 10 },
68 { "daemon", 12 },
69 { "sysadmin", 14 },
70 { "games", 20 },
71 { "smmsp", 25 },
72 { "gdm", 50 },
73 { "netadm", 65 },
74 { "mysql", 70 },
75 { "openldap", 75 },
76 { "webservd", 80 },
77 { "postgres", 90 },
78 { "slocate", 95 },
79 { "nobody", 60001 },
80 { "noaccess", 60002 },
81 { "nogroup", 65534 },
82 { NULL, 0 }
83 };
84
85 int
stdfind(const char * name,const struct stdlist * list)86 stdfind(const char *name, const struct stdlist *list)
87 {
88 while (list->name != NULL) {
89 if (strcmp(name, list->name) == 0)
90 return (list->value);
91 list++;
92 }
93 return (-1);
94 }
95
96 const char *
stdfindbyvalue(int value,const struct stdlist * list)97 stdfindbyvalue(int value, const struct stdlist *list)
98 {
99 while (list->name != NULL) {
100 if (value == list->value)
101 return (list->name);
102 list++;
103 }
104 return (NULL);
105 }
106