Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
2020f6f3
Unverified
Commit
2020f6f3
authored
Aug 27, 2019
by
Mark Nunberg
Committed by
GitHub
Aug 27, 2019
Browse files
Merge pull request #702 from yossigo/report-connect-errors
SSL: Properly report SSL_connect() errors.
parents
ff4fa454
aacd4ccd
Changes
1
Hide whitespace changes
Inline
Side-by-side
sslio.c
View file @
2020f6f3
...
...
@@ -5,6 +5,9 @@
#ifdef HIREDIS_SSL
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <openssl/err.h>
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
char
*
str
);
...
...
@@ -147,6 +150,7 @@ int redisSslCreate(redisContext *c, const char *capath, const char *certpath,
SSL_set_connect_state
(
s
->
ssl
);
c
->
flags
|=
REDIS_SSL
;
ERR_clear_error
();
int
rv
=
SSL_connect
(
c
->
ssl
->
ssl
);
if
(
rv
==
1
)
{
return
REDIS_OK
;
...
...
@@ -159,7 +163,15 @@ int redisSslCreate(redisContext *c, const char *capath, const char *certpath,
}
if
(
c
->
err
==
0
)
{
__redisSetError
(
c
,
REDIS_ERR_IO
,
"SSL_connect() failed"
);
char
err
[
512
];
if
(
rv
==
SSL_ERROR_SYSCALL
)
snprintf
(
err
,
sizeof
(
err
)
-
1
,
"SSL_connect failed: %s"
,
strerror
(
errno
));
else
{
unsigned
long
e
=
ERR_peek_last_error
();
snprintf
(
err
,
sizeof
(
err
)
-
1
,
"SSL_connect failed: %s"
,
ERR_reason_error_string
(
e
));
}
__redisSetError
(
c
,
REDIS_ERR_IO
,
err
);
}
return
REDIS_ERR
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment