summaryrefslogtreecommitdiffstats
path: root/bin/rcp
diff options
context:
space:
mode:
authorpirzyk <pirzyk@FreeBSD.org>2001-05-30 16:19:13 +0000
committerpirzyk <pirzyk@FreeBSD.org>2001-05-30 16:19:13 +0000
commitc8969dd00c5ee1c25c896be1e3904c0b31f7106c (patch)
tree74f02322124b489a3f75776d8c531ae2042b165d /bin/rcp
parent39c721b4d07fd21a8cecec9fb4fb7d8c30e8626a (diff)
downloadFreeBSD-src-c8969dd00c5ee1c25c896be1e3904c0b31f7106c.zip
FreeBSD-src-c8969dd00c5ee1c25c896be1e3904c0b31f7106c.tar.gz
Fixed two bugs, first not allowing '.' as a valid login name character
in okname() in util.c and second, returning != 0 when you do have an error from okname in two places in rcp.c. Thanks to Garrett for the POSIX defintion of valid login and group names. PR: bin/25757 MFC after: 3 weeks
Diffstat (limited to 'bin/rcp')
-rw-r--r--bin/rcp/rcp.c8
-rw-r--r--bin/rcp/util.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index 3a09ab4..9b9db6e 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -310,8 +310,10 @@ toremote(targ, argc, argv)
suser = argv[i];
if (*suser == '\0')
suser = pwd->pw_name;
- else if (!okname(suser))
+ else if (!okname(suser)) {
+ ++errs;
continue;
+ }
(void)snprintf(bp, len,
"%s %s -l %s -n %s %s '%s%s%s:%s'",
_PATH_RSH, host, suser, cmd, src,
@@ -391,8 +393,10 @@ tolocal(argc, argv)
suser = argv[i];
if (*suser == '\0')
suser = pwd->pw_name;
- else if (!okname(suser))
+ else if (!okname(suser)) {
+ ++errs;
continue;
+ }
}
len = strlen(src) + CMDNEEDS + 20;
if ((bp = malloc(len)) == NULL)
diff --git a/bin/rcp/util.c b/bin/rcp/util.c
index a8ba4c0..55c474f 100644
--- a/bin/rcp/util.c
+++ b/bin/rcp/util.c
@@ -98,7 +98,7 @@ okname(cp0)
c = *cp;
if (c & 0200)
goto bad;
- if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
+ if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.' )
goto bad;
} while (*++cp);
return (1);
OpenPOWER on IntegriCloud