]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Fixed bug #2000178.
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 1 Aug 2009 21:07:51 +0000 (21:07 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 1 Aug 2009 21:07:51 +0000 (21:07 +0000)
squidguard_log.c

index 79bc943d7cbea85c4d28f44f28a8550cfd9f9c05..38153b44dde269aed98330900998e62444368e5f 100644 (file)
@@ -40,6 +40,7 @@ static void read_log(const char *wentp, FILE *fp_ou)
    char wdata[127];
    int  idata=0;
    int  i;
+   char *str;
 
    if(debug) {
       strcpy(buf,text[7]);
@@ -70,7 +71,7 @@ static void read_log(const char *wentp, FILE *fp_ou)
    */
    for (i=0; i<nfiles_done; i++)
       if (!strcmp(wentp, files_done[i])) return;
-   
+
    nfiles_done++;
    files_done = realloc(files_done, nfiles_done*sizeof(char *));
    if (!files_done) {
@@ -87,7 +88,7 @@ static void read_log(const char *wentp, FILE *fp_ou)
       fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],wentp);
       exit(1);
    }
-   
+
    while (fgets(buf,sizeof(buf),fp_in) != NULL) {
       if(strlen(SquidGuardLogFormat) > 0) {
          strcpy(bufbsf,SquidGuardLogFormat);
@@ -131,12 +132,14 @@ static void read_log(const char *wentp, FILE *fp_ou)
              getword(day,sizeof(day),buf,' ')<0 || getword(hour,sizeof(hour),buf,' ')<0 ||
              getword(list,sizeof(list),buf,'/')<0 || getword(list,sizeof(list),buf,'/')<0 ||
              getword(tmp5,sizeof(tmp5),buf,'/')<0 || getword(tmp5,sizeof(tmp5),buf,'/')<0 ||
-             getword(url,sizeof(url),buf,'/')<0 || getword(tmp5,sizeof(tmp5),buf,' ')<0 ||
+             getword(url,sizeof(url),buf,' ')<0 ||
              getword(ip,sizeof(ip),buf,'/')<0 || getword(user,sizeof(user),buf,' ')<0 ||
              getword(user,sizeof(user),buf,' ')<0) {
             printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",wentp);
             exit(1);
           }
+          str=strchr(url,'/');
+          if (str) *str='\0';
       }
 
       sprintf(warea,"%s%s%s",year,mon,day);