]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Initialize usertab as late as possible
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Fri, 2 Oct 2015 17:07:55 +0000 (19:07 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Fri, 2 Oct 2015 17:07:55 +0000 (19:07 +0200)
The usertab option may use LDAP but the connection to the server was open
before parsing the access and useragent logs. It was possible that the
connection would time out before the first request was sent.

An attempt to fix this problem is to open the connection to the LDAP server
after parsing the log files.

datafile.c
log.c
report.c

index 54608c612dbe8e8abb0384634971ad30caf542a5..35822063301253abd223860a6153f8cc5c4773a0 100644 (file)
@@ -63,6 +63,8 @@ void data_file(char *tmp)
        struct userinfostruct *uinfo;
        longline line;
 
+       init_usertab(UserTabFile);
+
        ipantes[0]='\0';
        nameantes[0]='\0';
 
diff --git a/log.c b/log.c
index bd860e2492093a49feb5087a5b16bd6e0cd300c1..9d4f11443480d015478d869293c667c7a9bf7f4c 100644 (file)
--- a/log.c
+++ b/log.c
@@ -666,8 +666,6 @@ int main(int argc,char *argv[])
        }
 #endif
 
-       init_usertab(UserTabFile);
-
        read_start_time=time(NULL);
        LogStatus=ReadLogFile(&ReadFilter);
        read_end_time=time(NULL);
index 2d81566067d8421752a5db3de092f64002e1fd85..a1ea40d43aba4b8f0dae5e7f3a768ca2726930ce 100644 (file)
--- a/report.c
+++ b/report.c
@@ -112,11 +112,11 @@ void gerarel(void)
                debugaz(__FILE__,__LINE__,_("outdirname=%s\n"),outdirname);
        }
 
-       if (email[0] == '\0') {
-               if (!FileList_IsEmpty(UserAgentLog))
-                       UserAgent_Readlog();
-               UserAgent();
-       }
+       if (email[0] == '\0' && !FileList_IsEmpty(UserAgentLog))
+               UserAgent_Readlog();
+
+       init_usertab(UserTabFile);
+       UserAgent();
 
        snprintf(wdirname,sizeof(wdirname),"%s/sarg-general",outdirname);
        if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){