]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Use a boolean instead of a string compare
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 12 May 2010 21:35:35 +0000 (21:35 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 12 May 2010 21:35:35 +0000 (21:35 +0000)
getconf.c
include/conf.h
log.c
realtime.c

index c0d5e0d71e3060b3916deb66b54d6eaf9e52b5a9..85a7e19d8d640090bfcb93bcaec47464a613dd95 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -142,6 +142,12 @@ static struct param_list datetime_values[]=
    {"bytes",DATETIME_BYTE,~DATETIME_BYTE},
 };
 
+static struct param_list realtime_unauth_values[]=
+{
+   {"show",REALTIME_UNAUTH_REC_SHOW,~REALTIME_UNAUTH_REC_SHOW},
+   {"ignore",REALTIME_UNAUTH_REC_IGNORE,~REALTIME_UNAUTH_REC_IGNORE},
+};
+
 static int is_param(const char *param,const char *buf)
 {
    int plen;
@@ -604,7 +610,7 @@ static void parmtest(char *buf)
 
    if (getparam_string("realtime_types",buf,RealtimeTypes,sizeof(RealtimeTypes))>0) return;
 
-   if (getparam_string("realtime_unauthenticated_records",buf,RealtimeUnauthRec,sizeof(RealtimeUnauthRec))>0) return;
+   if (getparam_list("realtime_unauthenticated_records",SET_LIST(realtime_unauth_values),buf,&RealtimeUnauthRec)>0) return;
 
    if (getparam_int("realtime_refresh_time",buf,&realtime_refresh)>0) return;
 
index 9dec56985bde1090e72bf3a07c3792f839268087..eb527463f3afe70e8c77202ed8a1939b8e7d9f3d 100755 (executable)
@@ -240,6 +240,9 @@ int mkstemps(char *template, int suffixlen);
 #define DATETIME_ELAP 0x0001UL
 #define DATETIME_BYTE 0x0002UL
 
+#define REALTIME_UNAUTH_REC_SHOW 0x0001UL
+#define REALTIME_UNAUTH_REC_IGNORE 0x0001UL
+
 struct periodstruct
 {
    //! The first date of the period.
@@ -386,7 +389,7 @@ char Ulimit[6];
 char RealtimeTypes[1024];
 char cmd[255];
 char ImageFile[255];
-char RealtimeUnauthRec[15];
+unsigned long int RealtimeUnauthRec;
 char LDAPHost[255];
 char LDAPBindDN[512];
 char LDAPBindPW[255];
diff --git a/log.c b/log.c
index 66ad4551e86f2f7f558ec18ea102730058e9c215..2eb495701008977f9c241105c56a0540adbec4fe 100644 (file)
--- a/log.c
+++ b/log.c
@@ -265,7 +265,7 @@ int main(int argc,char *argv[])
    NtlmUserFormat=NTLMUSERFORMAT_DOMAINUSER;
    IndexTree=INDEX_TREE_FILE;
    strcpy(RealtimeTypes,"GET,PUT,CONNECT");
-   strcpy(RealtimeUnauthRec,"show");
+   RealtimeUnauthRec=REALTIME_UNAUTH_REC_SHOW;
    RedirectorIgnoreDate=false;
    DansguardianIgnoreDate=false;
    DataFileUrl=DATAFILEURL_IP;
index 4fdc25e1489310f9ac41c8641acd32147555d82e..4f6f456c3fd265a2e6667acaa83002d51f05eca5 100755 (executable)
@@ -161,7 +161,7 @@ static int getdata(char *rec, FILE *ftmp)
       }
    }
 
-   if(strncmp(user,"-",1) == 0 && strcmp(RealtimeUnauthRec,"ignore") == 0)
+   if(strncmp(user,"-",1) == 0 && RealtimeUnauthRec==REALTIME_UNAUTH_REC_IGNORE)
       return(0);
 
    tt=atoi(dat);