Hi,

El 6/8/26 a les 2:22, Roy Marples ha escrit:
Hurd lacks the means of authenticating a socket. ideally getpeereid(3) should be supported as it's sockets are BSD centric
which would make my life easy.
Maybe I could work on adding getpeereid() to he Hurd. The approach would be:

1. Add a new op to the socket protocol, called socket_getpeereid:

```
routine socket_getpeereid ( sock: socket_t; out euid: uid_t;
  out egid: gid_t);
```

2. pflocal, modify `struct sock` to add to new fields:

```
/* Effective identity of the socket's peer, when connected. */ uid_t peer_uid;
gid_t peer_gid;
```

3. pflocal, on sock_connect, set the values:

```
sock1->peer_uid = sock2->uid;
sock1->peer_gid = sock2->gid;
```
And vice-versa


4. pflocal, implement the new op:

```
S_socket_getpeereid (struct sock_user *user, uid_t *euid, gid_t *egid) { ...
  }
```

Finally, I would need to define getpeereid() in glibc to call the new op and mimic how BSD behaves.

Samuel, does the plan make sense? Is it something we want to do?


Reply via email to