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_bootstrap (module_inst_ctx_t const *mctx)
 
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
b01bfcbe52ebbb6a0030ff216d478219b30c5c88

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
char const * name name of this instance *‍/
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 117 of file rlm_totp.c.

+ Here is the call graph for this function:

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 73 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 94 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:212
#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:216
@ CALL_ENV_FLAG_NULLABLE
Tmpl expansions are allowed to produce no output.
Definition: call_env.h:78
#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:316
Per method call config.
Definition: call_env.h:171
@ 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" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#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 65 of file rlm_totp.c.

◆ rlm_totp

module_rlm_t rlm_totp
Initial value:
= {
.common = {
.name = "totp",
.config = module_config,
.bootstrap = mod_bootstrap,
.instantiate = mod_instantiate
},
.method_names = (module_method_name_t[]){
{ .name1 = "authenticate", .name2 = 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:65
Specifies a module method identifier.
Definition: module_method.c:36
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:117
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Definition: rlm_totp.c:73
static const conf_parser_t module_config[]
Definition: rlm_totp.c:65
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_totp.c:94
@ MODULE_TYPE_THREAD_SAFE
Module is threadsafe.
Definition: module.h:49
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 178 of file rlm_totp.c.