View | Details | Raw Unified | Return to bug 2336
Collapse All | Expand All

(-)a/channels.c (+66 lines)
Lines 4264-4266 auth_request_forwarding(void) Link Here
4264
	packet_send();
4264
	packet_send();
4265
	packet_write_wait();
4265
	packet_write_wait();
4266
}
4266
}
4267
4268
4269
/* -- forwarding info queries */
4270
4271
int
4272
channel_rforwards_exist(void)
4273
{
4274
	Channel *c;
4275
	u_int i;
4276
4277
	for (i = 0; i < channels_alloc; i++) {
4278
		c = channels[i];
4279
		if (c == NULL)
4280
			continue;
4281
		switch (c->type) {
4282
		case SSH_CHANNEL_PORT_LISTENER:
4283
		case SSH_CHANNEL_RPORT_LISTENER:
4284
		case SSH_CHANNEL_UNIX_LISTENER:
4285
		case SSH_CHANNEL_RUNIX_LISTENER:
4286
			return 1;
4287
		default:
4288
			break;
4289
		}
4290
	}
4291
4292
	return 0;
4293
}
4294
4295
char *
4296
channel_rforwards_as_string(const struct ForwardOptions *fwd_opts)
4297
{
4298
	Buffer buffer;
4299
	Channel *c;
4300
	char buf[1024], *cp;
4301
	u_int i;
4302
4303
	buffer_init(&buffer);
4304
	for (i = 0; i < channels_alloc; i++) {
4305
		c = channels[i];
4306
		if (c == NULL)
4307
			continue;
4308
		switch (c->type) {
4309
		case SSH_CHANNEL_PORT_LISTENER:
4310
		case SSH_CHANNEL_RPORT_LISTENER:
4311
		case SSH_CHANNEL_UNIX_LISTENER:
4312
		case SSH_CHANNEL_RUNIX_LISTENER:
4313
			snprintf(buf, sizeof buf,
4314
			    "%s %d ",
4315
			    c->listening_addr != NULL ?
4316
			    c->listening_addr :
4317
			    (fwd_opts->gateway_ports == 3 ? "localhost" :
4318
			     fwd_opts->gateway_ports == 2 ?
4319
			     (c->path != NULL && *c->path != '\0' ? c->path : "*") :
4320
			     fwd_opts->gateway_ports ? "*" : "localhost"),
4321
			    c->listening_port);
4322
			buffer_append(&buffer, buf, strlen(buf));
4323
			break;
4324
		default:
4325
			break;
4326
		}
4327
	}
4328
	buffer_append(&buffer, "\0", 1);
4329
	cp = xstrdup(buffer_ptr(&buffer));
4330
	buffer_free(&buffer);
4331
	return cp;
4332
}
(-)a/channels.h (+5 lines)
Lines 295-300 void deny_input_open(int, u_int32_t, void *); Link Here
295
295
296
void	 auth_request_forwarding(void);
296
void	 auth_request_forwarding(void);
297
297
298
/* rforward info */
299
300
int	 channel_rforwards_exist(void);
301
char	*channel_rforwards_as_string(const struct ForwardOptions *);
302
298
/* channel close */
303
/* channel close */
299
304
300
int	 chan_is_dead(Channel *, int);
305
int	 chan_is_dead(Channel *, int);
(-)a/session.c (-1 / +5 lines)
Lines 1255-1260 do_setup_env(Session *s, const char *shell) Link Here
1255
	if (original_command)
1255
	if (original_command)
1256
		child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND",
1256
		child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND",
1257
		    original_command);
1257
		    original_command);
1258
	if (channel_rforwards_exist()) {
1259
		char *const fwds = channel_rforwards_as_string(&options.fwd_opts);
1260
		child_set_env(&env, &envsize, "SSH_PORT_FORWARDING", fwds);
1261
		free(fwds);
1262
	}
1258
1263
1259
#ifdef _UNICOS
1264
#ifdef _UNICOS
1260
	if (cray_tmpdir[0] != '\0')
1265
	if (cray_tmpdir[0] != '\0')
1261
- 

Return to bug 2336