]> git.sur5r.net Git - openldap/commitdiff
cleanup null mapping detection
authorPierangelo Masarati <ando@openldap.org>
Mon, 27 Jan 2003 21:34:25 +0000 (21:34 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 27 Jan 2003 21:34:25 +0000 (21:34 +0000)
servers/slapd/back-ldap/attribute.c
servers/slapd/back-ldap/group.c
servers/slapd/back-ldap/map.c
servers/slapd/back-ldap/modify.c
servers/slapd/back-meta/add.c
servers/slapd/back-meta/attribute.c
servers/slapd/back-meta/group.c
servers/slapd/back-meta/modify.c

index a3371a5be3ce3c4e14c8ca5ec3ed64cfd734a88b..81f77888360a3c2f4185ddcc36477b15d63bce30 100644 (file)
@@ -64,7 +64,7 @@ ldap_back_attribute(
 
        }
        ldap_back_map(&li->at_map, &entry_at->ad_cname, &mapped, BACKLDAP_MAP);
-       if (mapped.bv_val == NULL) {
+       if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
                return 1;
        }
 
@@ -111,7 +111,7 @@ ldap_back_attribute(
                } else {
                        ldap_back_map(&li->oc_map, &v[j], &mapped,
                                        BACKLDAP_REMAP);
-                       if (mapped.bv_val) {
+                       if (mapped.bv_val && mapped.bv_val[0] != '\0') {
                                ber_dupbv( &v[j], &mapped );
                                if (v[j].bv_val)
                                        j++;
index aa413b66482783f45d722d6b7333534e0672e6dc..79e67c60959ab42058fb4e4d44c04af03d00c7ce 100644 (file)
@@ -156,11 +156,11 @@ ldap_back_group(
 
        ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name,
                        BACKLDAP_MAP);
-       if (group_oc_name.bv_val == NULL)
+       if (group_oc_name.bv_val == NULL || group_oc_name.bv_val[0] == '\0')
                goto cleanup;
        ldap_back_map(&li->at_map, &group_at_name, &group_at_name,
                        BACKLDAP_MAP);
-       if (group_at_name.bv_val == NULL)
+       if (group_at_name.bv_val == NULL || group_at_name.bv_val[0] == '\0')
                goto cleanup;
 
        filter = ch_malloc(sizeof("(&(objectclass=)(=))")
index 7c46626beea52172f3a137126dd72f838176535f..9a5fb497da48dbe9b5eb77b12904c13795e3a4af 100644 (file)
@@ -174,10 +174,11 @@ ldap_back_map_filter(
                                tmp.bv_len = p - q;
                                tmp.bv_val = q;
                                ldap_back_map(at_map, &tmp, &m, remap);
-                               if (m.bv_val == NULL)
+                               if (m.bv_val == NULL || m.bv_val[0] == '\0') {
                                        ldap_back_map(oc_map, &tmp, &m, remap);
-                               if (m.bv_val == NULL) {
-                                       m = tmp;
+                                       if (m.bv_val == NULL || m.bv_val[0] == '\0') {
+                                               m = tmp;
+                                       }
                                }
                                extra += p - q;
                                plen = m.bv_len;
@@ -233,7 +234,7 @@ ldap_back_map_attrs(
 
        for (i = j = 0; an[i].an_name.bv_val; i++) {
                ldap_back_map(at_map, &an[i].an_name, &mapped, remap);
-               if (mapped.bv_val != NULL)
+               if (mapped.bv_val != NULL && mapped.bv_val != '\0')
                        na[j++] = mapped.bv_val;
        }
        if (j == 0 && i != 0)
index d2c0ea8b83c13b3af4f17377fe923f81205b2aee..5cb19e5175acf2a71b6f738bb7afb7904fb017f5 100644 (file)
@@ -120,7 +120,7 @@ ldap_back_modify(
 
                ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped,
                                BACKLDAP_MAP);
-               if (mapped.bv_val == NULL) {
+               if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
                        continue;
                }
 
index 1b672ef4de8350dc784ae8a132d6424318efc18f..61ce46deedd859847023f76e099af72056e933fd 100644 (file)
@@ -155,7 +155,7 @@ meta_back_add(
 
                ldap_back_map( &li->targets[ candidate ]->at_map,
                                &a->a_desc->ad_cname, &mapped, BACKLDAP_MAP );
-               if ( mapped.bv_val == NULL ) {
+               if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) {
                        continue;
                }
 
index c3f9d6e5b99af42d90e84de6613c5a7d8897dffb..679f65ed7cb8b9d3198f0d46c3443cfab59cbf9d 100644 (file)
@@ -141,7 +141,7 @@ meta_back_attribute(
 
        ldap_back_map( &li->targets[ candidate ]->at_map,
                        &entry_at->ad_cname, &mapped, BACKLDAP_MAP );
-       if ( mapped.bv_val == NULL )
+       if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' )
                return 1;
 
        rc =  ldap_initialize( &ld, li->targets[ candidate ]->uri );
@@ -182,7 +182,7 @@ meta_back_attribute(
                                                        }
                                                } else {
                                                        ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, BACKLDAP_REMAP );
-                                                       if ( mapped.bv_val ) {
+                                                       if ( mapped.bv_val && mapped.bv_val[0] != '\0' ) {
                                                                ber_dupbv( &v[ j ], &mapped );
                                                                if ( v[ j ].bv_val ) {
                                                                        j++;
index 990ff8bc9c94f8dd90c5673f9c5dadea2957b0df..632a72448938d7e3dce450bca568a9ca520bea2f 100644 (file)
@@ -223,12 +223,12 @@ meta_back_group(
        
        ldap_back_map( &li->targets[ candidate ]->oc_map,
                        &group_oc_name, &group_oc_name, BACKLDAP_MAP );
-       if ( group_oc_name.bv_val == NULL ) {
+       if ( group_oc_name.bv_val == NULL || group_oc_name.bv_val[0] == '\0' ) {
                goto cleanup;
        }
        ldap_back_map( &li->targets[ candidate ]->at_map,
                        &group_at_name, &group_at_name, BACKLDAP_MAP );
-       if ( group_at_name.bv_val == NULL ) {
+       if ( group_at_name.bv_val == NULL || group_at_name.bv_val[0] == '\0' ) {
                goto cleanup;
        }
 
index 773b5bdb07a73585e94ad16eec0ccd27985d8c98..01fec49787949fe77839ed497f18c52dcd08cc12 100644 (file)
@@ -160,7 +160,7 @@ meta_back_modify(
                ldap_back_map( &li->targets[ candidate ]->at_map,
                                &ml->sml_desc->ad_cname, &mapped,
                                BACKLDAP_MAP );
-               if ( mapped.bv_val == NULL ) {
+               if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) {
                        continue;
                }