bug-wget
[Top][All Lists]
Advanced

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

[PATCH] netrc: only remove backslash when we have quotes


From: Jose Quaresma
Subject: [PATCH] netrc: only remove backslash when we have quotes
Date: Fri, 11 Feb 2022 11:28:31 +0000

If the netrc have backslash char "\" it doesn't work with "wget"
but the same netrc file works with "curl -n"

- For example if the netrc password have a backslash on it the wget will return:
  Username/Password Authentication Failed.

- The same password with the backslash works if the it is typed on the stdin 
with:
  wget uri --user=username --ask-password

commit 2b2fd2924aa9eac8c831380196a13c427f6b4329, introduce quotation mark
support and after that wget will remove the backslash char in every token
on the netrc. The backslash can be removed but only when the presence of
the quotation mark is detected.

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 src/netrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/netrc.c b/src/netrc.c
index 76e52485..ab090256 100644
--- a/src/netrc.c
+++ b/src/netrc.c
@@ -294,7 +294,7 @@ parse_netrc_fp (const char *path, FILE *fp)
 
           /* Find the end of the token, handling quotes and escapes.  */
           while (*p && (qmark ? *p != '"' : !c_isspace (*p))){
-            if (*p == '\\')
+            if (qmark && *p == '\\')
               shift_left (p);
             p ++;
           }
-- 
2.35.1




reply via email to

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