Re: svn commit: r1920247 - /apr/apr/trunk/ldap/apr_ldap.c
Ruediger Pluem <[email protected]> Wed, 28 Aug 2024 13:02:19 +0200
| Newsgroups | gmane.comp.apache.apr.devel |
|---|---|
| Message-ID | <[email protected]> |
On 8/28/24 12:41 PM, [email protected] wrote: > Author: minfrin > Date: Wed Aug 28 10:41:28 2024 > New Revision: 1920247 > > URL: http://svn.apache.org/viewvc?rev=1920247&view=rev > Log: > apr_ldap: Add support for RFC4522 binary encoding option. > > Modified: > apr/apr/trunk/ldap/apr_ldap.c > > Modified: apr/apr/trunk/ldap/apr_ldap.c > URL: http://svn.apache.org/viewvc/apr/apr/trunk/ldap/apr_ldap.c?rev=1920247&r1=1920246&r2=1920247&view=diff > ============================================================================== > --- apr/apr/trunk/ldap/apr_ldap.c (original) > +++ apr/apr/trunk/ldap/apr_ldap.c Wed Aug 28 10:41:28 2024 > @@ -1568,16 +1568,32 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_ > > if (vals) { > > - int k, nvals; > + int k, nvals, binary = 0; > + > + char *sc = attr; > + > + /* support for RFC4522 binary encoding option */ > + while ((sc = strchr(sc, ';'))) { > + if (!strcasecmp(sc, ";binary") && (sc[7] == 0 || sc[7] == ';')) { > + binary = 1; > + break; > + } > + } > > nvals = ldap_count_values_len(vals); > > for (k = 0; k < nvals; k++) { > > apr_buffer_t buf; > + char *str = NULL; > > - apr_buffer_mem_set(&buf, vals[k]->bv_val, vals[k]->bv_len); > -// fixme - tell cb if binary > + if (binary) { > + apr_buffer_mem_set(&buf, vals[k]->bv_val, vals[k]->bv_len); > + } > + else { > + str = strndup(vals[k]->bv_val, vals[k]->bv_len); Why do we need the strndup? > + apr_buffer_str_set(&buf, str, vals[k]->bv_len); > + } > > if (res->entry_cb.search) { > status = res->entry_cb.search(ldap, dn, res->nentries, nattrs, j, Regards RĂ¼diger