xref: /titanic_53/usr/src/head/shadow.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef	_SHADOW_H
32*7c478bd9Sstevel@tonic-gate #define	_SHADOW_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
37*7c478bd9Sstevel@tonic-gate extern "C" {
38*7c478bd9Sstevel@tonic-gate #endif
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #define	PASSWD 		"/etc/passwd"
41*7c478bd9Sstevel@tonic-gate #define	SHADOW		"/etc/shadow"
42*7c478bd9Sstevel@tonic-gate #define	OPASSWD		"/etc/opasswd"
43*7c478bd9Sstevel@tonic-gate #define	OSHADOW 	"/etc/oshadow"
44*7c478bd9Sstevel@tonic-gate #define	PASSTEMP	"/etc/ptmp"
45*7c478bd9Sstevel@tonic-gate #define	SHADTEMP	"/etc/stmp"
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate #define	DAY		(24L * 60 * 60) /* 1 day in seconds */
48*7c478bd9Sstevel@tonic-gate #define	DAY_NOW		(time_t)time((time_t *)0) / DAY
49*7c478bd9Sstevel@tonic-gate 			/* The above timezone variable is set by a call to */
50*7c478bd9Sstevel@tonic-gate 			/* any ctime(3c) routine.  Programs using the DAY_NOW */
51*7c478bd9Sstevel@tonic-gate 			/* macro must call one of the ctime routines, */
52*7c478bd9Sstevel@tonic-gate 			/* e.g. tzset(), BEFORE referencing DAY_NOW */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate #define	LOCKSTRING	"*LK*"	/* prefix to/string in sp_pwdp to lock acct */
55*7c478bd9Sstevel@tonic-gate #define	NOLOGINSTRING	"NP"	/* sp_pwdp for no-login accounts */
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /*
58*7c478bd9Sstevel@tonic-gate  * The spwd structure is used in the retreval of information from
59*7c478bd9Sstevel@tonic-gate  * /etc/shadow.  It is used by routines in the libos library.
60*7c478bd9Sstevel@tonic-gate  */
61*7c478bd9Sstevel@tonic-gate struct spwd {
62*7c478bd9Sstevel@tonic-gate 	char *sp_namp;	/* user name */
63*7c478bd9Sstevel@tonic-gate 	char *sp_pwdp;	/* user password */
64*7c478bd9Sstevel@tonic-gate 	int sp_lstchg;	/* password lastchanged date */
65*7c478bd9Sstevel@tonic-gate 	int sp_min;	/* minimum number of days between password changes */
66*7c478bd9Sstevel@tonic-gate 	int sp_max;	/* number of days password is valid */
67*7c478bd9Sstevel@tonic-gate 	int sp_warn;	/* number of days to warn user to change passwd */
68*7c478bd9Sstevel@tonic-gate 	int sp_inact;	/* number of days the login may be inactive */
69*7c478bd9Sstevel@tonic-gate 	int sp_expire;	/* date when the login is no longer valid */
70*7c478bd9Sstevel@tonic-gate 	unsigned int sp_flag;	/* currently low 4 bits are used */
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate 	/* low 4 bits of sp_flag for counting failed login attempts */
73*7c478bd9Sstevel@tonic-gate #define	FAILCOUNT_MASK 0xF
74*7c478bd9Sstevel@tonic-gate };
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #ifndef _STDIO_H
79*7c478bd9Sstevel@tonic-gate #include <stdio.h>
80*7c478bd9Sstevel@tonic-gate #endif
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /* Declare all shadow password functions */
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate extern struct spwd *getspnam_r(const char *,  struct spwd *, char *, int);
85*7c478bd9Sstevel@tonic-gate extern struct spwd *getspent_r(struct spwd *, char *, int);
86*7c478bd9Sstevel@tonic-gate extern struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int);
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate extern void	setspent(void);
89*7c478bd9Sstevel@tonic-gate extern void	endspent(void);
90*7c478bd9Sstevel@tonic-gate extern struct spwd	*getspent(void);			/* MT-unsafe */
91*7c478bd9Sstevel@tonic-gate extern struct spwd	*fgetspent(FILE *);			/* MT-unsafe */
92*7c478bd9Sstevel@tonic-gate extern struct spwd	*getspnam(const char *);	/* MT-unsafe */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate extern int	putspent(const struct spwd *, FILE *);
95*7c478bd9Sstevel@tonic-gate extern int	lckpwdf(void);
96*7c478bd9Sstevel@tonic-gate extern int	ulckpwdf(void);
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate #else
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate /* Declare all shadow password functions */
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate struct spwd	*getspent_r(), *fgetspent_r(), *getspnam_r();
103*7c478bd9Sstevel@tonic-gate void		setspent(), endspent();
104*7c478bd9Sstevel@tonic-gate struct spwd	*getspent(), *fgetspent(), *getspnam(); /* MT-unsafe */
105*7c478bd9Sstevel@tonic-gate int		putspent(), lckpwdf(), ulckpwdf();
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate #endif
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
110*7c478bd9Sstevel@tonic-gate }
111*7c478bd9Sstevel@tonic-gate #endif
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate #endif	/* _SHADOW_H */
114