Sorry, I mistyped the code of the function (forget a "{" when I copy &
paste it)

Here is the right code:

LFLDAPConnection *connect_ldap(LFAuthLDAPConfig *config) {
        LFLDAPConnection *ldap;
        LFString *value;

        /* Initialize our LDAP Connection */
        ldap = [[LFLDAPConnection alloc] initWithURL: [config url] timeout:
[config timeout]];
        if (!ldap) {
                [TRLog error: "Unable to open LDAP connection to %s\n", 
[[config url]
cString]];
                return nil;
        }

        /* Referrals */
        if ([config referralEnabled]) {
                if (![ldap setReferralEnabled: YES])
                        goto error;
        } else {
                if (![ldap setReferralEnabled: NO])
                        goto error;
        }

        /* Certificate file */
        if ((value = [config tlsCACertFile]))
                if (![ldap setTLSCACertFile: value])
                        goto error;

        /* Certificate directory */
        if ((value = [config tlsCACertDir]))
                if (![ldap setTLSCACertDir: value])
                        goto error;

        /* Client Certificate Pair */
        if ([config tlsCertFile] && [config tlsKeyFile])
                if(![ldap setTLSClientCert: [config tlsCertFile] keyFile: 
[config
tlsKeyFile]])
                        goto error;

        /* Cipher suite */
        if ((value = [config tlsCipherSuite]))
                if(![ldap setTLSCipherSuite: value])
                        goto error;

        /* Start TLS */
        if ([config tlsEnabled])
                if (![ldap startTLS])
                        goto error;

        /* Bind if requested */
        if ([config bindDN]) {
                if (![ldap bindWithDN: [config bindDN] password: [config
bindPassword]]) {
                        [TRLog error: "Unable to bind as %s", [[config
bindDN] cString]];
                        goto error;
                }
        }

        return ldap;

error:
        [ldap release];
        return nil;
}


-- 

Andre Pawlowski

-------------------------------------------------------------------

Your birth is a mistake you'll spend your whole life trying to correct.
        -Chuck Palahniuk



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to