Hello,

I experienced a strange problem with following function and Net::LDAP

--- cut here ---

sub CreateLDAPentry {
my ($uid,$name,$vorname,$st) = @_;
my $salt="/%";
my $pwd=crypt($word, $salt);

my $ldap = Net::LDAP->new ("localhost",async => 0) or die "$@";

my $mesg = $ldap->bind ( "$LDAP_ADM_DN",
                          password => "$LDAP_ADM_PWD",
                          version => 3 );

my $DNbranch = "ou=freemail, dc=my, dc=domain";
my @CreateArray;
  $CreateArray = [
   objectClass => [ "top", "inetOrgPerson" ],
   uid => "$uid",
   cn => "$vorname $name",
   sn => "$name",
   gn => "$vorname",
   userPassword => "{crypt}$pwd",
   st => "$st",
   ];

my $NewDN = "[EMAIL PROTECTED], ".$DNbranch;

my $result = $ldap->add ( $NewDN, attrs => [ @$CreateArray ] );
if ($result->code) {
  LDAPerror ("CreateLDAPentry",$result);
  }
$ldap->unbind;
return 0;
}

--- cut here ---

User can enter german special characters for $name, $vorname or $st, eg.
Müller for name, but not for uid. After $ldap->add I get following error:

Return code: 21
Message: LDAP_INVALID_SYNTAX :Some part of the request contained an
invalid syntax. It could be a search
with an invalid filter or a request to modify the schema and the given
schema has a bad syntax.
MessageID: 29
DN:

uid was [EMAIL PROTECTED] and did not cause any problems while tested w/o
special characters in other attributes.

Any hints ?

best regards
Christian

Reply via email to