]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapi/slapi_utils.c
Add slapi_x_be_select() (to be replaced with slapi_be_select() when
[openldap] / servers / slapd / slapi / slapi_utils.c
index f2ac0cf24b3db170e46e1939af21af88caf0610c..98951cef6696403bc563a1678fe5ec04679619bd 100644 (file)
@@ -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)