Loading pkgs/tools/security/tor/torsocks-gethostbyaddr-darwin.patch 0 → 100644 +33 −0 Original line number Diff line number Diff line diff --git a/tests/test_dns.c b/tests/test_dns.c index 7e07663..acf095c 100644 --- a/tests/test_dns.c +++ b/tests/test_dns.c @@ -76,6 +76,8 @@ static void test_gethostbyname(const struct test_host *host) return; } +#ifdef __linux__ + static void test_gethostbyaddr_r_failed(void) { int result; @@ -129,6 +131,8 @@ static void test_gethostbyaddr_r(const struct test_host *host) ok(1, "Resolved address"); } +#endif + static void test_gethostbyaddr(const struct test_host *host) { struct hostent *he; @@ -199,8 +203,10 @@ int main(int argc, char **argv) test_getaddrinfo(&tor_check); test_gethostbyname(&tor_dir_auth1); test_gethostbyaddr(&tor_dir_auth2); +#ifdef __linux__ test_gethostbyaddr_r(&tor_dir_auth2); test_gethostbyaddr_r_failed(); +#endif test_getaddrinfo(&tor_localhost); end: pkgs/tools/security/tor/torsocks.nix +33 −14 Original line number Diff line number Diff line { lib, stdenv, fetchgit, fetchurl, autoreconfHook, libcap }: { lib , stdenv , fetchFromGitLab , fetchpatch , autoreconfHook , libcap }: stdenv.mkDerivation rec { pname = "torsocks"; version = "2.3.0"; version = "2.4.0"; src = fetchgit { url = "https://git.torproject.org/torsocks.git"; rev = "refs/tags/v${version}"; sha256 = "0x0wpcigf22sjxg7bm0xzqihmsrz51hl4v8xf91qi4qnmr4ny1hb"; src = fetchFromGitLab { domain = "gitlab.torproject.org"; group = "tpo"; owner = "core"; repo = "torsocks"; rev = "v${version}"; sha256 = "sha256-ocJkoF9LMLC84ukFrm5pzjp/1gaXqDz8lzr9TdG+f88="; }; nativeBuildInputs = [ autoreconfHook ]; patches = lib.optional stdenv.isDarwin (fetchurl { url = "https://trac.torproject.org/projects/tor/raw-attachment/ticket/28538/0001-Fix-macros-for-accept4-2.patch"; sha256 = "97881f0b59b3512acc4acb58a0d6dfc840d7633ead2f400fad70dda9b2ba30b0"; }); patches = [ # fix compatibility with C99 # https://gitlab.torproject.org/tpo/core/torsocks/-/merge_requests/9 (fetchpatch { url = "https://gitlab.torproject.org/tpo/core/torsocks/-/commit/1171bf2fd4e7a0cab02cf5fca59090b65af9cd29.patch"; hash = "sha256-qu5/0fy72+02QI0cVE/6YrR1kPuJxsZfG8XeODqVOPY="; }) # tsocks_libc_accept4 only exists on Linux, use tsocks_libc_accept on other platforms (fetchpatch { url = "https://gitlab.torproject.org/tpo/core/torsocks/uploads/eeec9833512850306a42a0890d283d77/0001-Fix-macros-for-accept4-2.patch"; hash = "sha256-XWi8+UFB8XgBFSl5QDJ+hLu/dH4CvAwYbeZz7KB10Bs="; }) # no gethostbyaddr_r on darwin ./torsocks-gethostbyaddr-darwin.patch ]; postPatch = '' # Patch torify_app() Loading @@ -29,12 +46,14 @@ stdenv.mkDerivation rec { src/bin/torsocks.in ''; nativeBuildInputs = [ autoreconfHook ]; doInstallCheck = true; installCheckTarget = "check-recursive"; meta = { description = "Wrapper to safely torify applications"; homepage = "https://github.com/dgoulet/torsocks"; homepage = "https://gitlab.torproject.org/tpo/core/torsocks"; license = lib.licenses.gpl2; platforms = lib.platforms.unix; maintainers = with lib.maintainers; [ thoughtpolice ]; Loading Loading
pkgs/tools/security/tor/torsocks-gethostbyaddr-darwin.patch 0 → 100644 +33 −0 Original line number Diff line number Diff line diff --git a/tests/test_dns.c b/tests/test_dns.c index 7e07663..acf095c 100644 --- a/tests/test_dns.c +++ b/tests/test_dns.c @@ -76,6 +76,8 @@ static void test_gethostbyname(const struct test_host *host) return; } +#ifdef __linux__ + static void test_gethostbyaddr_r_failed(void) { int result; @@ -129,6 +131,8 @@ static void test_gethostbyaddr_r(const struct test_host *host) ok(1, "Resolved address"); } +#endif + static void test_gethostbyaddr(const struct test_host *host) { struct hostent *he; @@ -199,8 +203,10 @@ int main(int argc, char **argv) test_getaddrinfo(&tor_check); test_gethostbyname(&tor_dir_auth1); test_gethostbyaddr(&tor_dir_auth2); +#ifdef __linux__ test_gethostbyaddr_r(&tor_dir_auth2); test_gethostbyaddr_r_failed(); +#endif test_getaddrinfo(&tor_localhost); end:
pkgs/tools/security/tor/torsocks.nix +33 −14 Original line number Diff line number Diff line { lib, stdenv, fetchgit, fetchurl, autoreconfHook, libcap }: { lib , stdenv , fetchFromGitLab , fetchpatch , autoreconfHook , libcap }: stdenv.mkDerivation rec { pname = "torsocks"; version = "2.3.0"; version = "2.4.0"; src = fetchgit { url = "https://git.torproject.org/torsocks.git"; rev = "refs/tags/v${version}"; sha256 = "0x0wpcigf22sjxg7bm0xzqihmsrz51hl4v8xf91qi4qnmr4ny1hb"; src = fetchFromGitLab { domain = "gitlab.torproject.org"; group = "tpo"; owner = "core"; repo = "torsocks"; rev = "v${version}"; sha256 = "sha256-ocJkoF9LMLC84ukFrm5pzjp/1gaXqDz8lzr9TdG+f88="; }; nativeBuildInputs = [ autoreconfHook ]; patches = lib.optional stdenv.isDarwin (fetchurl { url = "https://trac.torproject.org/projects/tor/raw-attachment/ticket/28538/0001-Fix-macros-for-accept4-2.patch"; sha256 = "97881f0b59b3512acc4acb58a0d6dfc840d7633ead2f400fad70dda9b2ba30b0"; }); patches = [ # fix compatibility with C99 # https://gitlab.torproject.org/tpo/core/torsocks/-/merge_requests/9 (fetchpatch { url = "https://gitlab.torproject.org/tpo/core/torsocks/-/commit/1171bf2fd4e7a0cab02cf5fca59090b65af9cd29.patch"; hash = "sha256-qu5/0fy72+02QI0cVE/6YrR1kPuJxsZfG8XeODqVOPY="; }) # tsocks_libc_accept4 only exists on Linux, use tsocks_libc_accept on other platforms (fetchpatch { url = "https://gitlab.torproject.org/tpo/core/torsocks/uploads/eeec9833512850306a42a0890d283d77/0001-Fix-macros-for-accept4-2.patch"; hash = "sha256-XWi8+UFB8XgBFSl5QDJ+hLu/dH4CvAwYbeZz7KB10Bs="; }) # no gethostbyaddr_r on darwin ./torsocks-gethostbyaddr-darwin.patch ]; postPatch = '' # Patch torify_app() Loading @@ -29,12 +46,14 @@ stdenv.mkDerivation rec { src/bin/torsocks.in ''; nativeBuildInputs = [ autoreconfHook ]; doInstallCheck = true; installCheckTarget = "check-recursive"; meta = { description = "Wrapper to safely torify applications"; homepage = "https://github.com/dgoulet/torsocks"; homepage = "https://gitlab.torproject.org/tpo/core/torsocks"; license = lib.licenses.gpl2; platforms = lib.platforms.unix; maintainers = with lib.maintainers; [ thoughtpolice ]; Loading