1 |
aramv |
886 |
/*! |
2 |
|
|
|
3 |
|
|
\file eef_polytypes.h |
4 |
|
|
\brief API of the EEF internal types |
5 |
|
|
\author Aram Verstegen |
6 |
|
|
|
7 |
|
|
*/ |
8 |
aramv |
425 |
#ifndef POLYTYPES_H |
9 |
|
|
#define POLYTYPES_H |
10 |
aramv |
874 |
#if HAVE_CONFIG_H |
11 |
aramv |
1430 |
#include "eef_config.h" |
12 |
aramv |
874 |
#endif |
13 |
aramv |
594 |
#if HAVE_STDDEF_H |
14 |
aramv |
425 |
#include <stddef.h> |
15 |
aramv |
594 |
#endif |
16 |
|
|
#if HAVE_WCHAR_H |
17 |
aramv |
592 |
#include <wchar.h> |
18 |
aramv |
594 |
#endif |
19 |
|
|
#if HAVE_STDIO_H |
20 |
aramv |
592 |
#include <stdio.h> |
21 |
aramv |
594 |
#endif |
22 |
aramv |
790 |
#if HAVE_LINUX_LIMITS_H |
23 |
|
|
#include <linux/limits.h> |
24 |
|
|
#else |
25 |
aramv |
874 |
#if HAVE_SYS_PARAM_H |
26 |
|
|
/* most bsd's */ |
27 |
aramv |
789 |
#include <sys/param.h> |
28 |
aramv |
594 |
#endif |
29 |
aramv |
874 |
#endif |
30 |
aramv |
425 |
|
31 |
aramv |
878 |
#define MAXPROCS 5 |
32 |
|
|
#define LCMAPS_MAXARGSTRING 2000 |
33 |
aramv |
425 |
|
34 |
aramv |
1345 |
/* Function pointer type */ |
35 |
aramv |
874 |
typedef void *eef_proc_t; |
36 |
aramv |
502 |
|
37 |
aramv |
525 |
/*! Identifiers for linked process symbols */ |
38 |
aramv |
1345 |
typedef enum eef_proctype_e { |
39 |
aramv |
502 |
INITPROC, /*!< this value corresponds to the plugin initialization function */ |
40 |
|
|
RUNPROC, /*!< this value corresponds to the plugin run function (get credentials) */ |
41 |
|
|
TERMPROC, /*!< this value corresponds to the plugin termination function */ |
42 |
|
|
INTROPROC, /*!< this value corresponds to the plugin introspect function */ |
43 |
|
|
VERIFYPROC, /*!< this value corresponds to the plugin verification function */ |
44 |
|
|
ENDOFPROCS /*< this is the last enumeration value */ |
45 |
aramv |
874 |
} eef_proctype_t; |
46 |
aramv |
502 |
|
47 |
|
|
|
48 |
aramv |
525 |
/*! Argument types */ |
49 |
aramv |
1345 |
typedef enum { |
50 |
aramv |
425 |
TYPE_NONE, |
51 |
|
|
TYPE_SCHAR, |
52 |
|
|
TYPE_UCHAR, |
53 |
|
|
TYPE_SHORT, |
54 |
|
|
TYPE_USHORT, |
55 |
|
|
TYPE_INT, |
56 |
|
|
TYPE_UINT, |
57 |
|
|
TYPE_LONGINT, |
58 |
|
|
TYPE_ULONGINT, |
59 |
|
|
#ifdef HAVE_LONG_LONG_INT |
60 |
|
|
TYPE_LONGLONGINT, |
61 |
|
|
TYPE_ULONGLONGINT, |
62 |
|
|
#endif |
63 |
|
|
TYPE_FLOAT, |
64 |
|
|
TYPE_DOUBLE, |
65 |
|
|
#ifdef HAVE_LONG_DOUBLE |
66 |
|
|
TYPE_LONGDOUBLE, |
67 |
|
|
#endif |
68 |
|
|
TYPE_CHAR, |
69 |
|
|
#ifdef HAVE_WINT_T |
70 |
|
|
TYPE_WIDE_CHAR, |
71 |
|
|
#endif |
72 |
|
|
TYPE_STRING, |
73 |
|
|
#ifdef HAVE_WCHAR_T |
74 |
|
|
TYPE_WIDE_STRING, |
75 |
|
|
#endif |
76 |
|
|
TYPE_POINTER, |
77 |
|
|
TYPE_COUNT_SCHAR_POINTER, |
78 |
|
|
TYPE_COUNT_SHORT_POINTER, |
79 |
|
|
TYPE_COUNT_INT_POINTER, |
80 |
aramv |
473 |
TYPE_COUNT_LONGINT_POINTER, |
81 |
aramv |
425 |
#ifdef HAVE_LONG_LONG_INT |
82 |
aramv |
878 |
TYPE_COUNT_LONGLONGINT_POINTER, |
83 |
aramv |
425 |
#endif |
84 |
aramv |
878 |
TYPE_PEM, |
85 |
|
|
TYPE_X509, |
86 |
|
|
TYPE_STACK_OF_X509, |
87 |
|
|
TYPE_EVP_PKEY |
88 |
aramv |
874 |
} eef_arg_type; |
89 |
aramv |
425 |
|
90 |
aramv |
525 |
/*! |
91 |
|
|
* \brief Node structure to hold plugin nodes |
92 |
|
|
*/ |
93 |
aramv |
874 |
typedef struct eef_plugindl_s |
94 |
aramv |
425 |
{ |
95 |
aramv |
1142 |
void * handle; /*!< dlopen handle to plugin module */ |
96 |
|
|
eef_proc_t procs[MAXPROCS]; /*!< list of handles to interface functions of plugin */ |
97 |
aramv |
1155 |
char name[FILENAME_MAX]; /*!< name of plugin */ |
98 |
|
|
char args[LCMAPS_MAXARGSTRING]; /*!< argument string */ |
99 |
aramv |
1142 |
int init_argc; /*!< number of arguments for the initialization function */ |
100 |
|
|
char * init_argv[ARG_MAX]; /*!< list of arguments for the initialization function */ |
101 |
|
|
struct eef_plugindl_s * next; /*!< pointer to the next plugin in the plugin list */ |
102 |
aramv |
878 |
} eef_plugindl_t; |
103 |
aramv |
425 |
|
104 |
aramv |
1345 |
|
105 |
|
|
/* Policy parser types */ |
106 |
|
|
|
107 |
aramv |
890 |
/*! |
108 |
aramv |
1154 |
* \brief Structure for symbols used by the parser internally |
109 |
|
|
*/ |
110 |
aramv |
1345 |
typedef struct em_record_s { |
111 |
|
|
char* string; /*!< Hold the symbol that lex has found. */ |
112 |
|
|
int lineno; /*!< Hold the line number the symbol has been found. */ |
113 |
aramv |
1154 |
} record_t; |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
/*! |
117 |
|
|
* \brief Structure keeps track of the variables, their value and the line number they are defined on. |
118 |
|
|
*/ |
119 |
aramv |
1345 |
typedef struct em_var_s { |
120 |
|
|
char* name; /*!< Name of the variable. */ |
121 |
|
|
char* value; /*!< Value of the variable. */ |
122 |
|
|
unsigned int lineno; /*!< Line number the variable appears on. */ |
123 |
|
|
struct em_var_s* next; /*!< Next variable, or 0 if none. */ |
124 |
aramv |
1154 |
} var_t; |
125 |
|
|
|
126 |
|
|
/*! |
127 |
|
|
* \brief Structure to make a tree of |
128 |
|
|
* |
129 |
|
|
*/ |
130 |
aramv |
1345 |
typedef struct em_rule_s { |
131 |
|
|
unsigned int lineno; /*!< Line number where rule appeared. */ |
132 |
|
|
char* state; /*!< Name of the state.*/ |
133 |
|
|
struct em_rule_s* true_branch; /*!< True branch or NULL if none */ |
134 |
|
|
struct em_rule_s* false_branch; /*!< False branch or NULL if none */ |
135 |
|
|
struct em_rule_s* next; /*!< Next rule, or NULL if none */ |
136 |
|
|
eef_plugindl_t* plugin; |
137 |
aramv |
1154 |
} rule_t; |
138 |
|
|
|
139 |
|
|
/*! |
140 |
|
|
* \brief Structure to build a tree of plugins as defined in a policy in the config file |
141 |
|
|
*/ |
142 |
aramv |
1345 |
typedef struct em_policy_s { |
143 |
|
|
char* name; |
144 |
|
|
unsigned int lineno; |
145 |
|
|
rule_t* rules; |
146 |
|
|
int rules_list_transformed_to_tree; |
147 |
|
|
struct em_policy_s* next; |
148 |
aramv |
1154 |
} policy_t; |
149 |
|
|
|
150 |
|
|
|
151 |
aramv |
1345 |
typedef struct aos_attribute_s { |
152 |
|
|
char * id; /*! a label to identify the data */ |
153 |
|
|
char * issuer; /*! a string to identify the issuer */ |
154 |
|
|
char * type; /*! a type identifier */ |
155 |
|
|
int needs_free; /*! a flag that determines wheter the data should be free'd */ |
156 |
|
|
void* data; /*! a pointer to store the data */ |
157 |
|
|
struct aos_attribute_s * parent; /*! a pointer to the 'parent' object */ |
158 |
|
|
struct aos_attribute_s * child; /*! a pointer to the 'child' object */ |
159 |
|
|
struct aos_attribute_s * next; /*! a pointer to the next node */ |
160 |
|
|
eef_plugindl_t * setting_plugin; /*! a pointer to the plugin that initialized this data */ |
161 |
|
|
} aos_attribute_t; |
162 |
|
|
|
163 |
|
|
typedef enum aos_context_class_e { |
164 |
|
|
SUBJECT, |
165 |
|
|
ACTION, |
166 |
|
|
RESOURCE, |
167 |
|
|
ENVIRONMENT, |
168 |
|
|
NONE, |
169 |
|
|
ANY, |
170 |
|
|
OBLIGATION |
171 |
|
|
} aos_context_class_t; |
172 |
|
|
|
173 |
|
|
typedef struct aos_context_s { |
174 |
|
|
aos_attribute_t * list_attributes; |
175 |
|
|
aos_attribute_t * last_attribute; |
176 |
|
|
aos_context_class_t context_class; |
177 |
|
|
char* obligation_name; |
178 |
|
|
struct aos_context_s * next; |
179 |
|
|
} aos_context_t; |
180 |
|
|
|
181 |
|
|
typedef struct aos_storage_s { |
182 |
|
|
aos_context_t * list_contexts; |
183 |
|
|
aos_context_t * last_context; |
184 |
|
|
} aos_storage_t; |
185 |
|
|
|
186 |
|
|
|
187 |
aramv |
425 |
#endif |