removed the old dynamic log code. It's no longer needed, as the
authoraland <aland>
Wed, 18 Oct 2000 14:54:59 +0000 (14:54 +0000)
committeraland <aland>
Wed, 18 Oct 2000 14:54:59 +0000 (14:54 +0000)
new rlm_detail does it better.

Updated include files, to remove un-needed ones.

src/modules/rlm_files/rlm_files.c
src/modules/rlm_files/rlm_files_log.cfg [deleted file]

index 57e5065..bfd2bdd 100644 (file)
@@ -10,30 +10,23 @@ static const char rcsid[] = "$Id$";
 
 #include       "autoconf.h"
 
-#include       <sys/types.h>
+#include       "radiusd.h"
+
 #include       <sys/socket.h>
-#include       <sys/time.h>
 #include       <sys/stat.h>
 #include       <netinet/in.h>
 
-#include       <stdio.h>
 #include       <stdlib.h>
 #include       <string.h>
-#include       <errno.h>
 #include       <netdb.h>
-#include       <pwd.h>
-#include       <grp.h>
-#include       <time.h>
 #include       <ctype.h>
 #include       <fcntl.h>
-#include       <unistd.h>
 #include        <limits.h>
 
 #if HAVE_MALLOC_H
 #  include     <malloc.h>
 #endif
 
-#include       "radiusd.h"
 #include       "modules.h"
 
 #ifdef WITH_DBM
@@ -160,93 +153,10 @@ static int fallthrough(VALUE_PAIR *vp)
        return tmp ? tmp->lvalue : 0;
 }
 
-/*
- *  USE_DYNAMIC LOGS is set to FALSE, as this code should be rewritten.
- */
-#define USER_DYNAMIC_LOGS 0
-
-#if USE_DYNAMIC_LOGS
-#define DL_FLAG_START    1
-#define DL_FLAG_STOP     2
-#define DL_FLAG_ACCT_ON   4
-#define DL_FLAG_ACCT_OFF  8
-#define DL_FLAG_ALIVE   16
-
-typedef struct dyn_log {
-       char dir[256];
-       char fname[256];
-       char fmt[1024];
-       char mode[5];
-       int flags;
-} DYN_LOG;
-#define MAX_LOGS 20
-static DYN_LOG logcfg[MAX_LOGS];
-static int logcnt;
-
-/*
- * Initialize dynamic logging
- */
-static void file_getline(FILE *f,char * buff,int len)
-{
-       char tmp[2048];
-       int i;
-
-       tmp[0] = '\0';
-       while (!feof(f)) {
-               fgets(tmp,len,f);
-               if (tmp[0] != '#') {
-                       break;
-               }
-       }
-       i = 0;
-       while (tmp[i] != '\n') {
-               *buff = tmp[i];
-               buff++;
-               i++;
-       }
-}
-
-static void file_dynamic_log_init(void)
-{
-       FILE * f;
-       char fn[1024];
-
-       sprintf(fn,"%s/%s",radius_dir,"rlm_files_log.cfg");
-       logcnt = 0;
-       f = fopen(fn, "r");
-       if (f != NULL) {
-               log_debug("Loading %s",fn);
-               while (logcnt < MAX_LOGS) {
-                       file_getline(f,logcfg[logcnt].dir,sizeof(logcfg[logcnt].dir));
-                       file_getline(f,logcfg[logcnt].fname,sizeof(logcfg[logcnt].fname));
-                       file_getline(f,logcfg[logcnt].fmt,sizeof(logcfg[logcnt].fmt));
-                       file_getline(f,logcfg[logcnt].mode,sizeof(logcfg[logcnt].mode));
-                       file_getline(f,fn,sizeof(fn));
-                       logcfg[logcnt].flags = atoi(fn);
-                       if ((logcfg[logcnt].flags != 0) &&
-                           (strlen(logcfg[logcnt].mode) != 0)) {
-                               logcnt++;
-                       } else {
-                               break;
-                       }
-               }
-               log_debug("%d logs configured",logcnt);
-               fclose(f);
-       } else {
-               log_debug("Error loading %s: %s",fn, strerror(errno));
-       }
-
-
-}
-#endif
 
 
 static int file_init(void)
 {
-#if USE_DYNAMIC_LOGS
-       file_dynamic_log_init();
-#endif
-
        return 0;
 }
 
@@ -701,64 +611,6 @@ static int file_authenticate(void *instance, REQUEST *request)
        return RLM_MODULE_OK;
 }
 
-#if USE_DYNAMIC_LOGS
-/*
- * Write the dynamic log files
- */
-static void file_write_dynamic_log(REQUEST * request)
-{
-       char fn[1024];
-       char buffer[4096];
-       int x,y;
-       VALUE_PAIR * pair;
-       FILE * f;
-
-       pair = pairfind(request->packet->vps,PW_ACCT_STATUS_TYPE);
-       for (x = 0; x < logcnt; x++) {
-               if (((pair->lvalue == PW_STATUS_START) && (logcfg[x].flags & DL_FLAG_START)) ||
-                   ((pair->lvalue == PW_STATUS_STOP) && (logcfg[x].flags & DL_FLAG_STOP)) ||
-                   ((pair->lvalue == PW_STATUS_ACCOUNTING_ON) && (logcfg[x].flags & DL_FLAG_ACCT_ON)) ||
-                   ((pair->lvalue == PW_STATUS_ACCOUNTING_OFF) && (logcfg[x].flags & DL_FLAG_ACCT_OFF)) ||
-                   ((pair->lvalue == PW_STATUS_ALIVE) && (logcfg[x].flags & DL_FLAG_ALIVE))) {
-                       y = radius_xlat2(fn,sizeof(fn),logcfg[x].dir,request,request->packet->vps);
-                       (void) mkdir(fn, 0755);
-                       strcat(fn,"/");
-                       y++;
-                       /* FIXME must get the reply packet */
-                       radius_xlat2(&fn[y],sizeof(fn)-y,logcfg[x].fname,request,request->packet->vps);
-                       if (strcasecmp(logcfg[x].mode,"d") == 0) {
-                               remove(fn);
-                       } else {
-                               if (fn[y] == '|') {
-                                       f = popen(&fn[y+1],logcfg[x].mode);
-                               } else {
-                                       /* FIXME: permissions? */
-                                       f = fopen(fn,logcfg[x].mode);
-                               }
-                               if (f) {
-                                       /* FIXME must get the reply packet */
-                                       radius_xlat2(buffer,sizeof(buffer),logcfg[x].fmt,request,request->packet->vps);
-                                       fprintf(f,"%s\n",buffer);
-                                       if (fn[y] == '|') {
-                                               pclose(f);
-                                       } else {
-                                               fclose(f);
-                                       }
-                               } else {
-                                       if (fn[y] == '|') {
-                                               log_debug("Error opening pipe %s",fn[y+1]);
-                                       } else {
-                                               log_debug("Error opening log %s",fn);
-                                       }
-                               }
-                       }
-               }
-
-
-       }
-}
-#endif /* USE_DYNAMIC_LOGS */
-
 /*
  *     Pre-Accounting - read the acct_users file for check_items and
  *     config_items. Reply items are Not Recommended(TM) in acct_users,
diff --git a/src/modules/rlm_files/rlm_files_log.cfg b/src/modules/rlm_files/rlm_files_log.cfg
deleted file mode 100644 (file)
index a8eb06c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# This is a sample dynamic_log configuration file for FreeRADIUS
-# You can have 10 different dynamic logs configured.
-# The lines beginning with '#' are comments
-# Each log must have 7 config lines :
-#    1. Directory to store log file
-#    2. Filename for start logfile
-#    3. format of start logfile
-#    4. open mode for start logfile or 'd' to delete file
-#    5. flags - integer bitmask representing when to use this log definition
-#               1 - Start
-#               2 - Stop
-#               4 - Accounting On
-#               8 - Accounting Off
-#              16 - Alive
-#
-# Sample Log 1 (Standard FreeRADIUS detail, splited by day)
-%A/%C
-detail.%D
-%I%Z\tTimestamp = %l\n\tRequest-Authenticator = %V\n
-a
-3
-# Sample Log 2 :
-# At Start and Stop generate separated files
-# I use this, and have an external routine to get extra data from RAS using
-# SNMP and add to this file before loading data in database
-%A/%C/split
-${Acct-Status-Type}.${NAS-Identifier}.${Acct-Session-Id}.${User-Name}
-"%T","${NAS-Identifier}","${Acct-Session-Id}",${NAS-Port-Id},"${User-Name}","${Called-Station-Id}","${Calling-Station-Id}"
-a
-3
-# Sample log 3/4 :
-# At Start create a file with IP address and put user-name inside
-# At Logout delete the file
-# To use this your RAS server must send the IP address in start packet
-%A
-${Framed-IP-Address}
-${User-Name}
-w
-1
-%A
-${Framed-IP-Address}
-.
-d
-2
-# Sample log 5
-%A
-|p.cmd
-${User-Name} ${Framed-IP-Address}\n${NAS-Identifier} ${NAS-Port-Id}
-w
-3