[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] session: ssh_get_clientbanner


Hi,

Attached is a patch to expose a getter for the client banner text.


Thanks,
-Jon
From 9c472b02f10063545e9a83c03d8f38d207f4bb87 Mon Sep 17 00:00:00 2001
From: Jon Simons <jon.simons@xxxxxxxxxx>
Date: Mon, 2 Dec 2013 17:16:12 -0800
Subject: [PATCH] session: ssh_get_clientbanner

---
 include/libssh/libssh.h |  1 +
 src/session.c           | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 9a00ea7..46aafae 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -625,6 +625,7 @@ LIBSSH_API int ssh_event_dopoll(ssh_event event, int timeout);
 LIBSSH_API int ssh_event_remove_fd(ssh_event event, socket_t fd);
 LIBSSH_API int ssh_event_remove_session(ssh_event event, ssh_session session);
 LIBSSH_API void ssh_event_free(ssh_event event);
+LIBSSH_API const char* ssh_get_clientbanner(ssh_session session);
 LIBSSH_API const char* ssh_get_serverbanner(ssh_session session);
 
 #ifndef LIBSSH_LEGACY_0_4
diff --git a/src/session.c b/src/session.c
index ebf48d8..baa6949 100644
--- a/src/session.c
+++ b/src/session.c
@@ -280,6 +280,20 @@ void ssh_free(ssh_session session) {
 }
 
 /**
+ * @brief get the client banner
+ *
+ * @param[in] session   The SSH session
+ *
+ * @return Returns the client banner string or NULL.
+ */
+const char* ssh_get_clientbanner(ssh_session session) {
+	if (!session) {
+		return NULL;
+	}
+	return session->clientbanner;
+}
+
+/**
  * @brief get the server banner
  *
  * @param[in] session   The SSH session
-- 
1.8.4.21.g992c386


Follow-Ups:
Re: [PATCH] session: ssh_get_clientbannerJon Simons <jon@xxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org