Annotation of src/usr.bin/sudo/defaults.h, Revision 1.2
1.1 millert 1: /*
2: * Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com>
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: *
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: *
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * 3. The name of the author may not be used to endorse or promote products
17: * derived from this software without specific prior written permission.
18: *
19: * 4. Products derived from this software may not be called "Sudo" nor
20: * may "Sudo" appear in their names without specific prior written
21: * permission from the author.
22: *
23: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
26: * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33: *
1.2 ! millert 34: * $Sudo: defaults.h,v 1.8 1999/12/02 20:31:24 millert Exp $
1.1 millert 35: */
36:
37: #ifndef _SUDO_DEFAULTS_H
38: #define _SUDO_DEFAULTS_H
39:
40: /*
41: * Structure describing compile-time and run-time options.
42: */
43: struct sudo_defs_types {
44: char *name;
45: int type;
46: union {
47: int flag;
48: char *str;
49: unsigned int ival;
50: mode_t mode;
51: } sd_un;
52: char *desc;
53: };
54:
55: /*
56: * Four types of defaults: strings, integers, and flags.
57: * Also, T_INT or T_STR may be ANDed with T_BOOL to indicate that
58: * a value is not required. Flags are boolean by nature...
59: */
60: #undef T_INT
61: #define T_INT 0x001
62: #undef T_STR
63: #define T_STR 0x002
64: #undef T_FLAG
65: #define T_FLAG 0x003
66: #undef T_MODE
67: #define T_MODE 0x004
68: #undef T_LOGFAC
69: #define T_LOGFAC 0x005
70: #undef T_LOGPRI
71: #define T_LOGPRI 0x006
72: #undef T_MASK
73: #define T_MASK 0x0FF
74: #undef T_BOOL
75: #define T_BOOL 0x100
76: #undef T_PATH
77: #define T_PATH 0x200
78:
79: /*
80: * Indexes into sudo_defs_table
81: */
82:
83: /* Integer versions of syslog options. */
84: #define I_LOGFAC 0 /* syslog facility */
85: #define I_GOODPRI 1 /* syslog priority for successful auth */
86: #define I_BADPRI 2 /* syslog priority for unsuccessful auth */
87:
88: /* String versions of syslog options. */
89: #define I_LOGFACSTR 3 /* syslog facility */
90: #define I_GOODPRISTR 4 /* syslog priority for successful auth */
91: #define I_BADPRISTR 5 /* syslog priority for unsuccessful auth */
92:
93: /* Booleans */
94: #define I_LONG_OTP_PROMPT 6
95: #define I_IGNORE_DOT 7
96: #define I_MAIL_ALWAYS 8
97: #define I_MAIL_NOUSER 9
98: #define I_MAIL_NOHOST 10
99: #define I_MAIL_NOPERMS 11
100: #define I_TTY_TICKETS 12
101: #define I_LECTURE 13
102: #define I_AUTHENTICATE 14
103: #define I_ROOT_SUDO 15
104: #define I_LOG_HOST 16
105: #define I_LOG_YEAR 17
1.2 ! millert 106: #define I_SET_HOME 18
! 107: #define I_PATH_INFO 19
! 108: #define I_FQDN 20
! 109: #define I_INSULTS 21
! 110: #define I_REQUIRETTY 22
1.1 millert 111:
112: /* Integer values */
1.2 ! millert 113: #define I_LOGLEN 23 /* wrap log file line after N chars */
! 114: #define I_TS_TIMEOUT 24 /* timestamp stale after N minutes */
! 115: #define I_PW_TIMEOUT 25 /* exit if pass not entered in N minutes */
! 116: #define I_PW_TRIES 26 /* exit after N bad password tries */
! 117: #define I_UMASK 27 /* umask to use or 0777 to use user's */
1.1 millert 118:
119: /* Strings */
1.2 ! millert 120: #define I_LOGFILE 28 /* path to logfile (or NULL for none) */
! 121: #define I_MAILERPATH 29 /* path to sendmail or other mailer */
! 122: #define I_MAILERFLAGS 30 /* flags to pass to the mailer */
! 123: #define I_MAILTO 31 /* who to send bitch mail to */
! 124: #define I_MAILSUB 32 /* subject line of mail msg */
! 125: #define I_BADPASS_MSG 33 /* what to say when passwd is wrong */
! 126: #define I_TIMESTAMPDIR 34 /* path to timestamp dir */
! 127: #define I_EXEMPT_GRP 35 /* no password or PATH override for these */
! 128: #define I_PASSPROMPT 36 /* password prompt */
! 129: #define I_RUNAS_DEF 37 /* default user to run commands as */
! 130: #define I_SECURE_PATH 38 /* set $PATH to this if not NULL */
1.1 millert 131:
132: /*
133: * Macros for accessing sudo_defs_table.
134: */
135: #define def_flag(_i) (sudo_defs_table[(_i)].sd_un.flag)
136: #define def_ival(_i) (sudo_defs_table[(_i)].sd_un.ival)
137: #define def_str(_i) (sudo_defs_table[(_i)].sd_un.str)
138: #define def_mode(_i) (sudo_defs_table[(_i)].sd_un.mode)
139:
140: /*
141: * Prototypes
142: */
143: void dump_default __P((void));
144: int set_default __P((char *, char *, int));
145: void init_defaults __P((void));
146: void list_options __P((void));
147:
148: extern struct sudo_defs_types sudo_defs_table[];
149:
150: #endif /* _SUDO_DEFAULTS_H */