It the env var DEBUG is enable, the LDAP auth fails.
Created attachment 21282 [details] [review] Bug 10925: LDAP auth fails if DEBUG is enable To reproduce: 1/ Edit your apache virtual host and set the DEBUG environment variable (SetEnv DEBUG 1). 2/ Try to login with an ldap user 3/ You will be redirected to the 500 error page. The Koha logs contains: malformed header from script. Bad header=------------------------------: mainpage.pl The hashdump routine directly punks to the STDOUT (!) and breaks the headers. It appears Net::LDAP::?->dump does the same thing.
Patch applied cleanly, go forth and signoff
Created attachment 21545 [details] [review] [SIGNED OFF] Bug 10925: LDAP auth fails if DEBUG is enable To reproduce: 1/ Edit your apache virtual host and set the DEBUG environment variable (SetEnv DEBUG 1). 2/ Try to login with an ldap user 3/ You will be redirected to the 500 error page. The Koha logs contains: malformed header from script. Bad header=------------------------------: mainpage.pl The hashdump routine directly punks to the STDOUT (!) and breaks the headers. It appears Net::LDAP::?->dump does the same thing. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment on attachment 21282 [details] [review] Bug 10925: LDAP auth fails if DEBUG is enable Figured out how to test this.... I set up an LDAP server on my koha VM: $ sudo apt-get install ldap-server $ sudo slapcat The second entry's 'dn' line will be important in setting up LDAP authentication. Made sure to set up the koha-conf.xml <useldapserver>1</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on --> <ldapserver id='ldapserver' listenref='ldapserver'> <hostname>demo.library.kohasystem.ca</hostname> <base>dc=nodomain</base> <user>CN=admin,OU=Special,OU=Accounts,DC=nodomain</user> <pass>ldap123</pass> <replicate>1</replicate> <update>1</update> <auth_by_bind>1</auth_by_bind> <principal_name>CN=%s,DC=nodomain</principal_name> <mapping> <firstname is='givenname'></firstname> <surname is='sn'> </surname> <address is='postaladdress'>3900 University Blvd</address> <city is='l'>Tyler, TX</city> <zipcode is='postalcode'>75799</zipcode> <branchcode is=''>MNL</branchcode> <userid is='cn'></userid> <password is=''></password> <cardnumber is='extensionattribute2'></cardnumber> <email is='userprincipalname'></email> <categorycode is=''>PT</categorycode> <phone is='telephonenumber'>903-566-7343</phone> <dateenrolled is=''>2011-03-27</dateenrolled> <dateexpiry is=''>2011-05-13</dateexpiry> </mapping> </ldapserver> It is important to get the patron type and branch code to match something in your DB. Notice the principle_name line is similar to the second entry's 'dn' line. And yes, I was lazy setting it up and used ldap123 as the password for the admin account. And since I didn't know how to set up any other accounts, I just used the admin account. I then proceeded to log in using OPAC. BEFORE PATCH: #SetEnv DEBUG 1 delete patron log in, log out, log in, log out (previously exist or not cases) -- ALL GOOD! SetEnv DEBUG 1 delete patron log in, log in (previously exist or not cases) -- ALL FAIL! AFTER PATCH: -- ALL GOOD! Signed off. YAY!
Created attachment 21685 [details] [review] Bug 10925: LDAP auth fails if DEBUG is enable To reproduce: 1/ Edit your apache virtual host and set the DEBUG environment variable (SetEnv DEBUG 1). 2/ Try to login with an ldap user 3/ You will be redirected to the 500 error page. The Koha logs contains: malformed header from script. Bad header=------------------------------: mainpage.pl The hashdump routine directly punks to the STDOUT (!) and breaks the headers. It appears Net::LDAP::?->dump does the same thing. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Maybe we can kill C4::Utils after getting rid of this
(In reply to Chris Cormack from comment #5) > Maybe we can kill C4::Utils after getting rid of this That's what 10927 does. I've signed it off. It is awaiting QA.
Pushed to master. Thanks, Jonathan!
This patch has been pushed to 3.12.x, will be in 3.12.7. Thanks Jonathan!