<html><body bgcolor="#FFFFFF"><div>The base dn is where to search from</div><div><br></div><div>The bind dn is used when authenticating an account for secure ldap</div><div><br></div><div>I think<br><br>On 23 Oct 2011, at 21:44, "Thomas Rochford" <<a href="mailto:thomas.rochford@cambridge-serendipity.com">thomas.rochford@cambridge-serendipity.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div class="WordSection1"><p class="MsoPlainText">HI,<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">I've been able to get some more testing done on this and have now got the following information via 'echo' statements in the login scripts. (NB the actual value used by the institution has been replaced by 'zzz' and the actual username by '1234'). We're using XoT 1.7<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">[config.php] xerte_toolkits_site->basedn: OU= Staff, OU= ZZZ_Users, DC=zzz, DC=lan; Attempting authentication ...<o:p></o:p></p><p class="MsoPlainText">// This shows that the basedn is being read correctly from the MySQL database before the call to 'valid_login()' from index.php.<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">[login_library.php - valid_login()] host['ldap_basedn']: OU= Staff,OU= ZZZ_Users,DC=zzz,DC=lan; OU=ZZZ_Users,DC=zzz,DC=lan; OU=ZZZ_AdminAccounts,DC=zzz,DC=lan<o:p></o:p></p><p class="MsoPlainText">// However when the function is invoked the basedn has grown and now includes the bind_dn (ZZZ_AdminAccounts)<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">[login_library.php - authenticate_to_host()] LDAP bind successful to ldap://172.16.8.47 // The script thinks it is able to bind successfully to the internal address of the ldap server on the LAN (this is all that is required at present)<o:p></o:p></p><p class="MsoPlainText">     Search: 1234...<o:p></o:p></p><p class="MsoPlainText">// The string '1234' has been substituted for the actual username sought for the purposes of this email<o:p></o:p></p><p class="MsoPlainText">     BaseDN: OU= Staff,OU= ZZZ_Users,DC=zzz,DC=lan; OU=ZZZ_Users,DC=zzz,DC=lan; OU=ZZZ_AdminAccounts,DC=zzz,DC=lan<o:p></o:p></p><p class="MsoPlainText">// The BaseDN has been has handed over to the function as passed, although, of course, it is still incorrect // the call is being made from the block at the end of the routine which uses parameters grabbed from the mysql database by the following call<o:p></o:p></p><p class="MsoPlainText">//            while($host = mysql_fetch_array($ldap_hosts))<o:p></o:p></p><p class="MsoPlainText">// rather than reading them from the values already stored in $xerte_toolkits_site->basedn.<o:p></o:p></p><p class="MsoPlainText">// I'm not sure why this should be<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">     Filter: sAMAccountName=1234<o:p></o:p></p><p class="MsoPlainText">// ... and the Filter string is being passed correctly and has the correct field ' sAMAccountName'.<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">[login_library.php - authenticate_to_host()] Login Failed (295) // The username *IS* visible in the Active directory tree although not in the AdminAccounts container - this is only used for the 'bind' account.<o:p></o:p></p><p class="MsoPlainText">// However the login is failing at this point<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">I don't know much about Active directory but I'm not sure how well it can cope with multiple BaseDNs. Could this be why the search is failing? How/where is the bind_dn getting attached to the base_dn? <o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">Any help or suggestions would be really appreciated!<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:EN-GB">Kindest Regards,<br>Thomas<br>_____________________________________________<br>Eml: <a href="mailto:thomas.rochford@cambridge-serendipity.com"><span style="color:blue">thomas.rochford@cambridge-serendipity.com</span></a><br>Web: <a href="http://www.cambridge-serendipity.com/"><span style="color:blue">http://www.cambridge-serendipity.com/</span></a><o:p></o:p></span></p><p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:EN-GB">Skype: cambridge.serendipity<br>Mob: 07500 669 002<br>Fax: 01223 563142 <br></span><span style="font-family:"Arial","sans-serif";color:silver;mso-fareast-language:EN-GB"><image001.jpg></span><b><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#99CC00;mso-fareast-language:EN-GB"> </span></b><b><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#99CC00;mso-fareast-language:EN-GB">Please consider your environmental responsibility before printing this e-mail</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#969696;mso-fareast-language:EN-GB"><o:p></o:p></span></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">-----Original Message-----<o:p></o:p></p><p class="MsoPlainText">From: <a href="mailto:xerte-bounces@lists.nottingham.ac.uk"><a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a></a> <a href="mailto:[mailto:xerte-bounces@lists.nottingham.ac.uk]">[mailto:xerte-bounces@lists.nottingham.ac.uk]</a> On Behalf Of Pat Lockley<o:p></o:p></p><p class="MsoPlainText">Sent: 22 September 2011 17:32<o:p></o:p></p><p class="MsoPlainText">To: Xerte discussion list<o:p></o:p></p><p class="MsoPlainText">Subject: [Xerte] Re: Bug in XOT 1.7 ldap authentication<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">ooops, if only it didn't say eureka_site i could have blamed some one else.<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">the ldap table should come in version 1.7?<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">Is your install without an ldap table (as this removes the $$$ ugliness)? The installer should add one entry to the ldap table (if entered in the installer).<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">I haven't got an ldap to test against anymore, but I would suggest altering the code within valid login so as to leave authenticate to host valid in case you switch to the ldap table (in future, assuming the same bug isn't there).<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">Pat<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">On Thu, Sep 22, 2011 at 5:19 PM,  <<a href="mailto:C.J.Fryer@lse.ac.uk"><a href="mailto:C.J.Fryer@lse.ac.uk">C.J.Fryer@lse.ac.uk</a></a>> wrote:<o:p></o:p></p><p class="MsoPlainText">> Hello<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> I think I've found a bug in the LDAP Authentication code in Xerte <o:p></o:p></p><p class="MsoPlainText">> Online Toolkits version 1.7.  When I try to log in with my LDAP <o:p></o:p></p><p class="MsoPlainText">> credentials, I get a blank screen.  If I turn on error_reporting in <o:p></o:p></p><p class="MsoPlainText">> config.php, I see the following errors in the log:<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> "PHP Warning:  Missing argument 9 for authenticate_to_host(), called <o:p></o:p></p><p class="MsoPlainText">> in \xertenew\website_code\php\login_library.php on line 448 and <o:p></o:p></p><p class="MsoPlainText">> defined in \xertenew\website_code\php\login_library.php on line 270"<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> "PHP Warning:  Missing argument 10 for authenticate_to_host(), called <o:p></o:p></p><p class="MsoPlainText">> in \xertenew\website_code\php\login_library.php on line 448 and <o:p></o:p></p><p class="MsoPlainText">> defined in \xertenew\website_code\php\login_library.php on line 270"<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> In our database, sitedetails.ldap_host contains a $$$-separated list <o:p></o:p></p><p class="MsoPlainText">> of directory servers, rather than anything in a table called "ldap".  <o:p></o:p></p><p class="MsoPlainText">> So this places us in a particular branch within function valid_login().<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> Line 448 of website_code\php\login_library.php is:<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> $login_check =<o:p></o:p></p><p class="MsoPlainText">> authenticate_to_host($host[$x],$port[$x],$bind_pwd[$x],$basedn[$x],$bi<o:p></o:p></p><p class="MsoPlainText">> nd<o:p></o:p></p><p class="MsoPlainText">> _dn[$x],$username,$password,$xerte_toolkits_site)<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> But the function authenticate_to_host on line 270 expects 10 <o:p></o:p></p><p class="MsoPlainText">> arguments, and they are in a different order:<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> function<o:p></o:p></p><p class="MsoPlainText">> authenticate_to_host($host,$port,$bind_pwd,$bind_dn,$basedn,$ldap_filt<o:p></o:p></p><p class="MsoPlainText">> er<o:p></o:p></p><p class="MsoPlainText">> ,$ldap_filter_attr,$eureka_username,$password,$eureka_site)<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> I am not sure whether it would be better to modify valid_login() so it <o:p></o:p></p><p class="MsoPlainText">> passes the correct arguments, or authenticate_to_host() itself, so the <o:p></o:p></p><p class="MsoPlainText">> arguments are handled differently.<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> Chris<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> Please access the attached hyperlink for an important electronic <o:p></o:p></p><p class="MsoPlainText">> communications disclaimer: <a href="http://lse.ac.uk/emailDisclaimer"><a href="http://lse.ac.uk/emailDisclaimer">http://lse.ac.uk/emailDisclaimer</a></a><o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> _______________________________________________<o:p></o:p></p><p class="MsoPlainText">> Xerte mailing list<o:p></o:p></p><p class="MsoPlainText">> <a href="mailto:Xerte@lists.nottingham.ac.uk"><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a></a><o:p></o:p></p><p class="MsoPlainText">> <a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte"><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a></a><o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">> This message has been checked for viruses but the contents of an <o:p></o:p></p><p class="MsoPlainText">> attachment may still contain software viruses which could damage your computer system:<o:p></o:p></p><p class="MsoPlainText">> you are advised to perform your own checks. Email communications with <o:p></o:p></p><p class="MsoPlainText">> the University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText">><o:p> </o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">_______________________________________________<o:p></o:p></p><p class="MsoPlainText">Xerte mailing list<o:p></o:p></p><p class="MsoPlainText"><a href="mailto:Xerte@lists.nottingham.ac.uk"><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a></a><o:p></o:p></p><p class="MsoPlainText"><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte"><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a></a><o:p></o:p></p><p class="MsoPlainText">This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoPlainText">This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system:<o:p></o:p></p><p class="MsoPlainText">you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></p><p class="MsoPlainText"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><span style="font-size:10.0pt;color:#1F497D;mso-fareast-language:EN-GB"><o:p> </o:p></span></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:EN-GB"><o:p> </o:p></span></p><p class="MsoNormal"><o:p> </o:p></p></div><br>
<p>
This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, 
copy or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.
</p>
<p>
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
</p>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Xerte mailing list</span><br><span><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a></span><br><span><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a></span><br><span></span><br><span>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.</span><br><span></span><br><span>This message has been checked for viruses but the contents of an attachment</span><br><span>may still contain software viruses which could damage your computer system:</span><br><span>you are advised to perform your own checks. Email communications with the</span><br><span>University of Nottingham may be monitored as permitted by UK legislation.</span><br><span></span><br></div></blockquote></body></html>