curl / Mailing Lists / curl-library / Single Mail

curl-library

Comments in _netrc

From: Gisle Vanem via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 2 Aug 2017 13:30:55 +0200

For testing, I needed to comment out a line in my
'%HOME/_netrc' file. Like:

#machine tablet-pc login foo password bar1
  machine tablet-pc login foo password bar2

I was surprised to see that curl/libcurl even with
this edit, a command like 'curl ftp://tablet-pc ..' would
send the password "bar1".

I.e. lib/netc.c ignores the comment char '#'! Can this
please be fixed? Something like:

--- a/netrc.c 2016-11-22 14:33:03
+++ b/netrc.c 2017-08-02 11:27:18
@@ -119,6 +119,8 @@

      while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {
        tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
+ if (tok && *tok == '#')
+ continue;
        while(!done && tok) {

BTW.
It's also confusing that '%HOME%/.netrc' is NOT
supported on Windows. An old issue on Win-9x perhaps?
It would be great that '%HOME/_netrc' only said:
   include %HOME/.netrc

-- 
--gv
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-08-02