Support for pppd 2.5

Christoph Biedl <[email protected]> Sun, 26 Nov 2023 13:59:58 +0100
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
--===============0395780201931019455==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="WyVrGo0quymKc6Cb"
Content-Disposition: inline


--WyVrGo0quymKc6Cb
Content-Type: multipart/mixed; boundary="buuVcCvwYdVNF9YF"
Content-Disposition: inline


--buuVcCvwYdVNF9YF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

it seems pptpd needs some adjustment for pppd 2.5. The patch attached
was submitted by Chris Boot, as part of Debian bug report #1056898
<https://bugs.debian.org/1056898>. I guess this should go upstream, so
please consider inclusion.

All the best,
    Christoph

--buuVcCvwYdVNF9YF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="local.ppp-2.5.patch"
Content-Transfer-Encoding: quoted-printable

Subject: Build fixes for ppp-2.5
Author: Chris Boot <[email protected]>
Last-Update: 2023-11-26

--- a/plugins/pptpd-logwtmp.c
+++ b/plugins/pptpd-logwtmp.c
@@ -12,9 +12,12 @@
 #include <unistd.h>
 #include <utmp.h>
 #include <string.h>
+#include <linux/if.h>
+#include <linux/limits.h>
 #include <pppd/pppd.h>
+#include <pppd/options.h>
=20
-char pppd_version[] =3D VERSION;
+char pppd_version[] =3D PPPD_VERSION;
=20
 static char pptpd_original_ip[PATH_MAX+1];
 static bool pptpd_logwtmp_strip_domain =3D 0;
@@ -28,7 +31,7 @@
   { NULL }
 };
=20
-static char *reduce(char *user)
+static const char *reduce(const char *user)
 {
   char *sep;
   if (!pptpd_logwtmp_strip_domain) return user;
@@ -42,8 +45,10 @@
=20
 static void ip_up(void *opaque, int arg)
 {
-  char *user =3D reduce(peer_authname);
-  if (debug)
+  char ifname[IFNAMSIZ];
+  const char *user =3D reduce(ppp_peer_authname(NULL, 0));
+  ppp_get_ifname(ifname, sizeof(ifname));
+  if (debug_on())
     notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user,=20
 	   pptpd_original_ip);
   logwtmp(ifname, user, pptpd_original_ip);
@@ -51,16 +56,18 @@
=20
 static void ip_down(void *opaque, int arg)
 {
-  if (debug)=20
+  char ifname[IFNAMSIZ];
+  ppp_get_ifname(ifname, sizeof(ifname));
+  if (debug_on())
     notice("pptpd-logwtmp.so ip-down %s", ifname);
   logwtmp(ifname, "", "");
 }
=20
 void plugin_init(void)
 {
-  add_options(options);
-  add_notifier(&ip_up_notifier, ip_up, NULL);
-  add_notifier(&ip_down_notifier, ip_down, NULL);
-  if (debug)=20
+  ppp_add_options(options);
+  ppp_add_notify(NF_IP_UP, ip_up, NULL);
+  ppp_add_notify(NF_IP_DOWN, ip_down, NULL);
+  if (debug_on())
     notice("pptpd-logwtmp: $Version$");
 }

--buuVcCvwYdVNF9YF--

--WyVrGo0quymKc6Cb
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEWXMI+726A12MfJXdxCxY61kUkv0FAmVjQUsACgkQxCxY61kU
kv1ymg//ec7PeWRZLDJvfbywu5TRbsNk3gDrd8Tt/cXuU2oirDUrdnQLQhK9dbAl
P5lOPDYuUjaJMRFdRrvXB0FP/8DAdJtXbe5lRkscdNXYQY+GKXu6pNiRNSpQ8I8n
V9EqotfgUbz8Z1s0uweGZenZ5GV69aNotcJ/fytieu8GVcrXePZyvJAgHk6/bCyJ
BL14MhwU2Cr3b5REGXEYNk2w6zGn9clONer74bA2HhEeZSJOH1YXmnRqyyI9hhaO
zY/jwNNy66nUuKA4xmouDkYhAC7kyhF9kJs+SGiLEuL8vXHg3v657x0PKM7CH9Qk
leBz3UtZ4A49Bv3jGFXkFclwOqKqJ7we1zXtc/kN/1D1NbktU1/nc+sAbdC2+jQg
fsFQZGEIe8rJDJhSW+0BwSoAJbErn1Jv/TbX8VMhURuZ5NqYQ+AyTwMEq9rqlGoU
UCW99mTKtlG8E5sU4BqxCfaF5DdZRp9AbL1I4n/FYfTAYtLQ4LsT+j9YrMsPKh5G
JaT9IG/Bvpv9Vryr22HazRS3pj1Jg4uZQakmf7U6Zy4pp4ch4KK7uA3O1BQTahud
zcfm8lT0JGHu7R0R7b2w4+uM7kK/eQYQCx6StJ4wyylSMkdCmxbjsVf1XxLen2Ia
TsNOJEz04gMG+Cby/zUCQgB8nbzWz3P1Sn5I4VQTtJtFoF0DPPg=
=wAvd
-----END PGP SIGNATURE-----

--WyVrGo0quymKc6Cb--


--===============0395780201931019455==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0395780201931019455==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Poptop-server mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/poptop-server

--===============0395780201931019455==--