]> git.armaanb.net Git - opendoas.git/blob - doas.h
the environment handling code was showing its age. just because environ is a char...
[opendoas.git] / doas.h
1 /* $OpenBSD: doas.h,v 1.3 2015/07/21 11:04:06 zhuk Exp $ */
2
3 #include <sys/tree.h>
4
5 struct envnode {
6         RB_ENTRY(envnode) node;
7         const char *key;
8         const char *value;
9 };
10
11 struct env {
12         RB_HEAD(envtree, envnode) root;
13         u_int count;
14 };
15
16 RB_PROTOTYPE(envtree, envnode, node, envcmp)
17
18 struct rule {
19         int action;
20         int options;
21         const char *ident;
22         const char *target;
23         const char *cmd;
24         const char **cmdargs;
25         const char **envlist;
26 };
27
28 extern struct rule **rules;
29 extern int nrules, maxrules;
30 extern int parse_errors;
31
32 size_t arraylen(const char **);
33
34 struct env *createenv(char **);
35 struct env *filterenv(struct env *, struct rule *);
36 char **flattenenv(struct env *);
37
38 #define PERMIT  1
39 #define DENY    2
40
41 #define NOPASS          0x1
42 #define KEEPENV         0x2