From 546b6b46abf8399aa9721bb28f4e4f96dc7ded1b Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Feb 07 2019 14:01:31 +0000 Subject: Compile IPA modules with C11 extensions - define __STDC_WANT_LIB_EXT1__ to get C11 extensions like memset_s() for Samba's ZERO_STRUCT() macro, see https://en.cppreference.com/w/c/string/byte/memset - _DEFAULT_SOURCE enables features like htole16() from endian.h, see http://man7.org/linux/man-pages/man3/endian.3.html - _POSIX_C_SOURCE >= 200809 enables features like strndup() from string.h, see http://man7.org/linux/man-pages/man3/strndup.3.html - time_t is no longer implicitly defined, include time.h - typeof() is only available as GNU extension. Use explicit types instead of generic __typeof__(). Fixes: https://pagure.io/freeipa/issue/7858 Signed-off-by: Christian Heimes Reviewed-By: Alexander Bokovoy --- diff --git a/configure.ac b/configure.ac index 672f5f2..6ada16a 100644 --- a/configure.ac +++ b/configure.ac @@ -18,15 +18,21 @@ AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign 1.9 tar-pax]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) +dnl enable C11 extensions for features like memset_s() +CFLAGS+=" -D__STDC_WANT_LIB_EXT1__=1" +dnl enable features like htole16() +CFLAGS+=" -D_DEFAULT_SOURCE=1" +dnl Enable features like strndup() +CFLAGS+=" -D_POSIX_C_SOURCE=200809L" +dnl fail hard when includes statements are missing +CFLAGS+=" -Werror=implicit-function-declaration" + AC_PROG_CC_C99 AC_DISABLE_STATIC LT_INIT AC_HEADER_STDC -dnl fail hard when includes statements are missing -CFLAGS+=" -Werror=implicit-function-declaration" - PKG_PROG_PKG_CONFIG AC_ARG_ENABLE([server], diff --git a/daemons/ipa-slapi-plugins/libotp/otp_config.c b/daemons/ipa-slapi-plugins/libotp/otp_config.c index 685b2d9..949b913 100644 --- a/daemons/ipa-slapi-plugins/libotp/otp_config.c +++ b/daemons/ipa-slapi-plugins/libotp/otp_config.c @@ -217,7 +217,7 @@ struct otp_config *otp_config_init(Slapi_ComponentId *plugin_id) void *node = NULL; int search_result = 0; - cfg = (typeof(cfg)) slapi_ch_calloc(1, sizeof(*cfg)); + cfg = (struct otp_config *) slapi_ch_calloc(1, sizeof(*cfg)); cfg->plugin_id = plugin_id; /* Build the config table. */ @@ -229,7 +229,7 @@ struct otp_config *otp_config_init(Slapi_ComponentId *plugin_id) struct record *rec; /* Create the config entry. */ - rec = (typeof(rec)) slapi_ch_calloc(1, sizeof(*rec)); + rec = (struct record *) slapi_ch_calloc(1, sizeof(*rec)); rec->spec = specs[i]; rec->sdn = make_sdn(rec->spec->prefix, sfx); diff --git a/util/ipa_krb5.h b/util/ipa_krb5.h index 60a8ced..f64b39c 100644 --- a/util/ipa_krb5.h +++ b/util/ipa_krb5.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include