xref: /netbsd-src/include/login_cap.h (revision 398f572480f1fedc799ffccfcfa42f6da3bace8a)
1*398f5724Sdholland /*	$NetBSD: login_cap.h,v 1.13 2016/01/23 01:26:14 dholland Exp $	*/
2142f3694Smjl 
3142f3694Smjl /*-
4142f3694Smjl  * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved.
5142f3694Smjl  *
6142f3694Smjl  * Redistribution and use in source and binary forms, with or without
7142f3694Smjl  * modification, are permitted provided that the following conditions
8142f3694Smjl  * are met:
9142f3694Smjl  * 1. Redistributions of source code must retain the above copyright
10142f3694Smjl  *    notice, this list of conditions and the following disclaimer.
11142f3694Smjl  * 2. Redistributions in binary form must reproduce the above copyright
12142f3694Smjl  *    notice, this list of conditions and the following disclaimer in the
13142f3694Smjl  *    documentation and/or other materials provided with the distribution.
14142f3694Smjl  * 3. All advertising materials mentioning features or use of this software
15142f3694Smjl  *    must display the following acknowledgement:
16142f3694Smjl  *	This product includes software developed by Berkeley Software Design,
17142f3694Smjl  *	Inc.
18142f3694Smjl  * 4. The name of Berkeley Software Design, Inc.  may not be used to endorse
19142f3694Smjl  *    or promote products derived from this software without specific prior
20142f3694Smjl  *    written permission.
21142f3694Smjl  *
22142f3694Smjl  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
23142f3694Smjl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24142f3694Smjl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25142f3694Smjl  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
26142f3694Smjl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27142f3694Smjl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28142f3694Smjl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29142f3694Smjl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30142f3694Smjl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31142f3694Smjl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32142f3694Smjl  * SUCH DAMAGE.
33142f3694Smjl  *
34142f3694Smjl  *	BSDI login_cap.h,v 2.10 1997/08/07 21:35:19 prb Exp
35142f3694Smjl  */
36142f3694Smjl 
37142f3694Smjl #ifndef _LOGIN_CAP_H_
38142f3694Smjl #define _LOGIN_CAP_H_
39142f3694Smjl 
40142f3694Smjl #define	LOGIN_DEFCLASS		"default"
41142f3694Smjl #define	LOGIN_DEFSERVICE	"login"
42142f3694Smjl #define	LOGIN_DEFUMASK		022
43142f3694Smjl #define	_PATH_LOGIN_CONF	"/etc/login.conf"
44142f3694Smjl 
45b093a779Schristos #define	LOGIN_OSETGROUP		0x0001	/* Obsolete setgroup */
46142f3694Smjl #define	LOGIN_SETLOGIN		0x0002	/* Set login */
47142f3694Smjl #define	LOGIN_SETPATH		0x0004	/* Set path */
48142f3694Smjl #define	LOGIN_SETPRIORITY	0x0008	/* Set priority */
49142f3694Smjl #define	LOGIN_SETRESOURCES	0x0010	/* Set resource limits */
50142f3694Smjl #define	LOGIN_SETUMASK		0x0020	/* Set umask */
51142f3694Smjl #define	LOGIN_SETUSER		0x0040	/* Set user */
52b3204d53Smjl #define	LOGIN_SETENV		0x0080	/* Set user environment */
53fbe22811Schristos #define	LOGIN_SETGID		0x0100	/* Set group id */
54fbe22811Schristos #define	LOGIN_SETGROUPS		0x0200	/* Set group membership (initgroups) */
55ab7f7a66Schristos #define	LOGIN_SETALL		0x03fe	/* Set all. 0x0001 is obsolete! */
56b093a779Schristos #define	LOGIN_SETGROUP		(LOGIN_SETGID|LOGIN_SETGROUPS) /* Set group */
57142f3694Smjl 
58142f3694Smjl typedef struct {
59142f3694Smjl 	char	*lc_class;
60142f3694Smjl 	char	*lc_cap;
61142f3694Smjl 	char	*lc_style;
62142f3694Smjl } login_cap_t;
63142f3694Smjl 
64724f51cbSchristos typedef int (*envfunc_t)(void *, const char *, const char *, int);
65724f51cbSchristos 
66142f3694Smjl #include <sys/cdefs.h>
67142f3694Smjl __BEGIN_DECLS
68142f3694Smjl struct passwd;
69142f3694Smjl 
7040249304Schristos login_cap_t *login_getclass(const char *);
7150728e78Schristos #ifndef __LIBC12_SOURCE__
7250728e78Schristos login_cap_t *login_getpwclass(const struct passwd *)
7350728e78Schristos     __RENAME(__login_getpwclass50);
7450728e78Schristos #endif
753ac8ce9bSad void	 login_close(login_cap_t *);
76*398f5724Sdholland int	 login_getcapbool(login_cap_t *, const char *, unsigned int);
7740249304Schristos quad_t	 login_getcapnum(login_cap_t *, const char *, quad_t, quad_t);
7840249304Schristos quad_t	 login_getcapsize(login_cap_t *, const char *, quad_t, quad_t);
7940249304Schristos char	*login_getcapstr(login_cap_t *, const char *, char *, char *);
8040249304Schristos quad_t	 login_getcaptime(login_cap_t *, const char *, quad_t, quad_t);
81142f3694Smjl 
82*398f5724Sdholland int	setclasscontext(const char *, unsigned int);
8350728e78Schristos #ifndef __LIBC12_SOURCE__
84*398f5724Sdholland int	setusercontext(login_cap_t *, struct passwd *, uid_t, unsigned int)
8550728e78Schristos     __RENAME(__setusercontext50);
8650728e78Schristos #endif
87724f51cbSchristos void	setuserpath(login_cap_t *, const char *, envfunc_t, void *);
88724f51cbSchristos int	setuserenv(login_cap_t *, envfunc_t, void *);
89142f3694Smjl 
90142f3694Smjl __END_DECLS
91142f3694Smjl 
923ac8ce9bSad #endif	/* !_LOGIN_CAP_H_ */
93