-/* $OpenBSD: radiusd.c,v 1.38 2024/07/01 03:29:21 yasuoka Exp $ */
+/* $OpenBSD: radiusd.c,v 1.39 2024/07/01 03:31:29 yasuoka Exp $ */
/*
* Copyright (c) 2013, 2023 Internet Initiative Japan Inc.
module->radpktoff = 0;
switch (imsg->hdr.type) {
case IMSG_RADIUSD_MODULE_REQDECO_DONE:
+ if (q->deco == NULL || q->deco->type !=
+ IMSG_RADIUSD_MODULE_REQDECO) {
+ log_warnx("q=%u received %s "
+ "but not requested", q->id, typestr);
+ if (radpkt != NULL)
+ radius_delete_packet(radpkt);
+ break;
+ }
if (radpkt != NULL) {
radius_delete_packet(q->req);
q->req = radpkt;
break;
case IMSG_RADIUSD_MODULE_ACCSREQ_ANSWER:
if (radpkt == NULL) {
- log_warn("q=%u wrong pkt from module",
+ log_warnx("q=%u wrong pkt from module",
q->id);
radiusd_access_request_aborted(q);
break;
radiusd_access_request_answer(q);
break;
case IMSG_RADIUSD_MODULE_RESDECO_DONE:
+ if (q->deco == NULL || q->deco->type !=
+ IMSG_RADIUSD_MODULE_RESDECO) {
+ log_warnx("q=%u received %s but not "
+ "requested", q->id, typestr);
+ if (radpkt != NULL)
+ radius_delete_packet(radpkt);
+ break;
+ }
if (radpkt != NULL) {
radius_delete_packet(q->res);
radius_set_request_packet(radpkt,
radiusd_access_request_aborted(q);
return;
}
+ RADIUSD_ASSERT(q->deco != NULL);
+ q->deco->type = IMSG_RADIUSD_MODULE_REQDECO;
radiusd_module_reset_ev_handler(module);
}
radiusd_access_request_aborted(q);
return;
}
+ RADIUSD_ASSERT(q->deco != NULL);
+ q->deco->type = IMSG_RADIUSD_MODULE_RESDECO;
radiusd_module_reset_ev_handler(module);
}
-/* $OpenBSD: radiusd_local.h,v 1.7 2024/05/21 05:00:48 jsg Exp $ */
+/* $OpenBSD: radiusd_local.h,v 1.8 2024/07/01 03:31:29 yasuoka Exp $ */
/*
* Copyright (c) 2013 Internet Initiative Japan Inc.
struct radiusd_module_ref {
struct radiusd_module *module;
+ unsigned int type;
TAILQ_ENTRY(radiusd_module_ref) next;
};