X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/2d0a6606ee8899dfe372bbdc760fd15c14f3fceb..6ebc4527c6a103d0532c08744fb916f951018413:/lib/trackdb.c diff --git a/lib/trackdb.c b/lib/trackdb.c index d2ebe07..628498a 100644 --- a/lib/trackdb.c +++ b/lib/trackdb.c @@ -59,6 +59,7 @@ #include "unidata.h" #include "base64.h" #include "sendmail.h" +#include "validity.h" #define RESCAN "disorder-rescan" #define DEADLOCK "disorder-deadlock" @@ -3013,32 +3014,6 @@ static int trusted(const char *user) { return n < config->trust.n; } -/** @brief Return non-zero for a valid username - * @param user Candidate username - * @return Nonzero if it's valid - * - * Currently we only allow the letters and digits in ASCII. We could be more - * liberal than this but it is a nice simple test. It is critical that - * semicolons are never allowed. - * - * NB also used by playlist_parse_name() to validate playlist names! - */ -int valid_username(const char *user) { - if(!*user) - return 0; - while(*user) { - const uint8_t c = *user++; - /* For now we are very strict */ - if((c >= 'a' && c <= 'z') - || (c >= 'A' && c <= 'Z') - || (c >= '0' && c <= '9')) - /* ok */; - else - return 0; - } - return 1; -} - /** @brief Add a user * @param user Username * @param password Initial password or NULL