Closed Bug 1387 Opened 26 years ago Closed 26 years ago

Bug in API.xs handling zero-value attributes

Categories

(Directory :: PerLDAP, defect, P1)

All
Solaris
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: leif, Assigned: leif)

Details

From: Dave Carrigan <Dave.Carrigan@cnpl.enbridge.com> 2. There are some really brain dead LDAP servers out there (e.g. Lotus Domino) that list all of the attributes that an entry can potentially have, even if the entry doesn't actually have values for some of the attributes. What this means is that ldap_next_attribute will return an attribute name, but ldap_get_values on that attribute will return NULL. The RET_CPP and RET_BVPP macros in API.xs don't check for null pointers, which results in a core dump. The attached API.xs.patch fixes that. Index: API.xs =================================================================== RCS file: /cvsroot/mozilla/directory/perldap/API.xs,v retrieving revision 1.15.2.1 diff -u -b -u -r1.15.2.1 API.xs --- API.xs 1998/09/20 03:21:55 1.15.2.1 +++ API.xs 1998/10/28 19:52:25 @@ -70,22 +70,24 @@ /* Return a Perl List from a char ** in PPCODE */ #define RET_CPP(cppvar) \ int cppindex; \ + if (cppvar) { \ for (cppindex = 0; cppvar[cppindex] != NULL; cppindex++) \ { \ EXTEND(sp,1); \ PUSHs(sv_2mortal(newSVpv(cppvar[cppindex],strlen(cppvar[cppindex])))); \ } \ - ldap_value_free(cppvar) + ldap_value_free(cppvar);} /* Return a Perl List from a berval ** in PPCODE */ #define RET_BVPP(bvppvar) \ int bvppindex; \ + if (bvppvar) { \ for (bvppindex = 0; bvppvar[bvppindex] != NULL; bvppindex++) \ { \ EXTEND(sp,1); \ PUSHs(sv_2mortal(newSVpv(bvppvar[bvppindex]->bv_val,bvppvar[bvppindex]->bv_len))); \ } \ - ldap_value_free_len(bvppvar) + ldap_value_free_len(bvppvar);} /* Return a char ** when passed a reference to an AV */ char ** avref2charptrptr(SV *avref)
Priority: P2 → P1
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Ok, applied the included patch, I hope it will work. :)
QA Contact: 3849
asking Dave.Carrigan@cnpl.enbridge.com to verify the fix
requested incorrect person to verify bug / supply test case for verification. Leif, can you either verify the bug or supply me with a test case?
requested incorrect person to verify bug / supply test case for verification. Leif, can you either verify the bug or supply me with a test case?
still wiating to hear from Leif
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.