Imported Debian patch 1.6.8p9-2
[debian/sudo] / defaults.h
1 /*
2  * Copyright (c) 1999-2001 Todd C. Miller <Todd.Miller@courtesan.com>
3  *
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.
15  *
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  *
20  * $Sudo: defaults.h,v 1.28 2004/02/13 21:36:43 millert Exp $
21  */
22
23 #ifndef _SUDO_DEFAULTS_H
24 #define _SUDO_DEFAULTS_H
25
26 #include <def_data.h>
27
28 struct list_member {
29     char *value;
30     struct list_member *next;
31 };
32
33 struct def_values {
34     char *sval;         /* string value */
35     int ival;           /* actually an enum */
36 };
37
38 enum list_ops {
39     add,
40     delete,
41     freeall
42 };
43
44 /*
45  * Structure describing compile-time and run-time options.
46  */
47 struct sudo_defs_types {
48     char *name;
49     int type;
50     char *desc;
51     struct def_values *values;
52     int (*callback) __P((char *));
53     union {
54         int flag;
55         int ival;
56         enum def_tupple 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 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_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 */