Hi!

I'm not a perl expert (but i try to learn) but i've a question.

I have to install koha, a well-known library software written in perl.

I connect it to my ldap in order to get all borrowers with informations.

The connection is enabled but i'd like to change authentication method.


Here is my configuration in koha

Voici ma configuration

<hostname>******</hostname>
<base>ou=people,dc=ecp,dc=fr</base>
<user>cn=syncrepl,ou=applications,dc=ecp,dc=fr</user>
<pass>*****</pass>
<replicate>1</replicate>
<update>1</update>
<auth_by_bind>1</auth_by_bind>
<principal_name>uid=%s,ou=people,dc=ecp,dc=fr</principal_name>
<mapping>
<firstname is="givenname"></firstname>
<surname is="sn"></surname>
<address is="">Ecole Centrale Paris</address>
<city is="">Chatenay-Malabry</city>
<zipcode is="">92290</zipcode>
<branchcode is="">ECAM</branchcode>
<userid is="uid"></userid>
<password is="userpassword"></password>
<cardnumber is="ecpbadgenumber"></cardnumber>
<email is="mail"></email>
<categorycode is="supannetudiplome">employee</categorycode>
<phone is="telephonenumber">903-566-7654</phone>
<dateenrolled is="">2012-09-01</dateenrolled>
<dateexpiry is="">2013-09-01</dateexpiry>
</mapping>
</ldapserver>


Instead of using uid as userid, i 'd like to use "SupannAliasLogin" which
is an attribute of our ldap.
I can't make <userid="SupannAliasLogin">it will fail.

So, i think i have to change something in the module perl which manage the
connection with the ldap (i join the file)

I think that the change will be there in this part of the code (my $filter)
but i'm not very sure.

sub search_method {
my $db = shift or return;
my $userid = shift or return;
my $uid_field = $mapping{userid}->{is} or die ldapserver_error("mapping for
'userid'");
my $filter = Net::LDAP::Filter->new("$uid_field=$userid") or die "Failed to
create new Net::LDAP::Filter";
my $search = $db->search(
base => $base,
filter => $filter,
# attrs => ['*'],
) or die "LDAP search failed to return object.";
my $count = $search->count;
if ($search->code > 0) {
warn sprintf("LDAP Auth rejected : %s gets %d hits\n", $filter->as_string,
$count) . description($search);
return 0;
}
if ($count != 1) {
warn sprintf("LDAP Auth rejected : %s gets %d hits\n", $filter->as_string,
$count);
return 0;
}
return $search;
}

Many thanks

samuel

Attachment: Auth_with_ldap.pl
Description: Binary data

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

Reply via email to