Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 09-10-2010, 08:36 AM
Loyal Member
 
Posts: 81
Default

Hmmm, interesting. Well thanks for the help since I am programming this app what i can do is first hit the username and password against the AS400. If it recieves nothing back then Query zimbra, if it doesn't recieve anything back from there then the user doesn't exsist. Does that make sense in your opinion?
__________________
otel consulting, inc.
www.otelconsulting.com | facebook | twitter
Reply With Quote
  #12 (permalink)  
Old 09-10-2010, 09:11 AM
Loyal Member
 
Posts: 81
Default

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;
	}
}
__________________
otel consulting, inc.
www.otelconsulting.com | facebook | twitter
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.