Mailing List Archive

[PATCH 1/2] sftp: Don't attempt to complete arguments for non-existent commands
If user entered a non-existent command (e.g. because they made a
typo) there is no point in trying to complete its arguments. Skip
calling complete_match() if that's the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
sftp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sftp.c b/sftp.c
index 8cb5917a..1c529263 100644
--- a/sftp.c
+++ b/sftp.c
@@ -2102,7 +2102,7 @@ complete(EditLine *el, int ch)
if (carg > 1 && line[cursor-1] != ' ')
filematch = argv[carg - 1];

- if (remote != 0 &&
+ if ((remote == REMOTE || remote == LOCAL) &&
complete_match(el, complete_ctx->conn,
*complete_ctx->remote_pathp, filematch,
remote, carg == argc, quote, terminated) != 0)
--
2.34.1

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev