diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 9a1c5b76ca..63261bfa6c 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -1041,7 +1041,7 @@ int main(int argc, char *argv[]) { MHD_USE_DEBUG | MHD_USE_DUAL_STACK | MHD_USE_ITC | - MHD_USE_POLL | + MHD_USE_POLL_INTERNAL_THREAD | MHD_USE_THREAD_PER_CONNECTION; if (n > 0) @@ -1053,10 +1053,10 @@ int main(int argc, char *argv[]) { {MHD_OPTION_HTTPS_MEM_KEY, 0, arg_key_pem}; opts[opts_pos++] = (struct MHD_OptionItem) {MHD_OPTION_HTTPS_MEM_CERT, 0, arg_cert_pem}; - flags |= MHD_USE_SSL; + flags |= MHD_USE_TLS; } if (arg_trust_pem) { - assert(flags & MHD_USE_SSL); + assert(flags & MHD_USE_TLS); opts[opts_pos++] = (struct MHD_OptionItem) {MHD_OPTION_HTTPS_MEM_TRUST, 0, arg_trust_pem}; } diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 810206c621..0e051c8ff9 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -644,6 +644,7 @@ static int setup_microhttpd_server(RemoteServer *s, { MHD_OPTION_END}, { MHD_OPTION_END}, { MHD_OPTION_END}, + { MHD_OPTION_END}, { MHD_OPTION_END}}; int opts_pos = 4; int flags = @@ -663,6 +664,15 @@ static int setup_microhttpd_server(RemoteServer *s, if (r < 0) return log_error_errno(r, "Failed to make fd:%d nonblocking: %m", fd); +/* MHD_OPTION_STRICT_FOR_CLIENT is introduced in microhttpd 0.9.54, + * and MHD_USE_PEDANTIC_CHECKS will be deprecated in future. */ +#ifdef MHD_USE_PEDANTIC_CHECKS + opts[opts_pos++] = (struct MHD_OptionItem) + {MHD_OPTION_STRICT_FOR_CLIENT, 1}; +#else + flags |= MHD_USE_PEDANTIC_CHECKS; +#endif + if (key) { assert(cert); @@ -671,7 +681,7 @@ static int setup_microhttpd_server(RemoteServer *s, opts[opts_pos++] = (struct MHD_OptionItem) {MHD_OPTION_HTTPS_MEM_CERT, 0, (char*) cert}; - flags |= MHD_USE_SSL; + flags |= MHD_USE_TLS; if (trust) opts[opts_pos++] = (struct MHD_OptionItem) diff --git a/src/journal-remote/microhttpd-util.h b/src/journal-remote/microhttpd-util.h index 7f88c2cb7d..8112851b16 100644 --- a/src/journal-remote/microhttpd-util.h +++ b/src/journal-remote/microhttpd-util.h @@ -41,6 +41,16 @@ # define MHD_USE_EPOLL MHD_USE_EPOLL_LINUX_ONLY #endif +/* Renamed in µhttpd 0.9.52 */ +#ifndef MHD_USE_SSL +# define MHD_USE_TLS MHD_USE_SSL +#endif + +/* Renamed in µhttpd 0.9.53 */ +#ifndef MHD_USE_POLL_INTERNALLY +# define MHD_USE_POLL_INTERNAL_THREAD MHD_USE_POLL_INTERNALLY +#endif + /* Both the old and new names are defines, check for the new one. */ /* Renamed in µhttpd 0.9.53 */ diff --git a/sysusers.d/systemd-remote.conf.m4 b/sysusers.d/systemd-remote.conf.m4 index 0e9d71cdd0..83b362643f 100644 --- a/sysusers.d/systemd-remote.conf.m4 +++ b/sysusers.d/systemd-remote.conf.m4 @@ -6,7 +6,6 @@ # (at your option) any later version. m4_ifdef(`HAVE_MICROHTTPD', -u systemd-journal-gateway - "systemd Journal Gateway" u systemd-journal-remote - "systemd Journal Remote" )m4_dnl m4_ifdef(`HAVE_LIBCURL', diff --git a/units/systemd-journal-gatewayd.service.in b/units/systemd-journal-gatewayd.service.in index 99099967e7..42da3504b8 100644 --- a/units/systemd-journal-gatewayd.service.in +++ b/units/systemd-journal-gatewayd.service.in @@ -15,6 +15,7 @@ ExecStart=@rootlibexecdir@/systemd-journal-gatewayd User=systemd-journal-gateway Group=systemd-journal-gateway SupplementaryGroups=systemd-journal +DynamicUser=yes PrivateTmp=yes PrivateDevices=yes PrivateNetwork=yes