diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-03 07:47:50 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-03 07:47:50 +0000 |
commit | 4db7fc77ff1fd2768bec59892098007821f5802d (patch) | |
tree | 1347b20451c4733de5721a5958d43a4eefa34b31 /libssh/options.c | |
parent | 3b7940d05e573bcccf3b2d69fcab4d6a11cb4c1b (diff) | |
download | libssh-4db7fc77ff1fd2768bec59892098007821f5802d.tar.gz libssh-4db7fc77ff1fd2768bec59892098007821f5802d.tar.xz libssh-4db7fc77ff1fd2768bec59892098007821f5802d.zip |
Improve and document ssh_options_set_[dsa,rsa]_server_key().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@371 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/libssh/options.c b/libssh/options.c index 4bc7225..407150e 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -443,17 +443,48 @@ int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity){ return 0; } -/** \warning I don't remember what these functions are supposed - * to set +/** + * @brief Set the path to the dsa ssh host key. + * + * @param opt The options structure to use. + * + * @param dsakey The path to the dsa key to set. + * + * @return 0 on success, < 0 on error. */ -void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey){ - opt->dsakey=strdup(dsakey); +int ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey) { + if (opt == NULL || dsakey == NULL) { + return -1; + } + + opt->dsakey = strdup(dsakey); + if (opt->dsakey == NULL) { + return -1; + } + + return 0; } -/** \warning I don't remember what these functions are supposed - * to set + +/** + * @brief Set the path to the ssh host rsa key. + * + * @param opt The options structure to use. + * + * @param rsakey The path to the rsa key to set. + * + * @return 0 on success, < 0 on error. */ -void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey){ - opt->rsakey=strdup(rsakey); +int ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey) { + if (opt == NULL || rsakey == NULL) { + return -1; + } + + opt->rsakey = strdup(rsakey); + if (opt->rsakey == NULL) { + return -1; + } + + return 0; } /** |