From 3858ce0728d952db3445bb17bd64241f803181fc Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 8 Aug 2005 11:01:39 +0000 Subject: [PATCH] Add slapi_x_be_select() (to be replaced with slapi_be_select() when we support Slapi_DN API) --- servers/slapd/slapi/proto-slapi.h | 1 + servers/slapd/slapi/slapi_utils.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h index 0d1e8ee6c9..cd967ed202 100644 --- a/servers/slapd/slapi/proto-slapi.h +++ b/servers/slapd/slapi/proto-slapi.h @@ -31,6 +31,7 @@ LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod LDAP_SLAPI_F (int) slapi_int_count_controls LDAP_P(( LDAPControl **ctrls )); LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void)); LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state )); +LDAP_SLAPI_F (Slapi_Backend *) slapi_x_be_select LDAP_P((const char *dn)); /* slapi_ops.c */ LDAP_SLAPI_F (int) slapi_int_response LDAP_P(( Slapi_Operation *op, SlapReply *rs )); diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index f2ac0cf24b..98951cef66 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -3479,6 +3479,24 @@ const char *slapi_x_be_get_updatedn( Slapi_Backend *be ) return be->be_update_ndn.bv_val; } +Slapi_Backend *slapi_x_be_select(const char *dn) +{ + struct berval bdn; + struct berval ndn; + Slapi_Backend *be; + + bdn.bv_val = (char *)dn; + bdn.bv_len = (dn != NULL) ? strlen(dn) : 0; + + if ( dnNormalize( 0, NULL, NULL, &bdn, &ndn, NULL ) != LDAP_SUCCESS ) + return NULL; + + be = select_backend( &ndn, 0, 0 ); + slapi_ch_free_string( &ndn.bv_val ); + + return be; +} + #if 0 void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag) -- 2.39.5