*/
#include <stdio.h>
-#include <stdlib.h>
#include <jansson.h>
-#include <gsscon.h>
#include <trust_router/tr_dh.h>
#include <trust_router/tid.h>
free(tidc);
}
-TID_REQ *tid_dup_req (TID_REQ *orig_req)
-{
- TID_REQ *new_req = NULL;
-
- if (NULL == (new_req = malloc(sizeof(TID_REQ)))) {
- fprintf(stderr, "tid_dup_req: Can't allocated duplicate request.\n");
- return NULL;
- }
-
- /* Memcpy for flat fields, not valid until names are duped. */
- memcpy(new_req, orig_req, sizeof(TID_REQ));
-
- if ((NULL == (new_req->rp_realm = tr_dup_name(orig_req->rp_realm))) ||
- (NULL == (new_req->realm = tr_dup_name(orig_req->realm))) ||
- (NULL == (new_req->comm = tr_dup_name(orig_req->comm)))) {
- fprintf(stderr, "tid_dup_req: Can't duplicate request (names).\n");
- }
-
- if (orig_req->orig_coi) {
- if (NULL == (new_req->orig_coi = tr_dup_name(orig_req->orig_coi))) {
- fprintf(stderr, "tid_dup_req: Can't duplicate request (orig_coi).\n");
- }
- }
-
- return new_req;
-}
-
int tidc_open_connection (TIDC_INSTANCE *tidc,
char *server,
+ unsigned int port,
gss_ctx_id_t *gssctx)
{
int err = 0;
int conn = -1;
+ unsigned int use_port = 0;
+
+ if (0 == port)
+ use_port = TID_PORT;
+ else
+ use_port = port;
- err = gsscon_connect(server, TID_PORT, "trustidentity", &conn, gssctx);
+ fprintf(stderr, "tidc_open_connection: Opening GSS connection to %s:%u.", server, use_port);
+ err = gsscon_connect(server, use_port, "trustidentity", &conn, gssctx);
if (!err)
return conn;
if (msg)
free(msg);
if (tid_req)
- free(tid_req);
+ tid_req_free(tid_req);
if (req_buf)
free(req_buf);
if (resp_buf)
return 0;
}
-
-
-
-