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

1.1       millert     1: /*
1.8       millert     2:  * Copyright (c) 1999-2005, 2008
                      3:  *     Todd C. Miller <Todd.Miller@courtesan.com>
1.1       millert     4:  *
1.7       millert     5:  * Permission to use, copy, modify, and distribute this software for any
                      6:  * purpose with or without fee is hereby granted, provided that the above
                      7:  * copyright notice and this permission notice appear in all copies.
                      8:  *
                      9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       millert    16:  *
1.6       millert    17:  * Sponsored in part by the Defense Advanced Research Projects
                     18:  * Agency (DARPA) and Air Force Research Laboratory, Air Force
                     19:  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
1.1       millert    20:  */
                     21:
                     22: #ifndef _SUDO_DEFAULTS_H
                     23: #define _SUDO_DEFAULTS_H
                     24:
1.7       millert    25: #include <def_data.h>
                     26:
1.5       millert    27: struct list_member {
                     28:     char *value;
                     29:     struct list_member *next;
                     30: };
                     31:
1.7       millert    32: struct def_values {
                     33:     char *sval;                /* string value */
                     34:     int ival;          /* actually an enum */
                     35: };
                     36:
1.5       millert    37: enum list_ops {
                     38:     add,
                     39:     delete,
                     40:     freeall
                     41: };
                     42:
1.1       millert    43: /*
                     44:  * Structure describing compile-time and run-time options.
                     45:  */
                     46: struct sudo_defs_types {
                     47:     char *name;
                     48:     int type;
1.3       millert    49:     char *desc;
1.7       millert    50:     struct def_values *values;
                     51:     int (*callback) __P((char *));
1.1       millert    52:     union {
                     53:        int flag;
1.5       millert    54:        int ival;
1.7       millert    55:        enum def_tupple tuple;
1.1       millert    56:        char *str;
                     57:        mode_t mode;
1.5       millert    58:        struct list_member *list;
1.1       millert    59:     } sd_un;
                     60: };
                     61:
                     62: /*
                     63:  * Four types of defaults: strings, integers, and flags.
                     64:  * Also, T_INT or T_STR may be ANDed with T_BOOL to indicate that
                     65:  * a value is not required.  Flags are boolean by nature...
                     66:  */
                     67: #undef T_INT
                     68: #define T_INT          0x001
1.5       millert    69: #undef T_UINT
                     70: #define T_UINT         0x002
1.1       millert    71: #undef T_STR
1.5       millert    72: #define T_STR          0x003
1.1       millert    73: #undef T_FLAG
1.5       millert    74: #define T_FLAG         0x004
1.1       millert    75: #undef T_MODE
1.5       millert    76: #define T_MODE         0x005
                     77: #undef T_LIST
                     78: #define T_LIST         0x006
1.1       millert    79: #undef T_LOGFAC
1.5       millert    80: #define T_LOGFAC       0x007
1.1       millert    81: #undef T_LOGPRI
1.5       millert    82: #define T_LOGPRI       0x008
1.7       millert    83: #undef T_TUPLE
                     84: #define T_TUPLE                0x009
1.1       millert    85: #undef T_MASK
                     86: #define T_MASK         0x0FF
                     87: #undef T_BOOL
                     88: #define T_BOOL         0x100
                     89: #undef T_PATH
                     90: #define T_PATH         0x200
                     91:
                     92: /*
1.8       millert    93:  * Argument to update_defaults()
                     94:  */
                     95: #define SETDEF_GENERIC 0x01
                     96: #define        SETDEF_HOST     0x02
                     97: #define        SETDEF_USER     0x04
                     98: #define        SETDEF_RUNAS    0x08
                     99: #define        SETDEF_CMND     0x10
                    100: #define SETDEF_ALL     (SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER|SETDEF_RUNAS|SETDEF_CMND)
                    101:
                    102: /*
1.1       millert   103:  * Prototypes
                    104:  */
                    105: void dump_default      __P((void));
                    106: int set_default                __P((char *, char *, int));
                    107: void init_defaults     __P((void));
1.8       millert   108: int update_defaults    __P((int));
1.1       millert   109: void list_options      __P((void));
                    110:
                    111: extern struct sudo_defs_types sudo_defs_table[];
                    112:
                    113: #endif /* _SUDO_DEFAULTS_H */