Annotation of src/usr.bin/sudo/defaults.h, Revision 1.1
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: *
! 34: * $Sudo: defaults.h,v 1.7 1999/10/11 16:24:02 millert Exp $
! 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
! 106: #define I_SHELL_NOARGS 18
! 107: #define I_SET_HOME 19
! 108: #define I_PATH_INFO 20
! 109: #define I_FQDN 21
! 110: #define I_INSULTS 22
! 111: #define I_REQUIRETTY 23
! 112:
! 113: /* Integer values */
! 114: #define I_LOGLEN 24 /* wrap log file line after N chars */
! 115: #define I_TS_TIMEOUT 25 /* timestamp stale after N minutes */
! 116: #define I_PW_TIMEOUT 26 /* exit if pass not entered in N minutes */
! 117: #define I_PW_TRIES 27 /* exit after N bad password tries */
! 118: #define I_UMASK 28 /* umask to use or 0777 to use user's */
! 119:
! 120: /* Strings */
! 121: #define I_LOGFILE 29 /* path to logfile (or NULL for none) */
! 122: #define I_MAILERPATH 30 /* path to sendmail or other mailer */
! 123: #define I_MAILERFLAGS 31 /* flags to pass to the mailer */
! 124: #define I_MAILTO 32 /* who to send bitch mail to */
! 125: #define I_MAILSUB 33 /* subject line of mail msg */
! 126: #define I_BADPASS_MSG 34 /* what to say when passwd is wrong */
! 127: #define I_TIMESTAMPDIR 35 /* path to timestamp dir */
! 128: #define I_EXEMPT_GRP 36 /* no password or PATH override for these */
! 129: #define I_PASSPROMPT 37 /* password prompt */
! 130: #define I_RUNAS_DEF 38 /* default user to run commands as */
! 131: #define I_SECURE_PATH 39 /* set $PATH to this if not NULL */
! 132:
! 133: /*
! 134: * Macros for accessing sudo_defs_table.
! 135: */
! 136: #define def_flag(_i) (sudo_defs_table[(_i)].sd_un.flag)
! 137: #define def_ival(_i) (sudo_defs_table[(_i)].sd_un.ival)
! 138: #define def_str(_i) (sudo_defs_table[(_i)].sd_un.str)
! 139: #define def_mode(_i) (sudo_defs_table[(_i)].sd_un.mode)
! 140:
! 141: /*
! 142: * Prototypes
! 143: */
! 144: void dump_default __P((void));
! 145: int set_default __P((char *, char *, int));
! 146: void init_defaults __P((void));
! 147: void list_options __P((void));
! 148:
! 149: extern struct sudo_defs_types sudo_defs_table[];
! 150:
! 151: #endif /* _SUDO_DEFAULTS_H */