]> git.sur5r.net Git - openldap/blob - contrib/tweb/init_exp.h
* configure.in: add tcl8.2 to list of tcl libs to search for, also added new MOD_TCL_LIB
[openldap] / contrib / tweb / init_exp.h
1 /*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
2 *                                                                          *
3 * init_exp.h.                                                              *
4 *                                                                          *
5 * Function:..File for TWEB-SOFTWARE                                        *
6 *                                                                          *
7 *                                                                          *
8 *                                                                          *
9 * Authors:...Dr. Kurt Spanier & Bernhard Winkler,                          *
10 *            Zentrum fuer Datenverarbeitung, Bereich Entwicklung           *
11 *            neuer Dienste, Universitaet Tuebingen, GERMANY                *
12 *                                                                          *
13 *                                       ZZZZZ  DDD    V   V                *
14 *            Creation date:                Z   D  D   V   V                *
15 *            July 21 1995                 Z    D   D   V V                 *
16 *            Last modification:          Z     D  D    V V                 *
17 *            May 11 1999                ZZZZ   DDD      V                  *
18 *                                                                          *
19 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
20 /*
21  * $Id: init_exp.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
22  *
23  */
24
25
26 #ifndef _INIT_EXP_
27 #define _INIT_EXP_
28
29 #ifdef TUE_TEL
30 #  include  "tueTel_exp.h"
31 #endif
32
33 #include "regular_exp.h"
34
35 PUBLIC int  get_str_param(/* FILELINE *inLine, char **str,
36                              GLOB_STRUCT *glob, int lower */);
37
38 PUBLIC void getopts ();
39 PUBLIC void check ();
40 PUBLIC void init();
41 PUBLIC void output();
42 PUBLIC void langinit();
43 PUBLIC void langoutput();
44 PUBLIC void get_lang();
45 PUBLIC void file_test();
46 PUBLIC int  do_readf();
47 PUBLIC void get_index_url_rules();
48 PUBLIC void re_read_index_url_rules();
49
50 extern  STRDISP  disp_types[];
51
52
53 /* A pointer to an integer-function */
54 typedef int (*IFP)();
55
56
57 /* One line in the config-file, with line-counter */
58 typedef struct _fileline {
59     char value[BUFSIZ];
60     int count;
61 } FILELINE;
62
63
64 /* Table-structure to parse the key-words in the config- und rc-files */
65 typedef struct _parse_keys {
66     char *keyWord;
67     IFP   keyFunc;
68     struct _parse_keys *subTable;
69 } PARSE_ENTRY;
70
71
72 /* Maximum number of sub-lists in order to display result-lists */
73 #define MAX_OCS 128
74
75 /* List of attributes which will be displayed (on 1./2. page) */
76 typedef struct _display_line {
77     char *attribute;              /* the X.500-Attribute */
78     char *label;                  /* the Label of the Web-Page */
79     char *type;                   /* the Format-Type as String (C-Option) */
80     int ty;                       /* the Format-Type as Int (print-Funkt.) */
81     struct _display_line *next;   /* the next Attribute */
82 } DISPLAY_LINE, *pDISPLAY_LINE;
83
84
85 /* List of Object-Classes which shall be displayed */
86 typedef struct _display {
87     char *ocs;                    /* the X.500-Object-Class(es) */
88     DISPLAY_LINE *first_page;     /* Attribute on the first page */
89     DISPLAY_LINE *second_page;    /* Attribute on the second page */
90     struct _display *next;        /* the next Objekt-Class(es) */
91 } DISPLAY, *pDISPLAY;
92
93
94 /* List of attributes which may be modified */
95 typedef struct _modify_line {
96     char *attribute;              /* the X.500-attribute */
97     char *label;                  /* the Label in the modification-formulare */
98     int   count;                  /* the maximmum number of attribute-values */
99     struct _modify_line *next;    /* the next attribute */
100 } MODIFY_LINE, *pMODIFY_LINE;
101
102 /* List of Object-Class(es) which may be modified */
103 typedef struct _modify {
104     char *ocs;                    /* the X.500-Object-Class(es) */
105     MODIFY_LINE *modattr;         /* the modifyable attributes */
106     struct _modify *next;         /* the next Object-Class(es) */
107 } MODIF, *pMODIF;
108
109 /*attributes which are read from another entry */
110 typedef struct _ind_attr_arr {
111     char *key;                    /* pers for person etc. */
112     int replace;                  /* 2 -> function, 1 -> replace, 0 -> append */
113     char *attr;                   /* functionname / referenced attribute */
114     char *host;                   /* on which host to look */
115     int port;                     /* on which port to look */
116     char *base;                   /* where to look for ref-entry */
117     LDAPMessage **e;              /* Pointer to the result */
118     LDAP *ld;                     /* Pointer to the matching LDAP-Struct */
119 } IND_ATTR_ARR;
120
121 typedef struct _ind_attrs {
122     char *ref_attr;               /* name of the reference-attribute */
123     IND_ATTR_ARR *valid_nodes;    /* valid nodes array (only in 1st element) */
124     IND_ATTR_ARR *ia_arr;         /* supported keys, attrs and bases */
125     struct _ind_attrs *next;      /* the next ind_attr */
126 } IND_ATTRS, *pIND_ATTRS;
127
128
129 /* Support-structure to sort the result-lists */
130 typedef struct _dncompare {
131     char *string;                 /* Sort-String */
132     char *href;                   /* Hyper-Link for the sorted entry */
133     char *raw;                    /* Raw data:                                                                         -> <name>[<attr>=<value>&..%..$.. */
134 } DNLIST, *pDNLIST;
135
136
137 /* Structure to sort the result-lists object-class/attribute-related */
138 typedef struct _sort_line {
139     char *object_class;           /* Object-class by which is sorted */
140     char *label;                  /* Label to display sub-lists */
141     int   priority;               /* Sequence for list-output */
142     char *display_class;          /* dedicated display-class */
143     DISPLAY *display_class_ptr;   /* Pointer therefor */
144     char *sort_attr;              /* Attribut by which sorting is done */
145     pDNLIST *dnList;              /* Entries in the sub-list */
146     int  dnLast;                  /* Amount of entries in the sub-list */
147     int restricted;               /* 1 -> sub-list was restricted : 0 -> not*/
148     struct _sort_line *next;      /* the next Object-Class */
149 } SORT_LINE, *pSORT_LINE;
150
151 /* Structure to handle caching */
152
153 typedef struct _caching_terms_line {
154     int time;                     /* time to cache */
155     char *access_type;            /* type of access */
156     int rdn_oc;                   /* 1 -> rdn, 0 -> oc -lookup */
157     char *pattern;                /* mach-pattern: oc/rdn */
158     struct _caching_terms_line *next; /* the next line */
159 } CACHING_TERMS_LINE, *pCACHING_TERMS_LINE;
160
161
162 /* DN of the TWEB-Homepage, including header and footer thereof */
163 typedef struct _basedn_line {
164     char *dn;
165     char **dnarray;
166     char *head;
167     char *foot;
168 } BASEDN_LINE;
169
170 /* List of rules for table-button and table display */
171 typedef struct _table_display {
172     int allow;            /* 1 -> tables only if allowed, 0 -> in any case */
173     char *select_oc;      /* table-button only if
174                              objectclass contains select_oc */
175     char *button_label;   /* label for table-request-button */
176     char *dn_extension;   /* extension behind button Xdn?MENU */
177     struct _table_display *next;
178 } TABLE_DISPLAY, *pTABLE_DISPLAY;
179
180 /* List of organisational units where only searching is permitted,
181    including header and footer thereof */
182 typedef struct _search_only_line {
183     char *dn;
184     char *head;
185     char *foot;
186     struct _search_only_line *next;
187 } SEARCH_ONLY_LINE, *pSEARCH_ONLY_LINE;
188
189 /* Anti-Hack Structure */
190 typedef struct _comrefuse {
191     int      tmin;
192     int      tdiff;
193     int      maxAccept;
194     int      suspendCycle;
195     time_t   statCycle;
196     char    *statFile;
197 } COMREFUSE;
198     
199
200 /* static list of Gateway-Switches */
201 typedef struct _gw_switch_line {
202     char *dn;                     /* the DN of the organization(al unit) */
203     char *url;                    /* the URL of the gateway to be called */
204     struct _gw_switch_line *next; /* the next Gateway-Switch */
205 } GW_SWITCH_LINE, *pGW_SWITCH_LINE;
206
207 /* the head of the Gateway-Switch-list */
208 typedef struct _gw_switch {
209     int dynamic;                  /* is dynamic switching allowed */
210     char *lagws;                  /* language dependant recognition of
211                                      GW-Switch-entries in X.500
212                                      (language independant recognition is
213                                       implemented by macro) */
214     GW_SWITCH_LINE *list;         /* the static list of switches */
215 } GW_SWITCH, *pGW_SWITCH;
216
217 /* static list of already available ldap-connections */
218 typedef struct _ld_list {
219     LDAP *ld;                     /* pointer to the ldap-structure */
220     char *host;                   /* The corresponding host */
221     int port;                     /* The corresponding port */
222     struct _ld_list *next;        /* the next */
223 } LD_LIST, *pLD_LIST;
224
225 typedef struct _index_url_rule {
226     char *rule;                   /* Atribute providing data */
227     char *dit_dn;               /* DN supporting config */
228 } INDEX_URL_RULE;
229
230 typedef struct _index_url {
231     char *dat_file;             /* File providing data */
232 #define INDEX_RULE_SIZE     20
233     INDEX_URL_RULE rarr[INDEX_RULE_SIZE];  /* array with rules */
234     int rereadcycle;            /* frequency to reread */
235 } INDEX_URL;
236
237 /* Structure to hold config of buttons leading to form-scripts */
238 typedef struct _form_button {
239     int   read_menu;              /* 1-> button in do_read; 0-> in do_menu */
240     char *object_class;           /* display the button on presence of this
241                                      object-class*/
242     char *method;                 /* cgi method: GET ..  */
243     char *script_url;             /* URL of CGI-Script */
244     char *text;                   /* text in front of button */
245     char *dn_name;                /* name of dn in hidden form  */
246     char *form_name;              /* name of form (submit-button) */
247     char *button_label;           /* label of submit-button  */
248     struct _form_button *next;    /* the next FORM_BUTTON definition */
249 } FORM_BUTTON, *pFORM_BUTTON;
250
251 typedef struct _ip_refuse {
252     char *dat_file;             /* File providing data */
253     char *refu_str;             /* String of refused clients */
254 #define REFU_BUFSIZ     256
255 #define REFU_STRDELIM   "&"
256
257     int rereadcycle;            /* frequency to reread */
258 } IP_REFUSE;
259
260 /* the central structure of TWEB with the configuration of the gateway */
261 typedef struct _glob_struct {
262     char *webdn;                 /* GW-DN in case of authorisded access */
263     char *webpw;                 /* GW-PW in case of authorisded access */
264     char *webdn2;                /* GW-DN in case of non-authorisded access */
265     char *webpw2;                /* GW-PW in case of non-authorisded access */
266     int  webport;                /* the Port the GW is listening on */
267     int  timeout;                /* how long does the gateway wait for the DSA*/
268     time_t stat_slice;           /* Time for the anti-Hack + Statistic */
269     char *ldapd;                 /* the computer LDAPD is running on */
270     int  ldapport;               /* the Port thereof */
271     char *grant;                 /* ':'-separated list of domains with access */
272     char *refuse;                /* ':'-separated list of domains
273                                     without access */
274     char *allow_string;          /* ':'-separated list of domains
275                                     supported with authorised access */
276     char *deny_string;           /* ':'-separated list of domains
277                                     supported with restricted access */
278     regexp *comp_grant;          /* compiled regular expressions for GRANT */
279     regexp *comp_refuse;          /* compiled regular expressions for REFUSE */
280     regexp *comp_allow;          /* compiled regular expressions for ALLOW_ST */
281     regexp *comp_deny;           /* compiled regular expressions for DENY_ST. */
282     char **allow_proxy;          /* ':'-separated list of proxy-servers
283                                     supported with authorised access */
284     char **subtree_search;       /* ':'-separated list of objectclasses
285                                      where to make subtree_search instead of
286                                      single_level_search */
287     DISPLAY *display;            /* presentation of Objects */
288         DISPLAY *default_display_type; /* pointer to the default display descript */
289     BASEDN_LINE *basedn;         /* the entry-page of TWEB */
290     SEARCH_ONLY_LINE *search_only; /* where only searching is supported */
291     GW_SWITCH *gw_switch;        /* the Gateway-Switching */
292     MODIF *modify;               /* what may be modified within TWEB */
293     IND_ATTRS *ind_attrs;        /*attributes which are read from 
294                                    another entry */
295     int cache_expire;            /* caching-time for proxies in seconds */
296     CACHING_TERMS_LINE *caching_terms; /* cache-control-rules */
297     int maxcount;                /* maximum amount of result-lists */
298     int max_person;              /* maximum amount of persons displayed */
299     COMREFUSE *comrefuse;        /* Anti-Hack Structure */
300     TABLE_DISPLAY *tables;       /* listings also as tables by button-request */
301     INDEX_URL *index_url;        /* how to display search-results of index
302                                     -> display-type INDEX-URL */
303     FORM_BUTTON *form_button;    /* display buttons leading to forms */
304     char *tables_marker;         /* flag for menu with tables += their config */
305     char **language;             /* the language links on a html-page */
306     char lang[2];                /* the number of the "own" language */
307     char *olang;                 /* the other languages */
308     char *no_show_rdn;           /* String with "unvisible" DN parts */
309     char *no_modify;             /* Objectclasses without MODIFY-button */
310     SORT_LINE *sort;             /* how shall the results be sorted */
311     SORT_LINE *sorty[MAX_OCS];   /* Array with the sorted lists */
312     char **sort_attribs;         /* Array with the sort-attributes */
313     char *myname;                /* the programname */
314     char *argv0;                 /* ARGV[0] */
315     char *hostname;              /* the name of the computer TWEB 
316                                     is running on*/
317     int virtualport;             /* port if defined is set in every link
318                                     instead of webport (may always
319                                     lead requests over www4ward) */
320     char *header;                /* the header for the standardpage */
321     char *footer;                /* the footer for the standardpage */
322     char *allow_msg;             /* file containing allow-message */
323     char *helpfile;              /* the helpfile */
324     char *filterfile;            /* the filterfile for LDAP-search */
325     char *etcdir;                /* the directory containing the supportfiles */
326     char *friendlyfile;          /* the file for "more friendly" DNs */
327     char *acfilename;            /* the name of the actual config-file */
328     time_t nowtime;              /* actual time in tics */
329     time_t expiretime;           /* time for cache to expire in tics */
330     char *nowtimestr;            /* actual timestring in GMT */
331     char *strip_pin;             /* truncation of PINs at named sort_ocs */
332     char *expiretimestr;         /* timestring for cache to expire in GMT */
333     char *server_connection_msg; /* TCP Connection-message */
334     char *user_agent_msg;        /* User-Agent message */
335     char *menu_filter;           /* menu_filter */
336 #define LANG_ARR_SIZE 110
337     char la[LANG_ARR_SIZE][BUFSIZ];  /* language-specific text-fragments */
338     LD_LIST *ld_list;            /* List of open LDAP-Connections */
339     char **raw_attrs;            /* Attributes to be shown with raw_access */
340         size_t  svc_cnt;             /* A counter for the number of requests */
341
342 #ifdef TUE_TEL
343     DIT_CONFIG *dit_config;      /* container for relations between DNs and
344                                     responsible host:port */
345     TON_URLS *ton_urls;          /* TONs in addition to DNs */
346     char *phoneworld;            /* visibility of phonebook */
347 #endif
348     IP_REFUSE *ip_refuse;        /* refuse certain hosts by ip-addr */
349
350 #ifdef AMBIXGW
351     char *selbsteintrag[10];     /* some strings for AMBIX-selfentry */
352 #endif
353
354     unsigned show_defoc     : 1, /* respect unknown OCs while sorting */
355              strict         : 1, /* restriction of person-lists also in the
356                                     authorised case */
357              restricted     : 1, /* hard restriction of the extent of the list*/
358              persRestricted : 1, /* restriction of person-lists (legal) */
359              prefer_ref_uris : 1, /* take over labeledURIS from 
360                                     referenced objects */
361              is_proxy       : 1, /* did the request come from a proxy-server */
362              pull_down_menus : 1, /* move upwards with pull-down-menus */
363              no_proxy       : 1, /* no local proxy-servers */
364              strict_basedn  : 1, /* no access outside BASEDN */
365              no_browse      : 1, /* no person-lists while browsing */
366              noauth         : 1, /* dynamic flag for question of authorisation*/
367              caching        : 1, /* shall be cached by proxy-server */
368              legal          : 1, /* display privacy-text */
369              legal_top      : 1, /* display privacy-text on top */
370              unknown_host   : 1, /* connection from unknown */
371              allowed        : 1; /* access allowed for decide_access */
372     unsigned raw_data       : 1, /* provide raw-data instead of html */
373              ldap_referral_mode : 1, /* TWEB displayes foreign ldap-url */
374              disp_sea_rdn   : 1; /* display only rdns as search-result */
375 } GLOB_STRUCT, *pGLOB_STRUCT;
376
377
378 /* the function the gateway is initialized with */
379 void init();
380
381 #endif /* _INIT_EXP_ */
382