You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.0 KiB
52 lines
2.0 KiB
diff -uNr apt-1.4.9/apt-pkg/contrib/srvrec.cc apt-1.4.9.mod/apt-pkg/contrib/srvrec.cc
|
|
--- apt-1.4.9/apt-pkg/contrib/srvrec.cc 2019-01-18 12:42:07.000000000 +0200
|
|
+++ apt-1.4.9.mod/apt-pkg/contrib/srvrec.cc 2019-11-12 22:41:25.142836445 +0200
|
|
@@ -40,14 +40,24 @@
|
|
struct servent *s_ent = nullptr;
|
|
std::vector<char> buf(1024);
|
|
|
|
+#ifdef __ANDROID__
|
|
+ s_ent = getservbyport(htons(port), "tcp");
|
|
+ if (s_ent == nullptr) return false;
|
|
+#else
|
|
res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent);
|
|
if (res != 0 || s_ent == nullptr)
|
|
return false;
|
|
+#endif
|
|
|
|
strprintf(target, "_%s._tcp.%s", s_ent->s_name, host.c_str());
|
|
return GetSrvRecords(target, Result);
|
|
}
|
|
|
|
+#ifdef __ANDROID__
|
|
+extern "C" int __dn_skipname(const unsigned char* comp_dn, const unsigned char* eom);
|
|
+static inline int dn_skipname(const unsigned char* a, const unsigned char* b) { return __dn_skipname(a,b); }
|
|
+#endif
|
|
+
|
|
bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result)
|
|
{
|
|
unsigned char answer[PACKETSZ];
|
|
diff -uNr apt-1.4.9/methods/connect.cc apt-1.4.9.mod/methods/connect.cc
|
|
--- apt-1.4.9/methods/connect.cc 2019-01-18 12:42:07.000000000 +0200
|
|
+++ apt-1.4.9.mod/methods/connect.cc 2019-11-12 22:41:29.396188505 +0200
|
|
@@ -129,7 +129,7 @@
|
|
|
|
// Check the socket for an error condition
|
|
unsigned int Err;
|
|
- unsigned int Len = sizeof(Err);
|
|
+ socklen_t Len = sizeof(Err);
|
|
if (getsockopt(Fd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0)
|
|
return _error->Errno("getsockopt",_("Failed"));
|
|
|
|
@@ -301,7 +301,10 @@
|
|
if(LastHost != Host || LastPort != Port)
|
|
{
|
|
SrvRecords.clear();
|
|
- if (_config->FindB("Acquire::EnableSrvRecords", true) == true)
|
|
+ /* Disable by default in Termux due to it breaking on (some) HTC
|
|
+ devices (https://github.com/termux/termux-packages/issues/99). */
|
|
+
|
|
+ if (_config->FindB("Acquire::EnableSrvRecords", false) == true)
|
|
{
|
|
GetSrvRecords(Host, DefPort, SrvRecords);
|
|
// RFC2782 defines that a lonely '.' target is an abort reason
|
|
|