aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-15 13:57:12 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-15 13:57:46 +0200
commit1d93a576f4cc7c6bfb5eb122469c3d4ba85f84bc (patch)
tree98788e4be6bb7794b499ad87dd3a6b2f9d98be86
parent668bd8418f5886b1e449381057e4f2849b200562 (diff)
downloadrtty-1d93a576f4cc7c6bfb5eb122469c3d4ba85f84bc.tar.gz
Reverse meaning of +d (dumb) flag
I personally find the detection useful enough to have enabled by default.
-rw-r--r--rtty.15
-rw-r--r--rtty.c13
2 files changed, 9 insertions, 9 deletions
diff --git a/rtty.1 b/rtty.1
index 7fc2fee..d8a01eb 100644
--- a/rtty.1
+++ b/rtty.1
@@ -30,8 +30,9 @@ If the
.Sy +d
flag is provided,
.Nm
-tries to detect password prompts from the remote server
-and hide the user's input.
+disables all heuristics to detect password prompts
+from the remote server and hide the user's input,
+which are enabled by default.
If the
.Sy +p
flag is provided,
diff --git a/rtty.c b/rtty.c
index 18eeae6..aa62f45 100644
--- a/rtty.c
+++ b/rtty.c
@@ -22,7 +22,7 @@ main(int argc, char *argv[])
char bufin[MAXBUF], bufout[MAXBUF], *bi, *bo, in[30], **nargv,
out[30], pw[255];
fd_set rfds0, rfds1;
- int detect, fdin, fdout, i, n, offset, sshpass;
+ int dumb, fdin, fdout, i, n, offset, sshpass;
struct timeval tv;
signal(SIGCHLD, sigchld);
@@ -35,9 +35,9 @@ main(int argc, char *argv[])
err(1, "mkfifo");
/* Process rtty-specific flags. */
- detect = sshpass = 0;
+ dumb = sshpass = 0;
for(;argv[1][0] == '+';){
- if(strchr(argv[1], 'd')) detect = 1;
+ if(strchr(argv[1], 'd')) dumb = 1;
if(strchr(argv[1], 'p')) sshpass = 1;
/* Remove flag argument from argv. */
@@ -153,13 +153,12 @@ main(int argc, char *argv[])
fflush(stdout);
bufin[0] = 0;
- if(!detect)
- continue;
-
/*
- * As the +d flag is given, rtty tries to detect
+ * Unless the +d flag is given, rtty tries to detect
* password prompts and hide the user's input.
*/
+ if(dumb)
+ continue;
if(bo[strlen(bo)-1] == ':'
|| strcmp(bo+strlen(bo)-2, ": ") == 0){
if(!(bo = strrchr(bufout, '\n')))