Skip to content

Commit

Permalink
Only issue a bind after STARTTLS has completed.
Browse files Browse the repository at this point in the history
Issue: 19
Submitted by: mail [at] tinloaf.de
  • Loading branch information
landon.j.fuller committed Feb 25, 2012
1 parent 2d1568c commit 4a87c1a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/auth-ldap.m
Expand Up @@ -278,14 +278,6 @@ static BOOL pf_open(struct ldap_ctx *ctx) {
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;
}
}

/* Certificate file */
if ((value = [config tlsCACertFile]))
if (![ldap setTLSCACertFile: value])
Expand All @@ -311,6 +303,14 @@ static BOOL pf_open(struct ldap_ctx *ctx) {
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:
Expand Down

0 comments on commit 4a87c1a

Please sign in to comment.