diff options
author | Yury G. Kudryashov <urkud.urkud@gmail.com> | 2012-01-04 15:10:27 +0000 |
---|---|---|
committer | Yury G. Kudryashov <urkud.urkud@gmail.com> | 2012-01-04 15:10:27 +0000 |
commit | 3ca658287487cf6747236835de0c7a816e187270 (patch) | |
tree | 4bab8e7a8c4a561cf70971ddd260dc54b6063451 /pkgs/tools/networking/ppp | |
parent | 7fcf771c2ae9ce88b18605565a96bd3f8abff33f (diff) |
ppp-2.4.5, a few patches
svn path=/nixpkgs/trunk/; revision=31279
Diffstat (limited to 'pkgs/tools/networking/ppp')
-rw-r--r-- | pkgs/tools/networking/ppp/default.nix | 49 | ||||
-rw-r--r-- | pkgs/tools/networking/ppp/nix-purity.patch | 22 | ||||
-rw-r--r-- | pkgs/tools/networking/ppp/nonpriv.patch | 13 |
3 files changed, 55 insertions, 29 deletions
diff --git a/pkgs/tools/networking/ppp/default.nix b/pkgs/tools/networking/ppp/default.nix index 08097b4f5b339..9034c09acc8ba 100644 --- a/pkgs/tools/networking/ppp/default.nix +++ b/pkgs/tools/networking/ppp/default.nix @@ -1,41 +1,32 @@ -a : -let - fetchurl = a.fetchurl; +{ stdenv, fetchurl, substituteAll, libpcap }: + +stdenv.mkDerivation rec { + name = "ppp-2.4.5"; - version = a.lib.attrByPath ["version"] "2.4.4" a; - buildInputs = with a; [ - - ]; -in -rec { src = fetchurl { - url = "http://ppp.samba.org/ftp/ppp/ppp-${version}.tar.gz"; - sha256 = "1sli1s478k85vmjdbrqm39nn5r20x9qgg3a0lbp2dwz50zy4bbsq"; + url = "${meta.homepage}ftp/ppp/${name}.tar.gz"; + sha256 = "019m00q85nrgdpjlhb9021a3iw3pr4a0913gp4h9k7r9r7z7lca3"; }; - inherit buildInputs; - configureFlags = []; + patches = + [ ( substituteAll { + src = ./nix-purity.patch; + inherit libpcap; + glibc = stdenv.gcc.libc; + }) + ./nonpriv.patch + ]; - phaseNames = ["exportVars" "patchPrivileged" "doConfigure" "doMakeInstall"]; + postPatch = "rm -v include/linux/if_pppol2tp.h"; - exportVars = a.noDepEntry('' - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -lcrypt " - ''); + buildInputs = [ libpcap ]; - /* We want to run it as far as we can with our current permissions - For example, dependent builds would prefer to run --version - without ever using setuid pppd. We are not setuid anyway, so.. */ - patchPrivileged = a.fullDepEntry('' - sed -e '/privileged =/aprivileged = 1;' -i pppd/main.c - sed -e '/SH DESCRIPTION/a WARNING: Patched version unsuitable to be setuid root' -i pppd/pppd.8 - '') ["minInit" "doUnpack"]; + postInstall = "chmod -v -R +rw $out"; - passthru = { - inherit version; - }; - - name = "ppp-" + version; meta = { + homepage = http://ppp.samba.org/; description = "Point-to-point implementation for Linux and Solaris"; + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.urkud ]; }; } diff --git a/pkgs/tools/networking/ppp/nix-purity.patch b/pkgs/tools/networking/ppp/nix-purity.patch new file mode 100644 index 0000000000000..c74935c0ec8b2 --- /dev/null +++ b/pkgs/tools/networking/ppp/nix-purity.patch @@ -0,0 +1,22 @@ +diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux +index 060db6a..c151c62 100644 +--- a/pppd/Makefile.linux ++++ b/pppd/Makefile.linux +@@ -117,7 +117,7 @@ CFLAGS += -DHAS_SHADOW + #LIBS += -lshadow $(LIBS) + endif + +-ifneq ($(wildcard /usr/include/crypt.h),) ++ifneq ($(wildcard @glibc@/include/crypt.h),) + CFLAGS += -DHAVE_CRYPT_H=1 + LIBS += -lcrypt + endif +@@ -169,7 +169,7 @@ LIBS += -ldl + endif + + ifdef FILTER +-ifneq ($(wildcard /usr/include/pcap-bpf.h),) ++ifneq ($(wildcard @libpcap@/include/pcap-bpf.h),) + LIBS += -lpcap + CFLAGS += -DPPP_FILTER + endif diff --git a/pkgs/tools/networking/ppp/nonpriv.patch b/pkgs/tools/networking/ppp/nonpriv.patch new file mode 100644 index 0000000000000..df6faaf8383dc --- /dev/null +++ b/pkgs/tools/networking/ppp/nonpriv.patch @@ -0,0 +1,13 @@ +diff --git a/pppd/main.c b/pppd/main.c +index 014d614..6661d33 100644 +--- a/pppd/main.c ++++ b/pppd/main.c +@@ -334,7 +334,7 @@ main(argc, argv) + umask(umask(0777) | 022); + + uid = getuid(); +- privileged = uid == 0; ++ privileged = (uid == 0) || (geteuid() != 0); + slprintf(numbuf, sizeof(numbuf), "%d", uid); + script_setenv("ORIG_UID", numbuf, 0); + |