#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>
#define DIRLEN 8192
-static const char *packet_codes[] = {
- "",
- "Access-Request",
- "Access-Accept",
- "Access-Reject",
- "Accounting-Request",
- "Accounting-Response",
- "Accounting-Status",
- "Password-Request",
- "Password-Accept",
- "Password-Reject",
- "Accounting-Message",
- "Access-Challenge"
-};
-
-
struct detail_instance {
/* detail file */
char *detailfile;
* Numbers, if not.
*/
if ((packet->code > 0) &&
- (packet->code <= PW_ACCESS_CHALLENGE)) {
+ (packet->code < FR_MAX_PACKET_CODE)) {
fprintf(outfp, "\tPacket-Type = %s\n",
- packet_codes[packet->code]);
+ fr_packet_codes[packet->code]);
} else {
fprintf(outfp, "\tPacket-Type = %d\n", packet->code);
}
* Add non-protocol attibutes.
*/
if (compat) {
+#ifdef WITH_PROXY
if (request->proxy) {
char proxy_buffer[128];
RDEBUG("Freeradius-Proxied-To = %s",
proxy_buffer);
}
+#endif
fprintf(outfp, "\tTimestamp = %ld\n",
(unsigned long) request->timestamp);
*/
static int detail_accounting(void *instance, REQUEST *request)
{
- if (request->listener->type == RAD_LISTEN_DETAIL) {
+#ifdef WITH_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;
}
+#endif
return do_detail(instance,request,request->packet, TRUE);
}
return do_detail(instance,request,request->reply, FALSE);
}
+#ifdef WITH_COA
+/*
+ * Incoming CoA - write the detail files.
+ */
+static int detail_recv_coa(void *instance, REQUEST *request)
+{
+ return do_detail(instance,request,request->packet, FALSE);
+}
+
+/*
+ * Outgoing CoA - write the detail files.
+ */
+static int detail_send_coa(void *instance, REQUEST *request)
+{
+ return do_detail(instance,request,request->reply, FALSE);
+}
+#endif
/*
* Outgoing Access-Request to home server - write the detail files.
*/
+#ifdef WITH_PROXY
static int detail_pre_proxy(void *instance, REQUEST *request)
{
if (request->proxy &&
return RLM_MODULE_NOOP;
}
+#endif
/* globally exported name */
NULL, /* preaccounting */
detail_accounting, /* accounting */
NULL, /* checksimul */
+#ifdef WITH_PROXY
detail_pre_proxy, /* pre-proxy */
detail_post_proxy, /* post-proxy */
+#else
+ NULL, NULL,
+#endif
detail_postauth /* post-auth */
+#ifdef WITH_COA
+ , detail_recv_coa,
+ detail_send_coa
+#endif
},
};