From: Alan T. DeKok Date: Mon, 25 Sep 2017 14:38:17 +0000 (-0400) Subject: always write to the detail file X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86cac6660cb9bce64bddd8cb63b2369281887ccb;p=thirdparty%2Ffreeradius-server.git always write to the detail file even if we read it from the detail file. This change is necessary to encapsulate the new proto_detail code. We can later add an attribute which passes the filename to rlm_detail, so it can suppress infinite loops --- diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 3692cc2b410..ba6b01e0cfd 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -29,17 +29,12 @@ RCSID("$Id$") #include #include #include -#include #include #include #include #include -#ifdef HAVE_FNMATCH_H -# include -#endif - #ifdef HAVE_UNISTD_H # include #endif @@ -368,23 +363,6 @@ static rlm_rcode_t CC_HINT(nonnull) detail_do(void const *instance, REQUEST *req RDEBUG2("%s expands to %s", inst->filename, buffer); -#ifdef WITH_ACCOUNTING -#if defined(HAVE_FNMATCH_H) && defined(FNM_FILE_NAME) - /* - * If we read it from a detail file, and we're about to - * write it back to the SAME detail file directory, then - * suppress the write. This check prevents an infinite - * loop. - */ - if (request->listener && (request->listener->type == RAD_LISTEN_DETAIL) && - (fnmatch(((listen_detail_t *)request->listener->data)->filename, - buffer, FNM_FILE_NAME | FNM_PERIOD ) == 0)) { - RWDEBUG2("Suppressing infinite loop"); - return RLM_MODULE_NOOP; - } -#endif -#endif - outfd = exfile_open(inst->ef, request, buffer, inst->perm); if (outfd < 0) { RERROR("Couldn't open file %s: %s", buffer, fr_strerror()); @@ -444,15 +422,6 @@ skip_group: */ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *thread, REQUEST *request) { -#ifdef WITH_DETAIL - if (request->listener && (request->listener->type == RAD_LISTEN_DETAIL) && - strcmp(((rlm_detail_t const *)instance)->filename, - ((listen_detail_t *)request->listener->data)->filename) == 0) { - RDEBUG("Suppressing writes to detail file as the request was just read from a detail file"); - return RLM_MODULE_NOOP; - } -#endif - return detail_do(instance, request, request->packet, true); }