function ldaphelp_bindtrials in LDAP integration 6
1 call to ldaphelp_bindtrials()
- ldaphelp_wizard_form in ldaphelp/
ldaphelp_wizard.inc - @file wizard file for ldaphelp module
File
- ldaphelp/
ldaphelp_wizard.inc, line 278 - wizard file for ldaphelp module
Code
function ldaphelp_bindtrials($values) {
// first try values in form if port is entered:
$bind_success = FALSE;
$bind_form_values_success = FALSE;
if ($values['port']) {
$trial = array(
'server' => $values['server'],
'port' => $values['port'],
'tls' => $values['tls'],
);
$trial['results'] = _ldaphelp_bind_test($trial);
if ($trial['results']['bind_success'] == 1) {
drupal_set_message(t("Successfully bound to port @port with tls=@tls on server @server", array(
'@port' => $values['port'],
'@tls' => $values['tls'],
'@server' => $values['server'],
)));
$bind_success = TRUE;
$bind_form_values_success = TRUE;
}
else {
drupal_set_message(check_plain(ldaphelp_bind_trial_message($trial)), 'error');
}
$trials['form_values'] = $trial;
}
if (!$values['port'] || $trials['form_values']['results']['bind_success'] != 1) {
$trials['tls'] = array(
'port' => 389,
'tls' => 1,
'server' => $values['server'],
);
$trials['encrypted'] = array(
'port' => 636,
'tls' => 0,
'server' => $values['server'],
);
$trials['odd'] = array(
'port' => 636,
'tls' => 1,
'server' => $values['server'],
);
foreach ($trials as $name => $trial) {
$trial['results'] = _ldaphelp_bind_test($trial);
if ($trial['results']['bind_success'] == 1) {
drupal_set_message(t("Successfully bound to port @port with tls=@tls on server @server", array(
'@port' => $trial['port'],
'@tls' => $trial['tls'],
'@server' => $trial['server'],
)));
$bind_success = TRUE;
}
else {
drupal_set_message(check_plain(ldaphelp_bind_trial_message($trial)), 'error');
}
}
}
if (!$bind_success) {
drupal_set_message(t('Could not bind to ldap to server @server', array(
'@server' => $values['server'],
)) . ' ' . t('Perhaps you have the wrong hostname, its on a nonstandard port, or it doesn not allow anononymous binds. Try pinging the server.'), 'error');
}
if ($bind_success && !$bind_form_values_success) {
drupal_set_message(t('Was able to bind to server @server with some configurations, but not the data you entered. If one of the successful attempts looks correct, enter it in the form to go to next step.', array(
'@server' => $values['server'],
)), 'warn');
}
return $bind_form_values_success;
}