]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/mosquitto/0001-websockets.c-unbreak-build-without-TLS.patch
mosquitto: unbreak build with websockets and !libopenssl
[coffee/buildroot.git] / package / mosquitto / 0001-websockets.c-unbreak-build-without-TLS.patch
1 From 4822aa97da80a86033ec6e4a8b2f4ad0911235cf Mon Sep 17 00:00:00 2001
2 From: Peter Korsgaard <peter@korsgaard.com>
3 Date: Sat, 3 Mar 2018 11:04:47 +0100
4 Subject: [PATCH] websockets.c: unbreak build without TLS
5
6 Commit 7943072b1f3b (Fix use_identity_as_username not working on websockets
7 clients) added code which unconditionally accesses mosq-ssl, breaking the
8 build when TLS support is disabled.
9
10 Fix it by guarding this logic inside #ifdef WITH_TLS.
11
12 [Upstream: https://dev.eclipse.org/mhonarc/lists/mosquitto-dev/msg01813.html]
13 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
14 ---
15  src/websockets.c | 4 ++++
16  1 file changed, 4 insertions(+)
17
18 diff --git a/src/websockets.c b/src/websockets.c
19 index d4d7961..a796f0a 100644
20 --- a/src/websockets.c
21 +++ b/src/websockets.c
22 @@ -201,12 +201,14 @@ static int callback_mqtt(struct libwebsocket_context *context,
23                                 mosq->ws_context = context;
24  #endif
25                                 mosq->wsi = wsi;
26 +#ifdef WITH_TLS
27                                 if(in){
28                                         mosq->ssl = (SSL *)in;
29                                         if(!mosq->listener->ssl_ctx){
30                                                 mosq->listener->ssl_ctx = SSL_get_SSL_CTX(mosq->ssl);
31                                         }
32                                 }
33 +#endif
34                                 u->mosq = mosq;
35                         }else{
36                                 return -1;
37 @@ -240,7 +242,9 @@ static int callback_mqtt(struct libwebsocket_context *context,
38                                         mosq->pollfd_index = -1;
39                                 }
40                                 mosq->wsi = NULL;
41 +#ifdef WITH_TLS
42                                 mosq->ssl = NULL;
43 +#endif
44                                 do_disconnect(db, mosq);
45                         }
46                         break;
47 -- 
48 2.11.0
49