Hello again,
Since Graham did such a great job with my last question I thought I
would throw another one at you all.
I am trying to add a user to the ldap server. All I want the admin
person to supply is the username and have the program build the DN and
add the person from that. The problem is that I keep getting LDAP
ENCODING ERRORS no matter how I try to format the data. So this is
probably something real simple. At any rate here is the code.
$suffix = "ou=People,dc=searhc,dc=org,o=internet";
$dn = qq("CN="$firstname $lastname ($findname)", $suffix");
$ldapadd = Net::LDAP::Entry->new;
$ldapadd->add(
dn => $dn,
attr => [ 'inetOrgPerson',
'inetMailUser',
'person',
'imCalendarUser',
'inetSubscriber',
'inetMailRouting'],
'inetauthorizedservices' => ['smtp',
'imap',
'pop3',
'pop3s',
'sunw_webaccess',
'sunw_calendar'],
'cn' => $quotedname,
'sn' => $quotedlastname,
'name' => $quotedname,
'givenname' => $quotedfirstname,
'mai' => $mailaddress,
'uid' => $quotedusername,
'maildeliveryoption' => 'mailbox',
'mailhost' => '$host',
'imcalendarhost' => '$calendarhost',
'imcalendaruserversion' => '1.0',
'imcalendername' => $quotedusername,
'inetmailuserversion' => '1.0',
'inetsubscriberstatus' => 'active',
'datasource' => 'imldifsync 4.0.149',
'mailfoldermap' => 'SUN-MS']
);
$mesg = $ldapadd->update($connection);
warn ldap_error_name($mesg->code) if $mesg->code;
warn ldap_error_text($mesg->code) if $mesg->code;
I know that I can probably stuff my object class data and the
inetauthorized services into an array and pass it like this,
'objectclass' => @objectclass
and I probably will once I get this working. So what else am I doing
wrong. Thanks in advance for any help, it is greatly appreciated.
--
Brian Avis
SEARHC Medical Clinic
Juneau, AK 99801
(907) 463-4049
If nautical nonsense be something you wish.
Then drop on the deck and flop like a fish.
|