fix: harden the per-user IPC endpoint
This commit is contained in:
11
bench/main.c
11
bench/main.c
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user