mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
SSH port forwarding! How cool is that?
Only currently works on SSH1; SSH2 should be doable but it's late and I have other things to do tonight. The Cool Guy award for this one goes to Nicolas Barry, for doing most of the work and actually understanding the code he was adding to. [originally from svn r1176]
This commit is contained in:
42
settings.c
42
settings.c
@ -160,6 +160,26 @@ void save_settings(char *section, int do_host, Config * cfg)
|
||||
write_setting_i(sesskey, "BlinkText", cfg->blinktext);
|
||||
write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
|
||||
write_setting_s(sesskey, "X11Display", cfg->x11_display);
|
||||
write_setting_i(sesskey, "LocalPortAcceptAll", cfg->lport_acceptall);
|
||||
{
|
||||
char buf[2 * sizeof(cfg->portfwd)], *p, *q;
|
||||
p = buf;
|
||||
q = cfg->portfwd;
|
||||
while (*q) {
|
||||
while (*q) {
|
||||
int c = *q++;
|
||||
if (c == '=' || c == ',' || c == '\\')
|
||||
*p++ = '\\';
|
||||
if (c == '\t')
|
||||
c = '=';
|
||||
*p++ = c;
|
||||
}
|
||||
*p++ = ',';
|
||||
q++;
|
||||
}
|
||||
*p = '\0';
|
||||
write_setting_s(sesskey, "PortForwardings", buf);
|
||||
}
|
||||
|
||||
close_settings_w(sesskey);
|
||||
}
|
||||
@ -365,6 +385,28 @@ void load_settings(char *section, int do_host, Config * cfg)
|
||||
gpps(sesskey, "X11Display", "localhost:0", cfg->x11_display,
|
||||
sizeof(cfg->x11_display));
|
||||
|
||||
gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
|
||||
{
|
||||
char buf[2 * sizeof(cfg->portfwd)], *p, *q;
|
||||
gpps(sesskey, "PortForwardings", "", buf, sizeof(buf));
|
||||
p = buf;
|
||||
q = cfg->portfwd;
|
||||
while (*p) {
|
||||
while (*p && *p != ',') {
|
||||
int c = *p++;
|
||||
if (c == '=')
|
||||
c = '\t';
|
||||
if (c == '\\')
|
||||
c = *p++;
|
||||
*q++ = c;
|
||||
}
|
||||
if (*p == ',')
|
||||
p++;
|
||||
*q++ = '\0';
|
||||
}
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
close_settings_r(sesskey);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user