version 1.21, 1999/11/24 20:24:09 |
version 1.22, 1999/12/01 13:59:15 |
|
|
*/ |
*/ |
|
|
void |
void |
add_local_forward(Options *options, int port, const char *host, |
add_local_forward(Options *options, u_short port, const char *host, |
int host_port) |
u_short host_port) |
{ |
{ |
Forward *fwd; |
Forward *fwd; |
extern uid_t original_real_uid; |
extern uid_t original_real_uid; |
if ((port & 0xffff) != port) |
|
fatal("Requested forwarding of nonexistent port %d.", port); |
|
if (port < IPPORT_RESERVED && original_real_uid != 0) |
if (port < IPPORT_RESERVED && original_real_uid != 0) |
fatal("Privileged ports can only be forwarded by root.\n"); |
fatal("Privileged ports can only be forwarded by root.\n"); |
if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
|
|
*/ |
*/ |
|
|
void |
void |
add_remote_forward(Options *options, int port, const char *host, |
add_remote_forward(Options *options, u_short port, const char *host, |
int host_port) |
u_short host_port) |
{ |
{ |
Forward *fwd; |
Forward *fwd; |
if (options->num_remote_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
if (options->num_remote_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) |
|
|
int *activep) |
int *activep) |
{ |
{ |
char buf[256], *cp, *string, **charptr, *cp2; |
char buf[256], *cp, *string, **charptr, *cp2; |
int opcode, *intptr, value, fwd_port, fwd_host_port; |
int opcode, *intptr, value; |
|
u_short fwd_port, fwd_host_port; |
|
|
/* Skip leading whitespace. */ |
/* Skip leading whitespace. */ |
cp = line + strspn(line, WHITESPACE); |
cp = line + strspn(line, WHITESPACE); |
|
|
if (!cp) |
if (!cp) |
fatal("%.200s line %d: Missing second argument.", |
fatal("%.200s line %d: Missing second argument.", |
filename, linenum); |
filename, linenum); |
if (sscanf(cp, "%255[^:]:%d", buf, &fwd_host_port) != 2) |
if (sscanf(cp, "%255[^:]:%hu", buf, &fwd_host_port) != 2) |
fatal("%.200s line %d: Badly formatted host:port.", |
fatal("%.200s line %d: Badly formatted host:port.", |
filename, linenum); |
filename, linenum); |
if (*activep) |
if (*activep) |
|
|
if (!cp) |
if (!cp) |
fatal("%.200s line %d: Missing second argument.", |
fatal("%.200s line %d: Missing second argument.", |
filename, linenum); |
filename, linenum); |
if (sscanf(cp, "%255[^:]:%d", buf, &fwd_host_port) != 2) |
if (sscanf(cp, "%255[^:]:%hu", buf, &fwd_host_port) != 2) |
fatal("%.200s line %d: Badly formatted host:port.", |
fatal("%.200s line %d: Badly formatted host:port.", |
filename, linenum); |
filename, linenum); |
if (*activep) |
if (*activep) |