libyubikey-dev
- sudo apt-get install -qq -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" libmysqlclient-dev
before_script:
- - CFLAGS="${BUILD_CFLAGS}" ./configure -C --enable-werror --prefix=$HOME/freeradius --with-shared-libs=$LIBS_SHARED --with-threads=$LIBS_OPTIONAL --with-udpfromto=$LIBS_OPTIONAL --with-openssl=$LIBS_OPTIONAL
+ - CFLAGS="${BUILD_CFLAGS}" ./configure -C --enable-werror --prefix=$HOME/freeradius --with-shared-libs=$LIBS_SHARED --with-threads=$LIBS_OPTIONAL --with-udpfromto=$LIBS_OPTIONAL --with-openssl=$LIBS_OPTIONAL --with-regex=$LIBS_OPTIONAL
- make
script: if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make travis-test; fi
with_execinfo_include_dir
with_pcre_lib_dir
with_pcre_include_dir
+with_regex
'
ac_precious_vars='build_alias
host_alias
--with-pcre-lib-dir=DIR directory in which to look for pcre library files
--with-pcre-include-dir=DIR
directory in which to look for pcre include files
+ --with-regex Whether to build with regular expressions
+ (default=yes)
Some influential environment variables:
CC C compiler command
fi
-REGEX=no
-smart_try_dir=$pcre_include_dir
+REGEX=
+
+# Check whether --with-regex was given.
+if test "${with_regex+set}" = set; then :
+ withval=$with_regex; case "$withval" in
+ no)
+ REGEX=no
+ ;;
+ *)
+ ;;
+ esac
+
+fi
+
+
+if test "x$REGEX" = "x"; then
+ smart_try_dir=$pcre_include_dir
ac_safe=`echo "pcreposix.h" | sed 'y%./+-%__pm%'`
smart_prefix=
-if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
- smart_try_dir=$pcre_lib_dir
+ if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
+ smart_try_dir=$pcre_lib_dir
sm_lib_safe=`echo "pcre" | sed 'y%./+-%__p_%'`
SMART_LIBS="$smart_ldflags $smart_lib $SMART_LIBS"
fi
- if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
- REGEX=yes
+ if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
+ REGEX=yes
- smart_try_dir=$pcre_lib_dir
+ smart_try_dir=$pcre_lib_dir
$as_echo "#define HAVE_PCRE 1" >>confdefs.h
- LIBS=$(echo "$LIBS" | sed -e 's/-lpcre/-lpcre -lpcreposix/')
+ LIBS=$(echo "$LIBS" | sed -e 's/-lpcre/-lpcre -lpcreposix/')
+ fi
fi
fi
-if test "x$REGEX" != "xyes"; then
+
+if test "x$REGEX" = "x"; then
smart_try_dir=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- REGEX_EXTENDED=yes
$as_echo "#define HAVE_REG_EXTENDED 1" >>confdefs.h
esac ]
)
-dnl extra argument: --with-pcre-include--dir
+dnl extra argument: --with-pcre-include-dir
pcre_include_dir=
AC_ARG_WITH(pcre-include-dir,
[AS_HELP_STRING([--with-pcre-include-dir=DIR],
esac ]
)
-REGEX=no
+dnl extra argument: --with-regex
+REGEX=
+AC_ARG_WITH(regex,
+[AS_HELP_STRING([--with-regex],
+[Whether to build with regular expressions (default=yes)])],
+[ case "$withval" in
+ no)
+ REGEX=no
+ ;;
+ *)
+ ;;
+ esac ]
+)
+
dnl #
dnl # First look for PCRE
dnl #
-smart_try_dir=$pcre_include_dir
-FR_SMART_CHECK_INCLUDE(pcreposix.h)
-if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
- smart_try_dir=$pcre_lib_dir
- FR_SMART_CHECK_LIB(pcre, pcre_compile)
- if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
- REGEX=yes
-
+if test "x$REGEX" = "x"; then
+ smart_try_dir=$pcre_include_dir
+ FR_SMART_CHECK_INCLUDE(pcreposix.h)
+ if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
smart_try_dir=$pcre_lib_dir
- AC_DEFINE(HAVE_PCRE, [1], [define this if we have libpcre])
-
- dnl #
- dnl # Hack to get -L<path> and -lpcreposix at the start
- dnl # of the linker arguments.
- dnl #
- LIBS=$(echo "$LIBS" | sed -e 's/-lpcre/-lpcre -lpcreposix/')
+ FR_SMART_CHECK_LIB(pcre, pcre_compile)
+ if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
+ REGEX=yes
+
+ smart_try_dir=$pcre_lib_dir
+ AC_DEFINE(HAVE_PCRE, [1], [define this if we have libpcre])
+
+ dnl #
+ dnl # Hack to get -L<path> and -lpcreposix at the start
+ dnl # of the linker arguments.
+ dnl #
+ LIBS=$(echo "$LIBS" | sed -e 's/-lpcre/-lpcre -lpcreposix/')
+ fi
fi
fi
+
dnl #
dnl # If no PCRE, fallback to POSIX regular expressions
dnl #
-if test "x$REGEX" != "xyes"; then
+if test "x$REGEX" = "x"; then
smart_try_dir=
FR_SMART_CHECK_INCLUDE(regex.h)
if test "x$ac_cv_header_regex_h" = "xyes"; then
],
[
AC_MSG_RESULT(yes)
- REGEX_EXTENDED=yes
AC_DEFINE(HAVE_REG_EXTENDED, [1], [define this if we have REG_EXTENDED (from <regex.h>)])
],
[
int rad_expand_xlat(REQUEST *request, char const *cmd,
int max_argc, char *argv[], bool can_fail,
size_t argv_buflen, char *argv_buf);
+#ifdef HAVE_REGEX
void rad_regcapture(REQUEST *request, int compare, char const *value,
regmatch_t rxmatch[]);
+#endif
+
void verify_request(char const *file, int line, REQUEST *request); /* only for special debug builds */
#ifdef HAVE_GRP_H
bool fr_getgid(char const *name, gid_t *gid);
size_t length; //!< of the vpd data
} literal;
xlat_exp_t *xlat; //!< pre-parsed xlat_exp_t
+#ifdef HAVE_REGEX
struct {
regex_t *comp; //!< pre-parsed regex_t
bool iflag; //!< Case insensitive
} preg;
+#endif
} data;
} value_pair_tmpl_t;
#define tmpl_xlat data.xlat
-#define tmpl_preg data.preg.comp
-#define tmpl_iflag data.preg.iflag
+#ifdef HAVE_REGEX
+# define tmpl_preg data.preg.comp
+# define tmpl_iflag data.preg.iflag
+#endif
#define tmpl_value data.literal.value
#define tmpl_length data.literal.length
case T_OP_REG_EQ: /* =~ */
case T_OP_REG_NE: /* !~ */
{
-
- int compare;
- regex_t reg;
#ifndef WITH_REGEX
fr_strerror_printf("Regular expressions are not supported");
return NULL;
-
#else
+ int compare;
+ regex_t reg;
/*
* Someone else will fill in the value.
}
c->data.map = map_from_str(c, lhs, lhs_type, op, rhs, rhs_type,
- REQUEST_CURRENT, PAIR_LIST_REQUEST,
- REQUEST_CURRENT, PAIR_LIST_REQUEST);
+ REQUEST_CURRENT, PAIR_LIST_REQUEST,
+ REQUEST_CURRENT, PAIR_LIST_REQUEST);
if (!c->data.map) {
/*
* If strings are T_BARE_WORD and they start with '&',
}
if (c->data.map->src->type == TMPL_TYPE_REGEX) {
+#ifdef HAVE_REGEX
c->data.map->src->tmpl_iflag = i_flag;
+#else
+ return_0("Server was built without support for regular expressions");
+#endif
}
/*
return 0;
}
-
+#ifdef HAVE_REGEX
int realm_realm_add(REALM *r, CONF_SECTION *cs)
+#else
+int realm_realm_add(REALM *r, UNUSED CONF_SECTION *cs)
+#endif
{
/*
* The structs aren't mutex protected. Refuse to destroy
return argc;
}
+#ifdef HAVE_REGEX
/** Adds subcapture values to request data
*
* Allows use of %{n} expansions.
request_data_add(request, request, REQUEST_DATA_REGEX | i, p, true);
}
}
+#endif
#ifndef NDEBUG
/*
* @return 0 if check and vp are equal, -1 if vp value is less than check value, 1 is vp value is more than check
* value, -2 on error.
*/
+#ifdef HAVE_REGEX
int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
+#else
+int radius_compare_vps(UNUSED REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
+#endif
{
int ret = 0;
#ifdef HAVE_PCRE
DEBUG3(" regex-pcre");
#else
-#ifdef HAVE_REGEX
+# ifdef HAVE_REGEX
+# ifdef HAVE_REG_EXTENDED
+ DEBUG3(" regex-posix-extended");
+# else
DEBUG3(" regex-posix");
-#endif
+# endif
+# endif
#endif
#ifdef WITH_SESSION_MGMT