[Date Prev][Date Next] [Chronological] [Thread] [Top]

regarding referral



hi guys
well here is a question on referrals which i guess howard chu is working on
regarding the referral tracing for one level search which gives the wrong
result. Now since i need to get it up and working i tried to do the
following :
function : ldbm_back_search()

                /*
                 * if it's a referral, add it to the list of referrals. only
do
                 * this for non-base searches, and don't check the filter
                 * explicitly here since it's only a candidate anyway.
                 */
                if ( !manageDSAit && scope != LDAP_SCOPE_BASE &&
                        is_entry_referral( e ) )
                {
                        struct berval **refs = get_entry_referrals(
                                be, conn, op, e );

                        send_search_reference( be, conn, op,
                                e, refs, scope, NULL, &v2refs );

                        ber_bvecfree( refs );

                        if (scope && LDAP_SCOPE_ONELEVEL) {
                                char *pdn = dn_parent( NULL, e->e_ndn );
                                if ( pdn != NULL ) {
                                        if( !strcmp( pdn, realbase ) ) {

(*v2refs)->bv_val=ch_realloc((*v2refs)->bv_val, strlen((*v2refs)->bv_val) +
15);

strcat((*v2refs)->bv_val,"??base");

(*v2refs)->bv_len=strlen((*v2refs)->bv_val);
                                        }
                                        free(pdn);
                                }
                        }

Now its a pretty patchy fix coz what i intend to do was if its a one level
search and if the realbase and pdn match then it means its already at one
level search in the host and hence change the scope of the search in the
referral query to base search. Now i try to do it the way its mentioned in
the code snippet. With this the result returned to the client is
ldap://<host>/dn??base but i thought that client should parse it and do the
required stuff but it just send this search string to the referral ldap
server with dn as dn??base. Is this the right way to do it, firstly is there
any error in the syntax of the ldapurl sent and then again is this way
correct. help really needed fast.
thx
bharat