]> git.armaanb.net Git - opendoas.git/blobdiff - doas.h
the environment handling code was showing its age. just because environ is a char...
[opendoas.git] / doas.h
diff --git a/doas.h b/doas.h
index 235df9fc43539132a4af70dada4a155afb471fda..88b2223462e3cede9f1dfc2e5f8c06a884e11e14 100644 (file)
--- a/doas.h
+++ b/doas.h
@@ -1,5 +1,20 @@
 /* $OpenBSD: doas.h,v 1.3 2015/07/21 11:04:06 zhuk Exp $ */
 
+#include <sys/tree.h>
+
+struct envnode {
+       RB_ENTRY(envnode) node;
+       const char *key;
+       const char *value;
+};
+
+struct env {
+       RB_HEAD(envtree, envnode) root;
+       u_int count;
+};
+
+RB_PROTOTYPE(envtree, envnode, node, envcmp)
+
 struct rule {
        int action;
        int options;
@@ -16,6 +31,10 @@ extern int parse_errors;
 
 size_t arraylen(const char **);
 
+struct env *createenv(char **);
+struct env *filterenv(struct env *, struct rule *);
+char **flattenenv(struct env *);
+
 #define PERMIT 1
 #define DENY   2