]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Packet-Type does not map to codes in the packet
authorAlan T. DeKok <aland@freeradius.org>
Tue, 17 Jan 2023 18:52:56 +0000 (13:52 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Jan 2023 21:30:01 +0000 (16:30 -0500)
it's a synthetic type created during the packet decoding

src/modules/rlm_tacacs/rlm_tacacs.c
src/modules/rlm_tacacs/rlm_tacacs_tcp.c

index 471b00d4f995a87f60f183cf767c81dce94e2ba1..a51247719896e5c7b62c62a8321fb7bcda1cd780 100644 (file)
@@ -114,15 +114,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent,
         */
        type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1);
        if (!type_enum) {
-       invalid_code:
-               cf_log_err(ci, "Unknown or invalid TACACS+ packet type '%s'", type_str);
+               cf_log_err(ci, "Unknown TACACS+ packet type '%s'", type_str);
                return -1;
        }
 
        code = type_enum->value->vb_uint32;
 
-       if (!code || (code >= FR_TAC_PLUS_MAX)) goto invalid_code;
-
        memcpy(out, &code, sizeof(code));
 
        return 0;
@@ -162,7 +159,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul
                RETURN_MODULE_FAIL;
        }
 
-       if (request->packet->code >= FR_TAC_PLUS_MAX) {
+       if (request->packet->code > FR_TACACS_PACKET_TYPE_MAX) {
                REDEBUG("Invalid packet code %d", request->packet->code);
                RETURN_MODULE_FAIL;
        }
index b2f2e90ce6c5c9f442d48e9a009704f3e6eef669..7997280209d11f83264615de3be202d7711cbcd0 100644 (file)
@@ -1318,7 +1318,7 @@ static unlang_action_t mod_enqueue(rlm_rcode_t *p_result, void **rctx_out, UNUSE
        fr_trunk_request_t              *treq;
 
        fr_assert(request->packet->code > 0);
-       fr_assert(request->packet->code < FR_TAC_PLUS_MAX);
+       fr_assert(request->packet->code < FR_TACACS_PACKET_TYPE_MAX);
 
        treq = fr_trunk_request_alloc(t->trunk, request);
        if (!treq) RETURN_MODULE_FAIL;