From 8bcd392ee79996f828fd40c52198071ec0f273dd Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 6 Apr 2022 16:47:59 +0100 Subject: On platforms with no way to get peer UID, use getuid(), also fix some failure checks. --- server-acl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server-acl.c') diff --git a/server-acl.c b/server-acl.c index 344f795c..26f2490d 100644 --- a/server-acl.c +++ b/server-acl.c @@ -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) -- cgit