wget-dev
[Top][All Lists]
Advanced

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

[PATCH] Accept "user" as an alias for "login" in .netrc


From: Gerald Pfeifer
Subject: [PATCH] Accept "user" as an alias for "login" in .netrc
Date: Sat, 25 Nov 2023 21:34:37 +0100 (CET)

On one of my system I have been getting warnings like

  wget: .../.netrc:2: unknown token "user"
  wget: .../.netrc:2: unknown token "..."
  wget: .../.netrc:8: unknown token "user"
  wget: .../.netrc:8: unknown token "..."
  wget: .../.netrc:15: unknown token "user"
  wget: .../.netrc:15: unknown token "..."

for quite a while (where those entries were used by formail among others).

Digging into this a bit, into the wget sources, I found that wget solely 
accepts "login" to specify usernames in .netrc.

This patch makes wget more flexible to also accept "user", like fetchmail
does, and hence silences those warnings.


(I hope providing a patch like this is okay?)

Thanks,
Gerald


2023-11-25  Gerald Pfeifer  <gerald@pfeifer.com> 

        * src/netrc.c (parse_netrc_fp): Accept "user" as an alias 
        for "login".

---
 src/netrc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/netrc.c b/src/netrc.c
index a9232ed4..214e3cef 100644
--- a/src/netrc.c
+++ b/src/netrc.c
@@ -391,6 +391,10 @@ parse_netrc_fp (const char *path, FILE *fp)
               else if (!strcmp (tok, "login"))
                 last_token = tok_login;
 
+              /* "user" sometimes serves as an alias for "login". */
+              else if (!strcmp (tok, "user"))
+                last_token = tok_login;
+
               else if (!strcmp (tok, "macdef"))
                 last_token = tok_macdef;
 
-- 
2.41.1



reply via email to

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