=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tmux.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- src/usr.bin/tmux/tmux.c 2009/09/22 12:38:10 1.44 +++ src/usr.bin/tmux/tmux.c 2009/09/23 06:18:48 1.45 @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.44 2009/09/22 12:38:10 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.45 2009/09/23 06:18:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -46,11 +46,6 @@ struct options global_w_options; /* window options */ struct environ global_environ; -int server_locked; -struct passwd *server_locked_pw; -u_int password_failures; -time_t password_backoff; -char *server_password; time_t server_activity; int debug_level; @@ -61,7 +56,6 @@ __dead void usage(void); char *makesockpath(const char *); -int prepare_unlock(enum msgtype *, void **, size_t *, int); int prepare_cmd(enum msgtype *, void **, size_t *, int, char **); int dispatch_imsg(struct client_ctx *, int *); @@ -69,7 +63,7 @@ usage(void) { fprintf(stderr, - "usage: %s [-28dlqUuv] [-f file] [-L socket-name]\n" + "usage: %s [-28dlquv] [-f file] [-L socket-name]\n" " [-S socket-path] [command [flags]]\n", __progname); exit(1); @@ -251,35 +245,6 @@ } int -prepare_unlock(enum msgtype *msg, void **buf, size_t *len, int argc) -{ - static struct msg_unlock_data unlockdata; - char *pass; - - if (argc != 0) { - log_warnx("can't specify a command when unlocking"); - return (-1); - } - - if ((pass = getpass("Password:")) == NULL) - return (-1); - - if (strlen(pass) >= sizeof unlockdata.pass) { - log_warnx("password too long"); - return (-1); - } - - strlcpy(unlockdata.pass, pass, sizeof unlockdata.pass); - memset(pass, 0, strlen(pass)); - - *buf = &unlockdata; - *len = sizeof unlockdata; - - *msg = MSG_UNLOCK; - return (0); -} - -int prepare_cmd(enum msgtype *msg, void **buf, size_t *len, int argc, char **argv) { static struct msg_command_data cmddata; @@ -314,10 +279,10 @@ char cwd[MAXPATHLEN]; void *buf; size_t len; - int retcode, opt, flags, unlock, cmdflags = 0; + int retcode, opt, flags, cmdflags = 0; int nfds; - unlock = flags = 0; + flags = 0; label = path = NULL; login_shell = (**argv == '-'); while ((opt = getopt(argc, argv, "28df:lL:qS:uUv")) != -1) { @@ -357,9 +322,6 @@ case 'u': flags |= IDENTIFY_UTF8; break; - case 'U': - unlock = 1; - break; case 'v': debug_level++; break; @@ -407,6 +369,7 @@ options_set_number(so, "display-time", 750); options_set_number(so, "history-limit", 2000); options_set_number(so, "lock-after-time", 0); + options_set_string(so, "lock-command", "lock -np"); options_set_number(so, "message-attr", 0); options_set_number(so, "message-bg", 3); options_set_number(so, "message-fg", 0); @@ -514,17 +477,10 @@ } xfree(label); - if (unlock) { - if (prepare_unlock(&msg, &buf, &len, argc) != 0) - exit(1); - } else { - if (prepare_cmd(&msg, &buf, &len, argc, argv) != 0) - exit(1); - } + if (prepare_cmd(&msg, &buf, &len, argc, argv) != 0) + exit(1); - if (unlock) - cmdflags &= ~CMD_STARTSERVER; - else if (argc == 0) /* new-session is the default */ + if (argc == 0) /* new-session is the default */ cmdflags |= CMD_STARTSERVER|CMD_SENDENVIRON; else { /*