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*5983Ssm156471  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #include <string.h>
290Sstevel@tonic-gate #include "stdusers.h"
300Sstevel@tonic-gate 
311384Smike_s /* LINTLIBRARY */
321384Smike_s 
330Sstevel@tonic-gate const struct stdlist usernames[] = {
340Sstevel@tonic-gate 	{ "root", 0 },
350Sstevel@tonic-gate 	{ "daemon", 1 },
360Sstevel@tonic-gate 	{ "bin", 2 },
370Sstevel@tonic-gate 	{ "sys", 3 },
380Sstevel@tonic-gate 	{ "adm", 4 },
390Sstevel@tonic-gate 	{ "uucp", 5 },
400Sstevel@tonic-gate 	{ "nuucp", 9 },
412977Smeem 	{ "dladm", 15 },
420Sstevel@tonic-gate 	{ "smmsp", 25 },
430Sstevel@tonic-gate 	{ "listen", 37 },
441384Smike_s 	{ "gdm", 50 },
450Sstevel@tonic-gate 	{ "lp", 71 },
46*5983Ssm156471 	{ "mysql", 70 },
471384Smike_s 	{ "webservd", 80 },
483342Sjg97986 	{ "postgres", 90 },
490Sstevel@tonic-gate 	{ "nobody", 60001 },
500Sstevel@tonic-gate 	{ "noaccess", 60002 },
510Sstevel@tonic-gate 	{ "nobody4", 65534 },
520Sstevel@tonic-gate 	{ NULL, 0 }
530Sstevel@tonic-gate };
540Sstevel@tonic-gate 
550Sstevel@tonic-gate const struct stdlist groupnames[] = {
560Sstevel@tonic-gate 	{ "root", 0 },
570Sstevel@tonic-gate 	{ "other", 1 },
580Sstevel@tonic-gate 	{ "bin", 2 },
590Sstevel@tonic-gate 	{ "sys", 3 },
600Sstevel@tonic-gate 	{ "adm", 4 },
610Sstevel@tonic-gate 	{ "uucp", 5 },
620Sstevel@tonic-gate 	{ "mail", 6 },
630Sstevel@tonic-gate 	{ "tty", 7 },
640Sstevel@tonic-gate 	{ "lp", 8 },
650Sstevel@tonic-gate 	{ "nuucp", 9 },
660Sstevel@tonic-gate 	{ "staff", 10 },
670Sstevel@tonic-gate 	{ "daemon", 12 },
680Sstevel@tonic-gate 	{ "sysadmin", 14 },
690Sstevel@tonic-gate 	{ "smmsp", 25 },
701384Smike_s 	{ "gdm", 50 },
71*5983Ssm156471 	{ "mysql", 70 },
721384Smike_s 	{ "webservd", 80 },
733342Sjg97986 	{ "postgres", 90 },
740Sstevel@tonic-gate 	{ "nobody", 60001 },
750Sstevel@tonic-gate 	{ "noaccess", 60002 },
760Sstevel@tonic-gate 	{ "nogroup", 65534 },
770Sstevel@tonic-gate 	{ NULL, 0 }
780Sstevel@tonic-gate };
790Sstevel@tonic-gate 
800Sstevel@tonic-gate int
810Sstevel@tonic-gate stdfind(const char *name, const struct stdlist *list)
820Sstevel@tonic-gate {
830Sstevel@tonic-gate 	while (list->name != NULL) {
840Sstevel@tonic-gate 		if (strcmp(name, list->name) == 0)
850Sstevel@tonic-gate 			return (list->value);
860Sstevel@tonic-gate 		list++;
870Sstevel@tonic-gate 	}
880Sstevel@tonic-gate 	return (-1);
890Sstevel@tonic-gate }
901384Smike_s 
911384Smike_s const char *
921384Smike_s stdfindbyvalue(int value, const struct stdlist *list)
931384Smike_s {
941384Smike_s 	while (list->name != NULL) {
951384Smike_s 		if (value == list->value)
961384Smike_s 			return (list->name);
971384Smike_s 		list++;
981384Smike_s 	}
991384Smike_s 	return (NULL);
1001384Smike_s }
101