|
Lines 341-346
add_local_forward(Options *options, const struct Forward *newfwd)
Link Here
|
| 341 |
fwd->connect_host = newfwd->connect_host; |
341 |
fwd->connect_host = newfwd->connect_host; |
| 342 |
fwd->connect_port = newfwd->connect_port; |
342 |
fwd->connect_port = newfwd->connect_port; |
| 343 |
fwd->connect_path = newfwd->connect_path; |
343 |
fwd->connect_path = newfwd->connect_path; |
|
|
344 |
fwd->rdomain = newfwd->rdomain; |
| 344 |
} |
345 |
} |
| 345 |
|
346 |
|
| 346 |
/* |
347 |
/* |
|
Lines 370-375
add_remote_forward(Options *options, const struct Forward *newfwd)
Link Here
|
| 370 |
fwd->connect_host = newfwd->connect_host; |
371 |
fwd->connect_host = newfwd->connect_host; |
| 371 |
fwd->connect_port = newfwd->connect_port; |
372 |
fwd->connect_port = newfwd->connect_port; |
| 372 |
fwd->connect_path = newfwd->connect_path; |
373 |
fwd->connect_path = newfwd->connect_path; |
|
|
374 |
fwd->rdomain = newfwd->rdomain; |
| 373 |
fwd->handle = newfwd->handle; |
375 |
fwd->handle = newfwd->handle; |
| 374 |
fwd->allocated_port = 0; |
376 |
fwd->allocated_port = 0; |
| 375 |
} |
377 |
} |
|
Lines 384-389
clear_forwardings(Options *options)
Link Here
|
| 384 |
free(options->local_forwards[i].listen_path); |
386 |
free(options->local_forwards[i].listen_path); |
| 385 |
free(options->local_forwards[i].connect_host); |
387 |
free(options->local_forwards[i].connect_host); |
| 386 |
free(options->local_forwards[i].connect_path); |
388 |
free(options->local_forwards[i].connect_path); |
|
|
389 |
free(options->local_forwards[i].rdomain); |
| 387 |
} |
390 |
} |
| 388 |
if (options->num_local_forwards > 0) { |
391 |
if (options->num_local_forwards > 0) { |
| 389 |
free(options->local_forwards); |
392 |
free(options->local_forwards); |
|
Lines 2129-2135
done:
Link Here
|
| 2129 |
int |
2132 |
int |
| 2130 |
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remotefwd) |
2133 |
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remotefwd) |
| 2131 |
{ |
2134 |
{ |
| 2132 |
struct fwdarg fwdargs[4]; |
2135 |
struct fwdarg fwdargs[5]; |
| 2133 |
char *p, *cp; |
2136 |
char *p, *cp; |
| 2134 |
int i; |
2137 |
int i; |
| 2135 |
|
2138 |
|
|
Lines 2142-2148
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
Link Here
|
| 2142 |
while (isspace((u_char)*cp)) |
2145 |
while (isspace((u_char)*cp)) |
| 2143 |
cp++; |
2146 |
cp++; |
| 2144 |
|
2147 |
|
| 2145 |
for (i = 0; i < 4; ++i) { |
2148 |
for (i = 0; i < 5; ++i) { |
| 2146 |
if (parse_fwd_field(&cp, &fwdargs[i]) != 0) |
2149 |
if (parse_fwd_field(&cp, &fwdargs[i]) != 0) |
| 2147 |
break; |
2150 |
break; |
| 2148 |
} |
2151 |
} |
|
Lines 2207-2212
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
Link Here
|
| 2207 |
fwd->connect_host = xstrdup(fwdargs[2].arg); |
2210 |
fwd->connect_host = xstrdup(fwdargs[2].arg); |
| 2208 |
fwd->connect_port = a2port(fwdargs[3].arg); |
2211 |
fwd->connect_port = a2port(fwdargs[3].arg); |
| 2209 |
break; |
2212 |
break; |
|
|
2213 |
|
| 2214 |
case 5: |
| 2215 |
fwd->listen_host = xstrdup(fwdargs[0].arg); |
| 2216 |
fwd->listen_port = a2port(fwdargs[1].arg); |
| 2217 |
fwd->connect_host = xstrdup(fwdargs[2].arg); |
| 2218 |
fwd->connect_port = a2port(fwdargs[3].arg); |
| 2219 |
fwd->rdomain = xstrdup(fwdargs[4].arg); |
| 2220 |
break; |
| 2210 |
default: |
2221 |
default: |
| 2211 |
i = 0; /* failure */ |
2222 |
i = 0; /* failure */ |
| 2212 |
} |
2223 |
} |
|
Lines 2217-2223
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
Link Here
|
| 2217 |
if (!(i == 1 || i == 2)) |
2228 |
if (!(i == 1 || i == 2)) |
| 2218 |
goto fail_free; |
2229 |
goto fail_free; |
| 2219 |
} else { |
2230 |
} else { |
| 2220 |
if (!(i == 3 || i == 4)) { |
2231 |
if (!(i == 3 || i == 4 || i == 5)) { |
| 2221 |
if (fwd->connect_path == NULL && |
2232 |
if (fwd->connect_path == NULL && |
| 2222 |
fwd->listen_path == NULL) |
2233 |
fwd->listen_path == NULL) |
| 2223 |
goto fail_free; |
2234 |
goto fail_free; |
|
Lines 2242-2247
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
Link Here
|
| 2242 |
if (fwd->listen_path != NULL && |
2253 |
if (fwd->listen_path != NULL && |
| 2243 |
strlen(fwd->listen_path) >= PATH_MAX_SUN) |
2254 |
strlen(fwd->listen_path) >= PATH_MAX_SUN) |
| 2244 |
goto fail_free; |
2255 |
goto fail_free; |
|
|
2256 |
if (fwd->rdomain != NULL && |
| 2257 |
!valid_rdomain(fwd->rdomain)) |
| 2258 |
goto fail_free; |
| 2245 |
|
2259 |
|
| 2246 |
return (i); |
2260 |
return (i); |
| 2247 |
|
2261 |
|
|
Lines 2254-2259
parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
Link Here
|
| 2254 |
fwd->listen_host = NULL; |
2268 |
fwd->listen_host = NULL; |
| 2255 |
free(fwd->listen_path); |
2269 |
free(fwd->listen_path); |
| 2256 |
fwd->listen_path = NULL; |
2270 |
fwd->listen_path = NULL; |
|
|
2271 |
free(fwd->rdomain); |
| 2272 |
fwd->rdomain = NULL; |
| 2257 |
return (0); |
2273 |
return (0); |
| 2258 |
} |
2274 |
} |
| 2259 |
|
2275 |
|