summaryrefslogtreecommitdiff
path: root/extcap/ssh-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'extcap/ssh-base.c')
-rw-r--r--extcap/ssh-base.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c
index 10fefd2577..830485df3d 100644
--- a/extcap/ssh-base.c
+++ b/extcap/ssh-base.c
@@ -26,6 +26,7 @@
#include <extcap/extcap-base.h>
#include <log.h>
+#include <string.h>
#define verbose_print(...) { if (verbose) printf(__VA_ARGS__); }
@@ -132,6 +133,22 @@ failure:
return NULL;
}
+int ssh_channel_printf(ssh_channel channel, const char* fmt, ...)
+{
+ gchar* buf;
+ va_list arg;
+ int ret = EXIT_SUCCESS;
+
+ va_start(arg, fmt);
+ buf = g_strdup_vprintf(fmt, arg);
+ if (ssh_channel_write(channel, buf, (guint32)strlen(buf)) == SSH_ERROR)
+ ret = EXIT_FAILURE;
+ va_end(arg);
+ g_free(buf);
+
+ return ret;
+}
+
void ssh_cleanup(ssh_session* sshs, ssh_channel* channel)
{
if (*channel) {