xref: /onnv-gate/usr/src/tools/protocmp/stdusers.c (revision 11767:8f30d0e611c6)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52977Smeem  * Common Development and Distribution License (the "License").
62977Smeem  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11767SAnurag.Maskey@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <string.h>
270Sstevel@tonic-gate #include "stdusers.h"
280Sstevel@tonic-gate 
291384Smike_s /* LINTLIBRARY */
301384Smike_s 
310Sstevel@tonic-gate const struct stdlist usernames[] = {
320Sstevel@tonic-gate 	{ "root", 0 },
330Sstevel@tonic-gate 	{ "daemon", 1 },
340Sstevel@tonic-gate 	{ "bin", 2 },
350Sstevel@tonic-gate 	{ "sys", 3 },
360Sstevel@tonic-gate 	{ "adm", 4 },
370Sstevel@tonic-gate 	{ "uucp", 5 },
380Sstevel@tonic-gate 	{ "nuucp", 9 },
392977Smeem 	{ "dladm", 15 },
40*11767SAnurag.Maskey@Sun.COM 	{ "netadm", 16 },
41*11767SAnurag.Maskey@Sun.COM 	{ "netcfg", 17 },
420Sstevel@tonic-gate 	{ "smmsp", 25 },
430Sstevel@tonic-gate 	{ "listen", 37 },
441384Smike_s 	{ "gdm", 50 },
450Sstevel@tonic-gate 	{ "lp", 71 },
465983Ssm156471 	{ "mysql", 70 },
477721SDoug.Leavitt@Sun.COM 	{ "openldap", 75 },
481384Smike_s 	{ "webservd", 80 },
493342Sjg97986 	{ "postgres", 90 },
500Sstevel@tonic-gate 	{ "nobody", 60001 },
510Sstevel@tonic-gate 	{ "noaccess", 60002 },
520Sstevel@tonic-gate 	{ "nobody4", 65534 },
530Sstevel@tonic-gate 	{ NULL, 0 }
540Sstevel@tonic-gate };
550Sstevel@tonic-gate 
560Sstevel@tonic-gate const struct stdlist groupnames[] = {
570Sstevel@tonic-gate 	{ "root", 0 },
580Sstevel@tonic-gate 	{ "other", 1 },
590Sstevel@tonic-gate 	{ "bin", 2 },
600Sstevel@tonic-gate 	{ "sys", 3 },
610Sstevel@tonic-gate 	{ "adm", 4 },
620Sstevel@tonic-gate 	{ "uucp", 5 },
630Sstevel@tonic-gate 	{ "mail", 6 },
640Sstevel@tonic-gate 	{ "tty", 7 },
650Sstevel@tonic-gate 	{ "lp", 8 },
660Sstevel@tonic-gate 	{ "nuucp", 9 },
670Sstevel@tonic-gate 	{ "staff", 10 },
680Sstevel@tonic-gate 	{ "daemon", 12 },
690Sstevel@tonic-gate 	{ "sysadmin", 14 },
706315Sdduvall 	{ "games", 20 },
710Sstevel@tonic-gate 	{ "smmsp", 25 },
721384Smike_s 	{ "gdm", 50 },
73*11767SAnurag.Maskey@Sun.COM 	{ "netadm", 65 },
745983Ssm156471 	{ "mysql", 70 },
757721SDoug.Leavitt@Sun.COM 	{ "openldap", 75 },
761384Smike_s 	{ "webservd", 80 },
773342Sjg97986 	{ "postgres", 90 },
787647SJim.Li@Sun.COM 	{ "slocate", 95 },
790Sstevel@tonic-gate 	{ "nobody", 60001 },
800Sstevel@tonic-gate 	{ "noaccess", 60002 },
810Sstevel@tonic-gate 	{ "nogroup", 65534 },
820Sstevel@tonic-gate 	{ NULL, 0 }
830Sstevel@tonic-gate };
840Sstevel@tonic-gate 
850Sstevel@tonic-gate int
stdfind(const char * name,const struct stdlist * list)860Sstevel@tonic-gate stdfind(const char *name, const struct stdlist *list)
870Sstevel@tonic-gate {
880Sstevel@tonic-gate 	while (list->name != NULL) {
890Sstevel@tonic-gate 		if (strcmp(name, list->name) == 0)
900Sstevel@tonic-gate 			return (list->value);
910Sstevel@tonic-gate 		list++;
920Sstevel@tonic-gate 	}
930Sstevel@tonic-gate 	return (-1);
940Sstevel@tonic-gate }
951384Smike_s 
961384Smike_s const char *
stdfindbyvalue(int value,const struct stdlist * list)971384Smike_s stdfindbyvalue(int value, const struct stdlist *list)
981384Smike_s {
991384Smike_s 	while (list->name != NULL) {
1001384Smike_s 		if (value == list->value)
1011384Smike_s 			return (list->name);
1021384Smike_s 		list++;
1031384Smike_s 	}
1041384Smike_s 	return (NULL);
1051384Smike_s }
106