summaryrefslogtreecommitdiff
path: root/lib/netrc.h
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2013-08-19 00:48:24 -0700
committerDaniel Stenberg <daniel@haxx.se>2013-08-20 11:16:38 +0200
commit36585b539543ca4471ab19c0d738a6e52a827aee (patch)
tree484200dc1e4360b2d5c4bb0b40743963660b4ae2 /lib/netrc.h
parent11baffbff67eae225f63fc684d80ce52a79c8ac5 (diff)
downloadcurl-36585b539543ca4471ab19c0d738a6e52a827aee.tar.gz
netrc: handle longer username and password
libcurl truncates usernames and passwords it reads from .netrc to LOGINSIZE and PASSWORDSIZE (64) characters without any indication to the user, to ensure the values returned from Curl_parsenetrc fit in a caller-provided buffer. Fix the interface by passing back dynamically allocated buffers allocated to fit the user's input. The parser still relies on a 256-character buffer to read each line, though. So now you can include an ~246-character password in your .netrc, instead of the previous limit of 63 characters. Reported-by: Colby Ranger
Diffstat (limited to 'lib/netrc.h')
-rw-r--r--lib/netrc.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/netrc.h b/lib/netrc.h
index 4db764df2..a14560114 100644
--- a/lib/netrc.h
+++ b/lib/netrc.h
@@ -22,19 +22,15 @@
*
***************************************************************************/
-/* Make sure we have room for at least this size: */
-#define LOGINSIZE 64
-#define PASSWORDSIZE 64
-
/* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */
int Curl_parsenetrc(const char *host,
- char *login,
- char *password,
+ char **loginp,
+ char **passwordp,
char *filename);
- /* Assume: password[0]=0, host[0] != 0.
- * If login[0] = 0, search for login and password within a machine section
- * in the netrc.
- * If login[0] != 0, search for password within machine and login.
+ /* Assume: (*passwordp)[0]=0, host[0] != 0.
+ * If (*loginp)[0] = 0, search for login and password within a machine
+ * section in the netrc.
+ * If (*loginp)[0] != 0, search for password within machine and login.
*/
#endif /* HEADER_CURL_NETRC_H */