34da3b1
From f8c3df1f40f09dd61078436614d06e7ad818536e Mon Sep 17 00:00:00 2001
34da3b1
From: Tomas Hozza <thozza@redhat.com>
34da3b1
Date: Fri, 12 May 2017 19:17:31 +0200
34da3b1
Subject: [PATCH 2/4] Fixed getting of credentials from .netrc
34da3b1
34da3b1
There seemed to be a copy&paste error in http.c code, which decides
34da3b1
whether to get credentials from .netrc. In ftp.c "user" and "pass"
34da3b1
variables are char*, while in http.c, these are char**. For this reason
34da3b1
they should be dereferenced when determining if password and user login
34da3b1
is set to some value.
34da3b1
34da3b1
Also since both variables are dereferenced on lines above the changed
34da3b1
code, it does not really make sense to check if they are NULL.
34da3b1
34da3b1
This patch is based on fix from Bruce Jerrick <bmj001@gmail.com>.
34da3b1
Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=1425097
34da3b1
34da3b1
Signed-off-by: Tomas Hozza <thozza@redhat.com>
34da3b1
---
34da3b1
 src/http.c | 2 +-
34da3b1
 1 file changed, 1 insertion(+), 1 deletion(-)
34da3b1
34da3b1
diff --git a/src/http.c b/src/http.c
34da3b1
index 8b77a10..323f559 100644
34da3b1
--- a/src/http.c
34da3b1
+++ b/src/http.c
34da3b1
@@ -1900,7 +1900,7 @@ initialize_request (const struct url *u, struct http_stat *hs, int *dt, struct u
34da3b1
     *passwd = NULL;
34da3b1
 
34da3b1
   /* Check for ~/.netrc if none of the above match */
34da3b1
-  if (opt.netrc && (!user || (!passwd || !*passwd)))
34da3b1
+  if (opt.netrc && (!*user || !*passwd))
34da3b1
     search_netrc (u->host, (const char **) user, (const char **) passwd, 0);
34da3b1
 
34da3b1
   /* We only do "site-wide" authentication with "global" user/password
34da3b1
-- 
34da3b1
2.7.5
34da3b1