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

Translates requests between the server an a ruby interpreter. More...

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <ruby.h>
+ Include dependency graph for rlm_ruby.c:

Go to the source code of this file.

Data Structures

struct  rlm_ruby_t
struct  varlookup


#define BUF_SIZE   1024
#define RLM_RUBY_FUNC(foo)
#define RLM_RUBY_LOAD(foo)
#define RLM_RUBY_STRUCT(foo)   unsigned long func_##foo


typedef struct rlm_ruby_t rlm_ruby_t


static void add_vp_tuple (TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **vpp, VALUE rb_value, char const *function_name)
static rlm_rcode_t CC_HINT (nonnull(4))
static int load_function (char const *f_name, unsigned long *func, VALUE module)
static int mod_detach (UNUSED void *instance)
static int mod_instantiate (UNUSED CONF_SECTION *conf, void *instance)
static VALUE radlog_rb (UNUSED VALUE self, VALUE msg_type, VALUE rb_msg)


static struct varlookup constants []
static const CONF_PARSER module_config []
module_t rlm_ruby

Detailed Description

Translates requests between the server an a ruby interpreter.

Maintainers note
Please don't use this module, Matz ruby was never designed for embedding.
This module leaks memory, and the ruby code installs signal handlers
which interfere with normal operation of the server. It's all bad...
mruby shows some promise, feel free to rewrite the module to use that.

Definition in file rlm_ruby.c.

Data Structure Documentation

struct varlookup

Definition at line 295 of file rlm_ruby.c.

Data Fields
char const * name
int value

Macro Definition Documentation

#define BUF_SIZE   1024

Definition at line 198 of file rlm_ruby.c.

#define RLM_RUBY_FUNC (   foo)
static rlm_rcode_t CC_HINT(nonnull) mod_##foo(void *instance, REQUEST *request) \
{ \
return do_ruby(request, \
((struct rlm_ruby_t *)instance)->func_##foo,((struct rlm_ruby_t *)instance)->module, \
#foo); \
enum rlm_rcodes rlm_rcode_t
Return codes indicating the result of the module call.
static rlm_rcode_t CC_HINT(nonnull(4))
Definition: rlm_ruby.c:199

Definition at line 421 of file rlm_ruby.c.

#define RLM_RUBY_LOAD (   foo)
if (load_function(#foo, &inst->func_##foo, inst->module)==-1) { \
return -1; \
#define inst
static int load_function(char const *f_name, unsigned long *func, VALUE module)
Definition: rlm_ruby.c:320
#define RLM_RUBY_STRUCT (   foo)    unsigned long func_##foo

Definition at line 58 of file rlm_ruby.c.

Typedef Documentation

typedef struct rlm_ruby_t rlm_ruby_t

Function Documentation

static void add_vp_tuple ( TALLOC_CTX *  ctx,
REQUEST request,
VALUE_PAIR **  vpp,
VALUE  rb_value,
char const *  function_name 

Definition at line 114 of file rlm_ruby.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static rlm_rcode_t CC_HINT ( nonnull(4)  )

Definition at line 199 of file rlm_ruby.c.

+ Here is the call graph for this function:

static int load_function ( char const *  f_name,
unsigned long *  func,
VALUE  module 

Definition at line 320 of file rlm_ruby.c.

static int mod_detach ( UNUSED void *  instance)

Definition at line 441 of file rlm_ruby.c.

static int mod_instantiate ( UNUSED CONF_SECTION conf,
void *  instance 

Definition at line 346 of file rlm_ruby.c.

+ Here is the call graph for this function:

static VALUE radlog_rb ( UNUSED VALUE  self,
VALUE  msg_type,
VALUE  rb_msg 

Definition at line 103 of file rlm_ruby.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct varlookup constants[]
Initial value:
= {
{ "L_DBG", L_DBG},
{ "L_AUTH", L_AUTH},
{ "L_INFO", L_INFO},
{ "L_ERR", L_ERR},
{ NULL, 0},
Only displayed when debugging is enabled.
Definition: log.h:41
The module is OK, continue.
Definition: radiusd.h:91
Error message.
Definition: log.h:36
The module considers the request invalid.
Definition: radiusd.h:93
Reject the request (user is locked out).
Definition: radiusd.h:94
Immediately reject the request.
Definition: radiusd.h:89
Authentication message.
Definition: log.h:34
Module succeeded without doing anything.
Definition: radiusd.h:96
Module failed, don't reply.
Definition: radiusd.h:90
Proxy messages.
Definition: log.h:38
How many valid return codes there are.
Definition: radiusd.h:98
Informational message.
Definition: log.h:35
User not found.
Definition: radiusd.h:95
OK (pairs modified).
Definition: radiusd.h:97
The module handled the request, so stop.
Definition: radiusd.h:92
const CONF_PARSER module_config[]
Initial value:
= {
{ FR_CONF_OFFSET("filename", PW_TYPE_FILE_INPUT | PW_TYPE_REQUIRED, struct rlm_ruby_t, filename) },
{ FR_CONF_OFFSET("module", PW_TYPE_STRING, struct rlm_ruby_t, module_name), .dflt = "Radiusd" },
File matching value must exist, and must be readable.
Definition: conffile.h:204
Definition: conffile.h:289
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168
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 90 of file rlm_ruby.c.

module_t rlm_ruby
Initial value:
= {
.name = "ruby",
.inst_size = sizeof(rlm_ruby_t),
.config = module_config,
.instantiate = mod_instantiate,
.detach = mod_detach,
.methods = {
[MOD_PREACCT] = mod_preacct,
[MOD_PRE_PROXY] = mod_pre_proxy,
[MOD_POST_PROXY] = mod_post_proxy,
[MOD_RECV_COA] = mod_recv_coa,
[MOD_SEND_COA] = mod_send_coa
5 methods index for preproxy section.
Definition: modules.h:46
static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
Write accounting data to Couchbase documents.
static rlm_rcode_t mod_post_auth(void *instance, REQUEST *request) CC_HINT(nonnull)
Module is not threadsafe.
Definition: modules.h:76
7 methods index for postauth section.
Definition: modules.h:48
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
Definition: modules.h:86
static int mod_detach(UNUSED void *instance)
Definition: rlm_ruby.c:441
static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request) CC_HINT(nonnull)
static const CONF_PARSER module_config[]
Definition: rlm_ruby.c:90
4 methods index for checksimul section.
Definition: modules.h:45
3 methods index for accounting section.
Definition: modules.h:44
static rlm_rcode_t mod_checksimul(void *instance, REQUEST *request)
Check if a given user is already logged in.
0 methods index for authenticate section.
Definition: modules.h:41
static int mod_instantiate(UNUSED CONF_SECTION *conf, void *instance)
Definition: rlm_ruby.c:346
6 methods index for postproxy section.
Definition: modules.h:47
2 methods index for preacct section.
Definition: modules.h:43
8 methods index for recvcoa section.
Definition: modules.h:50
9 methods index for sendcoa section.
Definition: modules.h:51
1 methods index for authorize section.
Definition: modules.h:42
struct rlm_ruby_t rlm_ruby_t

Definition at line 459 of file rlm_ruby.c.