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
19cfd60d
Commit
19cfd60d
authored
Apr 02, 2024
by
michael-grunder
Committed by
Michael Grunder
Apr 03, 2024
Browse files
Only override context read/write funcs on SSL_connect success.
Fixes #1233
parent
2a7b8fac
Changes
1
Show whitespace changes
Inline
Side-by-side
ssl.c
View file @
19cfd60d
...
@@ -364,7 +364,6 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
...
@@ -364,7 +364,6 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
return
REDIS_ERR
;
return
REDIS_ERR
;
}
}
c
->
funcs
=
&
redisContextSSLFuncs
;
rssl
->
ssl
=
ssl
;
rssl
->
ssl
=
ssl
;
SSL_set_mode
(
rssl
->
ssl
,
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
);
SSL_set_mode
(
rssl
->
ssl
,
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
);
...
@@ -372,15 +371,19 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
...
@@ -372,15 +371,19 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
SSL_set_connect_state
(
rssl
->
ssl
);
SSL_set_connect_state
(
rssl
->
ssl
);
ERR_clear_error
();
ERR_clear_error
();
int
rv
=
SSL_connect
(
rssl
->
ssl
);
int
rv
=
SSL_connect
(
rssl
->
ssl
);
if
(
rv
==
1
)
{
if
(
rv
==
1
)
{
c
->
funcs
=
&
redisContextSSLFuncs
;
c
->
privctx
=
rssl
;
c
->
privctx
=
rssl
;
return
REDIS_OK
;
return
REDIS_OK
;
}
}
rv
=
SSL_get_error
(
rssl
->
ssl
,
rv
);
rv
=
SSL_get_error
(
rssl
->
ssl
,
rv
);
if
(((
c
->
flags
&
REDIS_BLOCK
)
==
0
)
&&
if
(((
c
->
flags
&
REDIS_BLOCK
)
==
0
)
&&
(
rv
==
SSL_ERROR_WANT_READ
||
rv
==
SSL_ERROR_WANT_WRITE
))
{
(
rv
==
SSL_ERROR_WANT_READ
||
rv
==
SSL_ERROR_WANT_WRITE
))
{
c
->
funcs
=
&
redisContextSSLFuncs
;
c
->
privctx
=
rssl
;
c
->
privctx
=
rssl
;
return
REDIS_OK
;
return
REDIS_OK
;
}
}
...
...
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