mosquitto icon indicating copy to clipboard operation
mosquitto copied to clipboard

CA file check breaks compiling Mosquitto version 2.0.21 without TLS support

Open ryanwoodsmall opened this issue 9 months ago • 2 comments

For some embedded Linux devices with very old, slow CPU(s), amounts of RAM that can be counted with fingers and toes, and no/poor encryption library support, I compile Mosquitto without TLS. This appears to have broken between versions 2.0.20 and 2.0.21; the error I'm seeing is:

conf.c: In function 'config__check':
conf.c:2318:40: error: 'struct mosquitto__listener' has no member named 'cafile'
 2318 |    bool cafile = !!config->listeners[i].cafile;
      |                                        ^
conf.c:2319:40: error: 'struct mosquitto__listener' has no member named 'capath'
 2319 |    bool capath = !!config->listeners[i].capath;
      |                                        ^
conf.c:2320:42: error: 'struct mosquitto__listener' has no member named 'certfile'
 2320 |    bool certfile = !!config->listeners[i].certfile;
      |                                          ^
conf.c:2321:41: error: 'struct mosquitto__listener' has no member named 'keyfile'
 2321 |    bool keyfile = !!config->listeners[i].keyfile;
      |                                         ^
make[1]: *** [Makefile:100: conf.o] Error 1
make[1]: Leaving directory '/usr/local/crosware/builds/mosquitto-2.0.21/src'
make: *** [Makefile:66: mosquitto] Error 2

src/conf.c needs an #ifdef WITH_TLS around the /* Check for missing TLS cafile/capath/certfile/keyfile */ block. Quick patch:

  • https://github.com/ryanwoodsmall/crosware-source-mirror/blob/master/mosquitto/mosquitto-2.0.21-no-ca-check-without-tls.patch

I don't sign contributor agreements or signup for accounts or I'd contribute a PR myself. Thanks! -r

ryanwoodsmall avatar Mar 25 '25 18:03 ryanwoodsmall

Yes, indeed - Noticed it as well here. @ralight commit https://github.com/eclipse-mosquitto/mosquitto/commit/87488a27f0e74e65ff095644d292fa457b2c003d forgot to stick the TLS specific logic inside an #ifdef WITH_TLS

jacmet avatar Apr 14 '25 13:04 jacmet

Thanks for this, as well as the fix which is in place I'm also going to see about getting another CI workflow that just exercises the different build configurations.

ralight avatar May 01 '25 12:05 ralight