#include <fcntl.h>
#include <string.h>
#include <stdio.h>
-#include <errno.h>
#include <sys/socket.h>
#include <sys/wait.h>
-#include <netdb.h>
#include <jansson.h>
#include <talloc.h>
#include <poll.h>
#include <tr_gss.h>
#include <tr_event.h>
-static TID_RESP *tids_create_response(TALLOC_CTX *mem_ctx, TIDS_INSTANCE *tids, TID_REQ *req)
+/**
+ * Create a response with minimal fields filled in
+ *
+ * @param mem_ctx talloc context for the return value
+ * @param req request to respond to
+ * @return new response structure allocated in the mem_ctx context
+ */
+static TID_RESP *tids_create_response(TALLOC_CTX *mem_ctx, TID_REQ *req)
{
TID_RESP *resp=NULL;
int success=0;
* Produces a JSON-encoded msg containing the TID response
*
* @param mem_ctx talloc context for the return value
- * @param tids TIDS_INSTANCE handling the request
- * @param req incoming request
* @param resp outgoing response
* @return JSON-encoded message containing the TID response
*/
-static char *tids_encode_response(TALLOC_CTX *mem_ctx, TIDS_INSTANCE *tids, TID_REQ *req, TID_RESP *resp)
+static char *tids_encode_response(TALLOC_CTX *mem_ctx, TID_RESP *resp)
{
TR_MSG mresp;
char *resp_buf = NULL;
if (req->resp_sent)
return 0;
- if (NULL == (resp = tids_create_response(req, tids, req))) {
+ if (NULL == (resp = tids_create_response(req, req))) {
tr_crit("tids_send_err_response: Can't create response.");
return -1;
}
*
* Part of the public interface
*
- * @param tids
+ * @param tids not actually used, but kept for ABI compatibility
* @param req
* @param resp
* @return
if (req->resp_sent)
return 0;
- resp_buf = tids_encode_response(NULL, tids, req, resp);
+ resp_buf = tids_encode_response(NULL, NULL);
if (resp_buf == NULL) {
tr_err("tids_send_response: Error encoding json response.");
tr_audit_req(req);
/* Allocate a response structure and populate common fields. The resp is in req's talloc context,
* which will be cleaned up when mreq is freed. */
- resp = tids_create_response(req, tids, req);
+ resp = tids_create_response(req, req);
if (resp == NULL) {
/* If we were unable to create a response, we cannot reply. Log an
* error if we can, then drop the request. */
}
/* Convert the completed response into an encoded response */
- resp_str = tids_encode_response(mem_ctx, tids, req, resp);
+ resp_str = tids_encode_response(mem_ctx, NULL);
/* Finished; free the request and return */
tr_msg_free_decoded(mreq); // this frees req and resp, too