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