]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/search.c
Add multimaster replication support (ITS#170) based upon
[openldap] / servers / slapd / back-ldap / search.c
index c742248c5ee3cb6ae516418e15f57df221557f40..05c6f2597b200ac705678e12c4eb6e290f3b87d1 100644 (file)
@@ -137,29 +137,30 @@ ldap_send_entry(
        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, 0, NULL );
+       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;