summaryrefslogtreecommitdiff
path: root/src/irmd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-04-27 16:17:39 +0000
committerSander Vrijders <[email protected]>2017-04-27 16:17:39 +0000
commitee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4 (patch)
tree137c34f79897b5f371a65dd14208b77201d1e907 /src/irmd/ipcp.c
parent1f8f2ebe3bb385593755b69bd264ff5f831a22ae (diff)
parentb398dbe5cfd12b928e00f9a22cd6826bbdfb18d7 (diff)
downloadouroboros-ee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4.tar.gz
ouroboros-ee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4.zip
Merged in dstaesse/ouroboros/be-cap (pull request #495)
Be cap
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r--src/irmd/ipcp.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index 7a32dd88..182970b1 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -212,13 +212,13 @@ int ipcp_bootstrap(pid_t api,
return ret;
}
-/* return the hash algorithm */
-int ipcp_enroll(pid_t api,
- const char * dst)
+int ipcp_enroll(pid_t api,
+ const char * dst,
+ struct dif_info * info)
{
- ipcp_msg_t msg = IPCP_MSG__INIT;
+ ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
- int ret = -1;
+ int ret = -1;
if (dst == NULL)
return -EINVAL;
@@ -236,9 +236,23 @@ int ipcp_enroll(pid_t api,
}
ret = recv_msg->result;
+ if (ret != 0) {
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+ return ret;
+ }
+
+ if (!recv_msg->has_dir_hash_algo || recv_msg->dif_name == NULL) {
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+ return -EIPCP;
+ }
+
+ info->algo = recv_msg->dir_hash_algo;
+
+ strcpy(info->dif_name, recv_msg->dif_name);
+
ipcp_msg__free_unpacked(recv_msg, NULL);
- return ret;
+ return 0;
}
int ipcp_reg(pid_t api,