For Programmers: Free Programming Magazines  


Home > Archive > LDAP > November 2005 > invalid dn error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author invalid dn error
Ronan

2005-11-10, 7:07 pm

this is the output.

ronan@engraver:~$ ./ldap.pl
cn=ronan, ou=Distribution Lists, ou=Mail System, o=Queens University
Belfast, c=GB
failed to add entry:
Invalid DN syntax at ./ldap.pl line 97, <DATA> line 225.


the DN as you see above is correct.
Im binding as the Directory manager.
just cpan'ed 0.33

code follows

use Net::LDAP;
..
..
$ldap = Net::LDAP -> new($ldap_host,port=>$ldap_port)or die "$@";
$mesg = $ldap->bind(dn=>$bind_dn,password=>$bind_pw)or die "$@";
..
..

$list{'entry'} = {
'objectClass' => ["top","mjDistributionList"],
'cn' => ["ronan"],
'mj_admin_passwd' => ["ronan.admin"],
'mj_moderate' => ["TRUE"],
'owner' => [$list_owner],
'description' => ["aut mailing list"],
'mj_approve_passwd' => ["aut.approve"],
'mj_submit_policy' => ["restricted"],
'mj_subscribe_policy' => ["closed"],
'mj_restrict_post' => \@senders,
'mj_DLMembers' => ["r.mcglue $ main"]
};


..
..
..

$result = $ldap->add(dn => $dn,$list{'entry'});
if ($result != LDAP_SUCCESS){
$result->code;
warn "failed to add entry:\n ", $result-> error; <--- this is line 97
(from above)
} else {
print "Added $rdn successfully\n";
};


can anyone suggest why this isnt working? is there anything obvious here?
thanks
Ronan
Chris Ridd

2005-11-10, 7:07 pm

On 10/11/05 10:35, Ronan <r.mcglue@qub.ac.uk> wrote:

> this is the output.
>
> ronan@engraver:~$ ./ldap.pl
> cn=ronan, ou=Distribution Lists, ou=Mail System, o=Queens University
> Belfast, c=GB
> failed to add entry:
> Invalid DN syntax at ./ldap.pl line 97, <DATA> line 225.
>
>
> the DN as you see above is correct.
> Im binding as the Directory manager.
> just cpan'ed 0.33
>
> code follows
>
> use Net::LDAP;
> .
> .
> $ldap = Net::LDAP -> new($ldap_host,port=>$ldap_port)or die "$@";
> $mesg = $ldap->bind(dn=>$bind_dn,password=>$bind_pw)or die "$@";
> .
> .
>
> $list{'entry'} = {
> 'objectClass' => ["top","mjDistributionList"],
> 'cn' => ["ronan"],
> 'mj_admin_passwd' => ["ronan.admin"],
> 'mj_moderate' => ["TRUE"],
> 'owner' => [$list_owner],
> 'description' => ["aut mailing list"],
> 'mj_approve_passwd' => ["aut.approve"],
> 'mj_submit_policy' => ["restricted"],
> 'mj_subscribe_policy' => ["closed"],
> 'mj_restrict_post' => \@senders,
> 'mj_DLMembers' => ["r.mcglue $ main"]
> };
>
>
> .
> .
> .
>
> $result = $ldap->add(dn => $dn,$list{'entry'});
> if ($result != LDAP_SUCCESS){
> $result->code;
> warn "failed to add entry:\n ", $result-> error; <--- this is line 97
> (from above)
> } else {
> print "Added $rdn successfully\n";
> };
>
>
> can anyone suggest why this isnt working? is there anything obvious here?
> thanks
> Ronan


Hi Ronan,

Do any of the other attributes you're setting in the entry have a syntax of
DN? For instance, 'owner' is a standard attribute with DN syntax. I guess
the mj_* attribute are local definitions.

You might find you need to make your DN attribute values use the DN quoting
rules defined in RFC 2253, if you're constructing them from data that
contains "special" characters like "=", ",", ";" and some others listed in
that RFC. A look at line 225 of your input data would probably help.

Cheers,

Chris


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com