summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2010-02-06 21:50:59 +0100
committerDenys Vlasenko2010-02-06 21:50:59 +0100
commitcb7edc26611f8df6b81ef4337206d5833ea98771 (patch)
treece211298be0d9f7d59d31139b47a5f915966e193 /libbb
parent0cd445f4d1ff322051ca2ad869e8757bb5ac2227 (diff)
downloadbusybox-cb7edc26611f8df6b81ef4337206d5833ea98771.zip
busybox-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 c1641d3..8b4deec 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;
}