]> git.sur5r.net Git - openldap/commitdiff
Fix segfault if entry_get is called with NULL attribute
authorHoward Chu <hyc@openldap.org>
Sat, 20 Sep 2003 07:48:57 +0000 (07:48 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 20 Sep 2003 07:48:57 +0000 (07:48 +0000)
servers/slapd/back-bdb/id2entry.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldbm/entry.c

index c97feb26849b5ea10d58a7a64cbfa4cb3fd31284..865e4da3d62badb69426718d4b2b119092dd1d33 100644 (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;
index 0784c1ed5174d702946e516c54693ce20c632b99..b00cd663d6660f7cd998557f0cc9e81ea097b8fe 100644 (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);
index 33edb9bfc35558a721fc6d4622574f4f408b271b..a3f15e7771889151186a98772505d49c7ad2be9d 100644 (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,