summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/enroll.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-27 19:01:12 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-27 19:01:12 +0000
commit6450c9d385ff9ec5234a489130a45378cafb8a6e (patch)
tree6270bf43428fe4e33594a86245b68503a4cca756 /src/ipcpd/normal/enroll.c
parent7baebbfc117e3b349f397d4675c49a582d13653a (diff)
parentd06cb62e111be1ac3f09398ae559f99e4833b4bf (diff)
downloadouroboros-6450c9d385ff9ec5234a489130a45378cafb8a6e.tar.gz
ouroboros-6450c9d385ff9ec5234a489130a45378cafb8a6e.zip
Merged in dstaesse/ouroboros/be-cacep (pull request #393)
lib: Split authentication from CACEP
Diffstat (limited to 'src/ipcpd/normal/enroll.c')
-rw-r--r--src/ipcpd/normal/enroll.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c
index b420533e..5c7ebd7e 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 conn_info info;
+ struct conn_info info;
cdap_key_t key;
enum cdap_opcode oc;
char * name;
@@ -61,27 +61,20 @@ int enroll_handle(int fd)
char * members_ro = MEMBERS_PATH;
char * dif_ro = DIF_PATH;
- conn_info_init(&info);
+ memset(&info, 0, sizeof(info));
- info.proto.protocol = strdup(CDAP_PROTO);
- if (info.proto.protocol == NULL) {
- conn_info_fini(&info);
- return -ENOMEM;
- }
-
- info.proto.pref_version = 1;
- info.proto.pref_syntax = PROTO_GPB;
+ strcpy(info.ae_name, ENROLL_AE);
+ strcpy(info.protocol, CDAP_PROTO);
+ info.pref_version = 1;
+ info.pref_syntax = PROTO_GPB;
- flow = cdap_flow_arr(fd, 0, ANONYMOUS_AUTH, &info);
+ flow = cdap_flow_arr(fd, 0, &info);
if (flow == NULL) {
log_err("Failed to auth enrollment request.");
- conn_info_fini(&info);
flow_dealloc(fd);
return -1;
}
- conn_info_fini(&info);
-
while (!(boot_r && members_r && dif_name_r)) {
key = cdap_request_wait(flow->ci, &oc, &name, &data,
(size_t *) &len , &flags);
@@ -156,7 +149,7 @@ int enroll_handle(int fd)
int enroll_boot(char * dst_name)
{
struct cdap_flow * flow;
- struct conn_info info;
+ struct conn_info info;
cdap_key_t key;
uint8_t * data;
size_t len;
@@ -170,26 +163,19 @@ int enroll_boot(char * dst_name)
char * members_ro = MEMBERS_PATH;
char * dif_ro = DIF_PATH;
- conn_info_init(&info);
+ memset(&info, 0, sizeof(info));
- info.proto.protocol = strdup(CDAP_PROTO);
- if (info.proto.protocol == NULL) {
- conn_info_fini(&info);
- return -ENOMEM;
- }
-
- info.proto.pref_version = 1;
- info.proto.pref_syntax = PROTO_GPB;
+ strcpy(info.ae_name, ENROLL_AE);
+ strcpy(info.protocol, CDAP_PROTO);
+ info.pref_version = 1;
+ info.pref_syntax = PROTO_GPB;
- flow = cdap_flow_alloc(dst_name, NULL, ANONYMOUS_AUTH, &info);
+ flow = cdap_flow_alloc(dst_name, NULL, &info);
if (flow == NULL) {
log_err("Failed to allocate flow for enrollment request.");
- conn_info_fini(&info);
return -1;
}
- conn_info_fini(&info);
-
log_dbg("Getting boot information from %s.", dst_name);
clock_gettime(CLOCK_REALTIME, &t0);