summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-05-09 14:31:15 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-05-09 14:43:59 +0200
commit19718b97ba13390ff5f2b7453d0297e936db5653 (patch)
tree663937818ceeef46ecdf34829bea4902f34ef5d7
parent9b8b1412c3c4a80df713abd02f172d87397adaf0 (diff)
downloadouroboros-19718b97ba13390ff5f2b7453d0297e936db5653.tar.gz
ouroboros-19718b97ba13390ff5f2b7453d0297e936db5653.zip
irmd: Fix unbinding AP and AP-Is from a name
APs and AP-Is were not removed from the registry entry for that name. Reported by: loic.vervaeke@ugent.be Tested by: loic.vervaeke@ugent.be
-rw-r--r--src/irmd/api_table.c2
-rw-r--r--src/irmd/api_table.h2
-rw-r--r--src/irmd/main.c16
3 files changed, 16 insertions, 4 deletions
diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c
index 268f8231..580191da 100644
--- a/src/irmd/api_table.c
+++ b/src/irmd/api_table.c
@@ -142,7 +142,7 @@ int api_entry_add_name(struct api_entry * e,
}
void api_entry_del_name(struct api_entry * e,
- char * name)
+ const char * name)
{
struct list_head * p = NULL;
struct list_head * h = NULL;
diff --git a/src/irmd/api_table.h b/src/irmd/api_table.h
index f9c4d0aa..1bb73df7 100644
--- a/src/irmd/api_table.h
+++ b/src/irmd/api_table.h
@@ -67,7 +67,7 @@ int api_entry_add_name(struct api_entry * e,
char * name);
void api_entry_del_name(struct api_entry * e,
- char * name);
+ const char * name);
int api_table_add(struct list_head * api_table,
struct api_entry * e);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index c9c989c5..3331c754 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -630,6 +630,8 @@ static int bind_api(pid_t api,
static int unbind_ap(char * ap,
char * name)
{
+ struct reg_entry * e;
+
if (ap == NULL)
return -EINVAL;
@@ -642,6 +644,10 @@ static int unbind_ap(char * ap,
apn_entry_del_name(e, name);
}
+ e = registry_get_entry(&irmd.registry, name);
+ if (e != NULL)
+ reg_entry_del_apn(e, ap);
+
pthread_rwlock_unlock(&irmd.reg_lock);
if (name == NULL)
@@ -652,9 +658,11 @@ static int unbind_ap(char * ap,
return 0;
}
-static int unbind_api(pid_t api,
- char * name)
+static int unbind_api(pid_t api,
+ const char * name)
{
+ struct reg_entry * e;
+
pthread_rwlock_wrlock(&irmd.reg_lock);
if (name == NULL)
@@ -664,6 +672,10 @@ static int unbind_api(pid_t api,
api_entry_del_name(e, name);
}
+ e = registry_get_entry(&irmd.registry, name);
+ if (e != NULL)
+ reg_entry_del_api(e, api);
+
pthread_rwlock_unlock(&irmd.reg_lock);
if (name == NULL)