All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions | Variables
rlm_pap.c File Reference

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

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/base64.h>
#include <freeradius-devel/rad_assert.h>
#include <ctype.h>
#include "../../include/md5.h"
#include "../../include/sha1.h"
+ Include dependency graph for rlm_pap.c:

Go to the source code of this file.

Data Structures

struct  rlm_pap_t
 

Typedefs

typedef
USES_APPLE_DEPRECATED_API
struct rlm_pap_t 
rlm_pap_t
 

Functions

static rlm_rcode_t CC_HINT (nonnull)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 
static void normify (REQUEST *request, VALUE_PAIR *vp, size_t min_len)
 Hex or base64 or bin auto-discovery. More...
 
static VALUE_PAIRnormify_with_header (REQUEST *request, VALUE_PAIR *vp)
 Convert a Password-With-Header attribute to the correct type. More...
 

Variables

static const FR_NAME_NUMBER header_names []
 
static const CONF_PARSER module_config []
 
module_t rlm_pap
 

Detailed Description

Hashes plaintext passwords to compare against a prehashed reference.

Id:
be9cb41684d143ba3162e051b7617272dc1e5aa0

Definition in file rlm_pap.c.


Data Structure Documentation

struct rlm_pap_t

Definition at line 50 of file rlm_pap.c.

Data Fields
int auth_type
char const * name
bool normify

Typedef Documentation

Function Documentation

static rlm_rcode_t CC_HINT ( nonnull  )
static

Definition at line 327 of file rlm_pap.c.

+ Here is the call graph for this function:

static int mod_instantiate ( CONF_SECTION conf,
void *  instance 
)
static

Definition at line 111 of file rlm_pap.c.

+ Here is the call graph for this function:

static void normify ( REQUEST request,
VALUE_PAIR vp,
size_t  min_len 
)
static

Hex or base64 or bin auto-discovery.

Here we try and autodiscover what encoding was used for the password/hash, and convert it back to binary or plaintext.

Note
Earlier versions used a 0x prefix as a hard indicator that the string was hex encoded, and would fail if the 0x was present but the string didn't consist of hexits. The base64 char set is a superset of hex, and it was observed in the wild, that occasionally base64 encoded data really could start with 0x. That's why min_len (and decodability) are used as the only heuristics now.
Parameters
[in]requestCurrent request.
[in,out]vpto normify.
[in]min_lenwe expect the decoded version to be.

Definition at line 147 of file rlm_pap.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static VALUE_PAIR* normify_with_header ( REQUEST request,
VALUE_PAIR vp 
)
static

Convert a Password-With-Header attribute to the correct type.

Attribute may be base64 encoded, in which case it will be decoded first, then evaluated.

Note
The buffer for octets types\ attributes is extended by one byte and '\0' terminated, to allow it to be used as a char buff.
Parameters
requestCurrent request.
vpPassword-With-Header attribute to convert.
Returns

Definition at line 206 of file rlm_pap.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const FR_NAME_NUMBER header_names[]
static

Definition at line 76 of file rlm_pap.c.

const CONF_PARSER module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("normalise", PW_TYPE_BOOLEAN, rlm_pap_t, normify), .dflt = "yes" },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
static void normify(REQUEST *request, VALUE_PAIR *vp, size_t min_len)
Hex or base64 or bin auto-discovery.
Definition: rlm_pap.c:147
A truth value.
Definition: radius.h:56
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168

Definition at line 65 of file rlm_pap.c.

module_t rlm_pap
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "pap",
.inst_size = sizeof(rlm_pap_t),
.config = module_config,
.instantiate = mod_instantiate,
.methods = {
},
}
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
#define RLM_MODULE_INIT
Definition: modules.h:86
#define RLM_TYPE_HUP_SAFE
Will be restarted on HUP.
Definition: modules.h:79
static int mod_instantiate(CONF_SECTION *conf, void *instance)
Definition: rlm_pap.c:111
static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request) CC_HINT(nonnull)
USES_APPLE_DEPRECATED_API struct rlm_pap_t rlm_pap_t
0 methods index for authenticate section.
Definition: modules.h:41
static const CONF_PARSER module_config[]
Definition: rlm_pap.c:65
1 methods index for authorize section.
Definition: modules.h:42

Definition at line 1078 of file rlm_pap.c.