All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rlm_detail.c
Go to the documentation of this file.
1 /*
2  * This program is is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or (at
5  * your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 
17 /**
18  * $Id: 0ccc8ea28de11438798089e91da51dcd85587257 $
19  * @file rlm_detail.c
20  * @brief Write plaintext versions of packets to flatfiles.
21  *
22  * @copyright 2000,2006 The FreeRADIUS server project
23  */
24 RCSID("$Id: 0ccc8ea28de11438798089e91da51dcd85587257 $")
25 
26 #include <freeradius-devel/radiusd.h>
27 #include <freeradius-devel/modules.h>
28 #include <freeradius-devel/rad_assert.h>
29 #include <freeradius-devel/detail.h>
30 #include <freeradius-devel/exfile.h>
31 
32 #include <ctype.h>
33 #include <fcntl.h>
34 #include <sys/stat.h>
35 
36 #ifdef HAVE_FNMATCH_H
37 # include <fnmatch.h>
38 #endif
39 
40 #ifdef HAVE_UNISTD_H
41 # include <unistd.h>
42 #endif
43 
44 #ifdef HAVE_GRP_H
45 # include <grp.h>
46 #endif
47 
48 #define DIRLEN 8192 //!< Maximum path length.
49 
50 /** Instance configuration for rlm_detail
51  *
52  * Holds the configuration and preparsed data for a instance of rlm_detail.
53  */
54 typedef struct detail_instance {
55  char const *name; //!< Instance name.
56  char const *filename; //!< File/path to write to.
57  uint32_t perm; //!< Permissions to use for new files.
58  char const *group; //!< Group to use for new files.
59 
60  char const *header; //!< Header format.
61  bool locking; //!< Whether the file should be locked.
62 
63  bool log_srcdst; //!< Add IP src/dst attributes to entries.
64 
65  bool escape; //!< do filename escaping, yes / no
66 
67  xlat_escape_t escape_func; //!< escape function
68 
69  exfile_t *ef; //!< Log file handler
70 
71  fr_hash_table_t *ht; //!< Holds suppressed attributes.
72 } rlm_detail_t;
73 
74 static const CONF_PARSER module_config[] = {
75  { FR_CONF_OFFSET("filename", PW_TYPE_FILE_OUTPUT | PW_TYPE_REQUIRED | PW_TYPE_XLAT, rlm_detail_t, filename), .dflt = "%A/%{Client-IP-Address}/detail" },
76  { FR_CONF_OFFSET("header", PW_TYPE_STRING | PW_TYPE_XLAT, rlm_detail_t, header), .dflt = "%t" },
77  { FR_CONF_OFFSET("permissions", PW_TYPE_INTEGER, rlm_detail_t, perm), .dflt = "0600" },
78  { FR_CONF_OFFSET("group", PW_TYPE_STRING, rlm_detail_t, group) },
79  { FR_CONF_OFFSET("locking", PW_TYPE_BOOLEAN, rlm_detail_t, locking), .dflt = "no" },
80  { FR_CONF_OFFSET("escape_filenames", PW_TYPE_BOOLEAN, rlm_detail_t, escape), .dflt = "no" },
81  { FR_CONF_OFFSET("log_packet_header", PW_TYPE_BOOLEAN, rlm_detail_t, log_srcdst), .dflt = "no" },
83 };
84 
85 
86 /*
87  * Clean up.
88  */
89 static int mod_detach(void *instance)
90 {
91  rlm_detail_t *inst = instance;
92  if (inst->ht) fr_hash_table_free(inst->ht);
93  return 0;
94 }
95 
96 
97 static uint32_t detail_hash(void const *data)
98 {
99  fr_dict_attr_t const *da = data;
100  return fr_hash(&da, sizeof(da));
101 }
102 
103 static int detail_cmp(void const *a, void const *b)
104 {
105  fr_dict_attr_t const *one = a;
106  fr_dict_attr_t const *two = b;
107 
108  return one - two;
109 }
110 
111 /*
112  * (Re-)read radiusd.conf into memory.
113  */
114 static int mod_instantiate(CONF_SECTION *conf, void *instance)
115 {
116  rlm_detail_t *inst = instance;
117  CONF_SECTION *cs;
118 
119  inst->name = cf_section_name2(conf);
120  if (!inst->name) {
121  inst->name = cf_section_name1(conf);
122  }
123 
124  /*
125  * Escape filenames only if asked.
126  */
127  if (inst->escape) {
129  } else {
131  }
132 
133  inst->ef = exfile_init(inst, 64, 30, inst->locking);
134  if (!inst->ef) {
135  cf_log_err_cs(conf, "Failed creating log file context");
136  return -1;
137  }
138 
139  /*
140  * Suppress certain attributes.
141  */
142  cs = cf_section_sub_find(conf, "suppress");
143  if (cs) {
144  CONF_ITEM *ci;
145 
146  inst->ht = fr_hash_table_create(NULL, detail_hash, detail_cmp, NULL);
147 
148  for (ci = cf_item_find_next(cs, NULL);
149  ci != NULL;
150  ci = cf_item_find_next(cs, ci)) {
151  char const *attr;
152  fr_dict_attr_t const *da;
153 
154  if (!cf_item_is_pair(ci)) continue;
155 
156  attr = cf_pair_attr(cf_item_to_pair(ci));
157  if (!attr) continue; /* pair-anoia */
158 
159  da = fr_dict_attr_by_name(NULL, attr);
160  if (!da) {
161  cf_log_err_cs(conf, "No such attribute '%s'", attr);
162  return -1;
163  }
164 
165  /*
166  * Be kind to minor mistakes.
167  */
168  if (fr_hash_table_finddata(inst->ht, da)) {
169  WARN("rlm_detail (%s): Ignoring duplicate entry '%s'", inst->name, attr);
170  continue;
171  }
172 
173 
174  if (!fr_hash_table_insert(inst->ht, da)) {
175  ERROR("rlm_detail (%s): Failed inserting '%s' into suppression table",
176  inst->name, attr);
177  return -1;
178  }
179 
180  DEBUG("rlm_detail (%s): '%s' suppressed, will not appear in detail output", inst->name, attr);
181  }
182 
183  /*
184  * If we didn't suppress anything, delete the hash table.
185  */
186  if (fr_hash_table_num_elements(inst->ht) == 0) {
187  fr_hash_table_free(inst->ht);
188  inst->ht = NULL;
189  }
190  }
191 
192  return 0;
193 }
194 
195 /*
196  * Wrapper for VPs allocated on the stack.
197  */
198 static void detail_fr_pair_fprint(TALLOC_CTX *ctx, FILE *out, VALUE_PAIR const *stacked)
199 {
200  VALUE_PAIR *vp;
201 
202  vp = talloc(ctx, VALUE_PAIR);
203  if (!vp) return;
204 
205  memcpy(vp, stacked, sizeof(*vp));
206  vp->op = T_OP_EQ;
207  fr_pair_fprint(out, vp);
208  talloc_free(vp);
209 }
210 
211 
212 /** Write a single detail entry to file pointer
213  *
214  * @param[in] out Where to write entry.
215  * @param[in] inst Instance of rlm_detail.
216  * @param[in] request The current request.
217  * @param[in] packet associated with the request (request, reply, proxy-request, proxy-reply...).
218  * @param[in] compat Write out entry in compatibility mode.
219  */
220 static int detail_write(FILE *out, rlm_detail_t *inst, REQUEST *request, RADIUS_PACKET *packet, bool compat)
221 {
222  VALUE_PAIR *vp;
223  char timestamp[256];
224 
225  if (radius_xlat(timestamp, sizeof(timestamp), request, inst->header, NULL, NULL) < 0) {
226  return -1;
227  }
228 
229 #define WRITE(fmt, ...) do {\
230  if (fprintf(out, fmt, ## __VA_ARGS__) < 0) {\
231  RERROR("Failed writing to detail file: %s", fr_syserror(errno));\
232  return -1;\
233  }\
234 } while(0)
235 
236  WRITE("%s\n", timestamp);
237 
238  /*
239  * Write the information to the file.
240  */
241  if (!compat) {
242  /*
243  * Print out names, if they're OK.
244  * Numbers, if not.
245  */
246  if (is_radius_code(packet->code)) {
247  WRITE("\tPacket-Type = %s\n", fr_packet_codes[packet->code]);
248  } else {
249  WRITE("\tPacket-Type = %u\n", packet->code);
250  }
251  }
252 
253  if (inst->log_srcdst) {
254  VALUE_PAIR src_vp, dst_vp;
255 
256  memset(&src_vp, 0, sizeof(src_vp));
257  memset(&dst_vp, 0, sizeof(dst_vp));
258 
259  switch (packet->src_ipaddr.af) {
260  case AF_INET:
261  src_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_SRC_IP_ADDRESS);
262  src_vp.vp_ipaddr = packet->src_ipaddr.ipaddr.ip4addr.s_addr;
263 
264  dst_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_DST_IP_ADDRESS);
265  dst_vp.vp_ipaddr = packet->dst_ipaddr.ipaddr.ip4addr.s_addr;
266  break;
267 
268  case AF_INET6:
269  src_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_SRC_IPV6_ADDRESS);
270  memcpy(&src_vp.vp_ipv6addr, &packet->src_ipaddr.ipaddr.ip6addr,
271  sizeof(packet->src_ipaddr.ipaddr.ip6addr));
272  dst_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_DST_IPV6_ADDRESS);
273  memcpy(&dst_vp.vp_ipv6addr, &packet->dst_ipaddr.ipaddr.ip6addr,
274  sizeof(packet->dst_ipaddr.ipaddr.ip6addr));
275  break;
276 
277  default:
278  break;
279  }
280 
281  detail_fr_pair_fprint(request, out, &src_vp);
282  detail_fr_pair_fprint(request, out, &dst_vp);
283 
284  src_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_SRC_PORT);
285  src_vp.vp_integer = packet->src_port;
286  dst_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_DST_PORT);
287  dst_vp.vp_integer = packet->dst_port;
288 
289  detail_fr_pair_fprint(request, out, &src_vp);
290  detail_fr_pair_fprint(request, out, &dst_vp);
291  }
292 
293  {
294  vp_cursor_t cursor;
295  /* Write each attribute/value to the log file */
296  for (vp = fr_cursor_init(&cursor, &packet->vps);
297  vp;
298  vp = fr_cursor_next(&cursor)) {
299  FR_TOKEN op;
300 
301  if (inst->ht && fr_hash_table_finddata(inst->ht, vp->da)) continue;
302 
303  /*
304  * Don't print passwords in old format...
305  */
306  if (compat && !vp->da->vendor && (vp->da->attr == PW_USER_PASSWORD)) continue;
307 
308  /*
309  * Print all of the attributes, operator should always be '='.
310  */
311  op = vp->op;
312  vp->op = T_OP_EQ;
313  fr_pair_fprint(out, vp);
314  vp->op = op;
315  }
316  }
317 
318  /*
319  * Add non-protocol attributes.
320  */
321  if (compat) {
322 #ifdef WITH_PROXY
323  if (request->proxy) {
324  char proxy_buffer[INET6_ADDRSTRLEN];
325 
326  inet_ntop(request->proxy->dst_ipaddr.af, &request->proxy->dst_ipaddr.ipaddr,
327  proxy_buffer, sizeof(proxy_buffer));
328  WRITE("\tFreeradius-Proxied-To = %s\n", proxy_buffer);
329  }
330 #endif
331  }
332  WRITE("\tTimestamp = %ld\n", (unsigned long) request->timestamp.tv_sec);
333 
334  WRITE("\n");
335 
336  return 0;
337 }
338 
339 /*
340  * Do detail, compatible with old accounting
341  */
342 static rlm_rcode_t CC_HINT(nonnull) detail_do(void *instance, REQUEST *request, RADIUS_PACKET *packet, bool compat)
343 {
344  int outfd;
345  char buffer[DIRLEN];
346 
347  FILE *outfp;
348 
349 #ifdef HAVE_GRP_H
350  gid_t gid;
351  char *endptr;
352 #endif
353 
354  rlm_detail_t *inst = instance;
355 
356  /*
357  * Generate the path for the detail file. Use the same
358  * format, but truncate at the last /. Then feed it
359  * through radius_xlat() to expand the variables.
360  */
361  if (radius_xlat(buffer, sizeof(buffer), request, inst->filename, inst->escape_func, NULL) < 0) {
362  return RLM_MODULE_FAIL;
363  }
364 
365  RDEBUG2("%s expands to %s", inst->filename, buffer);
366 
367 #ifdef WITH_ACCOUNTING
368 #if defined(HAVE_FNMATCH_H) && defined(FNM_FILE_NAME)
369  /*
370  * If we read it from a detail file, and we're about to
371  * write it back to the SAME detail file directory, then
372  * suppress the write. This check prevents an infinite
373  * loop.
374  */
375  if ((request->listener->type == RAD_LISTEN_DETAIL) &&
376  (fnmatch(((listen_detail_t *)request->listener->data)->filename,
377  buffer, FNM_FILE_NAME | FNM_PERIOD ) == 0)) {
378  RWDEBUG2("Suppressing infinite loop");
379  return RLM_MODULE_NOOP;
380  }
381 #endif
382 #endif
383 
384  outfd = exfile_open(inst->ef, buffer, inst->perm, true);
385  if (outfd < 0) {
386  RERROR("Couldn't open file %s: %s", buffer, fr_strerror());
387  return RLM_MODULE_FAIL;
388  }
389 
390  if (inst->group != NULL) {
391  gid = strtol(inst->group, &endptr, 10);
392  if (*endptr != '\0') {
393  if (rad_getgid(request, &gid, inst->group) < 0) {
394  RDEBUG2("Unable to find system group '%s'", inst->group);
395  goto skip_group;
396  }
397  }
398 
399  if (chown(buffer, -1, gid) == -1) {
400  RDEBUG2("Unable to change system group of '%s'", buffer);
401  }
402  }
403 
404 skip_group:
405  /*
406  * Open the output fp for buffering.
407  */
408  if ((outfp = fdopen(outfd, "a")) == NULL) {
409  RERROR("Couldn't open file %s: %s", buffer, fr_syserror(errno));
410  fail:
411  if (outfp) fclose(outfp);
412  exfile_unlock(inst->ef, outfd);
413  return RLM_MODULE_FAIL;
414  }
415 
416  if (detail_write(outfp, inst, request, packet, compat) < 0) goto fail;
417 
418  /*
419  * Flush everything
420  */
421  fclose(outfp);
422  exfile_unlock(inst->ef, outfd); /* do NOT close outfp */
423 
424  /*
425  * And everything is fine.
426  */
427  return RLM_MODULE_OK;
428 }
429 
430 /*
431  * Accounting - write the detail files.
432  */
433 static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *request)
434 {
435 #ifdef WITH_DETAIL
436  if (request->listener->type == RAD_LISTEN_DETAIL &&
437  strcmp(((rlm_detail_t *)instance)->filename,
438  ((listen_detail_t *)request->listener->data)->filename) == 0) {
439  RDEBUG("Suppressing writes to detail file as the request was just read from a detail file");
440  return RLM_MODULE_NOOP;
441  }
442 #endif
443 
444  return detail_do(instance, request, request->packet, true);
445 }
446 
447 /*
448  * Incoming Access Request - write the detail files.
449  */
450 static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *request)
451 {
452  return detail_do(instance, request, request->packet, false);
453 }
454 
455 /*
456  * Outgoing Access-Request Reply - write the detail files.
457  */
458 static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *request)
459 {
460  return detail_do(instance, request, request->reply, false);
461 }
462 
463 #ifdef WITH_COA
464 /*
465  * Incoming CoA - write the detail files.
466  */
467 static rlm_rcode_t CC_HINT(nonnull) mod_recv_coa(void *instance, REQUEST *request)
468 {
469  return detail_do(instance, request, request->packet, false);
470 }
471 
472 /*
473  * Outgoing CoA - write the detail files.
474  */
475 static rlm_rcode_t CC_HINT(nonnull) mod_send_coa(void *instance, REQUEST *request)
476 {
477  return detail_do(instance, request, request->reply, false);
478 }
479 #endif
480 
481 /*
482  * Outgoing Access-Request to home server - write the detail files.
483  */
484 #ifdef WITH_PROXY
485 static rlm_rcode_t CC_HINT(nonnull) mod_pre_proxy(void *instance, REQUEST *request)
486 {
487  if (request->proxy && request->proxy->vps) {
488  return detail_do(instance, request, request->proxy, false);
489  }
490 
491  return RLM_MODULE_NOOP;
492 }
493 
494 
495 /*
496  * Outgoing Access-Request Reply - write the detail files.
497  */
498 static rlm_rcode_t CC_HINT(nonnull) mod_post_proxy(void *instance, REQUEST *request)
499 {
500  if (request->proxy_reply && request->proxy_reply->vps) {
501  return detail_do(instance, request, request->proxy_reply, false);
502  }
503 
504  /*
505  * No reply: we must be doing Post-Proxy-Type = Fail.
506  *
507  * Note that we just call the normal accounting function,
508  * to minimize the amount of code, and to highlight that
509  * it's doing normal accounting.
510  */
511  if (!request->proxy_reply) {
512  rlm_rcode_t rcode;
513 
514  rcode = mod_accounting(instance, request);
515  if (rcode == RLM_MODULE_OK) {
516  request->reply->code = PW_CODE_ACCOUNTING_RESPONSE;
517  }
518  return rcode;
519  }
520 
521  return RLM_MODULE_NOOP;
522 }
523 #endif
524 
525 /* globally exported name */
526 extern module_t rlm_detail;
527 module_t rlm_detail = {
529  .name = "detail",
530  .type = RLM_TYPE_HUP_SAFE,
531  .inst_size = sizeof(rlm_detail_t),
532  .config = module_config,
533  .instantiate = mod_instantiate,
534  .detach = mod_detach,
535  .methods = {
539 #ifdef WITH_PROXY
540  [MOD_PRE_PROXY] = mod_pre_proxy,
541  [MOD_POST_PROXY] = mod_post_proxy,
542 #endif
544 #ifdef WITH_COA
545  [MOD_RECV_COA] = mod_recv_coa,
546  [MOD_SEND_COA] = mod_send_coa
547 #endif
548  },
549 };
550 
5 methods index for preproxy section.
Definition: modules.h:46
char const * filename
File/path to write to.
Definition: rlm_detail.c:56
static int detail_write(FILE *out, rlm_detail_t *inst, REQUEST *request, RADIUS_PACKET *packet, bool compat)
Write a single detail entry to file pointer.
Definition: rlm_detail.c:220
#define RERROR(fmt,...)
Definition: log.h:207
int fr_hash_table_insert(fr_hash_table_t *ht, void const *data)
Definition: hash.c:405
#define DIRLEN
Maximum path length.
Definition: rlm_detail.c:48
Instance configuration for rlm_detail.
Definition: rlm_detail.c:54
void * fr_hash_table_finddata(fr_hash_table_t *ht, void const *data)
Definition: hash.c:496
static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
Write accounting data to Couchbase documents.
The module is OK, continue.
Definition: radiusd.h:91
bool locking
Whether the file should be locked.
Definition: rlm_detail.c:61
xlat_escape_t escape_func
escape function
Definition: rlm_detail.c:67
static rlm_rcode_t mod_post_auth(void *instance, REQUEST *request) CC_HINT(nonnull)
Metadata exported by the module.
Definition: modules.h:134
Dictionary attribute.
Definition: dict.h:77
uint32_t fr_hash(void const *, size_t)
Definition: hash.c:727
char const * fr_packet_codes[FR_MAX_PACKET_CODE]
Definition: radius.c:101
7 methods index for postauth section.
Definition: modules.h:48
fr_ipaddr_t src_ipaddr
Src IP address of packet.
Definition: libradius.h:149
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
size_t rad_filename_escape(UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
Escapes the raw string such that it should be safe to use as part of a file path. ...
Definition: util.c:269
#define RLM_MODULE_INIT
Definition: modules.h:86
VALUE_PAIR * vps
Result of decoding the packet into VALUE_PAIRs.
Definition: libradius.h:162
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
char const * inet_ntop(int af, void const *src, char *dst, size_t cnt)
Definition: missing.c:538
VALUE_PAIR * fr_cursor_init(vp_cursor_t *cursor, VALUE_PAIR *const *node)
Setup a cursor to iterate over attribute pairs.
Definition: cursor.c:60
exfile_t * ef
Log file handler.
Definition: rlm_detail.c:69
static void detail_fr_pair_fprint(TALLOC_CTX *ctx, FILE *out, VALUE_PAIR const *stacked)
Definition: rlm_detail.c:198
char const * group
Group to use for new files.
Definition: rlm_detail.c:58
static int detail_cmp(void const *a, void const *b)
Definition: rlm_detail.c:103
module_t rlm_detail
Definition: rlm_detail.c:527
#define inst
Definition: token.h:46
size_t(* xlat_escape_t)(REQUEST *request, char *out, size_t outlen, char const *in, void *arg)
Definition: xlat.h:36
#define RLM_TYPE_HUP_SAFE
Will be restarted on HUP.
Definition: modules.h:79
uint16_t dst_port
DST Port of packet.
Definition: libradius.h:152
uint16_t src_port
Src port of packet.
Definition: libradius.h:151
fr_ipaddr_t dst_ipaddr
Dst IP address of packet.
Definition: libradius.h:150
void fr_pair_fprint(FILE *, VALUE_PAIR const *vp)
Print one attribute and value to FP.
Definition: pair.c:2232
Defines a CONF_PAIR to C data type mapping.
Definition: conffile.h:267
Abstraction to allow iterating over different configurations of VALUE_PAIRs.
Definition: pair.h:144
static uint32_t detail_hash(void const *data)
Definition: rlm_detail.c:97
char const * header
Header format.
Definition: rlm_detail.c:60
RFC2866 - Accounting-Response.
Definition: radius.h:96
RADIUS_PACKET * proxy
Outgoing request to proxy server.
Definition: radiusd.h:237
int af
Address family.
Definition: inet.h:42
int rad_getgid(TALLOC_CTX *ctx, gid_t *out, char const *name)
Resolve a group name to a GID.
Definition: util.c:1248
#define WRITE(fmt,...)
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
Definition: log.c:238
char const * cf_pair_attr(CONF_PAIR const *pair)
Definition: conffile.c:3497
#define DEBUG(fmt,...)
Definition: log.h:175
int exfile_open(exfile_t *lf, char const *filename, mode_t permissions, bool append)
Open a new log file, or maybe an existing one.
Definition: exfile.c:142
#define PW_TYPE_XLAT
string will be dynamically expanded.
Definition: conffile.h:207
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *item)
Cast a CONF_ITEM to a CONF_PAIR.
Definition: conffile.c:181
unsigned int attr
Attribute number.
Definition: dict.h:79
union fr_ipaddr_t::@1 ipaddr
unsigned int code
Packet code (type).
Definition: libradius.h:155
struct detail_instance rlm_detail_t
Instance configuration for rlm_detail.
3 methods index for accounting section.
Definition: modules.h:44
unsigned int vendor
Vendor that defines this attribute.
Definition: dict.h:78
Stores an attribute, a value and various bits of other data.
Definition: pair.h:112
static int mod_instantiate(CONF_SECTION *conf, void *instance)
Definition: rlm_detail.c:114
static int mod_detach(void *instance)
Definition: rlm_detail.c:89
void void cf_log_err_cs(CONF_SECTION const *cs, char const *fmt,...) CC_HINT(format(printf
size_t rad_filename_make_safe(UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
Ensures that a filename cannot walk up the directory structure.
Definition: util.c:175
bool cf_item_is_pair(CONF_ITEM const *item)
Definition: conffile.c:3928
A truth value.
Definition: radius.h:56
int exfile_unlock(exfile_t *lf, int fd)
Definition: exfile.c:382
bool log_srcdst
Add IP src/dst attributes to entries.
Definition: rlm_detail.c:63
FR_TOKEN op
Operator to use when moving or inserting valuepair into a list.
Definition: pair.h:118
32 Bit unsigned integer.
Definition: radius.h:34
enum rlm_rcodes rlm_rcode_t
Return codes indicating the result of the module call.
ssize_t radius_xlat(char *out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, void *escape_ctx) CC_HINT(nonnull(1
static rs_t * conf
Definition: radsniff.c:46
char const * fr_strerror(void)
Get the last library error.
Definition: log.c:212
#define RWDEBUG2(fmt,...)
Definition: log.h:252
static const CONF_PARSER module_config[]
Definition: rlm_detail.c:74
CONF_SECTION * cf_section_sub_find(CONF_SECTION const *, char const *name)
Find a sub-section in a section.
Definition: conffile.c:3708
void fr_hash_table_free(fr_hash_table_t *ht)
Definition: hash.c:562
char const * cf_section_name1(CONF_SECTION const *cs)
Definition: conffile.c:3592
Module succeeded without doing anything.
Definition: radiusd.h:96
#define RDEBUG2(fmt,...)
Definition: log.h:244
uint8_t data[]
Definition: eap_pwd.h:625
uint64_t magic
Used to validate module struct.
Definition: modules.h:135
Module failed, don't reply.
Definition: radiusd.h:90
#define PW_TYPE_FILE_OUTPUT
File matching value must exist, and must be writeable.
Definition: conffile.h:205
struct timeval timestamp
When we started processing the request.
Definition: radiusd.h:214
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168
VALUE_PAIR * fr_cursor_next(vp_cursor_t *cursor)
Advanced the cursor to the next VALUE_PAIR.
Definition: cursor.c:263
uint32_t perm
Permissions to use for new files.
Definition: rlm_detail.c:57
fr_hash_table_t * fr_hash_table_create(TALLOC_CTX *ctx, fr_hash_table_hash_t hashNode, fr_hash_table_cmp_t cmpNode, fr_hash_table_free_t freeNode)
Definition: hash.c:279
int fr_hash_table_num_elements(fr_hash_table_t *ht)
Definition: hash.c:598
#define WARN(fmt,...)
Definition: log.h:144
bool escape
do filename escaping, yes / no
Definition: rlm_detail.c:65
CONF_ITEM * cf_item_find_next(CONF_SECTION const *section, CONF_ITEM const *item)
Return the next item after a CONF_ITEM.
Definition: conffile.c:3850
6 methods index for postproxy section.
Definition: modules.h:47
2 methods index for preacct section.
Definition: modules.h:43
#define PW_TYPE_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: conffile.h:200
8 methods index for recvcoa section.
Definition: modules.h:50
enum fr_token FR_TOKEN
exfile_t * exfile_init(TALLOC_CTX *ctx, uint32_t entries, uint32_t idle, bool locking)
Initialize a way for multiple threads to log to one or more files.
Definition: exfile.c:100
fr_dict_attr_t const * da
Dictionary attribute defines the attribute.
Definition: pair.h:113
9 methods index for sendcoa section.
Definition: modules.h:51
fr_dict_attr_t const * fr_dict_attr_by_num(fr_dict_t *dict, unsigned int vendor, unsigned int attr)
Lookup a fr_dict_attr_t by its vendor and attribute numbers.
Definition: dict.c:3519
String of printable characters.
Definition: radius.h:33
1 methods index for authorize section.
Definition: modules.h:42
#define RCSID(id)
Definition: build.h:135
char const * name
Instance name.
Definition: rlm_detail.c:55
#define RDEBUG(fmt,...)
Definition: log.h:243
static rlm_rcode_t CC_HINT(nonnull)
Definition: rlm_detail.c:342
#define ERROR(fmt,...)
Definition: log.h:145
#define is_radius_code(_x)
Definition: libradius.h:372
char const * cf_section_name2(CONF_SECTION const *cs)
Definition: conffile.c:3601
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_t *dict, char const *attr)
Locate a fr_dict_attr_t by its name.
Definition: dict.c:3493
fr_hash_table_t * ht
Holds suppressed attributes.
Definition: rlm_detail.c:71