Skip to content

Commit

Permalink
Auth notifications for unknown peers
Browse files Browse the repository at this point in the history
  • Loading branch information
leninalive committed Sep 6, 2024
1 parent 2113d7c commit be6a26e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contrib/peer-approver/notification-listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
static struct nl_sock *sk = NULL;
static char **cb_argv;
static int cb_argc;
static bool running_cb = false;

static int cleanup_and_exit(int ret)
{
Expand All @@ -32,7 +33,8 @@ static int cleanup_and_exit(int ret)

static void signal_handler(int sig)
{
cleanup_and_exit(EXIT_SUCCESS);
if (!running_cb)
cleanup_and_exit(EXIT_SUCCESS);
}

static inline void encode_base64(char dest[static 4], const uint8_t src[static 3])
Expand Down Expand Up @@ -127,8 +129,11 @@ static int run_callback(char *ifname, char *pubkey, char *endpoint_ip, bool adva
new_argv[cb_argc - 2] = endpoint_ip;
new_argv[cb_argc - 1] = (advanced_security ? "on\0" : "off\0");
new_argv[cb_argc] = NULL;
//prerr("Calling ")

running_cb = true;
int ret = execv(cb_argv[1], new_argv);
running_cb = false;

free(new_argv);
return ret;
}
Expand Down

0 comments on commit be6a26e

Please sign in to comment.