From: Wayne Davison Date: Tue, 1 Mar 2005 03:39:32 +0000 (+0000) Subject: - Look for last '@' in a user@host spec. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/b31c92edcc11995daa5c90ec280010a1e2c5b64d - Look for last '@' in a user@host spec. --- diff --git a/clientserver.c b/clientserver.c index 0ed05145..531944aa 100644 --- a/clientserver.c +++ b/clientserver.c @@ -87,15 +87,12 @@ int start_socket_client(char *host, char *path, int argc, char *argv[]) return -1; } - if ((p = strchr(host, '@')) != NULL) { + if ((p = strrchr(host, '@')) != NULL) { user = host; host = p+1; *p = '\0'; } - if (rsync_port == 0) - rsync_port = RSYNC_PORT; - fd = open_socket_out_wrapped(host, rsync_port, bind_address, default_af_hint); if (fd == -1) diff --git a/socket.c b/socket.c index 4e6ef60f..c6341ced 100644 --- a/socket.c +++ b/socket.c @@ -198,7 +198,7 @@ int open_socket_out(char *host, int port, const char *bind_address, strlcpy(buffer, h, sizeof buffer); /* Is the USER:PASS@ prefix present? */ - if ((cp = strchr(buffer, '@')) != NULL) { + if ((cp = strrchr(buffer, '@')) != NULL) { *cp++ = '\0'; /* The remainder is the HOST:PORT part. */ h = cp;