#include <ac/socket.h>
#include <ac/string.h>
+#include <ac/time.h>
#include "slap.h"
#include "back-ldap.h"
} else {
sres = ldap_result2error(lc->ld, res, 1);
ldap_get_option(lc->ld, LDAP_OPT_ERROR_STRING, &err);
- ldap_get_option(lc->ld, LDAP_OPT_MATCH_STRING, &match);
+ ldap_get_option(lc->ld, LDAP_OPT_MATCHED_DN, &match);
rc = 0;
}
ldap_msgfree(res);
if (rc == -1)
goto fail;
- send_ldap_search_result( conn, op, sres, match, err, i );
+ send_search_result( conn, op, sres,
+ match, err, NULL, NULL, i );
if (match)
free(match);
if (err)
char *a;
Entry ent;
BerElement *ber = NULL;
- Attribute *attr;
+ Attribute *attr, **attrp;
struct berval *dummy = NULL;
ent.e_dn = ldap_get_dn(lc->ld, e);
- ent.e_ndn = dn_normalize_case( ch_strdup( ent.e_dn));
+ ent.e_ndn = ch_strdup( ent.e_dn);
+ (void) dn_normalize_case( ent.e_ndn );
ent.e_id = 0;
ent.e_attrs = 0;
ent.e_private = 0;
- attr = (Attribute *)4;
- attr = (Attribute *)((long)&ent.e_attrs - ((long)&attr->a_next-4));
+ attrp = &ent.e_attrs;
for (a = ldap_first_attribute(lc->ld, e, &ber); a;
a = ldap_next_attribute(lc->ld, e, ber)) {
- attr->a_next = (Attribute *)ch_malloc( sizeof(Attribute) );
- attr=attr->a_next;
+ attr = (Attribute *)ch_malloc( sizeof(Attribute) );
attr->a_next = 0;
attr->a_type = ch_strdup(a);
attr->a_syntax = attr_syntax(a);
attr->a_vals = ldap_get_values_len(lc->ld, e, a);
if (!attr->a_vals)
attr->a_vals = &dummy;
+ *attrp = attr;
+ attrp = &attr->a_next;
}
- send_search_entry( be, lc->conn, op, &ent, attrs, attrsonly );
+ send_search_entry( be, lc->conn, op, &ent, attrs, attrsonly, NULL );
for (;ent.e_attrs;) {
attr=ent.e_attrs;
ent.e_attrs = attr->a_next;