[SSSD] [PATCH] Do not call sdap_auth if not needed

Jakub Hrozek jhrozek at redhat.com
Thu Apr 5 12:29:36 UTC 2012


On Wed, Apr 04, 2012 at 07:54:23PM -0400, Simo Sorce wrote:
> On Wed, 2012-04-04 at 17:15 -0400, Jakub Hrozek wrote:
> > +    if (!state->do_auth ||
> > +        (sasl_mech == NULL && user_dn == NULL)) {
> > +        DEBUG(SSSDBG_TRACE_LIBS,
> > +              ("No authentication requested or GSSAPI auth forced off
> > \n")); 
> 
> change GSSAPI -> SASL
> 
> Simo.

attached
-------------- next part --------------
From 590342dfd8e9b617c43ed25d02596b8498f33549 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 4 Apr 2012 22:08:31 +0200
Subject: [PATCH] Do not call sdap_auth if not needed

---
 src/providers/ldap/sdap_async_connection.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index 02963f327dc44463c8458bef6806261748740b10..1f50c19835fcc214bb9def1bf883228e32c4c533 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -1504,9 +1504,15 @@ static void sdap_cli_auth_step(struct tevent_req *req)
     struct tevent_req *subreq;
     time_t now;
     int expire_timeout;
+    const char *sasl_mech = dp_opt_get_string(state->opts->basic,
+                                              SDAP_SASL_MECH);
+    const char *user_dn = dp_opt_get_string(state->opts->basic,
+                                            SDAP_DEFAULT_BIND_DN);
 
-    if (!state->do_auth) {
-        /* No authentication requested or GSSAPI auth forced off */
+    if (!state->do_auth ||
+        (sasl_mech == NULL && user_dn == NULL)) {
+        DEBUG(SSSDBG_TRACE_LIBS,
+              ("No authentication requested or SASL auth forced off\n"));
         tevent_req_done(req);
         return;
     }
@@ -1524,12 +1530,10 @@ static void sdap_cli_auth_step(struct tevent_req *req)
     subreq = sdap_auth_send(state,
                             state->ev,
                             state->sh,
-                            dp_opt_get_string(state->opts->basic,
-                                                          SDAP_SASL_MECH),
+                            sasl_mech,
                             dp_opt_get_string(state->opts->basic,
                                                         SDAP_SASL_AUTHID),
-                            dp_opt_get_string(state->opts->basic,
-                                                    SDAP_DEFAULT_BIND_DN),
+                            user_dn,
                             dp_opt_get_string(state->opts->basic,
                                                SDAP_DEFAULT_AUTHTOK_TYPE),
                             dp_opt_get_blob(state->opts->basic,
-- 
1.7.7.6



More information about the sssd-devel mailing list