/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* debugging */
/* inject reply value pairs defined in this json oblect */
mod_json_object_to_value_pairs(cookie->jobj, "reply", request);
- free_and_return:
+ finish:
/* free json object */
if (cookie->jobj) {
/* set return */
rcode = RLM_MODULE_NOOP;
/* return */
- goto free_and_return;
+ goto finish;
}
/* attempt to fetch document */
/* don't doing anything */
rcode = RLM_MODULE_NOOP;
/* return */
- goto free_and_return;
+ goto finish;
}
/* loop through pairs and add to json document */
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* debugging */
RERROR("failed to store document (%s): %s (0x%x)", dockey, lcb_strerror(NULL, cb_error), cb_error);
}
- free_and_return:
-
+finish:
/* free and reset json object */
if (cookie->jobj) {
json_object_put(cookie->jobj);
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* debugging */
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* check for document id in return */
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* get and hold rows */
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* debugging */
/* check count */
if (request->simul_count < request->simul_max) {
rcode = RLM_MODULE_OK;
- goto free_and_return;
+ goto finish;
}
/*
*/
if (inst->verify_simul != true) {
rcode = RLM_MODULE_OK;
- goto free_and_return;
+ goto finish;
}
/* debugging */
/* set return */
rcode = RLM_MODULE_FAIL;
/* return */
- goto free_and_return;
+ goto finish;
}
/* debugging */
if (!json_object_object_get_ex(cookie->jobj, element, &jval)){
RDEBUG("cannot zap stale entry without username");
rcode = RLM_MODULE_FAIL;
- goto free_and_return;
+ goto finish;
}
/* copy json string value to user_name */
user_name = talloc_typed_strdup(request, json_object_get_string(jval));
} else {
RDEBUG("failed to find map entry for User-Name attribute");
rcode = RLM_MODULE_FAIL;
- goto free_and_return;
+ goto finish;
}
/* get element name for Acct-Session-Id attribute */
if (!json_object_object_get_ex(cookie->jobj, element, &jval)){
RDEBUG("cannot zap stale entry without session id");
rcode = RLM_MODULE_FAIL;
- goto free_and_return;
+ goto finish;
}
/* copy json string value to session_id */
session_id = talloc_typed_strdup(request, json_object_get_string(jval));
} else {
RDEBUG("failed to find map entry for Acct-Session-Id attribute");
rcode = RLM_MODULE_FAIL;
- goto free_and_return;
+ goto finish;
}
/* get element name for NAS-IP-Address attribute */
/* check failed - return error */
REDEBUG("failed to check the terminal server for user '%s'", user_name);
rcode = RLM_MODULE_FAIL;
- goto free_and_return;
+ goto finish;
}
/* free and reset document user name talloc */
- if (user_name) {
- talloc_free(user_name);
- user_name = NULL;
- }
+ if (user_name) TALLOC_FREE(user_name);
/* free and reset document calling station id talloc */
- if (cs_id) {
- talloc_free(cs_id);
- cs_id = NULL;
- }
+ if (cs_id) TALLOC_FREE(cs_id);
/* free and reset document session id talloc */
- if (session_id) {
- talloc_free(session_id);
- session_id = NULL;
- }
+ if (session_id) TALLOC_FREE(session_id);
/* free and reset json object before fetching next row */
if (cookie->jobj) {
}
/* debugging */
- RDEBUG("retained %d open sessions for %s after verification",
+ RDEBUG("Retained %d open sessions for %s after verification",
request->simul_count, request->username->vp_strvalue);
- free_and_return:
-
- /* free document user name talloc */
- if (user_name) {
- talloc_free(user_name);
- }
-
- /* free document calling station id talloc */
- if (cs_id) {
- talloc_free(cs_id);
- }
-
- /* free document session id talloc */
- if (session_id) {
- talloc_free(session_id);
- }
+finish:
+ if (user_name) talloc_free(user_name);
+ if (cs_id) talloc_free(cs_id);
+ if (session_id) talloc_free(session_id);
/* free rows */
- if (jrows) {
- json_object_put(jrows);
- }
+ if (jrows) json_object_put(jrows);
/* free and reset json object */
if (cookie->jobj) {
cookie->jobj = NULL;
}
- /* release handle */
- if (handle) {
- fr_connection_release(inst->pool, handle);
- }
+ if (handle) fr_connection_release(inst->pool, handle);
/*
* The Auth module apparently looks at request->simul_count,
*/
static int mod_detach(void *instance)
{
- rlm_couchbase_t *inst = instance; /* instance struct */
+ rlm_couchbase_t *inst = instance;
- /* free json object attribute map */
- if (inst->map) {
- json_object_put(inst->map);
- }
-
- /* destroy connection pool */
- if (inst->pool) {
- fr_connection_pool_free(inst->pool);
- }
+ if (inst->map) json_object_put(inst->map);
+ if (inst->pool) fr_connection_pool_free(inst->pool);
- /* return okay */
return 0;
}