]> git.sur5r.net Git - openldap/blob - servers/slapd/proto-slap.h
Move userPassord and krbName authentication routines to the frontend.
[openldap] / servers / slapd / proto-slap.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 #ifndef _PROTO_SLAP
7 #define _PROTO_SLAP
8
9 #include <ldap_cdefs.h>
10
11 LDAP_BEGIN_DECL
12
13 /*
14  * acl.c
15  */
16
17 int access_allowed LDAP_P(( Backend *be, Connection *conn,
18         Operation *op, Entry *e,
19         char *attr, struct berval *val, slap_access_t access ));
20
21 int acl_check_modlist LDAP_P(( Backend *be,
22         Connection *conn,
23         Operation *op,
24         Entry *e,
25         LDAPModList *ml ));
26
27 void acl_append( AccessControl **l, AccessControl *a );
28
29 char *get_supported_acimech LDAP_P((int index));
30
31 /*
32  * aclparse.c
33  */
34
35 void parse_acl LDAP_P(( Backend *be,
36         const char *fname,
37         int lineno,
38         int argc, char **argv ));
39
40 char * access2str LDAP_P(( slap_access_t access ));
41 slap_access_t str2access LDAP_P(( const char *str ));
42
43 #define ACCESSMASK_MAXLEN       sizeof("unknown (+wrscan)")
44 char * accessmask2str LDAP_P(( slap_access_mask_t mask, char* ));
45 slap_access_mask_t str2accessmask LDAP_P(( const char *str ));
46
47 /*
48  * attr.c
49  */
50
51 void attr_free LDAP_P(( Attribute *a ));
52 Attribute *attr_dup LDAP_P(( Attribute *a ));
53 char * attr_normalize LDAP_P(( char *s ));
54 int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int  nvals,
55         int  naddvals, int  *maxvals, Attribute ***a ));
56 int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals ));
57 Attribute * attr_find LDAP_P(( Attribute *a, const char *type ));
58 int attr_delete LDAP_P(( Attribute **attrs, const char *type ));
59 int attr_syntax LDAP_P(( char *type ));
60 void attr_syntax_config LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
61 AttributeType * at_find LDAP_P(( const char *name ));
62 int at_find_in_list LDAP_P(( AttributeType *sat, AttributeType **list ));
63 int at_append_to_list LDAP_P(( AttributeType *sat, AttributeType ***listp ));
64 int at_delete_from_list LDAP_P(( int pos, AttributeType ***listp ));
65 int at_fake_if_needed LDAP_P(( char *name ));
66 int at_schema_info LDAP_P(( Entry *e ));
67 int at_add LDAP_P(( LDAP_ATTRIBUTE_TYPE *at, const char **err ));
68 char * at_canonical_name LDAP_P(( char * a_type ));
69
70 void attrs_free LDAP_P(( Attribute *a ));
71 Attribute *attrs_dup LDAP_P(( Attribute *a ));
72
73 /*
74  * ava.c
75  */
76
77 int get_ava LDAP_P(( BerElement *ber, Ava *ava ));
78 void ava_free LDAP_P(( Ava *ava, int freeit ));
79
80 /*
81  * backend.c
82  */
83
84 int backend_init LDAP_P((void));
85 int backend_add LDAP_P((BackendInfo *aBackendInfo));
86 int backend_num LDAP_P((Backend *be));
87 int backend_startup LDAP_P((Backend *be));
88 int backend_shutdown LDAP_P((Backend *be));
89 int backend_destroy LDAP_P((void));
90
91 BackendInfo * backend_info LDAP_P(( const char *type ));
92 BackendDB * backend_db_init LDAP_P(( const char *type ));
93
94 BackendDB * select_backend LDAP_P(( const char * dn ));
95
96 int be_issuffix LDAP_P(( Backend *be, const char *suffix ));
97 int be_isroot LDAP_P(( Backend *be, const char *ndn ));
98 int be_isroot_pw LDAP_P(( Backend *be, const char *ndn, struct berval *cred ));
99 char* be_root_dn LDAP_P(( Backend *be ));
100 int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
101 #define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 )
102 #define be_entry_release_w( be, e ) be_entry_release_rw( be, e, 1 )
103
104
105 extern int      backend_unbind LDAP_P((Connection *conn, Operation *op));
106
107 extern int      backend_connection_init LDAP_P((Connection *conn));
108 extern int      backend_connection_destroy LDAP_P((Connection *conn));
109
110 extern int      backend_group LDAP_P((Backend *be,
111         Entry *target,
112         const char *gr_ndn,
113         const char *op_ndn,
114         const char *objectclassValue,
115         const char *groupattrName));
116
117 #ifdef SLAPD_SCHEMA_DN
118 /* temporary extern for temporary routine*/
119 extern Attribute *backend_subschemasubentry( Backend * );
120 #endif
121
122
123 /*
124  * ch_malloc.c
125  */
126
127 #ifdef CSRIMALLOC
128 #define ch_malloc malloc
129 #define ch_realloc realloc
130 #define ch_calloc calloc
131 #define ch_strdup strdup
132 #define ch_free free
133
134 #else
135 void * ch_malloc LDAP_P(( ber_len_t size ));
136 void * ch_realloc LDAP_P(( void *block, ber_len_t size ));
137 void * ch_calloc LDAP_P(( ber_len_t nelem, ber_len_t size ));
138 char * ch_strdup LDAP_P(( const char *string ));
139 void   ch_free LDAP_P(( void * ));
140
141 #ifndef CH_FREE
142 #undef free
143 #define free ch_free
144 #endif
145 #endif
146
147 /*
148  * charray.c
149  */
150
151 void charray_add LDAP_P(( char ***a, const char *s ));
152 void charray_merge LDAP_P(( char ***a, char **s ));
153 void charray_free LDAP_P(( char **array ));
154 int charray_inlist LDAP_P(( char **a, const char *s ));
155 char ** charray_dup LDAP_P(( char **a ));
156 char ** str2charray LDAP_P(( const char *str, const char *brkstr ));
157 char * charray2str LDAP_P(( char **a ));
158
159 /*
160  * controls.c
161  */
162 int get_ctrls LDAP_P((
163         Connection *co,
164         Operation *op,
165         int senderrors ));
166
167 int get_manageDSAit LDAP_P(( Operation *op ));
168
169 /*
170  * config.c
171  */
172
173 int read_config LDAP_P(( const char *fname ));
174
175 /*
176  * connection.c
177  */
178 int connections_init LDAP_P((void));
179 int connections_shutdown LDAP_P((void));
180 int connections_destroy LDAP_P((void));
181 int connections_timeout_idle LDAP_P((time_t));
182
183 long connection_init LDAP_P((
184         ber_socket_t s,
185         const char* url,
186         const char* dnsname,
187         const char* peername,
188         const char* sockname,
189         int use_tls ));
190
191 void connection_closing LDAP_P(( Connection *c ));
192 int connection_state_closing LDAP_P(( Connection *c ));
193 const char *connection_state2str LDAP_P(( int state )) LDAP_GCCATTR((const));
194
195 int connection_write LDAP_P((ber_socket_t s));
196 int connection_read LDAP_P((ber_socket_t s));
197
198 unsigned long connections_nextid(void);
199
200 Connection* connection_first LDAP_P((ber_socket_t *));
201 Connection* connection_next LDAP_P((Connection *, ber_socket_t *));
202 void connection_done LDAP_P((Connection *));
203
204 /*
205  * dn.c
206  */
207
208 char * dn_validate LDAP_P(( char *dn ));
209 char * dn_normalize LDAP_P(( char *dn ));
210 char * dn_parent LDAP_P(( Backend *be, const char *dn ));
211 char ** dn_subtree LDAP_P(( Backend *be, const char *dn ));
212 char * dn_rdn LDAP_P(( Backend *be, char *dn ));
213 int dn_issuffix LDAP_P(( char *dn, char *suffix ));
214 #ifdef DNS_DN
215 int dn_type LDAP_P(( char *dn ));
216 #endif
217 int rdn_validate LDAP_P(( const char* str ));
218 char * rdn_attr_value LDAP_P(( char * rdn ));
219 char * rdn_attr_type LDAP_P(( char * rdn ));
220
221 void build_new_dn LDAP_P(( char ** new_dn,
222         const char *e_dn,
223         const char * p_dn,
224         const char * newrdn ));
225 /*
226  * entry.c
227  */
228
229 int entry_destroy LDAP_P((void));
230
231 Entry * str2entry LDAP_P(( char *s ));
232 char * entry2str LDAP_P(( Entry *e, int *len ));
233 void entry_free LDAP_P(( Entry *e ));
234
235 int entry_cmp LDAP_P(( Entry *a, Entry *b ));
236 int entry_dn_cmp LDAP_P(( Entry *a, Entry *b ));
237 int entry_id_cmp LDAP_P(( Entry *a, Entry *b ));
238
239 /*
240  * extended.c
241  */
242
243 int load_extension LDAP_P((const void *module, const char *file_name));
244 char *get_supported_extension LDAP_P((int index));
245
246 /*
247  * filter.c
248  */
249
250 int get_filter LDAP_P(( Connection *conn, BerElement *ber, Filter **filt, char **fstr ));
251 void filter_free LDAP_P(( Filter *f ));
252 void filter_print LDAP_P(( Filter *f ));
253
254 /*
255  * filterentry.c
256  */
257
258 int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
259         Filter  *f ));
260
261 /*
262  * lock.c
263  */
264
265 FILE * lock_fopen LDAP_P(( const char *fname, const char *type, FILE **lfp ));
266 int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
267
268 /*
269  * module.c
270  */
271
272 #ifdef SLAPD_MODULES
273 int module_init LDAP_P(( void ));
274 int module_kill LDAP_P(( void ));
275
276 int module_load LDAP_P(( const char* file_name, int argc, char *argv[] ));
277 int module_path LDAP_P(( const char* path ));
278
279 void *module_resolve LDAP_P((const void *module, const char *name));
280 #endif /* SLAPD_MODULES */
281
282 /*
283  * monitor.c
284  */
285 extern char *supportedControls[];
286
287 void monitor_info LDAP_P((
288         Connection *conn,
289         Operation *op,
290         char ** attrs,
291         int attrsonly ));
292
293 /*
294  * operation.c
295  */
296
297 void slap_op_free LDAP_P(( Operation *op ));
298 Operation * slap_op_alloc LDAP_P((
299         BerElement *ber, ber_int_t msgid,
300         ber_tag_t tag, ber_int_t id ));
301
302 int slap_op_add LDAP_P(( Operation **olist, Operation *op ));
303 int slap_op_remove LDAP_P(( Operation **olist, Operation *op ));
304 Operation * slap_op_pop LDAP_P(( Operation **olist ));
305
306 /*
307  * phonetic.c
308  */
309
310 char * first_word LDAP_P(( char *s ));
311 char * next_word LDAP_P(( char *s ));
312 char * word_dup LDAP_P(( char *w ));
313 char * phonetic LDAP_P(( char *s ));
314
315 /*
316  * repl.c
317  */
318
319 void replog LDAP_P(( Backend *be, Operation *op, char *dn, void *change ));
320
321 /*
322  * result.c
323  */
324
325 struct berval **get_entry_referrals LDAP_P((
326         Backend *be, Connection *conn, Operation *op,
327         Entry *e ));
328
329 void send_ldap_result LDAP_P((
330         Connection *conn, Operation *op,
331         int err, const char *matched, const char *text,
332         struct berval **refs,
333         LDAPControl **ctrls ));
334
335 void send_ldap_disconnect LDAP_P((
336         Connection *conn, Operation *op,
337         int err, const char *text ));
338
339 void send_ldap_extended LDAP_P((
340         Connection *conn, Operation *op,
341         ber_int_t err, const char *matched,
342         const char *text, char *rspoid,
343         struct berval *rspdata ));
344
345 void send_search_result LDAP_P((
346         Connection *conn, Operation *op,
347         int err, const char *matched, const char *text,
348         struct berval **refs,
349         LDAPControl **ctrls,
350         int nentries ));
351
352 int send_search_reference LDAP_P((
353         Backend *be, Connection *conn, Operation *op,
354         Entry *e, struct berval **refs, int scope,
355         LDAPControl **ctrls,
356         struct berval ***v2refs ));
357
358 int send_search_entry LDAP_P((
359         Backend *be, Connection *conn, Operation *op,
360         Entry *e, char **attrs, int attrsonly,
361         LDAPControl **ctrls ));
362
363 int str2result LDAP_P(( char *s,
364         int *code, char **matched, char **info ));
365
366 /*
367  * sasl.c
368  */
369 extern char **supportedSASLMechanisms;
370
371 int sasl_init(void);
372 int sasl_destroy(void);
373
374 /*
375  * schema.c
376  */
377
378 int oc_schema_check LDAP_P(( Entry *e ));
379 int oc_check_operational_attr LDAP_P(( const char *type ));
380 int oc_check_usermod_attr LDAP_P(( const char *type ));
381 int oc_check_no_usermod_attr LDAP_P(( const char *type ));
382 ObjectClass *oc_find LDAP_P((const char *ocname));
383 int oc_add LDAP_P((LDAP_OBJECT_CLASS *oc, const char **err));
384 Syntax *syn_find LDAP_P((const char *synname));
385 Syntax *syn_find_desc LDAP_P((const char *syndesc, int *slen));
386 int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
387 MatchingRule *mr_find LDAP_P((const char *mrname));
388 int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err));
389 int case_ignore_normalize LDAP_P((struct berval *val, struct berval **normalized));
390 int register_syntax LDAP_P((char *desc, slap_syntax_check_func *check ));
391 int register_matching_rule LDAP_P((char * desc, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare));
392 void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
393 int schema_init LDAP_P((void));
394
395 int is_entry_objectclass LDAP_P(( Entry *, const char* objectclass ));
396 #define is_entry_alias(e)               is_entry_objectclass((e), "ALIAS")
397 #define is_entry_referral(e)    is_entry_objectclass((e), "REFERRAL")
398
399
400 /*
401  * schemaparse.c
402  */
403
404 void parse_oc_old LDAP_P(( Backend *be, const char *fname, int lineno, int argc, char **argv ));
405 void parse_oc LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
406 void parse_at LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
407 void parse_oidm LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
408 char *scherr2str LDAP_P((int code)) LDAP_GCCATTR((const));
409 int dscompare LDAP_P(( const char *s1, const char *s2del, char delim ));
410 /*
411  * str2filter.c
412  */
413
414 Filter * str2filter LDAP_P(( char *str ));
415
416 /*
417  * suffixalias.c
418  */
419 char *suffix_alias LDAP_P(( Backend *be, char *ndn ));
420
421 /*
422  * value.c
423  */
424
425 int value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals,
426         int naddvals, int *maxvals ));
427 int value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
428 void value_normalize LDAP_P(( char *s, int syntax ));
429 int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
430         int normalize ));
431 int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
432         int normalize ));
433
434 /*
435  * user.c
436  */
437 #if defined(HAVE_PWD_H) && defined(HAVE_GRP_H)
438 void slap_init_user LDAP_P(( char *username, char *groupname ));
439 #endif
440
441 /*
442  * passwd.c
443  */
444 int slap_passwd_check(
445         struct berval       **vals,
446         struct berval       *v,
447         int                 syntax,
448         int                 normalize,
449         struct berval           *cred );
450
451 /*
452  * kerberos.c
453  */
454 #ifdef HAVE_KERBEROS
455 extern int      krbv4_ldap_auth();
456 #endif
457
458 /*
459  * Other...
460  */
461
462 extern struct berval **default_referral;
463 extern char             *replogfile;
464 extern const char Versionstr[];
465 extern int              active_threads;
466 extern int              defsize;
467 extern int              deftime;
468 extern int              g_argc;
469 extern slap_access_t            global_default_access;
470 extern int              global_readonly;
471 extern int              global_lastmod;
472 extern int              global_idletimeout;
473 extern int              global_schemacheck;
474 extern char             *global_realm;
475 extern int              lber_debug;
476 extern int              ldap_syslog;
477
478 extern ldap_pvt_thread_mutex_t  num_sent_mutex;
479 extern long             num_bytes_sent;
480 extern long             num_pdu_sent;
481 extern long             num_entries_sent;
482 extern long             num_refs_sent;
483
484 extern ldap_pvt_thread_mutex_t  num_ops_mutex;
485 extern long             num_ops_completed;
486 extern long             num_ops_initiated;
487
488 extern char   *slapd_pid_file;
489 extern char   *slapd_args_file;
490 extern char             **g_argv;
491 extern time_t   starttime;
492
493 time_t slap_get_time LDAP_P((void));
494
495 extern ldap_pvt_thread_mutex_t  active_threads_mutex;
496 extern ldap_pvt_thread_cond_t   active_threads_cond;
497
498 extern ldap_pvt_thread_mutex_t  entry2str_mutex;
499 extern ldap_pvt_thread_mutex_t  replog_mutex;
500
501 #ifdef SLAPD_CRYPT
502 extern ldap_pvt_thread_mutex_t  crypt_mutex;
503 #endif
504 extern ldap_pvt_thread_mutex_t  gmtime_mutex;
505
506 extern AccessControl *global_acl;
507
508 int     slap_init LDAP_P((int mode, char* name));
509 int     slap_startup LDAP_P(( Backend *be ));
510 int     slap_shutdown LDAP_P(( Backend *be ));
511 int     slap_destroy LDAP_P((void));
512
513 struct sockaddr_in;
514
515 extern int      slapd_daemon_init( char *urls, int port, int tls_port );
516 extern int      slapd_daemon_destroy(void);
517 extern int      slapd_daemon(void);
518
519 extern void slapd_set_write LDAP_P((ber_socket_t s, int wake));
520 extern void slapd_clr_write LDAP_P((ber_socket_t s, int wake));
521 extern void slapd_set_read LDAP_P((ber_socket_t s, int wake));
522 extern void slapd_clr_read LDAP_P((ber_socket_t s, int wake));
523
524 extern void slapd_remove LDAP_P((ber_socket_t s, int wake));
525
526 extern RETSIGTYPE slap_sig_shutdown LDAP_P((int sig));
527 extern RETSIGTYPE slap_sig_wake LDAP_P((int sig));
528
529 extern void     config_info LDAP_P((
530         Connection *conn,
531         Operation *op,
532         char ** attrs,
533         int attrsonly ));
534
535 extern void     root_dse_info LDAP_P((
536         Connection *conn,
537         Operation *op,
538         char ** attrs,
539         int attrsonly ));
540
541 extern int      do_abandon LDAP_P((Connection *conn, Operation *op));
542 extern int      do_add LDAP_P((Connection *conn, Operation *op));
543 extern int      do_bind LDAP_P((Connection *conn, Operation *op));
544 extern int      do_compare LDAP_P((Connection *conn, Operation *op));
545 extern int      do_delete LDAP_P((Connection *conn, Operation *op));
546 extern int      do_modify LDAP_P((Connection *conn, Operation *op));
547 extern int      do_modrdn LDAP_P((Connection *conn, Operation *op));
548 extern int      do_search LDAP_P((Connection *conn, Operation *op));
549 extern int      do_unbind LDAP_P((Connection *conn, Operation *op));
550 extern int      do_extended LDAP_P((Connection *conn, Operation *op));
551
552
553 extern ber_socket_t dtblsize;
554
555 LDAP_END_DECL
556
557 #endif /* _proto_slap */
558