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

Enables authentication against unix passwd files. More...

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/rad_assert.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 inst   ((rlm_passwd_t *)instance)
 
#define inst   ((rlm_passwd_t *)instance)
 

Typedefs

typedef struct rlm_passwd_t rlm_passwd_t
 

Functions

static void addresult (TALLOC_CTX *ctx, rlm_passwd_t *inst, REQUEST *request, VALUE_PAIR **vps, struct mypasswd *pw, char when, char const *listname)
 
static struct hashtablebuild_hash_table (char const *file, int nfields, int keyfield, int islist, int tablesize, int ignorenis, char delimiter)
 
static rlm_rcode_t CC_HINT (nonnull)
 
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 (void *instance)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 
static struct mypasswdmypasswd_malloc (char const *buffer, int nfields, size_t *len)
 
static void release_hash_table (struct hashtable *ht)
 
static void release_ht (struct hashtable *ht)
 
static int string_to_entry (char const *string, int nfields, char delimiter, struct mypasswd *passwd, size_t bufferlen)
 

Variables

static const CONF_PARSER module_config []
 
module_t rlm_passwd
 

Detailed Description

Enables authentication against unix passwd files.

Id:
8ca82f1c40e3db66f21a2ed7d36280afbbb219b8

Definition in file rlm_passwd.c.


Data Structure Documentation

struct hashtable

Definition at line 36 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 keyfield
int nfields
struct mypasswd ** table
int tablesize
struct mypasswd

Definition at line 30 of file rlm_passwd.c.

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

Definition at line 373 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
fr_dict_attr_t const * keyattr
uint32_t keyfield
uint32_t listable
uint32_t nfields
struct mypasswd * pwdfmt

Macro Definition Documentation

#define inst   ((rlm_passwd_t *)instance)
#define inst   ((rlm_passwd_t *)instance)

Typedef Documentation

typedef struct rlm_passwd_t rlm_passwd_t

Function Documentation

static void addresult ( TALLOC_CTX *  ctx,
rlm_passwd_t inst,
REQUEST request,
VALUE_PAIR **  vps,
struct mypasswd pw,
char  when,
char const *  listname 
)
static

Definition at line 515 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 161 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static rlm_rcode_t CC_HINT ( nonnull  )
static

Definition at line 534 of file rlm_passwd.c.

+ Here is the call graph for this function:

static void destroy_password ( struct mypasswd pass)
static

Definition at line 114 of file rlm_passwd.c.

+ Here is the caller graph for this function:

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

Definition at line 258 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 311 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 124 of file rlm_passwd.c.

+ Here is the caller graph for this function:

static int mod_detach ( void *  instance)
static

Definition at line 504 of file rlm_passwd.c.

+ Here is the call graph for this function:

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

Definition at line 404 of file rlm_passwd.c.

+ Here is the call graph for this function:

static struct mypasswd* mypasswd_malloc ( char const *  buffer,
int  nfields,
size_t *  len 
)
static

Definition at line 66 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void release_hash_table ( struct hashtable ht)
static

Definition at line 133 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void release_ht ( struct hashtable ht)
static

Definition at line 151 of file rlm_passwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 78 of file rlm_passwd.c.

+ Here is the caller graph for this function:

Variable Documentation

const CONF_PARSER module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("delimiter", PW_TYPE_STRING, rlm_passwd_t, delimiter), .dflt = ":" },
{ FR_CONF_OFFSET("ignore_nislike", PW_TYPE_BOOLEAN, rlm_passwd_t, ignore_nislike), .dflt = "yes" },
{ FR_CONF_OFFSET("ignore_empty", PW_TYPE_BOOLEAN, rlm_passwd_t, ignore_empty), .dflt = "yes" },
{ FR_CONF_OFFSET("allow_multiple_keys", PW_TYPE_BOOLEAN, rlm_passwd_t, allow_multiple), .dflt = "no" },
{ FR_CONF_OFFSET("hash_size", PW_TYPE_INTEGER, rlm_passwd_t, hash_size), .dflt = "100" },
}
#define PW_TYPE_FILE_INPUT
File matching value must exist, and must be readable.
Definition: conffile.h:204
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
A truth value.
Definition: radius.h:56
32 Bit unsigned integer.
Definition: radius.h:34
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168
#define PW_TYPE_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: conffile.h:200
String of printable characters.
Definition: radius.h:33

Definition at line 389 of file rlm_passwd.c.

module_t rlm_passwd
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "passwd",
.inst_size = sizeof(rlm_passwd_t),
.config = module_config,
.instantiate = mod_instantiate,
.detach = mod_detach,
.methods = {
[MOD_AUTHORIZE] = mod_passwd_map,
[MOD_ACCOUNTING] = mod_passwd_map,
[MOD_POST_AUTH] = mod_passwd_map,
[MOD_PRE_PROXY] = mod_passwd_map,
[MOD_POST_PROXY] = mod_passwd_map,
[MOD_RECV_COA] = mod_passwd_map,
[MOD_SEND_COA] = mod_passwd_map
},
}
static const CONF_PARSER module_config[]
Definition: rlm_passwd.c:389
5 methods index for preproxy section.
Definition: modules.h:46
static int mod_instantiate(CONF_SECTION *conf, void *instance)
Definition: rlm_passwd.c:404
7 methods index for postauth section.
Definition: modules.h:48
#define RLM_MODULE_INIT
Definition: modules.h:86
#define RLM_TYPE_HUP_SAFE
Will be restarted on HUP.
Definition: modules.h:79
struct rlm_passwd_t rlm_passwd_t
3 methods index for accounting section.
Definition: modules.h:44
6 methods index for postproxy section.
Definition: modules.h:47
8 methods index for recvcoa section.
Definition: modules.h:50
9 methods index for sendcoa section.
Definition: modules.h:51
static int mod_detach(void *instance)
Definition: rlm_passwd.c:504
1 methods index for authorize section.
Definition: modules.h:42

Definition at line 574 of file rlm_passwd.c.