summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-09-23 06:18:47 +0000
committernicm <nicm@openbsd.org>2009-09-23 06:18:47 +0000
commit1c5425bdd24ac7c21379105499a9670138555d99 (patch)
tree3837fee2a7e136bdde425b4b70d80b34b49a11cb /usr.bin/tmux/client.c
parentTrim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client (diff)
downloadwireguard-openbsd-1c5425bdd24ac7c21379105499a9670138555d99.tar.xz
wireguard-openbsd-1c5425bdd24ac7c21379105499a9670138555d99.zip
Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in each client. This means each terminal has to be unlocked individually but simplifies the code and allows the system password to be used to unlock. Note that the set-password command is gone, so it will need to be removed from configuration files, and the -U command line flag has been removed. This is the third protocol version change so again it is best to stop the tmux server before upgrading.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index eda669fa41f..70429fa5e4d 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.20 2009/09/23 06:12:58 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.21 2009/09/23 06:18:47 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -242,6 +242,7 @@ client_msg_dispatch(struct client_ctx *cctx)
{
struct imsg imsg;
struct msg_print_data printdata;
+ struct msg_lock_data lockdata;
ssize_t n, datalen;
for (;;) {
@@ -295,6 +296,15 @@ client_msg_dispatch(struct client_ctx *cctx)
client_suspend();
break;
+ case MSG_LOCK:
+ if (datalen != sizeof lockdata)
+ fatalx("bad MSG_LOCK size");
+ memcpy(&lockdata, imsg.data, sizeof lockdata);
+
+ lockdata.cmd[(sizeof lockdata.cmd) - 1] = '\0';
+ system(lockdata.cmd);
+ client_write_server(cctx, MSG_UNLOCK, NULL, 0);
+ break;
default:
fatalx("unexpected message");
}