Be more specific about which detail files we suppress
authorAlan T. DeKok <aland@freeradius.org>
Sun, 6 Dec 2009 12:39:00 +0000 (13:39 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 6 Dec 2009 12:41:04 +0000 (13:41 +0100)
Don't write packets back to the same detail file, but allow them
to be written to different detail files

src/modules/rlm_detail/rlm_detail.c

index 56681fb..fba5e9d 100644 (file)
@@ -26,6 +26,7 @@ RCSID("$Id$")
 #include       <freeradius-devel/radiusd.h>
 #include       <freeradius-devel/modules.h>
 #include       <freeradius-devel/rad_assert.h>
+#include       <freeradius-devel/detail.h>
 
 #include       <sys/stat.h>
 #include       <ctype.h>
@@ -475,7 +476,9 @@ static int do_detail(void *instance, REQUEST *request, RADIUS_PACKET *packet,
  */
 static int detail_accounting(void *instance, REQUEST *request)
 {
-       if (request->listener->type == RAD_LISTEN_DETAIL) {
+       if (request->listener->type == RAD_LISTEN_DETAIL &&
+           strcmp(((struct detail_instance *)instance)->detailfile,
+                  ((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;
        }