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 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1988 AT&T */ 28 /* All Rights Reserved */ 29 30 31 #ifndef _SHADOW_H 32 #define _SHADOW_H 33 34 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #define PASSWD "/etc/passwd" 41 #define SHADOW "/etc/shadow" 42 #define OPASSWD "/etc/opasswd" 43 #define OSHADOW "/etc/oshadow" 44 #define PASSTEMP "/etc/ptmp" 45 #define SHADTEMP "/etc/stmp" 46 47 #define DAY (24L * 60 * 60) /* 1 day in seconds */ 48 #define DAY_NOW (time_t)time((time_t *)0) / DAY 49 /* The above timezone variable is set by a call to */ 50 /* any ctime(3c) routine. Programs using the DAY_NOW */ 51 /* macro must call one of the ctime routines, */ 52 /* e.g. tzset(), BEFORE referencing DAY_NOW */ 53 54 #define LOCKSTRING "*LK*" /* prefix to/string in sp_pwdp to lock acct */ 55 #define NOLOGINSTRING "NP" /* sp_pwdp for no-login accounts */ 56 57 /* 58 * The spwd structure is used in the retreval of information from 59 * /etc/shadow. It is used by routines in the libos library. 60 */ 61 struct spwd { 62 char *sp_namp; /* user name */ 63 char *sp_pwdp; /* user password */ 64 int sp_lstchg; /* password lastchanged date */ 65 int sp_min; /* minimum number of days between password changes */ 66 int sp_max; /* number of days password is valid */ 67 int sp_warn; /* number of days to warn user to change passwd */ 68 int sp_inact; /* number of days the login may be inactive */ 69 int sp_expire; /* date when the login is no longer valid */ 70 unsigned int sp_flag; /* currently low 4 bits are used */ 71 72 /* low 4 bits of sp_flag for counting failed login attempts */ 73 #define FAILCOUNT_MASK 0xF 74 }; 75 76 #if defined(__STDC__) 77 78 #ifndef _STDIO_H 79 #include <stdio.h> 80 #endif 81 82 /* Declare all shadow password functions */ 83 84 extern struct spwd *getspnam_r(const char *, struct spwd *, char *, int); 85 extern struct spwd *getspent_r(struct spwd *, char *, int); 86 extern struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int); 87 88 extern void setspent(void); 89 extern void endspent(void); 90 extern struct spwd *getspent(void); /* MT-unsafe */ 91 extern struct spwd *fgetspent(FILE *); /* MT-unsafe */ 92 extern struct spwd *getspnam(const char *); /* MT-unsafe */ 93 94 extern int putspent(const struct spwd *, FILE *); 95 extern int lckpwdf(void); 96 extern int ulckpwdf(void); 97 98 #else 99 100 /* Declare all shadow password functions */ 101 102 struct spwd *getspent_r(), *fgetspent_r(), *getspnam_r(); 103 void setspent(), endspent(); 104 struct spwd *getspent(), *fgetspent(), *getspnam(); /* MT-unsafe */ 105 int putspent(), lckpwdf(), ulckpwdf(); 106 107 #endif 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif /* _SHADOW_H */ 114