[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH 2/3] Fixed getting of credentials from .netrc

From: Tomas Hozza
Subject: [Bug-wget] [PATCH 2/3] Fixed getting of credentials from .netrc
Date: Fri, 12 May 2017 19:17:31 +0200

There seemed to be a copy&paste error in http.c code, which decides
whether to get credentials from .netrc. In ftp.c "user" and "pass"
variables are char*, while in http.c, these are char**. For this reason
they should be dereferenced when determining if password and user login
is set to some value.

Also since both variables are dereferenced on lines above the changed
code, it does not really make sense to check if they are NULL.

This patch is based on fix from Bruce Jerrick <address@hidden>.
Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=1425097

Signed-off-by: Tomas Hozza <address@hidden>
 src/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c
index 8b77a10..323f559 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1900,7 +1900,7 @@ initialize_request (const struct url *u, struct http_stat 
*hs, int *dt, struct u
     *passwd = NULL;
   /* Check for ~/.netrc if none of the above match */
-  if (opt.netrc && (!user || (!passwd || !*passwd)))
+  if (opt.netrc && (!*user || !*passwd))
     search_netrc (u->host, (const char **) user, (const char **) passwd, 0);
   /* We only do "site-wide" authentication with "global" user/password

reply via email to

[Prev in Thread] Current Thread [Next in Thread]