]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't SEGV at DEBUG3 when running SASL
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 17 Nov 2022 23:41:50 +0000 (17:41 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 17 Nov 2022 23:41:50 +0000 (17:41 -0600)
src/lib/ldap/sasl.c

index 3ab369efae68a3ba5d14abf55dd6a69b70d10df8..c2388509cbffe6c1d5a6ea59a227c1d8797584b7 100644 (file)
@@ -173,15 +173,23 @@ static void _ldap_sasl_bind_io_read(fr_event_list_t *el, int fd, UNUSED int flag
                        return;
                }
 
-               DEBUG3("SASL response  : %pV", fr_box_strvalue_len(srv_cred->bv_val, srv_cred->bv_len));
+               /*
+                *      Observed as NULL when doing EXTERNAL
+                *      authentication.
+                */
+               if (srv_cred->bv_val) DEBUG3("SASL response  : %pV",
+                                            fr_box_strvalue_len(srv_cred->bv_val, srv_cred->bv_len));
                ber_bvfree(srv_cred);
 
                /*
                 *      If we need to continue, wait until the
                 *      socket is writable, and then call
                 *      ldap_sasl_interactive_bind again.
+                *
+                *      sasl_ctx->rmech may be NULL if there's
+                *      nothing else to do.
                 */
-               DEBUG3("Continuing SASL mech %s...", sasl_ctx->rmech);
+               if (sasl_ctx->rmech) DEBUG3("Continuing SASL mech %s...", sasl_ctx->rmech);
 
                ret = fr_event_fd_insert(sasl_ctx, el, fd,
                                         NULL,