[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_mod_add() (creating attributes)



hello,

Thank you for the reply, however I get the same
problem.  I might be misunderstanding something
fundemental, though.

I need to deal with a form that outputs fields, lets
say "firstname" and "lastname".  In PHP, I get an
array, HTTP_POST_VARS, which has elements "firstname"
and "lastname".  I want to be able to, if possible,
simply do something like this:

ldap_add($ldap, $dn, $HTTP_POST_VARS);

When I do this, however, I get the "Undefined
attribute type" error, which I presume, is because
slapd is looking for elements named "cn" and "sn".  I
would expect that the following:

$newattribs[0] = "firstname";
$newattribs[1] = "lastname";
ldap_add_mod($ldap, $dn, $newattribs);

would add two attributes to my current entry (DN),
allowing the above ldap_add() call to function as if
$HTTP_POST_VARS had elements "cn" and "sn", instead of
what it actually contains, "firstname" and "lastname".
 

Ideally, I would be able to add these two new
attributes to my tree 'globally', so I could just
continue using ldap_add() and not have the need for
ldap_add_mod() for each entry (DN).

Does any of this make any sense, or am I totally off
with LDAP's structure and the way things work. (I've
read the basics, however am new to it and don't know
if I have all the concepts down yet.)

Thank you very much,

Hans Zauner
refuzun@yahoo.com



--- Adam Tauno Williams <adam@morrison-ind.com> wrote:
> >I'm in the process of writing a PHP web-based
> frontend
> >for our OpenLDAP server.
> 
> Hey, me too.  What a coincidence...
> 
> >I realize that if I try to add an entry with an
> >attribute (such as firstname) it returns with an
> error
> >that that attribute doesn't exist.  
> 
>   $ds=ldap_connect("littleboy.morrison.iserv.net");
>   $r=ldap_bind($ds, "cn=Manager, o=Morrison
> Industries, c=US", "secret");
>   $dn = "cn=$cn,ou=Groups,o=Morrison
> Industries,c=US";
>   $add_entries["memberuid"] = $uid;
>   ldap_mod_add($ds, $dn, $add_entries);
>   ldap_close($ds);
> 
> Systems and Network Administrator
> Morrison Industries
> 1825 Monroe Ave NW.
> Grand Rapids, MI. 49505


__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/