]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - denied.c
Ported r208 from branches/v2_2_7
[thirdparty/sarg.git] / denied.c
index 00e54868f49c4e58ecbe460c5637fbe904fdc672..76c6e9d6a769665d1b8a3312b6458d733243acf7 100644 (file)
--- a/denied.c
+++ b/denied.c
@@ -1,6 +1,6 @@
 /*
  * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
- *                                                            1998, 2009
+ *                                                            1998, 2010
  * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
  *
  * SARG donations:
@@ -46,6 +46,7 @@ void gen_denied_report(void)
    char *str;
    int  z=0;
    int  count=0;
+   struct getwordstruct gwarea;
 
    ouser[0]='\0';
    ouser2[0]='\0';
@@ -103,9 +104,10 @@ void gen_denied_report(void)
    fprintf(fp_ou,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91]);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      if (getword(data,sizeof(data),buf,'\t')<0 || getword(hora,sizeof(hora),buf,'\t')<0 ||
-          getword(user,sizeof(user),buf,'\t')<0 || getword(ip,sizeof(ip),buf,'\t')<0 ||
-          getword(url,sizeof(url),buf,'\t')<0) {
+      getword_start(&gwarea,buf);
+      if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 ||
+          getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0 ||
+          getword(url,sizeof(url),&gwarea,'\t')<0) {
          printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",denied_in);
          exit(1);
       }
@@ -115,7 +117,7 @@ void gen_denied_report(void)
             fixip(user);
       }
 
-      if(strcmp(Ip2Name,"yes") == 0)
+      if(Ip2Name)
          ip2name(ip,sizeof(ip));
 
       if(!z) {
@@ -151,7 +153,7 @@ void gen_denied_report(void)
             continue;
       }
 
-      if(strlen(BlockIt) > 0)
+      if(BlockIt[0] != '\0')
          sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"%s/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url,ImageFile);
       else BlockImage[0]='\0';