From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 10 Sep 2020 10:48:48 +0000 (+0200)
Subject: remember_connection(): Remember the socks user name and password
X-Git-Tag: v_3_0_29~110
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@/static/faq/@default-cgi@show-url-info?a=commitdiff_plain;h=27e65aebe090f8f90a6348571d3677ed72dabccd;p=privoxy.git

remember_connection(): Remember the socks user name and password
---

diff --git a/gateway.c b/gateway.c
index 66ec64ae..dcea154b 100644
--- a/gateway.c
+++ b/gateway.c
@@ -231,6 +231,8 @@ void remember_connection(const struct reusable_connection *connection)
 
    assert(reusable_connection[slot].gateway_host == NULL);
    assert(reusable_connection[slot].gateway_port == 0);
+   assert(reusable_connection[slot].auth_username == NULL);
+   assert(reusable_connection[slot].auth_password == NULL);
    assert(reusable_connection[slot].forwarder_type == SOCKS_NONE);
    assert(reusable_connection[slot].forward_host == NULL);
    assert(reusable_connection[slot].forward_port == 0);
@@ -245,6 +247,22 @@ void remember_connection(const struct reusable_connection *connection)
       reusable_connection[slot].gateway_host = NULL;
    }
    reusable_connection[slot].gateway_port = connection->gateway_port;
+   if (NULL != connection->auth_username)
+   {
+      reusable_connection[slot].auth_username = strdup_or_die(connection->auth_username);
+   }
+   else
+   {
+      reusable_connection[slot].auth_username = NULL;
+   }
+   if (NULL != connection->auth_password)
+   {
+      reusable_connection[slot].auth_password = strdup_or_die(connection->auth_password);
+   }
+   else
+   {
+      reusable_connection[slot].auth_password = NULL;
+   }
 
    if (NULL != connection->forward_host)
    {