[BACK]Return to defaults.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Annotation of src/usr.bin/sudo/defaults.h, Revision 1.6

1.1       millert     1: /*
1.5       millert     2:  * Copyright (c) 1999-2001 Todd C. Miller <Todd.Miller@courtesan.com>
1.1       millert     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.6     ! millert    34:  * Sponsored in part by the Defense Advanced Research Projects
        !            35:  * Agency (DARPA) and Air Force Research Laboratory, Air Force
        !            36:  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
        !            37:  *
        !            38:  * $Sudo: defaults.h,v 1.24 2003/04/16 00:42:09 millert Exp $
1.1       millert    39:  */
                     40:
                     41: #ifndef _SUDO_DEFAULTS_H
                     42: #define _SUDO_DEFAULTS_H
                     43:
1.5       millert    44: struct list_member {
                     45:     char *value;
                     46:     struct list_member *next;
                     47: };
                     48:
                     49: enum list_ops {
                     50:     add,
                     51:     delete,
                     52:     freeall
                     53: };
                     54:
1.1       millert    55: /*
                     56:  * Structure describing compile-time and run-time options.
                     57:  */
                     58: struct sudo_defs_types {
                     59:     char *name;
                     60:     int type;
1.3       millert    61:     char *desc;
1.1       millert    62:     union {
                     63:        int flag;
1.5       millert    64:        int ival;
1.1       millert    65:        char *str;
                     66:        mode_t mode;
1.5       millert    67:        struct list_member *list;
1.1       millert    68:     } sd_un;
                     69: };
                     70:
                     71: /*
                     72:  * Four types of defaults: strings, integers, and flags.
                     73:  * Also, T_INT or T_STR may be ANDed with T_BOOL to indicate that
                     74:  * a value is not required.  Flags are boolean by nature...
                     75:  */
                     76: #undef T_INT
                     77: #define T_INT          0x001
1.5       millert    78: #undef T_UINT
                     79: #define T_UINT         0x002
1.1       millert    80: #undef T_STR
1.5       millert    81: #define T_STR          0x003
1.1       millert    82: #undef T_FLAG
1.5       millert    83: #define T_FLAG         0x004
1.1       millert    84: #undef T_MODE
1.5       millert    85: #define T_MODE         0x005
                     86: #undef T_LIST
                     87: #define T_LIST         0x006
1.1       millert    88: #undef T_LOGFAC
1.5       millert    89: #define T_LOGFAC       0x007
1.1       millert    90: #undef T_LOGPRI
1.5       millert    91: #define T_LOGPRI       0x008
1.3       millert    92: #undef T_PWFLAG
1.5       millert    93: #define T_PWFLAG       0x009
1.1       millert    94: #undef T_MASK
                     95: #define T_MASK         0x0FF
                     96: #undef T_BOOL
                     97: #define T_BOOL         0x100
                     98: #undef T_PATH
                     99: #define T_PATH         0x200
                    100:
                    101: /*
                    102:  * Indexes into sudo_defs_table
                    103:  */
1.5       millert   104: #include <def_data.h>
                    105: #define I_LOGFAC       I_SYSLOG_IFAC
                    106: #define I_GOODPRI      I_SYSLOG_IGOODPRI
                    107: #define I_BADPRI       I_SYSLOG_IBADPRI
1.1       millert   108:
                    109: /*
                    110:  * Macros for accessing sudo_defs_table.
                    111:  */
                    112: #define def_flag(_i)   (sudo_defs_table[(_i)].sd_un.flag)
                    113: #define def_ival(_i)   (sudo_defs_table[(_i)].sd_un.ival)
                    114: #define def_str(_i)    (sudo_defs_table[(_i)].sd_un.str)
1.5       millert   115: #define def_list(_i)   (sudo_defs_table[(_i)].sd_un.list)
1.1       millert   116: #define def_mode(_i)   (sudo_defs_table[(_i)].sd_un.mode)
                    117:
                    118: /*
                    119:  * Prototypes
                    120:  */
                    121: void dump_default      __P((void));
                    122: int set_default                __P((char *, char *, int));
                    123: void init_defaults     __P((void));
                    124: void list_options      __P((void));
                    125:
                    126: extern struct sudo_defs_types sudo_defs_table[];
                    127:
                    128: #endif /* _SUDO_DEFAULTS_H */