aboutsummaryrefslogtreecommitdiff
path: root/libssh/options.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-02 21:37:48 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-02 21:37:48 +0000
commit3b7940d05e573bcccf3b2d69fcab4d6a11cb4c1b (patch)
tree1f1feeadea0aa3d1d2e15215301caaa8b316376e /libssh/options.c
parent2afc8a4f1cf4debd3b7437bc64554a1ab0e45fa9 (diff)
downloadlibssh-3b7940d05e573bcccf3b2d69fcab4d6a11cb4c1b.tar.gz
libssh-3b7940d05e573bcccf3b2d69fcab4d6a11cb4c1b.tar.xz
libssh-3b7940d05e573bcccf3b2d69fcab4d6a11cb4c1b.zip
Improve ssh_options_set_auth_callback().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@370 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r--libssh/options.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libssh/options.c b/libssh/options.c
index 3bbf559..4bc7225 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -800,7 +800,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
int ssh1=0;
#endif
int ssh2=1;
-
+
int saveoptind=optind; /* need to save 'em */
int saveopterr=opterr;
@@ -914,14 +914,28 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
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) {
- if (opt == NULL) {
- return;
+ if (opt == NULL || cb == NULL) {
+ return -1;
}
opt->auth_function = cb;
opt->auth_userdata = userdata;
+
+ return 0;
}
/** @} */