mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-12 03:00:26 +09:00
Improve ssh_options_set_banner().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@358 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -320,11 +320,11 @@ void ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
|
|||||||
int ssh_options_set_ssh_dir(SSH_OPTIONS *opt, const char *dir);
|
int ssh_options_set_ssh_dir(SSH_OPTIONS *opt, const char *dir);
|
||||||
int ssh_options_set_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
|
int ssh_options_set_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
|
||||||
int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
|
int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
|
||||||
|
int ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
|
||||||
void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
|
void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
|
||||||
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
|
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
|
||||||
void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
|
void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
|
||||||
void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey);
|
void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey);
|
||||||
void ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
|
|
||||||
void ssh_options_set_log_function(SSH_OPTIONS *opt,
|
void ssh_options_set_log_function(SSH_OPTIONS *opt,
|
||||||
void (*callback)(const char *message, SSH_SESSION *session, int verbosity ));
|
void (*callback)(const char *message, SSH_SESSION *session, int verbosity ));
|
||||||
void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity);
|
void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity);
|
||||||
|
|||||||
@@ -456,14 +456,27 @@ void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey){
|
|||||||
opt->rsakey=strdup(rsakey);
|
opt->rsakey=strdup(rsakey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief set the server banner sent to clients
|
/**
|
||||||
* \param opt options structure
|
* @brief Set the server banner sent to clients.
|
||||||
* \param banner a text banner to be shown
|
*
|
||||||
|
* @param opt The options structure to use.
|
||||||
|
*
|
||||||
|
* @param banner A text banner to be shown.
|
||||||
|
*
|
||||||
|
* @return 0 on success, < 0 on error.
|
||||||
*/
|
*/
|
||||||
void ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner){
|
int ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner) {
|
||||||
if(opt->banner)
|
if (opt == NULL || banner == NULL) {
|
||||||
free(opt->banner);
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SAFE_FREE(opt->banner);
|
||||||
opt->banner = strdup(banner);
|
opt->banner = strdup(banner);
|
||||||
|
if (opt->banner == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the methods are:\n
|
/** the methods are:\n
|
||||||
|
|||||||
Reference in New Issue
Block a user