ldap - ldapmodify: invalid format (line 5) entry: " ... " on LDIF (passed from PHP) -


i'm attempting write bit of code allow users change expired active directory passwords via php web interface. due limitations php's ldap library's*, seems way generating ldif , passing directly ldapmodify.

the code i've come (minus vars) is:

ldapmodify -h {$ad_server} -d '{$dn}' -w {$old} <<! dn: {$dn} changetype: modify delete: unicodepwd unicodepwd:: {$oldpassword} - add: unicodepwd unicodepwd:: {$newpassword} - ! 

the code appears work fine when paste generated code straight in console, far i've had no luck running php.

i tried passing code exec, exitcode 247(which doesn't appear real thing)

i attempted use proc_open instead, provided current error

ldapmodify: invalid format (line 5) entry: " ... " 

so far can see thing on line 5 "-". i'm bit stuck wrong.

p.s. read post ldif file error?? invalid format? reported similar problem, although assuming encoding of "-" character issue, i'm not sure can php (mb_string_encoding whole string utf-8 doesn't appear have effect)

this running on solaris machine may factor.

*php unable perform 2 actions within single command, somthing required in order user password change in ad. (so far i'm aware)

edit: no sure why getting downvotes, i'd happy told i'm idiot if i'm doing patently stupid without noticing (so long point out is, i've been stuck on while now)

thanks #ldap channel on freenode turns out indeed idiot (especially considering i've been poking , prodding of day).

it seems ldapmodify not when ldif contains windows new line characters after "-" switching line endings windows unix in sublime has fixed problem me*.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -