Re: [PHP-DEV] Bug #3613: ldap_mod_replace does not handle binary values properly From: Andi Gutmans (andi <email protected>)
Date: 02/24/00

 From looking at the ldap.c source code and not having written the ldap
module myself it does seem that ldap_modify does not handle binary data. I
am including a small paragraph from the ldap_modify man page at the end of
this letter which gives a short pointer on what to do with binary data.
Parts of the LDAP module actually do seem to work this way so maybe you
need to use a different function. I'm Cc'ing the authors of the LDAP
module. They might be able to enlighten us on this issue.

Andi

 From the OpenLDAP ldap_modify man page:

---
  If you need to specify a non-string value (e.g., to add a photo or audio 
attribute value), you should set mod_op to the logical OR of the operation 
as above (e.g., LDAP_MOD_REPLACE) and the 
constant  LDAP_MOD_BVALUES.   In  this case, mod_bvalues should be used 
instead of mod_values, and it should point to a null-terminated array of 
struct bervals, as defined in <lber.h>.

At 10:18 PM 2/24/00 +0000, rb <email protected> wrote: >From: rb <email protected> >Operating system: Linux 2.2.13 - glibc2.1 >PHP version: 3.0.14 >PHP Bug Type: LDAP related >Bug description: ldap_mod_replace does not handle binary values properly > >$fd = fopen( $file, "r" ); >$contents = fread( $fd, filesize( $file) ); >fclose( $fd ); > >$ds=ldap_connect("-----------"); >$r=ldap_bind($ds,"--------------","------"); >ldap_mod_replace($ds, $searchroot, array ( $attr => $contents)); >ldap_close($ds); > >--- > >./configure --disable-debug --with-apache=/usr/src/apache_1.3.11 >--without-gd --with-ftp --with-mysql --with-rege >x=apache --enable-trans-sid --with-ldap=/usr/local --enable-track-vars > >--- > >in config.h i undefined HAVE_GETRUSAGE, so it would finally compile... > >--- > >I would want to store gif/jpeg images uploaded via http post into my LDAP >directory, but it won't do it... probably it's because of the usage of >string functions, again... it just stores several bytes... then cuts >off... using the comandline ldap-toys works fine > > > > >-- >PHP Development Mailing List <http://www.php.net/> >To unsubscribe, e-mail: php-dev-unsubscribe <email protected> >For additional commands, e-mail: php-dev-help <email protected> >To contact the list administrators, e-mail: php-list-admin <email protected>

--- Andi Gutmans <andi <email protected>> http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>