static TR_CFG_RC tr_cfg_parse_internal (TR_INSTANCE *tr, json_t *jcfg) {
json_t *jint = NULL;
json_t *jmtd = NULL;
+ json_t *jtp = NULL;
json_t *jhname = NULL;
if ((!tr) || (!tr->new_cfg) || (!jcfg))
/* If not configured, use the default */
tr->new_cfg->internal->max_tree_depth = TR_DEFAULT_MAX_TREE_DEPTH;
}
+ if (NULL != (jtp = json_object_get(jint, "tids_port"))) {
+ if (json_is_number(jtp)) {
+ tr->new_cfg->internal->tids_port = json_integer_value(jtp);
+ } else {
+ fprintf(stderr,"tr_cfg_parse_internal: Parsing error, port is not a number.\n");
+ return TR_CFG_NOPARSE;
+ }
+ } else {
+ /* If not configured, use the default */
+ tr->new_cfg->internal->tids_port = TR_DEFAULT_TIDS_PORT;
+ }
if (NULL != (jhname = json_object_get(jint, "hostname"))) {
if (json_is_string(jhname)) {
tr->new_cfg->internal->hostname = json_string_value(jhname);
#include <tr_msg.h>
#include <tr_rp.h>
-#define TRUST_ROUTER_PORT 12308
-
typedef struct tr_instance {
struct tr_cfg *new_cfg; /* unapplied configuration */
struct tr_cfg *active_cfg;
#include <tr_comm.h>
#define TR_DEFAULT_MAX_TREE_DEPTH 12
+#define TR_DEFAULT_TR_PORT 12308
+#define TR_DEFAULT_TIDS_PORT 12309
typedef enum tr_cfg_rc {
TR_CFG_SUCCESS = 0, /* No error */
typedef struct tr_cfg_internal {
unsigned int max_tree_depth;
+ unsigned int tids_port;
const char *hostname;
} TR_CFG_INTERNAL;
/* TID Server functions, in tid/tids.c */
TR_EXPORT TIDS_INSTANCE *tids_create (void);
TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler,
- tids_auth_func *auth_handler, const char *hostname,
- void *cookie);
+ tids_auth_func *auth_handler, const char *hostname,
+ unsigned int port, void *cookie);
TR_EXPORT int tids_send_response (TIDS_INSTANCE *tids, TID_REQ *req, TID_RESP *resp);
TR_EXPORT int tids_send_err_response (TIDS_INSTANCE *tids, TID_REQ *req, const char *err_msg);
TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids);
tids->ipaddr = ipaddr;
/* Start-up the server, won't return unless there is an error. */
- rc = tids_start(tids, &tids_req_handler , auth_handler, hostname, gssname);
+ rc = tids_start(tids, &tids_req_handler , auth_handler, hostname, TID_PORT, gssname);
fprintf(stdout, "Error in tids_start(), rc = %d. Exiting.\n", rc);
TIDS_REQ_FUNC *req_handler,
tids_auth_func *auth_handler,
const char *hostname,
+ unsigned int port,
void *cookie)
{
int listen = -1;
int conn = -1;
pid_t pid;
- if (0 > (listen = tids_listen(tids, TID_PORT)))
+ if (0 > (listen = tids_listen(tids, port)))
perror ("Error from tids_listen()");
/* store the caller's request handler & cookie */
{"tr_internal":{"max_tree_depth": 4,
- "hostname":"tr.painless-security.com"}}
\ No newline at end of file
+ "tids_port": 12309,
+ "hostname":"moonshot-proxy.local"}}
\ No newline at end of file
}
/* start the trust path query server, won't return unless fatal error. */
- if (0 != (err = tids_start(tr->tids, &tr_tids_req_handler, &tr_tids_gss_handler, tr->active_cfg->internal->hostname, (void *)tr))) {
+ if (0 != (err = tids_start(tr->tids, &tr_tids_req_handler, &tr_tids_gss_handler, tr->active_cfg->internal->hostname, tr->active_cfg->internal->tids_port, (void *)tr))) {
fprintf (stderr, "Error from Trust Path Query Server, err = %d.\n", err);
exit(err);
}