Re: Bug #3613: ldap_mod_replace does not handle binary values properly
| From: | Andi Gutmans | Date: | Thu, 24 Feb 2000 22:39:34 +0000 |
| Subject: | Re: Bug #3613: ldap_mod_replace does not handle binary values properly | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-15964@lists.php.net to get a copy of this message | ||
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@odn.de wrote:
--- Andi Gutmans <andi@zend.com> http://www.zend.com/From: rb@odn.deOperating system: Linux 2.2.13 - glibc2.1PHP version: 3.0.14 PHP Bug Type: LDAP relatedBug 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@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net