Re: Support for pppd 2.5
James Cameron <[email protected]> Mon, 27 Nov 2023 20:45:29 +1100
| Newsgroups | gmane.network.poptop |
|---|---|
| Message-ID | <[email protected]> |
Thanks, taken.
b77d92c ("Build fixes for ppp-2.5")
On Sun, Nov 26, 2023 at 01:59:58PM +0100, Christoph Biedl wrote:
> 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
> 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>
>
> -char pppd_version[] = VERSION;
> +char pppd_version[] = PPPD_VERSION;
>
> static char pptpd_original_ip[PATH_MAX+1];
> static bool pptpd_logwtmp_strip_domain = 0;
> @@ -28,7 +31,7 @@
> { NULL }
> };
>
> -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 @@
>
> static void ip_up(void *opaque, int arg)
> {
> - char *user = reduce(peer_authname);
> - if (debug)
> + char ifname[IFNAMSIZ];
> + const char *user = 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,
> pptpd_original_ip);
> logwtmp(ifname, user, pptpd_original_ip);
> @@ -51,16 +56,18 @@
>
> static void ip_down(void *opaque, int arg)
> {
> - if (debug)
> + char ifname[IFNAMSIZ];
> + ppp_get_ifname(ifname, sizeof(ifname));
> + if (debug_on())
> notice("pptpd-logwtmp.so ip-down %s", ifname);
> logwtmp(ifname, "", "");
> }
>
> 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)
> + 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$");
> }
> _______________________________________________
> Poptop-server mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/poptop-server