rio: 0.0.36 -> 0.0.37
[NixPkgs.git] / pkgs / tools / networking / pptpd / ppp-2.5.0-compat.patch
blob33c4a828067ecfa8303f3ef323b329e258543045
1 diff --git a/plugins/pptpd-logwtmp.c b/plugins/pptpd-logwtmp.c
2 index ac5ecc2..9745177 100644
3 --- a/plugins/pptpd-logwtmp.c
4 +++ b/plugins/pptpd-logwtmp.c
5 @@ -12,9 +12,18 @@
6 #include <unistd.h>
7 #include <utmp.h>
8 #include <string.h>
10 +#define HAVE_STDARG_H 1
11 +#define HAVE_STDBOOL_H 1
12 +#define HAVE_STDDEF_H 1
13 #include <pppd/pppd.h>
14 +#include <pppd/options.h>
15 +#include <linux/ppp_defs.h>
16 +#include <linux/limits.h>
18 +int debug = 0;
20 -char pppd_version[] = VERSION;
21 +char pppd_version[] = PPPD_VERSION;
23 static char pptpd_original_ip[PATH_MAX+1];
24 static bool pptpd_logwtmp_strip_domain = 0;
25 @@ -42,25 +51,27 @@ static char *reduce(char *user)
27 static void ip_up(void *opaque, int arg)
29 + char peer_authname[MAXNAMELEN];
30 + ppp_peer_authname(peer_authname, MAXNAMELEN);
31 char *user = reduce(peer_authname);
32 if (debug)
33 - notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user,
34 + notice("pptpd-logwtmp.so ip-up %s %s %s", ppp_ifname(), user,
35 pptpd_original_ip);
36 - logwtmp(ifname, user, pptpd_original_ip);
37 + logwtmp(ppp_ifname(), user, pptpd_original_ip);
40 static void ip_down(void *opaque, int arg)
42 if (debug)
43 - notice("pptpd-logwtmp.so ip-down %s", ifname);
44 - logwtmp(ifname, "", "");
45 + notice("pptpd-logwtmp.so ip-down %s", ppp_ifname());
46 + logwtmp(ppp_ifname(), "", "");
49 void plugin_init(void)
51 - add_options(options);
52 - add_notifier(&ip_up_notifier, ip_up, NULL);
53 - add_notifier(&ip_down_notifier, ip_down, NULL);
54 + ppp_add_options(options);
55 + ppp_add_notify(NF_IP_UP, ip_up, NULL);
56 + ppp_add_notify(NF_IP_DOWN, ip_down, NULL);
57 if (debug)
58 notice("pptpd-logwtmp: $Version$");