Skip to content

Commit

Permalink
tls: fix disabled-tls compilation
Browse files Browse the repository at this point in the history
guess these snuck in after my last round of testing.
  • Loading branch information
dormando committed Aug 1, 2024
1 parent c2d2261 commit 8c91ac2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ static void conn_close(conn *c) {

MEMCACHED_CONN_RELEASE(c->sfd);
conn_set_state(c, conn_closed);
if (c->ssl) {
if (c->ssl_enabled) {
ssl_conn_close(c->ssl);
}
close(c->sfd);
Expand Down
4 changes: 2 additions & 2 deletions memcached.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ struct settings {
bool lru_maintainer_thread; /* LRU maintainer background thread */
bool lru_segmented; /* Use split or flat LRU's */
bool slab_reassign; /* Whether or not slab reassignment is allowed */
bool ssl_enabled; /* indicates whether SSL is enabled */
int slab_automove; /* Whether or not to automatically move slabs */
double slab_automove_ratio; /* youngest must be within pct of oldest */
unsigned int slab_automove_window; /* window mover for algorithm */
Expand Down Expand Up @@ -521,7 +522,6 @@ struct settings {
double ext_max_frag; /* ideal maximum page fragmentation */
double slab_automove_freeratio; /* % of memory to hold free as buffer */
bool ext_drop_unread; /* skip unread items during compaction */
bool ssl_enabled; /* indicates whether SSL is enabled */
/* start flushing to extstore after memory below this */
unsigned int ext_global_pool_min;
#endif
Expand Down Expand Up @@ -834,8 +834,8 @@ struct conn {
bool close_after_write; /** flush write then move to close connection */
bool rbuf_malloced; /** read buffer was malloc'ed for ascii mget, needs free() */
bool item_malloced; /** item for conn_nread state is a temporary malloc */
#ifdef TLS
bool ssl_enabled;
#ifdef TLS
void *ssl;
char *ssl_wbuf;
#endif
Expand Down
2 changes: 2 additions & 0 deletions tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ int ssl_init(void) {
* SSL_OP_NO_RENEGOTIATION option in SSL_CTX_set_options.
*/
void ssl_callback(const SSL *s, int where, int ret) {
// useful for debugging.
// fprintf(stderr, "WHERE: %d RET: %d CODE: %s LONG: %s\n", where, ret, SSL_state_string(s), SSL_state_string_long(s));
#ifndef SSL_OP_NO_RENEGOTIATION
SSL* ssl = (SSL*)s;
if (SSL_in_before(ssl)) {
Expand Down
2 changes: 2 additions & 0 deletions tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ void ssl_help(void);
bool ssl_set_verify_mode(int verify);
bool ssl_set_min_version(int version);
const char *ssl_proto_text(int version);
void ssl_help(void);
#else
#define ssl_init(void)
#define ssl_init_conn(c, ssl)
#define ssl_init_settings(void)
#define ssl_conn_close(ssl)
#define ssl_accept(c, sfd, fail) NULL
#define ssl_help()
#endif

#endif

0 comments on commit 8c91ac2

Please sign in to comment.