diff --git a/pkgs/tools/networking/ncat/default.nix b/pkgs/tools/networking/ncat/default.nix new file mode 100644 index 00000000000..8627fe502ac --- /dev/null +++ b/pkgs/tools/networking/ncat/default.nix @@ -0,0 +1,24 @@ +{stdenv, fetchurl, openssl}: +stdenv.mkDerivation { + name = "ncat-0.10rc3"; + + src = fetchurl { + url = http://ovh.dl.sourceforge.net/sourceforge/nmap-ncat/ncat-0.10rc3.tar.gz; + sha256 = "1yb26ipxwhqkfannji90jxi38k35fal4ffx0jm5clr1a1rndjjzb"; + }; + + patches = [./ncat-0.10rc3.patch ]; + + buildInputs = [openssl ]; + + CFLAGS = "-g"; + + postInstall = "install -D ncat \${out}/bin/ncat ; + install -D docs/man/ncat.1 \${out}/man/ncat.1 ;"; + + meta = { + description = " + Ncat - some effort to join features from different `netcat's. Supports IPv6. +"; + }; +} diff --git a/pkgs/tools/networking/ncat/ncat-0.10rc3.patch b/pkgs/tools/networking/ncat/ncat-0.10rc3.patch new file mode 100644 index 00000000000..ed4c93673aa --- /dev/null +++ b/pkgs/tools/networking/ncat/ncat-0.10rc3.patch @@ -0,0 +1,38 @@ +diff -urN ncat-0.10rc3/ncat_main.c ncat-0.10rc3-fixed/ncat_main.c +--- ncat-0.10rc3/ncat_main.c 2006-01-10 03:29:08.000000000 +0300 ++++ ncat-0.10rc3-fixed/ncat_main.c 2007-07-09 09:58:58.000000000 +0400 +@@ -23,6 +23,7 @@ + { + struct sockaddr_in ss; + struct sockaddr_in6 ss6; ++ struct sockaddr_storage sst; + + struct conn_state cs; + +@@ -271,7 +272,7 @@ + } + + /* resolve hostname */ +- if (!resolve(argv[optind], (struct sockaddr_storage *) &ss)) { ++ if (!resolve(argv[optind], (struct sockaddr_storage *) &sst)) { + /* host failed to resolve :( */ + fprintf(stderr, + "%s: Could not resolve target hostname %s. QUITTING.\n", +@@ -297,6 +298,8 @@ + + /* IPv6 connect() */ + if (oipv == 6) { ++ memcpy(&ss6,&sst,sizeof(ss6)); ++ + ss6.sin6_family = AF_INET6; + ss_len = sizeof(struct sockaddr_in6); + +@@ -329,6 +332,8 @@ + } + /* IPv4 connect() - default. */ + else { ++ memcpy(&ss,&sst,sizeof(ss)); ++ + ss.sin_family = AF_INET; + ss_len = sizeof(struct sockaddr_in); + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b8adbf91ddf..abad521179a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -447,6 +447,10 @@ rec { inherit fetchurl stdenv; }; + ncat = import ../tools/networking/ncat { + inherit fetchurl stdenv openssl; + }; + netcat = import ../tools/networking/netcat { inherit fetchurl stdenv; };