version 1.184, 2010/05/16 12:55:51 |
version 1.185, 2010/06/25 07:14:46 |
|
|
{ |
{ |
Forward *fwd; |
Forward *fwd; |
extern uid_t original_real_uid; |
extern uid_t original_real_uid; |
|
|
if (newfwd->listen_port < IPPORT_RESERVED && original_real_uid != 0) |
if (newfwd->listen_port < IPPORT_RESERVED && original_real_uid != 0) |
fatal("Privileged ports can only be forwarded by root."); |
fatal("Privileged ports can only be forwarded by root."); |
if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
options->local_forwards = xrealloc(options->local_forwards, |
fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION); |
options->num_local_forwards + 1, |
|
sizeof(*options->local_forwards)); |
fwd = &options->local_forwards[options->num_local_forwards++]; |
fwd = &options->local_forwards[options->num_local_forwards++]; |
|
|
fwd->listen_host = newfwd->listen_host; |
fwd->listen_host = newfwd->listen_host; |
|
|
add_remote_forward(Options *options, const Forward *newfwd) |
add_remote_forward(Options *options, const Forward *newfwd) |
{ |
{ |
Forward *fwd; |
Forward *fwd; |
if (options->num_remote_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
|
fatal("Too many remote forwards (max %d).", |
options->remote_forwards = xrealloc(options->remote_forwards, |
SSH_MAX_FORWARDS_PER_DIRECTION); |
options->num_remote_forwards + 1, |
|
sizeof(*options->remote_forwards)); |
fwd = &options->remote_forwards[options->num_remote_forwards++]; |
fwd = &options->remote_forwards[options->num_remote_forwards++]; |
|
|
fwd->listen_host = newfwd->listen_host; |
fwd->listen_host = newfwd->listen_host; |
|
|
xfree(options->local_forwards[i].listen_host); |
xfree(options->local_forwards[i].listen_host); |
xfree(options->local_forwards[i].connect_host); |
xfree(options->local_forwards[i].connect_host); |
} |
} |
|
if (options->num_local_forwards > 0) { |
|
xfree(options->local_forwards); |
|
options->local_forwards = NULL; |
|
} |
options->num_local_forwards = 0; |
options->num_local_forwards = 0; |
for (i = 0; i < options->num_remote_forwards; i++) { |
for (i = 0; i < options->num_remote_forwards; i++) { |
if (options->remote_forwards[i].listen_host != NULL) |
if (options->remote_forwards[i].listen_host != NULL) |
xfree(options->remote_forwards[i].listen_host); |
xfree(options->remote_forwards[i].listen_host); |
xfree(options->remote_forwards[i].connect_host); |
xfree(options->remote_forwards[i].connect_host); |
} |
} |
|
if (options->num_remote_forwards > 0) { |
|
xfree(options->remote_forwards); |
|
options->remote_forwards = NULL; |
|
} |
options->num_remote_forwards = 0; |
options->num_remote_forwards = 0; |
options->tun_open = SSH_TUNMODE_NO; |
options->tun_open = SSH_TUNMODE_NO; |
} |
} |
|
|
options->user_hostfile = NULL; |
options->user_hostfile = NULL; |
options->system_hostfile2 = NULL; |
options->system_hostfile2 = NULL; |
options->user_hostfile2 = NULL; |
options->user_hostfile2 = NULL; |
|
options->local_forwards = NULL; |
options->num_local_forwards = 0; |
options->num_local_forwards = 0; |
|
options->remote_forwards = NULL; |
options->num_remote_forwards = 0; |
options->num_remote_forwards = 0; |
options->clear_forwardings = -1; |
options->clear_forwardings = -1; |
options->log_level = SYSLOG_LEVEL_NOT_SET; |
options->log_level = SYSLOG_LEVEL_NOT_SET; |