Re: [PHP] pack it in



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


Relevant Pages

  • Re: How do I filter an Active Directory search to an OU (organizational unit)?
    ... > DirectoryEntry entry = new DirectoryEntry ... I think the easiest thing to do here would be to refine your LDAP string. ... (LDAP syntax is confusing because several different looking syntaxes are ... Although you might find you don't need your filter anymore. ...
    (microsoft.public.dotnet.security)
  • Re: ADAMsync Object Class Violation
    ... LDAP queries are fine, but I have to use XML ... on the AD account that doesn't exist in ADAM. ... complained about syntax. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Entourage with Directory services using Microsoft ADAM
    ... to list users. ... LDAP client that objects should or should not be returned. ... able to return results with Entourage by using our Domain ... LDAP syntax is LDAP syntax regardless of what computer platform you're using. ...
    (microsoft.public.mac.office.entourage)
  • Re: ldap and autofs
    ... I ran into a similar issue with SLES9 and ldap automount maps, ... The syntax you used above was in Netscape ... Netscape and NIS formats not the latest schema. ...
    (linux.redhat)
  • Whats the correct Validation Expression Syntax?
    ... I'm having a password field which should contain at least one ... character a-z AND at least one number 0-9. ... syntax, have tried something like the one below and variations of it ... Martin ...
    (microsoft.public.dotnet.framework.aspnet)