[tor-commits] [torsocks/pending-changes] Second fix for the "not found in any shared library" issue.
ioerror at torproject.org
ioerror at torproject.org
Sun Jan 27 04:10:01 UTC 2013
commit c2c22d0007c340fcb517e6a434ec5bcb4321c3e6
Author: Jacob Appelbaum <jacob at appelbaum.net>
Date: Sun Nov 4 21:20:07 2012 +0000
Second fix for the "not found in any shared library" issue.
This patch is from lunar:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636943#74
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=74;filename=torsocks-1.2_fix_libresolv_with_eglibc2.3.diff;att=1;bug=636943
---
src/expansion_table.h | 5 -----
src/torsocks.c | 20 +++++++++++++-------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/expansion_table.h b/src/expansion_table.h
index e981f5d..14fabe1 100644
--- a/src/expansion_table.h
+++ b/src/expansion_table.h
@@ -76,12 +76,7 @@
/*RES_FUNC (ERR, int, RES_INIT_, res_init, res_init, "res_init") */
RES_FUNC (ERR, int, RES_QUERY_, res_query, res_query, "res_query")
RES_FUNC (ERR, int, RES_SEARCH_, res_search, res_search, "res_search")
-#if defined(__APPLE__) || defined(__darwin__)
RES_FUNC (ERR, int, RES_SEND_, res_send, res_send, "res_send")
-#else
-/* It is a bit of a mystery why this is required on Linux. See http://code.google.com/p/torsocks/issues/detail?id=3 */
-RES_FUNC (ERR, int, RES_SEND_, res_send, res_send, "__res_send")
-#endif
RES_FUNC (ERR, int, RES_QUERYDOMAIN_, res_querydomain, res_querydomain, "res_querydomain")
DNS_FUNC (ERR, struct hostent *, GETHOSTBYNAME_, gethostbyname, gethostbyname, "gethostbyname")
diff --git a/src/torsocks.c b/src/torsocks.c
index 5b1c16a..294e6dc 100644
--- a/src/torsocks.c
+++ b/src/torsocks.c
@@ -150,10 +150,11 @@ void torsocks_init(void)
dlerror();
#ifndef USE_OLD_DLSYM
#ifdef SUPPORT_RES_API
- if ((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL)
+ if (((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL) &&
+ ((realres_init = dlsym(RTLD_NEXT, "__res_init")) == NULL))
LOAD_ERROR("res_init", MSGERR);
#endif
- #define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) if ((real##n = dlsym(RTLD_NEXT, m)) == NULL) LOAD_ERROR(m, MSG##e);
+ #define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) if (((real##n = dlsym(RTLD_NEXT, m)) == NULL) && ((real##n = dlsym(RTLD_NEXT, "__" m)) == NULL)) LOAD_ERROR(m, MSG##e);
#include "expansion_table.h"
#undef PATCH_TABLE_EXPANSION
#else
@@ -856,7 +857,8 @@ int res_init(void)
{
int rc;
- if (!realres_init && ((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL))
+ if (!realres_init && ((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL) &&
+ ((realres_init = dlsym(RTLD_NEXT, "__res_init")) == NULL))
LOAD_ERROR("res_init", MSGERR);
show_msg(MSGTEST, "Got res_init request\n");
@@ -877,7 +879,8 @@ int EXPAND_GUTS_NAME(res_query)(RES_QUERY_SIGNATURE, int (*original_res_query)(R
{
int rc;
- if (!original_res_query && ((original_res_query = dlsym(RTLD_NEXT, "res_query")) == NULL))
+ if (!original_res_query && ((original_res_query = dlsym(RTLD_NEXT, "res_query")) == NULL) &&
+ ((original_res_query = dlsym(RTLD_NEXT, "__res_query")) == NULL))
LOAD_ERROR("res_query", MSGERR);
show_msg(MSGTEST, "Got res_query request\n");
@@ -903,7 +906,8 @@ int EXPAND_GUTS_NAME(res_querydomain)(RES_QUERYDOMAIN_SIGNATURE, int (*original_
int rc;
if (!original_res_querydomain &&
- ((original_res_querydomain = dlsym(RTLD_NEXT, "res_querydomain")) == NULL))
+ ((original_res_querydomain = dlsym(RTLD_NEXT, "res_querydomain")) == NULL) &&
+ ((original_res_querydomain = dlsym(RTLD_NEXT, "__res_querydomain")) == NULL))
LOAD_ERROR("res_querydoimain", MSGERR);
show_msg(MSGDEBUG, "Got res_querydomain request\n");
@@ -929,7 +933,8 @@ int EXPAND_GUTS_NAME(res_search)(RES_SEARCH_SIGNATURE, int (*original_res_search
int rc;
if (!original_res_search &&
- ((original_res_search = dlsym(RTLD_NEXT, "res_search")) == NULL))
+ ((original_res_search = dlsym(RTLD_NEXT, "res_search")) == NULL) &&
+ ((original_res_search = dlsym(RTLD_NEXT, "__res_search")) == NULL))
LOAD_ERROR("res_search", MSGERR);
show_msg(MSGTEST, "Got res_search request\n");
@@ -954,7 +959,8 @@ int EXPAND_GUTS_NAME(res_send)(RES_SEND_SIGNATURE, int (*original_res_send)(RES_
{
int rc;
- if (!original_res_send && ((original_res_send = dlsym(RTLD_NEXT, "res_send")) == NULL))
+ if (!original_res_send && ((original_res_send = dlsym(RTLD_NEXT, "res_send")) == NULL)
+ && ((original_res_send = dlsym(RTLD_NEXT, "__res_send")) == NULL))
LOAD_ERROR("res_send", MSGERR);
show_msg(MSGTEST, "Got res_send request\n");
More information about the tor-commits
mailing list