From 48599a14144725dedc45f7558d814950791d069d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 24 Feb 2017 11:32:24 +0100 Subject: Revise CACEP API The information passed to CACEP is split between the information about the connection and the information to be used during the authentication exchange. --- src/ipcpd/normal/cdap_flow.c | 24 +++++++++--------- src/ipcpd/normal/cdap_flow.h | 20 +++++++-------- src/ipcpd/normal/enroll.c | 20 +++++++-------- src/ipcpd/normal/fmgr.c | 18 ++++++------- src/ipcpd/normal/gam.c | 52 +++++++++++++++++++------------------- src/ipcpd/normal/gam.h | 8 +++--- src/ipcpd/normal/pol-gam-ops.h | 8 +++--- src/ipcpd/normal/pol/complete.c | 2 +- src/ipcpd/normal/pol/complete.h | 6 ++--- src/lib/cacep.c | 50 +++++++++++++++++++----------------- src/lib/pol/cacep_anonymous_auth.c | 40 ++++++++++++++++------------- src/lib/pol/cacep_anonymous_auth.h | 10 +++++--- src/lib/pol/cacep_simple_auth.c | 39 ++++++++++++++++------------ src/lib/pol/cacep_simple_auth.h | 10 +++++--- 14 files changed, 163 insertions(+), 144 deletions(-) (limited to 'src') diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c index a94627c2..71ebcc03 100644 --- a/src/ipcpd/normal/cdap_flow.c +++ b/src/ipcpd/normal/cdap_flow.c @@ -38,17 +38,17 @@ static void cdap_flow_destroy(struct cdap_flow * flow) if (flow->ci != NULL) cdap_destroy(flow->ci); if (flow->info != NULL) { - cacep_info_fini(flow->info); + conn_info_fini(flow->info); free(flow->info); } free(flow); } -struct cdap_flow * cdap_flow_arr(int fd, - int resp, - enum pol_cacep pc, - const struct cacep_info * info) +struct cdap_flow * cdap_flow_arr(int fd, + int resp, + enum pol_cacep pc, + const struct conn_info * info) { struct cdap_flow * flow; @@ -69,7 +69,7 @@ struct cdap_flow * cdap_flow_arr(int fd, flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth_wait(fd, pc, info); + flow->info = cacep_auth_wait(fd, pc, info, NULL); if (flow->info == NULL) { log_err("Other side failed to authenticate."); cdap_flow_destroy(flow); @@ -86,11 +86,11 @@ struct cdap_flow * cdap_flow_arr(int fd, return flow; } -struct cdap_flow * cdap_flow_alloc(const char * dst_name, - const char * ae_name, - qosspec_t * qs, - enum pol_cacep pc, - const struct cacep_info * info) +struct cdap_flow * cdap_flow_alloc(const char * dst_name, + const char * ae_name, + qosspec_t * qs, + enum pol_cacep pc, + const struct conn_info * info) { struct cdap_flow * flow; int fd; @@ -123,7 +123,7 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth(fd, pc, info); + flow->info = cacep_auth(fd, pc, info, NULL); if (flow->info == NULL) { log_err("Failed to authenticate."); cdap_flow_dealloc(flow); diff --git a/src/ipcpd/normal/cdap_flow.h b/src/ipcpd/normal/cdap_flow.h index c5ca2ab4..14a04f02 100644 --- a/src/ipcpd/normal/cdap_flow.h +++ b/src/ipcpd/normal/cdap_flow.h @@ -30,19 +30,19 @@ struct cdap_flow { int fd; struct cdap * ci; - struct cacep_info * info; + struct conn_info * info; }; -struct cdap_flow * cdap_flow_arr(int fd, - int resp, - enum pol_cacep pc, - const struct cacep_info * info); +struct cdap_flow * cdap_flow_arr(int fd, + int resp, + enum pol_cacep pc, + const struct conn_info * info); -struct cdap_flow * cdap_flow_alloc(const char * dst_name, - const char * ae_name, - qosspec_t * qs, - enum pol_cacep pc, - const struct cacep_info * info); +struct cdap_flow * cdap_flow_alloc(const char * dst_name, + const char * ae_name, + qosspec_t * qs, + enum pol_cacep pc, + const struct conn_info * info); void cdap_flow_dealloc(struct cdap_flow * flow); diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index ce6768fb..78bc4d51 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -44,7 +44,7 @@ int enroll_handle(int fd) { struct cdap_flow * flow; - struct cacep_info info; + struct conn_info info; cdap_key_t key; enum cdap_opcode oc; char * name; @@ -61,11 +61,11 @@ int enroll_handle(int fd) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - cacep_info_init(&info); + conn_info_init(&info); info.proto.protocol = strdup(CDAP_PROTO); if (info.proto.protocol == NULL) { - cacep_info_fini(&info); + conn_info_fini(&info); return -ENOMEM; } @@ -75,12 +75,12 @@ int enroll_handle(int fd) flow = cdap_flow_arr(fd, 0, ANONYMOUS_AUTH, &info); if (flow == NULL) { log_err("Failed to auth enrollment request."); - cacep_info_fini(&info); + conn_info_fini(&info); flow_dealloc(fd); return -1; } - cacep_info_fini(&info); + conn_info_fini(&info); while (!(boot_r && members_r && dif_name_r)) { key = cdap_request_wait(flow->ci, &oc, &name, &data, @@ -156,7 +156,7 @@ int enroll_handle(int fd) int enroll_boot(char * dst_name) { struct cdap_flow * flow; - struct cacep_info info; + struct conn_info info; cdap_key_t key; uint8_t * data; size_t len; @@ -170,11 +170,11 @@ int enroll_boot(char * dst_name) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - cacep_info_init(&info); + conn_info_init(&info); info.proto.protocol = strdup(CDAP_PROTO); if (info.proto.protocol == NULL) { - cacep_info_fini(&info); + conn_info_fini(&info); return -ENOMEM; } @@ -185,11 +185,11 @@ int enroll_boot(char * dst_name) &info); if (flow == NULL) { log_err("Failed to allocate flow for enrollment request."); - cacep_info_fini(&info); + conn_info_fini(&info); return -1; } - cacep_info_fini(&info); + conn_info_fini(&info); log_dbg("Getting boot information from %s.", dst_name); diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index c2b53abf..74bdda88 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -49,10 +49,10 @@ typedef FlowAllocMsg flow_alloc_msg_t; #define FD_UPDATE_TIMEOUT 100000 /* nanoseconds */ struct nm1_flow { - struct list_head next; - int fd; - qosspec_t qs; - struct cacep_info * info; + struct list_head next; + int fd; + qosspec_t qs; + struct conn_info * info; }; struct { @@ -194,11 +194,11 @@ void * fmgr_nm1_sdu_reader(void * o) static void * fmgr_nm1_flow_wait(void * o) { - qoscube_t cube; - struct cacep_info * info; - int fd; - qosspec_t qs; - struct nm1_flow * flow; + qoscube_t cube; + struct conn_info * info; + int fd; + qosspec_t qs; + struct nm1_flow * flow; (void) o; diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index 791cf34e..02df0be7 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -45,7 +45,7 @@ struct ga { qosspec_t qs; int fd; - struct cacep_info * info; + struct conn_info * info; }; struct gam { @@ -148,10 +148,10 @@ void gam_destroy(struct gam * instance) free(instance); } -static int add_ga(struct gam * instance, - int fd, - qosspec_t qs, - struct cacep_info * info) +static int add_ga(struct gam * instance, + int fd, + qosspec_t qs, + struct conn_info * info) { struct ga * ga; @@ -179,8 +179,8 @@ int gam_flow_arr(struct gam * instance, int fd, qosspec_t qs) { - struct cacep_info * rcv_info; - struct cacep_info snd_info; + struct conn_info * rcv_info; + struct conn_info snd_info; if (flow_alloc_resp(fd, instance->ops->accept_new_flow(instance->ops_o)) < 0) { @@ -188,10 +188,10 @@ int gam_flow_arr(struct gam * instance, return -1; } - cacep_info_init(&snd_info); + conn_info_init(&snd_info); snd_info.proto.protocol = strdup(CDAP_PROTO); if (snd_info.proto.protocol == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } @@ -200,22 +200,22 @@ int gam_flow_arr(struct gam * instance, snd_info.addr = ipcpi.address; snd_info.name = strdup(ipcpi.name); if (snd_info.name == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } - rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info); + rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info, NULL); if (rcv_info == NULL) { log_err("Other side failed to authenticate."); - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -1; } - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -223,7 +223,7 @@ int gam_flow_arr(struct gam * instance, if (add_ga(instance, fd, qs, rcv_info)) { log_err("Failed to add ga to graph adjacency manager list."); flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -235,8 +235,8 @@ int gam_flow_alloc(struct gam * instance, char * dst_name, qosspec_t qs) { - struct cacep_info * rcv_info; - struct cacep_info snd_info; + struct conn_info * rcv_info; + struct conn_info snd_info; int fd; log_dbg("Allocating flow to %s.", dst_name); @@ -253,10 +253,10 @@ int gam_flow_alloc(struct gam * instance, return -1; } - cacep_info_init(&snd_info); + conn_info_init(&snd_info); snd_info.proto.protocol = strdup(CDAP_PROTO); if (snd_info.proto.protocol == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } @@ -265,22 +265,22 @@ int gam_flow_alloc(struct gam * instance, snd_info.addr = ipcpi.address; snd_info.name = strdup(ipcpi.name); if (snd_info.name == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } - rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info); + rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info, NULL); if (rcv_info == NULL) { log_err("Other side failed to authenticate."); - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -1; } - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -288,7 +288,7 @@ int gam_flow_alloc(struct gam * instance, if (add_ga(instance, fd, qs, rcv_info)) { log_err("Failed to add GA to graph adjacency manager list."); flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -298,7 +298,7 @@ int gam_flow_alloc(struct gam * instance, int gam_flow_wait(struct gam * instance, int * fd, - struct cacep_info ** info, + struct conn_info ** info, qosspec_t * qs) { struct ga * ga; diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h index 50f83df9..e4832ca6 100644 --- a/src/ipcpd/normal/gam.h +++ b/src/ipcpd/normal/gam.h @@ -39,9 +39,9 @@ int gam_flow_alloc(struct gam * instance, char * dst_name, qosspec_t qs); -int gam_flow_wait(struct gam * instance, - int * fd, - struct cacep_info ** info, - qosspec_t * qs); +int gam_flow_wait(struct gam * instance, + int * fd, + struct conn_info ** info, + qosspec_t * qs); #endif /* OUROBOROS_IPCPD_NORMAL_GAM_H */ diff --git a/src/ipcpd/normal/pol-gam-ops.h b/src/ipcpd/normal/pol-gam-ops.h index 0721136c..6983e3a0 100644 --- a/src/ipcpd/normal/pol-gam-ops.h +++ b/src/ipcpd/normal/pol-gam-ops.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H #define OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H -#include +#include "conn.h" struct pol_gam_ops { void * (* create)(struct gam * instance); @@ -36,9 +36,9 @@ struct pol_gam_ops { int (* accept_new_flow)(void * o); - int (* accept_flow)(void * o, - qosspec_t qs, - const struct cacep_info * info); + int (* accept_flow)(void * o, + qosspec_t qs, + const struct conn_info * info); }; #endif /* OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H */ diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 5faa1ae8..1d4811d2 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -153,7 +153,7 @@ int complete_accept_new_flow(void * o) int complete_accept_flow(void * o, qosspec_t qs, - const struct cacep_info * info) + const struct conn_info * info) { struct list_head * pos = NULL; struct neighbor * n; diff --git a/src/ipcpd/normal/pol/complete.h b/src/ipcpd/normal/pol/complete.h index 3f08c2e5..8fe1437f 100644 --- a/src/ipcpd/normal/pol/complete.h +++ b/src/ipcpd/normal/pol/complete.h @@ -36,9 +36,9 @@ int complete_stop(void * o); int complete_accept_new_flow(void * o); -int complete_accept_flow(void * o, - qosspec_t qs, - const struct cacep_info * info); +int complete_accept_flow(void * o, + qosspec_t qs, + const struct conn_info * info); struct pol_gam_ops complete_ops = { .create = complete_create, diff --git a/src/lib/cacep.c b/src/lib/cacep.c index 92c028af..89bd05e7 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -28,42 +28,45 @@ #include #include -#include -#include +#include "pol/cacep_anonymous_auth.h" +#include "pol/cacep_simple_auth.h" #include #include #define BUF_SIZE 2048 -int cacep_info_init(struct cacep_info * info) +int conn_info_init(struct conn_info * info) { if (info == NULL) return -EINVAL; info->proto.protocol = NULL; - info->name = NULL; - info->data = NULL; + info->name = NULL; return 0; } -void cacep_info_fini(struct cacep_info * info) +void conn_info_fini(struct conn_info * info) { - if (info->proto.protocol != NULL) + if (info == NULL) + return; + + if (info->proto.protocol != NULL) { free(info->proto.protocol); - if (info->name != NULL) - free(info->name); - if (info->data != NULL) - free(info->data); + info->proto.protocol = NULL; + } - info->name = NULL; - info->data = NULL; + if (info->name != NULL) { + free(info->name); + info->name = NULL; + } } -struct cacep_info * cacep_auth(int fd, - enum pol_cacep pc, - const struct cacep_info * info) +struct conn_info * cacep_auth(int fd, + enum pol_cacep pc, + const struct conn_info * info, + const void * auth) { if (info == NULL) { log_err("No info provided."); @@ -72,20 +75,21 @@ struct cacep_info * cacep_auth(int fd, switch (pc) { case ANONYMOUS_AUTH: - return cacep_anonymous_auth(fd, info); + return cacep_anonymous_auth(fd, info, auth); case SIMPLE_AUTH: if (info == NULL) return NULL; - return cacep_simple_auth_auth(fd, info); + return cacep_simple_auth_auth(fd, info, auth); default: log_err("Unsupported CACEP policy."); return NULL; } } -struct cacep_info * cacep_auth_wait(int fd, - enum pol_cacep pc, - const struct cacep_info * info) +struct conn_info * cacep_auth_wait(int fd, + enum pol_cacep pc, + const struct conn_info * info, + const void * auth) { if (info == NULL) { log_err("No info provided."); @@ -94,11 +98,11 @@ struct cacep_info * cacep_auth_wait(int fd, switch (pc) { case ANONYMOUS_AUTH: - return cacep_anonymous_auth_wait(fd, info); + return cacep_anonymous_auth_wait(fd, info, auth); case SIMPLE_AUTH: if (info == NULL) return NULL; - return cacep_simple_auth_auth_wait(fd, info); + return cacep_simple_auth_auth_wait(fd, info, auth); default: log_err("Unsupported CACEP policy."); return NULL; diff --git a/src/lib/pol/cacep_anonymous_auth.c b/src/lib/pol/cacep_anonymous_auth.c index 1fcc730a..44c7bd17 100644 --- a/src/lib/pol/cacep_anonymous_auth.c +++ b/src/lib/pol/cacep_anonymous_auth.c @@ -43,16 +43,16 @@ typedef CacepProtoMsg cacep_proto_msg_t; #define NAME_LEN 8 /* this policy generates a hex string */ -static struct cacep_info * anonymous_info(void) +static struct conn_info * anonymous_info(void) { - struct cacep_info * info; + struct conn_info * info; struct timespec t; info = malloc(sizeof(*info)); if (info == NULL) return NULL; - cacep_info_init(info); + conn_info_init(info); info->name = malloc(NAME_LEN + 1); if (info->name == NULL) { @@ -71,9 +71,9 @@ static struct cacep_info * anonymous_info(void) return info; } -static struct cacep_info * read_msg(int fd) +static struct conn_info * read_msg(int fd) { - struct cacep_info * tmp; + struct conn_info * tmp; uint8_t buf[BUF_SIZE]; cacep_anonymous_auth_msg_t * msg; ssize_t len; @@ -113,8 +113,8 @@ static struct cacep_info * read_msg(int fd) return tmp; } -static int send_msg(int fd, - const struct cacep_info * info) +static int send_msg(int fd, + const struct conn_info * info) { cacep_anonymous_auth_msg_t msg = CACEP_ANONYMOUS_AUTH_MSG__INIT; cacep_proto_msg_t cmsg = CACEP_PROTO_MSG__INIT; @@ -148,13 +148,16 @@ static int send_msg(int fd, return ret; } -struct cacep_info * cacep_anonymous_auth(int fd, - const struct cacep_info * info) +struct conn_info * cacep_anonymous_auth(int fd, + const struct conn_info * info, + const void * auth) { - struct cacep_info * tmp; + struct conn_info * tmp; assert(info); + (void) auth; + if (send_msg(fd, info)) return NULL; @@ -165,30 +168,31 @@ struct cacep_info * cacep_anonymous_auth(int fd, if (strcmp(info->proto.protocol, tmp->proto.protocol) || info->proto.pref_version != tmp->proto.pref_version || info->proto.pref_syntax != tmp->proto.pref_syntax) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } - tmp->data = NULL; - return tmp; } -struct cacep_info * cacep_anonymous_auth_wait(int fd, - const struct cacep_info * info) +struct conn_info * cacep_anonymous_auth_wait(int fd, + const struct conn_info * info, + const void * auth) { - struct cacep_info * tmp; + struct conn_info * tmp; assert(info); + (void) auth; + tmp = read_msg(fd); if (tmp == NULL) return NULL; if (send_msg(fd, info)) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } @@ -196,7 +200,7 @@ struct cacep_info * cacep_anonymous_auth_wait(int fd, if (strcmp(info->proto.protocol, tmp->proto.protocol) || info->proto.pref_version != tmp->proto.pref_version || info->proto.pref_syntax != tmp->proto.pref_syntax) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } diff --git a/src/lib/pol/cacep_anonymous_auth.h b/src/lib/pol/cacep_anonymous_auth.h index d0229b05..ca47b1b8 100644 --- a/src/lib/pol/cacep_anonymous_auth.h +++ b/src/lib/pol/cacep_anonymous_auth.h @@ -24,10 +24,12 @@ #ifndef OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H #define OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H -struct cacep_info * cacep_anonymous_auth(int fd, - const struct cacep_info * info); +struct conn_info * cacep_anonymous_auth(int fd, + const struct conn_info * info, + const void * auth); -struct cacep_info * cacep_anonymous_auth_wait(int fd, - const struct cacep_info * info); +struct conn_info * cacep_anonymous_auth_wait(int fd, + const struct conn_info * info, + const void * auth); #endif /* OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H */ diff --git a/src/lib/pol/cacep_simple_auth.c b/src/lib/pol/cacep_simple_auth.c index 65c510a2..69189114 100644 --- a/src/lib/pol/cacep_simple_auth.c +++ b/src/lib/pol/cacep_simple_auth.c @@ -38,9 +38,9 @@ typedef CacepProtoMsg cacep_proto_msg_t; #define BUF_SIZE 2048 -static struct cacep_info * read_msg(int fd) +static struct conn_info * read_msg(int fd) { - struct cacep_info * tmp; + struct conn_info * tmp; uint8_t buf[BUF_SIZE]; cacep_simple_auth_msg_t * msg; ssize_t len; @@ -59,7 +59,7 @@ static struct cacep_info * read_msg(int fd) return NULL; } - cacep_info_init(tmp); + conn_info_init(tmp); tmp->addr = msg->addr; tmp->name = strdup(msg->name); @@ -71,7 +71,7 @@ static struct cacep_info * read_msg(int fd) tmp->proto.protocol = strdup(msg->proto->protocol); if (tmp->proto.protocol == NULL) { - free(tmp->name); + conn_info_fini(tmp); free(tmp); cacep_simple_auth_msg__free_unpacked(msg, NULL); return NULL; @@ -80,7 +80,7 @@ static struct cacep_info * read_msg(int fd) tmp->proto.pref_version = msg->proto->pref_version; tmp->proto.pref_syntax = code_to_syntax(msg->proto->pref_syntax); if (tmp->proto.pref_syntax < 0) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); cacep_simple_auth_msg__free_unpacked(msg, NULL); return NULL; @@ -91,8 +91,8 @@ static struct cacep_info * read_msg(int fd) return tmp; } -static int send_msg(int fd, - const struct cacep_info * info) +static int send_msg(int fd, + const struct conn_info * info) { cacep_simple_auth_msg_t msg = CACEP_SIMPLE_AUTH_MSG__INIT; cacep_proto_msg_t cmsg = CACEP_PROTO_MSG__INIT; @@ -128,13 +128,17 @@ static int send_msg(int fd, return ret; } -struct cacep_info * cacep_simple_auth_auth(int fd, - const struct cacep_info * info) +struct conn_info * cacep_simple_auth_auth(int fd, + const struct conn_info * info, + const void * auth) { - struct cacep_info * tmp; + struct conn_info * tmp; assert(info); + /* This policy does not need info to authenticate */ + (void) auth; + if (send_msg(fd, info)) return NULL; @@ -145,7 +149,7 @@ struct cacep_info * cacep_simple_auth_auth(int fd, if (strcmp(info->proto.protocol, tmp->proto.protocol) || info->proto.pref_version != tmp->proto.pref_version || info->proto.pref_syntax != tmp->proto.pref_syntax) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } @@ -154,19 +158,22 @@ struct cacep_info * cacep_simple_auth_auth(int fd, } -struct cacep_info * cacep_simple_auth_auth_wait(int fd, - const struct cacep_info * info) +struct conn_info * cacep_simple_auth_auth_wait(int fd, + const struct conn_info * info, + const void * auth) { - struct cacep_info * tmp; + struct conn_info * tmp; assert(info); + (void) auth; + tmp = read_msg(fd); if (tmp == NULL) return NULL; if (send_msg(fd, info)) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } @@ -174,7 +181,7 @@ struct cacep_info * cacep_simple_auth_auth_wait(int fd, if (strcmp(info->proto.protocol, tmp->proto.protocol) || info->proto.pref_version != tmp->proto.pref_version || info->proto.pref_syntax != tmp->proto.pref_syntax) { - cacep_info_fini(tmp); + conn_info_fini(tmp); free(tmp); return NULL; } diff --git a/src/lib/pol/cacep_simple_auth.h b/src/lib/pol/cacep_simple_auth.h index bbdbe9b9..31398a68 100644 --- a/src/lib/pol/cacep_simple_auth.h +++ b/src/lib/pol/cacep_simple_auth.h @@ -24,10 +24,12 @@ #ifndef OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H #define OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H -struct cacep_info * cacep_simple_auth_auth(int fd, - const struct cacep_info * info); +struct conn_info * cacep_simple_auth_auth(int fd, + const struct conn_info * info, + const void * auth); -struct cacep_info * cacep_simple_auth_auth_wait(int fd, - const struct cacep_info * info); +struct conn_info * cacep_simple_auth_auth_wait(int fd, + const struct conn_info * info, + const void * auth); #endif /* OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H */ -- cgit v1.2.3