diff options
author | Oliver Stöneberg <oliverst@online.de> | 2011-04-26 16:06:46 -0700 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-05-01 19:43:57 +0200 |
commit | 30bdca07e90f2c28547f095211783588db212fba (patch) | |
tree | 62a7d9459616a6434738e9be5e3760c2d17d86c1 /src/keyfiles.c | |
parent | b4b49cf3f6f7cfd74eb5325bea264863590731a7 (diff) | |
download | libssh-30bdca07e90f2c28547f095211783588db212fba.tar.gz libssh-30bdca07e90f2c28547f095211783588db212fba.tar.xz libssh-30bdca07e90f2c28547f095211783588db212fba.zip |
init: Some initialization fixes.
- Check result of ssh_init() in privatekey_from_base64()
- Moved code from ssh_finalize() to appropriate subroutines
- Only initialize sockets once (caused mismatch of WSAStartup() and
WSACleanup() calls and potential usage of bsd_poll when win_poll
should be used)
Diffstat (limited to 'src/keyfiles.c')
-rw-r--r-- | src/keyfiles.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/keyfiles.c b/src/keyfiles.c index 366baade..a1cd563a 100644 --- a/src/keyfiles.c +++ b/src/keyfiles.c @@ -681,14 +681,15 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename, /* TODO Implement to read both DSA and RSA at once. */ /* needed for openssl initialization */ - ssh_init(); + if (ssh_init() < 0) { + return NULL; + } + ssh_log(session, SSH_LOG_RARE, "Trying to open %s", filename); file = fopen(filename,"r"); if (file == NULL) { ssh_set_error(session, SSH_REQUEST_DENIED, "Error opening %s: %s", filename, strerror(errno)); - return NULL; - } ssh_log(session, SSH_LOG_RARE, "Trying to read %s, passphase=%s, authcb=%s", filename, passphrase ? "true" : "false", |