switch from rcS.d to rc[0-6].d
[debian/sudo] / defaults.h
1 /*
2  * Copyright (c) 1999-2005, 2008
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  * $Sudo: defaults.h,v 1.33 2008/11/09 14:13:12 millert Exp $
22  */
23
24 #ifndef _SUDO_DEFAULTS_H
25 #define _SUDO_DEFAULTS_H
26
27 #include <def_data.h>
28
29 struct list_member {
30     char *value;
31     struct list_member *next;
32 };
33
34 struct def_values {
35     char *sval;         /* string value */
36     int ival;           /* actually an enum */
37 };
38
39 enum list_ops {
40     add,
41     delete,
42     freeall
43 };
44
45 /*
46  * Structure describing compile-time and run-time options.
47  */
48 struct sudo_defs_types {
49     char *name;
50     int type;
51     char *desc;
52     struct def_values *values;
53     int (*callback) __P((char *));
54     union {
55         int flag;
56         int ival;
57         enum def_tupple tuple;
58         char *str;
59         mode_t mode;
60         struct list_member *list;
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
71 #undef T_UINT
72 #define T_UINT          0x002
73 #undef T_STR
74 #define T_STR           0x003
75 #undef T_FLAG
76 #define T_FLAG          0x004
77 #undef T_MODE
78 #define T_MODE          0x005
79 #undef T_LIST
80 #define T_LIST          0x006
81 #undef T_LOGFAC
82 #define T_LOGFAC        0x007
83 #undef T_LOGPRI
84 #define T_LOGPRI        0x008
85 #undef T_TUPLE
86 #define T_TUPLE         0x009
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 /*
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 /*
105  * Prototypes
106  */
107 void dump_default       __P((void));
108 int set_default         __P((char *, char *, int));
109 void init_defaults      __P((void));
110 int update_defaults     __P((int));
111 void list_options       __P((void));
112
113 extern struct sudo_defs_types sudo_defs_table[];
114
115 #endif /* _SUDO_DEFAULTS_H */