Skip to content

Commit 10cdf3b

Browse files
authored
Merge pull request #6189 from garlick/issue#6151
add configure time check for zeromq crypto and improve broker error handling at cert creation
2 parents 966cae5 + a252c39 commit 10cdf3b

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

config/x_ac_zeromq.m4

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# N.B oldest in CI are focal=libzmq-4.3.2-2, centos7=zeromq-4.1.4
2+
3+
AC_DEFUN([X_AC_ZEROMQ], [
4+
5+
PKG_CHECK_MODULES([ZMQ], [libzmq >= 4.0.4])
6+
7+
old_CFLAGS=$CFLAGS
8+
CFLAGS="$CFLAGS $ZMQ_CFLAGS"
9+
10+
old_LIBS=$LIBS
11+
LIBS="$LIBS $ZMQ_LIBS"
12+
13+
AC_MSG_CHECKING([whether zeromq has CURVE support])
14+
AC_RUN_IFELSE([
15+
AC_LANG_SOURCE([[
16+
#include <zmq.h>
17+
int main () {
18+
char pub[41];
19+
char sec[41];
20+
if (zmq_curve_keypair (pub, sec) < 0) return 1;
21+
return 0;
22+
}
23+
]])],
24+
[have_zmq_curve_support=yes; AC_MSG_RESULT([yes])],
25+
[AC_MSG_RESULT([no])]
26+
)
27+
28+
CFLAGS=$old_CFLAGS
29+
LIBS=$old_LIBS
30+
31+
AS_IF([test "x$have_zmq_curve_support" != "xyes"],
32+
[AC_MSG_ERROR([zeromq CURVE/libsodium support is required])]
33+
)
34+
]
35+
)

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ AM_CONDITIONAL([ENABLE_PYLINT], [test "x$PYLINT" = "xpylint"])
333333
AX_PROG_LUA([5.1],[5.5])
334334
AX_LUA_HEADERS
335335
AX_LUA_LIBS
336-
# N.B oldest in CI are focal=libzmq-4.3.2-2, centos7=zeromq-4.1.4
337-
PKG_CHECK_MODULES([ZMQ], [libzmq >= 4.0.4])
336+
X_AC_ZEROMQ
338337
X_AC_JANSSON
339338
PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 0.23],
340339
[have_libsystemd=yes], [have_libsystemd=no])

src/broker/overlay.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,8 +2493,10 @@ struct overlay *overlay_create (flux_t *h,
24932493
goto error;
24942494
if (flux_msg_handler_addvec (h, htab, ov, &ov->handlers) < 0)
24952495
goto error;
2496-
if (!(ov->cert = cert_create ()))
2497-
goto nomem;
2496+
if (!(ov->cert = cert_create ())) {
2497+
log_err ("could not create curve certificate");
2498+
goto error;
2499+
}
24982500
if (!(ov->health_requests = flux_msglist_create ())
24992501
|| !(ov->trace_requests = flux_msglist_create ()))
25002502
goto error;

0 commit comments

Comments
 (0)