r4460: Add a new GENSEC module: gensec_gssapi
[samba.git] / source / libcli / ldap / ldap_client.c
index 77356cbe70f84932608a747e71fe9281ccffa569..9ca9e4b5c4255a84ff87522bd55af7bdeaf2d22a 100644 (file)
@@ -459,9 +459,13 @@ int ldap_bind_sasl(struct ldap_connection *conn, const char *username, const cha
                        break;
                }
 
-               status = gensec_update(conn->gensec, mem_ctx,
-                                      response->r.BindResponse.SASL.secblob,
-                                      &output);
+               if (!NT_STATUS_IS_OK(status)) {
+                       status = gensec_update(conn->gensec, mem_ctx,
+                                              response->r.BindResponse.SASL.secblob,
+                                              &output);
+               } else {
+                       output.length = 0;
+               }
 
                talloc_free(response);
        }