diff options
-rw-r--r-- | util.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -89,6 +89,14 @@ int parse_local_port_forward(char *string, int *local_port, char **hostname, int | |||
89 | char *lport; | 89 | char *lport; |
90 | char *host; | 90 | char *host; |
91 | char *rport; | 91 | char *rport; |
92 | |||
93 | /* First replace all @ with :, ':' is forbidden in some environments */ | ||
94 | char *p = string; | ||
95 | while(*p) | ||
96 | { | ||
97 | if(*p == '@') *p = ':'; | ||
98 | p++; | ||
99 | } | ||
92 | 100 | ||
93 | lport = strtok(string, ":"); | 101 | lport = strtok(string, ":"); |
94 | host = strtok(NULL, ":"); | 102 | host = strtok(NULL, ":"); |
@@ -112,6 +120,14 @@ int parse_pipe_port_forward(char *string, char **hostname, int *remote_port) | |||
112 | { | 120 | { |
113 | char *host; | 121 | char *host; |
114 | char *rport; | 122 | char *rport; |
123 | |||
124 | /* First replace all @ with :, ':' is forbidden in some environments */ | ||
125 | char *p = string; | ||
126 | while(*p) | ||
127 | { | ||
128 | if(*p == '@') *p = ':'; | ||
129 | p++; | ||
130 | } | ||
115 | 131 | ||
116 | host = strtok(string, ":"); | 132 | host = strtok(string, ":"); |
117 | rport = strtok(NULL, ":"); | 133 | rport = strtok(NULL, ":"); |