]>
git.cameronkatri.com Git - pw-darwin.git/blob - libutil/login_cap.h
2 * Copyright (c) 1996 by
3 * Sean Eric Fagan <sef@kithrup.com>
4 * David Nugent <davidn@blaze.net.au>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, is permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice immediately at the beginning of the file, without modification,
12 * this list of conditions, and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. This work was done expressly for inclusion into FreeBSD. Other use
17 * is permitted provided this notation is included.
18 * 4. Absolutely no warranty of function or purpose is made by the authors.
19 * 5. Modifications may be freely made to this file providing the above
22 * Low-level routines relating to the user capabilities database
24 * Was login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp
25 * $Id: login_cap.h,v 1.1 1997/05/10 12:49:30 davidn Exp $
31 #define LOGIN_DEFCLASS "default"
32 #define LOGIN_DEFROOTCLASS "root"
33 #define LOGIN_MECLASS "me"
34 #define LOGIN_DEFSTYLE "passwd"
35 #define LOGIN_DEFSERVICE "login"
36 #define LOGIN_DEFUMASK 022
37 #define LOGIN_DEFPRI 0
38 #define _PATH_LOGIN_CONF "/etc/login.conf"
39 #define _FILE_LOGIN_CONF ".login_conf"
40 #define _PATH_AUTHPROG "/usr/libexec/login_"
42 #define LOGIN_SETGROUP 0x0001 /* set group */
43 #define LOGIN_SETLOGIN 0x0002 /* set login (via setlogin) */
44 #define LOGIN_SETPATH 0x0004 /* set path */
45 #define LOGIN_SETPRIORITY 0x0008 /* set priority */
46 #define LOGIN_SETRESOURCES 0x0010 /* set resources (cputime, etc.) */
47 #define LOGIN_SETUMASK 0x0020 /* set umask, obviously */
48 #define LOGIN_SETUSER 0x0040 /* set user (via setuid) */
49 #define LOGIN_SETENV 0x0080 /* set user environment */
50 #define LOGIN_SETALL 0x00ff /* set everything */
52 #define BI_AUTH "authorize" /* accepted authentication */
53 #define BI_REJECT "reject" /* rejected authentication */
54 #define BI_CHALLENG "reject challenge" /* reject with a challenge */
55 #define BI_SILENT "reject silent" /* reject silently */
56 #define BI_REMOVE "remove" /* remove file on error */
57 #define BI_ROOTOKAY "authorize root" /* root authenticated */
58 #define BI_SECURE "authorize secure" /* okay on non-secure line */
59 #define BI_SETENV "setenv" /* set environment variable */
60 #define BI_VALUE "value" /* set local variable */
62 #define AUTH_OKAY 0x01 /* user authenticated */
63 #define AUTH_ROOTOKAY 0x02 /* root login okay */
64 #define AUTH_SECURE 0x04 /* secure login */
65 #define AUTH_SILENT 0x08 /* silent rejection */
66 #define AUTH_CHALLENGE 0x10 /* a chellenge was given */
68 #define AUTH_ALLOW (AUTH_OKAY | AUTH_ROOTOKAY | AUTH_SECURE)
70 typedef struct login_cap
{
76 typedef struct login_time
{
77 u_short lt_start
; /* Start time */
78 u_short lt_end
; /* End time */
90 u_char lt_dow
; /* Days of week */
93 #define LC_MAXTIMES 64
95 #include <sys/cdefs.h>
99 void login_close
__P((login_cap_t
*));
100 login_cap_t
*login_getclassbyname
__P((const char *, const struct passwd
*));
101 login_cap_t
*login_getclass
__P((const char *));
102 login_cap_t
*login_getpwclass
__P((const struct passwd
*));
103 login_cap_t
*login_getuserclass
__P((const struct passwd
*));
105 char *login_getcapstr
__P((login_cap_t
*, const char *, char *, char *));
106 char **login_getcaplist
__P((login_cap_t
*, const char *, const char *));
107 char *login_getstyle
__P((login_cap_t
*, char *, const char *));
108 rlim_t login_getcaptime
__P((login_cap_t
*, const char *, rlim_t
, rlim_t
));
109 rlim_t login_getcapnum
__P((login_cap_t
*, const char *, rlim_t
, rlim_t
));
110 rlim_t login_getcapsize
__P((login_cap_t
*, const char *, rlim_t
, rlim_t
));
111 char *login_getpath
__P((login_cap_t
*, const char *, char *));
112 int login_getcapbool
__P((login_cap_t
*, const char *, int));
114 int setclasscontext
__P((const char*, unsigned int));
115 int setusercontext
__P((login_cap_t
*, const struct passwd
*, uid_t
, unsigned int));
116 void setclassresources
__P((login_cap_t
*));
117 void setclassenvironment
__P((login_cap_t
*, const struct passwd
*, int));
119 /* Most of these functions are deprecated */
120 int auth_approve
__P((login_cap_t
*, const char*, const char*));
121 int auth_check
__P((const char *, const char *, const char *, const char *, int *));
122 void auth_env
__P((void));
123 char *auth_mkvalue
__P((const char *n
));
124 int auth_response
__P((const char *, const char *, const char *, const char *, int *, const char *, const char *));
125 void auth_rmfiles
__P((void));
126 int auth_scan
__P((int));
127 int auth_script
__P((const char*, ...));
128 int auth_script_data
__P((const char *, int, const char *, ...));
129 char *auth_valud
__P((const char *));
130 int auth_setopt
__P((const char *, const char *));
131 void auth_clropts
__P((void));
133 void auth_checknologin
__P((login_cap_t
*));
134 int auth_cat
__P((const char*));
136 int auth_ttyok
__P((login_cap_t
*, const char *));
137 int auth_hostok
__P((login_cap_t
*, const char *, char const *));
138 int auth_timeok
__P((login_cap_t
*, time_t));
142 login_time_t parse_lt
__P((const char *));
143 int in_ltm
__P((const login_time_t
*, struct tm
*, time_t *));
144 int in_ltms
__P((const login_time_t
*, struct tm
*, time_t *));
146 /* helper functions */
148 int login_strinlist
__P((char **, char const *, int));
149 int login_str2inlist
__P((char **, const char *, const char *, int));
150 login_time_t
* login_timelist
__P((login_cap_t
*, char const *, int *, login_time_t
**));
151 int login_ttyok
__P((login_cap_t
*, const char *, const char *, const char *));
152 int login_hostok
__P((login_cap_t
*, const char *, const char *, const char *, const char *));
156 #endif /* _LOGIN_CAP_H_ */