mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
SLAPI - Netscape plugin API for slapd - based on patch contributed by Steve Omrani <somrani@us.ibm.com> as ITS#2073
This commit is contained in:
parent
cf6a9d9d0f
commit
1b70e16448
41 changed files with 8473 additions and 57 deletions
36
configure.in
36
configure.in
|
|
@ -186,6 +186,8 @@ OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups of client
|
|||
OL_ARG_ENABLE(slp, [ --enable-slp enable SLPv2 support], no)dnl
|
||||
OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
|
||||
|
||||
OL_ARG_ENABLE(slapi,[ --enable-slapi enable installation of slapi library], yes)dnl
|
||||
|
||||
dnl SLAPD Backend options
|
||||
OL_ARG_ENABLE(bdb,[ --enable-bdb enable Berkeley DB backend], yes)dnl
|
||||
OL_ARG_WITH(bdb_module,[ --with-bdb-module module type static|dynamic], static,
|
||||
|
|
@ -247,6 +249,9 @@ dnl General "enable" options
|
|||
# validate options
|
||||
if test $ol_enable_slapd = no ; then
|
||||
dnl SLAPD was specificallly disabled
|
||||
if test $ol_enable_slapi = yes ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --enable-slapi argument])
|
||||
fi
|
||||
if test $ol_enable_bdb = yes ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --enable-bdb argument])
|
||||
fi
|
||||
|
|
@ -351,6 +356,7 @@ if test $ol_enable_slapd = no ; then
|
|||
fi
|
||||
|
||||
# force settings to no
|
||||
ol_enable_slapi=no
|
||||
ol_enable_bdb=no
|
||||
ol_enable_dnssrv=no
|
||||
ol_enable_ldap=no
|
||||
|
|
@ -521,6 +527,9 @@ BUILD_SLURPD=no
|
|||
|
||||
BUILD_THREAD=no
|
||||
|
||||
BUILD_SLAPI=no
|
||||
SLAPD_SLAPI_DEPEND=
|
||||
|
||||
BUILD_BDB=no
|
||||
BUILD_DNSSRV=no
|
||||
BUILD_LDAP=no
|
||||
|
|
@ -569,6 +578,7 @@ SASL_LIBS=
|
|||
TERMCAP_LIBS=
|
||||
TLS_LIBS=
|
||||
MODULES_LIBS=
|
||||
SLAPI_LIBS=
|
||||
AUTH_LIBS=
|
||||
|
||||
SLAPD_SLP_LIBS=
|
||||
|
|
@ -2504,6 +2514,22 @@ OL_SYS_ERRLIST
|
|||
dnl ----------------------------------------------------------------
|
||||
dnl Sort out defines
|
||||
|
||||
if test "$ol_enable_slapi" != no ; then
|
||||
dnl This check is donel also if --enable-modules is used;
|
||||
dnl it is duplicated here, 'cause it'd be cached anyway
|
||||
AC_CHECK_HEADERS(ltdl.h)
|
||||
|
||||
if test $ac_cv_header_ltdl_h != yes ; then
|
||||
AC_MSG_ERROR([could not locate <ltdl.h>])
|
||||
fi
|
||||
AC_CHECK_LIB(ltdl, lt_dlinit, [
|
||||
SLAPI_LIBS=-lltdl
|
||||
AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
|
||||
],[AC_MSG_ERROR([could not locate libtool -lltdl])])
|
||||
|
||||
AC_DEFINE(LDAP_SLAPI,1, [define this to add SLAPI code])
|
||||
fi
|
||||
|
||||
if test "$ol_enable_debug" != no ; then
|
||||
AC_DEFINE(LDAP_DEBUG,1,
|
||||
[define this to add debugging code])
|
||||
|
|
@ -2764,6 +2790,12 @@ if test "$ol_enable_rewrite" != no ; then
|
|||
BUILD_REWRITE=yes
|
||||
fi
|
||||
|
||||
if test "$ol_enable_slapi" != no ; then
|
||||
AC_DEFINE(ENABLE_SLAPI,1,[define to enable slapi library])
|
||||
BUILD_SLAPI=yes
|
||||
SLAPD_SLAPI_DEPEND=libslapi.a
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
|
||||
dnl
|
||||
|
|
@ -2789,6 +2821,8 @@ AC_SUBST(PLAT)
|
|||
AC_SUBST(BUILD_LIBS_DYNAMIC)
|
||||
|
||||
AC_SUBST(BUILD_SLAPD)
|
||||
AC_SUBST(BUILD_SLAPI)
|
||||
AC_SUBST(SLAPD_SLAPI_DEPEND)
|
||||
AC_SUBST(BUILD_BDB)
|
||||
AC_SUBST(BUILD_DNSSRV)
|
||||
AC_SUBST(BUILD_LDAP)
|
||||
|
|
@ -2843,6 +2877,7 @@ AC_SUBST(SASL_LIBS)
|
|||
AC_SUBST(TERMCAP_LIBS)
|
||||
AC_SUBST(TLS_LIBS)
|
||||
AC_SUBST(MODULES_LIBS)
|
||||
AC_SUBST(SLAPI_LIBS)
|
||||
AC_SUBST(AUTH_LIBS)
|
||||
|
||||
AC_SUBST(SLAPD_SLP_LIBS)
|
||||
|
|
@ -2896,6 +2931,7 @@ servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile
|
|||
servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk \
|
||||
servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/mod.mk \
|
||||
servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
|
||||
servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk \
|
||||
servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
|
||||
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
|
||||
tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
|
||||
|
|
|
|||
370
include/slapi-plugin.h
Normal file
370
include/slapi-plugin.h
Normal file
|
|
@ -0,0 +1,370 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _SLAPI_PLUGIN_H
|
||||
#define _SLAPI_PLUGIN_H
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
typedef struct slapi_pblock Slapi_PBlock;
|
||||
typedef struct slapi_entry Slapi_Entry;
|
||||
typedef struct slapi_attr Slapi_Attr;
|
||||
typedef struct slapi_filter Slapi_Filter;
|
||||
|
||||
|
||||
/* pblock routines */
|
||||
int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
|
||||
int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
|
||||
Slapi_PBlock *slapi_pblock_new();
|
||||
void slapi_pblock_destroy( Slapi_PBlock* );
|
||||
|
||||
/*entry/attr/dn routines */
|
||||
Slapi_Entry *slapi_str2entry( char *s, int flags );
|
||||
char *slapi_entry2str( Slapi_Entry *e, int *len );
|
||||
char *slapi_entry_get_dn( Slapi_Entry *e );
|
||||
void slapi_entry_set_dn(Slapi_Entry *e, char *dn);
|
||||
Slapi_Entry *slapi_entry_dup(Slapi_Entry *e);
|
||||
int slapi_entry_attr_delete( Slapi_Entry *e, char *type );
|
||||
Slapi_Entry *slapi_entry_alloc();
|
||||
void slapi_entry_free( Slapi_Entry *e );
|
||||
int slapi_entry_attr_merge( Slapi_Entry *e, char *type, struct berval **vals );
|
||||
int slapi_entry_attr_find( Slapi_Entry *e, char *type, Slapi_Attr **attr );
|
||||
int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
|
||||
char *slapi_dn_normalize( char *dn );
|
||||
char *slapi_dn_normalize_case( char *dn );
|
||||
int slapi_dn_issuffix( char *dn, char *suffix );
|
||||
char *slapi_dn_ignore_case( char *dn );
|
||||
|
||||
/* char routines */
|
||||
char * slapi_ch_malloc( unsigned long size );
|
||||
void slapi_ch_free( void *ptr );
|
||||
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
|
||||
char *slapi_ch_realloc(char *block, unsigned long size );
|
||||
char *slapi_ch_strdup(char *s );
|
||||
|
||||
|
||||
/* LDAP V3 routines */
|
||||
int slapi_control_present( LDAPControl **controls, char *oid, struct berval **val, int *iscritical);
|
||||
void slapi_register_supported_control(char *controloid, unsigned long controlops);
|
||||
#define SLAPI_OPERATION_BIND 0x00000001L
|
||||
#define SLAPI_OPERATION_UNBIND 0x00000002L
|
||||
#define SLAPI_OPERATION_SEARCH 0x00000004L
|
||||
#define SLAPI_OPERATION_MODIFY 0x00000008L
|
||||
#define SLAPI_OPERATION_ADD 0x00000010L
|
||||
#define SLAPI_OPERATION_DELETE 0x00000020L
|
||||
#define SLAPI_OPERATION_MODDN 0x00000040L
|
||||
#define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
|
||||
#define SLAPI_OPERATION_COMPARE 0x00000080L
|
||||
#define SLAPI_OPERATION_ABANDON 0x00000100L
|
||||
#define SLAPI_OPERATION_EXTENDED 0x00000200L
|
||||
#define SLAPI_OPERATION_ANY 0xFFFFFFFFL
|
||||
#define SLAPI_OPERATION_NONE 0x00000000L
|
||||
int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp);
|
||||
void slapi_register_supported_saslmechanism(char *mechanism);
|
||||
char **slapi_get_supported_saslmechanisms();
|
||||
char **slapi_get_supported_extended_ops(void);
|
||||
|
||||
|
||||
/* send ldap result back */
|
||||
void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched, char *text,
|
||||
int nentries, struct berval **urls );
|
||||
int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e, LDAPControl **ectrls,
|
||||
char **attrs, int attrsonly );
|
||||
|
||||
/* filter routines */
|
||||
Slapi_Filter *slapi_str2filter( char *str );
|
||||
void slapi_filter_free( Slapi_Filter *f, int recurse );
|
||||
int slapi_filter_get_choice( Slapi_Filter *f);
|
||||
int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
|
||||
Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
|
||||
Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
|
||||
|
||||
/* internal add/delete/search/modify routines */
|
||||
Slapi_PBlock *slapi_search_internal( char *base, int scope, char *filter,
|
||||
LDAPControl **controls, char **attrs, int attrsonly );
|
||||
Slapi_PBlock *slapi_modify_internal( char *dn, LDAPMod **mods,
|
||||
LDAPControl **controls, int log_change);
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_add_internal( char * dn, LDAPMod **attrs, LDAPControl **controls, int log_changes );
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_delete_internal( char * dn, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn, char *newParent, int deloldrdn, LDAPControl **controls, int log_change);
|
||||
void slapi_free_search_results_internal(Slapi_PBlock *pb);
|
||||
|
||||
/* connection related routines */
|
||||
int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL);
|
||||
int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort);
|
||||
|
||||
/* parameters currently supported */
|
||||
|
||||
|
||||
/* plugin types supported */
|
||||
|
||||
#define SLAPI_PLUGIN_DATABASE 1
|
||||
#define SLAPI_PLUGIN_EXTENDEDOP 2
|
||||
#define SLAPI_PLUGIN_PREOPERATION 3
|
||||
#define SLAPI_PLUGIN_POSTOPERATION 4
|
||||
#define SLAPI_PLUGIN_AUDIT 7
|
||||
|
||||
/* misc params */
|
||||
|
||||
#define SLAPI_BACKEND 130
|
||||
#define SLAPI_CONNECTION 131
|
||||
#define SLAPI_OPERATION 132
|
||||
#define SLAPI_REQUESTOR_ISROOT 133
|
||||
#define SLAPI_BE_MONITORDN 134
|
||||
#define SLAPI_BE_TYPE 135
|
||||
#define SLAPI_BE_READONLY 136
|
||||
#define SLAPI_BE_LASTMOD 137
|
||||
#define SLAPI_CONN_ID 139
|
||||
|
||||
/* operation params */
|
||||
#define SLAPI_OPINITIATED_TIME 140
|
||||
#define SLAPI_REQUESTOR_DN 141
|
||||
#define SLAPI_REQUESTOR_ISUPDATEDN 142
|
||||
|
||||
/* connection structure params*/
|
||||
#define SLAPI_CONN_DN 143
|
||||
#define SLAPI_CONN_AUTHTYPE 144
|
||||
|
||||
/* Authentication types */
|
||||
#define SLAPD_AUTH_NONE "none"
|
||||
#define SLAPD_AUTH_SIMPLE "simple"
|
||||
#define SLAPD_AUTH_SSL "SSL"
|
||||
#define SLAPD_AUTH_SASL "SASL "
|
||||
|
||||
/* plugin configuration parmams */
|
||||
#define SLAPI_PLUGIN 3
|
||||
#define SLAPI_PLUGIN_PRIVATE 4
|
||||
#define SLAPI_PLUGIN_TYPE 5
|
||||
#define SLAPI_PLUGIN_ARGV 6
|
||||
#define SLAPI_PLUGIN_ARGC 7
|
||||
#define SLAPI_PLUGIN_VERSION 8
|
||||
#define SLAPI_PLUGIN_OPRETURN 9
|
||||
#define SLAPI_PLUGIN_OBJECT 10
|
||||
#define SLAPI_PLUGIN_DESTROY_FN 11
|
||||
#define SLAPI_PLUGIN_DESCRIPTION 12
|
||||
|
||||
/* internal opreations params */
|
||||
#define SLAPI_PLUGIN_INTOP_RESULT 15
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
|
||||
|
||||
/* function pointer params for backends */
|
||||
#define SLAPI_PLUGIN_DB_BIND_FN 200
|
||||
#define SLAPI_PLUGIN_DB_UNBIND_FN 201
|
||||
#define SLAPI_PLUGIN_DB_SEARCH_FN 202
|
||||
#define SLAPI_PLUGIN_DB_COMPARE_FN 203
|
||||
#define SLAPI_PLUGIN_DB_MODIFY_FN 204
|
||||
#define SLAPI_PLUGIN_DB_MODRDN_FN 205
|
||||
#define SLAPI_PLUGIN_DB_ADD_FN 206
|
||||
#define SLAPI_PLUGIN_DB_DELETE_FN 207
|
||||
#define SLAPI_PLUGIN_DB_ABANDON_FN 208
|
||||
#define SLAPI_PLUGIN_DB_CONFIG_FN 209
|
||||
#define SLAPI_PLUGIN_CLOSE_FN 210
|
||||
#define SLAPI_PLUGIN_DB_FLUSH_FN 211
|
||||
#define SLAPI_PLUGIN_START_FN 212
|
||||
#define SLAPI_PLUGIN_DB_SEQ_FN 213
|
||||
#define SLAPI_PLUGIN_DB_ENTRY_FN 214
|
||||
#define SLAPI_PLUGIN_DB_REFERRAL_FN 215
|
||||
#define SLAPI_PLUGIN_DB_RESULT_FN 216
|
||||
#define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
|
||||
#define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
|
||||
#define SLAPI_PLUGIN_DB_BEGIN_FN 219
|
||||
#define SLAPI_PLUGIN_DB_COMMIT_FN 220
|
||||
#define SLAPI_PLUGIN_DB_ABORT_FN 221
|
||||
#define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
|
||||
#define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
|
||||
#define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
|
||||
#define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
|
||||
#define SLAPI_PLUGIN_DB_SIZE_FN 226
|
||||
#define SLAPI_PLUGIN_DB_TEST_FN 227
|
||||
|
||||
|
||||
/* functions pointers for LDAP V3 extended ops */
|
||||
#define SLAPI_PLUGIN_EXT_OP_FN 300
|
||||
#define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
|
||||
|
||||
/* functions for preoperation functions */
|
||||
#define SLAPI_PLUGIN_PRE_BIND_FN 401
|
||||
#define SLAPI_PLUGIN_PRE_UNBIND_FN 402
|
||||
#define SLAPI_PLUGIN_PRE_SEARCH_FN 403
|
||||
#define SLAPI_PLUGIN_PRE_COMPARE_FN 404
|
||||
#define SLAPI_PLUGIN_PRE_MODIFY_FN 405
|
||||
#define SLAPI_PLUGIN_PRE_MODRDN_FN 406
|
||||
#define SLAPI_PLUGIN_PRE_ADD_FN 407
|
||||
#define SLAPI_PLUGIN_PRE_DELETE_FN 408
|
||||
#define SLAPI_PLUGIN_PRE_ABANDON_FN 409
|
||||
#define SLAPI_PLUGIN_PRE_ENTRY_FN 410
|
||||
#define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
|
||||
#define SLAPI_PLUGIN_PRE_RESULT_FN 412
|
||||
|
||||
/* functions for postoperation functions*/
|
||||
#define SLAPI_PLUGIN_POST_BIND_FN 501
|
||||
#define SLAPI_PLUGIN_POST_UNBIND_FN 502
|
||||
#define SLAPI_PLUGIN_POST_SEARCH_FN 503
|
||||
#define SLAPI_PLUGIN_POST_COMPARE_FN 504
|
||||
#define SLAPI_PLUGIN_POST_MODIFY_FN 505
|
||||
#define SLAPI_PLUGIN_POST_MODRDN_FN 506
|
||||
#define SLAPI_PLUGIN_POST_ADD_FN 507
|
||||
#define SLAPI_PLUGIN_POST_DELETE_FN 508
|
||||
#define SLAPI_PLUGIN_POST_ABANDON_FN 509
|
||||
#define SLAPI_PLUGIN_POST_ENTRY_FN 510
|
||||
#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
|
||||
#define SLAPI_PLUGIN_POST_RESULT_FN 512
|
||||
|
||||
/* audit plugin defines */
|
||||
#define SLAPI_PLUGIN_AUDIT_DATA 1100
|
||||
#define SLAPI_PLUGIN_AUDIT_FN 1101
|
||||
|
||||
/* managedsait control */
|
||||
#define SLAPI_MANAGEDSAIT 1000
|
||||
|
||||
/* config stuff */
|
||||
#define SLAPI_CONFIG_FILENAME 40
|
||||
#define SLAPI_CONFIG_LINENO 41
|
||||
#define SLAPI_CONFIG_ARGC 42
|
||||
#define SLAPI_CONFIG_ARGV 43
|
||||
|
||||
/* operational params */
|
||||
#define SLAPI_TARGET_DN 50
|
||||
#define SLAPI_REQCONTROLS 51
|
||||
|
||||
/* server LDAPv3 controls */
|
||||
#define SLAPI_RESCONTROLS 55
|
||||
#define SLAPI_ADD_RESCONTROL 56
|
||||
|
||||
/* add params */
|
||||
#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_ADD_ENTRY 60
|
||||
|
||||
/* bind params */
|
||||
#define SLAPI_BIND_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_BIND_METHOD 70
|
||||
#define SLAPI_BIND_CREDENTIALS 71
|
||||
#define SLAPI_BIND_SASLMECHANISM 72
|
||||
#define SLAPI_BIND_RET_SASLCREDS 73
|
||||
|
||||
/* compare params */
|
||||
#define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_COMPARE_TYPE 80
|
||||
#define SLAPI_COMPARE_VALUE 81
|
||||
|
||||
/* delete params */
|
||||
#define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
|
||||
|
||||
/* modify params */
|
||||
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODIFY_MODS 90
|
||||
|
||||
/* modrdn params */
|
||||
#define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODRDN_NEWRDN 100
|
||||
#define SLAPI_MODRDN_DELOLDRDN 101
|
||||
#define SLAPI_MODRDN_NEWSUPERIOR 102 /* v3 only */
|
||||
|
||||
/* search params */
|
||||
#define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_SEARCH_SCOPE 110
|
||||
#define SLAPI_SEARCH_DEREF 111
|
||||
#define SLAPI_SEARCH_SIZELIMIT 112
|
||||
#define SLAPI_SEARCH_TIMELIMIT 113
|
||||
#define SLAPI_SEARCH_FILTER 114
|
||||
#define SLAPI_SEARCH_STRFILTER 115
|
||||
#define SLAPI_SEARCH_ATTRS 116
|
||||
#define SLAPI_SEARCH_ATTRSONLY 117
|
||||
|
||||
/* abandon params */
|
||||
#define SLAPI_ABANDON_MSGID 120
|
||||
|
||||
/* extended operation params */
|
||||
#define SLAPI_EXT_OP_REQ_OID 160
|
||||
#define SLAPI_EXT_OP_REQ_VALUE 161
|
||||
|
||||
/* extended operation return codes */
|
||||
#define SLAPI_EXT_OP_RET_OID 162
|
||||
#define SLAPI_EXT_OP_RET_VALUE 163
|
||||
|
||||
#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
|
||||
|
||||
/* Search result params */
|
||||
#define SLAPI_SEARCH_RESULT_SET 193
|
||||
#define SLAPI_SEARCH_RESULT_ENTRY 194
|
||||
#define SLAPI_NENTRIES 195
|
||||
#define SLAPI_SEARCH_REFERRALS 196
|
||||
|
||||
|
||||
/* filter types */
|
||||
#ifndef LDAP_FILTER_AND
|
||||
#define LDAP_FILTER_AND 0xa0L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_OR
|
||||
#define LDAP_FILTER_OR 0xa1L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_NOT
|
||||
#define LDAP_FILTER_NOT 0xa2L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_EQUALITY
|
||||
#define LDAP_FILTER_EQUALITY 0xa3L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_SUBSTRINGS
|
||||
#define LDAP_FILTER_SUBSTRINGS 0xa4L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_GE
|
||||
#define LDAP_FILTER_GE 0xa5L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_LE
|
||||
#define LDAP_FILTER_LE 0xa6L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_PRESENT
|
||||
#define LDAP_FILTER_PRESENT 0x87L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_APPROX
|
||||
#define LDAP_FILTER_APPROX 0xa8L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_EXT_MATCH
|
||||
#define LDAP_FILTER_EXT_MATCH 0xa9L
|
||||
#endif
|
||||
|
||||
int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
|
||||
#define SLAPI_LOG_FATAL 0
|
||||
#define SLAPI_LOG_TRACE 1
|
||||
#define SLAPI_LOG_PACKETS 2
|
||||
#define SLAPI_LOG_ARGS 3
|
||||
#define SLAPI_LOG_CONNS 4
|
||||
#define SLAPI_LOG_BER 5
|
||||
#define SLAPI_LOG_FILTER 6
|
||||
#define SLAPI_LOG_CONFIG 7
|
||||
#define SLAPI_LOG_ACL 8
|
||||
#define SLAPI_LOG_SHELL 9
|
||||
#define SLAPI_LOG_PARSE 10
|
||||
#define SLAPI_LOG_HOUSE 11
|
||||
#define SLAPI_LOG_REPL 12
|
||||
#define SLAPI_LOG_CACHE 13
|
||||
#define SLAPI_LOG_PLUGIN 14
|
||||
#define SLAPI_LOG_TIMING 15
|
||||
|
||||
#define SLAPI_PLUGIN_DESCRIPTION 12
|
||||
typedef struct slapi_plugindesc {
|
||||
char *spd_id;
|
||||
char *spd_vendor;
|
||||
char *spd_version;
|
||||
char *spd_description;
|
||||
} Slapi_PluginDesc;
|
||||
|
||||
#define SLAPI_PLUGIN_VERSION_01 "01"
|
||||
#define SLAPI_PLUGIN_VERSION_02 "02"
|
||||
#define SLAPI_PLUGIN_VERSION_03 "03"
|
||||
#define SLAPI_PLUGIN_CURRENT_VERSION SLAPI_PLUGIN_VERSION_03
|
||||
|
||||
#endif
|
||||
|
|
@ -35,11 +35,11 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o cr.o \
|
|||
limits.o backglue.o operational.o matchedValues.o \
|
||||
$(@PLAT@_OBJS)
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_INCDIR= ../../include -Islapi
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
SLAP_DIR=
|
||||
SLAPD_STATIC_DEPENDS=@SLAPD_NO_STATIC@ libbackends.a
|
||||
SLAPD_STATIC_DEPENDS=@SLAPD_SLAPI_DEPEND@ @SLAPD_NO_STATIC@ libbackends.a
|
||||
SLAPD_STATIC_BACKENDS=@SLAPD_STATIC_BACKENDS@
|
||||
SLAPD_DYNAMIC_BACKENDS=@SLAPD_DYNAMIC_BACKENDS@
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ XLDFLAGS = $(MODULES_LDFLAGS)
|
|||
|
||||
XLIBS = $(SLAPD_STATIC_DEPENDS) $(SLAPD_L)
|
||||
XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
|
||||
XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
|
||||
XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS) $(SLAPI_LIBS)
|
||||
|
||||
BUILD_OPT = "--enable-slapd"
|
||||
BUILD_SRV = @BUILD_SLAPD@
|
||||
|
|
@ -224,8 +224,17 @@ slapd.exp: libslapd.a
|
|||
dlltool --dllname slapd.exe --input-def slapd.def \
|
||||
--base-file slapd.base --output-exp $@
|
||||
|
||||
.slapi: FORCE
|
||||
(cd slapi; $(MAKE) $(MFLAGS) all)
|
||||
|
||||
libslapi.a: .slapi
|
||||
$(AR) ruv slapi/libtmpslapd.a $(OBJS)
|
||||
cp slapi/.libs/libslapi.a .
|
||||
|
||||
slapd: $(SLAPD_DEPENDS)
|
||||
$(LTLINK) -o $@ $(SLAPD_OBJECTS) $(LIBS) $(WRAP_LIBS)
|
||||
$(LTLINK) -o $@ $(SLAPD_OBJECTS) $(LIBS) \
|
||||
libslapi.a slapi/libtmpslapd.a \
|
||||
$(WRAP_LIBS)
|
||||
|
||||
sslapd: version.o
|
||||
$(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
|
||||
|
|
@ -280,7 +289,7 @@ version.c: $(OBJS) $(SLAPD_LIBDEPEND)
|
|||
$(MKVERSION) -s -n Versionstr slapd > $@
|
||||
|
||||
depend-local-srv: FORCE
|
||||
@for i in back-* shell-backends tools; do \
|
||||
@for i in back-* shell-backends slapi tools; do \
|
||||
if test -d $$i -a -f $$i/Makefile ; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) depend"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) depend ); \
|
||||
|
|
@ -293,7 +302,7 @@ clean-local:
|
|||
rm -f *.exp *.def *.base *.a *.objs symdummy.c
|
||||
|
||||
clean-local-srv: FORCE
|
||||
@for i in back-* shell-backends tools; do \
|
||||
@for i in back-* shell-backends slapi tools; do \
|
||||
if test -d $$i -a -f $$i/Makefile ; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
|
||||
|
|
@ -303,7 +312,7 @@ clean-local-srv: FORCE
|
|||
rm -f *.tmp all-cffiles
|
||||
|
||||
veryclean-local-srv: FORCE
|
||||
@for i in back-* shell-backends tools; do \
|
||||
@for i in back-* shell-backends slapi tools; do \
|
||||
if test -d $$i -a -f $$i/Makefile ; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
|
||||
|
|
@ -317,7 +326,7 @@ install-slapd: FORCE
|
|||
-$(MKDIR) $(DESTDIR)$(localstatedir)
|
||||
$(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \
|
||||
slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
|
||||
@for i in back-* shell-backends tools; do \
|
||||
@for i in back-* shell-backends slapi tools; do \
|
||||
if test -d $$i -a -f $$i/Makefile ; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) install ); \
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/string.h>
|
||||
|
|
@ -24,13 +25,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
|
||||
static int slap_mods2entry(
|
||||
Modifications *mods,
|
||||
Entry **e,
|
||||
int repl_user,
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen );
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_add( Connection *conn, Operation *op )
|
||||
|
|
@ -49,6 +44,8 @@ do_add( Connection *conn, Operation *op )
|
|||
int rc = LDAP_SUCCESS;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_add: conn %d enter\n", conn->c_connid,0,0 );
|
||||
#else
|
||||
|
|
@ -228,6 +225,31 @@ do_add( Connection *conn, Operation *op )
|
|||
goto done;
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
|
||||
slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_ADD_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (add) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_add: add preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " add preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/*
|
||||
* do the add if 1 && (2 || 3)
|
||||
* 1) there is an add function implemented in this backend;
|
||||
|
|
@ -314,6 +336,23 @@ do_add( Connection *conn, Operation *op )
|
|||
NULL, "operation not supported within namingContext", NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_ADD_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (Add) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_add: Add postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " Add postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
done:
|
||||
if( modlist != NULL ) {
|
||||
slap_mods_free( modlist );
|
||||
|
|
@ -325,7 +364,8 @@ done:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int slap_mods2entry(
|
||||
int
|
||||
slap_mods2entry(
|
||||
Modifications *mods,
|
||||
Entry **e,
|
||||
int repl_user,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
#include "lutil.h"
|
||||
#include "lber_pvt.h"
|
||||
|
||||
|
|
@ -687,11 +689,55 @@ backend_unbind(
|
|||
)
|
||||
{
|
||||
int i;
|
||||
int rc;
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
for ( i = 0; i < nbackends; i++ ) {
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)&backends[i] );
|
||||
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_PRE_UNBIND_FN,
|
||||
(Slapi_PBlock *)pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (unbind) plugins
|
||||
* or a plugin failed. Just log it.
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_bind: Unbind preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " Unbind preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
if ( backends[i].be_unbind ) {
|
||||
(*backends[i].be_unbind)( &backends[i], conn, op );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
|
||||
(Slapi_PBlock *)pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (unbind) plugins
|
||||
* or a plugin failed. Just log it.
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_unbind: Unbind postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " Unbind postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_bind(
|
||||
|
|
@ -47,6 +49,8 @@ do_bind(
|
|||
struct berval cred = { 0, NULL };
|
||||
Backend *be = NULL;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_bind: conn %d\n", conn->c_connid, 0, 0 );
|
||||
#else
|
||||
|
|
@ -526,6 +530,30 @@ do_bind(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_BIND_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (bind) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_bind: Bind preOps failed\n"));
|
||||
#else
|
||||
Debug(LDAP_DEBUG_TRACE, " Bind preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
if ( be->be_bind ) {
|
||||
int ret;
|
||||
|
||||
|
|
@ -592,6 +620,23 @@ do_bind(
|
|||
NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_BIND_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no pretOp (bind) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_bind: Bind postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " Bind postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
conn->c_sasl_bindop = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/socket.h>
|
||||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
static int compare_entry(
|
||||
Connection *conn,
|
||||
|
|
@ -48,6 +50,8 @@ do_compare(
|
|||
const char *text = NULL;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
ava.aa_desc = NULL;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -267,6 +271,32 @@ do_compare(
|
|||
/* deref suffix alias if appropriate */
|
||||
suffix_alias( be, &ndn );
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
slapi_pblock_set( pb, SLAPI_COMPARE_TYPE, (void *)desc.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_COMPARE_VALUE, (void *)&value );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_COMPARE_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (compare) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_compare: compare preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " compare preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
if ( be->be_compare ) {
|
||||
(*be->be_compare)( be, conn, op, &pdn, &ndn, &ava );
|
||||
} else {
|
||||
|
|
@ -275,6 +305,23 @@ do_compare(
|
|||
NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_COMPARE_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (compare) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_compare: compare postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " compare postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
free( pdn.bv_val );
|
||||
free( ndn.bv_val );
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -18,6 +19,7 @@
|
|||
#include "lutil.h"
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
#define ARGS_STEP 512
|
||||
|
||||
|
|
@ -2311,6 +2313,49 @@ read_config( const char *fname, int depth )
|
|||
#endif
|
||||
#endif /* !SLAPD_RLOOKUPS */
|
||||
|
||||
/* Netscape plugins */
|
||||
} else if ( strcasecmp( cargv[0], "plugin" ) == 0 ) {
|
||||
#if defined( LDAP_SLAPI )
|
||||
|
||||
/*
|
||||
* a "plugin" line must be inside a database
|
||||
* definition, since we implement pre-,post-
|
||||
* and extended operation plugins
|
||||
*/
|
||||
if ( be == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( CONFIG, INFO,
|
||||
"%s: line %d: plugin line must appear "
|
||||
"inside a database definition.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "%s: line %d: plugin "
|
||||
"line must appear inside a database "
|
||||
"definition\n", fname, lineno, 0 );
|
||||
#endif
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
if ( netscape_plugin( be, fname, lineno, cargc, cargv )
|
||||
!= LDAP_SUCCESS ) {
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
#else /* !defined( LDAP_SLAPI ) */
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( CONFIG, INFO,
|
||||
"%s: line %d: SLAPI not supported.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "%s: line %d: SLAPI "
|
||||
"not supported.\n", fname, lineno, 0 );
|
||||
#endif
|
||||
return( 1 );
|
||||
|
||||
#endif /* !defined( LDAP_SLAPI ) */
|
||||
|
||||
|
||||
|
||||
/* pass anything else to the current backend info/db config routine */
|
||||
} else {
|
||||
if ( bi != NULL ) {
|
||||
|
|
|
|||
|
|
@ -395,12 +395,12 @@ long connection_init(
|
|||
if( c == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( CONNECTION, INFO,
|
||||
"connection_init: skt %d connection table full (%d/%d)\n",
|
||||
s, i, dtblsize );
|
||||
"connection_init: skt %d connection table full "
|
||||
"(%d/%d)\n", s, i, dtblsize );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"connection_init(%d): connection table full (%d/%d)\n",
|
||||
s, i, dtblsize);
|
||||
"connection_init(%d): connection table full "
|
||||
"(%d/%d)\n", s, i, dtblsize);
|
||||
#endif
|
||||
ldap_pvt_thread_mutex_unlock( &connections_mutex );
|
||||
return -1;
|
||||
|
|
@ -411,6 +411,12 @@ long connection_init(
|
|||
assert( c != NULL );
|
||||
|
||||
if( c->c_struct_state == SLAP_C_UNINITIALIZED ) {
|
||||
c->c_send_ldap_result = slap_send_ldap_result;
|
||||
c->c_send_search_entry = slap_send_search_entry;
|
||||
c->c_send_search_result = slap_send_search_result;
|
||||
c->c_send_search_reference = slap_send_search_reference;
|
||||
c->c_send_ldap_extended = slap_send_ldap_extended;
|
||||
|
||||
c->c_authmech.bv_val = NULL;
|
||||
c->c_authmech.bv_len = 0;
|
||||
c->c_dn.bv_val = NULL;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,12 @@ get_supported_ctrl(int index)
|
|||
return supportedControls[index].sc_oid;
|
||||
}
|
||||
|
||||
slap_mask_t
|
||||
get_supported_ctrl_mask(int index)
|
||||
{
|
||||
return supportedControls[index].sc_mask;
|
||||
}
|
||||
|
||||
static struct slap_control *
|
||||
find_ctrl( const char *oid )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_delete(
|
||||
|
|
@ -39,6 +41,8 @@ do_delete(
|
|||
int rc;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY,
|
||||
"do_delete: conn %d\n", conn->c_connid, 0, 0 );
|
||||
|
|
@ -153,6 +157,30 @@ do_delete(
|
|||
/* deref suffix alias if appropriate */
|
||||
suffix_alias( be, &ndn );
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_DELETE_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (delete) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: delete preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " delete preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/*
|
||||
* do the delete if 1 && (2 || 3)
|
||||
* 1) there is a delete function implemented in this backend;
|
||||
|
|
@ -193,6 +221,23 @@ do_delete(
|
|||
NULL, "operation not supported within namingContext", NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_DELETE_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (delete) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: delete postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " delete postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
free( pdn.bv_val );
|
||||
free( ndn.bv_val );
|
||||
|
|
|
|||
|
|
@ -26,14 +26,18 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
#include "lber_pvt.h"
|
||||
|
||||
#define UNSUPPORTED_EXTENDEDOP "unsupported extended operation"
|
||||
|
||||
static struct extop_list {
|
||||
struct extop_list *next;
|
||||
struct berval oid;
|
||||
|
|
@ -102,6 +106,12 @@ do_extended(
|
|||
struct berval *rspdata;
|
||||
LDAPControl **rspctrls;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
SLAPI_FUNC funcAddr = NULL;
|
||||
int extop_rc;
|
||||
int msg_sent=FALSE;
|
||||
char *result_msg="";
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_extended: conn %d\n", conn->c_connid, 0, 0 );
|
||||
#else
|
||||
|
|
@ -136,7 +146,10 @@ do_extended(
|
|||
goto done;
|
||||
}
|
||||
|
||||
if( !(ext = find_extop(supp_ext_list, &reqoid)) ) {
|
||||
/* Netscape extended operation */
|
||||
getPluginFunc( &reqoid, &funcAddr );
|
||||
|
||||
if( !(ext = find_extop(supp_ext_list, &reqoid)) && !(funcAddr) ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR,
|
||||
"do_extended: conn %d unsupported operation \"%s\"\n",
|
||||
|
|
@ -202,6 +215,7 @@ do_extended(
|
|||
text = NULL;
|
||||
refs = NULL;
|
||||
|
||||
if (ext != NULL) { /* OpenLDAP extended operation */
|
||||
rc = (ext->ext_main)( conn, op,
|
||||
reqoid.bv_val, reqdata.bv_val ? &reqdata : NULL,
|
||||
&rspoid, &rspdata, &rspctrls, &text, &refs );
|
||||
|
|
@ -225,6 +239,48 @@ do_extended(
|
|||
if ( rspdata != NULL ) {
|
||||
ber_bvfree( rspdata );
|
||||
}
|
||||
#if !defined( LDAP_SLAPI )
|
||||
}
|
||||
#else /* defined( LDAP_SLAPI ) */
|
||||
goto done; /* end of OpenLDAP extended operation */
|
||||
|
||||
} else { /* start of Netscape extended operation */
|
||||
if ( ( rc = slapi_pblock_set( pb, SLAPI_EXT_OP_REQ_OID,(void *)reqoid.bv_val) ) == 0 &&
|
||||
( rc = slapi_pblock_set( pb, SLAPI_EXT_OP_REQ_VALUE,(void *)&reqdata) ) == 0 &&
|
||||
( rc = slapi_pblock_set( pb, SLAPI_CONNECTION,(void *)conn) ) == 0 &&
|
||||
( rc = slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op) ) == 0) {
|
||||
extop_rc = (*funcAddr)( pb );
|
||||
if ( extop_rc == SLAPI_PLUGIN_EXTENDED_SENT_RESULT ) {
|
||||
msg_sent = TRUE;
|
||||
} else if ( extop_rc == SLAPI_PLUGIN_EXTENDED_NOT_HANDLED ) {
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
result_msg = UNSUPPORTED_EXTENDEDOP;
|
||||
} else {
|
||||
if ( ( rc = slapi_pblock_get(pb, SLAPI_EXT_OP_RET_OID,&rspoid) ) == 0 &&
|
||||
( rc = slapi_pblock_get(pb, SLAPI_EXT_OP_RET_VALUE,&rspdata) ) == 0 ) {
|
||||
send_ldap_extended( conn, op, extop_rc, NULL, text, refs,
|
||||
rspoid, rspdata, rspctrls );
|
||||
msg_sent = TRUE;
|
||||
} else {
|
||||
rc = LDAP_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rc = LDAP_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
if ( rc != LDAP_SUCCESS && msg_sent == FALSE ) {
|
||||
send_ldap_result( conn, op, rc, NULL, result_msg, NULL, NULL );
|
||||
}
|
||||
if ( rspoid != NULL ) {
|
||||
free( rspoid );
|
||||
}
|
||||
if ( rspdata != NULL ) {
|
||||
ber_bvfree( rspdata );
|
||||
}
|
||||
|
||||
} /* end of Netscape extended operation */
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
done:
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -16,7 +17,9 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
|
||||
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
#include "lutil.h"
|
||||
#include "ldif.h"
|
||||
|
||||
|
|
@ -405,6 +408,20 @@ int main( int argc, char **argv )
|
|||
(void) ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &rc );
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SLAPI
|
||||
if ( slapi_init() != 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, CRIT, "main: slapi initialization error\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"slapi initialization error\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
|
||||
goto destroy;
|
||||
}
|
||||
#endif /* LDAP_SLAPI */
|
||||
|
||||
if ( read_config( configfile, 0 ) != 0 ) {
|
||||
rc = 1;
|
||||
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 );
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_modify(
|
||||
|
|
@ -49,6 +51,8 @@ do_modify(
|
|||
const char *text;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_modify: enter\n", 0, 0, 0 );
|
||||
#else
|
||||
|
|
@ -303,6 +307,30 @@ do_modify(
|
|||
/* deref suffix alias if appropriate */
|
||||
suffix_alias( be, &ndn );
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (modify) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_modify: modify preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " modify preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/*
|
||||
* do the modify if 1 && (2 || 3)
|
||||
* 1) there is a modify function implemented in this backend;
|
||||
|
|
@ -380,6 +408,23 @@ do_modify(
|
|||
NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_MODIFY_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (modify) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_modify: modify postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " modify postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
free( pdn.bv_val );
|
||||
free( ndn.bv_val );
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -37,6 +38,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_modrdn(
|
||||
|
|
@ -64,6 +66,8 @@ do_modrdn(
|
|||
const char *text;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_modrdn: begin\n", 0, 0, 0 );
|
||||
#else
|
||||
|
|
@ -324,6 +328,34 @@ do_modrdn(
|
|||
/* deref suffix alias if appropriate */
|
||||
suffix_alias( be, &ndn );
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR,
|
||||
(void *)newSuperior.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)deloldrdn );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_MODRDN_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (modrdn) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_modrdn: modrdn preOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " modrdn preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/*
|
||||
* do the add if 1 && (2 || 3)
|
||||
* 1) there is an add function implemented in this backend;
|
||||
|
|
@ -370,6 +402,23 @@ do_modrdn(
|
|||
NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_MODRDN_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (modrdn) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_modrdn: modrdn postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " modrdn postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
free( pdn.bv_val );
|
||||
free( ndn.bv_val );
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
#include <ac/socket.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -42,6 +44,12 @@ slap_op_free( Operation *op )
|
|||
}
|
||||
#endif /* LDAP_CLIENT_UPDATE */
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
if ( op->o_pb != NULL ) {
|
||||
slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
free( (char *) op );
|
||||
}
|
||||
|
||||
|
|
@ -64,5 +72,9 @@ slap_op_alloc(
|
|||
op->o_time = slap_get_time();
|
||||
op->o_opid = id;
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
op->o_pb = slapi_pblock_new();
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
return( op );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,12 @@ LDAP_SLAPD_F (AttributeName *) str2anlist LDAP_P(( AttributeName *an,
|
|||
char *str, const char *brkstr ));
|
||||
LDAP_SLAPD_F (int) an_find LDAP_P(( AttributeName *a, struct berval *s ));
|
||||
|
||||
/*
|
||||
* add.c
|
||||
*/
|
||||
LDAP_SLAPD_F (int) slap_mods2entry LDAP_P(( Modifications *mods, Entry **e,
|
||||
int repl_user, const char **text, char *textbuf, size_t textlen ));
|
||||
|
||||
/*
|
||||
* at.c
|
||||
*/
|
||||
|
|
@ -271,6 +277,8 @@ LDAP_SLAPD_F (int) get_ctrls LDAP_P((
|
|||
|
||||
LDAP_SLAPD_F (char *) get_supported_ctrl LDAP_P((int index));
|
||||
|
||||
LDAP_SLAPD_F (slap_mask_t) get_supported_ctrl_mask LDAP_P((int index));
|
||||
|
||||
/*
|
||||
* config.c
|
||||
*/
|
||||
|
|
@ -773,7 +781,7 @@ LDAP_SLAPD_F (void) replog LDAP_P(( Backend *be, Operation *op,
|
|||
/*
|
||||
* result.c
|
||||
*/
|
||||
LDAP_SLAPD_F (void) send_ldap_result LDAP_P((
|
||||
LDAP_SLAPD_F (void) slap_send_ldap_result LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched, const char *text,
|
||||
BerVarray refs,
|
||||
|
|
@ -791,7 +799,7 @@ LDAP_SLAPD_F (void) send_ldap_disconnect LDAP_P((
|
|||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *text ));
|
||||
|
||||
LDAP_SLAPD_F (void) send_ldap_extended LDAP_P((
|
||||
LDAP_SLAPD_F (void) slap_send_ldap_extended LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched,
|
||||
const char *text, BerVarray refs,
|
||||
|
|
@ -803,20 +811,20 @@ LDAP_SLAPD_F (void) send_ldap_partial LDAP_P((
|
|||
const char *rspoid, struct berval *rspdata,
|
||||
LDAPControl **ctrls ));
|
||||
|
||||
LDAP_SLAPD_F (void) send_search_result LDAP_P((
|
||||
LDAP_SLAPD_F (void) slap_send_search_result LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched, const char *text,
|
||||
BerVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries ));
|
||||
|
||||
LDAP_SLAPD_F (int) send_search_reference LDAP_P((
|
||||
LDAP_SLAPD_F (int) slap_send_search_reference LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, BerVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
BerVarray *v2refs ));
|
||||
|
||||
LDAP_SLAPD_F (int) send_search_entry LDAP_P((
|
||||
LDAP_SLAPD_F (int) slap_send_search_entry LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, AttributeName *attrs, int attrsonly,
|
||||
LDAPControl **ctrls ));
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ send_ldap_disconnect(
|
|||
}
|
||||
|
||||
void
|
||||
send_ldap_result(
|
||||
slap_send_ldap_result(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -545,7 +545,7 @@ send_ldap_sasl(
|
|||
}
|
||||
|
||||
void
|
||||
send_ldap_extended(
|
||||
slap_send_ldap_extended(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -583,7 +583,7 @@ send_ldap_extended(
|
|||
|
||||
|
||||
void
|
||||
send_search_result(
|
||||
slap_send_search_result(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -661,7 +661,7 @@ send_search_result(
|
|||
}
|
||||
|
||||
int
|
||||
send_search_entry(
|
||||
slap_send_search_entry(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
|
|
@ -1214,7 +1214,7 @@ error_return:;
|
|||
}
|
||||
|
||||
int
|
||||
send_search_reference(
|
||||
slap_send_search_reference(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
|
|
|
|||
|
|
@ -11,13 +11,18 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
#include <ldif.h>
|
||||
#include "lber_pvt.h"
|
||||
#include "slapi/slapi_utils.h"
|
||||
|
||||
struct berval *ns_get_supported_extop (int);
|
||||
|
||||
static struct berval supportedFeatures[] = {
|
||||
BER_BVC(LDAP_FEATURE_ALL_OPERATIONAL_ATTRS), /* all Operational Attributes ("+") */
|
||||
|
|
@ -134,6 +139,14 @@ root_dse_info(
|
|||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
/* netscape supportedExtension */
|
||||
for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) {
|
||||
vals[0] = *bv;
|
||||
attr_merge( e, ad_supportedExtension, vals );
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/* supportedFeatures */
|
||||
if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
|
||||
return LDAP_OTHER;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
#include "slapi.h"
|
||||
|
||||
int
|
||||
do_search(
|
||||
|
|
@ -44,6 +46,8 @@ do_search(
|
|||
const char *text;
|
||||
int manageDSAit;
|
||||
|
||||
Slapi_PBlock *pb = op->o_pb;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ENTRY, "do_search: conn %d\n", conn->c_connid, 0, 0 );
|
||||
#else
|
||||
|
|
@ -310,6 +314,37 @@ do_search(
|
|||
/* deref the base if needed */
|
||||
suffix_alias( be, &nbase );
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
|
||||
slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
|
||||
slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
|
||||
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)base.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)scope );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_DEREF, (void *)deref );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, (void *)sizelimit );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_TIMELIMIT, (void *)timelimit );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, (void *)filter );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)fstr.bv_val );
|
||||
slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)attrsonly );
|
||||
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
|
||||
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
|
||||
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_SEARCH_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no preOp (search) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_search: search preOps failed\n"));
|
||||
#else
|
||||
Debug(LDAP_DEBUG_TRACE, "search preOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
/* actually do the search and send the result(s) */
|
||||
if ( be->be_search ) {
|
||||
(*be->be_search)( be, conn, op, &pbase, &nbase,
|
||||
|
|
@ -321,6 +356,23 @@ do_search(
|
|||
NULL, NULL );
|
||||
}
|
||||
|
||||
#if defined( LDAP_SLAPI )
|
||||
rc = doPluginFNs( be, SLAPI_PLUGIN_POST_SEARCH_FN, pb );
|
||||
if ( rc != 0 && rc != LDAP_OTHER ) {
|
||||
/*
|
||||
* either there is no postOp (search) plugins
|
||||
* or a plugin failed. Just log it
|
||||
*
|
||||
* FIXME: is this correct?
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_search: search postOps failed\n"));
|
||||
#else
|
||||
Debug (LDAP_DEBUG_TRACE, " search postOps failed.\n", 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
return_results:;
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( !( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
|
||||
|
|
|
|||
|
|
@ -1327,6 +1327,8 @@ struct slap_backend_db {
|
|||
BerVarray be_update_refs; /* where to refer modifying clients to */
|
||||
char *be_realm;
|
||||
void *be_private; /* anything the backend database needs */
|
||||
|
||||
void *be_pb; /* Netscape plugin */
|
||||
};
|
||||
|
||||
struct slap_conn;
|
||||
|
|
@ -1689,6 +1691,9 @@ typedef struct slap_op {
|
|||
|
||||
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
|
||||
ValuesReturnFilter *vrFilter; /* Structure represents ValuesReturnFilter */
|
||||
|
||||
void *o_pb; /* Netscape plugin */
|
||||
|
||||
} Operation;
|
||||
|
||||
#define get_manageDSAit(op) ((int)(op)->o_managedsait)
|
||||
|
|
@ -1697,6 +1702,80 @@ typedef struct slap_op {
|
|||
#define get_pagedresults(op) ((int)(op)->o_pagedresults)
|
||||
|
||||
|
||||
|
||||
typedef void (*SEND_LDAP_RESULT)(
|
||||
struct slap_conn *conn,
|
||||
struct slap_op *op,
|
||||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
BerVarray ref,
|
||||
LDAPControl **ctrls
|
||||
);
|
||||
|
||||
#define send_ldap_result( conn, op, err, matched, text, ref, ctrls ) \
|
||||
(*conn->c_send_ldap_result)( conn, op, err, matched, text, ref, ctrls )
|
||||
|
||||
|
||||
typedef int (*SEND_SEARCH_ENTRY)(
|
||||
struct slap_backend_db *be,
|
||||
struct slap_conn *conn,
|
||||
struct slap_op *op,
|
||||
struct slap_entry *e,
|
||||
AttributeName *attrs,
|
||||
int attrsonly,
|
||||
LDAPControl **ctrls
|
||||
);
|
||||
|
||||
#define send_search_entry( be, conn, op, e, attrs, attrsonly, ctrls) \
|
||||
(*conn->c_send_search_entry)( be, conn, op, e, attrs, attrsonly, ctrls)
|
||||
|
||||
|
||||
typedef void (*SEND_SEARCH_RESULT)(
|
||||
struct slap_conn *conn,
|
||||
struct slap_op *op,
|
||||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
BerVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries
|
||||
);
|
||||
|
||||
#define send_search_result( conn, op, err, matched, text, refs, ctrls, nentries ) \
|
||||
(*conn->c_send_search_result)( conn, op, err, matched, text, refs, ctrls, nentries )
|
||||
|
||||
|
||||
typedef int (*SEND_SEARCH_REFERENCE)(
|
||||
struct slap_backend_db *be,
|
||||
struct slap_conn *conn,
|
||||
struct slap_op *op,
|
||||
struct slap_entry *e,
|
||||
BerVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
BerVarray *v2refs
|
||||
);
|
||||
|
||||
#define send_search_reference( be, conn, op, e, refs, ctrls, v2refs ) \
|
||||
(*conn->c_send_search_reference)( be, conn, op, e, refs, ctrls, v2refs )
|
||||
|
||||
|
||||
typedef void (*SEND_LDAP_EXTENDED)(
|
||||
struct slap_conn *conn,
|
||||
struct slap_op *op,
|
||||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
BerVarray refs,
|
||||
const char *rspoid,
|
||||
struct berval *rspdata,
|
||||
LDAPControl **ctrls
|
||||
);
|
||||
|
||||
#define send_ldap_extended( conn, op, err, matched, text, refs, rspoid, rspdata, ctrls) \
|
||||
(*conn->c_send_ldap_extended)( conn, op, err, matched, text, refs, rspoid, rspdata, ctrls )
|
||||
|
||||
|
||||
/*
|
||||
* Caches the result of a backend_group check for ACL evaluation
|
||||
*/
|
||||
|
|
@ -1777,6 +1856,20 @@ typedef struct slap_conn {
|
|||
long c_n_get; /* num of get calls */
|
||||
long c_n_read; /* num of read calls */
|
||||
long c_n_write; /* num of write calls */
|
||||
|
||||
void *c_pb; /* Netscape plugin */
|
||||
|
||||
/*
|
||||
* These are the "callbacks" that are available for back-ends to
|
||||
* supply data back to connected clients that are connected
|
||||
* through the "front-end".
|
||||
*/
|
||||
SEND_LDAP_RESULT c_send_ldap_result;
|
||||
SEND_SEARCH_ENTRY c_send_search_entry;
|
||||
SEND_SEARCH_RESULT c_send_search_result;
|
||||
SEND_SEARCH_REFERENCE c_send_search_reference;
|
||||
SEND_LDAP_EXTENDED c_send_ldap_extended;
|
||||
|
||||
} Connection;
|
||||
|
||||
#if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
|
||||
|
|
|
|||
45
servers/slapd/slapi/Makefile.in
Normal file
45
servers/slapd/slapi/Makefile.in
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
|
||||
## (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.
|
||||
|
||||
|
||||
LIBRARY = libslapi.la
|
||||
XLIBRARY = libtmpslapd.a
|
||||
|
||||
#all-common: $(LIBRARY) $(PROGRAMS)
|
||||
# @touch plugin.c slapi_pblock.c slapi_utils.c slapi_ops.c
|
||||
|
||||
NT_SRCS = nt_err.c
|
||||
NT_OBJS = nt_err.lo
|
||||
|
||||
LIB_DEFS = -DSLAPI_LIBRARY
|
||||
|
||||
SRCS= plugin.c slapi_pblock.c slapi_utils.c printmsg.c slapi_ops.c $(@PLAT@_SRCS)
|
||||
OBJS= plugin.lo slapi_pblock.lo slapi_utils.lo printmsg.lo slapi_ops.lo $(@PLAT@_SRCS)
|
||||
|
||||
XSRCS= version.c
|
||||
|
||||
LDAP_INCDIR= ../../../include -I.. -I.
|
||||
LDAP_LIBDIR= ../../../libraries
|
||||
|
||||
XLIBS = $(LIBRARY)
|
||||
XXLIBS =
|
||||
NT_LINK_LIBS = $(AC_LIBS)
|
||||
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
|
||||
UNIX_LINK_LIBS = ./libtmpslapd.a ../libbackends.a ../../../libraries/libavl/libavl.a ../../../libraries/liblber/.libs/liblber.a ../../../libraries/libldbm/libldbm.a ../../../libraries/libldif/libldif.a ../../../libraries/liblutil/liblutil.a ../../../libraries/liblunicode/liblunicode.a ../../../libraries/libldap_r/.libs/libldap_r.a ./libtmpslapd.a
|
||||
|
||||
BUILD_MOD = @BUILD_SLAPI@
|
||||
|
||||
install-local: FORCE
|
||||
if test "$(BUILD_MOD)" = "yes"; then \
|
||||
$(MKDIR) $(DESTDIR)$(libdir); \
|
||||
$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir); \
|
||||
fi
|
||||
|
||||
55
servers/slapd/slapi/README
Normal file
55
servers/slapd/slapi/README
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
Files included in this patch:
|
||||
|
||||
I. Modified OpenLDAP files
|
||||
---------------------------------
|
||||
|
||||
1. top level configure.in
|
||||
2. slap.h
|
||||
3. back-ldbm/Makefile.in
|
||||
4. back-ldbm/config.c
|
||||
5. back-bdb/Makefile.in
|
||||
6. back-bdb/config.c
|
||||
7. slapd/tools/Makefile.in
|
||||
8. ldap/include/Makefile.in
|
||||
9. slapd/Makefile.in
|
||||
10. operation.c
|
||||
11. root_dse.c
|
||||
12. extended.c
|
||||
13. bind.c
|
||||
14. backend.c
|
||||
15. add.c
|
||||
16. delete.c
|
||||
17. compare.c
|
||||
18. moddify.c
|
||||
19. modrdn.c
|
||||
20. search.c
|
||||
21. result.c
|
||||
22. mimic.c
|
||||
|
||||
|
||||
II. New files
|
||||
-------------------------------
|
||||
|
||||
1. slapd/slapi/Makefile.in
|
||||
2. slapd/slapi/ldapload.h
|
||||
3. slapd/slapi/ldapload.c
|
||||
4. slapd/slapi/plugin.h
|
||||
5. slapd/slapi/plugin.c
|
||||
6. slapd/slapi/printmsg.c
|
||||
7. slapd/slapi/slapi_pblock.h
|
||||
8. slapd/slapi/slapi_pblock.c
|
||||
9. slapd/slapi/slapi_ops.h
|
||||
10.slapd/slapi/slapi_utils.h
|
||||
11.slapd/slapi/slapi_utils.c
|
||||
12.slapd/slapi/ibm_pblock_params.h
|
||||
13.slapd/slapi/slapi_common.h
|
||||
14.slapd/slapi/slapi.h
|
||||
15.slapd/slapi/slapi_cl.h
|
||||
16.ldap/include/slapi-plugin.h
|
||||
|
||||
III. General procedure
|
||||
|
||||
The directory ldap/servers/slapd/slapi should be created and
|
||||
files 1-15, section II above should be placed in that directory.
|
||||
The file slapi-plugin.h (16 above) should also be copied into
|
||||
the ldap/include directory.
|
||||
68
servers/slapd/slapi/ibm_pblock_params.h
Normal file
68
servers/slapd/slapi/ibm_pblock_params.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _ibm_pblock_params_H
|
||||
#define _ibm_pblock_params_H
|
||||
|
||||
#define FIRST_PARAM -1
|
||||
#define LAST_IBM_PARAM -48
|
||||
#define NETSCAPE_RESERVED(p) (p >= 280) && (p <= 299)
|
||||
#define IBM_RESERVED(p) (p >= LAST_IBM_PARAM) && (p <= FIRST_PARAM)
|
||||
|
||||
#define SLAPI_IBM_THREAD_CONTROL (FIRST_PARAM - 1)
|
||||
#define SLAPI_IBM_PBLOCK (FIRST_PARAM - 2)
|
||||
#define SLAPI_IBM_CONNECTION_PTR (FIRST_PARAM - 3)
|
||||
#define SLAPI_IBM_BACKENDS (FIRST_PARAM - 4)
|
||||
#define SLAPI_PRE_BIND_ALL (FIRST_PARAM - 5)
|
||||
#define SLAPI_POST_BIND_ALL (FIRST_PARAM - 6)
|
||||
#define SLAPI_IBM_ADMIN_DN (FIRST_PARAM - 7)
|
||||
#define SLAPI_CONFIG_STATE (FIRST_PARAM - 8)
|
||||
#define SLAPI_PLUGIN_DB_REGISTER_SERVICE_FN (FIRST_PARAM - 9)
|
||||
#define SLAPI_PLUGIN_DB_INSERT_REPL_ENTRIES_FN (FIRST_PARAM - 10)
|
||||
#define SLAPI_PLUGIN_DB_GET_REPL_ENTRIES_FN (FIRST_PARAM - 11)
|
||||
#define SLAPI_PLUGIN_DB_REPLICA_DONE_FN (FIRST_PARAM - 12)
|
||||
#define SLAPI_PLUGIN_DB_INIT_REPL_LIST_FN (FIRST_PARAM - 13)
|
||||
#define SLAPI_PLUGIN_DB_THREAD_INITIALIZE_FN (FIRST_PARAM - 14)
|
||||
#define SLAPI_PLUGIN_DB_THREAD_TERMINATE_FN (FIRST_PARAM - 15)
|
||||
#define SLAPI_PLUGIN_DB_SCHEMA_MODIFY_ATTRTYPE_FN (FIRST_PARAM - 16)
|
||||
#define SLAPI_PLUGIN_DB_SCHEMA_MODIFY_OBJCLASS_FN (FIRST_PARAM - 17)
|
||||
#define SLAPI_PLUGIN_DB_INIT_FN (FIRST_PARAM - 18)
|
||||
#define SLAPI_IBM_EXTENDED_OPS (FIRST_PARAM - 19)
|
||||
#define SLAPI_IBM_CONTROLS (FIRST_PARAM - 20)
|
||||
#define SLAPI_IBM_SASLMECHANISMS (FIRST_PARAM - 21)
|
||||
#define SLAPI_IBM_BROADCAST_BE (FIRST_PARAM - 22)
|
||||
#define SLAPI_IBM_NOTIFY_BIND_FN (FIRST_PARAM - 23)
|
||||
#define SLAPI_IBM_SECRET (FIRST_PARAM - 24)
|
||||
#define SLAPI_IBM_CL_START_FN (FIRST_PARAM - 25)
|
||||
#define SLAPI_IBM_REPLICATE (FIRST_PARAM - 26)
|
||||
#define SLAPI_IBM_CL_CLASS (FIRST_PARAM - 27)
|
||||
#define SLAPI_IBM_CL_SUFFIX (FIRST_PARAM - 28)
|
||||
#define SLAPI_IBM_CL_MAX_ENTRIES (FIRST_PARAM - 29)
|
||||
#define SLAPI_IBM_CONNINFO (FIRST_PARAM - 30)
|
||||
#define SLAPI_IBM_CL_FIRST_ENTRY (FIRST_PARAM - 31)
|
||||
#define SLAPI_IBM_CL_LAST_ENTRY (FIRST_PARAM - 32)
|
||||
#define SLAPI_IBM_CONN_DN_ALT (FIRST_PARAM - 33)
|
||||
#define SLAPI_IBM_GSSAPI_CONTEXT (FIRST_PARAM - 34)
|
||||
#define SLAPI_IBM_ADD_ENTRY (FIRST_PARAM - 35)
|
||||
#define SLAPI_IBM_DELETE_ENTRY (FIRST_PARAM - 36)
|
||||
#define SLAPI_IBM_MODIFY_ENTRY (FIRST_PARAM - 37)
|
||||
#define SLAPI_IBM_MODIFY_MODS (FIRST_PARAM - 38)
|
||||
#define SLAPI_IBM_MODRDN_ENTRY (FIRST_PARAM - 39)
|
||||
#define SLAPI_IBM_MODRDN_NEWDN (FIRST_PARAM - 40)
|
||||
#define SLAPI_IBM_EVENT_ENABLED (FIRST_PARAM - 41)
|
||||
#define SLAPI_IBM_EVENT_MAXREG (FIRST_PARAM - 42)
|
||||
#define SLAPI_IBM_EVENT_REGPERCONN (FIRST_PARAM - 43)
|
||||
#define SLAPI_IBM_EVENT_CURREG (FIRST_PARAM - 44)
|
||||
#define SLAPI_IBM_EVENT_SENTREG (FIRST_PARAM - 45)
|
||||
#define SLAPI_IBM_CONN_DN_ORIG (FIRST_PARAM - 46)
|
||||
#define SLAPI_PLUGIN_DB_DELETE_PROGRESS_FN (FIRST_PARAM - 47)
|
||||
#endif
|
||||
679
servers/slapd/slapi/plugin.c
Normal file
679
servers/slapd/slapi/plugin.c
Normal file
|
|
@ -0,0 +1,679 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
#include <ldap_pvt_thread.h>
|
||||
#include <slap.h>
|
||||
#include <slapi.h>
|
||||
|
||||
/*
|
||||
* Note: if ltdl.h is not available, slapi should not be compiled
|
||||
*/
|
||||
#include <ltdl.h>
|
||||
|
||||
static int loadPlugin( Slapi_PBlock *, const char *, const char *, int,
|
||||
SLAPI_FUNC *, lt_dlhandle * );
|
||||
|
||||
/* pointer to link list of extended objects */
|
||||
static ExtendedOp *pGExtendedOps = NULL;
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: newPlugin
|
||||
*
|
||||
* Description: This routine creates a new Slapi_PBlock structure,
|
||||
* loads in the plugin module and executes the init
|
||||
* function provided by the module.
|
||||
*
|
||||
* Input: type - type of the plugin, such as SASL, database, etc.
|
||||
* path - the loadpath to load the module in
|
||||
* initfunc - name of the plugin function to execute first
|
||||
* argc - number of arguements
|
||||
* argv[] - an array of char pointers point to
|
||||
* the arguments passed in via
|
||||
* the configuration file.
|
||||
*
|
||||
* Output:
|
||||
*
|
||||
* Return Values: a pointer to a newly created Slapi_PBlock structrue or
|
||||
* NULL - function failed
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
|
||||
Slapi_PBlock *
|
||||
newPlugin(
|
||||
int type,
|
||||
const char *path,
|
||||
const char *initfunc,
|
||||
int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
Slapi_PBlock *pPlugin = NULL;
|
||||
lt_dlhandle hdLoadHandle;
|
||||
int rc;
|
||||
|
||||
pPlugin = slapi_pblock_new();
|
||||
if ( pPlugin == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)type );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGC, (void *)argc );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGV, (void *)argv );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = loadPlugin( pPlugin, path, initfunc, TRUE, NULL, &hdLoadHandle );
|
||||
|
||||
done:
|
||||
if ( rc != LDAP_SUCCESS && pPlugin != NULL ) {
|
||||
slapi_pblock_destroy( pPlugin );
|
||||
pPlugin = NULL;
|
||||
}
|
||||
|
||||
return pPlugin;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: insertPlugin
|
||||
*
|
||||
* Description: insert the slapi_pblock structure to the end of the plugin
|
||||
* list
|
||||
*
|
||||
* Input: a pointer to a plugin slapi_pblock structure to be added to
|
||||
* the list
|
||||
*
|
||||
* Output: none
|
||||
*
|
||||
* Return Values: LDAP_SUCCESS - successfully inserted.
|
||||
* LDAP_LOCAL_ERROR.
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
int
|
||||
insertPlugin(
|
||||
Backend *be,
|
||||
Slapi_PBlock *pPB )
|
||||
{
|
||||
Slapi_PBlock *pTmpPB;
|
||||
Slapi_PBlock *pSavePB;
|
||||
int rc = LDAP_SUCCESS;
|
||||
|
||||
pTmpPB = (Slapi_PBlock *)(be->be_pb);
|
||||
|
||||
if ( pTmpPB == NULL ) {
|
||||
be->be_pb = (void *)pPB;
|
||||
} else {
|
||||
while ( pTmpPB != NULL && rc == LDAP_SUCCESS ) {
|
||||
pSavePB = pTmpPB;
|
||||
rc = slapi_pblock_get( pTmpPB, SLAPI_IBM_PBLOCK,
|
||||
&pTmpPB );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rc = LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = slapi_pblock_set( pSavePB, SLAPI_IBM_PBLOCK,
|
||||
(void *)pPB );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rc = LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: getAllPluginFuncs
|
||||
*
|
||||
* Description: get the desired type of function pointers defined
|
||||
* in all the plugins
|
||||
*
|
||||
* Input: the type of the functions to get, such as pre-operation,etc.
|
||||
*
|
||||
* Output: none
|
||||
*
|
||||
* Return Values: this routine returns a pointer to an array of function
|
||||
* pointers
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
int
|
||||
getAllPluginFuncs(
|
||||
Backend *be,
|
||||
int functype,
|
||||
SLAPI_FUNC **ppFuncPtrs )
|
||||
{
|
||||
|
||||
Slapi_PBlock *pCurrentPB;
|
||||
SLAPI_FUNC FuncPtr;
|
||||
SLAPI_FUNC *pTmpFuncPtr;
|
||||
int numPB = 0;
|
||||
int rc = LDAP_SUCCESS;
|
||||
|
||||
assert( be );
|
||||
assert( ppFuncPtrs );
|
||||
|
||||
pCurrentPB = (Slapi_PBlock *)(be->be_pb);
|
||||
|
||||
if ( pCurrentPB == NULL ) {
|
||||
/*
|
||||
* LDAP_OTHER is returned if no plugins are installed
|
||||
*/
|
||||
rc = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
|
||||
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
if ( FuncPtr != NULL ) {
|
||||
numPB++;
|
||||
}
|
||||
rc = slapi_pblock_get( pCurrentPB,
|
||||
SLAPI_IBM_PBLOCK, &pCurrentPB );
|
||||
}
|
||||
}
|
||||
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( numPB == 0 ) {
|
||||
*ppFuncPtrs = NULL;
|
||||
rc = LDAP_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
*ppFuncPtrs = pTmpFuncPtr =
|
||||
(SLAPI_FUNC *)ch_malloc( ( numPB + 1 ) * sizeof(SLAPI_FUNC) );
|
||||
if ( ppFuncPtrs == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
pCurrentPB = (Slapi_PBlock *)(be->be_pb);
|
||||
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
|
||||
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
if ( FuncPtr != NULL ) {
|
||||
*pTmpFuncPtr = FuncPtr;
|
||||
pTmpFuncPtr++;
|
||||
}
|
||||
rc = slapi_pblock_get( pCurrentPB,
|
||||
SLAPI_IBM_PBLOCK, &pCurrentPB );
|
||||
}
|
||||
}
|
||||
*pTmpFuncPtr = NULL ;
|
||||
|
||||
done:
|
||||
if ( rc != LDAP_SUCCESS && *ppFuncPtrs != NULL ) {
|
||||
ch_free( *ppFuncPtrs );
|
||||
*ppFuncPtrs = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: createExtendedOp
|
||||
*
|
||||
* Description: Creates an extended operation structure and
|
||||
* initializes the fields
|
||||
*
|
||||
* Return value: A newly allocated structure or NULL
|
||||
********************************************************************/
|
||||
ExtendedOp *
|
||||
createExtendedOp()
|
||||
{
|
||||
ExtendedOp *ret;
|
||||
|
||||
ret = (ExtendedOp *)ch_malloc(sizeof(ExtendedOp));
|
||||
if ( ret != NULL ) {
|
||||
ret->ext_oid.bv_val = NULL;
|
||||
ret->ext_oid.bv_len = 0;
|
||||
ret->ext_func = NULL;
|
||||
ret->ext_be = NULL;
|
||||
ret->ext_next = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: removeExtendedOp
|
||||
*
|
||||
* Description: This routine removes the ExtendedOp structures
|
||||
* asscoiated with a particular extended operation
|
||||
* plugin.
|
||||
*
|
||||
* Input: pBE - pointer to a backend structure
|
||||
* opList - pointer to a linked list of extended
|
||||
* operation structures
|
||||
* pPB - pointer to a slapi parameter block
|
||||
*
|
||||
* Output:
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
void
|
||||
removeExtendedOp(
|
||||
Backend *pBE,
|
||||
ExtendedOp **opList,
|
||||
Slapi_PBlock *pPB )
|
||||
{
|
||||
ExtendedOp *pTmpExtOp, *backExtOp;
|
||||
char **pTmpOIDs;
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
assert( pBE != NULL); /* unused */
|
||||
#endif /* 0 */
|
||||
assert( opList != NULL );
|
||||
assert( pPB != NULL );
|
||||
|
||||
if ( *opList == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
slapi_pblock_get( pPB, SLAPI_PLUGIN_EXT_OP_OIDLIST, &pTmpOIDs );
|
||||
if ( pTmpOIDs == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = 0; pTmpOIDs[i] != NULL; i++ ) {
|
||||
backExtOp = NULL;
|
||||
pTmpExtOp = *opList;
|
||||
for ( ; pTmpExtOp != NULL; pTmpExtOp = pTmpExtOp->ext_next) {
|
||||
int rc;
|
||||
rc = strcasecmp( pTmpExtOp->ext_oid.bv_val,
|
||||
pTmpOIDs[ i ] );
|
||||
if ( rc == 0 ) {
|
||||
if ( backExtOp == NULL ) {
|
||||
*opList = pTmpExtOp->ext_next;
|
||||
} else {
|
||||
backExtOp->ext_next
|
||||
= pTmpExtOp->ext_next;
|
||||
}
|
||||
|
||||
ch_free( pTmpExtOp );
|
||||
break;
|
||||
}
|
||||
backExtOp = pTmpExtOp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: newExtendedOp
|
||||
*
|
||||
* Description: This routine creates a new ExtendedOp structure, loads
|
||||
* in the extended op module and put the extended op function address
|
||||
* in the structure. The function will not be executed in
|
||||
* this routine.
|
||||
*
|
||||
* Input: pBE - pointer to a backend structure
|
||||
* opList - pointer to a linked list of extended
|
||||
* operation structures
|
||||
* pPB - pointer to a slapi parameter block
|
||||
*
|
||||
* Output:
|
||||
*
|
||||
* Return Value: an LDAP return code
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
int
|
||||
newExtendedOp(
|
||||
Backend *pBE,
|
||||
ExtendedOp **opList,
|
||||
Slapi_PBlock *pPB )
|
||||
{
|
||||
ExtendedOp *pTmpExtOp = NULL;
|
||||
SLAPI_FUNC tmpFunc;
|
||||
char **pTmpOIDs;
|
||||
int rc = LDAP_OTHER;
|
||||
int i;
|
||||
|
||||
if ( (*opList) == NULL ) {
|
||||
*opList = createExtendedOp();
|
||||
if ( (*opList) == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto error_return;
|
||||
}
|
||||
pTmpExtOp = *opList;
|
||||
|
||||
} else { /* Find the end of the list */
|
||||
for ( pTmpExtOp = *opList; pTmpExtOp->ext_next != NULL;
|
||||
pTmpExtOp = pTmpExtOp->ext_next )
|
||||
; /* EMPTY */
|
||||
pTmpExtOp->ext_next = createExtendedOp();
|
||||
if ( pTmpExtOp->ext_next == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto error_return;
|
||||
}
|
||||
pTmpExtOp = pTmpExtOp->ext_next;
|
||||
}
|
||||
|
||||
rc = slapi_pblock_get( pPB,SLAPI_PLUGIN_EXT_OP_OIDLIST, &pTmpOIDs );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rc = LDAP_OTHER;
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
rc = slapi_pblock_get(pPB,SLAPI_PLUGIN_EXT_OP_FN, &tmpFunc);
|
||||
if ( rc != 0 ) {
|
||||
rc = LDAP_OTHER;
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
if ( (pTmpOIDs == NULL) || (tmpFunc == NULL) ) {
|
||||
rc = LDAP_OTHER;
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
for ( i = 0; pTmpOIDs[i] != NULL; i++ ) {
|
||||
pTmpExtOp->ext_oid.bv_val = pTmpOIDs[i];
|
||||
pTmpExtOp->ext_oid.bv_len = strlen( pTmpOIDs[i] );
|
||||
pTmpExtOp->ext_func = tmpFunc;
|
||||
pTmpExtOp->ext_be = pBE;
|
||||
if ( pTmpOIDs[i + 1] != NULL ) {
|
||||
pTmpExtOp->ext_next = createExtendedOp();
|
||||
if ( pTmpExtOp->ext_next == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
pTmpExtOp = pTmpExtOp->ext_next;
|
||||
}
|
||||
}
|
||||
|
||||
error_return:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: getPluginFunc
|
||||
*
|
||||
* Description: This routine gets the function address for a given function
|
||||
* name.
|
||||
*
|
||||
* Input:
|
||||
* funcName - name of the extended op function, ie. an OID.
|
||||
*
|
||||
* Output: pFuncAddr - the function address of the requested function name.
|
||||
*
|
||||
* Return Values: a pointer to a newly created ExtendOp structrue or
|
||||
* NULL - function failed
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
int
|
||||
getPluginFunc(
|
||||
struct berval *reqoid,
|
||||
SLAPI_FUNC *pFuncAddr )
|
||||
{
|
||||
ExtendedOp *pTmpExtOp;
|
||||
|
||||
assert( reqoid != NULL );
|
||||
assert( pFuncAddr != NULL );
|
||||
|
||||
*pFuncAddr = NULL;
|
||||
|
||||
if ( pGExtendedOps == NULL ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
pTmpExtOp = pGExtendedOps;
|
||||
while ( pTmpExtOp != NULL ) {
|
||||
int rc;
|
||||
|
||||
rc = strcasecmp( reqoid->bv_val, pTmpExtOp->ext_oid.bv_val );
|
||||
if ( rc == 0 ) {
|
||||
*pFuncAddr = pTmpExtOp->ext_func;
|
||||
break;
|
||||
}
|
||||
pTmpExtOp = pTmpExtOp->ext_next;
|
||||
}
|
||||
|
||||
return ( *pFuncAddr == NULL ? 1 : 0 );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This function is similar to getPluginFunc above. except it returns one OID
|
||||
* per call. It is called from root_dse_info (root_dse.c).
|
||||
* The function is a modified version of get_supported_extop (file extended.c).
|
||||
***************************************************************************/
|
||||
struct berval *
|
||||
ns_get_supported_extop( int index )
|
||||
{
|
||||
ExtendedOp *ext;
|
||||
|
||||
for ( ext = pGExtendedOps ; ext != NULL && --index >= 0;
|
||||
ext = ext->ext_next) {
|
||||
; /* empty */
|
||||
}
|
||||
|
||||
if ( ext == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &ext->ext_oid ;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* Function Name: loadPlugin
|
||||
*
|
||||
* Description: This routine loads the specified DLL, gets and executes the init function
|
||||
* if requested.
|
||||
*
|
||||
* Input:
|
||||
* pPlugin - a pointer to a Slapi_PBlock struct which will be passed to
|
||||
* the DLL init function.
|
||||
* path - path name of the DLL to be load.
|
||||
* initfunc - either the DLL initialization function or an OID of the
|
||||
* loaded extended operation.
|
||||
* doInit - if it is TRUE, execute the init function, otherwise, save the
|
||||
* function address but not execute it.
|
||||
*
|
||||
* Output: pInitFunc - the function address of the loaded function. This param
|
||||
* should be not be null if doInit is FALSE.
|
||||
* pLdHandle - handle returned by lt_dlopen()
|
||||
*
|
||||
* Return Values: LDAP_SUCCESS, LDAP_LOCAL_ERROR
|
||||
*
|
||||
* Messages: None
|
||||
*********************************************************************/
|
||||
|
||||
static int
|
||||
loadPlugin(
|
||||
Slapi_PBlock *pPlugin,
|
||||
const char *path,
|
||||
const char *initfunc,
|
||||
int doInit,
|
||||
SLAPI_FUNC *pInitFunc,
|
||||
lt_dlhandle *pLdHandle )
|
||||
{
|
||||
int rc = LDAP_SUCCESS;
|
||||
SLAPI_FUNC fpInitFunc = NULL;
|
||||
|
||||
assert( pLdHandle );
|
||||
|
||||
if ( lt_dlinit() ) {
|
||||
return LDAP_LOCAL_ERROR;
|
||||
}
|
||||
|
||||
/* load in the module */
|
||||
*pLdHandle = lt_dlopen( path );
|
||||
if ( *pLdHandle == NULL ) {
|
||||
return LDAP_LOCAL_ERROR;
|
||||
}
|
||||
|
||||
fpInitFunc = (SLAPI_FUNC)lt_dlsym( *pLdHandle, initfunc );
|
||||
if ( fpInitFunc == NULL ) {
|
||||
lt_dlclose( *pLdHandle );
|
||||
return LDAP_LOCAL_ERROR;
|
||||
}
|
||||
|
||||
if ( doInit == TRUE ) {
|
||||
rc = ( *fpInitFunc )( pPlugin );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
lt_dlclose( *pLdHandle );
|
||||
}
|
||||
|
||||
} else {
|
||||
*pInitFunc = fpInitFunc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
doPluginFNs(
|
||||
Backend *be,
|
||||
int funcType,
|
||||
Slapi_PBlock *pPB )
|
||||
{
|
||||
|
||||
int rc = LDAP_SUCCESS;
|
||||
SLAPI_FUNC *pGetPlugin = NULL, *tmpPlugin = NULL;
|
||||
|
||||
rc = getAllPluginFuncs(be, funcType, &tmpPlugin );
|
||||
if ( rc != LDAP_SUCCESS || tmpPlugin == NULL ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
for ( pGetPlugin = tmpPlugin ; *pGetPlugin != NULL; pGetPlugin++ ) {
|
||||
/*
|
||||
* FIXME: operation stops at first non-success
|
||||
*
|
||||
* FIXME: we should provide here a sort of sandbox,
|
||||
* to protect from plugin faults; e.g. trap signals
|
||||
* and longjump here, marking the plugin as unsafe for
|
||||
* later executions ...
|
||||
*/
|
||||
rc = (*pGetPlugin)(pPB);
|
||||
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ch_free( tmpPlugin );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
netscape_plugin(
|
||||
Backend *be,
|
||||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv )
|
||||
{
|
||||
int iType = -1;
|
||||
int numPluginArgc = 0;
|
||||
char **ppPluginArgv = NULL;
|
||||
|
||||
if ( argc < 4 ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: missing arguments "
|
||||
"in \"plugin <plugin_type> <lib_path> "
|
||||
"<init_function> [<arguments>]\" line\n",
|
||||
fname, lineno );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( strcasecmp( argv[1], "preoperation" ) == 0 ) {
|
||||
iType = SLAPI_PLUGIN_PREOPERATION;
|
||||
} else if ( strcasecmp( argv[1], "postoperation" ) == 0 ) {
|
||||
iType = SLAPI_PLUGIN_POSTOPERATION;
|
||||
} else if ( strcasecmp( argv[1], "extendedop" ) == 0 ) {
|
||||
iType = SLAPI_PLUGIN_EXTENDEDOP;
|
||||
} else {
|
||||
fprintf( stderr, "%s: line %d: invalid plugin type \"%s\".\n",
|
||||
fname, lineno, argv[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
numPluginArgc = argc - 4;
|
||||
if ( numPluginArgc > 0 ) {
|
||||
ppPluginArgv = &argv[4];
|
||||
} else {
|
||||
ppPluginArgv = NULL;
|
||||
}
|
||||
|
||||
if ( iType == SLAPI_PLUGIN_PREOPERATION ||
|
||||
iType == SLAPI_PLUGIN_EXTENDEDOP ||
|
||||
iType == SLAPI_PLUGIN_POSTOPERATION ) {
|
||||
int rc;
|
||||
Slapi_PBlock *pPlugin;
|
||||
|
||||
pPlugin = newPlugin( iType, argv[2], argv[3],
|
||||
numPluginArgc, ppPluginArgv );
|
||||
if (pPlugin == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (iType == SLAPI_PLUGIN_EXTENDEDOP) {
|
||||
rc = newExtendedOp(be, &pGExtendedOps, pPlugin);
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
slapi_pblock_destroy( pPlugin );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
rc = insertPlugin( be, pPlugin );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
if ( iType == SLAPI_PLUGIN_EXTENDEDOP ) {
|
||||
removeExtendedOp( be, &pGExtendedOps, pPlugin );
|
||||
}
|
||||
slapi_pblock_destroy( pPlugin );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
slapi_init(void)
|
||||
{
|
||||
if ( ldap_pvt_thread_mutex_init( &slapi_hn_mutex ) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( ldap_pvt_thread_mutex_init( &slapi_time_mutex ) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
28
servers/slapd/slapi/plugin.h
Normal file
28
servers/slapd/slapi/plugin.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _PLUGIN_H_
|
||||
#define _PLUGIN_H_
|
||||
|
||||
Slapi_PBlock *newPlugin ( int type, const char *path, const char *initfunc,
|
||||
int argc, char *argv[] );
|
||||
int insertPlugin(Backend *be, Slapi_PBlock *pPB);
|
||||
int doPluginFNs(Backend *be, int funcType, Slapi_PBlock * pPB);
|
||||
int getAllPluginFuncs(Backend *be, int functype, SLAPI_FUNC **ppFuncPtrs);
|
||||
int newExtendedOp(Backend *pBE, ExtendedOp **opList, Slapi_PBlock *pPB);
|
||||
int getPluginFunc(struct berval *reqoid, SLAPI_FUNC *pFuncAddr );
|
||||
int netscape_plugin(Backend *be, const char *fname, int lineno,
|
||||
int argc, char **argv );
|
||||
int slapi_init(void);
|
||||
|
||||
#endif /* _PLUGIN_H_ */
|
||||
|
||||
118
servers/slapd/slapi/printmsg.c
Normal file
118
servers/slapd/slapi/printmsg.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#include <portable.h>
|
||||
#include <slapi_common.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <ldap.h>
|
||||
#include <ldap_config.h>
|
||||
#include <slap.h>
|
||||
#include <slapi.h>
|
||||
|
||||
#include <ldap_pvt_thread.h>
|
||||
|
||||
/* Single threads access to routine */
|
||||
static ldap_pvt_thread_mutex_t PrintMessage_mutex;
|
||||
static int PrintMessage_mutex_inited = 0;
|
||||
|
||||
static void
|
||||
InitMutex ()
|
||||
{
|
||||
if (PrintMessage_mutex_inited == 0) {
|
||||
PrintMessage_mutex_inited = 1;
|
||||
ldap_pvt_thread_mutex_init(&PrintMessage_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
vLogError(
|
||||
int level,
|
||||
char *subsystem,
|
||||
char *fmt,
|
||||
va_list arglist )
|
||||
{
|
||||
int rc = 0;
|
||||
char *tmpFmt;
|
||||
FILE * fp = NULL;
|
||||
char *p, *sval;
|
||||
int ival;
|
||||
|
||||
char timeStr[100];
|
||||
struct tm *ltm;
|
||||
time_t currentTime;
|
||||
|
||||
tmpFmt = fmt;
|
||||
fmt = (char*)ch_calloc(strlen(subsystem) + strlen(tmpFmt) + 3, 1);
|
||||
sprintf(fmt, "%s: %s", subsystem, tmpFmt);
|
||||
|
||||
InitMutex() ;
|
||||
ldap_pvt_thread_mutex_lock( &PrintMessage_mutex ) ;
|
||||
|
||||
/* for now, we log all severities */
|
||||
if ( 1 ) {
|
||||
fp = fopen( LDAP_RUNDIR LDAP_DIRSEP "errors", "a" );
|
||||
if (fp == NULL)
|
||||
fp = fopen( "errors", "a" );
|
||||
|
||||
if ( fp != NULL) {
|
||||
while ( lockf(fileno(fp), F_LOCK, 0 ) != 0 ) {}
|
||||
|
||||
time (¤tTime);
|
||||
ltm = localtime( ¤tTime );
|
||||
strftime( timeStr, sizeof(timeStr), "%x %X ", ltm );
|
||||
fprintf(fp, timeStr);
|
||||
for (p = fmt; *p; p++) {
|
||||
if (*p != '%') {
|
||||
fprintf(fp, "%c", *p);
|
||||
continue;
|
||||
}
|
||||
switch(*++p) {
|
||||
case 'd':
|
||||
ival = va_arg( arglist, int);
|
||||
fprintf(fp, "%d", ival);
|
||||
break;
|
||||
case 's':
|
||||
for (sval = va_arg(arglist, char *); *sval; sval++)
|
||||
fprintf(fp, "%c", *sval);
|
||||
break;
|
||||
default:
|
||||
fprintf(fp, "%c", *p);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
|
||||
lockf( fileno(fp), F_ULOCK, 0 );
|
||||
|
||||
fclose(fp);
|
||||
} else {
|
||||
#if 0 /* unused */
|
||||
int save_errno = (int)errno;
|
||||
#endif /* unused */
|
||||
rc = ( -1);
|
||||
}
|
||||
} else {
|
||||
rc = ( -1);
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &PrintMessage_mutex );
|
||||
ch_free(fmt);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
379
servers/slapd/slapi/slapi-plugin.h
Normal file
379
servers/slapd/slapi/slapi-plugin.h
Normal file
|
|
@ -0,0 +1,379 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _SLAPI_PLUGIN_H
|
||||
#define _SLAPI_PLUGIN_H
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
typedef struct slapi_pblock Slapi_PBlock;
|
||||
typedef struct slapi_entry Slapi_Entry;
|
||||
typedef struct slapi_attr Slapi_Attr;
|
||||
typedef struct slapi_filter Slapi_Filter;
|
||||
|
||||
|
||||
/* pblock routines */
|
||||
int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
|
||||
int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
|
||||
Slapi_PBlock *slapi_pblock_new();
|
||||
void slapi_pblock_destroy( Slapi_PBlock* );
|
||||
|
||||
/* entry/attr/dn routines */
|
||||
Slapi_Entry *slapi_str2entry( char *s, int flags );
|
||||
char *slapi_entry2str( Slapi_Entry *e, int *len );
|
||||
char *slapi_entry_get_dn( Slapi_Entry *e );
|
||||
void slapi_entry_set_dn( Slapi_Entry *e, char *dn );
|
||||
Slapi_Entry *slapi_entry_dup( Slapi_Entry *e );
|
||||
int slapi_entry_attr_delete( Slapi_Entry *e, char *type );
|
||||
Slapi_Entry *slapi_entry_alloc();
|
||||
void slapi_entry_free( Slapi_Entry *e );
|
||||
int slapi_entry_attr_merge( Slapi_Entry *e, char *type, struct berval **vals );
|
||||
int slapi_entry_attr_find( Slapi_Entry *e, char *type, Slapi_Attr **attr );
|
||||
int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
|
||||
char *slapi_dn_normalize( char *dn );
|
||||
char *slapi_dn_normalize_case( char *dn );
|
||||
int slapi_dn_issuffix( char *dn, char *suffix );
|
||||
char *slapi_dn_ignore_case( char *dn );
|
||||
|
||||
/* char routines */
|
||||
char *slapi_ch_malloc( unsigned long size );
|
||||
void slapi_ch_free( void *ptr );
|
||||
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
|
||||
char *slapi_ch_realloc( char *block, unsigned long size );
|
||||
char *slapi_ch_strdup( char *s );
|
||||
|
||||
|
||||
/* LDAP V3 routines */
|
||||
int slapi_control_present( LDAPControl **controls, char *oid,
|
||||
struct berval **val, int *iscritical);
|
||||
void slapi_register_supported_control(char *controloid,
|
||||
unsigned long controlops);
|
||||
#define SLAPI_OPERATION_BIND 0x00000001L
|
||||
#define SLAPI_OPERATION_UNBIND 0x00000002L
|
||||
#define SLAPI_OPERATION_SEARCH 0x00000004L
|
||||
#define SLAPI_OPERATION_MODIFY 0x00000008L
|
||||
#define SLAPI_OPERATION_ADD 0x00000010L
|
||||
#define SLAPI_OPERATION_DELETE 0x00000020L
|
||||
#define SLAPI_OPERATION_MODDN 0x00000040L
|
||||
#define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
|
||||
#define SLAPI_OPERATION_COMPARE 0x00000080L
|
||||
#define SLAPI_OPERATION_ABANDON 0x00000100L
|
||||
#define SLAPI_OPERATION_EXTENDED 0x00000200L
|
||||
#define SLAPI_OPERATION_ANY 0xFFFFFFFFL
|
||||
#define SLAPI_OPERATION_NONE 0x00000000L
|
||||
int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp);
|
||||
void slapi_register_supported_saslmechanism(char *mechanism);
|
||||
char **slapi_get_supported_saslmechanisms();
|
||||
char **slapi_get_supported_extended_ops(void);
|
||||
|
||||
|
||||
/* send ldap result back */
|
||||
void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
|
||||
char *text, int nentries, struct berval **urls );
|
||||
int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e,
|
||||
LDAPControl **ectrls, char **attrs, int attrsonly );
|
||||
|
||||
/* filter routines */
|
||||
Slapi_Filter *slapi_str2filter( char *str );
|
||||
void slapi_filter_free( Slapi_Filter *f, int recurse );
|
||||
int slapi_filter_get_choice( Slapi_Filter *f);
|
||||
int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
|
||||
Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
|
||||
Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
|
||||
|
||||
/* internal add/delete/search/modify routines */
|
||||
Slapi_PBlock *slapi_search_internal( char *base, int scope, char *filter,
|
||||
LDAPControl **controls, char **attrs, int attrsonly );
|
||||
Slapi_PBlock *slapi_modify_internal( char *dn, LDAPMod **mods,
|
||||
LDAPControl **controls, int log_change);
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e,
|
||||
LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_add_internal( char * dn, LDAPMod **attrs,
|
||||
LDAPControl **controls, int log_changes );
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e,
|
||||
LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_delete_internal( char * dn, LDAPControl **controls,
|
||||
int log_change );
|
||||
Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn,
|
||||
char *newParent, int deloldrdn, LDAPControl **controls,
|
||||
int log_change);
|
||||
void slapi_free_search_results_internal(Slapi_PBlock *pb);
|
||||
|
||||
/* connection related routines */
|
||||
int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL);
|
||||
int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort);
|
||||
|
||||
/* parameters currently supported */
|
||||
|
||||
|
||||
/* plugin types supported */
|
||||
|
||||
#define SLAPI_PLUGIN_DATABASE 1
|
||||
#define SLAPI_PLUGIN_EXTENDEDOP 2
|
||||
#define SLAPI_PLUGIN_PREOPERATION 3
|
||||
#define SLAPI_PLUGIN_POSTOPERATION 4
|
||||
#define SLAPI_PLUGIN_AUDIT 7
|
||||
|
||||
/* misc params */
|
||||
|
||||
#define SLAPI_BACKEND 130
|
||||
#define SLAPI_CONNECTION 131
|
||||
#define SLAPI_OPERATION 132
|
||||
#define SLAPI_REQUESTOR_ISROOT 133
|
||||
#define SLAPI_BE_MONITORDN 134
|
||||
#define SLAPI_BE_TYPE 135
|
||||
#define SLAPI_BE_READONLY 136
|
||||
#define SLAPI_BE_LASTMOD 137
|
||||
#define SLAPI_CONN_ID 139
|
||||
|
||||
/* operation params */
|
||||
#define SLAPI_OPINITIATED_TIME 140
|
||||
#define SLAPI_REQUESTOR_DN 141
|
||||
#define SLAPI_REQUESTOR_ISUPDATEDN 142
|
||||
|
||||
/* connection structure params*/
|
||||
#define SLAPI_CONN_DN 143
|
||||
#define SLAPI_CONN_AUTHTYPE 144
|
||||
|
||||
/* Authentication types */
|
||||
#define SLAPD_AUTH_NONE "none"
|
||||
#define SLAPD_AUTH_SIMPLE "simple"
|
||||
#define SLAPD_AUTH_SSL "SSL"
|
||||
#define SLAPD_AUTH_SASL "SASL "
|
||||
|
||||
/* plugin configuration parmams */
|
||||
#define SLAPI_PLUGIN 3
|
||||
#define SLAPI_PLUGIN_PRIVATE 4
|
||||
#define SLAPI_PLUGIN_TYPE 5
|
||||
#define SLAPI_PLUGIN_ARGV 6
|
||||
#define SLAPI_PLUGIN_ARGC 7
|
||||
#define SLAPI_PLUGIN_VERSION 8
|
||||
#define SLAPI_PLUGIN_OPRETURN 9
|
||||
#define SLAPI_PLUGIN_OBJECT 10
|
||||
#define SLAPI_PLUGIN_DESTROY_FN 11
|
||||
#define SLAPI_PLUGIN_DESCRIPTION 12
|
||||
|
||||
/* internal opreations params */
|
||||
#define SLAPI_PLUGIN_INTOP_RESULT 15
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
|
||||
|
||||
/* function pointer params for backends */
|
||||
#define SLAPI_PLUGIN_DB_BIND_FN 200
|
||||
#define SLAPI_PLUGIN_DB_UNBIND_FN 201
|
||||
#define SLAPI_PLUGIN_DB_SEARCH_FN 202
|
||||
#define SLAPI_PLUGIN_DB_COMPARE_FN 203
|
||||
#define SLAPI_PLUGIN_DB_MODIFY_FN 204
|
||||
#define SLAPI_PLUGIN_DB_MODRDN_FN 205
|
||||
#define SLAPI_PLUGIN_DB_ADD_FN 206
|
||||
#define SLAPI_PLUGIN_DB_DELETE_FN 207
|
||||
#define SLAPI_PLUGIN_DB_ABANDON_FN 208
|
||||
#define SLAPI_PLUGIN_DB_CONFIG_FN 209
|
||||
#define SLAPI_PLUGIN_CLOSE_FN 210
|
||||
#define SLAPI_PLUGIN_DB_FLUSH_FN 211
|
||||
#define SLAPI_PLUGIN_START_FN 212
|
||||
#define SLAPI_PLUGIN_DB_SEQ_FN 213
|
||||
#define SLAPI_PLUGIN_DB_ENTRY_FN 214
|
||||
#define SLAPI_PLUGIN_DB_REFERRAL_FN 215
|
||||
#define SLAPI_PLUGIN_DB_RESULT_FN 216
|
||||
#define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
|
||||
#define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
|
||||
#define SLAPI_PLUGIN_DB_BEGIN_FN 219
|
||||
#define SLAPI_PLUGIN_DB_COMMIT_FN 220
|
||||
#define SLAPI_PLUGIN_DB_ABORT_FN 221
|
||||
#define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
|
||||
#define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
|
||||
#define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
|
||||
#define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
|
||||
#define SLAPI_PLUGIN_DB_SIZE_FN 226
|
||||
#define SLAPI_PLUGIN_DB_TEST_FN 227
|
||||
|
||||
|
||||
/* functions pointers for LDAP V3 extended ops */
|
||||
#define SLAPI_PLUGIN_EXT_OP_FN 300
|
||||
#define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
|
||||
|
||||
/* functions for preoperation functions */
|
||||
#define SLAPI_PLUGIN_PRE_BIND_FN 401
|
||||
#define SLAPI_PLUGIN_PRE_UNBIND_FN 402
|
||||
#define SLAPI_PLUGIN_PRE_SEARCH_FN 403
|
||||
#define SLAPI_PLUGIN_PRE_COMPARE_FN 404
|
||||
#define SLAPI_PLUGIN_PRE_MODIFY_FN 405
|
||||
#define SLAPI_PLUGIN_PRE_MODRDN_FN 406
|
||||
#define SLAPI_PLUGIN_PRE_ADD_FN 407
|
||||
#define SLAPI_PLUGIN_PRE_DELETE_FN 408
|
||||
#define SLAPI_PLUGIN_PRE_ABANDON_FN 409
|
||||
#define SLAPI_PLUGIN_PRE_ENTRY_FN 410
|
||||
#define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
|
||||
#define SLAPI_PLUGIN_PRE_RESULT_FN 412
|
||||
|
||||
/* functions for postoperation functions*/
|
||||
#define SLAPI_PLUGIN_POST_BIND_FN 501
|
||||
#define SLAPI_PLUGIN_POST_UNBIND_FN 502
|
||||
#define SLAPI_PLUGIN_POST_SEARCH_FN 503
|
||||
#define SLAPI_PLUGIN_POST_COMPARE_FN 504
|
||||
#define SLAPI_PLUGIN_POST_MODIFY_FN 505
|
||||
#define SLAPI_PLUGIN_POST_MODRDN_FN 506
|
||||
#define SLAPI_PLUGIN_POST_ADD_FN 507
|
||||
#define SLAPI_PLUGIN_POST_DELETE_FN 508
|
||||
#define SLAPI_PLUGIN_POST_ABANDON_FN 509
|
||||
#define SLAPI_PLUGIN_POST_ENTRY_FN 510
|
||||
#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
|
||||
#define SLAPI_PLUGIN_POST_RESULT_FN 512
|
||||
|
||||
/* audit plugin defines */
|
||||
#define SLAPI_PLUGIN_AUDIT_DATA 1100
|
||||
#define SLAPI_PLUGIN_AUDIT_FN 1101
|
||||
|
||||
/* managedsait control */
|
||||
#define SLAPI_MANAGEDSAIT 1000
|
||||
|
||||
/* config stuff */
|
||||
#define SLAPI_CONFIG_FILENAME 40
|
||||
#define SLAPI_CONFIG_LINENO 41
|
||||
#define SLAPI_CONFIG_ARGC 42
|
||||
#define SLAPI_CONFIG_ARGV 43
|
||||
|
||||
/* operational params */
|
||||
#define SLAPI_TARGET_DN 50
|
||||
#define SLAPI_REQCONTROLS 51
|
||||
|
||||
/* server LDAPv3 controls */
|
||||
#define SLAPI_RESCONTROLS 55
|
||||
#define SLAPI_ADD_RESCONTROL 56
|
||||
|
||||
/* add params */
|
||||
#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_ADD_ENTRY 60
|
||||
|
||||
/* bind params */
|
||||
#define SLAPI_BIND_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_BIND_METHOD 70
|
||||
#define SLAPI_BIND_CREDENTIALS 71
|
||||
#define SLAPI_BIND_SASLMECHANISM 72
|
||||
#define SLAPI_BIND_RET_SASLCREDS 73
|
||||
|
||||
/* compare params */
|
||||
#define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_COMPARE_TYPE 80
|
||||
#define SLAPI_COMPARE_VALUE 81
|
||||
|
||||
/* delete params */
|
||||
#define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
|
||||
|
||||
/* modify params */
|
||||
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODIFY_MODS 90
|
||||
|
||||
/* modrdn params */
|
||||
#define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODRDN_NEWRDN 100
|
||||
#define SLAPI_MODRDN_DELOLDRDN 101
|
||||
#define SLAPI_MODRDN_NEWSUPERIOR 102 /* v3 only */
|
||||
|
||||
/* search params */
|
||||
#define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_SEARCH_SCOPE 110
|
||||
#define SLAPI_SEARCH_DEREF 111
|
||||
#define SLAPI_SEARCH_SIZELIMIT 112
|
||||
#define SLAPI_SEARCH_TIMELIMIT 113
|
||||
#define SLAPI_SEARCH_FILTER 114
|
||||
#define SLAPI_SEARCH_STRFILTER 115
|
||||
#define SLAPI_SEARCH_ATTRS 116
|
||||
#define SLAPI_SEARCH_ATTRSONLY 117
|
||||
|
||||
/* abandon params */
|
||||
#define SLAPI_ABANDON_MSGID 120
|
||||
|
||||
/* extended operation params */
|
||||
#define SLAPI_EXT_OP_REQ_OID 160
|
||||
#define SLAPI_EXT_OP_REQ_VALUE 161
|
||||
|
||||
/* extended operation return codes */
|
||||
#define SLAPI_EXT_OP_RET_OID 162
|
||||
#define SLAPI_EXT_OP_RET_VALUE 163
|
||||
|
||||
#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
|
||||
|
||||
/* Search result params */
|
||||
#define SLAPI_SEARCH_RESULT_SET 193
|
||||
#define SLAPI_SEARCH_RESULT_ENTRY 194
|
||||
#define SLAPI_NENTRIES 195
|
||||
#define SLAPI_SEARCH_REFERRALS 196
|
||||
|
||||
|
||||
/* filter types */
|
||||
#ifndef LDAP_FILTER_AND
|
||||
#define LDAP_FILTER_AND 0xa0L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_OR
|
||||
#define LDAP_FILTER_OR 0xa1L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_NOT
|
||||
#define LDAP_FILTER_NOT 0xa2L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_EQUALITY
|
||||
#define LDAP_FILTER_EQUALITY 0xa3L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_SUBSTRINGS
|
||||
#define LDAP_FILTER_SUBSTRINGS 0xa4L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_GE
|
||||
#define LDAP_FILTER_GE 0xa5L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_LE
|
||||
#define LDAP_FILTER_LE 0xa6L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_PRESENT
|
||||
#define LDAP_FILTER_PRESENT 0x87L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_APPROX
|
||||
#define LDAP_FILTER_APPROX 0xa8L
|
||||
#endif
|
||||
#ifndef LDAP_FILTER_EXT_MATCH
|
||||
#define LDAP_FILTER_EXT_MATCH 0xa9L
|
||||
#endif
|
||||
|
||||
int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
|
||||
#define SLAPI_LOG_FATAL 0
|
||||
#define SLAPI_LOG_TRACE 1
|
||||
#define SLAPI_LOG_PACKETS 2
|
||||
#define SLAPI_LOG_ARGS 3
|
||||
#define SLAPI_LOG_CONNS 4
|
||||
#define SLAPI_LOG_BER 5
|
||||
#define SLAPI_LOG_FILTER 6
|
||||
#define SLAPI_LOG_CONFIG 7
|
||||
#define SLAPI_LOG_ACL 8
|
||||
#define SLAPI_LOG_SHELL 9
|
||||
#define SLAPI_LOG_PARSE 10
|
||||
#define SLAPI_LOG_HOUSE 11
|
||||
#define SLAPI_LOG_REPL 12
|
||||
#define SLAPI_LOG_CACHE 13
|
||||
#define SLAPI_LOG_PLUGIN 14
|
||||
#define SLAPI_LOG_TIMING 15
|
||||
|
||||
#define SLAPI_PLUGIN_DESCRIPTION 12
|
||||
typedef struct slapi_plugindesc {
|
||||
char *spd_id;
|
||||
char *spd_vendor;
|
||||
char *spd_version;
|
||||
char *spd_description;
|
||||
} Slapi_PluginDesc;
|
||||
|
||||
#define SLAPI_PLUGIN_VERSION_01 "01"
|
||||
#define SLAPI_PLUGIN_VERSION_02 "02"
|
||||
#define SLAPI_PLUGIN_VERSION_03 "03"
|
||||
#define SLAPI_PLUGIN_CURRENT_VERSION SLAPI_PLUGIN_VERSION_03
|
||||
|
||||
#endif /* _SLAPI_PLUGIN_H */
|
||||
|
||||
296
servers/slapd/slapi/slapi.h
Normal file
296
servers/slapd/slapi/slapi.h
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _SLAPI_H
|
||||
#define _SLAPI_H
|
||||
|
||||
#include <ibm_pblock_params.h>
|
||||
|
||||
typedef struct slapi_pblock Slapi_PBlock;
|
||||
typedef struct slap_entry Slapi_Entry;
|
||||
typedef struct slap_attr Slapi_Attr;
|
||||
typedef Filter Slapi_Filter;
|
||||
|
||||
#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>
|
||||
|
||||
/*
|
||||
* types of plugins
|
||||
*/
|
||||
#define SLAPI_PLUGIN_DATABASE 1
|
||||
#define SLAPI_PLUGIN_EXTENDEDOP 2
|
||||
#define SLAPI_PLUGIN_PREOPERATION 3
|
||||
#define SLAPI_PLUGIN_POSTOPERATION 4
|
||||
#define SLAPI_PLUGIN_MATCHINGRULE 5
|
||||
#define SLAPI_PLUGIN_SYNTAX 6
|
||||
#define SLAPI_PLUGIN_AUDIT 7
|
||||
|
||||
#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
|
||||
#define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
|
||||
|
||||
#define SLAPI_BACKEND 130
|
||||
#define SLAPI_CONNECTION 131
|
||||
#define SLAPI_OPERATION 132
|
||||
#define SLAPI_REQUESTOR_ISROOT 133
|
||||
#define SLAPI_BE_MONITORDN 134
|
||||
#define SLAPI_BE_TYPE 135
|
||||
#define SLAPI_BE_READONLY 136
|
||||
#define SLAPI_BE_LASTMOD 137
|
||||
#define SLAPI_CONN_ID 139
|
||||
|
||||
#define SLAPI_OPINITIATED_TIME 140
|
||||
#define SLAPI_REQUESTOR_DN 141
|
||||
#define SLAPI_REQUESTOR_ISUPDATEDN 142
|
||||
#define SLAPI_CONN_DN 143
|
||||
#define SLAPI_CONN_AUTHTYPE 144
|
||||
|
||||
#define SLAPD_AUTH_NONE "none"
|
||||
#define SLAPD_AUTH_SIMPLE "simple"
|
||||
#define SLAPD_AUTH_SSL "SSL"
|
||||
#define SLAPD_AUTH_SASL "SASL "
|
||||
|
||||
#define SLAPI_PLUGIN 3
|
||||
#define SLAPI_PLUGIN_PRIVATE 4
|
||||
#define SLAPI_PLUGIN_TYPE 5
|
||||
#define SLAPI_PLUGIN_ARGV 6
|
||||
#define SLAPI_PLUGIN_ARGC 7
|
||||
#define SLAPI_PLUGIN_VERSION 8
|
||||
|
||||
#define SLAPI_PLUGIN_OPRETURN 9
|
||||
#define SLAPI_PLUGIN_OBJECT 10
|
||||
#define SLAPI_PLUGIN_DESTROY_FN 11
|
||||
|
||||
#define SLAPI_PLUGIN_DESCRIPTION 12
|
||||
|
||||
#define SLAPI_PLUGIN_INTOP_RESULT 15
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
|
||||
#define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
|
||||
|
||||
#define SLAPI_PLUGIN_DB_BIND_FN 200
|
||||
#define SLAPI_PLUGIN_DB_UNBIND_FN 201
|
||||
#define SLAPI_PLUGIN_DB_SEARCH_FN 202
|
||||
#define SLAPI_PLUGIN_DB_COMPARE_FN 203
|
||||
#define SLAPI_PLUGIN_DB_MODIFY_FN 204
|
||||
#define SLAPI_PLUGIN_DB_MODRDN_FN 205
|
||||
#define SLAPI_PLUGIN_DB_ADD_FN 206
|
||||
#define SLAPI_PLUGIN_DB_DELETE_FN 207
|
||||
#define SLAPI_PLUGIN_DB_ABANDON_FN 208
|
||||
#define SLAPI_PLUGIN_DB_CONFIG_FN 209
|
||||
#define SLAPI_PLUGIN_CLOSE_FN 210
|
||||
#define SLAPI_PLUGIN_DB_FLUSH_FN 211
|
||||
#define SLAPI_PLUGIN_START_FN 212
|
||||
#define SLAPI_PLUGIN_DB_SEQ_FN 213
|
||||
#define SLAPI_PLUGIN_DB_ENTRY_FN 214
|
||||
#define SLAPI_PLUGIN_DB_REFERRAL_FN 215
|
||||
#define SLAPI_PLUGIN_DB_RESULT_FN 216
|
||||
#define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
|
||||
#define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
|
||||
#define SLAPI_PLUGIN_DB_BEGIN_FN 219
|
||||
#define SLAPI_PLUGIN_DB_COMMIT_FN 220
|
||||
#define SLAPI_PLUGIN_DB_ABORT_FN 221
|
||||
#define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
|
||||
#define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
|
||||
#define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
|
||||
#define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
|
||||
#define SLAPI_PLUGIN_DB_SIZE_FN 226
|
||||
#define SLAPI_PLUGIN_DB_TEST_FN 227
|
||||
#define SLAPI_PLUGIN_DB_NO_ACL 250
|
||||
|
||||
#define SLAPI_PLUGIN_EXT_OP_FN 300
|
||||
#define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
|
||||
#define SLAPI_PLUGIN_PRE_BIND_FN 401
|
||||
#define SLAPI_PLUGIN_PRE_UNBIND_FN 402
|
||||
#define SLAPI_PLUGIN_PRE_SEARCH_FN 403
|
||||
#define SLAPI_PLUGIN_PRE_COMPARE_FN 404
|
||||
#define SLAPI_PLUGIN_PRE_MODIFY_FN 405
|
||||
#define SLAPI_PLUGIN_PRE_MODRDN_FN 406
|
||||
#define SLAPI_PLUGIN_PRE_ADD_FN 407
|
||||
#define SLAPI_PLUGIN_PRE_DELETE_FN 408
|
||||
#define SLAPI_PLUGIN_PRE_ABANDON_FN 409
|
||||
#define SLAPI_PLUGIN_PRE_ENTRY_FN 410
|
||||
#define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
|
||||
#define SLAPI_PLUGIN_PRE_RESULT_FN 412
|
||||
#define SLAPI_PLUGIN_POST_BIND_FN 501
|
||||
#define SLAPI_PLUGIN_POST_UNBIND_FN 502
|
||||
#define SLAPI_PLUGIN_POST_SEARCH_FN 503
|
||||
#define SLAPI_PLUGIN_POST_COMPARE_FN 504
|
||||
#define SLAPI_PLUGIN_POST_MODIFY_FN 505
|
||||
#define SLAPI_PLUGIN_POST_MODRDN_FN 506
|
||||
#define SLAPI_PLUGIN_POST_ADD_FN 507
|
||||
#define SLAPI_PLUGIN_POST_DELETE_FN 508
|
||||
#define SLAPI_PLUGIN_POST_ABANDON_FN 509
|
||||
#define SLAPI_PLUGIN_POST_ENTRY_FN 510
|
||||
#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
|
||||
#define SLAPI_PLUGIN_POST_RESULT_FN 512
|
||||
|
||||
#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_FILTER_INDEX_FN 603
|
||||
#define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
|
||||
#define SLAPI_PLUGIN_MR_INDEX_FN 605
|
||||
#define SLAPI_PLUGIN_MR_OID 610
|
||||
#define SLAPI_PLUGIN_MR_TYPE 611
|
||||
#define SLAPI_PLUGIN_MR_VALUE 612
|
||||
#define SLAPI_PLUGIN_MR_VALUES 613
|
||||
#define SLAPI_PLUGIN_MR_KEYS 614
|
||||
#define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
|
||||
#define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
|
||||
#define SLAPI_PLUGIN_MR_USAGE 617
|
||||
|
||||
#define SLAPI_OP_LESS 1
|
||||
#define SLAPI_OP_LESS_OR_EQUAL 2
|
||||
#define SLAPI_OP_EQUAL 3
|
||||
#define SLAPI_OP_GREATER_OR_EQUAL 4
|
||||
#define SLAPI_OP_GREATER 5
|
||||
#define SLAPI_OP_SUBSTRING 6
|
||||
|
||||
#define SLAPI_PLUGIN_MR_USAGE_INDEX 0
|
||||
#define SLAPI_PLUGIN_MR_USAGE_SORT 1
|
||||
|
||||
#define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
|
||||
#define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
|
||||
#define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
|
||||
#define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
|
||||
#define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
|
||||
#define SLAPI_PLUGIN_SYNTAX_NAMES 705
|
||||
#define SLAPI_PLUGIN_SYNTAX_OID 706
|
||||
#define SLAPI_PLUGIN_SYNTAX_FLAGS 707
|
||||
#define SLAPI_PLUGIN_SYNTAX_COMPARE 708
|
||||
|
||||
#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
|
||||
|
||||
#define SLAPI_MANAGEDSAIT 1000
|
||||
|
||||
#define SLAPI_CONFIG_FILENAME 40
|
||||
#define SLAPI_CONFIG_LINENO 41
|
||||
#define SLAPI_CONFIG_ARGC 42
|
||||
#define SLAPI_CONFIG_ARGV 43
|
||||
|
||||
#define SLAPI_TARGET_DN 50
|
||||
#define SLAPI_REQCONTROLS 51
|
||||
|
||||
#define SLAPI_ENTRY_PRE_OP 52
|
||||
#define SLAPI_ENTRY_POST_OP 53
|
||||
|
||||
#define SLAPI_RESCONTROLS 55
|
||||
#define SLAPI_ADD_RESCONTROL 56
|
||||
|
||||
#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_ADD_ENTRY 60
|
||||
|
||||
#define SLAPI_BIND_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_BIND_METHOD 70
|
||||
#define SLAPI_BIND_CREDENTIALS 71
|
||||
#define SLAPI_BIND_SASLMECHANISM 72
|
||||
#define SLAPI_BIND_RET_SASLCREDS 73
|
||||
|
||||
#define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_COMPARE_TYPE 80
|
||||
#define SLAPI_COMPARE_VALUE 81
|
||||
|
||||
#define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
|
||||
|
||||
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODIFY_MODS 90
|
||||
|
||||
#define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_MODRDN_NEWRDN 100
|
||||
#define SLAPI_MODRDN_DELOLDRDN 101
|
||||
#define SLAPI_MODRDN_NEWSUPERIOR 102
|
||||
|
||||
#define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
|
||||
#define SLAPI_SEARCH_SCOPE 110
|
||||
#define SLAPI_SEARCH_DEREF 111
|
||||
#define SLAPI_SEARCH_SIZELIMIT 112
|
||||
#define SLAPI_SEARCH_TIMELIMIT 113
|
||||
#define SLAPI_SEARCH_FILTER 114
|
||||
#define SLAPI_SEARCH_STRFILTER 115
|
||||
#define SLAPI_SEARCH_ATTRS 116
|
||||
#define SLAPI_SEARCH_ATTRSONLY 117
|
||||
|
||||
#define SLAPI_ABANDON_MSGID 120
|
||||
|
||||
#define SLAPI_SEQ_TYPE 150
|
||||
#define SLAPI_SEQ_ATTRNAME 151
|
||||
#define SLAPI_SEQ_VAL 152
|
||||
|
||||
#define SLAPI_EXT_OP_REQ_OID 160
|
||||
#define SLAPI_EXT_OP_REQ_VALUE 161
|
||||
#define SLAPI_EXT_OP_RET_OID 162
|
||||
#define SLAPI_EXT_OP_RET_VALUE 163
|
||||
|
||||
#define SLAPI_MR_FILTER_ENTRY 170
|
||||
#define SLAPI_MR_FILTER_TYPE 171
|
||||
#define SLAPI_MR_FILTER_VALUE 172
|
||||
#define SLAPI_MR_FILTER_OID 173
|
||||
#define SLAPI_MR_FILTER_DNATTRS 174
|
||||
|
||||
#define SLAPI_LDIF2DB_FILE 180
|
||||
#define SLAPI_LDIF2DB_REMOVEDUPVALS 185
|
||||
|
||||
#define SLAPI_DB2LDIF_PRINTKEY 183
|
||||
|
||||
#define SLAPI_PARENT_TXN 190
|
||||
#define SLAPI_TXN 191
|
||||
|
||||
#define SLAPI_SEARCH_RESULT_SET 193
|
||||
#define SLAPI_SEARCH_RESULT_ENTRY 194
|
||||
#define SLAPI_NENTRIES 195
|
||||
#define SLAPI_SEARCH_REFERRALS 196
|
||||
|
||||
#define SLAPI_CHANGENUMBER 197
|
||||
#define SLAPI_LOG_OPERATION 198
|
||||
|
||||
#define SLAPI_DBSIZE 199
|
||||
|
||||
#define SLAPI_LOG_FATAL 0
|
||||
#define SLAPI_LOG_TRACE 1
|
||||
#define SLAPI_LOG_PACKETS 2
|
||||
#define SLAPI_LOG_ARGS 3
|
||||
#define SLAPI_LOG_CONNS 4
|
||||
#define SLAPI_LOG_BER 5
|
||||
#define SLAPI_LOG_FILTER 6
|
||||
#define SLAPI_LOG_CONFIG 7
|
||||
#define SLAPI_LOG_ACL 8
|
||||
#define SLAPI_LOG_SHELL 9
|
||||
#define SLAPI_LOG_PARSE 10
|
||||
#define SLAPI_LOG_HOUSE 11
|
||||
#define SLAPI_LOG_REPL 12
|
||||
#define SLAPI_LOG_CACHE 13
|
||||
#define SLAPI_LOG_PLUGIN 14
|
||||
|
||||
#define SLAPI_OPERATION_BIND 0x00000001L
|
||||
#define SLAPI_OPERATION_UNBIND 0x00000002L
|
||||
#define SLAPI_OPERATION_SEARCH 0x00000004L
|
||||
#define SLAPI_OPERATION_MODIFY 0x00000008L
|
||||
#define SLAPI_OPERATION_ADD 0x00000010L
|
||||
#define SLAPI_OPERATION_DELETE 0x00000020L
|
||||
#define SLAPI_OPERATION_MODDN 0x00000040L
|
||||
#define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
|
||||
#define SLAPI_OPERATION_COMPARE 0x00000080L
|
||||
#define SLAPI_OPERATION_ABANDON 0x00000100L
|
||||
#define SLAPI_OPERATION_EXTENDED 0x00000200L
|
||||
#define SLAPI_OPERATION_ANY 0xFFFFFFFFL
|
||||
#define SLAPI_OPERATION_NONE 0x00000000L
|
||||
|
||||
#endif /* _SLAPI_H */
|
||||
|
||||
55
servers/slapd/slapi/slapi_cl.h
Normal file
55
servers/slapd/slapi/slapi_cl.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _SLAPI_CL_H
|
||||
#define _SLAPI_CL_H
|
||||
|
||||
#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"
|
||||
|
||||
void slapi_register_changelog_suffix(char *suffix);
|
||||
char **slapi_get_changelog_suffixes();
|
||||
void slapi_update_changelog_counters(long curNum, long numEntries);
|
||||
char *slapi_get_cl_firstNum();
|
||||
char *slapi_get_cl_lastNum();
|
||||
int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op);
|
||||
int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op);
|
||||
int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op);
|
||||
int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
|
||||
Backend * slapi_cl_get_be(char *dn);
|
||||
|
||||
#endif /* _SLAPI_CL_H */
|
||||
|
||||
40
servers/slapd/slapi/slapi_common.h
Normal file
40
servers/slapd/slapi/slapi_common.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef SLAPI_COMMON_H
|
||||
#define SLAPI_COMMON_H
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define dn_normalize_case dn_normalize
|
||||
#define SLAPD_NO_MEMORY 7
|
||||
#define ANYBODY_STRING "CN=ANYBODY"
|
||||
|
||||
extern int slap_debug;
|
||||
|
||||
int
|
||||
dn_check(char *, int *);
|
||||
|
||||
|
||||
typedef struct strlist {
|
||||
char *string;
|
||||
struct strlist *next;
|
||||
} StrList;
|
||||
|
||||
#endif /* SLAPI_COMMON_H */
|
||||
|
||||
1269
servers/slapd/slapi/slapi_ops.c
Normal file
1269
servers/slapd/slapi/slapi_ops.c
Normal file
File diff suppressed because it is too large
Load diff
1303
servers/slapd/slapi/slapi_ops.c.all
Normal file
1303
servers/slapd/slapi/slapi_ops.c.all
Normal file
File diff suppressed because it is too large
Load diff
1271
servers/slapd/slapi/slapi_ops.c.save
Normal file
1271
servers/slapd/slapi/slapi_ops.c.save
Normal file
File diff suppressed because it is too large
Load diff
34
servers/slapd/slapi/slapi_ops.h
Normal file
34
servers/slapd/slapi/slapi_ops.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef SLAPI_OPS_H
|
||||
#define SLAPI_OPS_H
|
||||
|
||||
Slapi_PBlock *slapi_search_internal( char *base, int scope, char *filter,
|
||||
LDAPControl **controls, char **attrs, int attrsonly );
|
||||
Slapi_PBlock *slapi_search_internal_bind( char *bindDN, char *base, int scope, char *filter,
|
||||
LDAPControl **controls, char **attrs, int attrsonly ); /* d58508 */
|
||||
Slapi_PBlock *slapi_modify_internal( char *dn, LDAPMod **mods,
|
||||
LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_add_internal( char * dn, LDAPMod **attrs, LDAPControl **controls, int log_changes );
|
||||
Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_delete_internal( char * dn, LDAPControl **controls, int log_change );
|
||||
Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn, int deloldrdn, LDAPControl **controls, int log_change);
|
||||
/*
|
||||
Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn, char *newParent, int deloldrdn, LDAPControl **controls, int log_change);
|
||||
*/
|
||||
char **slapi_get_supported_extended_ops(void);
|
||||
int duplicateBVMod( LDAPMod *pMod, LDAPMod **ppNewMod );
|
||||
|
||||
#endif /* SLAPI_OPS_H */
|
||||
|
||||
436
servers/slapd/slapi/slapi_pblock.c
Normal file
436
servers/slapd/slapi/slapi_pblock.c
Normal file
|
|
@ -0,0 +1,436 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
#include "slapi_common.h"
|
||||
#include <slap.h>
|
||||
#include <slapi.h>
|
||||
|
||||
static int
|
||||
isOkNetscapeParam( int param )
|
||||
{
|
||||
switch ( param ) {
|
||||
case SLAPI_BACKEND:
|
||||
case SLAPI_CONNECTION:
|
||||
case SLAPI_OPERATION:
|
||||
case SLAPI_REQUESTOR_ISROOT:
|
||||
case SLAPI_BE_MONITORDN:
|
||||
case SLAPI_BE_TYPE:
|
||||
case SLAPI_BE_READONLY:
|
||||
case SLAPI_BE_LASTMOD:
|
||||
case SLAPI_CONN_ID:
|
||||
case SLAPI_OPINITIATED_TIME:
|
||||
case SLAPI_REQUESTOR_DN:
|
||||
case SLAPI_REQUESTOR_ISUPDATEDN:
|
||||
case SLAPI_CONN_DN:
|
||||
case SLAPI_CONN_AUTHTYPE:
|
||||
case SLAPI_IBM_CONN_DN_ALT:
|
||||
case SLAPI_IBM_CONN_DN_ORIG:
|
||||
case SLAPI_IBM_GSSAPI_CONTEXT:
|
||||
case SLAPI_PLUGIN:
|
||||
case SLAPI_PLUGIN_PRIVATE:
|
||||
case SLAPI_PLUGIN_TYPE:
|
||||
case SLAPI_PLUGIN_ARGV:
|
||||
case SLAPI_PLUGIN_ARGC:
|
||||
case SLAPI_PLUGIN_VERSION:
|
||||
case SLAPI_PLUGIN_OPRETURN:
|
||||
case SLAPI_PLUGIN_OBJECT:
|
||||
case SLAPI_PLUGIN_DESTROY_FN:
|
||||
case SLAPI_PLUGIN_DESCRIPTION:
|
||||
case SLAPI_PLUGIN_INTOP_RESULT:
|
||||
case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
|
||||
case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
|
||||
case SLAPI_PLUGIN_DB_BIND_FN:
|
||||
case SLAPI_PLUGIN_DB_UNBIND_FN:
|
||||
case SLAPI_PLUGIN_DB_SEARCH_FN:
|
||||
case SLAPI_PLUGIN_DB_COMPARE_FN:
|
||||
case SLAPI_PLUGIN_DB_MODIFY_FN:
|
||||
case SLAPI_PLUGIN_DB_MODRDN_FN:
|
||||
case SLAPI_PLUGIN_DB_ADD_FN:
|
||||
case SLAPI_PLUGIN_DB_DELETE_FN:
|
||||
case SLAPI_PLUGIN_DB_ABANDON_FN:
|
||||
case SLAPI_PLUGIN_DB_CONFIG_FN:
|
||||
case SLAPI_PLUGIN_CLOSE_FN:
|
||||
case SLAPI_PLUGIN_DB_FLUSH_FN:
|
||||
case SLAPI_PLUGIN_START_FN:
|
||||
case SLAPI_PLUGIN_DB_SEQ_FN:
|
||||
case SLAPI_PLUGIN_DB_ENTRY_FN:
|
||||
case SLAPI_PLUGIN_DB_REFERRAL_FN:
|
||||
case SLAPI_PLUGIN_DB_RESULT_FN:
|
||||
case SLAPI_PLUGIN_DB_LDIF2DB_FN:
|
||||
case SLAPI_PLUGIN_DB_DB2LDIF_FN:
|
||||
case SLAPI_PLUGIN_DB_BEGIN_FN:
|
||||
case SLAPI_PLUGIN_DB_COMMIT_FN:
|
||||
case SLAPI_PLUGIN_DB_ABORT_FN:
|
||||
case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
|
||||
case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
|
||||
case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
|
||||
case SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN:
|
||||
case SLAPI_PLUGIN_DB_SIZE_FN:
|
||||
case SLAPI_PLUGIN_DB_TEST_FN:
|
||||
case SLAPI_PLUGIN_DB_NO_ACL:
|
||||
case SLAPI_PLUGIN_EXT_OP_FN:
|
||||
case SLAPI_PLUGIN_EXT_OP_OIDLIST:
|
||||
case SLAPI_PLUGIN_PRE_BIND_FN:
|
||||
case SLAPI_PLUGIN_PRE_UNBIND_FN:
|
||||
case SLAPI_PLUGIN_PRE_SEARCH_FN:
|
||||
case SLAPI_PLUGIN_PRE_COMPARE_FN:
|
||||
case SLAPI_PLUGIN_PRE_MODIFY_FN:
|
||||
case SLAPI_PLUGIN_PRE_MODRDN_FN:
|
||||
case SLAPI_PLUGIN_PRE_ADD_FN:
|
||||
case SLAPI_PLUGIN_PRE_DELETE_FN:
|
||||
case SLAPI_PLUGIN_PRE_ABANDON_FN:
|
||||
case SLAPI_PLUGIN_PRE_ENTRY_FN:
|
||||
case SLAPI_PLUGIN_PRE_REFERRAL_FN:
|
||||
case SLAPI_PLUGIN_PRE_RESULT_FN:
|
||||
case SLAPI_PLUGIN_POST_BIND_FN:
|
||||
case SLAPI_PLUGIN_POST_UNBIND_FN:
|
||||
case SLAPI_PLUGIN_POST_SEARCH_FN:
|
||||
case SLAPI_PLUGIN_POST_COMPARE_FN:
|
||||
case SLAPI_PLUGIN_POST_MODIFY_FN:
|
||||
case SLAPI_PLUGIN_POST_MODRDN_FN:
|
||||
case SLAPI_PLUGIN_POST_ADD_FN:
|
||||
case SLAPI_PLUGIN_POST_DELETE_FN:
|
||||
case SLAPI_PLUGIN_POST_ABANDON_FN:
|
||||
case SLAPI_PLUGIN_POST_ENTRY_FN:
|
||||
case SLAPI_PLUGIN_POST_REFERRAL_FN:
|
||||
case SLAPI_PLUGIN_POST_RESULT_FN:
|
||||
case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
|
||||
case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
|
||||
case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
|
||||
case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
|
||||
case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
|
||||
case SLAPI_PLUGIN_MR_INDEX_FN:
|
||||
case SLAPI_PLUGIN_MR_OID:
|
||||
case SLAPI_PLUGIN_MR_TYPE:
|
||||
case SLAPI_PLUGIN_MR_VALUE:
|
||||
case SLAPI_PLUGIN_MR_VALUES:
|
||||
case SLAPI_PLUGIN_MR_KEYS:
|
||||
case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
|
||||
case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
|
||||
case SLAPI_PLUGIN_MR_USAGE:
|
||||
case SLAPI_OP_LESS:
|
||||
case SLAPI_OP_LESS_OR_EQUAL:
|
||||
case SLAPI_PLUGIN_MR_USAGE_INDEX:
|
||||
case SLAPI_PLUGIN_SYNTAX_FILTER_AVA:
|
||||
case SLAPI_PLUGIN_SYNTAX_FILTER_SUB:
|
||||
case SLAPI_PLUGIN_SYNTAX_VALUES2KEYS:
|
||||
case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA:
|
||||
case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB:
|
||||
case SLAPI_PLUGIN_SYNTAX_NAMES:
|
||||
case SLAPI_PLUGIN_SYNTAX_OID:
|
||||
case SLAPI_PLUGIN_SYNTAX_FLAGS:
|
||||
case SLAPI_PLUGIN_SYNTAX_COMPARE:
|
||||
case SLAPI_MANAGEDSAIT:
|
||||
case SLAPI_CONFIG_FILENAME:
|
||||
case SLAPI_CONFIG_LINENO:
|
||||
case SLAPI_CONFIG_ARGC:
|
||||
case SLAPI_CONFIG_ARGV:
|
||||
case SLAPI_TARGET_DN:
|
||||
case SLAPI_REQCONTROLS:
|
||||
case SLAPI_ENTRY_PRE_OP:
|
||||
case SLAPI_ENTRY_POST_OP:
|
||||
case SLAPI_RESCONTROLS:
|
||||
case SLAPI_ADD_RESCONTROL:
|
||||
case SLAPI_ADD_ENTRY:
|
||||
case SLAPI_BIND_METHOD:
|
||||
case SLAPI_BIND_CREDENTIALS:
|
||||
case SLAPI_BIND_SASLMECHANISM:
|
||||
case SLAPI_BIND_RET_SASLCREDS:
|
||||
case SLAPI_COMPARE_TYPE:
|
||||
case SLAPI_COMPARE_VALUE:
|
||||
case SLAPI_MODIFY_MODS:
|
||||
case SLAPI_MODRDN_NEWRDN:
|
||||
case SLAPI_MODRDN_DELOLDRDN:
|
||||
case SLAPI_MODRDN_NEWSUPERIOR:
|
||||
case SLAPI_SEARCH_SCOPE:
|
||||
case SLAPI_SEARCH_DEREF:
|
||||
case SLAPI_SEARCH_SIZELIMIT:
|
||||
case SLAPI_SEARCH_TIMELIMIT:
|
||||
case SLAPI_SEARCH_FILTER:
|
||||
case SLAPI_SEARCH_STRFILTER:
|
||||
case SLAPI_SEARCH_ATTRS:
|
||||
case SLAPI_SEARCH_ATTRSONLY:
|
||||
case SLAPI_ABANDON_MSGID:
|
||||
case SLAPI_SEQ_TYPE:
|
||||
case SLAPI_SEQ_ATTRNAME:
|
||||
case SLAPI_SEQ_VAL:
|
||||
case SLAPI_EXT_OP_REQ_OID:
|
||||
case SLAPI_EXT_OP_REQ_VALUE:
|
||||
case SLAPI_EXT_OP_RET_OID:
|
||||
case SLAPI_EXT_OP_RET_VALUE:
|
||||
case SLAPI_MR_FILTER_ENTRY:
|
||||
case SLAPI_MR_FILTER_TYPE:
|
||||
case SLAPI_MR_FILTER_VALUE:
|
||||
case SLAPI_MR_FILTER_OID:
|
||||
case SLAPI_MR_FILTER_DNATTRS:
|
||||
case SLAPI_LDIF2DB_FILE:
|
||||
case SLAPI_LDIF2DB_REMOVEDUPVALS:
|
||||
case SLAPI_DB2LDIF_PRINTKEY:
|
||||
case SLAPI_PARENT_TXN:
|
||||
case SLAPI_TXN:
|
||||
case SLAPI_SEARCH_RESULT_SET:
|
||||
case SLAPI_SEARCH_RESULT_ENTRY:
|
||||
case SLAPI_NENTRIES:
|
||||
case SLAPI_SEARCH_REFERRALS:
|
||||
case SLAPI_CHANGENUMBER:
|
||||
case SLAPI_LOG_OPERATION:
|
||||
case SLAPI_DBSIZE:
|
||||
return LDAP_SUCCESS;
|
||||
default:
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
isValidParam( Slapi_PBlock *pb, int param )
|
||||
{
|
||||
if ( pb->ckParams == TRUE ) {
|
||||
if ( IBM_RESERVED( param ) ) return LDAP_SUCCESS;
|
||||
if (param == SLAPI_PLUGIN_AUDIT_FN ||
|
||||
param == SLAPI_PLUGIN_AUDIT_DATA )
|
||||
return LDAP_SUCCESS;
|
||||
if ( param < LAST_IBM_PARAM ) {
|
||||
return INVALID_PARAM;
|
||||
} else if ( NETSCAPE_RESERVED( param ) ) {
|
||||
return INVALID_PARAM;
|
||||
} else {
|
||||
return isOkNetscapeParam(param);
|
||||
}
|
||||
} else {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Lock( Slapi_PBlock *pb )
|
||||
{
|
||||
ldap_pvt_thread_mutex_lock(&pb->pblockMutex);
|
||||
}
|
||||
|
||||
static void
|
||||
unLock( Slapi_PBlock *pb )
|
||||
{
|
||||
ldap_pvt_thread_mutex_unlock(&pb->pblockMutex);
|
||||
}
|
||||
|
||||
static int
|
||||
get( Slapi_PBlock *pb, int param, void **val )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
Lock( pb );
|
||||
|
||||
*val = NULL;
|
||||
for ( i = 0; i < pb->numParams; i++ ) {
|
||||
if ( pb->curParams[i] == param ) {
|
||||
*val = pb->curVals[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
unLock( pb );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
set( Slapi_PBlock *pb, int param, void *val )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
int i;
|
||||
|
||||
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
Lock( pb );
|
||||
|
||||
if ( pb->numParams == MAX_PARAMS ) {
|
||||
unLock( pb );
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
for( i = 0; i < pb->numParams; i++ ) {
|
||||
if ( pb->curParams[i] == param ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( i >= pb->numParams ) {
|
||||
pb->curParams[i] = param;
|
||||
pb->numParams++;
|
||||
}
|
||||
pb->curVals[i] = val;
|
||||
|
||||
unLock( pb );
|
||||
return LDAP_SUCCESS;
|
||||
#endif /* LDAP_SLAPI */
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
clearPB( Slapi_PBlock *pb )
|
||||
{
|
||||
pb->numParams = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
checkParams( Slapi_PBlock *pb, int flag )
|
||||
{
|
||||
pb->ckParams = flag;
|
||||
}
|
||||
|
||||
static int
|
||||
deleteParam( Slapi_PBlock *p, int param )
|
||||
{
|
||||
int i;
|
||||
|
||||
Lock(p);
|
||||
for ( i = 0; i < p->numParams; i++ ) {
|
||||
if ( p->curParams[i] == param ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= p->numParams ) {
|
||||
unLock( p );
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
if ( p->numParams > 1 ) {
|
||||
p->curParams[i] = p->curParams[p->numParams];
|
||||
p->curVals[i] = p->curVals[p->numParams];
|
||||
}
|
||||
p->numParams--;
|
||||
unLock( p );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
Slapi_PBlock *
|
||||
slapi_pblock_new()
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
Slapi_PBlock *pb;
|
||||
|
||||
pb = (Slapi_PBlock *) ch_malloc(sizeof(Slapi_PBlock));
|
||||
if ( pb != NULL ) {
|
||||
pb->ckParams = TRUE;
|
||||
ldap_pvt_thread_mutex_init( &pb->pblockMutex );
|
||||
memset( pb->curParams, 0, sizeof(pb->curParams) );
|
||||
memset( pb->curVals, 0, sizeof(pb->curVals) );
|
||||
pb->curParams[0] = SLAPI_IBM_PBLOCK;
|
||||
pb->curVals[0] = NULL;
|
||||
pb->numParams = 1;
|
||||
}
|
||||
return pb;
|
||||
#endif /* LDAP_SLAPI */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
slapi_pblock_destroy( Slapi_PBlock* pb )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
char *str = NULL;
|
||||
|
||||
get( pb, SLAPI_CONN_DN,(void **)&str );
|
||||
if ( str != NULL ) {
|
||||
ch_free( str );
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
get( pb, SLAPI_CONN_AUTHTYPE, (void **)&str );
|
||||
if ( str != NULL ) {
|
||||
ch_free( str );
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
get( pb, SLAPI_IBM_CONN_DN_ALT, (void **)&str );
|
||||
if ( str != NULL ) {
|
||||
ch_free( str );
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
get( pb, SLAPI_IBM_CONN_DN_ORIG, (void **)&str );
|
||||
if ( str != NULL ) {
|
||||
ch_free( str );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_destroy( &pb->pblockMutex );
|
||||
|
||||
ch_free( pb );
|
||||
#endif /* LDAP_SLAPI */
|
||||
}
|
||||
|
||||
int
|
||||
slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
return get( pb, arg, (void **)value );
|
||||
#endif /* LDAP_SLAPI */
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
void *pTmp = NULL;
|
||||
|
||||
switch ( arg ) {
|
||||
case SLAPI_CONN_DN:
|
||||
case SLAPI_CONN_AUTHTYPE:
|
||||
case SLAPI_IBM_CONN_DN_ALT:
|
||||
case SLAPI_IBM_CONN_DN_ORIG:
|
||||
if ( value != NULL ) {
|
||||
pTmp = (void *)slapi_ch_strdup((char *)value);
|
||||
if ( pTmp == NULL ) {
|
||||
return LDAP_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pTmp = value;
|
||||
break;
|
||||
}
|
||||
return set( pb, arg, pTmp );
|
||||
#endif /* LDAP_SLAPI */
|
||||
return LDAP_NO_MEMORY;
|
||||
}
|
||||
|
||||
void
|
||||
slapi_pblock_clear( Slapi_PBlock *pb )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
clearPB( pb );
|
||||
#endif /* LDAP_SLAPI */
|
||||
}
|
||||
|
||||
int
|
||||
slapi_pblock_delete_param( Slapi_PBlock *p, int param )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
return deleteParam( p, param );
|
||||
#endif /* LDAP_SLAPI */
|
||||
return PBLOCK_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
slapi_pblock_check_params( Slapi_PBlock *pb, int flag )
|
||||
{
|
||||
#if defined(LDAP_SLAPI)
|
||||
checkParams( pb, flag );
|
||||
#endif /* LDAP_SLAPI */
|
||||
}
|
||||
|
||||
40
servers/slapd/slapi/slapi_pblock.h
Normal file
40
servers/slapd/slapi/slapi_pblock.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef SLAPI_PBLOCK_H
|
||||
#define SLAPI_PBLOCK_H
|
||||
|
||||
#define CMP_EQUAL 0
|
||||
#define CMP_GREATER 1
|
||||
#define CMP_LOWER (-1)
|
||||
#define PBLOCK_ERROR (-1)
|
||||
#define INVALID_PARAM PBLOCK_ERROR
|
||||
#define MAX_PARAMS 100
|
||||
|
||||
struct slapi_pblock {
|
||||
ldap_pvt_thread_mutex_t pblockMutex;
|
||||
int ckParams;
|
||||
int numParams;
|
||||
int curParams[MAX_PARAMS];
|
||||
void *curVals[MAX_PARAMS];
|
||||
};
|
||||
|
||||
Slapi_PBlock *slapi_pblock_new();
|
||||
void slapi_pblock_destroy( Slapi_PBlock* );
|
||||
int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
|
||||
int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
|
||||
void slapi_pblock_check_params(Slapi_PBlock *pb, int flag);
|
||||
int slapi_pblock_delete_param(Slapi_PBlock *p, int param);
|
||||
void slapi_pblock_clear(Slapi_PBlock *pb);
|
||||
|
||||
#endif /* SLAPI_PBLOCK_H */
|
||||
|
||||
1132
servers/slapd/slapi/slapi_utils.c
Normal file
1132
servers/slapd/slapi/slapi_utils.c
Normal file
File diff suppressed because it is too large
Load diff
115
servers/slapd/slapi/slapi_utils.h
Normal file
115
servers/slapd/slapi/slapi_utils.h
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#ifndef _SLAPI_UTILS_H
|
||||
#define _SLAPI_UTILS_H
|
||||
|
||||
struct _Audit_record;
|
||||
typedef struct _Audit_record Audit_record;
|
||||
|
||||
#define SLAPI_CONTROL_MANAGEDSAIT_OID "2.16.840.1.113730.3.4.2"
|
||||
#define SLAPI_CONTROL_SORTEDSEARCH_OID "1.2.840.113556.1.4.473"
|
||||
#define SLAPI_CONTROL_PAGED_RESULTS_OID "1.2.840.113556.1.4.319"
|
||||
|
||||
typedef int (*SLAPI_FUNC)(Slapi_PBlock *pb);
|
||||
|
||||
#define MAX_HOSTNAME 512
|
||||
|
||||
#define DOMAIN "Domain"
|
||||
#define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
|
||||
|
||||
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;
|
||||
|
||||
int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
|
||||
Slapi_Entry *slapi_str2entry( char *s, int flags );
|
||||
char *slapi_entry2str( Slapi_Entry *e, int *len );
|
||||
int slapi_entry_attr_merge( Slapi_Entry *e, char *type, struct berval **vals );
|
||||
int slapi_entry_attr_find( Slapi_Entry *e, char *type, Slapi_Attr **attr );
|
||||
int slapi_entry_attr_delete( Slapi_Entry *e, char *type );
|
||||
char *slapi_entry_get_dn( Slapi_Entry *e );
|
||||
void slapi_entry_set_dn( Slapi_Entry *e, char *dn );
|
||||
Slapi_Entry *slapi_entry_dup( Slapi_Entry *e );
|
||||
Slapi_Entry *slapi_entry_alloc();
|
||||
void slapi_entry_free( Slapi_Entry *e );
|
||||
int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
|
||||
char *slapi_ch_malloc( unsigned long size );
|
||||
void slapi_ch_free( void *ptr );
|
||||
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
|
||||
char *slapi_ch_realloc( char *block, unsigned long size );
|
||||
char *slapi_ch_strdup( char *s );
|
||||
/*
|
||||
* FIXME: these two were missing, but widely used in a couple of .c files
|
||||
*/
|
||||
size_t slapi_strlen(char *s );
|
||||
#define slapi_ch_stlen(s) slapi_strlen(s)
|
||||
/* end of FIXME */
|
||||
char *slapi_dn_normalize( char *dn );
|
||||
char *slapi_dn_normalize_case( char *dn );
|
||||
char * slapi_esc_dn_normalize( char *dn );
|
||||
char * slapi_esc_dn_normalize_case( char *dn );
|
||||
int slapi_dn_isroot( Slapi_PBlock *pb, char *dn );
|
||||
int slapi_dn_issuffix( char *dn, char *suffix );
|
||||
char *slapi_dn_ignore_case( char *dn );
|
||||
char *slapi_get_hostname();
|
||||
void slapi_register_supported_saslmechanism( char *mechanism );
|
||||
void slapi_send_ldap_result( Slapi_PBlock *pb, int err,
|
||||
char *matched, char *text, int nentries, struct berval **urls );
|
||||
int slapi_send_ldap_extended_response(Connection *conn, Operation *op,
|
||||
int errornum, char *respName, struct berval *response);
|
||||
int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e,
|
||||
LDAPControl **ectrls, char **attrs, int attrsonly );
|
||||
void slapi_register_supported_control(char *controloid,
|
||||
unsigned long controlops);
|
||||
int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp);
|
||||
int slapi_control_present( LDAPControl **controls, char *oid,
|
||||
struct berval **val, int *iscritical);
|
||||
void slapi_register_supported_saslmechanism(char *mechanism);
|
||||
char **slapi_get_supported_saslmechanisms();
|
||||
char **slapi_get_supported_extended_ops(void);
|
||||
int checkControlHonored(LDAPControl **controls, char *pControlOid,
|
||||
unsigned long operation, int *isHonored );
|
||||
void slapi_broadcast_be(int funcType, Slapi_PBlock *pPB);
|
||||
Slapi_Filter *slapi_str2filter( char *str );
|
||||
void slapi_filter_free( Slapi_Filter *f, int recurse );
|
||||
int slapi_filter_get_choice( Slapi_Filter *f);
|
||||
int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
|
||||
Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
|
||||
Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
|
||||
void slapi_free_search_results_internal(Slapi_PBlock *pb);
|
||||
int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL);
|
||||
int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort);
|
||||
int slapi_get_num_be(char *type);
|
||||
unsigned long slapi_timer_current_time();
|
||||
unsigned long slapi_timer_get_time(char *label);
|
||||
void slapi_timer_elapsed_time(char *label,unsigned long start);
|
||||
int slapi_audit_init_header( Connection *conn, Operation *op,
|
||||
Audit_record **arp, void **audit_op_str,
|
||||
int audit_op, int audit_ext_op, int audit_op_str_len);
|
||||
int slapi_audit_send_record( Slapi_PBlock *pb, Connection *conn,
|
||||
Operation *op, int rc);
|
||||
|
||||
extern ldap_pvt_thread_mutex_t slapi_hn_mutex;
|
||||
extern ldap_pvt_thread_mutex_t slapi_time_mutex;
|
||||
|
||||
#endif /* _SLAPI_UTILS_H */
|
||||
|
||||
|
|
@ -27,7 +27,8 @@ XLIBS = $(SLAPD_L) $(LDBM_LIBS)
|
|||
XXLIBS = $(SLAPD_LIBS) \
|
||||
$(LDBM_LIBS) $(SECURITY_LIBS) \
|
||||
$(LDIF_LIBS) $(LUTIL_LIBS)
|
||||
XXXLIBS = $(MODULES_LIBS) $(LTHREAD_LIBS)
|
||||
XXXLIBS = $(MODULES_LIBS) $(LTHREAD_LIBS) \
|
||||
$(SLAPI_LIBS) ../libslapi.a
|
||||
|
||||
STATIC_DEPENDS=@SLAPD_NO_STATIC@ ../libbackends.a
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ send_ldap_disconnect(
|
|||
}
|
||||
|
||||
void
|
||||
send_ldap_extended(
|
||||
slap_send_ldap_extended(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -73,7 +73,7 @@ send_ldap_sasl(
|
|||
}
|
||||
|
||||
void
|
||||
send_ldap_result(
|
||||
slap_send_ldap_result(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -87,7 +87,7 @@ send_ldap_result(
|
|||
}
|
||||
|
||||
void
|
||||
send_search_result(
|
||||
slap_send_search_result(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
ber_int_t err,
|
||||
|
|
@ -102,7 +102,7 @@ send_search_result(
|
|||
}
|
||||
|
||||
int
|
||||
send_search_entry(
|
||||
slap_send_search_entry(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
|
|
@ -116,7 +116,8 @@ send_search_entry(
|
|||
return -1;
|
||||
}
|
||||
|
||||
int send_search_reference(
|
||||
int
|
||||
slap_send_search_reference(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
|
|
@ -270,6 +271,17 @@ slap_modrdn2mods(
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
slap_mods2entry(
|
||||
Modifications *mods,
|
||||
Entry **e,
|
||||
int repl_user,
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int slap_sasl_getdn( Connection *conn, char *id, int len,
|
||||
char *user_realm, struct berval *dn, int flags )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue