Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.netrc parser fails to skip macdef statements #7238

piru opened this issue Jun 11, 2021 · 1 comment

.netrc parser fails to skip macdef statements #7238

piru opened this issue Jun 11, 2021 · 1 comment


Copy link

piru commented Jun 11, 2021

I did this

Have ~/.netrc of:

macdef testmacro
	cd default
	cd login
	put login.bin
	cd ..
	cd password
	put password.bin

machine example.invalid
	login professor
	password joshua

curl -n http://example.invalid

NOTE: Use --resolve example.invalid:80: or similar to redirect the request to your test server.

Instead of using professor:joshua as credentials put:put is used instead.

I expected the following

netrc file parsing skipping macdef statements properly.

‘macdef name’

Define a macro. This token functions like the ftp macdef command functions. A macro is defined with the specified name; its contents begin with the next .netrc line and continue until a null line (consecutive new-line characters) is encountered. If a macro named init is defined, it is automatically executed as the last step in the auto-login process.

curl/libcurl version

curl 7.77.1-DEV (x86_64-pc-linux-gnu) libcurl/7.77.1-DEV OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.4.57
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB PSL SSL TLS-SRP UnixSockets

operating system

Linux hostname 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux

Copy link

bagder commented Jun 11, 2021

makes you wish there was a documented format for .netrc...

bagder added a commit that referenced this issue Jun 11, 2021
Add test 494 to verify

Reported-by: Harry Sintonen
Fixes #7238
@bagder bagder closed this as completed in bbbc5de Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging a pull request may close this issue.

2 participants