22 #define LOG_PREFIX "securid"
50 if (session->
sdiHandle != SDI_HANDLE_NONE) {
63 pthread_mutex_lock(&(
inst->session_mutex));
65 for (node =
inst->session_head; node != NULL; node =
next) {
70 inst->session_head =
inst->session_tail = NULL;
72 pthread_mutex_unlock(&(
inst->session_mutex));
94 session->
src_ipaddr = request->packet->src_ipaddr;
100 pthread_mutex_lock(&(
inst->session_mutex));
112 inst->last_session_id++;
117 memset(session->
state, 0,
sizeof(session->
state));
119 RDEBUG2(
"Inserting session id=%d identity='%s' state='%s' to the session list",
136 prev =
inst->session_tail;
139 prev->
next = session;
140 session->
prev = prev;
141 session->
next = NULL;
142 inst->session_tail = session;
145 inst->session_head =
inst->session_tail = session;
146 session->
next = session->
prev = NULL;
155 pthread_mutex_unlock(&(
inst->session_mutex));
159 ERROR(
"Failed to store session");
179 pthread_mutex_lock(&(
inst->session_mutex));
181 pthread_mutex_unlock(&(
inst->session_mutex));
192 ERROR(
"Invalid State variable. length=%d", (
int) state->vp_length);
196 memset(&mySession,0,
sizeof(mySession));
197 mySession.
src_ipaddr = request->packet->src_ipaddr;
198 memcpy(mySession.
state, state->vp_strvalue,
sizeof(mySession.
state));
204 pthread_mutex_lock(&(
inst->session_mutex));
206 pthread_mutex_unlock(&(
inst->session_mutex));
212 ERROR(
"No SECURID session matching the State variable");
216 RDEBUG2(
"Session found identity='%s' state='%s', released from the list",
218 if (session->
trips >=
inst->max_trips_per_session) {
219 RDEBUG2(
"More than %d authentication packets for this SECURID session. Aborted.",
inst->max_trips_per_session);
243 session->
prev->next = session->
next;
248 session->
next->prev = session->
prev;
252 session->
prev = session->
next = NULL;
260 uint64_t num_sessions;
264 RDEBUG2(
"There are %d sessions in the tree\n",num_sessions);
270 while((session =
inst->session_head)) {
279 session->
next->prev = NULL;
281 inst->session_head = NULL;
282 inst->session_tail = NULL;
285 RDEBUG2(
"Cleaning expired session: identity='%s' state='%s'\n",
HIDDEN fr_dict_attr_t const * attr_state
static void securid_sessionlist_clean_expired(rlm_securid_t *inst, request_t *request, time_t timestamp)
int securid_sessionlist_add(rlm_securid_t *inst, request_t *request, SECURID_SESSION *session)
static SECURID_SESSION * securid_sessionlist_delete(rlm_securid_t *inst, SECURID_SESSION *session)
SECURID_SESSION * securid_session_alloc(void)
void securid_session_free(UNUSED rlm_securid_t *inst, request_t *request, SECURID_SESSION *session)
SECURID_SESSION * securid_sessionlist_find(rlm_securid_t *inst, request_t *request)
void securid_sessionlist_free(rlm_securid_t *inst, request_t *request)
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
int fr_pair_value_memdup(fr_pair_t *vp, uint8_t const *src, size_t len, bool tainted)
Copy data into an "octets" data type.
uint32_t fr_rb_num_elements(fr_rb_tree_t *tree)
bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
bool fr_rb_delete(fr_rb_tree_t *tree, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
struct _securid_session_t * next
struct _securid_session_t * prev
#define SECURID_STATE_LEN
char state[SECURID_STATE_LEN]
#define pair_update_reply(_attr, _da)
Return or allocate a fr_pair_t in the reply list.
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
eap_aka_sim_process_conf_t * inst
Stores an attribute, a value and various bits of other data.
static int64_t fr_time_to_sec(fr_time_t when)
Convert an fr_time_t (internal time) to number of sec since the unix epoch (wallclock time)
void fr_pair_list_free(fr_pair_list_t *list)
Free memory used by a valuepair list.