Skip to content

Commit

Permalink
Add dynamic client processing to TACACS state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
ndptech committed Jan 10, 2025
1 parent 366039c commit 1ddba0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/process/tacacs/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ typedef struct {
CONF_SECTION *acct_error;

CONF_SECTION *do_not_respond;

CONF_SECTION *new_client;
CONF_SECTION *add_client;
CONF_SECTION *deny_client;
} process_tacacs_sections_t;

typedef struct {
Expand Down Expand Up @@ -191,8 +195,10 @@ typedef struct {

#define PROCESS_PACKET_TYPE fr_tacacs_packet_code_t
#define PROCESS_CODE_MAX FR_TACACS_CODE_MAX
#define PROCESS_CODE_DO_NOT_RESPOND FR_TACACS_CODE_DO_NOT_RESPOND
#define PROCESS_PACKET_CODE_VALID FR_TACACS_PACKET_CODE_VALID
#define PROCESS_INST process_tacacs_t
#define PROCESS_CODE_DYNAMIC_CLIENT FR_TACACS_CODE_AUTH_PASS

#include <freeradius-devel/server/process.h>

Expand Down Expand Up @@ -1047,6 +1053,10 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
// @todo - debug stuff!
// tacacs_packet_debug(request, request->packet, &request->request_pairs, true);

if (unlikely(request_is_dynamic_client(request))) {
return new_client(p_result, mctx, request);
}

return state->recv(p_result, mctx, request);
}

Expand Down Expand Up @@ -1434,6 +1444,8 @@ static virtual_server_compile_t compile_list[] = {
.offset = PROCESS_CONF_OFFSET(do_not_respond),
},

DYNAMIC_CLIENT_SECTIONS,

COMPILE_TERMINATOR
};

Expand Down
1 change: 1 addition & 0 deletions src/protocols/tacacs/tacacs.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ typedef enum {
FR_TACACS_CODE_ACCT_ERROR = FR_PACKET_TYPE_VALUE_ACCOUNTING_ERROR,

FR_TACACS_CODE_MAX = 19,
FR_TACACS_CODE_DO_NOT_RESPOND = 256,
} fr_tacacs_packet_code_t;


Expand Down

0 comments on commit 1ddba0e

Please sign in to comment.