]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: if psl fails, reject the cookie
authorDaniel Stenberg <daniel@haxx.se>
Sun, 3 Mar 2024 17:41:52 +0000 (18:41 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 4 Mar 2024 07:46:59 +0000 (08:46 +0100)
A libpsl install without data and no built-in database is now considered
bad enough to reject all cookies since they cannot be checked. It is
somewhat of a user error, but still.

Reported-by: Dan Fandrich
Closes #13033

lib/cookie.c

index d10dd572baab3ee1479d7381b0b94dcc9a20e02e..c1ed2913c40caa090375c11d2b15166b329f0e90 100644 (file)
@@ -426,6 +426,7 @@ static void remove_expired(struct CookieInfo *cookies)
   }
 }
 
+#ifndef USE_LIBPSL
 /* Make sure domain contains a dot or is localhost. */
 static bool bad_domain(const char *domain, size_t len)
 {
@@ -443,6 +444,7 @@ static bool bad_domain(const char *domain, size_t len)
   }
   return TRUE;
 }
+#endif
 
 /*
   RFC 6265 section 4.1.1 says a server should accept this range:
@@ -1040,7 +1042,7 @@ Curl_cookie_add(struct Curl_easy *data,
         Curl_psl_release(data);
       }
       else
-        acceptable = !bad_domain(domain, strlen(domain));
+        infof(data, "libpsl problem, rejecting cookie for satety");
     }
 
     if(!acceptable) {