2 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 * (C) Copyright IBM Corp. 1997,2002
7 * Redistribution and use in source and binary forms are permitted
8 * provided that this notice is preserved and that due credit is
9 * given to IBM Corporation. This software is provided ``as is''
10 * without express or implied warranty.
13 #ifdef LDAP_SLAPI /* SLAPI is OPTIONAL */
18 #include <ibm_pblock_params.h>
23 * Quick 'n' dirty to make struct slapi_* in slapi-plugin.h opaque
25 #define slapi_entry slap_entry
26 #define slapi_attr slap_attr
27 #define slapi_value berval
28 #define slapi_valueset berval*
29 #define slapi_filter slap_filter
33 #include <slapi-plugin.h>
41 /* a little naif ... */
50 #if 0 /* unused (yet?) */
51 #define dn_normalize_case dn_normalize
52 #define SLAPD_NO_MEMORY 7
53 #define ANYBODY_STRING "CN=ANYBODY"
55 extern int slap_debug;
57 extern int dn_check(char *, int *);
59 typedef struct strlist {
65 extern struct berval *ns_get_supported_extop( int );
70 typedef struct _Audit_record Audit_record;
72 #define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT
73 #define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST
74 #define SLAPI_CONTROL_PAGED_RESULTS_OID LDAP_CONTROL_PAGEDRESULTS
76 typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
78 #if 0 /* unused (yet?) */
79 #define DOMAIN "Domain"
80 #define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
83 typedef struct _slapi_control {
86 unsigned long *s_ctrl_ops;
89 typedef struct _ExtendedOp {
90 struct berval ext_oid;
93 struct _ExtendedOp *ext_next;
96 /* Computed attribute support */
97 struct _computed_attr_context {
98 /* slap_send_search_entry() argblock */
100 AttributeName *cac_attrs;
101 int cac_attrsonly : 1;
102 int cac_userattrs : 1;
104 AccessControlState cac_acl_state;
109 /* for slapi_attr_type_cmp() */
110 #define SLAPI_TYPE_CMP_EXACT 0
111 #define SLAPI_TYPE_CMP_BASE 1
112 #define SLAPI_TYPE_CMP_SUBTYPE 2
116 * Was: slapi_pblock.h
119 #ifndef NO_PBLOCK_CLASS /* where's this test from? */
121 #if 0 /* unused (yet?) */
123 #define CMP_GREATER 1
124 #define CMP_LOWER (-1)
126 #define PBLOCK_ERROR (-1)
127 #define INVALID_PARAM PBLOCK_ERROR
128 #define PBLOCK_MAX_PARAMS 100
130 struct slapi_pblock {
131 ldap_pvt_thread_mutex_t pblockMutex;
134 int curParams[PBLOCK_MAX_PARAMS];
135 void *curVals[PBLOCK_MAX_PARAMS];
138 #endif /* !NO_PBLOCK_CLASS */
144 #define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
152 #define OBJECTCLASS "objectclass"
154 #define CHANGE_TIME "changetime"
155 #define CHANGE_TYPE "changetype"
156 #define CHANGE_TARGETDN "targetdn"
157 #define CHANGES "changes"
158 #define CHANGE_NUMBER "changenumber"
160 * FIXME: I get complaints like "ADD" being redefined - first definition
161 * being in "/usr/include/arpa/nameser.h:552"
166 #define DEL "delete: "
168 #define REPLACE "replace: "
171 #define MODRDN "modrdn"
172 #define CHANGE_LOGENTRY "changelogentry"
173 #define IBM_CHANGE_LOGENTRY "ibm-changelog"
174 #define CL_NEWRDN "newrdn"
175 #define CL_DELRDN "deleteoldrdn"
176 #define CHANGE_INITIATOR "ibm-changeInitiatorsName"
178 extern void slapi_register_changelog_suffix(char *suffix);
179 extern char **slapi_get_changelog_suffixes();
180 extern void slapi_update_changelog_counters(long curNum, long numEntries);
181 extern char *slapi_get_cl_firstNum();
182 extern char *slapi_get_cl_lastNum();
183 extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op);
184 extern int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op);
185 extern int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op);
186 extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
187 extern Backend * slapi_cl_get_be(char *dn);
192 * Attribute flags returned by slapi_attr_get_flags()
194 #define SLAPI_ATTR_FLAG_SINGLE 0x0001
195 #define SLAPI_ATTR_FLAG_OPATTR 0x0002
196 #define SLAPI_ATTR_FLAG_READONLY 0x0004
197 #define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
198 #define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
199 #define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
200 #define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
205 #define SLAPI_ACL_COMPARE 0x01
206 #define SLAPI_ACL_SEARCH 0x02
207 #define SLAPI_ACL_READ 0x04
208 #define SLAPI_ACL_WRITE 0x08
209 #define SLAPI_ACL_DELETE 0x10
210 #define SLAPI_ACL_ADD 0x20
211 #define SLAPI_ACL_SELF 0x40
212 #define SLAPI_ACL_PROXY 0x80
213 #define SLAPI_ACL_ALL 0x7f
216 * Plugin types universally supported by SLAPI
219 #define SLAPI_PLUGIN_DATABASE 1
220 #define SLAPI_PLUGIN_EXTENDEDOP 2
221 #define SLAPI_PLUGIN_PREOPERATION 3
222 #define SLAPI_PLUGIN_POSTOPERATION 4
223 #define SLAPI_PLUGIN_MATCHINGRULE 5
224 #define SLAPI_PLUGIN_SYNTAX 6
225 /* XXX this is SLAPI_PLUGIN_ACL in SunDS */
226 #define SLAPI_PLUGIN_AUDIT 7
228 * The following plugin types are reserved for future
229 * Sun ONE DS compatability.
231 #define SLAPI_PLUGIN_BEPREOPERATION 8
232 #define SLAPI_PLUGIN_BEPOSTOPERATION 9
233 #define SLAPI_PLUGIN_ENTRY 10
234 #define SLAPI_PLUGIN_TYPE_OBJECT 11
235 #define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
236 #define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
237 #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
238 #define SLAPI_PLUGIN_VATTR_SP 15
239 #define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
241 #define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
242 #define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
244 #define SLAPI_BIND_SUCCESS 0
245 #define SLAPI_BIND_FAIL 2
246 #define SLAPI_BIND_ANONYMOUS 3
248 #define SLAPI_BACKEND 130
249 #define SLAPI_CONNECTION 131
250 #define SLAPI_OPERATION 132
251 #define SLAPI_REQUESTOR_ISROOT 133
252 #define SLAPI_BE_MONITORDN 134
253 #define SLAPI_BE_TYPE 135
254 #define SLAPI_BE_READONLY 136
255 #define SLAPI_BE_LASTMOD 137
256 #define SLAPI_OPERATION_PARAMETERS 138
257 #define SLAPI_CONN_ID 139
259 #define SLAPI_OPINITIATED_TIME 140
260 #define SLAPI_REQUESTOR_DN 141
261 #define SLAPI_REQUESTOR_ISUPDATEDN 142
262 #define SLAPI_IS_REPLICATED_OPERATION SLAPI_REQUESTOR_ISUPDATEDN
263 #define SLAPI_CONN_DN 143
264 #define SLAPI_CONN_AUTHTYPE 144
265 #define SLAPI_CONN_CLIENTIP 145
266 #define SLAPI_CONN_SERVERIP 146
267 #define SLAPI_X_CONN_CLIENTPATH 1300
268 #define SLAPI_X_CONN_SERVERPATH 1301
269 #define SLAPI_X_CONN_IS_UDP 1302
271 #define SLAPD_AUTH_NONE "none"
272 #define SLAPD_AUTH_SIMPLE "simple"
273 #define SLAPD_AUTH_SSL "SSL"
274 #define SLAPD_AUTH_SASL "SASL "
276 #define SLAPI_PLUGIN 3
277 #define SLAPI_PLUGIN_PRIVATE 4
278 #define SLAPI_PLUGIN_TYPE 5
279 #define SLAPI_PLUGIN_ARGV 6
280 #define SLAPI_PLUGIN_ARGC 7
281 #define SLAPI_PLUGIN_VERSION 8
283 #define SLAPI_PLUGIN_OPRETURN 9
284 #define SLAPI_PLUGIN_OBJECT 10
285 #define SLAPI_PLUGIN_DESTROY_FN 11
287 #define SLAPI_PLUGIN_DESCRIPTION 12
289 #define SLAPI_PLUGIN_INTOP_RESULT 15
290 #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
291 #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
293 #define SLAPI_PLUGIN_DB_BIND_FN 200
294 #define SLAPI_PLUGIN_DB_UNBIND_FN 201
295 #define SLAPI_PLUGIN_DB_SEARCH_FN 202
296 #define SLAPI_PLUGIN_DB_COMPARE_FN 203
297 #define SLAPI_PLUGIN_DB_MODIFY_FN 204
298 #define SLAPI_PLUGIN_DB_MODRDN_FN 205
299 #define SLAPI_PLUGIN_DB_ADD_FN 206
300 #define SLAPI_PLUGIN_DB_DELETE_FN 207
301 #define SLAPI_PLUGIN_DB_ABANDON_FN 208
302 #define SLAPI_PLUGIN_DB_CONFIG_FN 209
303 #define SLAPI_PLUGIN_CLOSE_FN 210
304 #define SLAPI_PLUGIN_DB_FLUSH_FN 211
305 #define SLAPI_PLUGIN_START_FN 212
306 #define SLAPI_PLUGIN_DB_SEQ_FN 213
307 #define SLAPI_PLUGIN_DB_ENTRY_FN 214
308 #define SLAPI_PLUGIN_DB_REFERRAL_FN 215
309 #define SLAPI_PLUGIN_DB_RESULT_FN 216
310 #define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
311 #define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
312 #define SLAPI_PLUGIN_DB_BEGIN_FN 219
313 #define SLAPI_PLUGIN_DB_COMMIT_FN 220
314 #define SLAPI_PLUGIN_DB_ABORT_FN 221
315 #define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
316 #define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
317 #define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
318 #define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
319 #define SLAPI_PLUGIN_DB_SIZE_FN 226
320 #define SLAPI_PLUGIN_DB_TEST_FN 227
321 #define SLAPI_PLUGIN_DB_NO_ACL 250
323 #define SLAPI_PLUGIN_EXT_OP_FN 300
324 #define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
325 #define SLAPI_PLUGIN_PRE_BIND_FN 401
326 #define SLAPI_PLUGIN_PRE_UNBIND_FN 402
327 #define SLAPI_PLUGIN_PRE_SEARCH_FN 403
328 #define SLAPI_PLUGIN_PRE_COMPARE_FN 404
329 #define SLAPI_PLUGIN_PRE_MODIFY_FN 405
330 #define SLAPI_PLUGIN_PRE_MODRDN_FN 406
331 #define SLAPI_PLUGIN_PRE_ADD_FN 407
332 #define SLAPI_PLUGIN_PRE_DELETE_FN 408
333 #define SLAPI_PLUGIN_PRE_ABANDON_FN 409
334 #define SLAPI_PLUGIN_PRE_ENTRY_FN 410
335 #define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
336 #define SLAPI_PLUGIN_PRE_RESULT_FN 412
337 #define SLAPI_PLUGIN_POST_BIND_FN 501
338 #define SLAPI_PLUGIN_POST_UNBIND_FN 502
339 #define SLAPI_PLUGIN_POST_SEARCH_FN 503
340 #define SLAPI_PLUGIN_POST_COMPARE_FN 504
341 #define SLAPI_PLUGIN_POST_MODIFY_FN 505
342 #define SLAPI_PLUGIN_POST_MODRDN_FN 506
343 #define SLAPI_PLUGIN_POST_ADD_FN 507
344 #define SLAPI_PLUGIN_POST_DELETE_FN 508
345 #define SLAPI_PLUGIN_POST_ABANDON_FN 509
346 #define SLAPI_PLUGIN_POST_ENTRY_FN 510
347 #define SLAPI_PLUGIN_POST_REFERRAL_FN 511
348 #define SLAPI_PLUGIN_POST_RESULT_FN 512
350 #define SLAPI_OPERATION_TYPE 590
352 #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
353 #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
354 #define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
355 #define SLAPI_PLUGIN_MR_FILTER_INDEX_FN 603
356 #define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
357 #define SLAPI_PLUGIN_MR_INDEX_FN 605
358 #define SLAPI_PLUGIN_MR_OID 610
359 #define SLAPI_PLUGIN_MR_TYPE 611
360 #define SLAPI_PLUGIN_MR_VALUE 612
361 #define SLAPI_PLUGIN_MR_VALUES 613
362 #define SLAPI_PLUGIN_MR_KEYS 614
363 #define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
364 #define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
365 #define SLAPI_PLUGIN_MR_USAGE 617
367 #define SLAPI_OP_LESS 1
368 #define SLAPI_OP_LESS_OR_EQUAL 2
369 #define SLAPI_OP_EQUAL 3
370 #define SLAPI_OP_GREATER_OR_EQUAL 4
371 #define SLAPI_OP_GREATER 5
372 #define SLAPI_OP_SUBSTRING 6
374 #define SLAPI_PLUGIN_MR_USAGE_INDEX 0
375 #define SLAPI_PLUGIN_MR_USAGE_SORT 1
377 #define SLAPI_MATCHINGRULE_NAME 1
378 #define SLAPI_MATCHINGRULE_OID 2
379 #define SLAPI_MATCHINGRULE_DESC 3
380 #define SLAPI_MATCHINGRULE_SYNTAX 4
381 #define SLAPI_MATCHINGRULE_OBSOLETE 5
383 #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
384 #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
385 #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
386 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
387 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
388 #define SLAPI_PLUGIN_SYNTAX_NAMES 705
389 #define SLAPI_PLUGIN_SYNTAX_OID 706
390 #define SLAPI_PLUGIN_SYNTAX_FLAGS 707
391 #define SLAPI_PLUGIN_SYNTAX_COMPARE 708
393 #define SLAPI_OPERATION_AUTHTYPE 741
394 #define SLAPI_OPERATION_ID 742
395 #define SLAPI_CONN_CERT 743
396 #define SLAPI_CONN_AUTHMETHOD 746
398 #define SLAPI_RESULT_CODE 881
399 #define SLAPI_RESULT_TEXT 882
400 #define SLAPI_RESULT_MATCHED 883
402 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
403 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
405 #define SLAPI_PLUGIN_AUDIT_DATA 1100
406 #define SLAPI_PLUGIN_AUDIT_FN 1101
408 /* DS 5.x Computed Attribute Callbacks (not exposed) */
409 #define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
410 #define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
412 #define SLAPI_MANAGEDSAIT 1000
414 #define SLAPI_CONFIG_FILENAME 40
415 #define SLAPI_CONFIG_LINENO 41
416 #define SLAPI_CONFIG_ARGC 42
417 #define SLAPI_CONFIG_ARGV 43
419 #define SLAPI_TARGET_DN 50
420 #define SLAPI_REQCONTROLS 51
422 #define SLAPI_ENTRY_PRE_OP 52
423 #define SLAPI_ENTRY_POST_OP 53
425 #define SLAPI_RESCONTROLS 55
426 #define SLAPI_ADD_RESCONTROL 56
428 #define SLAPI_ADD_TARGET SLAPI_TARGET_DN
429 #define SLAPI_ADD_ENTRY 60
431 #define SLAPI_BIND_TARGET SLAPI_TARGET_DN
432 #define SLAPI_BIND_METHOD 70
433 #define SLAPI_BIND_CREDENTIALS 71
434 #define SLAPI_BIND_SASLMECHANISM 72
435 #define SLAPI_BIND_RET_SASLCREDS 73
437 #define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
438 #define SLAPI_COMPARE_TYPE 80
439 #define SLAPI_COMPARE_VALUE 81
441 #define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
443 #define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
444 #define SLAPI_MODIFY_MODS 90
446 #define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
447 #define SLAPI_MODRDN_NEWRDN 100
448 #define SLAPI_MODRDN_DELOLDRDN 101
449 #define SLAPI_MODRDN_NEWSUPERIOR 102
451 #define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
452 #define SLAPI_SEARCH_SCOPE 110
453 #define SLAPI_SEARCH_DEREF 111
454 #define SLAPI_SEARCH_SIZELIMIT 112
455 #define SLAPI_SEARCH_TIMELIMIT 113
456 #define SLAPI_SEARCH_FILTER 114
457 #define SLAPI_SEARCH_STRFILTER 115
458 #define SLAPI_SEARCH_ATTRS 116
459 #define SLAPI_SEARCH_ATTRSONLY 117
461 #define SLAPI_ABANDON_MSGID 120
463 #define SLAPI_SEQ_TYPE 150
464 #define SLAPI_SEQ_ATTRNAME 151
465 #define SLAPI_SEQ_VAL 152
467 #define SLAPI_EXT_OP_REQ_OID 160
468 #define SLAPI_EXT_OP_REQ_VALUE 161
469 #define SLAPI_EXT_OP_RET_OID 162
470 #define SLAPI_EXT_OP_RET_VALUE 163
472 #define SLAPI_MR_FILTER_ENTRY 170
473 #define SLAPI_MR_FILTER_TYPE 171
474 #define SLAPI_MR_FILTER_VALUE 172
475 #define SLAPI_MR_FILTER_OID 173
476 #define SLAPI_MR_FILTER_DNATTRS 174
478 #define SLAPI_LDIF2DB_FILE 180
479 #define SLAPI_LDIF2DB_REMOVEDUPVALS 185
481 #define SLAPI_DB2LDIF_PRINTKEY 183
483 #define SLAPI_PARENT_TXN 190
484 #define SLAPI_TXN 191
486 #define SLAPI_SEARCH_RESULT_SET 193
487 #define SLAPI_SEARCH_RESULT_ENTRY 194
488 #define SLAPI_NENTRIES 195
489 #define SLAPI_SEARCH_REFERRALS 196
491 #define SLAPI_CHANGENUMBER 197
492 #define SLAPI_LOG_OPERATION 198
494 #define SLAPI_DBSIZE 199
496 #define SLAPI_LOG_FATAL 0
497 #define SLAPI_LOG_TRACE 1
498 #define SLAPI_LOG_PACKETS 2
499 #define SLAPI_LOG_ARGS 3
500 #define SLAPI_LOG_CONNS 4
501 #define SLAPI_LOG_BER 5
502 #define SLAPI_LOG_FILTER 6
503 #define SLAPI_LOG_CONFIG 7
504 #define SLAPI_LOG_ACL 8
505 #define SLAPI_LOG_SHELL 9
506 #define SLAPI_LOG_PARSE 10
507 #define SLAPI_LOG_HOUSE 11
508 #define SLAPI_LOG_REPL 12
509 #define SLAPI_LOG_CACHE 13
510 #define SLAPI_LOG_PLUGIN 14
512 #define SLAPI_OPERATION_BIND 0x00000001L
513 #define SLAPI_OPERATION_UNBIND 0x00000002L
514 #define SLAPI_OPERATION_SEARCH 0x00000004L
515 #define SLAPI_OPERATION_MODIFY 0x00000008L
516 #define SLAPI_OPERATION_ADD 0x00000010L
517 #define SLAPI_OPERATION_DELETE 0x00000020L
518 #define SLAPI_OPERATION_MODDN 0x00000040L
519 #define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
520 #define SLAPI_OPERATION_COMPARE 0x00000080L
521 #define SLAPI_OPERATION_ABANDON 0x00000100L
522 #define SLAPI_OPERATION_EXTENDED 0x00000200L
523 #define SLAPI_OPERATION_ANY 0xFFFFFFFFL
524 #define SLAPI_OPERATION_NONE 0x00000000L
528 #include "proto-slapi.h"
530 #endif /* _SLAPI_H */
531 #endif /* LDAP_SLAPI */