The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
rlm_winbind.c File Reference

Authenticates against Active Directory or Samba using winbind. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/unlang/call_env.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/util/debug.h>
#include "rlm_winbind.h"
#include "auth_wbclient_pap.h"
#include <grp.h>
#include <wbclient.h>
+ Include dependency graph for rlm_winbind.c:

Go to the source code of this file.

Data Structures

struct  winbind_autz_call_env_t
 
struct  winbind_group_xlat_call_env_t
 

Functions

static int _mod_ctx_free (winbind_ctx_t *wbctx)
 
static int domain_call_env_parse (TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
 
static unlang_action_t mod_authenticate (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 Authenticate the user via libwbclient and winbind.
 
static unlang_action_t mod_authorize (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 Authorize for libwbclient/winbind authentication.
 
static int mod_bootstrap (module_inst_ctx_t const *mctx)
 Bootstrap this module.
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 Instantiate this module.
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 
static bool winbind_check_group (rlm_winbind_t const *inst, request_t *request, char const *name, winbind_group_xlat_call_env_t *env, rlm_winbind_thread_t *t)
 Group comparison for Winbind-Group.
 
static int winbind_ctx_alloc (winbind_ctx_t *wbctx, UNUSED void *uctx)
 
static xlat_action_t winbind_group_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Check if the user is a member of a particular winbind group.
 

Variables

static fr_dict_attr_t const * attr_auth_type
 
static fr_dict_attr_t const * attr_expr_bool_enum
 
static fr_dict_t const * dict_freeradius
 
static const conf_parser_t group_config []
 
static const conf_parser_t module_config []
 
static conf_parser_t reuse_winbind_config []
 
module_rlm_t rlm_winbind
 
fr_dict_autoload_t rlm_winbind_dict []
 
fr_dict_attr_autoload_t rlm_winbind_dict_attr []
 
static const call_env_method_t winbind_auth_method_env
 
static const call_env_method_t winbind_autz_method_env
 
static xlat_arg_parser_t const winbind_group_xlat_arg []
 
static const call_env_method_t winbind_group_xlat_call_env
 

Detailed Description

Authenticates against Active Directory or Samba using winbind.

Id
3992d7d7edaeb41b78556cc77873c1030c9dd0ca
Author
Matthew Newton (matth.nosp@m.ew@n.nosp@m.ewton.nosp@m.comp.nosp@m.uting.nosp@m..co..nosp@m.uk)

Definition in file rlm_winbind.c.


Data Structure Documentation

◆ winbind_autz_call_env_t

struct winbind_autz_call_env_t

Definition at line 74 of file rlm_winbind.c.

+ Collaboration diagram for winbind_autz_call_env_t:
Data Fields
tmpl_t * password

◆ winbind_group_xlat_call_env_t

struct winbind_group_xlat_call_env_t

Definition at line 78 of file rlm_winbind.c.

+ Collaboration diagram for winbind_group_xlat_call_env_t:
Data Fields
fr_value_box_t domain
fr_value_box_t username

Function Documentation

◆ _mod_ctx_free()

static int _mod_ctx_free ( winbind_ctx_t wbctx)
static

Definition at line 274 of file rlm_winbind.c.

+ Here is the caller graph for this function:

◆ domain_call_env_parse()

static int domain_call_env_parse ( TALLOC_CTX *  ctx,
void *  out,
tmpl_rules_t const *  t_rules,
CONF_ITEM ci,
UNUSED call_env_ctx_t const *  cec,
UNUSED call_env_parser_t const *  rule 
)
static

Definition at line 408 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ mod_authenticate()

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

Authenticate the user via libwbclient and winbind.

Parameters
[out]p_resultThe result of the module call.
[in]mctxModule instance data.
[in]requestThe current request

Definition at line 364 of file rlm_winbind.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

Authorize for libwbclient/winbind authentication.

Checks there is a password available so we can authenticate against winbind and, if so, sets Auth-Type to ourself.

Parameters
[out]p_resultThe result of the module call:
[in]mctxModule instance data.
[in]requestThe current request.

Definition at line 333 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Bootstrap this module.

Parameters
[in]mctxdata for this module
Returns
  • 0 success
  • -1 failure

Definition at line 505 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Instantiate this module.

Parameters
[in]mctxdata for this module
Returns
  • 0 instantiation succeeded
  • -1 instantiation failed

Definition at line 308 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 541 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 527 of file rlm_winbind.c.

+ Here is the call graph for this function:

◆ winbind_check_group()

static bool winbind_check_group ( rlm_winbind_t const *  inst,
request_t request,
char const *  name,
winbind_group_xlat_call_env_t env,
rlm_winbind_thread_t t 
)
static

Group comparison for Winbind-Group.

Parameters
instInstance of this module
requestThe current request
nameGroup name to be searched
envGroup check xlat call_env
Returns
  • 0 user is in group
  • 1 failure or user is not in group

Definition at line 94 of file rlm_winbind.c.

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

◆ winbind_ctx_alloc()

static int winbind_ctx_alloc ( winbind_ctx_t wbctx,
UNUSED void *  uctx 
)
static

Definition at line 283 of file rlm_winbind.c.

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

Variable Documentation

◆ attr_auth_type

fr_dict_attr_t const* attr_auth_type
static

Definition at line 64 of file rlm_winbind.c.

◆ attr_expr_bool_enum

fr_dict_attr_t const* attr_expr_bool_enum
static

Definition at line 65 of file rlm_winbind.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 56 of file rlm_winbind.c.

◆ group_config

const conf_parser_t group_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("add_domain", rlm_winbind_t, group_add_domain), .dflt = "yes" },
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:642
#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

Definition at line 40 of file rlm_winbind.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("group", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) group_config },
}
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition cf_parse.h:323
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
Definition cf_parse.h:297
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:412
static const conf_parser_t group_config[]
Definition rlm_winbind.c:40
static conf_parser_t reuse_winbind_config[]
Definition rlm_winbind.c:45

Definition at line 50 of file rlm_winbind.c.

◆ reuse_winbind_config

conf_parser_t reuse_winbind_config[]
static
Initial value:
= {
}
#define FR_SLAB_CONFIG_CONF_PARSER
conf_parser_t entries to populate user configurable slab values
Definition slab.h:35

Definition at line 45 of file rlm_winbind.c.

◆ rlm_winbind

module_rlm_t rlm_winbind
Initial value:
= {
.common = {
.name = "winbind",
.inst_size = sizeof(rlm_winbind_t),
.bootstrap = mod_bootstrap,
.thread_inst_size = sizeof(rlm_winbind_thread_t),
.thread_instantiate = mod_thread_instantiate,
.thread_detach = mod_thread_detach,
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env },
{ .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_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 instantiate(module_inst_ctx_t const *mctx)
Definition rlm_rest.c:1310
static const call_env_method_t winbind_autz_method_env
static const call_env_method_t winbind_auth_method_env
static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Authenticate the user via libwbclient and winbind.
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Bootstrap this module.
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Authorize for libwbclient/winbind authentication.
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
static const conf_parser_t module_config[]
Definition rlm_winbind.c:50
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
static int mod_instantiate(module_inst_ctx_t const *mctx)
Instantiate this module.
#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 558 of file rlm_winbind.c.

◆ rlm_winbind_dict

fr_dict_autoload_t rlm_winbind_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition rlm_winbind.c:56

Definition at line 59 of file rlm_winbind.c.

◆ rlm_winbind_dict_attr

fr_dict_attr_autoload_t rlm_winbind_dict_attr
Initial value:
= {
{ .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ .out = &attr_expr_bool_enum, .name = "Expr-Bool-Enum", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_BOOL
A truth value.
static fr_dict_attr_t const * attr_expr_bool_enum
Definition rlm_winbind.c:65
static fr_dict_attr_t const * attr_auth_type
Definition rlm_winbind.c:64

Definition at line 68 of file rlm_winbind.c.

◆ winbind_auth_method_env

const call_env_method_t winbind_auth_method_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING, .pair.func = domain_call_env_parse },
.pair.dflt = "&User-Password", .pair.dflt_quote = T_BARE_WORD },
}
}
#define CALL_ENV_TERMINATOR
Definition call_env.h:231
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
Definition call_env.h:235
@ CALL_ENV_FLAG_SECRET
The value is a secret, and should not be logged.
Definition call_env.h:91
@ CALL_ENV_FLAG_NONE
Definition call_env.h:74
@ CALL_ENV_FLAG_REQUIRED
Associated conf pair or section is required.
Definition call_env.h:75
#define FR_CALL_ENV_OFFSET(_name, _cast_type, _flags, _struct, _field)
Specify a call_env_parser_t which writes out runtime results to the specified field.
Definition call_env.h:335
Per method call config.
Definition call_env.h:175
@ FR_TYPE_STRING
String of printable characters.
username
static int domain_call_env_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
@ T_SINGLE_QUOTED_STRING
Definition token.h:122
@ T_BARE_WORD
Definition token.h:120

Definition at line 471 of file rlm_winbind.c.

◆ winbind_autz_method_env

const call_env_method_t winbind_autz_method_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
.pair.dflt = "&User-Password", .pair.dflt_quote = T_BARE_WORD },
}
}
@ CALL_ENV_FLAG_ATTRIBUTE
Tmpl must contain an attribute reference.
Definition call_env.h:86
@ CALL_ENV_FLAG_PARSE_ONLY
The result of parsing will not be evaluated at runtime.
Definition call_env.h:85
#define FR_CALL_ENV_PARSE_ONLY_OFFSET(_name, _cast_type, _flags, _struct, _parse_field)
Specify a call_env_parser_t which writes out the result of the parsing phase to the field specified.
Definition call_env.h:384

Definition at line 399 of file rlm_winbind.c.

◆ winbind_group_xlat_arg

xlat_arg_parser_t const winbind_group_xlat_arg[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING, .concat = true },
}
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:168

Definition at line 294 of file rlm_winbind.c.

◆ winbind_group_xlat_call_env

const call_env_method_t winbind_group_xlat_call_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING, .pair.func = domain_call_env_parse },
}))},
}
}
#define FR_CALL_ENV_SUBSECTION(_name, _name2, _flags, _subcs)
Specify a call_env_parser_t which defines a nested subsection.
Definition call_env.h:397

Definition at line 483 of file rlm_winbind.c.