]> git.deb.at Git - pkg/abook.git/commitdiff
ldif: cleanup ldif_convert()
authorRaphaël Droz <raphael.droz+floss@gmail.com>
Thu, 13 Dec 2012 16:01:14 +0000 (17:01 +0100)
committerRaphaël Droz <raphael.droz+floss@gmail.com>
Thu, 13 Dec 2012 16:01:14 +0000 (17:01 +0100)
* removed the "dirty hack" about LDIF_ITEM_FIELDS
* removed a useless free() causing segfaults
* don't process "objectclass" fields as we don't do anything about them

filter.c

index ff3e511872f0e2bd3619680fa67c70de7699eff4..520d4ceddd5b1f248505667274dec44503145c28 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -630,15 +630,8 @@ ldif_convert(ldif_item item, char *type, char *value)
                return;
        }
 
-       for(i=0; i < LDIF_ITEM_FIELDS; i++) {
+       for(i=0; i < LDIF_ITEM_FIELDS - 1; i++) {
                 if(!strcasecmp(ldif_field_names[i], type) && *value) {
-                        if(i == LDIF_ITEM_FIELDS - 1) /* this is a dirty hack */
-                               if(safe_strcmp("person", value))
-                                       break;
-
-                       if(item_fget(item, i))
-                               free(item_fget(item, i));
-
                        item_fput(item, i, xstrdup(value));
                        break;
                }