diff --git a/TODO b/TODO index 22d0a8b2..800cd140 100644 --- a/TODO +++ b/TODO @@ -51,6 +51,7 @@ At next SONAME bump libssh2_poll() libssh2_poll_channel_read() libssh2_session_startup() (libssh2_session_handshake() is the replacement) + libssh2_banner_set() (libssh2_session_banner_set() is the repacement) * Rename a few function: diff --git a/docs/Makefile.am b/docs/Makefile.am index ce18ce0f..bcd9faa1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -93,6 +93,7 @@ dist_man_MANS = \ libssh2_scp_send_ex.3 \ libssh2_session_abstract.3 \ libssh2_session_banner_get.3 \ + libssh2_session_banner_set.3 \ libssh2_session_block_directions.3 \ libssh2_session_callback_set.3 \ libssh2_session_disconnect.3 \ diff --git a/docs/libssh2_banner_set.3 b/docs/libssh2_banner_set.3 index 750e896c..d0617deb 100644 --- a/docs/libssh2_banner_set.3 +++ b/docs/libssh2_banner_set.3 @@ -8,6 +8,9 @@ int libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner); .SH DESCRIPTION +This function is \fbDEPRECATED\fP. Use \fIlibssh2_session_banner_set(3)\fP +instead! + \fIsession\fP - Session instance as returned by .BR libssh2_session_init_ex(3) @@ -17,14 +20,13 @@ Set the banner that will be sent to the remote host when the SSH session is started with .BR libssh2_session_startup(3) This is optional; a banner corresponding to the protocol and libssh2 version will be sent by default. - .SH RETURN VALUE Return 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. - +.SH AVAILABILITY +Marked as deprecated since 1.4.0 .SH ERRORS \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. - .SH SEE ALSO -.BR libssh2_session_startup(3) +.BR libssh2_session_handshake(3) diff --git a/docs/libssh2_session_banner_get.3 b/docs/libssh2_session_banner_get.3 index 814b0009..e253aa13 100644 --- a/docs/libssh2_session_banner_get.3 +++ b/docs/libssh2_session_banner_get.3 @@ -13,6 +13,8 @@ the banner each server presents. A pointer to a string or NULL if something failed. The data pointed to will be allocated and associated to the session handle and will be freed by libssh2 when \fIlibssh2_session_free(3)\fP is used. +.SH AVAILABILITY +Added in 1.4.0 .SH SEE ALSO .BR libssh2_session_banner_set(3), .BR libssh2_session_handshake(3), diff --git a/docs/libssh2_session_banner_set.3 b/docs/libssh2_session_banner_set.3 new file mode 100644 index 00000000..b1d445a3 --- /dev/null +++ b/docs/libssh2_session_banner_set.3 @@ -0,0 +1,32 @@ +.TH libssh2_session_banner_set 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual" +.SH NAME +libssh2_session_banner_set - set the SSH prococol banner for the local client +.SH SYNOPSIS +#include + +int +libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner); + +.SH DESCRIPTION +\fIsession\fP - Session instance as returned by +.BR libssh2_session_init_ex(3) + +\fIbanner\fP - A pointer to a zero-terminated string holding the user defined +banner + +Set the banner that will be sent to the remote host when the SSH session is +started with \fIlibssh2_session_startup(3)\fP This is optional; a banner +corresponding to the protocol and libssh2 version will be sent by default. +.SH RETURN VALUE +Returns 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN +when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative +number, it isn't really a failure per se. +.SH ERRORS +\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. +.SH AVAILABILITY +Added in 1.4.0. + +Before 1.4.0 this function was known as libssh2_banner_set(3) +.SH SEE ALSO +.BR libssh2_session_handshake(3), +.BR libssh2_session_banner_get(3) diff --git a/src/session.c b/src/session.c index 2706e587..f15d0037 100644 --- a/src/session.c +++ b/src/session.c @@ -411,11 +411,11 @@ get_socket_nonblocking(int sockfd) #endif } -/* libssh2_banner_set - * Set the local banner +/* libssh2_session_banner_set + * Set the local banner to use in the server handshake. */ LIBSSH2_API int -libssh2_banner_set(LIBSSH2_SESSION * session, const char *banner) +libssh2_session_banner_set(LIBSSH2_SESSION * session, const char *banner) { size_t banner_len = banner ? strlen(banner) : 0; @@ -446,6 +446,15 @@ libssh2_banner_set(LIBSSH2_SESSION * session, const char *banner) return 0; } +/* libssh2_banner_set + * Set the local banner. DEPRECATED VERSION + */ +LIBSSH2_API int +libssh2_banner_set(LIBSSH2_SESSION * session, const char *banner) +{ + return libssh2_session_banner_set(session, banner); +} + /* * libssh2_session_init_ex *