diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-11-10 16:32:52 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-11-10 16:32:52 +0100 |
commit | 71ecaad29d8066a494f516efc5efd80860653fe2 (patch) | |
tree | b0769df88e2b6496f23e3d899aeb1c240a3488d9 /apt-pkg/contrib/netrc.cc | |
parent | a865ed25fa54514224cf4d6f83dd9cf48b7ed02b (diff) | |
parent | 37adedc9d0b66eeae7efb88aebd08dfbc6e06f77 (diff) |
merged from http://bzr.debian.org/bzr/apt/apt/debian-experimental2
Diffstat (limited to 'apt-pkg/contrib/netrc.cc')
-rw-r--r-- | apt-pkg/contrib/netrc.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index 34f472ee1..cb7d36088 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -11,9 +11,12 @@ ##################################################################### */ /*}}}*/ +#include <config.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> + #include <iostream> #include <stdio.h> #include <stdlib.h> @@ -23,6 +26,7 @@ #include "netrc.h" +using std::string; /* Get user and password from .netrc when given a machine name */ @@ -47,10 +51,7 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL) int specific_login = (login[0] != 0); char *home = NULL; bool netrc_alloc = false; - int state = NOTHING; - char state_login = 0; /* Found a login keyword */ - char state_password = 0; /* Found a password keyword */ int state_our_login = false; /* With specific_login, found *our* login name */ @@ -81,6 +82,10 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL) bool done = false; char netrcbuffer[256]; + int state = NOTHING; + char state_login = 0; /* Found a login keyword */ + char state_password = 0; /* Found a password keyword */ + while (!done && fgets(netrcbuffer, sizeof (netrcbuffer), file)) { tok = strtok_r (netrcbuffer, " \t\n", &tok_buf); while (!done && tok) { |