mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
cleanup null mapping detection
This commit is contained in:
parent
4f64bd9402
commit
71e35141e1
@ -64,7 +64,7 @@ ldap_back_attribute(
|
|||||||
|
|
||||||
}
|
}
|
||||||
ldap_back_map(&li->at_map, &entry_at->ad_cname, &mapped, BACKLDAP_MAP);
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ ldap_back_attribute(
|
|||||||
} else {
|
} else {
|
||||||
ldap_back_map(&li->oc_map, &v[j], &mapped,
|
ldap_back_map(&li->oc_map, &v[j], &mapped,
|
||||||
BACKLDAP_REMAP);
|
BACKLDAP_REMAP);
|
||||||
if (mapped.bv_val) {
|
if (mapped.bv_val && mapped.bv_val[0] != '\0') {
|
||||||
ber_dupbv( &v[j], &mapped );
|
ber_dupbv( &v[j], &mapped );
|
||||||
if (v[j].bv_val)
|
if (v[j].bv_val)
|
||||||
j++;
|
j++;
|
||||||
|
@ -156,11 +156,11 @@ ldap_back_group(
|
|||||||
|
|
||||||
ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name,
|
ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name,
|
||||||
BACKLDAP_MAP);
|
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;
|
goto cleanup;
|
||||||
ldap_back_map(&li->at_map, &group_at_name, &group_at_name,
|
ldap_back_map(&li->at_map, &group_at_name, &group_at_name,
|
||||||
BACKLDAP_MAP);
|
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;
|
goto cleanup;
|
||||||
|
|
||||||
filter = ch_malloc(sizeof("(&(objectclass=)(=))")
|
filter = ch_malloc(sizeof("(&(objectclass=)(=))")
|
||||||
|
@ -174,10 +174,11 @@ ldap_back_map_filter(
|
|||||||
tmp.bv_len = p - q;
|
tmp.bv_len = p - q;
|
||||||
tmp.bv_val = q;
|
tmp.bv_val = q;
|
||||||
ldap_back_map(at_map, &tmp, &m, remap);
|
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);
|
ldap_back_map(oc_map, &tmp, &m, remap);
|
||||||
if (m.bv_val == NULL) {
|
if (m.bv_val == NULL || m.bv_val[0] == '\0') {
|
||||||
m = tmp;
|
m = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extra += p - q;
|
extra += p - q;
|
||||||
plen = m.bv_len;
|
plen = m.bv_len;
|
||||||
@ -233,7 +234,7 @@ ldap_back_map_attrs(
|
|||||||
|
|
||||||
for (i = j = 0; an[i].an_name.bv_val; i++) {
|
for (i = j = 0; an[i].an_name.bv_val; i++) {
|
||||||
ldap_back_map(at_map, &an[i].an_name, &mapped, remap);
|
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;
|
na[j++] = mapped.bv_val;
|
||||||
}
|
}
|
||||||
if (j == 0 && i != 0)
|
if (j == 0 && i != 0)
|
||||||
|
@ -120,7 +120,7 @@ ldap_back_modify(
|
|||||||
|
|
||||||
ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped,
|
ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped,
|
||||||
BACKLDAP_MAP);
|
BACKLDAP_MAP);
|
||||||
if (mapped.bv_val == NULL) {
|
if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ meta_back_add(
|
|||||||
|
|
||||||
ldap_back_map( &li->targets[ candidate ]->at_map,
|
ldap_back_map( &li->targets[ candidate ]->at_map,
|
||||||
&a->a_desc->ad_cname, &mapped, BACKLDAP_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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ meta_back_attribute(
|
|||||||
|
|
||||||
ldap_back_map( &li->targets[ candidate ]->at_map,
|
ldap_back_map( &li->targets[ candidate ]->at_map,
|
||||||
&entry_at->ad_cname, &mapped, BACKLDAP_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;
|
return 1;
|
||||||
|
|
||||||
rc = ldap_initialize( &ld, li->targets[ candidate ]->uri );
|
rc = ldap_initialize( &ld, li->targets[ candidate ]->uri );
|
||||||
@ -182,7 +182,7 @@ meta_back_attribute(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, BACKLDAP_REMAP );
|
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 );
|
ber_dupbv( &v[ j ], &mapped );
|
||||||
if ( v[ j ].bv_val ) {
|
if ( v[ j ].bv_val ) {
|
||||||
j++;
|
j++;
|
||||||
|
@ -223,12 +223,12 @@ meta_back_group(
|
|||||||
|
|
||||||
ldap_back_map( &li->targets[ candidate ]->oc_map,
|
ldap_back_map( &li->targets[ candidate ]->oc_map,
|
||||||
&group_oc_name, &group_oc_name, BACKLDAP_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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ldap_back_map( &li->targets[ candidate ]->at_map,
|
ldap_back_map( &li->targets[ candidate ]->at_map,
|
||||||
&group_at_name, &group_at_name, BACKLDAP_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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ meta_back_modify(
|
|||||||
ldap_back_map( &li->targets[ candidate ]->at_map,
|
ldap_back_map( &li->targets[ candidate ]->at_map,
|
||||||
&ml->sml_desc->ad_cname, &mapped,
|
&ml->sml_desc->ad_cname, &mapped,
|
||||||
BACKLDAP_MAP );
|
BACKLDAP_MAP );
|
||||||
if ( mapped.bv_val == NULL ) {
|
if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user