return NULL;
}
- if (NULL == (comm = talloc(trc, TR_COMM))) {
+ if (NULL == (comm = talloc_zero(trc, TR_COMM))) {
fprintf(stderr, "tr_cfg_parse_one_comm: Out of memory.\n");
*rc = TR_CFG_NOMEM;
return NULL;
}
- memset(comm, 0, sizeof(TR_COMM));
if ((NULL == (jid = json_object_get(jcomm, "community_id"))) ||
(!json_is_string(jid)) ||
if (TR_CFG_SUCCESS != *rc) {
fprintf(stderr, "tr_cfg_parse_comm: Can't parse RP realms for comm %s .\n", comm->id->buf);
tr_free_name(comm->id);
- /* TBD -- free idps? */;
return NULL;
}
+ if (TR_COMM_APC == comm->type) {
+ json_t *jexpire = json_object_get(jcomm, "expiration_interval");
+ comm->expiration_interval = 43200; /*30 days*/
+ if (jexpire) {
+ if (!json_is_integer(jexpire)) {
+ fprintf(stderr, "tr_parse_comm: expirae_interval is not an integer\n");
+ return NULL;
+ }
+ comm->expiration_interval = json_integer_value(jexpire);
+ if (comm->expiration_interval <= 10)
+ comm->expiration_interval = 11; /* Freeradius waits 10 minutes between successful TR queries*/
+ if (comm->expiration_interval > 129600) /* 90 days*/
+ comm->expiration_interval = 129600;
+ }
+ }
+
return comm;
}
/*
- * Copyright (c) 2012, JANET(UK)
+ * Copyright (c) 2012, 2015, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
TR_APC *apcs;
TR_IDP_REALM *idp_realms;
TR_RP_REALM *rp_realms;
+ time_t expiration_interval; /*Minutes to key expiration; only valid for an APC*/
} TR_COMM;
TR_COMM *tr_comm_lookup(TR_INSTANCE *tr, TR_NAME *comm);
/* send a TID request to the AAA server(s), and get the answer(s) */
/* TBD -- Handle multiple servers */
+ if (cfg_apc)
+ fwd_req->expiration_interval = cfg_apc->expiration_interval;
+ else fwd_req->expiration_interval = cfg_comm->expiration_interval;
/* Create a TID client instance */
if (NULL == (tidc = tidc_create())) {
fprintf(stderr, "tr_tids_req_hander: Unable to allocate TIDC instance.\n");