summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2022-01-08 07:33:55 +0000
committerDamien Miller <djm@cvs.openbsd.org>2022-01-08 07:33:55 +0000
commit22381158c65e3873af702420fd83abfbc562c69a (patch)
treeac410029ce449a5966970b46e74d84d4d31ee098 /usr.bin
parent51d0189a9719fa1adaac24636bb9a2c843d8e00d (diff)
add a variant of send_status() that allows overriding the default,
generic error message. feedback/ok markus & jsg
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sftp-server.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c
index 2c9c300bbe8..e13ac9609ce 100644
--- a/usr.bin/ssh/sftp-server.c
+++ b/usr.bin/ssh/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.135 2022/01/01 01:55:30 jsg Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.136 2022/01/08 07:33:54 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@@ -526,7 +526,7 @@ status_to_message(u_int32_t status)
}
static void
-send_status(u_int32_t id, u_int32_t status)
+send_status_errmsg(u_int32_t id, u_int32_t status, const char *errmsg)
{
struct sshbuf *msg;
int r;
@@ -542,14 +542,21 @@ send_status(u_int32_t id, u_int32_t status)
(r = sshbuf_put_u32(msg, status)) != 0)
fatal_fr(r, "compose");
if (version >= 3) {
- if ((r = sshbuf_put_cstring(msg,
- status_to_message(status))) != 0 ||
+ if ((r = sshbuf_put_cstring(msg, errmsg == NULL ?
+ status_to_message(status) : errmsg)) != 0 ||
(r = sshbuf_put_cstring(msg, "")) != 0)
fatal_fr(r, "compose message");
}
send_msg(msg);
sshbuf_free(msg);
}
+
+static void
+send_status(u_int32_t id, u_int32_t status)
+{
+ return send_status_errmsg(id, status, NULL);
+}
+
static void
send_data_or_handle(char type, u_int32_t id, const u_char *data, int dlen)
{