]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
always write to the detail file
authorAlan T. DeKok <aland@freeradius.org>
Mon, 25 Sep 2017 14:38:17 +0000 (10:38 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 25 Sep 2017 14:39:36 +0000 (10:39 -0400)
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

src/modules/rlm_detail/rlm_detail.c

index 3692cc2b410505a80fea600c277751bb9245b87b..ba6b01e0cfd402113f73aedf2a77f1850fa4fae0 100644 (file)
@@ -29,17 +29,12 @@ RCSID("$Id$")
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/modules.h>
 #include <freeradius-devel/rad_assert.h>
-#include <freeradius-devel/detail.h>
 #include <freeradius-devel/exfile.h>
 
 #include <ctype.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_FNMATCH_H
-#  include <fnmatch.h>
-#endif
-
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #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);
 }