]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: sftp: Don't attempt to complete arguments for
authordjm@openbsd.org <djm@openbsd.org>
Fri, 16 Sep 2022 03:13:34 +0000 (03:13 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 16 Sep 2022 03:35:21 +0000 (13:35 +1000)
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.

From Michal Privoznik

OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a

sftp.c

diff --git a/sftp.c b/sftp.c
index 939b8dc00bc47f55696624b89951dcf49dddb5bd..11ebe209c3dd874bd7024981d8bf5de7a96c43c6 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.218 2022/06/28 06:09:14 jmc Exp $ */
+/* $OpenBSD: sftp.c,v 1.219 2022/09/16 03:13:34 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -2143,7 +2143,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)