From: Pierangelo Masarati Date: Mon, 27 Jan 2003 14:44:39 +0000 (+0000) Subject: reworking of slapi headers X-Git-Tag: NO_SLAP_OP_BLOCKS~493 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d1cc80694f6343715036b6428d238354dc44e25d;p=openldap reworking of slapi headers --- diff --git a/include/slapi-plugin.h b/include/slapi-plugin.h index 46ed481544..384742a2f7 100644 --- a/include/slapi-plugin.h +++ b/include/slapi-plugin.h @@ -20,7 +20,7 @@ typedef struct slapi_pblock Slapi_PBlock; typedef struct slapi_entry Slapi_Entry; typedef struct slapi_attr Slapi_Attr; typedef struct berval Slapi_Value; -typedef struct BerVarray Slapi_ValueSet; +typedef BerVarray Slapi_ValueSet; typedef struct slapi_filter Slapi_Filter; /* pblock routines */ @@ -195,24 +195,27 @@ int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial, Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2); int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f, int verify_access ); -int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f); +int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f ); /* 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 ); + 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 ); +#if 0 Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn, char *newParent, int deloldrdn, LDAPControl **controls, - int log_change); + int log_change ); +#endif void slapi_free_search_results_internal(Slapi_PBlock *pb); /* connection related routines */ @@ -220,7 +223,6 @@ int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL); int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort); /* computed attributes */ -struct _computed_attr_context; typedef struct _computed_attr_context computed_attr_context; typedef int (*slapi_compute_output_t)(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e); typedef int (*slapi_compute_callback_t)(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn); diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index f3b7ba533f..ac2d4fccf3 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -36,8 +36,7 @@ #include #include "slap.h" -#include "slapi-plugin.h" -#include "slapi_pblock.h" +#include "slapi.h" #include "back-monitor.h" #if defined(LDAP_SLAPI) diff --git a/servers/slapd/slapi/plugin.c b/servers/slapd/slapi/plugin.c index 5ebe44dc20..9b978d9c4e 100644 --- a/servers/slapd/slapi/plugin.c +++ b/servers/slapd/slapi/plugin.c @@ -11,7 +11,6 @@ */ #include "portable.h" -#include "slapi_common.h" #include #include #include diff --git a/servers/slapd/slapi/plugin.h b/servers/slapd/slapi/plugin.h deleted file mode 100644 index f334f69fa2..0000000000 --- a/servers/slapd/slapi/plugin.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 1998-2003 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); - -#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN) - -#endif /* _PLUGIN_H_ */ - diff --git a/servers/slapd/slapi/printmsg.c b/servers/slapd/slapi/printmsg.c index 21f0c2f8db..6bc88d0397 100644 --- a/servers/slapd/slapi/printmsg.c +++ b/servers/slapd/slapi/printmsg.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h new file mode 100644 index 0000000000..81215a9001 --- /dev/null +++ b/servers/slapd/slapi/proto-slapi.h @@ -0,0 +1,313 @@ +/* + * Copyright 1998-2003 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 _PROTO_SLAPI_H +#define _PROTO_SLAPI_H + +LDAP_BEGIN_DECL + +/* + * Was: slapi_utils.h + */ + +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 ); +char *slapi_entry_attr_get_charptr( const Slapi_Entry *e, const char *type ); +int slapi_entry_attr_delete( Slapi_Entry *e, char *type ); +int slapi_entry_attr_get_int( const Slapi_Entry *e, const char *type ); +int slapi_entry_attr_get_long( const Slapi_Entry *e, const char *type ); +int slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type ); +int slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type ); +int slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value ); +int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value); +void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l); +void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l); +void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l); +void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l); +int slapi_is_rootdse( const char *dn ); +int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs); +int slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value); +int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value); +int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value); +int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ); +int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ); +char *slapi_entry_get_dn( Slapi_Entry *e ); +int slapi_x_entry_get_id( 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 ); + +/* DS 5.x SLAPI */ +int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr, + struct berval *val, int access ); +int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, + char **errbuf ); +Slapi_Attr *slapi_attr_new( void ); +Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type ); +void slapi_attr_free( Slapi_Attr **a ); +Slapi_Attr *slapi_attr_dup( const Slapi_Attr *attr ); +int slapi_attr_add_value( Slapi_Attr *a, const Slapi_Value *v ); +int slapi_attr_type2plugin( const char *type, void **pi ); +int slapi_attr_get_type( const Slapi_Attr *attr, char **type ); +int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp ); +int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags ); +int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag ); +int slapi_attr_value_cmp( const Slapi_Attr *attr, const struct berval *v1, + const struct berval *v2 ); +int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v ); +#if 0 +#define SLAPI_TYPE_CMP_EXACT 0 +#define SLAPI_TYPE_CMP_BASE 1 +#define SLAPI_TYPE_CMP_SUBTYPE 2 +#endif +int slapi_attr_type_cmp( const char *t1, const char *t2, int opt ); +int slapi_attr_types_equivalent( const char *t1, const char *t2 ); +int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v ); +int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v ); +int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues ); +int slapi_attr_get_valueset( const Slapi_Attr *a, Slapi_ValueSet **vs ); +int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals ); +char *slapi_attr_syntax_normalize( const char *s ); + +Slapi_Value *slapi_value_new( void ); +Slapi_Value *slapi_value_new_berval(const struct berval *bval); +Slapi_Value *slapi_value_new_value(const Slapi_Value *v); +Slapi_Value *slapi_value_new_string(const char *s); +Slapi_Value *slapi_value_init(Slapi_Value *v); +Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval); +Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s); +Slapi_Value *slapi_value_dup(const Slapi_Value *v); +void slapi_value_free(Slapi_Value **value); +const struct berval *slapi_value_get_berval( const Slapi_Value *value ); +Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval ); +Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom); +Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len); +int slapi_value_set_string(Slapi_Value *value, const char *strVal); +int slapi_value_set_int(Slapi_Value *value, int intVal); +const char*slapi_value_get_string(const Slapi_Value *value); +int slapi_value_get_int(const Slapi_Value *value); +unsigned int slapi_value_get_uint(const Slapi_Value *value); +long slapi_value_get_long(const Slapi_Value *value); +unsigned long slapi_value_get_ulong(const Slapi_Value *value); +size_t slapi_value_get_length(const Slapi_Value *value); +int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2); + +Slapi_ValueSet *slapi_valueset_new( void ); +void slapi_valueset_free(Slapi_ValueSet *vs); +void slapi_valueset_init(Slapi_ValueSet *vs); +void slapi_valueset_done(Slapi_ValueSet *vs); +void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval); +int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v ); +int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v); +int slapi_valueset_count( const Slapi_ValueSet *vs); +void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2); + +Slapi_Mutex *slapi_new_mutex( void ); +void slapi_destroy_mutex( Slapi_Mutex *mutex ); +void slapi_lock_mutex( Slapi_Mutex *mutex ); +int slapi_unlock_mutex( Slapi_Mutex *mutex ); +Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex ); +void slapi_destroy_condvar( Slapi_CondVar *cvar ); +int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout ); +int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all ); + +char *slapi_ch_malloc( unsigned long size ); +void slapi_ch_free( void **ptr ); +void slapi_ch_free_string( char **s ); +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 ); +void slapi_ch_array_free( char **arrayp ); +struct berval *slapi_ch_bvdup(const struct berval *v); +struct berval **slapi_ch_bvecdup(const struct berval **v); + +/* + * 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 ); +int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type ); +int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial, + char ***any, char **final ); +Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2); +int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f, + int verify_access ); +int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f); +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); + +int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be ); +int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn ); +int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op ); + +LDAPMod **slapi_x_modifications2ldapmods(Modifications **); +Modifications *slapi_x_ldapmods2modifications(LDAPMod **); +void slapi_x_free_ldapmods(LDAPMod **); + +int slapi_compute_add_evaluator(slapi_compute_callback_t function); +int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function); +int compute_rewrite_search_filter(Slapi_PBlock *pb); +int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn); +int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e); +int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb); + +extern ldap_pvt_thread_mutex_t slapi_hn_mutex; +extern ldap_pvt_thread_mutex_t slapi_time_mutex; +extern ldap_pvt_thread_mutex_t slapi_printmessage_mutex; +extern char *slapi_log_file; +extern int slapi_log_level; + + +/* + * Was: slapi_pblock.h + */ + +Slapi_PBlock *slapi_pblock_new( void ); +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 ); + +/* + * OpenLDAP extensions + */ +int slapi_x_pblock_get_first( Backend *be, Slapi_PBlock **pb ); +int slapi_x_pblock_get_next( Slapi_PBlock **pb ); + + +/* + * Was: 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); + + +/* + * Was: 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); +#if 0 +Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn, + char *newParent, int deloldrdn, LDAPControl **controls, + int log_change); +#endif +char **slapi_get_supported_extended_ops(void); +int duplicateBVMod( LDAPMod *pMod, LDAPMod **ppNewMod ); + + +/* + * Was: slapi_cl.h + */ + +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); + +LDAP_END_DECL + +#endif /* _PROTO_SLAPI_H */ + diff --git a/servers/slapd/slapi/slapi.h b/servers/slapd/slapi/slapi.h index 41afe283f9..d13cb6fa86 100644 --- a/servers/slapd/slapi/slapi.h +++ b/servers/slapd/slapi/slapi.h @@ -15,28 +15,145 @@ #include +#define slapi_entry slap_entry +#define slapi_attr slap_attr +#define slapi_filter slap_filter +#include + LDAP_BEGIN_DECL +/* + * Generic typedefs + */ +#if 0 typedef struct slapi_pblock Slapi_PBlock; typedef struct slap_entry Slapi_Entry; typedef struct slap_attr Slapi_Attr; typedef struct berval Slapi_Value; typedef BerVarray Slapi_ValueSet; typedef Filter Slapi_Filter; +#endif -LDAP_END_DECL +/* + * Was: slapi_common.h + */ + +/* a little naif ... */ +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#if 0 + +#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 + + +/* + * Was: slapi_utils.h + */ +typedef struct _Audit_record Audit_record; + +#define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT +#define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST +#define SLAPI_CONTROL_PAGED_RESULTS_OID LDAP_CONTROL_PAGEDRESULTS + +typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb ); + +#if 0 +#define DOMAIN "Domain" +#define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#endif + +typedef struct _slapi_control { + int s_ctrl_num; + char **s_ctrl_oids; + unsigned long *s_ctrl_ops; +} Slapi_Control; + +typedef struct _ExtendedOp { + struct berval ext_oid; + SLAPI_FUNC ext_func; + Backend *ext_be; + struct _ExtendedOp *ext_next; +} ExtendedOp; + +/* Computed attribute support */ +struct _computed_attr_context { + /* slap_send_search_entry() argblock */ + Slapi_PBlock *cac_pb; + AttributeName *cac_attrs; + int cac_attrsonly : 1; + int cac_userattrs : 1; + int cac_opattrs : 1; + AccessControlState cac_acl_state; + /* private data */ + void *cac_private; +}; + +/* for slapi_attr_type_cmp() */ +#define SLAPI_TYPE_CMP_EXACT 0 +#define SLAPI_TYPE_CMP_BASE 1 +#define SLAPI_TYPE_CMP_SUBTYPE 2 + + +/* + * Was: slapi_pblock.h + */ -#include #ifndef NO_PBLOCK_CLASS + +#if 0 +#define CMP_EQUAL 0 +#define CMP_GREATER 1 +#define CMP_LOWER (-1) +#endif +#define PBLOCK_ERROR (-1) +#define INVALID_PARAM PBLOCK_ERROR +#define PBLOCK_MAX_PARAMS 100 + +struct slapi_pblock { + ldap_pvt_thread_mutex_t pblockMutex; + int ckParams; + int numParams; + int curParams[PBLOCK_MAX_PARAMS]; + void *curVals[PBLOCK_MAX_PARAMS]; +}; + +#endif /* !NO_PBLOCK_CLASS */ + +/* + * Was: plugin.h + */ + +#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN) + +#if 0 +#include #include -#endif /* NO_PBLOCK_CLASS */ #include #include #if 0 /* unused (yet?) */ #include #endif /* 0 */ - -LDAP_BEGIN_DECL +#endif /* * Attribute flags returned by slapi_attr_get_flags() @@ -375,5 +492,7 @@ LDAP_BEGIN_DECL LDAP_END_DECL +#include "proto-slapi.h" + #endif /* _SLAPI_H */ diff --git a/servers/slapd/slapi/slapi_cl.h b/servers/slapd/slapi/slapi_cl.h deleted file mode 100644 index 3dae15ae8a..0000000000 --- a/servers/slapd/slapi/slapi_cl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 1998-2003 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 */ - diff --git a/servers/slapd/slapi/slapi_common.h b/servers/slapd/slapi/slapi_common.h deleted file mode 100644 index a44898f36b..0000000000 --- a/servers/slapd/slapi/slapi_common.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 1998-2003 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 - -LDAP_BEGIN_DECL - - -#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; - -LDAP_END_DECL - -#endif /* SLAPI_COMMON_H */ - diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index fcfa6fe5bb..b8b7108476 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -11,7 +11,6 @@ */ #include "portable.h" -#include "slapi_common.h" #include #include #include diff --git a/servers/slapd/slapi/slapi_ops.h b/servers/slapd/slapi/slapi_ops.h deleted file mode 100644 index e6189ffc74..0000000000 --- a/servers/slapd/slapi/slapi_ops.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 1998-2003 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 - -LDAP_BEGIN_DECL - -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 ); - -LDAP_END_DECL - -#endif /* SLAPI_OPS_H */ - diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 8d20932f09..3441eb4592 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -11,7 +11,6 @@ */ #include "portable.h" -#include "slapi_common.h" #include #include @@ -273,7 +272,7 @@ set( Slapi_PBlock *pb, int param, void *val ) Lock( pb ); - if ( pb->numParams == MAX_PARAMS ) { + if ( pb->numParams == PBLOCK_MAX_PARAMS ) { unLock( pb ); return PBLOCK_ERROR; } diff --git a/servers/slapd/slapi/slapi_pblock.h b/servers/slapd/slapi/slapi_pblock.h deleted file mode 100644 index fb80d88b67..0000000000 --- a/servers/slapd/slapi/slapi_pblock.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 1998-2003 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 - -LDAP_BEGIN_DECL - -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); - -/* - * OpenLDAP extensions - */ -int slapi_x_pblock_get_first( Backend *be, Slapi_PBlock **pb ); -int slapi_x_pblock_get_next( Slapi_PBlock **pb ); - -LDAP_END_DECL - -#endif /* SLAPI_PBLOCK_H */ - diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 2694914b5b..3c5e758f3d 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -18,17 +18,16 @@ */ #include "portable.h" -#include "slapi_common.h" #include - -#include -#include #include #include #include #include +#include +#include + struct berval *ns_get_supported_extop( int ); #ifdef _SPARC @@ -594,7 +593,6 @@ slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs) AttributeDescription *ad = NULL; const char *text; int rc; - BerVarray bv; rc = slap_str2ad( type, &ad, &text ); if ( rc != LDAP_SUCCESS ) { @@ -1674,7 +1672,9 @@ slapi_pw_find( return 1; #endif /* !defined(LDAP_SLAPI) */ } - + +#define MAX_HOSTNAME 512 + char * slapi_get_hostname( void ) { diff --git a/servers/slapd/slapi/slapi_utils.h b/servers/slapd/slapi/slapi_utils.h deleted file mode 100644 index 3f0c06214f..0000000000 --- a/servers/slapd/slapi/slapi_utils.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 1998-2003 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 - -LDAP_BEGIN_DECL - -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 ); -char *slapi_entry_attr_get_charptr( const Slapi_Entry *e, const char *type ); -int slapi_entry_attr_delete( Slapi_Entry *e, char *type ); -int slapi_entry_attr_get_int( const Slapi_Entry *e, const char *type ); -int slapi_entry_attr_get_long( const Slapi_Entry *e, const char *type ); -int slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type ); -int slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type ); -int slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value ); -int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value); -void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l); -void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l); -void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l); -void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l); -int slapi_is_rootdse( const char *dn ); -int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs); -int slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); -int slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value); -int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value); -int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value); -int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ); -int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ); -char *slapi_entry_get_dn( Slapi_Entry *e ); -int slapi_x_entry_get_id( 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 ); - -/* DS 5.x SLAPI */ -int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr, struct berval *val, int access ); -int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char **errbuf ); -Slapi_Attr *slapi_attr_new( void ); -Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type ); -void slapi_attr_free( Slapi_Attr **a ); -Slapi_Attr *slapi_attr_dup( const Slapi_Attr *attr ); -int slapi_attr_add_value( Slapi_Attr *a, const Slapi_Value *v ); -int slapi_attr_type2plugin( const char *type, void **pi ); -int slapi_attr_get_type( const Slapi_Attr *attr, char **type ); -int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp ); -int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags ); -int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag ); -int slapi_attr_value_cmp( const Slapi_Attr *attr, const struct berval *v1, const struct berval *v2 ); -int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v ); -#define SLAPI_TYPE_CMP_EXACT 0 -#define SLAPI_TYPE_CMP_BASE 1 -#define SLAPI_TYPE_CMP_SUBTYPE 2 -int slapi_attr_type_cmp( const char *t1, const char *t2, int opt ); -int slapi_attr_types_equivalent( const char *t1, const char *t2 ); -int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v ); -int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v ); -int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues ); -int slapi_attr_get_valueset( const Slapi_Attr *a, Slapi_ValueSet **vs ); -int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals ); -char *slapi_attr_syntax_normalize( const char *s ); - -Slapi_Value *slapi_value_new( void ); -Slapi_Value *slapi_value_new_berval(const struct berval *bval); -Slapi_Value *slapi_value_new_value(const Slapi_Value *v); -Slapi_Value *slapi_value_new_string(const char *s); -Slapi_Value *slapi_value_init(Slapi_Value *v); -Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval); -Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s); -Slapi_Value *slapi_value_dup(const Slapi_Value *v); -void slapi_value_free(Slapi_Value **value); -const struct berval *slapi_value_get_berval( const Slapi_Value *value ); -Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval ); -Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom); -Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len); -int slapi_value_set_string(Slapi_Value *value, const char *strVal); -int slapi_value_set_int(Slapi_Value *value, int intVal); -const char*slapi_value_get_string(const Slapi_Value *value); -int slapi_value_get_int(const Slapi_Value *value); -unsigned int slapi_value_get_uint(const Slapi_Value *value); -long slapi_value_get_long(const Slapi_Value *value); -unsigned long slapi_value_get_ulong(const Slapi_Value *value); -size_t slapi_value_get_length(const Slapi_Value *value); -int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2); - -Slapi_ValueSet *slapi_valueset_new( void ); -void slapi_valueset_free(Slapi_ValueSet *vs); -void slapi_valueset_init(Slapi_ValueSet *vs); -void slapi_valueset_done(Slapi_ValueSet *vs); -void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval); -int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v ); -int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v); -int slapi_valueset_count( const Slapi_ValueSet *vs); -void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2); - -typedef struct slapi_mutex Slapi_Mutex; -typedef struct slapi_condvar Slapi_CondVar; -Slapi_Mutex *slapi_new_mutex( void ); -void slapi_destroy_mutex( Slapi_Mutex *mutex ); -void slapi_lock_mutex( Slapi_Mutex *mutex ); -int slapi_unlock_mutex( Slapi_Mutex *mutex ); -Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex ); -void slapi_destroy_condvar( Slapi_CondVar *cvar ); -int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout ); -int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all ); - -char *slapi_ch_malloc( unsigned long size ); -void slapi_ch_free( void **ptr ); -void slapi_ch_free_string( char **s ); -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 ); -void slapi_ch_array_free( char **arrayp ); -struct berval *slapi_ch_bvdup(const struct berval *v); -struct berval **slapi_ch_bvecdup(const struct berval **v); - -/* - * 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 ); -int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type ); -int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial, - char ***any, char **final ); -Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2); -int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f, - int verify_access ); -int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f); -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); - -int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be ); -int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn ); -int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op ); - -LDAPMod **slapi_x_modifications2ldapmods(Modifications **); -Modifications *slapi_x_ldapmods2modifications(LDAPMod **); -void slapi_x_free_ldapmods(LDAPMod **); - -/* Computed attribute support */ -struct _computed_attr_context { - /* slap_send_search_entry() argblock */ - Slapi_PBlock *cac_pb; - AttributeName *cac_attrs; - int cac_attrsonly : 1; - int cac_userattrs : 1; - int cac_opattrs : 1; - AccessControlState cac_acl_state; - /* private data */ - void *cac_private; -}; -typedef struct _computed_attr_context computed_attr_context; -typedef int (*slapi_compute_output_t)(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e); -typedef int (*slapi_compute_callback_t)(computed_attr_context *c, char *type, - Slapi_Entry *e, slapi_compute_output_t outputfn); -typedef int (*slapi_search_rewrite_callback_t)(Slapi_PBlock *pb); -int slapi_compute_add_evaluator(slapi_compute_callback_t function); -int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function); -int compute_rewrite_search_filter(Slapi_PBlock *pb); -int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn); -int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e); -int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb); - -extern ldap_pvt_thread_mutex_t slapi_hn_mutex; -extern ldap_pvt_thread_mutex_t slapi_time_mutex; -extern ldap_pvt_thread_mutex_t slapi_printmessage_mutex; -extern char *slapi_log_file; -extern int slapi_log_level; - -LDAP_END_DECL - -#endif /* _SLAPI_UTILS_H */ -