cleanup null mapping detection

This commit is contained in:
Pierangelo Masarati 2003-01-27 21:34:25 +00:00
parent 4f64bd9402
commit 71e35141e1
8 changed files with 16 additions and 15 deletions

View 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++;

View 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=)(=))")

View 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)

View 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;
}

View 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;
}

View 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++;

View 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;
}

View 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;
}