+ /*
+ * Rewrite the gr ndn if needed
+ */
+ switch ( rewrite_session( li->rwinfo, "searchBase",
+ gr_ndn->bv_val, conn, &mgr_ndn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mgr_ndn.bv_val == NULL ) {
+ mgr_ndn = *gr_ndn;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchBase (gr ndn in group): \"%s\" -> \"%s\"\n%s",
+ gr_ndn->bv_val, mgr_ndn.bv_val, "" );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS,
+ "rw> searchBase (gr ndn in group):"
+ " \"%s\" -> \"%s\"\n%s",
+ gr_ndn->bv_val, mgr_ndn.bv_val, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+
+ case REWRITE_REGEXEC_ERR:
+ goto cleanup;
+ }
+#else /* !ENABLE_REWRITE */
+ ldap_back_dn_massage( li, op_ndn, &mop_ndn, 1, 1 );
+ if ( mop_ndn.bv_val == NULL ) {
+ goto cleanup;
+ }
+ ldap_back_dn_massage( li, gr_ndn, &mgr_ndn, 1, 1 );
+ if ( mgr_ndn.bv_val == NULL ) {
+ goto cleanup;
+ }
+#endif /* !ENABLE_REWRITE */
+
+ ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name, 0);
+ if (group_oc_name.bv_val == NULL)
+ goto cleanup;
+ ldap_back_map(&li->at_map, &group_at_name, &group_at_name, 0);
+ if (group_at_name.bv_val == NULL)
+ goto cleanup;
+
+ filter = ch_malloc(sizeof("(&(objectclass=)(=))")
+ + group_oc_name.bv_len
+ + group_at_name.bv_len
+ + mop_ndn.bv_len + 1);
+ if (filter == NULL)
+ goto cleanup;
+
+ if (ldap_initialize(&ld, li->url) != LDAP_SUCCESS) {
+ goto cleanup;
+ }