Skip to content

Commit

Permalink
#51: Fix last case of byobu/tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdope committed Aug 31, 2021
1 parent 59382a1 commit 3bb96f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ int pusb_local_login(t_pusb_options *opts, const char *user, const char *service

if (local_request == 0 && strstr(name, "tmux") != NULL && tmux_pid != 0) {
char *tmux_client_tty = pusb_tmux_get_client_tty(tmux_pid);
if (tmux_client_tty != NULL) {
if (tmux_client_tty != NULL && tmux_client_tty != 0) {
local_request = pusb_is_tty_local(tmux_client_tty);
} else if (tmux_client_tty == 0) {
return 0;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/tmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ int pusb_tmux_has_remote_clients(const char* username)
char buf[BUFSIZ];
char msgbuf[100];
char regex_tpl[2][BUFSIZ] = {
"(.+)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.+)tmux(.+)(a|attach)", //v4
"(.+)([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4})(.+)tmux(.+)(a|attach)" // v6
"(.+)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.+)tmux(.+)(a|at|attach|new)", //v4
"(.+)([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4})(.+)tmux(.+)(a|at|attach|new)" // v6
}; // ... yes, these allow invalid addresses. No, I don't care. This isn't about validation but detecting remote access. Good enough ¯\_(ツ)_/¯

for (int i = 0; i <= 1; i++) {
Expand Down

0 comments on commit 3bb96f1

Please sign in to comment.