bug-wget
[Top][All Lists]
Advanced

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

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


From: Darshit Shah
Subject: Re: [PATCH] netrc: only remove backslash when we have quotes
Date: Fri, 11 Feb 2022 17:38:28 +0100
User-agent: Cyrus-JMAP/3.5.0-alpha0-4748-g31a5b5f50e-fm-cal2020-20220204.001-g31a5b5f5

Hi,

Thanks a lot for the patch! Would you be willing to write a test case for it? 
The tests are  available in the testenv/ directory

On Fri, Feb 11, 2022, at 12:28, Jose Quaresma wrote:
> 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]