aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-06 21:50:59 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-06 21:50:59 +0100
commitcb7edc26611f8df6b81ef4337206d5833ea98771 (patch)
treece211298be0d9f7d59d31139b47a5f915966e193 /libbb
parent0cd445f4d1ff322051ca2ad869e8757bb5ac2227 (diff)
downloadbusybox-cb7edc26611f8df6b81ef4337206d5833ea98771.tar.gz
adduser: copy /etc/skel to mew homes. +100 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/die_if_bad_username.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c
index c1641d376..8b4deec29 100644
--- a/libbb/die_if_bad_username.c
+++ b/libbb/die_if_bad_username.c
@@ -18,16 +18,20 @@
void FAST_FUNC die_if_bad_username(const char *name)
{
- goto skip; /* 1st char being dash isn't valid */
+ /* 1st char being dash or dot isn't valid: */
+ goto skip;
+ /* For example, name like ".." can make adduser
+ * chown "/home/.." recursively - NOT GOOD
+ */
+
do {
- if (*name == '-')
+ if (*name == '-' || *name == '.')
continue;
skip:
if (isalnum(*name)
|| *name == '_'
- || *name == '.'
|| *name == '@'
- || (*name == '$' && !*(name + 1))
+ || (*name == '$' && !name[1])
) {
continue;
}