-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2002-2004 The OpenLDAP Foundation.
+ * Portions Copyright 1997,2002-2003 IBM Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
-/*
- * (C) Copyright IBM Corp. 1997,2002
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is
- * given to IBM Corporation. This software is provided ``as is''
- * without express or implied warranty.
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by IBM Corporation for use in
+ * IBM products and subsequently ported to OpenLDAP Software by
+ * Steve Omrani. Additional significant contributors include:
+ * Luke Howard
*/
+#ifdef LDAP_SLAPI /* SLAPI is OPTIONAL */
+
#ifndef _SLAPI_H
#define _SLAPI_H
-#include <ibm_pblock_params.h>
+#include "ibm_pblock_params.h"
+
+LDAP_BEGIN_DECL
+
+/*
+ * Quick 'n' dirty to make struct slapi_* in slapi-plugin.h opaque
+ */
+#define slapi_entry slap_entry
+#define slapi_attr slap_attr
+#define slapi_value berval
+#define slapi_valueset berval*
+#define slapi_filter slap_filter
+
+LDAP_END_DECL
+
+#include <slapi-plugin.h>
+
+LDAP_BEGIN_DECL
+
+/*
+ * Was: slapi_common.h
+ */
+
+/* a little naif ... */
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#if 0 /* unused (yet?) */
+#define dn_normalize_case dn_normalize
+#define SLAPD_NO_MEMORY 7
+#define ANYBODY_STRING "CN=ANYBODY"
+
+extern int slap_debug;
+
+extern int dn_check(char *, int *);
+
+typedef struct strlist {
+ char *string;
+ struct strlist *next;
+} StrList;
+#endif
+
+/*
+ * Was: slapi_utils.h
+ */
+typedef struct _Audit_record Audit_record;
+
+#define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT
+#define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST
+#define SLAPI_CONTROL_PAGED_RESULTS_OID LDAP_CONTROL_PAGEDRESULTS
+
+typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
+
+#if 0 /* unused (yet?) */
+#define DOMAIN "Domain"
+#define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
+#endif
+
+typedef struct _slapi_control {
+ int s_ctrl_num;
+ char **s_ctrl_oids;
+ unsigned long *s_ctrl_ops;
+} Slapi_Control;
+
+typedef struct _ExtendedOp {
+ struct berval ext_oid;
+ SLAPI_FUNC ext_func;
+ Backend *ext_be;
+ struct _ExtendedOp *ext_next;
+} ExtendedOp;
+
+/* Computed attribute support */
+struct _computed_attr_context {
+ /* slap_send_search_entry() argblock */
+ Slapi_PBlock *cac_pb;
+ AttributeName *cac_attrs;
+ int cac_attrsonly : 1;
+ int cac_userattrs : 1;
+ int cac_opattrs : 1;
+ AccessControlState cac_acl_state;
+ /* private data */
+ void *cac_private;
+};
+
+/* for slapi_attr_type_cmp() */
+#define SLAPI_TYPE_CMP_EXACT 0
+#define SLAPI_TYPE_CMP_BASE 1
+#define SLAPI_TYPE_CMP_SUBTYPE 2
+
+typedef enum slapi_extension_e {
+ SLAPI_X_EXT_CONNECTION = 0,
+ SLAPI_X_EXT_OPERATION = 1,
+ SLAPI_X_EXT_MAX = 2
+} slapi_extension_t;
+
+/*
+ * Was: slapi_pblock.h
+ */
+
+#ifndef NO_PBLOCK_CLASS /* where's this test from? */
+
+#if 0 /* unused (yet?) */
+#define CMP_EQUAL 0
+#define CMP_GREATER 1
+#define CMP_LOWER (-1)
+#endif
+#define PBLOCK_ERROR (-1)
+#define INVALID_PARAM PBLOCK_ERROR
+#define PBLOCK_MAX_PARAMS 100
+
+struct slapi_pblock {
+ ldap_pvt_thread_mutex_t pblockMutex;
+ int ckParams;
+ int numParams;
+ int curParams[PBLOCK_MAX_PARAMS];
+ void *curVals[PBLOCK_MAX_PARAMS];
+};
+
+#endif /* !NO_PBLOCK_CLASS */
-typedef struct slapi_pblock Slapi_PBlock;
-typedef struct slap_entry Slapi_Entry;
-typedef struct slap_attr Slapi_Attr;
-typedef Filter Slapi_Filter;
+/*
+ * Was: plugin.h
+ */
+
+#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
+
+/*
+ * Was: slapi_cl.h
+ */
-#include <slapi_utils.h>
-#ifndef NO_PBLOCK_CLASS
-#include <slapi_pblock.h>
-#endif /* NO_PBLOCK_CLASS */
-#include <plugin.h>
-#include <slapi_ops.h>
-#include <slapi_cl.h>
+#if 0
+#define TIME_SIZE 20
+#define OBJECTCLASS "objectclass"
+#define TOP "top"
+#define CHANGE_TIME "changetime"
+#define CHANGE_TYPE "changetype"
+#define CHANGE_TARGETDN "targetdn"
+#define CHANGES "changes"
+#define CHANGE_NUMBER "changenumber"
+/*
+ * FIXME: I get complaints like "ADD" being redefined - first definition
+ * being in "/usr/include/arpa/nameser.h:552"
+ */
+#undef ADD
+#define ADD "add: "
+#define ADDLEN 5
+#define DEL "delete: "
+#define DELLEN 8
+#define REPLACE "replace: "
+#define REPLEN 9
+#define MOD "modify"
+#define MODRDN "modrdn"
+#define CHANGE_LOGENTRY "changelogentry"
+#define IBM_CHANGE_LOGENTRY "ibm-changelog"
+#define CL_NEWRDN "newrdn"
+#define CL_DELRDN "deleteoldrdn"
+#define CHANGE_INITIATOR "ibm-changeInitiatorsName"
+
+extern void slapi_register_changelog_suffix(char *suffix);
+extern char **slapi_get_changelog_suffixes();
+extern void slapi_update_changelog_counters(long curNum, long numEntries);
+extern char *slapi_get_cl_firstNum();
+extern char *slapi_get_cl_lastNum();
+extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op);
+extern int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op);
+extern int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op);
+extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
+extern Backend * slapi_cl_get_be(char *dn);
+#endif
+
+
+/*
+ * Attribute flags returned by slapi_attr_get_flags()
+ */
+#define SLAPI_ATTR_FLAG_SINGLE 0x0001
+#define SLAPI_ATTR_FLAG_OPATTR 0x0002
+#define SLAPI_ATTR_FLAG_READONLY 0x0004
+#define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
+#define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
+#define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
+#define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
+
+/*
+ * ACL levels
+ */
+#define SLAPI_ACL_COMPARE 0x01
+#define SLAPI_ACL_SEARCH 0x02
+#define SLAPI_ACL_READ 0x04
+#define SLAPI_ACL_WRITE 0x08
+#define SLAPI_ACL_DELETE 0x10
+#define SLAPI_ACL_ADD 0x20
+#define SLAPI_ACL_SELF 0x40
+#define SLAPI_ACL_PROXY 0x80
+#define SLAPI_ACL_ALL 0x7f
/*
- * types of plugins
+ * Plugin types universally supported by SLAPI
+ * implementations
*/
#define SLAPI_PLUGIN_DATABASE 1
#define SLAPI_PLUGIN_EXTENDEDOP 2
#define SLAPI_PLUGIN_POSTOPERATION 4
#define SLAPI_PLUGIN_MATCHINGRULE 5
#define SLAPI_PLUGIN_SYNTAX 6
+/* XXX this is SLAPI_PLUGIN_ACL in SunDS */
#define SLAPI_PLUGIN_AUDIT 7
+/*
+ * The following plugin types are reserved for future
+ * Sun ONE DS compatability.
+ */
+#define SLAPI_PLUGIN_BEPREOPERATION 8
+#define SLAPI_PLUGIN_BEPOSTOPERATION 9
+#define SLAPI_PLUGIN_ENTRY 10
+#define SLAPI_PLUGIN_TYPE_OBJECT 11
+#define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
+#define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
+#define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
+#define SLAPI_PLUGIN_VATTR_SP 15
+#define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
#define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
+#define SLAPI_BIND_SUCCESS 0
+#define SLAPI_BIND_FAIL 2
+#define SLAPI_BIND_ANONYMOUS 3
+
#define SLAPI_BACKEND 130
#define SLAPI_CONNECTION 131
#define SLAPI_OPERATION 132
#define SLAPI_BE_TYPE 135
#define SLAPI_BE_READONLY 136
#define SLAPI_BE_LASTMOD 137
+#define SLAPI_OPERATION_PARAMETERS 138
#define SLAPI_CONN_ID 139
#define SLAPI_OPINITIATED_TIME 140
#define SLAPI_REQUESTOR_DN 141
#define SLAPI_REQUESTOR_ISUPDATEDN 142
+#define SLAPI_IS_REPLICATED_OPERATION SLAPI_REQUESTOR_ISUPDATEDN
#define SLAPI_CONN_DN 143
#define SLAPI_CONN_AUTHTYPE 144
+#define SLAPI_CONN_CLIENTIP 145
+#define SLAPI_CONN_SERVERIP 146
+#define SLAPI_X_CONN_CLIENTPATH 1300
+#define SLAPI_X_CONN_SERVERPATH 1301
+#define SLAPI_X_CONN_IS_UDP 1302
+#define SLAPI_X_CONN_SSF 1303
+#define SLAPI_X_CONN_SASL_CONTEXT 1304
#define SLAPD_AUTH_NONE "none"
#define SLAPD_AUTH_SIMPLE "simple"
#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
#define SLAPI_PLUGIN_POST_RESULT_FN 512
+#define SLAPI_OPERATION_TYPE 590
+
#define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
#define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
#define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
#define SLAPI_PLUGIN_MR_USAGE_INDEX 0
#define SLAPI_PLUGIN_MR_USAGE_SORT 1
+#define SLAPI_MATCHINGRULE_NAME 1
+#define SLAPI_MATCHINGRULE_OID 2
+#define SLAPI_MATCHINGRULE_DESC 3
+#define SLAPI_MATCHINGRULE_SYNTAX 4
+#define SLAPI_MATCHINGRULE_OBSOLETE 5
+
#define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
#define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
#define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
#define SLAPI_PLUGIN_SYNTAX_FLAGS 707
#define SLAPI_PLUGIN_SYNTAX_COMPARE 708
+#define SLAPI_PLUGIN_ACL_INIT 730
+#define SLAPI_PLUGIN_ACL_SYNTAX_CHECK 731
+#define SLAPI_PLUGIN_ACL_ALLOW_ACCESS 732
+#define SLAPI_PLUGIN_ACL_MODS_ALLOWED 733
+#define SLAPI_PLUGIN_ACL_MODS_UPDATE 734
+
+#define SLAPI_OPERATION_AUTHTYPE 741
+#define SLAPI_OPERATION_ID 742
+#define SLAPI_CONN_CERT 743
+#define SLAPI_CONN_AUTHMETHOD 746
+
+#define SLAPI_RESULT_CODE 881
+#define SLAPI_RESULT_TEXT 882
+#define SLAPI_RESULT_MATCHED 883
+
#define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
#define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
#define SLAPI_PLUGIN_AUDIT_DATA 1100
#define SLAPI_PLUGIN_AUDIT_FN 1101
+/* DS 5.x Computed Attribute Callbacks (not exposed) */
+#define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
+#define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
+
+#define SLAPI_X_PLUGIN_PRE_GROUP_FN 1202
+#define SLAPI_X_PLUGIN_POST_GROUP_FN 1203
+
+/* backend_group extension */
+#define SLAPI_X_GROUP_ENTRY 1250 /* e */
+#define SLAPI_X_GROUP_ATTRIBUTE 1251 /* group_at */
+#define SLAPI_X_GROUP_OPERATION_DN 1252 /* op_ndn */
+#define SLAPI_X_GROUP_TARGET_ENTRY 1253 /* target */
+
#define SLAPI_MANAGEDSAIT 1000
#define SLAPI_CONFIG_FILENAME 40
#define SLAPI_ENTRY_POST_OP 53
#define SLAPI_RESCONTROLS 55
+/* This is the spelling in the SunOne 5.2 docs */
+#define SLAPI_RES_CONTROLS SLAPI_RESCONTROLS
#define SLAPI_ADD_RESCONTROL 56
#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
#define SLAPI_OPERATION_ANY 0xFFFFFFFFL
#define SLAPI_OPERATION_NONE 0x00000000L
-#endif /* _SLAPI_H */
+LDAP_END_DECL
+
+#include "proto-slapi.h"
+#endif /* _SLAPI_H */
+#endif /* LDAP_SLAPI */