Fix segfault if entry_get is called with NULL attribute

This commit is contained in:
Howard Chu 2003-09-20 07:48:57 +00:00
parent bb13266a15
commit 20902a2be3
3 changed files with 8 additions and 6 deletions

View file

@ -231,7 +231,7 @@ int bdb_entry_get(
Entry *e = NULL;
EntryInfo *ei;
int rc;
const char *at_name = at->ad_cname.bv_val;
const char *at_name = at ? at->ad_cname.bv_val : "(null)";
u_int32_t locker = 0;
DB_LOCK lock;

View file

@ -605,10 +605,12 @@ ldap_back_entry_get(
return 1;
}
ldap_back_map(&li->rwmap.rwm_at, &at->ad_cname, &mapped, BACKLDAP_MAP);
if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
rc = 1;
goto cleanup;
if ( at ) {
ldap_back_map(&li->rwmap.rwm_at, &at->ad_cname, &mapped, BACKLDAP_MAP);
if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
rc = 1;
goto cleanup;
}
}
is_oc = (strcasecmp("objectclass", mapped.bv_val) == 0);

View file

@ -62,7 +62,7 @@ int ldbm_back_entry_get(
struct ldbminfo *li = (struct ldbminfo *) op->o_bd->be_private;
Entry *e;
int rc;
const char *at_name = at->ad_cname.bv_val;
const char *at_name = at ? at->ad_cname.bv_val : "(null)";
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, ARGS,