From fbd6bc21c7048d4cb148adf8711e396750ce8378 Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 16 Sep 2022 03:13:34 +0000 Subject: [PATCH] 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. From Michal Privoznik --- usr.bin/ssh/sftp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index 5c4b71d1fba..d49f1682ee1 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/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 * @@ -2115,7 +2115,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.20.1