Hi Everyone,
Does Scriptcase support the use of LDAPS instead of just LDAP? Does it require special configuration somewhere? I cannot get my LDAPS connection to properly bind.
Hi Everyone,
Does Scriptcase support the use of LDAPS instead of just LDAP? Does it require special configuration somewhere? I cannot get my LDAPS connection to properly bind.
Did you try it this way
$connect = ldap_connect('ldaps://'. $ldap_host. ':'. $ldap_port)
I have verified the port is open and tried the following code with no luck…
$login = {login};
$pswd = {pswd};
$options = array(
‘domain_controllers’ => array(‘LDAPS://servername’),
‘base_dn’ => ‘’,
‘account_suffix’ => ‘@name.com’,
‘admin_username’ => $login,
‘admin_password’ => $pswd,
‘ad_port’ => 636,
‘useSSL’ => True
);
$ldapConn = sc_ldap_login($options);
if($ldapConn === false)
{
//sc_log_add(‘Login Fail’, {lang_login_fail} . {login});
//sc_error_message({lang_error_login});
//sc_error_exit();
// $ldapErrorMessage = ldap_connect_error($ldapConn); // Retrieve the specific LDAP error message
die(“LDAP connection failed. Error”);
}
else
{
$user_filter = {login};
if(strpos($user_filter, “\”) !== false)
{
$user_filter = substr($user_filter, strpos($user_filter, “\”)+1);
}
$filter = “(|(samaccountname=”.$user_filter . “)(uid=”.$user_filter.")(userprincipalname=".$user_filter."))";
$dn = “”;
if(strpos($login, ‘=’) !== false)
{
$dn = $login;
$filter = “all”;
}
$result = sc_ldap_search($filter, array(‘mail’, ‘displayname’, ‘cn’, ‘givenname’), $dn);
[usr_login] = {login};
[usr_name] = {login};
if(isset($result[0]['displayname'][0]))
{
[usr_name] = $result[0]['displayname'][0];
}
elseif(isset($result[0]['cn'][0]))
{
[usr_name] = $result[0]['cn'][0];
}
elseif(isset($result[0]['givenname'][0]))
{
[usr_name] = $result[0]['givenname'][0];
}
[usr_email] = (isset($result[0]['mail'][0]) ? $result[0]['mail'][0] : '');
}
Don’t use sc_ldap_login use ldap_login directly
$ldap = @ldap_connect(ldaps://'. $ldap_host. ':'. $ldap_port);
$username = {login} . '@' . {domain};
$password = {pswd};
$bind = @ldap_bind($ldap, $username, $password);
If $bind is true your credential are good