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

Enables authentication against unix passwd files. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
+ Include dependency graph for rlm_passwd.c:

Go to the source code of this file.

Data Structures

struct  hashtable
 
struct  mypasswd
 
struct  rlm_passwd_t
 

Macros

#define LOG_PREFIX   "passwd"
 

Functions

static struct hashtablebuild_hash_table (char const *file, int num_fields, int key_field, int islist, int tablesize, int ignorenis, char delimiter)
 
static void destroy_password (struct mypasswd *pass)
 
static struct mypasswdget_next (char *name, struct hashtable *ht, struct mypasswd **last_found)
 
static struct mypasswdget_pw_nam (char *name, struct hashtable *ht, struct mypasswd **last_found)
 
static unsigned int hash (char const *username, unsigned int tablesize)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_passwd_map (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static struct mypasswdmypasswd_alloc (char const *buffer, int num_fields, size_t *len)
 
static void release_hash_table (struct hashtable *ht)
 
static void release_ht (struct hashtable *ht)
 
static void result_add (TALLOC_CTX *ctx, rlm_passwd_t const *inst, request_t *request, fr_pair_list_t *vps, struct mypasswd *pw, char when, char const *listname)
 
static int string_to_entry (char const *string, int num_fields, char delimiter, struct mypasswd *passwd, size_t bufferlen)
 

Variables

static fr_dict_t const * dict_freeradius
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_passwd
 
fr_dict_autoload_t rlm_passwd_dict []
 

Detailed Description

Enables authentication against unix passwd files.

Id
6e6a1dfa8f816ec1f2514f7ae609f5544153fa23

Definition in file rlm_passwd.c.


Data Structure Documentation

◆ hashtable

struct hashtable

Definition at line 38 of file rlm_passwd.c.

+ Collaboration diagram for hashtable:
Data Fields
char buffer[1024]
char delimiter
char * filename
FILE * fp
int ignorenis
int islist
int key_field
int num_fields
struct mypasswd ** table
int tablesize

◆ mypasswd

struct mypasswd

Definition at line 32 of file rlm_passwd.c.

+ Collaboration diagram for mypasswd:
Data Fields
char * field[1]
char * listflag
struct mypasswd * next

◆ rlm_passwd_t

struct rlm_passwd_t

Definition at line 357 of file rlm_passwd.c.

+ Collaboration diagram for rlm_passwd_t:
Data Fields
bool allow_multiple
char const * delimiter
char const * filename
char const * format
uint32_t hash_size
struct hashtable * ht
bool ignore_empty
bool ignore_nislike
uint32_t key_field
fr_dict_attr_t const * keyattr
uint32_t listable
uint32_t num_fields
struct mypasswd * pwd_fmt

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "passwd"

Definition at line 26 of file rlm_passwd.c.

Function Documentation

◆ build_hash_table()

static struct hashtable* build_hash_table ( char const *  file,
int  num_fields,
int  key_field,
int  islist,
int  tablesize,
int  ignorenis,
char  delimiter 
)
static

Definition at line 159 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy_password()

static void destroy_password ( struct mypasswd pass)
static

Definition at line 121 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_next()

static struct mypasswd* get_next ( char *  name,
struct hashtable ht,
struct mypasswd **  last_found 
)
static

Definition at line 242 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_pw_nam()

static struct mypasswd* get_pw_nam ( char *  name,
struct hashtable ht,
struct mypasswd **  last_found 
)
static

Definition at line 295 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hash()

static unsigned int hash ( char const *  username,
unsigned int  tablesize 
)
static

Definition at line 132 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Definition at line 503 of file rlm_passwd.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 388 of file rlm_passwd.c.

+ Here is the call graph for this function:

◆ mod_passwd_map()

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

Definition at line 563 of file rlm_passwd.c.

+ Here is the call graph for this function:

◆ mypasswd_alloc()

static struct mypasswd* mypasswd_alloc ( char const *  buffer,
int  num_fields,
size_t len 
)
static

Definition at line 73 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ release_hash_table()

static void release_hash_table ( struct hashtable ht)
static

Definition at line 139 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ release_ht()

static void release_ht ( struct hashtable ht)
static

Definition at line 153 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ result_add()

static void result_add ( TALLOC_CTX *  ctx,
rlm_passwd_t const *  inst,
request_t request,
fr_pair_list_t vps,
struct mypasswd pw,
char  when,
char const *  listname 
)
static

Definition at line 514 of file rlm_passwd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ string_to_entry()

static int string_to_entry ( char const *  string,
int  num_fields,
char  delimiter,
struct mypasswd passwd,
size_t  bufferlen 
)
static

Definition at line 85 of file rlm_passwd.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 51 of file rlm_passwd.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("delimiter", rlm_passwd_t, delimiter), .dflt = ":" },
{ FR_CONF_OFFSET("ignore_nislike", rlm_passwd_t, ignore_nislike), .dflt = "yes" },
{ FR_CONF_OFFSET("ignore_empty", rlm_passwd_t, ignore_empty), .dflt = "yes" },
{ FR_CONF_OFFSET("allow_multiple_keys", rlm_passwd_t, allow_multiple), .dflt = "no" },
{ FR_CONF_OFFSET("hash_size", rlm_passwd_t, hash_size), .dflt = "100" },
}
#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
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:256
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:406
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:412
int format(printf, 5, 0))

Definition at line 373 of file rlm_passwd.c.

◆ rlm_passwd

module_rlm_t rlm_passwd
Initial value:
= {
.common = {
.name = "passwd",
.inst_size = sizeof(rlm_passwd_t),
.detach = mod_detach
},
.method_names = (module_method_name_t[]){
{ .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_passwd_map },
}
}
#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_detach(module_detach_ctx_t const *mctx)
Definition: rlm_passwd.c:503
static unlang_action_t mod_passwd_map(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_passwd.c:563
static const conf_parser_t module_config[]
Definition: rlm_passwd.c:373
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_passwd.c:388
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 610 of file rlm_passwd.c.

◆ rlm_passwd_dict

fr_dict_autoload_t rlm_passwd_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: rlm_passwd.c:51

Definition at line 54 of file rlm_passwd.c.