Re: pack it in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 24, 2008 6:20 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:

> someone asked about checksum values in another thread, I believe
> he got his answer no thanks to me. but whilst I was trying to help
> I got stuck playing with pack/unpack.
>
> so now I have the broadbrush question of what would one use
> pack/unpack for? can anyone point at some realworld examples/code that
> might help me broaden my horizons?


here is an awesome one.
so for ldap, you have to ensure data meets a specific 'format' for
all the different 'syntax'es it supports.  these are each represented
by a particular syntax oid, and the syntax is written in backus noir form.
i wish i could say its reasonable to cipher out the syntax of those things,
but then id be lying; at least for me, i struggle .. =/
anyways; for the password field, you have to supply ldap an appropriate
syntax.
the field has this syntax oid
1.3.6.1.4.1.1466.115.121.1.40
which is described as an Octet String.
in order to get a password into ldap, i had to use the following
$attrs['userPassword'] = '{MD5}' . base64_encode(pack('H*', $userPassword));

per this article:
http://logout.sh/computers/ldap/

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux