1*2fe8fb19SBen Gras /* $NetBSD: login_cap.h,v 1.11 2009/01/11 03:04:12 christos Exp $ */ 2*2fe8fb19SBen Gras 3*2fe8fb19SBen Gras /*- 4*2fe8fb19SBen Gras * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved. 5*2fe8fb19SBen Gras * 6*2fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without 7*2fe8fb19SBen Gras * modification, are permitted provided that the following conditions 8*2fe8fb19SBen Gras * are met: 9*2fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright 10*2fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer. 11*2fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 12*2fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the 13*2fe8fb19SBen Gras * documentation and/or other materials provided with the distribution. 14*2fe8fb19SBen Gras * 3. All advertising materials mentioning features or use of this software 15*2fe8fb19SBen Gras * must display the following acknowledgement: 16*2fe8fb19SBen Gras * This product includes software developed by Berkeley Software Design, 17*2fe8fb19SBen Gras * Inc. 18*2fe8fb19SBen Gras * 4. The name of Berkeley Software Design, Inc. may not be used to endorse 19*2fe8fb19SBen Gras * or promote products derived from this software without specific prior 20*2fe8fb19SBen Gras * written permission. 21*2fe8fb19SBen Gras * 22*2fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND 23*2fe8fb19SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24*2fe8fb19SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25*2fe8fb19SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE 26*2fe8fb19SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27*2fe8fb19SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28*2fe8fb19SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29*2fe8fb19SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30*2fe8fb19SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31*2fe8fb19SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32*2fe8fb19SBen Gras * SUCH DAMAGE. 33*2fe8fb19SBen Gras * 34*2fe8fb19SBen Gras * BSDI login_cap.h,v 2.10 1997/08/07 21:35:19 prb Exp 35*2fe8fb19SBen Gras */ 36*2fe8fb19SBen Gras 37*2fe8fb19SBen Gras #ifndef _LOGIN_CAP_H_ 38*2fe8fb19SBen Gras #define _LOGIN_CAP_H_ 39*2fe8fb19SBen Gras 40*2fe8fb19SBen Gras #define LOGIN_DEFCLASS "default" 41*2fe8fb19SBen Gras #define LOGIN_DEFSERVICE "login" 42*2fe8fb19SBen Gras #define LOGIN_DEFUMASK 022 43*2fe8fb19SBen Gras #define _PATH_LOGIN_CONF "/etc/login.conf" 44*2fe8fb19SBen Gras 45*2fe8fb19SBen Gras #define LOGIN_OSETGROUP 0x0001 /* Obsolete setgroup */ 46*2fe8fb19SBen Gras #define LOGIN_SETLOGIN 0x0002 /* Set login */ 47*2fe8fb19SBen Gras #define LOGIN_SETPATH 0x0004 /* Set path */ 48*2fe8fb19SBen Gras #define LOGIN_SETPRIORITY 0x0008 /* Set priority */ 49*2fe8fb19SBen Gras #define LOGIN_SETRESOURCES 0x0010 /* Set resource limits */ 50*2fe8fb19SBen Gras #define LOGIN_SETUMASK 0x0020 /* Set umask */ 51*2fe8fb19SBen Gras #define LOGIN_SETUSER 0x0040 /* Set user */ 52*2fe8fb19SBen Gras #define LOGIN_SETENV 0x0080 /* Set user environment */ 53*2fe8fb19SBen Gras #define LOGIN_SETGID 0x0100 /* Set group id */ 54*2fe8fb19SBen Gras #define LOGIN_SETGROUPS 0x0200 /* Set group membership (initgroups) */ 55*2fe8fb19SBen Gras #define LOGIN_SETALL 0x03fe /* Set all. 0x0001 is obsolete! */ 56*2fe8fb19SBen Gras #define LOGIN_SETGROUP (LOGIN_SETGID|LOGIN_SETGROUPS) /* Set group */ 57*2fe8fb19SBen Gras 58*2fe8fb19SBen Gras typedef struct { 59*2fe8fb19SBen Gras char *lc_class; 60*2fe8fb19SBen Gras char *lc_cap; 61*2fe8fb19SBen Gras char *lc_style; 62*2fe8fb19SBen Gras } login_cap_t; 63*2fe8fb19SBen Gras 64*2fe8fb19SBen Gras typedef int (*envfunc_t)(void *, const char *, const char *, int); 65*2fe8fb19SBen Gras 66*2fe8fb19SBen Gras #include <sys/cdefs.h> 67*2fe8fb19SBen Gras __BEGIN_DECLS 68*2fe8fb19SBen Gras struct passwd; 69*2fe8fb19SBen Gras 70*2fe8fb19SBen Gras login_cap_t *login_getclass(const char *); 71*2fe8fb19SBen Gras #ifndef __LIBC12_SOURCE__ 72*2fe8fb19SBen Gras login_cap_t *login_getpwclass(const struct passwd *) 73*2fe8fb19SBen Gras __RENAME(__login_getpwclass50); 74*2fe8fb19SBen Gras #endif 75*2fe8fb19SBen Gras void login_close(login_cap_t *); 76*2fe8fb19SBen Gras int login_getcapbool(login_cap_t *, const char *, u_int); 77*2fe8fb19SBen Gras quad_t login_getcapnum(login_cap_t *, const char *, quad_t, quad_t); 78*2fe8fb19SBen Gras quad_t login_getcapsize(login_cap_t *, const char *, quad_t, quad_t); 79*2fe8fb19SBen Gras char *login_getcapstr(login_cap_t *, const char *, char *, char *); 80*2fe8fb19SBen Gras quad_t login_getcaptime(login_cap_t *, const char *, quad_t, quad_t); 81*2fe8fb19SBen Gras 82*2fe8fb19SBen Gras int setclasscontext(const char *, u_int); 83*2fe8fb19SBen Gras #ifndef __LIBC12_SOURCE__ 84*2fe8fb19SBen Gras int setusercontext(login_cap_t *, struct passwd *, uid_t, u_int) 85*2fe8fb19SBen Gras __RENAME(__setusercontext50); 86*2fe8fb19SBen Gras #endif 87*2fe8fb19SBen Gras void setuserpath(login_cap_t *, const char *, envfunc_t, void *); 88*2fe8fb19SBen Gras int setuserenv(login_cap_t *, envfunc_t, void *); 89*2fe8fb19SBen Gras 90*2fe8fb19SBen Gras __END_DECLS 91*2fe8fb19SBen Gras 92*2fe8fb19SBen Gras #endif /* !_LOGIN_CAP_H_ */ 93