diff options
-rw-r--r-- | include/libssh/server.h | 3 | ||||
-rw-r--r-- | src/channels.c | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/libssh/server.h b/include/libssh/server.h index 1a7fd4e6..048abcdc 100644 --- a/include/libssh/server.h +++ b/include/libssh/server.h @@ -199,6 +199,9 @@ LIBSSH_API int ssh_channel_request_send_exit_signal(ssh_channel channel, int core, const char *errmsg, const char *lang); +LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel, + const void *data, + uint32_t len); /* deprecated functions */ SSH_DEPRECATED LIBSSH_API int ssh_accept(ssh_session session); diff --git a/src/channels.c b/src/channels.c index 2463bb0d..08dee367 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2596,6 +2596,23 @@ int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, #if WITH_SERVER /** + * @brief Blocking write on a channel stderr. + * + * @param[in] channel The channel to write to. + * + * @param[in] data A pointer to the data to write. + * + * @param[in] len The length of the buffer to write to. + * + * @return The number of bytes written, SSH_ERROR on error. + * + * @see channel_read() + */ +int ssh_channel_write_stderr(ssh_channel channel, const void *data, uint32_t len) { + return channel_write_common(channel, data, len, 1); +} + +/** * @brief Open a TCP/IP reverse forwarding channel. * * @param[in] channel An allocated channel. |