Debian Codegraph @

WWW/Library/Implementation/HTAAProt.h

raw
1 /* PROTECTION SETUP FILE
2
3 */
4
5 #ifndef HTAAPROT_H
6 #define HTAAPROT_H
7
8 #include <HTGroup.h>
9 #include <HTAssoc.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 /*
15
16 Server's Representation of Document (Tree) Protections
17
18 */ typedef struct {
19 char *ctemplate; /* Template for this protection */
20 char *filename; /* Current document file */
21 char *uid_name; /* Effective uid (name of it) */
22 char *gid_name; /* Effective gid (name of it) */
23 GroupDef *mask_group; /* Allowed users and IP addresses */
24 HTList *valid_schemes; /* Valid authentication schemes */
25 HTAssocList *values; /* Association list for scheme specific */
26 /* parameters. */
27 } HTAAProt;
28
29 /*
30
31 Callbacks for rule system
32
33 The following three functions are called by the rule system:
34
35 HTAA_clearProtections() when starting to translate a filename
36
37 HTAA_setDefaultProtection() when "defprot" rule is matched
38
39 HTAA_setCurrentProtection() when "protect" rule is matched
40
41 Protection setup files are cached by these functions.
42
43 */
44
45 /* PUBLIC HTAA_setDefaultProtection()
46 * SET THE DEFAULT PROTECTION MODE
47 * (called by rule system when a
48 * "defprot" rule is matched)
49 * ON ENTRY:
50 * cur_docname is the current result of rule translations.
51 * prot_filename is the protection setup file (second argument
52 * for "defprot" rule, optional)
53 * eff_ids contains user and group names separated by
54 * a dot, corresponding to the effective uid
55 * gid under which the server should run,
56 * default is "nobody.nogroup" (third argument
57 * for "defprot" rule, optional; can be given
58 * only if protection setup file is also given).
59 *
60 * ON EXIT:
61 * returns nothing.
62 * Sets the module-wide variable default_prot.
63 */
64 extern void HTAA_setDefaultProtection(const char *cur_docname,
65 const char *prot_filename,
66 const char *eff_ids);
67
68 /* PUBLIC HTAA_setCurrentProtection()
69 * SET THE CURRENT PROTECTION MODE
70 * (called by rule system when a
71 * "protect" rule is matched)
72 * ON ENTRY:
73 * cur_docname is the current result of rule translations.
74 * prot_filename is the protection setup file (second argument
75 * for "protect" rule, optional)
76 * eff_ids contains user and group names separated by
77 * a dot, corresponding to the effective uid
78 * gid under which the server should run,
79 * default is "nobody.nogroup" (third argument
80 * for "protect" rule, optional; can be given
81 * only if protection setup file is also given).
82 *
83 * ON EXIT:
84 * returns nothing.
85 * Sets the module-wide variable current_prot.
86 */
87 extern void HTAA_setCurrentProtection(const char *cur_docname,
88 const char *prot_filename,
89 const char *eff_ids);
90
91 /* SERVER INTERNAL HTAA_clearProtections()
92 * CLEAR DOCUMENT PROTECTION MODE
93 * (ALSO DEFAULT PROTECTION)
94 * (called by the rule system)
95 * ON ENTRY:
96 * No arguments.
97 *
98 * ON EXIT:
99 * returns nothing.
100 * Frees the memory used by protection information.
101 */
102 extern void HTAA_clearProtections(void);
103
104 /*
105
106 Getting Protection Settings
107
108 HTAA_getCurrentProtection() returns the current protection mode (if there was a
109 "protect" rule). NULL, if no "protect" rule has been matched.
110
111 HTAA_getDefaultProtection() sets the current protection mode to what it was set to
112 by "defprot" rule and also returns it (therefore after this call also
113 HTAA_getCurrentProtection() returns the same structure.
114
115 */
116
117 /* PUBLIC HTAA_getCurrentProtection()
118 * GET CURRENT PROTECTION SETUP STRUCTURE
119 * (this is set up by callbacks made from
120 * the rule system when matching "protect"
121 * (and "defprot") rules)
122 * ON ENTRY:
123 * HTTranslate() must have been called before calling
124 * this function.
125 *
126 * ON EXIT:
127 * returns a HTAAProt structure representing the
128 * protection setup of the HTTranslate()'d file.
129 * This must not be free()'d.
130 */
131 extern HTAAProt *HTAA_getCurrentProtection(void);
132
133 /* PUBLIC HTAA_getDefaultProtection()
134 * GET DEFAULT PROTECTION SETUP STRUCTURE
135 * (this is set up by callbacks made from
136 * the rule system when matching "defprot"
137 * rules)
138 * ON ENTRY:
139 * HTTranslate() must have been called before calling
140 * this function.
141 *
142 * ON EXIT:
143 * returns a HTAAProt structure representing the
144 * default protection setup of the HTTranslate()'d
145 * file (if HTAA_getCurrentProtection() returned
146 * NULL, i.e., if there is no "protect" rule
147 * but ACL exists, and we need to know default
148 * protection settings).
149 * This must not be free()'d.
150 */
151 extern HTAAProt *HTAA_getDefaultProtection(void);
152
153 /*
154
155 Get User and Group IDs to Which Set to
156
157 */
158
159 #ifndef NOUSERS
160 /* PUBLIC HTAA_getUid()
161 * GET THE USER ID TO CHANGE THE PROCESS UID TO
162 * ON ENTRY:
163 * No arguments.
164 *
165 * ON EXIT:
166 * returns the uid number to give to setuid() system call.
167 * Default is 65534 (nobody).
168 */
169 extern int HTAA_getUid(void);
170
171 /* PUBLIC HTAA_getGid()
172 * GET THE GROUP ID TO CHANGE THE PROCESS GID TO
173 * ON ENTRY:
174 * No arguments.
175 *
176 * ON EXIT:
177 * returns the uid number to give to setgid() system call.
178 * Default is 65534 (nogroup).
179 */
180 extern int HTAA_getGid(void);
181 #endif /* !NOUSERS */
182
183 /* PUBLIC HTAA_UidToName
184 * GET THE USER NAME
185 * ON ENTRY:
186 * The user-id
187 *
188 * ON EXIT:
189 * returns the user name
190 */
191 extern const char *HTAA_UidToName(int uid);
192
193 /* PUBLIC HTAA_NameToUid
194 * GET THE USER ID
195 * ON ENTRY:
196 * The user-name
197 *
198 * ON EXIT:
199 * returns the user id
200 */
201 extern int HTAA_NameToUid(const char *name);
202
203 /* PUBLIC HTAA_GidToName
204 * GET THE GROUP NAME
205 * ON ENTRY:
206 * The group-id
207 *
208 * ON EXIT:
209 * returns the group name
210 */
211 extern const char *HTAA_GidToName(int gid);
212
213 /* PUBLIC HTAA_NameToGid
214 * GET THE GROUP ID
215 * ON ENTRY:
216 * The group-name
217 *
218 * ON EXIT:
219 * returns the group id
220 */
221 extern int HTAA_NameToGid(const char *name);
222
223 #ifdef __cplusplus
224 }
225 #endif
226 #endif /* not HTAAPROT_H */