X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Futils.c;h=8fbc7108e9a3ffe8536b317e201fd5f5595566a0;hb=38d7e730e619a8b86dfbf68d77773564595f12a1;hp=797bc3f51540f00771a4275af9c47d4f58a7ace0;hpb=826ad11e419db90b66b3f76a90b54df021bb39fc;p=tinc diff --git a/src/utils.c b/src/utils.c index 797bc3f5..8fbc7108 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,11 +18,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "logger.h" #include "system.h" -#include "xalloc.h" - -#include "../src/logger.h" #include "utils.h" +#include "xalloc.h" static const char hexadecimals[] = "0123456789ABCDEF"; static const char base64_original[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -181,6 +180,17 @@ unsigned int bitfield_to_int(const void *bitfield, size_t size) { return value; } +bool check_id(const char *id) { + if(!id || !*id) + return false; + + for(; *id; id++) + if(!isalnum(*id) && *id != '_') + return false; + + return true; +} + char *replace_name(const char *name) { char *ret_name;