libtr_tid_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
libtr_tid_la_LIBADD = gsscon/libgsscon.la
-libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1 -no-undefined
+libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2 -no-undefined
pkginclude_HEADERS = include/trust_router/tid.h include/trust_router/tr_name.h \
include/trust_router/tr_dh.h \
-typedef int (TIDS_REQ_FUNC)(TIDS_INSTANCE *, TID_REQ *, TID_RESP **, void *);
+typedef int (TIDS_REQ_FUNC)(TIDS_INSTANCE *, TID_REQ *, TID_RESP *, void *);
typedef int (tids_auth_func)(gss_name_t client_name, TR_NAME *display_name, void *cookie);
static int tids_req_handler (TIDS_INSTANCE *tids,
TID_REQ *req,
- TID_RESP **resp,
+ TID_RESP *resp,
void *cookie)
{
unsigned char *s_keybuf = NULL;
if (tids)
tids->req_count++;
- if (!(resp) || !(*resp)) {
+ if (!(resp) || !resp) {
fprintf(stderr, "tids_req_handler: No response structure.\n");
return -1;
}
/* Allocate a new server block */
- if (NULL == ((*resp)->servers = malloc(sizeof(TID_SRVR_BLK)))){
+ if (NULL == (resp->servers = malloc(sizeof(TID_SRVR_BLK)))){
fprintf(stderr, "tids_req_handler(): malloc failed.\n");
return -1;
}
- memset((*resp)->servers, 0, sizeof(TID_SRVR_BLK));
- (*resp)->num_servers = 1;
+ memset(resp->servers, 0, sizeof(TID_SRVR_BLK));
+ resp->num_servers = 1;
/* TBD -- Set up the server IP Address */
// fprintf(stderr, "Generating the server DH block.\n");
// fprintf(stderr, "...from client DH block, dh_g = %s, dh_p = %s.\n", BN_bn2hex(req->tidc_dh->g), BN_bn2hex(req->tidc_dh->p));
- if (NULL == ((*resp)->servers->aaa_server_dh = tr_create_matching_dh(NULL, 0, req->tidc_dh))) {
+ if (NULL == (resp->servers->aaa_server_dh = tr_create_matching_dh(NULL, 0, req->tidc_dh))) {
fprintf(stderr, "tids_req_handler(): Can't create server DH params.\n");
return -1;
}
- if (0 == inet_aton(tids->ipaddr, &((*resp)->servers->aaa_server_addr))) {
+ if (0 == inet_aton(tids->ipaddr, &(resp->servers->aaa_server_addr))) {
fprintf(stderr, "tids_req_handler(): inet_aton() failed.\n");
return -1;
}
/* Set the key name */
if (-1 == create_key_id(key_id, sizeof(key_id)))
return -1;
- (*resp)->servers->key_name = tr_new_name(key_id);
+ resp->servers->key_name = tr_new_name(key_id);
/* Generate the server key */
// fprintf(stderr, "Generating the server key.\n");
if (0 > (s_keylen = tr_compute_dh_key(&s_keybuf,
req->tidc_dh->pub_key,
- (*resp)->servers->aaa_server_dh))) {
+ resp->servers->aaa_server_dh))) {
fprintf(stderr, "tids_req_handler(): Key computation failed.");
return -1;
}
return buflen;
}
-static int tids_handle_request (TIDS_INSTANCE *tids, TR_MSG *mreq, TID_RESP **resp)
+static int tids_handle_request (TIDS_INSTANCE *tids, TR_MSG *mreq, TID_RESP *resp)
{
int rc;
(!mreq->tid_req->realm) ||
(!mreq->tid_req->comm)) {
fprintf(stderr, "tids_handle_request():Not a valid TID Request.\n");
- (*resp)->result = TID_ERROR;
- (*resp)->err_msg = tr_new_name("Bad request format");
+ resp->result = TID_ERROR;
+ resp->err_msg = tr_new_name("Bad request format");
return -1;
}
/* Call the caller's request handler */
/* TBD -- Handle different error returns/msgs */
- if (0 > (rc = (*tids->req_handler)(tids, mreq->tid_req, &(*resp), tids->cookie))) {
+ if (0 > (rc = (*tids->req_handler)(tids, mreq->tid_req, resp, tids->cookie))) {
/* set-up an error response */
- (*resp)->result = TID_ERROR;
- if (!(*resp)->err_msg) /* Use msg set by handler, if any */
- (*resp)->err_msg = tr_new_name("Internal processing error");
+ resp->result = TID_ERROR;
+ if (!resp->err_msg) /* Use msg set by handler, if any */
+ resp->err_msg = tr_new_name("Internal processing error");
}
else {
/* set-up a success response */
- (*resp)->result = TID_SUCCESS;
- (*resp)->err_msg = NULL; /* No error msg on successful return */
+ resp->result = TID_SUCCESS;
+ resp->err_msg = NULL; /* No error msg on successful return */
}
return rc;
return;
}
- if (0 > (rc = tids_handle_request(tids, mreq, &resp))) {
+ if (0 > (rc = tids_handle_request(tids, mreq, resp))) {
fprintf(stderr, "tids_handle_connection: Error from tids_handle_request(), rc = %d.\n", rc);
/* Fall through, to send the response, either way */
}
static int tr_tids_req_handler (TIDS_INSTANCE *tids,
TID_REQ *orig_req,
- TID_RESP **resp,
+ TID_RESP *resp,
void *tr)
{
TIDC_INSTANCE *tidc = NULL;
int oaction = TR_FILTER_ACTION_REJECT;
int rc = 0;
- if ((!tids) || (!orig_req) || (!resp) || (!(*resp)) || (!tr)) {
+ if ((!tids) || (!orig_req) || (!resp) || (!tr)) {
fprintf(stderr, "tids_req_handler: Bad parameters\n");
return -1;
}