Thanks a million for your help. You are truly the man! So if i wanted to get user details on an account that was on zimbra authing off the as400 i couldn't do that via LDAP right? Because of the bug.
Example for my logic, just tested it and it works great
Code:
MasterAuth('bleto', 'xxxx');
function MasterAuth($UN, $Pwd){
if(AS400auth($UN, $Pwd)){
//first auth off AS400
echo 'Authenticated on AS400: '.$UN;
}elseif(zimbraAuth($UN, $Pwd, 'otelconsulting')){
//If not on AS400 Auth off Zimbra
echo 'Authenticated on Zimbra LDAP: '.$UN;
}else{
echo 'Could not auth: '.$UN;
}
}
Code for zimbraAuth function just in case anyone needs it in the future.
This will authenticate the user off of zimbra and return true or false. You could shorten up the code. I just have it setup this way so you can understand the logic and maybe adapt it for another use in your own code.
Example auth for
testuser1@testdomain.com
zimbraAuth('testuser1', 'xxxYourPasswordxxx', 'testdomain')
Code:
function zimbraAuth($username, $password, $domain){
$ldap['user'] = $username;
$ldap['pass'] = $password;
$ldap['host'] = 'zwm.maronda.com';
$ldap['domain'] = $domain;
$ldap['port'] = 389;
$ldap['dn']= 'uid='.$ldap['user'].',ou=people,dc='.$ldap['domain'].',dc=com';
$ldap['base'] = '';
// connecting to ldap
$ldap['conn'] = ldap_connect( $ldap['host'], $ldap['port'] );
ldap_set_option($ldap['conn'], LDAP_OPT_PROTOCOL_VERSION, 3);
// binding to ldap
$ldap['bind'] = ldap_bind( $ldap['conn'], $ldap['dn'], $ldap['pass'] );
if ($ldap['bind']) {
return true;
} else {
return false;
}
}