Guest User

Untitled

a guest
Jan 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <?php
  2. // Set the ldap server
  3. $ldapurl = "[snipped]";
  4. $ldapuser = "[snipped]";
  5. $ldappass = "[snipped]";
  6. // Set the debug flag
  7. $debug = true;
  8.  
  9. // Set debugging
  10. if ($debug) {
  11. ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
  12. }
  13.  
  14. // connect to ldap server
  15. echo "Trying to connect<br/>";
  16. echo "1: " . date('l jS of F Y h:i:s A') . "<br/>";
  17. $ldapconn = ldap_connect($ldapurl) or die ("Couldn't connect");
  18. echo "2: " . date('l jS of F Y h:i:s A') . "<br/>";
  19.  
  20. // binding to ldap server
  21. echo "Trying to bind with $ldapuser - $ldappass<br/>";
  22. echo "3: " . date('l jS of F Y h:i:s A') . "<br/>";
  23. $ldapbind = @ldap_bind($ldapconn, $ldapuser, $ldappass);
  24. echo "4: " . date('l jS of F Y h:i:s A') . "<br/>";
  25.  
  26. if (!$ldapbind) {
  27. echo "Unable to bind to server $ldapurln";
  28. echo "OpenLdap error message: " . ldap_error($ldapconn) . "n";
  29. exit;
  30. }
  31.  
  32. // Rest of code goes here
  33.  
  34. ?>
  35.  
  36. authconfig --enableldap --enableldapauth --forcelegacy=yes --ldapserver=myldapserver.com --ldapbasedn="dc=example,dc=com" --update
Add Comment
Please, Sign In to add comment