void
channel_request_local_forwarding(u_short port, const char *host,
- u_short host_port)
+ u_short host_port, int gateway_ports)
{
int ch, sock, on = 1;
struct sockaddr_in sin;
- extern Options options;
struct linger linger;
if (strlen(host) > sizeof(channels[0].path) - 1)
/* Initialize socket address. */
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
- if (options.gateway_ports == 1)
+ if (gateway_ports == 1)
sin.sin_addr.s_addr = htonl(INADDR_ANY);
else
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (port < IPPORT_RESERVED && !is_root)
packet_disconnect("Requested forwarding of port %d but user is not root.",
port);
-
- /* Initiate forwarding. */
- channel_request_local_forwarding(port, hostname, host_port);
+ /*
+ * Initiate forwarding,
+ * bind port to localhost only (gateway ports == 0).
+ */
+ channel_request_local_forwarding(port, hostname, host_port, 0);
/* Free the argument string. */
xfree(hostname);
*/
char *
-x11_create_display_inet(int screen_number)
+x11_create_display_inet(int screen_number, int x11_display_offset)
{
- extern ServerOptions options;
int display_number, sock;
u_short port;
struct sockaddr_in sin;
char buf[512];
char hostname[MAXHOSTNAMELEN];
- for (display_number = options.x11_display_offset;
+ for (display_number = x11_display_offset;
display_number < MAX_DISPLAYS;
display_number++) {
port = 6000 + display_number;