Jordan Russell's patch (again): a couple of registry read operations
[sgt/putty] / settings.c
index 01fd312..3ebcbb1 100644 (file)
@@ -172,6 +172,7 @@ void save_settings(char *section, int do_host, Config * cfg)
     write_setting_i(sesskey, "NoPTY", cfg->nopty);
     write_setting_i(sesskey, "Compression", cfg->compression);
     write_setting_i(sesskey, "AgentFwd", cfg->agentfwd);
+    write_setting_i(sesskey, "ChangeUsername", cfg->change_username);
     wprefs(sesskey, "Cipher", ciphernames, CIPHER_MAX,
           cfg->ssh_cipherlist);
     write_setting_i(sesskey, "AuthTIS", cfg->try_tis_auth);
@@ -264,6 +265,7 @@ void save_settings(char *section, int do_host, Config * cfg)
     write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
     write_setting_s(sesskey, "X11Display", cfg->x11_display);
     write_setting_i(sesskey, "LocalPortAcceptAll", cfg->lport_acceptall);
+    write_setting_i(sesskey, "RemotePortAcceptAll", cfg->rport_acceptall);
     {
        char buf[2 * sizeof(cfg->portfwd)], *p, *q;
        p = buf;
@@ -359,6 +361,7 @@ void load_settings(char *section, int do_host, Config * cfg)
     gppi(sesskey, "NoPTY", 0, &cfg->nopty);
     gppi(sesskey, "Compression", 0, &cfg->compression);
     gppi(sesskey, "AgentFwd", 0, &cfg->agentfwd);
+    gppi(sesskey, "ChangeUsername", 0, &cfg->change_username);
     gprefs(sesskey, "Cipher", "\0",
           ciphernames, CIPHER_MAX, cfg->ssh_cipherlist);
     gppi(sesskey, "SshProt", 1, &cfg->sshprot);
@@ -499,6 +502,7 @@ void load_settings(char *section, int do_host, Config * cfg)
         sizeof(cfg->x11_display));
 
     gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
+    gppi(sesskey, "RemotePortAcceptAll", 0, &cfg->rport_acceptall);
     {
        char buf[2 * sizeof(cfg->portfwd)], *p, *q;
        gpps(sesskey, "PortForwardings", "", buf, sizeof(buf));
@@ -561,24 +565,23 @@ void get_sesslist(int allocate)
 
     if (allocate) {
 
-       if ((handle = enum_settings_start()) == NULL)
-           return;
-
        buflen = bufsize = 0;
        buffer = NULL;
-       do {
-           ret = enum_settings_next(handle, otherbuf, sizeof(otherbuf));
-           if (ret) {
-               int len = strlen(otherbuf) + 1;
-               if (bufsize < buflen + len) {
-                   bufsize = buflen + len + 2048;
-                   buffer = srealloc(buffer, bufsize);
+       if ((handle = enum_settings_start())) {
+           do {
+               ret = enum_settings_next(handle, otherbuf, sizeof(otherbuf));
+               if (ret) {
+                   int len = strlen(otherbuf) + 1;
+                   if (bufsize < buflen + len) {
+                       bufsize = buflen + len + 2048;
+                       buffer = srealloc(buffer, bufsize);
+                   }
+                   strcpy(buffer + buflen, otherbuf);
+                   buflen += strlen(buffer + buflen) + 1;
                }
-               strcpy(buffer + buflen, otherbuf);
-               buflen += strlen(buffer + buflen) + 1;
-           }
-       } while (ret);
-       enum_settings_finish(handle);
+           } while (ret);
+           enum_settings_finish(handle);
+       }
        buffer = srealloc(buffer, buflen + 1);
        buffer[buflen] = '\0';