Killing warnings
authorjongfoster <jongfoster@users.sourceforge.net>
Wed, 13 Mar 2002 00:30:52 +0000 (00:30 +0000)
committerjongfoster <jongfoster@users.sourceforge.net>
Wed, 13 Mar 2002 00:30:52 +0000 (00:30 +0000)
Added option of always sending redirect for imageblock,
currently disabled with #if 0.

filters.c

index 256b0c9..a1dc75f 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.45 2002/03/08 16:47:50 oes Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.46 2002/03/12 01:42:49 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -38,6 +38,9 @@ const char filters_rcs[] = "$Id: filters.c,v 1.45 2002/03/08 16:47:50 oes Exp $"
  *
  * Revisions   :
  *    $Log: filters.c,v $
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.46  2002/03/12 01:42:49  oes
+ *    Introduced modular filters
+ *
  *    Revision 1.45  2002/03/08 16:47:50  oes
  *    Added choice beween GIF and PNG built-in images
  *
  *    Revision 1.45  2002/03/08 16:47:50  oes
  *    Added choice beween GIF and PNG built-in images
  *
@@ -490,7 +493,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
    masklength = 32;
    port       =  0;
 
    masklength = 32;
    port       =  0;
 
-   if ((p = strchr(aspec, '/')))
+   if ((p = strchr(aspec, '/')) != NULL)
    {
       *p++ = '\0';
 
    {
       *p++ = '\0';
 
@@ -506,7 +509,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
       return(-1);
    }
 
       return(-1);
    }
 
-   if ((p = strchr(aspec, ':')))
+   if ((p = strchr(aspec, ':')) != NULL)
    {
       *p++ = '\0';
 
    {
       *p++ = '\0';
 
@@ -670,6 +673,8 @@ struct http_response *block_url(struct client_state *csp)
       /* determine HOW images should be blocked */
       p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
 
       /* determine HOW images should be blocked */
       p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
 
+#if 1 /* Two alternative strategies, use this one for now: */
+
       /* and handle accordingly: */
       if ((p == NULL) || (0 == strcmpic(p, "logo")))
       {
       /* and handle accordingly: */
       if ((p == NULL) || (0 == strcmpic(p, "logo")))
       {
@@ -737,6 +742,35 @@ struct http_response *block_url(struct client_state *csp)
             return cgi_error_memory();
          }
       }
             return cgi_error_memory();
          }
       }
+
+#else /* Following code is disabled for now */
+
+      /* and handle accordingly: */
+      if ((p == NULL) || (0 == strcmpic(p, "logo")))
+      {
+         p = CGI_PREFIX "send-banner?type=logo";
+      }
+      else if (0 == strcmpic(p, "blank"))
+      {
+         p = CGI_PREFIX "send-banner?type=blank";
+      }
+      else if (0 == strcmpic(p, "pattern"))
+      {
+         p = CGI_PREFIX "send-banner?type=pattern";
+      }
+      rsp->status = strdup("302 Local Redirect from Junkbuster");
+      if (rsp->status == NULL)
+      {
+         free_http_response(rsp);
+         return cgi_error_memory();
+      }
+
+      if (enlist_unique_header(rsp->headers, "Location", p))
+      {
+         free_http_response(rsp);
+         return cgi_error_memory();
+      }
+#endif /* Preceeding code is disabled for now */
    }
    else
 #endif /* def FEATURE_IMAGE_BLOCKING */
    }
    else
 #endif /* def FEATURE_IMAGE_BLOCKING */
@@ -882,7 +916,7 @@ struct http_response *trust_url(struct client_state *csp)
     * Export the trust list
     */
    p = strdup("");
     * Export the trust list
     */
    p = strdup("");
-   for (tl = csp->config->trust_list; (t = *tl) ; tl++)
+   for (tl = csp->config->trust_list; (t = *tl) != NULL ; tl++)
    {
       sprintf(buf, "<li>%s</li>\n", t->spec);
       string_append(&p, buf);
    {
       sprintf(buf, "<li>%s</li>\n", t->spec);
       string_append(&p, buf);
@@ -979,7 +1013,7 @@ struct http_response *redirect_url(struct client_state *csp)
    /*
     * find the last URL encoded in the request
     */
    /*
     * find the last URL encoded in the request
     */
-   while ((p = strstr(p, "http://")))
+   while ((p = strstr(p, "http://")) != NULL)
    {
       q = p++;
    }
    {
       q = p++;
    }
@@ -1140,7 +1174,7 @@ int is_untrusted_url(struct client_state *csp)
 
          FILE *fp;
 
 
          FILE *fp;
 
-         if ((fp = fopen(csp->config->trustfile, "a")))
+         if (NULL != (fp = fopen(csp->config->trustfile, "a")))
          {
             char * path;
             char * path_end;
          {
             char * path;
             char * path_end;