Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaim, Sean M <Sean.Kaim@ca.com>2015-11-04 23:46:18 +0300
committerKaim, Sean M <Sean.Kaim@ca.com>2015-11-04 23:46:18 +0300
commit1d0c3e474a4e2a935ae25932e731ac48c1a9ad1c (patch)
tree5242fb83e6a94100b5817e045c70904d4f9fb22e /SETTINGS.C
parentb19b2a07ed187eda1315fe3a16986dab7cbba663 (diff)
Merge upstream 0.65 tag
http://tartarus.org/~simon-git/gitweb/?p=putty.git;a=commit;h=7cfe83f7915907ea7cc2643468558e5bd83d4b51
Diffstat (limited to 'SETTINGS.C')
-rw-r--r--SETTINGS.C59
1 files changed, 41 insertions, 18 deletions
diff --git a/SETTINGS.C b/SETTINGS.C
index 6499686b..02d7506b 100644
--- a/SETTINGS.C
+++ b/SETTINGS.C
@@ -138,7 +138,8 @@ static void gppi(void *handle, char *name, int def, Conf *conf, int primary)
* Read a set of name-value pairs in the format we occasionally use:
* NAME\tVALUE\0NAME\tVALUE\0\0 in memory
* NAME=VALUE,NAME=VALUE, in storage
- * `def' is in the storage format.
+ * If there's no "=VALUE" (e.g. just NAME,NAME,NAME) then those keys
+ * are mapped to the empty string.
*/
static int gppmap(void *handle, char *name, Conf *conf, int primary)
{
@@ -178,7 +179,7 @@ static int gppmap(void *handle, char *name, Conf *conf, int primary)
val = q;
*q = '\0';
- if (primary == CONF_portfwd && buf[0] == 'D') {
+ if (primary == CONF_portfwd && strchr(buf, 'D') != NULL) {
/*
* Backwards-compatibility hack: dynamic forwardings are
* indexed in the data store as a third type letter in the
@@ -188,9 +189,10 @@ static int gppmap(void *handle, char *name, Conf *conf, int primary)
* _listening_ on a local port, and are hence mutually
* exclusive on the same port number. So here we translate
* the legacy storage format into the sensible internal
- * form.
+ * form, by finding the D and turning it into a L.
*/
- char *newkey = dupcat("L", buf+1, NULL);
+ char *newkey = dupstr(buf);
+ *strchr(newkey, 'D') = 'L';
conf_set_str_str(conf, primary, newkey, "D");
sfree(newkey);
} else {
@@ -203,9 +205,11 @@ static int gppmap(void *handle, char *name, Conf *conf, int primary)
}
/*
- * Write a set of name/value pairs in the above format.
+ * Write a set of name/value pairs in the above format, or just the
+ * names if include_values is FALSE.
*/
-static void wmap(void *handle, char const *outkey, Conf *conf, int primary)
+static void wmap(void *handle, char const *outkey, Conf *conf, int primary,
+ int include_values)
{
char *buf, *p, *q, *key, *realkey, *val;
int len;
@@ -232,9 +236,13 @@ static void wmap(void *handle, char const *outkey, Conf *conf, int primary)
* conceptually incoherent legacy storage format (key
* "D<port>", value empty).
*/
+ char *L;
+
realkey = key; /* restore it at end of loop */
val = "";
- key = dupcat("D", key+1, NULL);
+ key = dupstr(key);
+ L = strchr(key, 'L');
+ if (L) *L = 'D';
} else {
realkey = NULL;
}
@@ -246,12 +254,14 @@ static void wmap(void *handle, char const *outkey, Conf *conf, int primary)
*p++ = '\\';
*p++ = *q;
}
- *p++ = '=';
- for (q = val; *q; q++) {
- if (*q == '=' || *q == ',' || *q == '\\')
- *p++ = '\\';
- *p++ = *q;
- }
+ if (include_values) {
+ *p++ = '=';
+ for (q = val; *q; q++) {
+ if (*q == '=' || *q == ',' || *q == '\\')
+ *p++ = '\\';
+ *p++ = *q;
+ }
+ }
if (realkey) {
free(key);
@@ -451,7 +461,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "TCPKeepalives", conf_get_int(conf, CONF_tcp_keepalives));
write_setting_s(sesskey, "TerminalType", conf_get_str(conf, CONF_termtype));
write_setting_s(sesskey, "TerminalSpeed", conf_get_str(conf, CONF_termspeed));
- wmap(sesskey, "TerminalModes", conf, CONF_ttymodes);
+ wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, TRUE);
/* Address family selection */
write_setting_i(sesskey, "AddressFamily", conf_get_int(conf, CONF_addressfamily));
@@ -466,7 +476,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_s(sesskey, "ProxyUsername", conf_get_str(conf, CONF_proxy_username));
write_setting_s(sesskey, "ProxyPassword", conf_get_str(conf, CONF_proxy_password));
write_setting_s(sesskey, "ProxyTelnetCommand", conf_get_str(conf, CONF_proxy_telnet_command));
- wmap(sesskey, "Environment", conf, CONF_environmt);
+ wmap(sesskey, "Environment", conf, CONF_environmt, TRUE);
write_setting_s(sesskey, "UserName", conf_get_str(conf, CONF_username));
write_setting_i(sesskey, "UserNameFromEnvironment", conf_get_int(conf, CONF_username_from_env));
write_setting_s(sesskey, "LocalUserName", conf_get_str(conf, CONF_localusername));
@@ -609,7 +619,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_filename(sesskey, "X11AuthFile", conf_get_filename(conf, CONF_xauthfile));
write_setting_i(sesskey, "LocalPortAcceptAll", conf_get_int(conf, CONF_lport_acceptall));
write_setting_i(sesskey, "RemotePortAcceptAll", conf_get_int(conf, CONF_rport_acceptall));
- wmap(sesskey, "PortForwardings", conf, CONF_portfwd);
+ wmap(sesskey, "PortForwardings", conf, CONF_portfwd, TRUE);
write_setting_i(sesskey, "BugIgnore1", 2-conf_get_int(conf, CONF_sshbug_ignore1));
write_setting_i(sesskey, "BugPlainPW1", 2-conf_get_int(conf, CONF_sshbug_plainpw1));
write_setting_i(sesskey, "BugRSA1", 2-conf_get_int(conf, CONF_sshbug_rsa1));
@@ -620,7 +630,9 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "BugPKSessID2", 2-conf_get_int(conf, CONF_sshbug_pksessid2));
write_setting_i(sesskey, "BugRekey2", 2-conf_get_int(conf, CONF_sshbug_rekey2));
write_setting_i(sesskey, "BugMaxPkt2", 2-conf_get_int(conf, CONF_sshbug_maxpkt2));
+ write_setting_i(sesskey, "BugOldGex2", 2-conf_get_int(conf, CONF_sshbug_oldgex2));
write_setting_i(sesskey, "BugWinadj", 2-conf_get_int(conf, CONF_sshbug_winadj));
+ write_setting_i(sesskey, "BugChanReq", 2-conf_get_int(conf, CONF_sshbug_chanreq));
write_setting_i(sesskey, "StampUtmp", conf_get_int(conf, CONF_stamp_utmp));
write_setting_i(sesskey, "LoginShell", conf_get_int(conf, CONF_login_shell));
write_setting_i(sesskey, "ScrollbarOnLeft", conf_get_int(conf, CONF_scrollbar_on_left));
@@ -636,6 +648,10 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "SerialParity", conf_get_int(conf, CONF_serparity));
write_setting_i(sesskey, "SerialFlowControl", conf_get_int(conf, CONF_serflow));
write_setting_s(sesskey, "WindowClass", conf_get_str(conf, CONF_winclass));
+ write_setting_i(sesskey, "ConnectionSharing", conf_get_int(conf, CONF_ssh_connection_sharing));
+ write_setting_i(sesskey, "ConnectionSharingUpstream", conf_get_int(conf, CONF_ssh_connection_sharing_upstream));
+ write_setting_i(sesskey, "ConnectionSharingDownstream", conf_get_int(conf, CONF_ssh_connection_sharing_downstream));
+ wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, FALSE);
}
void load_settings(char *section, Conf *conf)
@@ -763,7 +779,8 @@ void load_open_settings(void *sesskey, Conf *conf)
}
gppi(sesskey, "RekeyTime", 60, conf, CONF_ssh_rekey_time);
gpps(sesskey, "RekeyBytes", "1G", conf, CONF_ssh_rekey_data);
- gppi(sesskey, "SshProt", 2, conf, CONF_sshprot);
+ /* SSH-2 only by default */
+ gppi(sesskey, "SshProt", 3, conf, CONF_sshprot);
gpps(sesskey, "LogHost", "", conf, CONF_loghost);
gppi(sesskey, "SSH2DES", 0, conf, CONF_ssh2_des_cbc);
gppi(sesskey, "SshNoAuth", 0, conf, CONF_ssh_no_userauth);
@@ -866,7 +883,7 @@ void load_open_settings(void *sesskey, Conf *conf)
gppi(sesskey, "TryPalette", 0, conf, CONF_try_palette);
gppi(sesskey, "ANSIColour", 1, conf, CONF_ansi_colour);
gppi(sesskey, "Xterm256Colour", 1, conf, CONF_xterm_256_colour);
- i = gppi_raw(sesskey, "BoldAsColour", 0); conf_set_int(conf, CONF_bold_style, i+1);
+ i = gppi_raw(sesskey, "BoldAsColour", 1); conf_set_int(conf, CONF_bold_style, i+1);
for (i = 0; i < 22; i++) {
static const char *const defaults[] = {
@@ -961,7 +978,9 @@ void load_open_settings(void *sesskey, Conf *conf)
i = gppi_raw(sesskey, "BugPKSessID2", 0); conf_set_int(conf, CONF_sshbug_pksessid2, 2-i);
i = gppi_raw(sesskey, "BugRekey2", 0); conf_set_int(conf, CONF_sshbug_rekey2, 2-i);
i = gppi_raw(sesskey, "BugMaxPkt2", 0); conf_set_int(conf, CONF_sshbug_maxpkt2, 2-i);
+ i = gppi_raw(sesskey, "BugOldGex2", 0); conf_set_int(conf, CONF_sshbug_oldgex2, 2-i);
i = gppi_raw(sesskey, "BugWinadj", 0); conf_set_int(conf, CONF_sshbug_winadj, 2-i);
+ i = gppi_raw(sesskey, "BugChanReq", 0); conf_set_int(conf, CONF_sshbug_chanreq, 2-i);
conf_set_int(conf, CONF_ssh_simple, FALSE);
gppi(sesskey, "StampUtmp", 1, conf, CONF_stamp_utmp);
gppi(sesskey, "LoginShell", 1, conf, CONF_login_shell);
@@ -978,6 +997,10 @@ void load_open_settings(void *sesskey, Conf *conf)
gppi(sesskey, "SerialParity", SER_PAR_NONE, conf, CONF_serparity);
gppi(sesskey, "SerialFlowControl", SER_FLOW_XONXOFF, conf, CONF_serflow);
gpps(sesskey, "WindowClass", "", conf, CONF_winclass);
+ gppi(sesskey, "ConnectionSharing", 0, conf, CONF_ssh_connection_sharing);
+ gppi(sesskey, "ConnectionSharingUpstream", 1, conf, CONF_ssh_connection_sharing_upstream);
+ gppi(sesskey, "ConnectionSharingDownstream", 1, conf, CONF_ssh_connection_sharing_downstream);
+ gppmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys);
}
void do_defaults(char *session, Conf *conf)