[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.5

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