nixpkgs/pkgs/by-name/pp/pptpd/ppp-2.5.0-compat.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

60 lines
1.6 KiB
Diff

diff --git a/plugins/pptpd-logwtmp.c b/plugins/pptpd-logwtmp.c
index ac5ecc2..9745177 100644
--- a/plugins/pptpd-logwtmp.c
+++ b/plugins/pptpd-logwtmp.c
@@ -12,9 +12,18 @@
#include <unistd.h>
#include <utmp.h>
#include <string.h>
+
+#define HAVE_STDARG_H 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STDDEF_H 1
#include <pppd/pppd.h>
+#include <pppd/options.h>
+#include <linux/ppp_defs.h>
+#include <linux/limits.h>
+
+int debug = 0;
-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 +51,27 @@ static char *reduce(char *user)
static void ip_up(void *opaque, int arg)
{
+ char peer_authname[MAXNAMELEN];
+ ppp_peer_authname(peer_authname, MAXNAMELEN);
char *user = reduce(peer_authname);
if (debug)
- notice("pptpd-logwtmp.so ip-up %s %s %s", ifname, user,
+ notice("pptpd-logwtmp.so ip-up %s %s %s", ppp_ifname(), user,
pptpd_original_ip);
- logwtmp(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, "", "");
+ 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);
+ ppp_add_options(options);
+ ppp_add_notify(NF_IP_UP, ip_up, NULL);
+ ppp_add_notify(NF_IP_DOWN, ip_down, NULL);
if (debug)
notice("pptpd-logwtmp: $Version$");
}