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