Improve ssh_options_allow_ssh2().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@367 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-02 12:39:49 +00:00
parent 396db49a41
commit 0dee533531
2 changed files with 23 additions and 10 deletions

View File

@@ -322,7 +322,7 @@ int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
(void *arg, float status), void *arg); (void *arg, float status), void *arg);
int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec); int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow); int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow); int 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_log_function(SSH_OPTIONS *opt, void ssh_options_set_log_function(SSH_OPTIONS *opt,

View File

@@ -691,18 +691,31 @@ int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow) {
return 0; return 0;
} }
/** Default value is 1 (allow connection to SSH2 servers) /**
* \brief allow or deny the connection to SSH2 servers * @brief Allow or deny the connection to SSH2 servers.
* \param opt options structure *
* \param allow nonzero values allow ssh2 * Default value is 1 (allow connection to SSH2 servers).
*
* @param opt The options structure to use.
*
* @param allow Non zero values allow ssh2.
*
* @return 0 on success, < 0 on error.
*/ */
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow){ int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow) {
if(allow) if (opt == NULL) {
return -1;
}
if (allow) {
opt->ssh2allowed = 1; opt->ssh2allowed = 1;
else } else {
opt->ssh2allowed = 0; opt->ssh2allowed = 0;
} }
return 0;
}
/** Default is a write on stderr /** Default is a write on stderr
* \brief Change the writer callback for logging * \brief Change the writer callback for logging
* \param opt options structure * \param opt options structure