#include <freeradius-devel/rad_assert.h>
#include <libcouchbase/couchbase.h>
-#include <json/json.h>
+#include <json.h>
#include "mod.h"
#include "couchbase.h"
* Module Configuration
*/
static const CONF_PARSER module_config[] = {
- {"acct_key", PW_TYPE_STRING, offsetof(rlm_couchbase_t, acct_key), NULL,
- "radacct_%{%{Acct-Unique-Session-Id}:-%{Acct-Session-Id}}"},
- {"doctype", PW_TYPE_STRING, offsetof(rlm_couchbase_t, doctype), NULL, "radacct"},
- {"server", PW_TYPE_STRING | PW_TYPE_REQUIRED, offsetof(rlm_couchbase_t, server), NULL, NULL},
- {"bucket", PW_TYPE_STRING | PW_TYPE_REQUIRED, offsetof(rlm_couchbase_t, bucket), NULL, NULL},
- {"password", PW_TYPE_STRING, offsetof(rlm_couchbase_t, password), NULL, NULL},
- {"expire", PW_TYPE_INTEGER, offsetof(rlm_couchbase_t, expire), NULL, 0},
- {"user_key", PW_TYPE_STRING | PW_TYPE_REQUIRED, offsetof(rlm_couchbase_t, user_key), NULL,
- "raduser_%{md5:%{tolower:%{%{Stripped-User-Name}:-%{User-Name}}}}"},
+ { "acct_key", FR_CONF_OFFSET(PW_TYPE_STRING, rlm_couchbase_t, acct_key), "radacct_%{%{Acct-Unique-Session-Id}:-%{Acct-Session-Id}}" },
+ { "doctype", FR_CONF_OFFSET(PW_TYPE_STRING, rlm_couchbase_t, doctype), "radacct" },
+ { "server", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_couchbase_t, server_raw), NULL },
+ { "bucket", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_couchbase_t, bucket), NULL },
+ { "password", FR_CONF_OFFSET(PW_TYPE_STRING, rlm_couchbase_t, password), NULL },
+ { "expire", FR_CONF_OFFSET(PW_TYPE_INTEGER, rlm_couchbase_t, expire), 0 },
+ { "user_key", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_couchbase_t, user_key), "raduser_%{md5:%{tolower:%{%{Stripped-User-Name}:-%{User-Name}}}}" },
{NULL, -1, 0, NULL, NULL} /* end the list */
};
/* initialize couchbase connection */
static int mod_instantiate(CONF_SECTION *conf, void *instance) {
+ static bool version_done;
+
rlm_couchbase_t *inst = instance; /* our module instance */
+ if (!version_done) {
+ version_done = true;
+ INFO("rlm_couchbase: json-c version: %s", json_c_version());
+ INFO("rlm_couchbase: libcouchbase version: %s", lcb_get_version(NULL));
+ }
+
{
char *server, *p;
size_t len, i;
bool sep = false;
- len = talloc_array_length(inst->server);
+ len = talloc_array_length(inst->server_raw);
server = p = talloc_array(inst, char, len);
for (i = 0; i < len; i++) {
- switch (inst->server[i]) {
+ switch (inst->server_raw[i]) {
case '\t':
case ' ':
case ',':
default:
sep = false;
- *p++ = inst->server[i];
+ *p++ = inst->server_raw[i];
break;
}
}
*p = '\0';
- talloc_free(inst->server);
inst->server = server;
}
}
/* initiate connection pool */
- inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, mod_conn_delete, NULL);
+ inst->pool = fr_connection_pool_init(conf, inst, mod_conn_create, mod_conn_alive, NULL, NULL);
/* check connection pool */
if (!inst->pool) {