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;
}
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;
}
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;
}
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;
}
* 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;
}
c = (unsigned char)*++name;
} while(c != 0);
- return 1;
+ return !hookable || afb_api_is_hookable(name);
}
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 "$"
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;