diff options
-rw-r--r-- | include/libssh/libssh.h | 2 | ||||
-rw-r--r-- | libssh/options.c | 32 |
2 files changed, 23 insertions, 11 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 94232b98..e135f329 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -325,9 +325,9 @@ int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow); int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow); int ssh_options_set_log_function(SSH_OPTIONS *opt, void (*callback)(const char *message, SSH_SESSION *session, int verbosity)); +int ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity); 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_log_verbosity(SSH_OPTIONS *opt, int verbosity); /** * @brief Set the authentication callback. diff --git a/libssh/options.c b/libssh/options.c index c9b938d2..3bbf559c 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -740,17 +740,29 @@ int ssh_options_set_log_function(SSH_OPTIONS *opt, return 0; } -/** \brief set this session's logging priority - * \param opt options structure - * \param verbosity verbosity of the messages. Every log smaller or equal to verbosity will be shown\n - * SSH_LOG_NOLOG No logging \n - * SSH_LOG_RARE Rare conditions or warnings\n - * SSH_LOG_ENTRY Api-accessible entrypoints\n - * SSH_LOG_PACKET Packet id and size\n - * SSH_LOG_FUNCTIONS function entering and leaving\n +/** + * @brief Set the session logging priority. + * + * @param opt The options structure to use. + * + * @param verbosity The verbosity of the messages. Every log smaller or + * equal to verbosity will be shown\n + * SSH_LOG_NOLOG No logging \n + * SSH_LOG_RARE Rare conditions or warnings\n + * SSH_LOG_ENTRY Api-accessible entrypoints\n + * SSH_LOG_PACKET Packet id and size\n + * SSH_LOG_FUNCTIONS function entering and leaving\n + * + * @return 0 on success, < 0 on error. */ -void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity){ - opt->log_verbosity=verbosity; +int ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity) { + if (opt == NULL) { + return -1; + } + + opt->log_verbosity = verbosity; + + return 0; } /** * This is a helper for your application to generate the appropriate |