]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: stop NULL-checking conn->passwd and ->user
authorDaniel Stenberg <daniel@haxx.se>
Tue, 14 Oct 2025 12:43:46 +0000 (14:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 15 Oct 2025 08:44:51 +0000 (10:44 +0200)
They always point to a string. The string might be zero length.

Closes #19059

lib/ftp.c
lib/pop3.c
lib/vssh/libssh2.c

index 58b34eab6d951e0c1d4320457f911bce69266b3c..fd957a2bb485cc8edc93a0bd834c5b685741f5c8 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2606,7 +2606,7 @@ static CURLcode ftp_state_user_resp(struct Curl_easy *data,
     /* 331 Password required for ...
        (the server requires to send the user's password too) */
     result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s",
-                           data->conn->passwd ? data->conn->passwd : "");
+                           data->conn->passwd);
     if(!result)
       ftp_state(data, ftpc, FTP_PASS);
   }
index a0fd881a791f6a1da59add40fa25031d77aee83b..2fd496cb314280298a4136f35aeae77c7eb994bb 100644 (file)
@@ -1057,8 +1057,7 @@ static CURLcode pop3_state_user_resp(struct Curl_easy *data, int pop3code,
   }
   else
     /* Send the PASS command */
-    result = Curl_pp_sendf(data, &pop3c->pp, "PASS %s",
-                           conn->passwd ? conn->passwd : "");
+    result = Curl_pp_sendf(data, &pop3c->pp, "PASS %s", conn->passwd);
   if(!result)
     pop3_state(data, POP3_PASS);
 
index dc972dc9e67a15649a0644a816b6ccb4bf8ef69b..f9160944befe9424d47b6eb1c61cc4934dd7f0b8 100644 (file)
@@ -3335,14 +3335,9 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
      function to make the reuse checks properly be able to check this bit. */
   connkeep(conn, "SSH default");
 
-  if(conn->user)
-    infof(data, "User: '%s'", conn->user);
-  else
-    infof(data, "User: NULL");
+  infof(data, "User: '%s'", conn->user);
 #ifdef CURL_LIBSSH2_DEBUG
-  if(conn->passwd) {
-    infof(data, "Password: %s", conn->passwd);
-  }
+  infof(data, "Password: %s", conn->passwd);
   sock = conn->sock[FIRSTSOCKET];
 #endif /* CURL_LIBSSH2_DEBUG */