aboutsummaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-09-18 17:39:13 +0000
committerWayne Davison <wayned@samba.org>2006-09-18 17:39:13 +0000
commit8f4ae68ca7f1114c76494c0a2d56badd72f2ac32 (patch)
treed7ec4c0978b530758ed1ae11a5db556cc358c0fd /options.c
parentff1b9344c965a6dcad791a58024fb5886ae0637e (diff)
downloadandroid_external_rsync-8f4ae68ca7f1114c76494c0a2d56badd72f2ac32.tar.gz
android_external_rsync-8f4ae68ca7f1114c76494c0a2d56badd72f2ac32.tar.bz2
android_external_rsync-8f4ae68ca7f1114c76494c0a2d56badd72f2ac32.zip
The [ & ] are now removed from a literal IPv6 hostname passed to the
remote shell.
Diffstat (limited to 'options.c')
-rw-r--r--options.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/options.c b/options.c
index ec57901c..44b7b038 100644
--- a/options.c
+++ b/options.c
@@ -1780,10 +1780,10 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
{
char *p;
int not_host;
+ int hostlen;
if (port_ptr && strncasecmp(URL_PREFIX, s, strlen(URL_PREFIX)) == 0) {
char *path;
- int hostlen;
s += strlen(URL_PREFIX);
if ((p = strchr(s, '/')) != NULL) {
hostlen = p - s;
@@ -1811,6 +1811,8 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
}
if (*s == '[' && (p = strchr(s, ']')) != NULL && p[1] == ':') {
+ s++;
+ hostlen = p - s;
*p = '\0';
not_host = strchr(s, '/') || !strchr(s, ':');
*p = ']';
@@ -1820,6 +1822,7 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
} else {
if (!(p = strchr(s, ':')))
return NULL;
+ hostlen = p - s;
*p = '\0';
not_host = strchr(s, '/') != NULL;
*p = ':';
@@ -1827,8 +1830,8 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
return NULL;
}
- *host_ptr = new_array(char, p - s + 1);
- strlcpy(*host_ptr, s, p - s + 1);
+ *host_ptr = new_array(char, hostlen + 1);
+ strlcpy(*host_ptr, s, hostlen + 1);
if (p[1] == ':') {
if (port_ptr && !*port_ptr)