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

how to use ldap_parse_sortresponse_control



I confuse with the use of  ldap_parse_sortresponse_control because there is no example and document about it. Although it seems like ldap_parse_sort_control of Novell CLDAP and Mozilla C LDAP, it is wrong if using it on their way.

the following is my code:

...

    LDAPControl *sortctrl = NULL;
    LDAPControl *serverctrls[2];
    LDAPControl **resultctrls = NULL;
    LDAPSortKey **sortkeylist;

...

ldap_create_sort_keylist(&sortkeylist, sort_attrs);

    /* Create the sort control. */
    rc = ldap_create_sort_control(ldap, sortkeylist, 1, &sortctrl);
   
...
    requestctrls[0] = sortctrl;
    requestctrls[1] = NULL;

    /* Search for all entries in Sunnyvale */
    rc = ldap_search_ext_s(...);
  
...

    parse_rc =
        ldap_parse_result(ldap, result, &rc, NULL, NULL, NULL, &resultctrls, 0);
   ...

    parse_rc = ldap_parse_sortresponse_control(ldap, *resultctrls, &rcode, NULL);

...

for (...) {
...
}

nothing is searched. it is ok if no sort or sort by CLDAP

gtalk:freeespeech@gmail.com