The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions | Variables
rlm_totp.c File Reference

Execute commands and parse the results. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/util/base32.h>
#include <freeradius-devel/unlang/call_env.h>
#include "totp.h"
+ Include dependency graph for rlm_totp.c:

Go to the source code of this file.

Data Structures

struct  rlm_totp_call_env_t
 
struct  rlm_totp_t
 

Typedefs

typedef struct rlm_totp_t rlm_totp_t
 

Functions

static unlang_action_t mod_authenticate (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 

Variables

static const call_env_method_t method_env
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_totp
 

Detailed Description

Execute commands and parse the results.

Id
9e6800ec4bfaf776927b5adfd62a4e698a5a2c94

Definition in file rlm_totp.c.


Data Structure Documentation

◆ rlm_totp_call_env_t

struct rlm_totp_call_env_t

Definition at line 36 of file rlm_totp.c.

+ Collaboration diagram for rlm_totp_call_env_t:
Data Fields
fr_value_box_t key
fr_value_box_t secret
fr_value_box_t user_password

◆ rlm_totp_t

struct rlm_totp_t

Definition at line 59 of file rlm_totp.c.

+ Collaboration diagram for rlm_totp_t:
Data Fields
fr_totp_t totp

Typedef Documentation

◆ rlm_totp_t

typedef struct rlm_totp_t rlm_totp_t

Function Documentation

◆ mod_authenticate()

static unlang_action_t mod_authenticate ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 76 of file rlm_totp.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 144 of file rlm_totp.c.

Variable Documentation

◆ method_env

const call_env_method_t method_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
.pair.dflt = "&control.TOTP.Secret", .pair.dflt_quote = T_BARE_WORD },
.pair.dflt = "&control.TOTP.key", .pair.dflt_quote = T_BARE_WORD },
.pair.dflt = "&request.TOTP.From-User", .pair.dflt_quote = T_BARE_WORD },
}
}
#define CALL_ENV_TERMINATOR
Definition: call_env.h:231
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
Definition: call_env.h:235
@ CALL_ENV_FLAG_NULLABLE
Tmpl expansions are allowed to produce no output.
Definition: call_env.h:80
#define FR_CALL_ENV_OFFSET(_name, _cast_type, _flags, _struct, _field)
Specify a call_env_parser_t which writes out runtime results to the specified field.
Definition: call_env.h:335
Per method call config.
Definition: call_env.h:175
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
static char * secret
Definition: radclient-ng.c:69
@ T_BARE_WORD
Definition: token.h:120

Definition at line 42 of file rlm_totp.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("time_step", rlm_totp_t, totp.time_step), .dflt = "30" },
{ FR_CONF_OFFSET("otp_length", rlm_totp_t, totp.otp_length), .dflt = "6" },
{ FR_CONF_OFFSET("lookback_steps", rlm_totp_t, totp.lookback_steps), .dflt = "1" },
{ FR_CONF_OFFSET("lookback_interval", rlm_totp_t, totp.lookback_interval), .dflt = "30" },
{ FR_CONF_OFFSET("lookforward_steps", rlm_totp_t, totp.lookforward_steps), .dflt = "0" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268

Definition at line 64 of file rlm_totp.c.

◆ rlm_totp

module_rlm_t rlm_totp
Initial value:
= {
.common = {
.name = "totp",
.inst_size = sizeof(rlm_totp_t),
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env },
}
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static const conf_parser_t config[]
Definition: base.c:183
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
static const call_env_method_t method_env
Definition: rlm_totp.c:42
static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_totp.c:76
static const conf_parser_t module_config[]
Definition: rlm_totp.c:64
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_totp.c:144
struct rlm_totp_t rlm_totp_t
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

Definition at line 176 of file rlm_totp.c.