mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
On platforms with no way to get peer UID, use getuid(), also fix some failure
checks.
This commit is contained in:
parent
3a6d82b7c8
commit
8bcd392ee7
@ -569,7 +569,7 @@ cmdq_add_message(struct cmdq_item *item)
|
||||
tmp = cmd_print(item->cmd);
|
||||
if (c != NULL) {
|
||||
uid = proc_get_peer_uid(c->peer);
|
||||
if (uid != getuid()) {
|
||||
if (uid != (uid_t)-1 && uid != getuid()) {
|
||||
if ((pw = getpwuid(uid)) != NULL)
|
||||
xasprintf(&user, "[%s]", pw->pw_name);
|
||||
else
|
||||
|
@ -53,7 +53,6 @@ getpeereid(int s, uid_t *uid, gid_t *gid)
|
||||
return (0);
|
||||
}
|
||||
#else
|
||||
errno = EOPNOTSUPP;
|
||||
return (-1);
|
||||
return (getuid());
|
||||
#endif
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user