Home | History | Annotate | Line # | Download | only in user
usermgmt.h revision 1.2
      1  1.2  lukem /* $NetBSD: usermgmt.h,v 1.2 1999/12/07 10:14:03 lukem Exp $ */
      2  1.1    agc 
      3  1.1    agc /*
      4  1.2  lukem  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
      5  1.1    agc  *
      6  1.1    agc  * Redistribution and use in source and binary forms, with or without
      7  1.1    agc  * modification, are permitted provided that the following conditions
      8  1.1    agc  * are met:
      9  1.1    agc  * 1. Redistributions of source code must retain the above copyright
     10  1.1    agc  *    notice, this list of conditions and the following disclaimer.
     11  1.1    agc  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1    agc  *    notice, this list of conditions and the following disclaimer in the
     13  1.1    agc  *    documentation and/or other materials provided with the distribution.
     14  1.1    agc  * 3. All advertising materials mentioning features or use of this software
     15  1.1    agc  *    must display the following acknowledgement:
     16  1.1    agc  *	This product includes software developed by Alistair G. Crooks.
     17  1.1    agc  * 4. The name of the author may not be used to endorse or promote
     18  1.1    agc  *    products derived from this software without specific prior written
     19  1.1    agc  *    permission.
     20  1.1    agc  *
     21  1.1    agc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     22  1.1    agc  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     23  1.1    agc  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1    agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     25  1.1    agc  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1    agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     27  1.1    agc  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28  1.1    agc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     29  1.1    agc  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30  1.1    agc  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31  1.1    agc  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  1.1    agc  */
     33  1.1    agc #ifndef USERMGMT_H_
     34  1.1    agc #define USERMGMT_H_
     35  1.1    agc 
     36  1.1    agc #define CONFFILE	"/etc/usermgmt.conf"
     37  1.1    agc 
     38  1.1    agc #define DEF_GROUP	"other"
     39  1.1    agc #define DEF_BASEDIR	"/home"
     40  1.1    agc #define DEF_SKELDIR	"/etc/skel"
     41  1.1    agc #define DEF_SHELL	"/bin/csh"
     42  1.1    agc #define DEF_COMMENT	""
     43  1.1    agc #define DEF_LOWUID	1000
     44  1.1    agc #define DEF_HIGHUID	60000
     45  1.1    agc #define DEF_INACTIVE	0
     46  1.1    agc #define DEF_EXPIRE	(char *) NULL
     47  1.1    agc 
     48  1.1    agc #ifndef MASTER
     49  1.1    agc #define MASTER		"/etc/master.passwd"
     50  1.1    agc #endif
     51  1.1    agc 
     52  1.1    agc #ifndef ETCGROUP
     53  1.1    agc #define ETCGROUP	"/etc/group"
     54  1.1    agc #endif
     55  1.1    agc 
     56  1.1    agc #ifndef WAITSECS
     57  1.1    agc #define WAITSECS	10
     58  1.1    agc #endif
     59  1.1    agc 
     60  1.1    agc #ifndef NOBODY_UID
     61  1.1    agc #define NOBODY_UID	32767
     62  1.1    agc #endif
     63  1.1    agc 
     64  1.1    agc /* some useful constants */
     65  1.1    agc enum {
     66  1.1    agc 	MaxShellNameLen = 256,
     67  1.1    agc 	MaxFileNameLen = MAXPATHLEN,
     68  1.1    agc 	MaxUserNameLen = 32,
     69  1.1    agc 	MaxFieldNameLen = 32,
     70  1.1    agc 	MaxCommandLen = 2048,
     71  1.1    agc 	MaxEntryLen = 2048,
     72  1.1    agc 	PasswordLength = 13,
     73  1.1    agc 
     74  1.1    agc 	LowGid = 1000,
     75  1.1    agc 	HighGid = 60000
     76  1.1    agc };
     77  1.1    agc 
     78  1.1    agc /* Full paths of programs used here */
     79  1.1    agc #define CHOWN		"/usr/sbin/chown"
     80  1.1    agc #define CP		"/bin/cp"
     81  1.1    agc #define FALSE_PROG	"/usr/bin/false"
     82  1.1    agc #define MKDIR		"/bin/mkdir -p"
     83  1.1    agc #define MV		"/bin/mv"
     84  1.1    agc #define RM		"/bin/rm"
     85  1.1    agc 
     86  1.1    agc #define UNSET_EXPIRY	"Null (unset)"
     87  1.1    agc 
     88  1.1    agc /* this struct describes a uid range */
     89  1.1    agc typedef struct range_t {
     90  1.1    agc 	int	r_from;		/* low uid */
     91  1.1    agc 	int	r_to;		/* high uid */
     92  1.1    agc } range_t;
     93  1.1    agc 
     94  1.1    agc /* this struct encapsulates the user information */
     95  1.1    agc typedef struct user_t {
     96  1.1    agc 	int		u_uid;			/* uid of user */
     97  1.1    agc 	char		*u_password;		/* encrypted password */
     98  1.1    agc 	char		*u_comment;		/* comment field */
     99  1.1    agc 	int		u_homeset;		/* home dir has been set */
    100  1.1    agc 	char		*u_home;		/* home directory */
    101  1.1    agc 	char		*u_primgrp;		/* primary group */
    102  1.1    agc 	int		u_groupc;		/* # of secondary groups */
    103  1.1    agc 	char		*u_groupv[NGROUPS_MAX];	/* secondary groups */
    104  1.1    agc 	char		*u_shell;		/* user's shell */
    105  1.1    agc 	char		*u_basedir;		/* base directory for home */
    106  1.1    agc 	char		*u_expire;		/* when password will expire */
    107  1.1    agc 	int		u_inactive;		/* inactive */
    108  1.1    agc 	int		u_mkdir;		/* make the home directory */
    109  1.1    agc 	int		u_dupuid;		/* duplicate uids are allowed */
    110  1.1    agc 	char		*u_skeldir;		/* directory for startup files */
    111  1.1    agc 	unsigned	u_rsize;		/* size of range array */
    112  1.1    agc 	unsigned	u_rc;			/* # of ranges */
    113  1.1    agc 	range_t		*u_rv;			/* the ranges */
    114  1.1    agc 	int		u_preserve;		/* preserve uids on deletion */
    115  1.1    agc } user_t;
    116  1.1    agc 
    117  1.1    agc #endif
    118