mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-13 04:42:23 +03:00
Improve ssh_options_set_auth_callback().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@370 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -328,16 +328,7 @@ int ssh_options_set_log_function(SSH_OPTIONS *opt,
|
|||||||
int ssh_options_set_log_verbosity(SSH_OPTIONS *opt, 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_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);
|
||||||
|
int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
|
||||||
/**
|
|
||||||
* @brief Set the authentication callback.
|
|
||||||
*
|
|
||||||
* @param opt The options structure to use.
|
|
||||||
* @param cb The callback function to use.
|
|
||||||
* @param userdata A pointer to some user data you can pass to the
|
|
||||||
* callback.
|
|
||||||
*/
|
|
||||||
void ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
|
|
||||||
void *userdata);
|
void *userdata);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -800,7 +800,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
|
|||||||
int ssh1=0;
|
int ssh1=0;
|
||||||
#endif
|
#endif
|
||||||
int ssh2=1;
|
int ssh2=1;
|
||||||
|
|
||||||
int saveoptind=optind; /* need to save 'em */
|
int saveoptind=optind; /* need to save 'em */
|
||||||
int saveopterr=opterr;
|
int saveopterr=opterr;
|
||||||
|
|
||||||
@@ -914,14 +914,28 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
|
|||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
|
/**
|
||||||
|
* @brief Set the authentication callback.
|
||||||
|
*
|
||||||
|
* @param opt The options structure to use.
|
||||||
|
*
|
||||||
|
* @param cb The callback function to use.
|
||||||
|
*
|
||||||
|
* @param userdata A pointer to some user data you can pass to the
|
||||||
|
* callback.
|
||||||
|
*
|
||||||
|
* @return 0 on success, < 0 on error.
|
||||||
|
*/
|
||||||
|
int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
if (opt == NULL) {
|
if (opt == NULL || cb == NULL) {
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
opt->auth_function = cb;
|
opt->auth_function = cb;
|
||||||
opt->auth_userdata = userdata;
|
opt->auth_userdata = userdata;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
Reference in New Issue
Block a user