Skip to content

Commit

Permalink
tls: fix another conn flag leading to crash
Browse files Browse the repository at this point in the history
fixes a second case of a tls related value not getting reset when a
connection structure is being reused.
  • Loading branch information
dormando committed Aug 25, 2024
1 parent 461d873 commit 9c81709
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 3 additions & 0 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,20 @@ conn *conn_new(const int sfd, enum conn_states init_state,

c->item = 0;
c->ssl = NULL;
c->ssl_wbuf = NULL;

c->noreply = false;

if (ssl) {
// musn't get here without ssl enabled.
assert(settings.ssl_enabled);
ssl_init_conn(c, ssl);
c->ssl_enabled = true;
} else {
c->read = tcp_read;
c->sendmsg = tcp_sendmsg;
c->write = tcp_write;
c->ssl_enabled = false;
}

if (IS_UDP(transport)) {
Expand Down
5 changes: 0 additions & 5 deletions tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,7 @@ void ssl_init_conn(conn *c, void *ssl_in) {
c->read = ssl_read;
c->sendmsg = ssl_sendmsg;
c->write = ssl_write;
c->ssl_enabled = true;
SSL_set_info_callback(c->ssl, ssl_callback);
} else {
c->ssl = NULL;
c->ssl_wbuf = NULL;
c->ssl_enabled = false;
}
}

Expand Down

0 comments on commit 9c81709

Please sign in to comment.