Annotation of embedaddon/sudo/plugins/sudoers/defaults.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (c) 1999-2005, 2008-2010
3: * Todd C. Miller <Todd.Miller@courtesan.com>
4: *
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.
16: *
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: */
21:
22: #ifndef _SUDO_DEFAULTS_H
23: #define _SUDO_DEFAULTS_H
24:
25: #include <def_data.h>
26:
27: struct list_member {
28: char *value;
29: struct list_member *next;
30: };
31:
32: struct def_values {
33: char *sval; /* string value */
34: int ival; /* actually an enum */
35: };
36:
37: enum list_ops {
38: add,
39: delete,
40: freeall
41: };
42:
43: /*
44: * Structure describing compile-time and run-time options.
45: */
46: struct sudo_defs_types {
47: char *name;
48: int type;
49: char *desc;
50: struct def_values *values;
51: int (*callback)(const char *);
52: union {
53: int flag;
54: int ival;
55: double fval;
56: enum def_tuple tuple;
57: char *str;
58: mode_t mode;
59: struct list_member *list;
60: } sd_un;
61: };
62:
63: /*
64: * Four types of defaults: strings, integers, and flags.
65: * Also, T_INT, T_FLOAT 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
70: #undef T_UINT
71: #define T_UINT 0x002
72: #undef T_STR
73: #define T_STR 0x003
74: #undef T_FLAG
75: #define T_FLAG 0x004
76: #undef T_MODE
77: #define T_MODE 0x005
78: #undef T_LIST
79: #define T_LIST 0x006
80: #undef T_LOGFAC
81: #define T_LOGFAC 0x007
82: #undef T_LOGPRI
83: #define T_LOGPRI 0x008
84: #undef T_TUPLE
85: #define T_TUPLE 0x009
86: #undef T_FLOAT
87: #define T_FLOAT 0x010
88: #undef T_MASK
89: #define T_MASK 0x0FF
90: #undef T_BOOL
91: #define T_BOOL 0x100
92: #undef T_PATH
93: #define T_PATH 0x200
94:
95: /*
96: * Argument to update_defaults()
97: */
98: #define SETDEF_GENERIC 0x01
99: #define SETDEF_HOST 0x02
100: #define SETDEF_USER 0x04
101: #define SETDEF_RUNAS 0x08
102: #define SETDEF_CMND 0x10
103: #define SETDEF_ALL (SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER|SETDEF_RUNAS|SETDEF_CMND)
104:
105: /*
106: * Prototypes
107: */
108: void dump_default(void);
109: void init_defaults(void);
110: int set_default(char *, char *, int);
111: int update_defaults(int);
112:
113: extern struct sudo_defs_types sudo_defs_table[];
114:
115: #endif /* _SUDO_DEFAULTS_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>