Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check for memsetlimit
  • Loading branch information
arr2036 committed Jul 30, 2013
1 parent dbf0989 commit fe4ab18
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
45 changes: 45 additions & 0 deletions configure
Expand Up @@ -8569,6 +8569,51 @@ $as_echo "#define HAVE_THREAD_TLS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for talloc_set_memlimit in -ltalloc" >&5
$as_echo_n "checking for talloc_set_memlimit in -ltalloc... " >&6; }
if ${ac_cv_lib_talloc_talloc_set_memlimit+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltalloc $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char talloc_set_memlimit ();
int
main ()
{
return talloc_set_memlimit ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_talloc_talloc_set_memlimit=yes
else
ac_cv_lib_talloc_talloc_set_memlimit=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_talloc_talloc_set_memlimit" >&5
$as_echo "$ac_cv_lib_talloc_talloc_set_memlimit" >&6; }
if test "x$ac_cv_lib_talloc_talloc_set_memlimit" = xyes; then :
$as_echo "#define HAVE_TALLOC_SET_MEMLIMIT 1 Define to 1 if you have the function talloc_set_memlimit." >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
$as_echo_n "checking for crypt in -lcrypt... " >&6; }
if ${ac_cv_lib_crypt_crypt+:} false; then :
Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Expand Up @@ -1304,6 +1304,16 @@ dnl # 7. Checks for library functions
dnl #
dnl #############################################################

dnl #
dnl # Check for talloc_set_memlimit
dnl # This was only included in version 2.0.8
dnl #
AC_CHECK_LIB(talloc, talloc_set_memlimit,
[
AC_DEFINE(HAVE_TALLOC_SET_MEMLIMIT, 1, [Define to 1 if you have the function talloc_set_memlimit.])
]
)

dnl #
dnl # Check for libcrypt
dnl # We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
Expand Down
5 changes: 5 additions & 0 deletions src/main/radsniff.c
Expand Up @@ -570,7 +570,12 @@ int main(int argc, char *argv[])
exit (1);
}

/*
* We don't really want probes taking down machines
*/
#ifdef HAVE_TALLOC_SET_MEMLIMIT
talloc_set_memlimit(conf, 52428800); /* 50 MB */
#endif

/*
* Get options
Expand Down

0 comments on commit fe4ab18

Please sign in to comment.