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
fafb415870354adf0fc1219f38ca2f4228b6897e

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 900 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 150 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 976 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ mod_load()

static int mod_load ( void  )
static

Definition at line 989 of file rlm_pap.c.

+ Here is the call graph for this function:

◆ mod_unload()

static void mod_unload ( void  )
static

Definition at line 1040 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 180 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 847 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 235 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 782 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 748 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 292 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 260 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 319 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 857 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: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
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:407

Definition at line 80 of file rlm_pap.c.

◆ pap_alloweds

fr_dict_attr_t const** pap_alloweds
static

Definition at line 142 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:212
#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:341
@ CALL_ENV_FLAG_CONCAT
If the tmpl produced multiple boxes they should be concatenated.
Definition: call_env.h:74
@ CALL_ENV_FLAG_ATTRIBUTE
Tmpl must contain an attribute reference.
Definition: call_env.h:84
@ CALL_ENV_FLAG_REQUIRED
Associated conf pair or section is required.
Definition: call_env.h:73
@ CALL_ENV_FLAG_NULLABLE
Tmpl expansions are allowed to produce no output.
Definition: call_env.h:78
Per method call config.
Definition: call_env.h:171
@ 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_names = (module_method_name_t[]){
{ .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize,
.method_env = &pap_method_env },
{ .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate,
.method_env = &pap_method_env },
{ .name1 = CF_IDENT_ANY, .name2 = 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:65
Specifies a module method identifier.
Definition: module_method.c:36
static const conf_parser_t config[]
Definition: base.c:188
static int mod_load(void)
Definition: rlm_pap.c:989
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:900
static void mod_unload(void)
Definition: rlm_pap.c:1040
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_pap.c:150
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:976
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1312
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 1056 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.