File ppp-2.5.0.patch of Package pptpd
diff --git a/plugins/pptpd-logwtmp.c b/plugins/pptpd-logwtmp.c
index ac5ecc2..fb24b29 100644
--- a/plugins/pptpd-logwtmp.c
+++ b/plugins/pptpd-logwtmp.c
@@ -12,9 +12,11 @@
#include <unistd.h>
#include <utmp.h>
#include <string.h>
+#include <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;
@@ -42,25 +44,25 @@ static char *reduce(char *user)
static void ip_up(void *opaque, int arg)
{
- char *user = reduce(peer_authname);
- if (debug)
- notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user,
- pptpd_original_ip);
- logwtmp(ifname, user, pptpd_original_ip);
+ char *user = reduce(ppp_peer_authname(NULL, 0));
+ if (debug_on())
+ notice("pptpd-logwtmp.so ip-up %s %s %s", ppp_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, "", "");
+ if (debug_on())
+ 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);
- 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$");
}