From 1ccfc77e9cac41c84b39aa6f9a26b11872ea7e23 Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 25 Apr 2023 15:34:22 +0200 Subject: [PATCH] pptpd: add patch for ppp 2.5.0 compatibility --- pkgs/tools/networking/pptpd/default.nix | 4 ++ .../networking/pptpd/ppp-2.5.0-compat.patch | 59 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 pkgs/tools/networking/pptpd/ppp-2.5.0-compat.patch diff --git a/pkgs/tools/networking/pptpd/default.nix b/pkgs/tools/networking/pptpd/default.nix index c7bd929b1812..3c24d2ac0715 100644 --- a/pkgs/tools/networking/pptpd/default.nix +++ b/pkgs/tools/networking/pptpd/default.nix @@ -9,6 +9,10 @@ stdenv.mkDerivation rec { sha256 = "1h06gyxj51ba6kbbnf6hyivwjia0i6gsmjz8kyggaany8a58pkcg"; }; + patches = [ + ./ppp-2.5.0-compat.patch + ]; + buildInputs = [ ppp ]; postPatch = '' diff --git a/pkgs/tools/networking/pptpd/ppp-2.5.0-compat.patch b/pkgs/tools/networking/pptpd/ppp-2.5.0-compat.patch new file mode 100644 index 000000000000..33c4a828067e --- /dev/null +++ b/pkgs/tools/networking/pptpd/ppp-2.5.0-compat.patch @@ -0,0 +1,59 @@ +diff --git a/plugins/pptpd-logwtmp.c b/plugins/pptpd-logwtmp.c +index ac5ecc2..9745177 100644 +--- a/plugins/pptpd-logwtmp.c ++++ b/plugins/pptpd-logwtmp.c +@@ -12,9 +12,18 @@ + #include + #include + #include ++ ++#define HAVE_STDARG_H 1 ++#define HAVE_STDBOOL_H 1 ++#define HAVE_STDDEF_H 1 + #include ++#include ++#include ++#include ++ ++int debug = 0; + +-char pppd_version[] = VERSION; ++char pppd_version[] = PPPD_VERSION; + + static char pptpd_original_ip[PATH_MAX+1]; + static bool pptpd_logwtmp_strip_domain = 0; +@@ -42,25 +51,27 @@ static char *reduce(char *user) + + static void ip_up(void *opaque, int arg) + { ++ char peer_authname[MAXNAMELEN]; ++ ppp_peer_authname(peer_authname, MAXNAMELEN); + char *user = reduce(peer_authname); + if (debug) +- notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user, ++ notice("pptpd-logwtmp.so ip-up %s %s %s", ppp_ifname(), user, + pptpd_original_ip); +- logwtmp(ifname, user, pptpd_original_ip); ++ logwtmp(ppp_ifname(), user, pptpd_original_ip); + } + + static void ip_down(void *opaque, int arg) + { + if (debug) +- notice("pptpd-logwtmp.so ip-down %s", ifname); +- logwtmp(ifname, "", ""); ++ notice("pptpd-logwtmp.so ip-down %s", ppp_ifname()); ++ logwtmp(ppp_ifname(), "", ""); + } + + void plugin_init(void) + { +- add_options(options); +- add_notifier(&ip_up_notifier, ip_up, NULL); +- add_notifier(&ip_down_notifier, ip_down, NULL); ++ ppp_add_options(options); ++ ppp_add_notify(NF_IP_UP, ip_up, NULL); ++ ppp_add_notify(NF_IP_DOWN, ip_down, NULL); + if (debug) + notice("pptpd-logwtmp: $Version$"); + }