On platforms with no way to get peer UID, use getuid(), also fix some failure

checks.
This commit is contained in:
Nicholas Marriott
2022-04-06 16:47:59 +01:00
parent 3a6d82b7c8
commit 8bcd392ee7
3 changed files with 8 additions and 5 deletions

View File

@ -151,7 +151,7 @@ server_acl_user_deny_write(uid_t uid)
TAILQ_FOREACH(c, &clients, entry) {
uid = proc_get_peer_uid(c->peer);
if (uid == user->uid && uid == user->uid)
if (uid != (uid_t)-1 && uid == user->uid)
c->flags |= CLIENT_READONLY;
}
}
@ -164,7 +164,11 @@ int
server_acl_join(struct client *c)
{
struct server_acl_user *user;
uid_t uid = proc_get_peer_uid(c->peer);
uid_t uid;
uid = proc_get_peer_uid(c->peer);
if (uid == (uid_t)-1)
return (0);
user = server_acl_user_find(uid);
if (user == NULL)