]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
1) fr_ldap_trunk_search(): prevent fr_trunk_request_signal_cancel() from (#4628)
authorMax Khon <fjoe@samodelkin.net>
Wed, 27 Jul 2022 09:17:32 +0000 (12:17 +0300)
committerGitHub <noreply@github.com>
Wed, 27 Jul 2022 09:17:32 +0000 (17:17 +0800)
being called twice (from _ldap_search_sync_timeout() and ldap_trunk_query_cancel())

2) fr_trunk_request_enter_cancel_complete(): allow FR_TRUNK_REQUEST_STATE_CANCEL

src/lib/ldap/base.c

index bfa92b9862b9aa345d897b913c00c9015d297652..ecf9a49313a557d54d56bef82044f433dde4e23c 100644 (file)
@@ -619,6 +619,7 @@ static void ldap_trunk_query_cancel(UNUSED request_t *request, fr_state_signal_t
        if (!query->treq) return;
 
        fr_trunk_request_signal_cancel(query->treq);
+       query->treq = NULL;
 
 }
 
@@ -648,9 +649,7 @@ static unlang_action_t ldap_trunk_query_start(UNUSED rlm_rcode_t *p_result, UNUS
  */
 static void _ldap_search_sync_timeout(UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 {
-       fr_trunk_request_t *treq = talloc_get_type_abort(uctx, fr_trunk_request_t);
-
-       fr_trunk_request_signal_cancel(treq);
+       ldap_trunk_query_cancel(NULL, FR_SIGNAL_CANCEL, uctx);
 }
 
 /** Run an async or sync search LDAP query on a trunk connection
@@ -722,7 +721,7 @@ unlang_action_t fr_ldap_trunk_search(rlm_rcode_t *p_result,
                 */
                if (fr_time_delta_ispos(timeout)) {
                        if (fr_event_timer_in(ctx, unlang_interpret_event_list(request), &ev, timeout,
-                                             _ldap_search_sync_timeout, query->treq) < 0) goto error;
+                                             _ldap_search_sync_timeout, query) < 0) goto error;
                }
 
                *p_result = unlang_interpret_synchronous(unlang_interpret_event_list(request), request);