Subject: Build fixes for ppp-2.5 Origin: upstream, 1.4.0-22-gb77d92c Upstream-Author: Chris Boot Date: Mon Nov 27 20:43:56 2023 +1100 --- a/plugins/pptpd-logwtmp.c +++ b/plugins/pptpd-logwtmp.c @@ -12,9 +12,12 @@ #include #include #include +#include +#include #include +#include -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$"); }