Accept "user" as an alias for "login" in .netrc

Message ID 20200629144635.C834B33E34@hamza.pair.com
State New
Headers show
Series
  • Accept "user" as an alias for "login" in .netrc
Related show

Commit Message

Gerald Pfeifer June 29, 2020, 2:46 p.m.
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 ages (where those entries were used by formail among others).

Finally digging into this a bit deeper, into the wget sources, I
found that wget solely accepts "login" to specify username in .netrc.

This patch makes it more flexible to also accept "user", like fetchmail
does, and hence silences those warnings as a positive side effect.


(I don't know how to besty provide patches to you and hope this is okay?)

Thanks,
Gerald


2020-06-29  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(+)

-- 
2.26.2

Patch

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;