From d94d2b0a9e30fee32cf312acc5f9f45c8f6a09c4 Mon Sep 17 00:00:00 2001 From: Kyeong Yoo Date: Wed, 14 Feb 2018 13:36:13 +1300 Subject: [PATCH] adduser: Allow '@', '%', '/' and '\' in username Allow '@', '%', '/' and '\' in username for adduser command to support usernames in the form of : username@domain username%domain domain/username domain\username Username in those forms may have some limitations in various services like email, ssh, but simply disallowing them prevents more generic use of the username based on email address or name with realm. --- libbb/die_if_bad_username.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c index 46f1033404..eb69084d86 100644 --- a/libbb/die_if_bad_username.c +++ b/libbb/die_if_bad_username.c @@ -32,6 +32,10 @@ void FAST_FUNC die_if_bad_username(const char *name) /* These chars are valid unless they are at the 1st pos: */ if (*name == '-' || *name == '.' + || *name == '@' + || *name == '%' + || *name == '/' + || *name == '\\' /* $ is allowed if it's the last char: */ || (*name == '$' && !name[1]) ) {