From: Frédéric Marchal Date: Wed, 12 May 2010 21:35:35 +0000 (+0000) Subject: Use a boolean instead of a string compare X-Git-Tag: v2.3-pre5~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71d7877434738a91d131f46a8ec9f0e8549a52d9;p=thirdparty%2Fsarg.git Use a boolean instead of a string compare --- diff --git a/getconf.c b/getconf.c index c0d5e0d..85a7e19 100644 --- 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; diff --git a/include/conf.h b/include/conf.h index 9dec569..eb52746 100755 --- a/include/conf.h +++ b/include/conf.h @@ -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 66ad455..2eb4957 100644 --- 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; diff --git a/realtime.c b/realtime.c index 4fdc25e..4f6f456 100755 --- a/realtime.c +++ b/realtime.c @@ -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);