aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-api-dbus.c2
-rw-r--r--src/afb-api-so-v1.c2
-rw-r--r--src/afb-api-so-v2.c2
-rw-r--r--src/afb-api-ws.c2
-rw-r--r--src/afb-api.c4
-rw-r--r--src/afb-api.h2
-rw-r--r--src/afb-export.c2
7 files changed, 8 insertions, 8 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index c66426e9..ad640fb2 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -113,7 +113,7 @@ static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pat
goto error2;
}
api->api++;
- if (!afb_api_is_valid_name(api->api)) {
+ if (!afb_api_is_valid_name(api->api, 1)) {
errno = EINVAL;
goto error2;
}
diff --git a/src/afb-api-so-v1.c b/src/afb-api-so-v1.c
index 9a9e47a4..c77ab724 100644
--- a/src/afb-api-so-v1.c
+++ b/src/afb-api-so-v1.c
@@ -239,7 +239,7 @@ int afb_api_so_v1_add(const char *path, void *handle, struct afb_apiset *apiset)
ERROR("binding [%s] bad prefix...", path);
goto error;
}
- if (!afb_api_is_valid_name(desc->binding->v1.prefix)) {
+ if (!afb_api_is_valid_name(desc->binding->v1.prefix, 1)) {
ERROR("binding [%s] invalid prefix...", path);
goto error;
}
diff --git a/src/afb-api-so-v2.c b/src/afb-api-so-v2.c
index ba53223f..5954eb11 100644
--- a/src/afb-api-so-v2.c
+++ b/src/afb-api-so-v2.c
@@ -230,7 +230,7 @@ int afb_api_so_v2_add(const char *path, void *handle, struct afb_apiset *apiset)
ERROR("binding [%s] bad api name...", path);
goto error;
}
- if (!afb_api_is_valid_name(binding->api)) {
+ if (!afb_api_is_valid_name(binding->api, 1)) {
ERROR("binding [%s] invalid api name...", path);
goto error;
}
diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c
index 1a463587..0e4d1d05 100644
--- a/src/afb-api-ws.c
+++ b/src/afb-api-ws.c
@@ -73,7 +73,7 @@ static struct api_ws *api_ws_make(const char *path)
while (length && path[length - 1] != '/' && path[length - 1] != ':')
length = length - 1;
api->api = &api->path[length];
- if (api->api == NULL || !afb_api_is_valid_name(api->api)) {
+ if (api->api == NULL || !afb_api_is_valid_name(api->api, 1)) {
errno = EINVAL;
goto error2;
}
diff --git a/src/afb-api.c b/src/afb-api.c
index 38ec4f25..7c4598d2 100644
--- a/src/afb-api.c
+++ b/src/afb-api.c
@@ -29,7 +29,7 @@
* Checks wether 'name' is a valid API name.
* @return 1 if valid, 0 otherwise
*/
-int afb_api_is_valid_name(const char *name)
+int afb_api_is_valid_name(const char *name, int hookable)
{
unsigned char c;
@@ -60,6 +60,6 @@ int afb_api_is_valid_name(const char *name)
}
c = (unsigned char)*++name;
} while(c != 0);
- return 1;
+ return !hookable || afb_api_is_hookable(name);
}
diff --git a/src/afb-api.h b/src/afb-api.h
index a9de8434..ff1bc108 100644
--- a/src/afb-api.h
+++ b/src/afb-api.h
@@ -38,7 +38,7 @@ struct afb_api
const void *group;
};
-extern int afb_api_is_valid_name(const char *name);
+extern int afb_api_is_valid_name(const char *name, int hookable);
#define AFB_API_UNHOOKABLE_PREFIX_CHAR '$'
#define AFB_API_UNHOOKABLE_PREFIX_STRING "$"
diff --git a/src/afb-export.c b/src/afb-export.c
index 304395ae..98964bf9 100644
--- a/src/afb-export.c
+++ b/src/afb-export.c
@@ -241,7 +241,7 @@ static int rename_api_cb(void *closure, const char *name)
errno = EINVAL;
return -1;
}
- if (!afb_api_is_valid_name(name)) {
+ if (!afb_api_is_valid_name(name, 1)) {
ERROR("[API %s] Can't rename to %s: bad API name", export->apiname, name);
errno = EINVAL;
return -1;