diff options
author | Michael Vogt <mvo@debian.org> | 2011-05-16 15:57:52 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2011-05-16 15:57:52 +0200 |
commit | d44b706c2d5964daaaf55e6eb97845827958f6e3 (patch) | |
tree | b77f6e72c34c2444ec28e2d47430211d802efb4b /apt-pkg/contrib/netrc.cc | |
parent | 9c192d2811c12dcaf607024eb7f0677b011194e6 (diff) | |
parent | d77b985a309c379d4978525172a72b728fecd15e (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/contrib/netrc.cc')
-rw-r--r-- | apt-pkg/contrib/netrc.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index d8027fc24..34f472ee1 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -160,10 +160,10 @@ void maybe_add_auth (URI &Uri, string NetRCFile) { char login[64] = ""; char password[64] = ""; - char *netrcfile = strdupa (NetRCFile.c_str ()); + char *netrcfile = strdup(NetRCFile.c_str()); // first check for a generic host based netrc entry - char *host = strdupa (Uri.Host.c_str ()); + char *host = strdup(Uri.Host.c_str()); if (host && parsenetrc (host, login, password, netrcfile) == 0) { if (_config->FindB("Debug::Acquire::netrc", false) == true) @@ -173,13 +173,16 @@ void maybe_add_auth (URI &Uri, string NetRCFile) << std::endl; Uri.User = string (login); Uri.Password = string (password); + free(netrcfile); + free(host); return; } + free(host); // if host did not work, try Host+Path next, this will trigger // a lookup uri.startswith(host) in the netrc file parser (because // of the "/" - char *hostpath = strdupa (string(Uri.Host+Uri.Path).c_str ()); + char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str()); if (hostpath && parsenetrc (hostpath, login, password, netrcfile) == 0) { if (_config->FindB("Debug::Acquire::netrc", false) == true) @@ -189,8 +192,9 @@ void maybe_add_auth (URI &Uri, string NetRCFile) << std::endl; Uri.User = string (login); Uri.Password = string (password); - return; } + free(netrcfile); + free(hostpath); } } } |