fix: harden the per-user IPC endpoint

This commit is contained in:
2026-08-12 16:08:23 +09:00
parent 4120f90736
commit 432df3730c
9 changed files with 96 additions and 46 deletions

View File

@@ -4,8 +4,6 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "../ipc.h"
typedef struct Key Key;
@@ -81,15 +79,8 @@ loadkeys(char *file)
static void
dial(void)
{
struct sockaddr_un addr;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
fd = ipcconnect();
if(fd < 0)
die("socket");
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), IPCPATH, getuid());
if(connect(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
die("connect");
}