diff options
author | José Bollo <jose.bollo@iot.bzh> | 2019-10-24 11:11:23 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-10-24 11:11:23 +0200 |
commit | df80ab073c4b6c668e5ebedac01a0cfda7ff7c69 (patch) | |
tree | ebd477166aa10d1c2e6ab867a93b30b6ab7c976e /src/cyn.c | |
parent | 6b5d5750a179def14ed48f1700aaefd5e5b0e059 (diff) |
Unic routine for checking agent names
Change-Id: Ibd3601ce97b4bc9e1035642584df0fe7788716db
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/cyn.c')
-rw-r--r-- | src/cyn.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -27,12 +27,12 @@ #include <stdbool.h> #include <string.h> #include <errno.h> -#include <ctype.h> #include "data.h" #include "db.h" #include "queue.h" #include "cyn.h" +#include "names.h" #if !CYN_SEARCH_DEEP_MAX # define CYN_SEARCH_DEEP_MAX 10 @@ -557,31 +557,6 @@ cyn_query_reply( free(query); } -/** - * Check the name and compute its length. Returns 0 in case of invalid name - * @param name the name to check - * @return the length of the name or zero if invalid - */ -static -size_t -agent_check_name( - const char *name -) { - char c; - size_t length = 0; - if (name) { - while ((c = name[length])) { - if (length > UINT8_MAX - || (!isalnum(c) && !strchr("@_-$", c))) { - length = 0; - break; - } - length++; - } - } - return length; -} - /* see cyn.h */ int cyn_agent_add( |