ppp: 2.4.9 -> 2.5.0

This commit is contained in:
Yureka 2023-02-19 12:48:52 +01:00
parent c9a253ff7f
commit b65e9775fb
3 changed files with 18 additions and 81 deletions

View File

@ -1,9 +1,10 @@
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, libpcap
, libxcrypt
, pkg-config
, autoreconfHook
, openssl
, bash
, nixosTests
@ -11,27 +12,25 @@
}:
stdenv.mkDerivation rec {
version = "2.4.9";
version = "2.5.0";
pname = "ppp";
src = fetchFromGitHub {
owner = "ppp-project";
repo = pname;
rev = "${pname}-${version}";
sha256 = "sha256-8+nbqRNfKPLDx+wmuKSkv+BSeG72hKJI4dNqypqeEK4=";
rev = "ppp-${version}";
sha256 = "sha256-J7udiLiJiJ1PzNxD+XYAUPXZ+ABGXt2U3hSFUWJXe94=";
};
patches = [
(substituteAll {
src = ./nix-purity.patch;
glibc = stdenv.cc.libc.dev or stdenv.cc.libc;
openssl_dev = openssl.dev;
openssl_lib = lib.getLib openssl;
})
# Without nonpriv.patch, pppd --version doesn't work when not run as root.
./nonpriv.patch
configureFlags = [
"--with-openssl=${openssl.dev}"
"--sysconfdir=/etc"
];
nativeBuildInputs = [
pkg-config
autoreconfHook
];
buildInputs = [
libpcap
libxcrypt
@ -39,17 +38,6 @@ stdenv.mkDerivation rec {
bash
];
# This can be removed when ppp 2.5.0 is released:
# https://github.com/ppp-project/ppp/commit/509f04959ad891d7f981f035ed461d51bd1f74b0
propagatedBuildInputs = lib.optional stdenv.hostPlatform.isMusl (writeTextDir "include/net/ppp_defs.h" ''
#ifndef _NET_PPP_DEFS_H
#define _NET_PPP_DEFS_H 1
#include <linux/ppp_defs.h>
#endif /* net/ppp_defs.h */
'');
postPatch = ''
for file in $(find -name Makefile.linux); do
substituteInPlace "$file" --replace '-m 4550' '-m 550'
@ -65,20 +53,15 @@ stdenv.mkDerivation rec {
NIX_LDFLAGS = "-lcrypt";
# This can probably be removed if version > 2.4.9, as IPX support
# has been removed upstream[1]. Just check whether pkgsMusl.ppp
# still builds.
#
# [1]: https://github.com/ppp-project/ppp/commit/c2881a6b71a36d28a89166e82820dc5e711fd775
env.NIX_CFLAGS_COMPILE =
lib.optionalString stdenv.hostPlatform.isMusl "-UIPX_CHANGE";
installFlags = [
"sysconfdir=$(out)/etc"
];
installPhase = ''
runHook preInstall
preInstall = ''
mkdir -p $out/bin
make install
'';
postInstall = ''
install -D -m 755 scripts/{pon,poff,plog} $out/bin
runHook postInstall
'';
postFixup = ''

View File

@ -1,33 +0,0 @@
diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
index 22837c5..6f6fff5 100644
--- a/pppd/Makefile.linux
+++ b/pppd/Makefile.linux
@@ -111,8 +111,8 @@ endif
# EAP SRP-SHA1
ifdef USE_SRP
-CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
-LIBS += -lsrp -L/usr/local/ssl/lib
+CFLAGS += -DUSE_SRP -DOPENSSL -I@openssl_dev@/include/openssl
+LIBS += -lsrp -L@openssl_lib@/lib
NEEDCRYPTOLIB = y
TARGETS += srp-entry
EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
@@ -143,7 +143,7 @@ CFLAGS += -DHAS_SHADOW
#LIBS += -lshadow $(LIBS)
endif
-ifeq ($(shell echo '\#include <crypt.h>' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
+ifneq ($(wildcard @glibc@/include/crypt.h),)
CFLAGS += -DHAVE_CRYPT_H=1
LIBS += -lcrypt
endif
@@ -155,7 +155,7 @@ endif
ifdef NEEDDES
ifndef USE_CRYPT
-CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl
+CFLAGS += -I@openssl_dev@/include/openssl
NEEDCRYPTOLIB = y
else
CFLAGS += -DUSE_CRYPT=1

View File

@ -1,13 +0,0 @@
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);