From: Pierangelo Masarati Date: Mon, 27 Jan 2003 21:34:25 +0000 (+0000) Subject: cleanup null mapping detection X-Git-Tag: NO_SLAP_OP_BLOCKS~486 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=71e35141e151b7ca602c7a4638c35260f65d946d;p=openldap cleanup null mapping detection --- diff --git a/servers/slapd/back-ldap/attribute.c b/servers/slapd/back-ldap/attribute.c index a3371a5be3..81f7788836 100644 --- a/servers/slapd/back-ldap/attribute.c +++ b/servers/slapd/back-ldap/attribute.c @@ -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++; diff --git a/servers/slapd/back-ldap/group.c b/servers/slapd/back-ldap/group.c index aa413b6648..79e67c6095 100644 --- a/servers/slapd/back-ldap/group.c +++ b/servers/slapd/back-ldap/group.c @@ -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=)(=))") diff --git a/servers/slapd/back-ldap/map.c b/servers/slapd/back-ldap/map.c index 7c46626bee..9a5fb497da 100644 --- a/servers/slapd/back-ldap/map.c +++ b/servers/slapd/back-ldap/map.c @@ -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) diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index d2c0ea8b83..5cb19e5175 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -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; } diff --git a/servers/slapd/back-meta/add.c b/servers/slapd/back-meta/add.c index 1b672ef4de..61ce46deed 100644 --- a/servers/slapd/back-meta/add.c +++ b/servers/slapd/back-meta/add.c @@ -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; } diff --git a/servers/slapd/back-meta/attribute.c b/servers/slapd/back-meta/attribute.c index c3f9d6e5b9..679f65ed7c 100644 --- a/servers/slapd/back-meta/attribute.c +++ b/servers/slapd/back-meta/attribute.c @@ -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++; diff --git a/servers/slapd/back-meta/group.c b/servers/slapd/back-meta/group.c index 990ff8bc9c..632a724489 100644 --- a/servers/slapd/back-meta/group.c +++ b/servers/slapd/back-meta/group.c @@ -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; } diff --git a/servers/slapd/back-meta/modify.c b/servers/slapd/back-meta/modify.c index 773b5bdb07..01fec49787 100644 --- a/servers/slapd/back-meta/modify.c +++ b/servers/slapd/back-meta/modify.c @@ -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; }