]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/search.c
provisions for configuring a desired chaining policy via the chaining behavior control
[openldap] / servers / slapd / back-ldap / search.c
index b42352614f65e09159e8df6bfb80efcedadff3dd..8c610a57980b1c18b1006a4c2a060a51f58a5f17 100644 (file)
@@ -234,13 +234,34 @@ fail:;
                        }
 
                } else {
+                       char            **references = NULL;
+
                        rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
                                        &match.bv_val, (char **)&rs->sr_text,
-                                       NULL, &rs->sr_ctrls, 1 );
-                       if (rc != LDAP_SUCCESS ) {
+                                       &references, &rs->sr_ctrls, 1 );
+                       if ( rc != LDAP_SUCCESS ) {
                                rs->sr_err = rc;
                        }
                        rs->sr_err = slap_map_api2result( rs );
+
+                       if ( references ) {
+                               int     cnt;
+
+                               for ( cnt = 0; references[ cnt ]; cnt++ )
+                                       /* NO OP */ ;
+                               
+                               rs->sr_ref = ch_calloc( cnt + 1, sizeof( struct berval ) );
+
+                               for ( cnt = 0; references[ cnt ]; cnt++ ) {
+                                       ber_str2bv( references[ cnt ], 0, 0, &rs->sr_ref[ cnt ] );
+                               }
+
+                               /* cleanup */
+                               if ( references ) {
+                                       ldap_value_free( references );
+                               }
+                       }
+
                        rc = 0;
                        break;
                }
@@ -283,12 +304,19 @@ finish:;
                rs->sr_matched = NULL;
                LDAP_FREE( match.bv_val );
        }
+
        if ( rs->sr_text ) {
                if ( !dontfreetext ) {
                        LDAP_FREE( (char *)rs->sr_text );
                }
                rs->sr_text = NULL;
        }
+
+       if ( rs->sr_ref ) {
+               ber_bvarray_free( rs->sr_ref );
+               rs->sr_ref = NULL;
+       }
+
        if ( attrs ) {
                ch_free( attrs );
        }
@@ -545,8 +573,8 @@ ldap_back_entry_get(
        
 retry:
        rc = ldap_search_ext_s( lc->lc_ld, ndn->bv_val, LDAP_SCOPE_BASE, filter,
-                               at ? gattr : NULL, 0, ctrls, NULL, LDAP_NO_LIMIT,
-                               LDAP_NO_LIMIT, &result );
+                               at ? gattr : NULL, 0, ctrls, NULL,
+                               LDAP_NO_LIMIT, LDAP_NO_LIMIT, &result );
        if ( rc != LDAP_SUCCESS ) {
                if ( rc == LDAP_SERVER_DOWN && do_retry ) {
                        do_retry = 0;