[PATCH] look for port number only within host part in rsync:// syntax

Paul Slootman paul at debian.org
Wed Aug 1 12:31:05 GMT 2007


[See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=369904 ]

The following patch stops rsync from confusing the 123 in the following
command line with the port number:

$ rsync /tmp/somefile rsync://backup@otherbox/module/a:123:b
rsync: getaddrinfo: otherbox/module/a 123: Name or service not known

Paul Slootman

Index: options.c
===================================================================
RCS file: /cvsroot/rsync/options.c,v
retrieving revision 1.393
diff -u -r1.393 options.c
--- options.c	24 Jul 2007 04:09:46 -0000	1.393
+++ options.c	1 Aug 2007 12:25:40 -0000
@@ -1981,7 +1981,7 @@
 			if (p[1] == ':')
 				*port_ptr = atoi(p+2);
 		} else {
-			if ((p = strchr(s, ':')) != NULL) {
+			if ((p = strchr(s, ':')) != NULL && p < s + hostlen) {
 				hostlen = p - s;
 				*port_ptr = atoi(p+1);
 			}


More information about the rsync mailing list