- Look for last '@' in a user@host spec.
This commit is contained in:
@@ -87,15 +87,12 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p = strchr(host, '@')) != NULL) {
|
if ((p = strrchr(host, '@')) != NULL) {
|
||||||
user = host;
|
user = host;
|
||||||
host = p+1;
|
host = p+1;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsync_port == 0)
|
|
||||||
rsync_port = RSYNC_PORT;
|
|
||||||
|
|
||||||
fd = open_socket_out_wrapped(host, rsync_port, bind_address,
|
fd = open_socket_out_wrapped(host, rsync_port, bind_address,
|
||||||
default_af_hint);
|
default_af_hint);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
|
|||||||
2
socket.c
2
socket.c
@@ -198,7 +198,7 @@ int open_socket_out(char *host, int port, const char *bind_address,
|
|||||||
strlcpy(buffer, h, sizeof buffer);
|
strlcpy(buffer, h, sizeof buffer);
|
||||||
|
|
||||||
/* Is the USER:PASS@ prefix present? */
|
/* Is the USER:PASS@ prefix present? */
|
||||||
if ((cp = strchr(buffer, '@')) != NULL) {
|
if ((cp = strrchr(buffer, '@')) != NULL) {
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
/* The remainder is the HOST:PORT part. */
|
/* The remainder is the HOST:PORT part. */
|
||||||
h = cp;
|
h = cp;
|
||||||
|
|||||||
Reference in New Issue
Block a user