From: Adam Bishop Date: Tue, 9 Dec 2014 13:47:26 +0000 (+0000) Subject: Add some audit messages to be logged X-Git-Tag: 1.5~14^2~6 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=faa5fa75514a2f19933a55c2dfab170c4ce12e4d Add some audit messages to be logged --- diff --git a/tid/tids.c b/tid/tids.c index 811fb4b..ed525d8 100644 --- a/tid/tids.c +++ b/tid/tids.c @@ -45,6 +45,7 @@ #include #include #include +#include #include static TID_RESP *tids_create_response (TIDS_INSTANCE *tids, TID_REQ *req) @@ -266,15 +267,24 @@ int tids_send_response (TIDS_INSTANCE *tids, TID_REQ *req, TID_RESP *resp) if (NULL == (resp_buf = tr_msg_encode(&mresp))) { fprintf(stderr, "tids_send_response: Error encoding json response.\n"); + tr_audit_req(req); + return -1; } fprintf(stderr, "tids_send_response: Encoded response:\n%s\n", resp_buf); + /* If external logging is enabled, fire off a message */ + /* TODO Can be moved to end once segfault in gsscon_write_encrypted_token fixed */ + tr_audit_resp(resp); + /* Send the response over the connection */ if (err = gsscon_write_encrypted_token (req->conn, req->gssctx, resp_buf, strlen(resp_buf) + 1)) { fprintf(stderr, "tids_send_response: Error sending response over connection.\n"); + + tr_audit_req(req); + return -1; } @@ -368,6 +378,8 @@ int tids_start (TIDS_INSTANCE *tids, tids->hostname = hostname; tids->cookie = cookie; + tr_info("Trust Path Query Server starting on host %s:%d.", hostname, port); + while(1) { /* accept incoming conns until we are stopped */ if (0 > (conn = accept(listen, NULL, NULL))) { @@ -398,6 +410,9 @@ int tids_start (TIDS_INSTANCE *tids, void tids_destroy (TIDS_INSTANCE *tids) { + /* close syslog connection if syslog is enabled */ + tr_log_close(); + if (tids) free(tids); }