From dabe8669a56fca398da9a7dd117eb74f874cddc0 Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Fri, 7 Dec 2018 13:01:05 -1000 Subject: Update to use libapt instead of apt7-lib for apt1.4+ and add apt-rdepends --- data/_apt7/strdupa.diff | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 data/_apt7/strdupa.diff (limited to 'data/_apt7/strdupa.diff') diff --git a/data/_apt7/strdupa.diff b/data/_apt7/strdupa.diff new file mode 100644 index 000000000..03a179e01 --- /dev/null +++ b/data/_apt7/strdupa.diff @@ -0,0 +1,80 @@ +diff -ru apt-0.7.25.3/apt-pkg/contrib/netrc.cc apt-0.7.25.3+iPhone/apt-pkg/contrib/netrc.cc +--- apt-0.7.25.3/apt-pkg/contrib/netrc.cc 2010-02-01 19:44:40.000000000 +0000 ++++ apt-0.7.25.3+iPhone/apt-pkg/contrib/netrc.cc 2010-02-22 18:26:01.000000000 +0000 +@@ -40,13 +40,13 @@ + #define NETRC DOT_CHAR "netrc" + + /* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */ +-int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL) ++int parsenetrc (const char *host, char *login, char *password, const char *netrcfile = NULL) + { + FILE *file; + int retcode = 1; + int specific_login = (login[0] != 0); + char *home = NULL; +- bool netrc_alloc = false; ++ char *netrc_alloc = NULL; + int state = NOTHING; + + char state_login = 0; /* Found a login keyword */ +@@ -67,11 +67,11 @@ + if (!home) + return -1; + +- asprintf (&netrcfile, "%s%s%s", home, DIR_CHAR, NETRC); +- if(!netrcfile) ++ asprintf (&netrc_alloc, "%s%s%s", home, DIR_CHAR, NETRC); ++ if(!netrc_alloc) + return -1; + else +- netrc_alloc = true; ++ netrcfile = netrc_alloc; + } + + file = fopen (netrcfile, "r"); +@@ -144,7 +144,7 @@ + } + + if (netrc_alloc) +- free(netrcfile); ++ free(netrc_alloc); + + return retcode; + } +@@ -160,11 +160,11 @@ + { + char login[64] = ""; + char password[64] = ""; +- char *netrcfile = strdupa (NetRCFile.c_str ()); ++ const char *netrcfile = NetRCFile.c_str (); + + // first check for a generic host based netrc entry +- char *host = strdupa (Uri.Host.c_str ()); +- if (host && parsenetrc (host, login, password, netrcfile) == 0) ++ const char *host = Uri.Host.c_str (); ++ if (parsenetrc (host, login, password, netrcfile) == 0) + { + if (_config->FindB("Debug::Acquire::netrc", false) == true) + std::clog << "host: " << host +@@ -179,7 +179,8 @@ + // 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 ()); ++ std::string temp(Uri.Host+Uri.Path); ++ const char *hostpath = temp.c_str (); + if (hostpath && parsenetrc (hostpath, login, password, netrcfile) == 0) + { + if (_config->FindB("Debug::Acquire::netrc", false) == true) +diff -ru apt-0.7.25.3/apt-pkg/contrib/netrc.h apt-0.7.25.3+iPhone/apt-pkg/contrib/netrc.h +--- apt-0.7.25.3/apt-pkg/contrib/netrc.h 2010-02-01 19:44:40.000000000 +0000 ++++ apt-0.7.25.3+iPhone/apt-pkg/contrib/netrc.h 2010-02-22 18:23:20.000000000 +0000 +@@ -23,7 +23,7 @@ + // 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. +-int parsenetrc (char *host, char *login, char *password, char *filename); ++int parsenetrc (const char *host, char *login, char *password, const char *filename); + + void maybe_add_auth (URI &Uri, string NetRCFile); + #endif -- cgit v1.2.3