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

Hashes plaintext passwords to compare against a prehashed reference. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/password.h>
#include <freeradius-devel/tls/base.h>
#include <freeradius-devel/tls/log.h>
#include <freeradius-devel/util/base64.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/base16.h>
#include <freeradius-devel/util/md5.h>
#include <freeradius-devel/util/sha1.h>
#include <freeradius-devel/unlang/call_env.h>
#include <freeradius-devel/protocol/freeradius/freeradius.internal.password.h>
#include <ctype.h>
#include <unistd.h>
#include <pthread.h>
+ Include dependency graph for rlm_pap.c:

Go to the source code of this file.

Data Structures

struct  pap_call_env_t
 
struct  rlm_pap_t
 

Typedefs

typedef unlang_action_t(* pap_auth_func_t) (rlm_rcode_t *p_result, rlm_pap_t const *inst, request_t *request, fr_pair_t const *, fr_value_box_t const *)
 

Functions

static unlang_action_t mod_authenticate (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static unlang_action_t mod_authorize (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static int mod_load (void)
 
static void mod_unload (void)
 
static unlang_action_t pap_auth_clear (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_dummy (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, UNUSED request_t *request, UNUSED fr_pair_t const *known_good, UNUSED fr_value_box_t const *password)
 Auth func for password types that should have been normalised away. More...
 
static unlang_action_t pap_auth_md5 (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_ns_mta_md5 (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_nt (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_sha1 (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_smd5 (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 
static unlang_action_t pap_auth_ssha1 (rlm_rcode_t *p_result, UNUSED rlm_pap_t const *inst, request_t *request, fr_pair_t const *known_good, fr_value_box_t const *password)
 

Variables

static fr_dict_attr_t const * attr_auth_type
 
static fr_dict_attr_t const * attr_root
 
static const pap_auth_func_t auth_func_table []
 Table of password types we can process. More...
 
static fr_dict_t const * dict_freeradius
 
static USES_APPLE_DEPRECATED_API pthread_mutex_t fr_crypt_mutex = PTHREAD_MUTEX_INITIALIZER
 
static const conf_parser_t module_config []
 
static fr_dict_attr_t const ** pap_alloweds
 
static const call_env_method_t pap_method_env
 
module_rlm_t rlm_pap
 
static fr_dict_autoload_t rlm_pap_dict []
 
static fr_dict_attr_autoload_t rlm_pap_dict_attr []
 

Detailed Description

Hashes plaintext passwords to compare against a prehashed reference.

Id
50818f979867e98520f89503d6dc9a7290019d21

Definition in file rlm_pap.c.


Data Structure Documentation

◆ pap_call_env_t

struct pap_call_env_t

Definition at line 85 of file rlm_pap.c.

+ Collaboration diagram for pap_call_env_t:
Data Fields
fr_value_box_t password
tmpl_t * password_tmpl

◆ rlm_pap_t

struct rlm_pap_t

Definition at line 73 of file rlm_pap.c.

+ Collaboration diagram for rlm_pap_t:
Data Fields
fr_dict_enum_value_t * auth_type
bool normify

Typedef Documentation

◆ pap_auth_func_t

typedef unlang_action_t(* pap_auth_func_t) (rlm_rcode_t *p_result, rlm_pap_t const *inst, request_t *request, fr_pair_t const *, fr_value_box_t const *)

Definition at line 78 of file rlm_pap.c.

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 901 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ mod_authorize()

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

Definition at line 148 of file rlm_pap.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 977 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ mod_load()

static int mod_load ( void  )
static

Definition at line 990 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ mod_unload()

static void mod_unload ( void  )
static

Definition at line 1041 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_clear()

static unlang_action_t pap_auth_clear ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 178 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_dummy()

static unlang_action_t pap_auth_dummy ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
UNUSED request_t request,
UNUSED fr_pair_t const *  known_good,
UNUSED fr_value_box_t const *  password 
)
static

Auth func for password types that should have been normalised away.

Definition at line 851 of file rlm_pap.c.

◆ pap_auth_md5()

static unlang_action_t pap_auth_md5 ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 233 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_ns_mta_md5()

static unlang_action_t pap_auth_ns_mta_md5 ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 786 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_nt()

static unlang_action_t pap_auth_nt ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 752 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_sha1()

static unlang_action_t pap_auth_sha1 ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 290 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_smd5()

static unlang_action_t pap_auth_smd5 ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 258 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ pap_auth_ssha1()

static unlang_action_t pap_auth_ssha1 ( rlm_rcode_t p_result,
UNUSED rlm_pap_t const *  inst,
request_t request,
fr_pair_t const *  known_good,
fr_value_box_t const *  password 
)
static

Definition at line 317 of file rlm_pap.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_auth_type

fr_dict_attr_t const* attr_auth_type
static

Definition at line 108 of file rlm_pap.c.

◆ attr_root

fr_dict_attr_t const* attr_root
static

Definition at line 109 of file rlm_pap.c.

◆ auth_func_table

const pap_auth_func_t auth_func_table[]
static

Table of password types we can process.

Definition at line 861 of file rlm_pap.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 101 of file rlm_pap.c.

◆ fr_crypt_mutex

USES_APPLE_DEPRECATED_API pthread_mutex_t fr_crypt_mutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 63 of file rlm_pap.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("normalise", rlm_pap_t, normify), .dflt = "yes" },
}
#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
static ssize_t normify(normalise_t *action, uint8_t *buffer, size_t bufflen, char const *known_good, size_t len, size_t min_len)
Definition: password.c:400

Definition at line 80 of file rlm_pap.c.

◆ pap_alloweds

fr_dict_attr_t const** pap_alloweds
static

Definition at line 140 of file rlm_pap.c.

◆ pap_method_env

const call_env_method_t pap_method_env
static
Initial value:
= {
.inst_size = sizeof(pap_call_env_t),
.inst_type = "pap_call_env_t",
.env = (call_env_parser_t[]) {
{ FR_CALL_ENV_PARSE_OFFSET("password_attribute", FR_TYPE_STRING,
pap_call_env_t, password, password_tmpl), .pair.dflt = "&User-Password", .pair.dflt_quote = T_BARE_WORD },
}
}
#define CALL_ENV_TERMINATOR
Definition: call_env.h:231
#define FR_CALL_ENV_PARSE_OFFSET(_name, _cast_type, _flags, _struct, _field, _parse_field)
Specify a call_env_parser_t which writes out runtime results and the result of the parsing phase to t...
Definition: call_env.h:360
@ CALL_ENV_FLAG_CONCAT
If the tmpl produced multiple boxes they should be concatenated.
Definition: call_env.h:76
@ CALL_ENV_FLAG_ATTRIBUTE
Tmpl must contain an attribute reference.
Definition: call_env.h:86
@ CALL_ENV_FLAG_REQUIRED
Associated conf pair or section is required.
Definition: call_env.h:75
@ CALL_ENV_FLAG_NULLABLE
Tmpl expansions are allowed to produce no output.
Definition: call_env.h:80
Per method call config.
Definition: call_env.h:175
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
@ T_BARE_WORD
Definition: token.h:120

Definition at line 90 of file rlm_pap.c.

◆ rlm_pap

module_rlm_t rlm_pap
Initial value:
= {
.common = {
.name = "pap",
.inst_size = sizeof(rlm_pap_t),
.onload = mod_load,
.unload = mod_unload,
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env },
{ .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env },
{ .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_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 mod_load(void)
Definition: rlm_pap.c:990
static const call_env_method_t pap_method_env
Definition: rlm_pap.c:90
static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_pap.c:901
static void mod_unload(void)
Definition: rlm_pap.c:1041
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_pap.c:148
static const conf_parser_t module_config[]
Definition: rlm_pap.c:80
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_pap.c:977
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
#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 1057 of file rlm_pap.c.

◆ rlm_pap_dict

fr_dict_autoload_t rlm_pap_dict[]
static
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: rlm_pap.c:101

Definition at line 103 of file rlm_pap.c.

◆ rlm_pap_dict_attr

fr_dict_attr_autoload_t rlm_pap_dict_attr[]
static
Initial value:
= {
{ .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ .out = &attr_root, .name = "Password", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_TLV
Contains nested attributes.
Definition: merged_model.c:118
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
static fr_dict_attr_t const * attr_auth_type
Definition: rlm_pap.c:108
static fr_dict_attr_t const * attr_root
Definition: rlm_pap.c:109

Definition at line 111 of file rlm_pap.c.