xref: /titanic_51/usr/src/tools/protocmp/stdusers.c (revision ccbf80fa3b6bf6b986dca9037e5ad9d6c9f9fa65)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <string.h>
30 #include "stdusers.h"
31 
32 /* LINTLIBRARY */
33 
34 const struct stdlist usernames[] = {
35 	{ "root", 0 },
36 	{ "daemon", 1 },
37 	{ "bin", 2 },
38 	{ "sys", 3 },
39 	{ "adm", 4 },
40 	{ "uucp", 5 },
41 	{ "nuucp", 9 },
42 	{ "smmsp", 25 },
43 	{ "listen", 37 },
44 	{ "gdm", 50 },
45 	{ "lp", 71 },
46 	{ "webservd", 80 },
47 	{ "nobody", 60001 },
48 	{ "noaccess", 60002 },
49 	{ "nobody4", 65534 },
50 	{ NULL, 0 }
51 };
52 
53 const struct stdlist groupnames[] = {
54 	{ "root", 0 },
55 	{ "other", 1 },
56 	{ "bin", 2 },
57 	{ "sys", 3 },
58 	{ "adm", 4 },
59 	{ "uucp", 5 },
60 	{ "mail", 6 },
61 	{ "tty", 7 },
62 	{ "lp", 8 },
63 	{ "nuucp", 9 },
64 	{ "staff", 10 },
65 	{ "daemon", 12 },
66 	{ "sysadmin", 14 },
67 	{ "smmsp", 25 },
68 	{ "gdm", 50 },
69 	{ "webservd", 80 },
70 	{ "nobody", 60001 },
71 	{ "noaccess", 60002 },
72 	{ "nogroup", 65534 },
73 	{ NULL, 0 }
74 };
75 
76 int
77 stdfind(const char *name, const struct stdlist *list)
78 {
79 	while (list->name != NULL) {
80 		if (strcmp(name, list->name) == 0)
81 			return (list->value);
82 		list++;
83 	}
84 	return (-1);
85 }
86 
87 const char *
88 stdfindbyvalue(int value, const struct stdlist *list)
89 {
90 	while (list->name != NULL) {
91 		if (value == list->value)
92 			return (list->name);
93 		list++;
94 	}
95 	return (NULL);
96 }
97