Annotation of src/usr.bin/sudo/defaults.h, Revision 1.8
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.
20: *
1.8 ! millert 21: * $Sudo: defaults.h,v 1.33 2008/11/09 14:13:12 millert Exp $
1.1 millert 22: */
23:
24: #ifndef _SUDO_DEFAULTS_H
25: #define _SUDO_DEFAULTS_H
26:
1.7 millert 27: #include <def_data.h>
28:
1.5 millert 29: struct list_member {
30: char *value;
31: struct list_member *next;
32: };
33:
1.7 millert 34: struct def_values {
35: char *sval; /* string value */
36: int ival; /* actually an enum */
37: };
38:
1.5 millert 39: enum list_ops {
40: add,
41: delete,
42: freeall
43: };
44:
1.1 millert 45: /*
46: * Structure describing compile-time and run-time options.
47: */
48: struct sudo_defs_types {
49: char *name;
50: int type;
1.3 millert 51: char *desc;
1.7 millert 52: struct def_values *values;
53: int (*callback) __P((char *));
1.1 millert 54: union {
55: int flag;
1.5 millert 56: int ival;
1.7 millert 57: enum def_tupple tuple;
1.1 millert 58: char *str;
59: mode_t mode;
1.5 millert 60: struct list_member *list;
1.1 millert 61: } sd_un;
62: };
63:
64: /*
65: * Four types of defaults: strings, integers, and flags.
66: * Also, T_INT or T_STR may be ANDed with T_BOOL to indicate that
67: * a value is not required. Flags are boolean by nature...
68: */
69: #undef T_INT
70: #define T_INT 0x001
1.5 millert 71: #undef T_UINT
72: #define T_UINT 0x002
1.1 millert 73: #undef T_STR
1.5 millert 74: #define T_STR 0x003
1.1 millert 75: #undef T_FLAG
1.5 millert 76: #define T_FLAG 0x004
1.1 millert 77: #undef T_MODE
1.5 millert 78: #define T_MODE 0x005
79: #undef T_LIST
80: #define T_LIST 0x006
1.1 millert 81: #undef T_LOGFAC
1.5 millert 82: #define T_LOGFAC 0x007
1.1 millert 83: #undef T_LOGPRI
1.5 millert 84: #define T_LOGPRI 0x008
1.7 millert 85: #undef T_TUPLE
86: #define T_TUPLE 0x009
1.1 millert 87: #undef T_MASK
88: #define T_MASK 0x0FF
89: #undef T_BOOL
90: #define T_BOOL 0x100
91: #undef T_PATH
92: #define T_PATH 0x200
93:
94: /*
1.8 ! millert 95: * Argument to update_defaults()
! 96: */
! 97: #define SETDEF_GENERIC 0x01
! 98: #define SETDEF_HOST 0x02
! 99: #define SETDEF_USER 0x04
! 100: #define SETDEF_RUNAS 0x08
! 101: #define SETDEF_CMND 0x10
! 102: #define SETDEF_ALL (SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER|SETDEF_RUNAS|SETDEF_CMND)
! 103:
! 104: /*
1.1 millert 105: * Prototypes
106: */
107: void dump_default __P((void));
108: int set_default __P((char *, char *, int));
109: void init_defaults __P((void));
1.8 ! millert 110: int update_defaults __P((int));
1.1 millert 111: void list_options __P((void));
112:
113: extern struct sudo_defs_types sudo_defs_table[];
114:
115: #endif /* _SUDO_DEFAULTS_H */