Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: [SOLVED] LDAP Auth to Zimbra from Different Server PHP

  1. #11
    Join Date
    Jun 2006
    Posts
    86
    Rep Power
    9

    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

  2. #12
    Join Date
    Jun 2006
    Posts
    86
    Rep Power
    9

    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

Similar Threads

  1. [SOLVED] Postfix unavailable - queue down
    By pmona in forum Administrators
    Replies: 20
    Last Post: 01-21-2010, 10:03 PM
  2. /tmp filling
    By Nutz in forum Administrators
    Replies: 8
    Last Post: 02-22-2008, 02:00 AM
  3. 3 testing: LDAP: 389 Failed when restore zimbra
    By victorLeong in forum Administrators
    Replies: 15
    Last Post: 05-24-2007, 07:45 AM
  4. huge log size
    By rmvg in forum Administrators
    Replies: 5
    Last Post: 01-02-2007, 10:39 AM
  5. Zimbra server crashed
    By goetzi in forum Administrators
    Replies: 6
    Last Post: 03-25-2006, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •