From ac9c6f004d1f2f721dd8730eeab850382f76d78c Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 16 Jun 2008 15:05:05 -0500 Subject: [PATCH] Bugfix LDAP config to play nice with Zebra. The section in KOHA_CONF was moved inside and renamed . Perldoc updated to correspond. Tested with local LDAP and existing test (t/db_dependent/Auth_with_ldap.t). Patch can be applied with confidence based on comparison of 2 dumps: perl -e 'use C4::Context; use Data::Dumper; my $context=C4::Context->new("./old_config.xml"); print Dumper ($context->{server}->{ldapserver}),"\n";' and perl -e 'use C4::Context; use Data::Dumper; my $context=C4::Context->new("./new_config.xml"); print Dumper (C4::Context->config("ldapserver")),"\n";' These dumps reflect the way Auth_with_ldap accesses configuration info before and after. Signed-off-by: Joshua Ferraro --- C4/Auth_with_ldap.pm | 57 +++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index fe8abfad4d..e6ed181630 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -20,6 +20,7 @@ package C4::Auth_with_ldap; use strict; use Digest::MD5 qw(md5_base64); +use C4::Debug; use C4::Context; use C4::Members qw(AddMember changepassword); use C4::Utils qw( :all ); @@ -30,8 +31,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); BEGIN { require Exporter; - $VERSION = 3.02; # set the version for version checking - $debug = $ENV{DEBUG} || 0; + $VERSION = 3.03; # set the version for version checking @ISA = qw(Exporter); @EXPORT = qw( checkpw_ldap ); } @@ -49,7 +49,7 @@ sub ldapserver_error ($) { use vars qw($mapping @ldaphosts $base $ldapname $ldappassword); my $context = C4::Context->new() or die 'C4::Context->new failed'; -my $ldap = $context->{server}->{ldapserver} or die 'No "ldapserver" in server hash from KOHA_CONF: ' . $ENV{KOHA_CONF}; +my $ldap = C4::Context->config("ldapserver") or die 'No "ldapserver" in server hash from KOHA_CONF: ' . $ENV{KOHA_CONF}; my $prefhost = $ldap->{hostname} or die ldapserver_error('hostname'); my $base = $ldap->{base} or die ldapserver_error('base'); $ldapname = $ldap->{user} or die ldapserver_error('user'); @@ -303,30 +303,33 @@ C4::Auth - Authenticates Koha users =head1 KOHA_CONF and field mapping -Example XML stanza for LDAP configuration in KOHA_CONF: - - - - localhost - dc=metavore,dc=com - cn=Manager,dc=metavore,dc=com - metavore - 1 - 1 - - - -
- Athens, OH - - MAIN - - - - PT - -
-
+Example XML stanza for LDAP configuration in KOHA_CONF. + + + ... + + + localhost + dc=metavore,dc=com + cn=Manager,dc=metavore,dc=com + metavore + 1 + 1 + + + +
+ Athens, OH + + MAIN + + + + PT + +
+
+
The subelements establish the relationship between mysql fields and LDAP attributes. The element name is the column in mysql, with the "is" characteristic set to the LDAP attribute name. Optionally, any content -- 2.39.5