]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gnutls: don't leak the SRP credentials in redirects
authorDaniel Stenberg <daniel@haxx.se>
Tue, 26 Apr 2022 05:46:19 +0000 (07:46 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 26 Apr 2022 05:46:20 +0000 (07:46 +0200)
Follow-up to 620ea21410030 and 139a54ed0a172a

Reported-by: Harry Sintonen
Closes #8752

lib/vtls/gtls.c

index 9c3a68f0ac6b1198a9a589f7f26c2ed0a3b44d8e..0535011911d53ae425bf371d568cb1dbeb0015c6 100644 (file)
@@ -445,11 +445,11 @@ gtls_connect_step1(struct Curl_easy *data,
   }
 
 #ifdef USE_GNUTLS_SRP
-  if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
+  if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
+     Curl_allow_auth_to_host(data)) {
     infof(data, "Using TLS-SRP username: %s", SSL_SET_OPTION(username));
 
-    rc = gnutls_srp_allocate_client_credentials(
-           &backend->srp_client_cred);
+    rc = gnutls_srp_allocate_client_credentials(&backend->srp_client_cred);
     if(rc != GNUTLS_E_SUCCESS) {
       failf(data, "gnutls_srp_allocate_client_cred() failed: %s",
             gnutls_strerror(rc));