1
0

cherry-pick.1.4.0-22-gb77d92c.build-fixes-for-ppp-2-5.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Subject: Build fixes for ppp-2.5
  2. Origin: upstream, 1.4.0-22-gb77d92c
  3. Upstream-Author: Chris Boot <bootc@debian.org>
  4. Date: Mon Nov 27 20:43:56 2023 +1100
  5. --- a/plugins/pptpd-logwtmp.c
  6. +++ b/plugins/pptpd-logwtmp.c
  7. @@ -12,9 +12,12 @@
  8. #include <unistd.h>
  9. #include <utmp.h>
  10. #include <string.h>
  11. +#include <linux/if.h>
  12. +#include <linux/limits.h>
  13. #include <pppd/pppd.h>
  14. +#include <pppd/options.h>
  15. -char pppd_version[] = VERSION;
  16. +char pppd_version[] = PPPD_VERSION;
  17. static char pptpd_original_ip[PATH_MAX+1];
  18. static bool pptpd_logwtmp_strip_domain = 0;
  19. @@ -28,7 +31,7 @@
  20. { NULL }
  21. };
  22. -static char *reduce(char *user)
  23. +static const char *reduce(const char *user)
  24. {
  25. char *sep;
  26. if (!pptpd_logwtmp_strip_domain) return user;
  27. @@ -42,8 +45,10 @@
  28. static void ip_up(void *opaque, int arg)
  29. {
  30. - char *user = reduce(peer_authname);
  31. - if (debug)
  32. + char ifname[IFNAMSIZ];
  33. + const char *user = reduce(ppp_peer_authname(NULL, 0));
  34. + ppp_get_ifname(ifname, sizeof(ifname));
  35. + if (debug_on())
  36. notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user,
  37. pptpd_original_ip);
  38. logwtmp(ifname, user, pptpd_original_ip);
  39. @@ -51,16 +56,18 @@
  40. static void ip_down(void *opaque, int arg)
  41. {
  42. - if (debug)
  43. + char ifname[IFNAMSIZ];
  44. + ppp_get_ifname(ifname, sizeof(ifname));
  45. + if (debug_on())
  46. notice("pptpd-logwtmp.so ip-down %s", ifname);
  47. logwtmp(ifname, "", "");
  48. }
  49. void plugin_init(void)
  50. {
  51. - add_options(options);
  52. - add_notifier(&ip_up_notifier, ip_up, NULL);
  53. - add_notifier(&ip_down_notifier, ip_down, NULL);
  54. - if (debug)
  55. + ppp_add_options(options);
  56. + ppp_add_notify(NF_IP_UP, ip_up, NULL);
  57. + ppp_add_notify(NF_IP_DOWN, ip_down, NULL);
  58. + if (debug_on())
  59. notice("pptpd-logwtmp: $Version$");
  60. }