-const char filters_rcs[] = "$Id: filters.c,v 1.202 2016/05/25 10:50:55 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
#include "win32.h"
#endif
-const char filters_h_rcs[] = FILTERS_H_VERSION;
-
typedef char *(*filter_function_ptr)();
static filter_function_ptr get_filter_function(const struct client_state *csp);
static jb_err prepare_for_filtering(struct client_state *csp);
* 3 : len = length of IP address in octets
* 4 : port = port number in network order;
*
- * Returns : 0 = no errror; -1 otherwise.
+ * Returns : void
*
*********************************************************************/
-static int sockaddr_storage_to_ip(const struct sockaddr_storage *addr,
- uint8_t **ip, unsigned int *len,
- in_port_t **port)
+static void sockaddr_storage_to_ip(const struct sockaddr_storage *addr,
+ uint8_t **ip, unsigned int *len,
+ in_port_t **port)
{
- if (NULL == addr)
- {
- return(-1);
- }
+ assert(NULL != addr);
+ assert(addr->ss_family == AF_INET || addr->ss_family == AF_INET6);
switch (addr->ss_family)
{
}
break;
- default:
- /* Unsupported address family */
- return(-1);
}
-
- return(0);
}
}
aca->mask.ss_family = aca->addr.ss_family;
- if (sockaddr_storage_to_ip(&aca->mask, &mask_data, &addr_len, &mask_port))
- {
- return(-1);
- }
+ sockaddr_storage_to_ip(&aca->mask, &mask_data, &addr_len, &mask_port);
if (p)
{
*
* Function : is_imageurl
*
- * Description : Given a URL, decide whether it is an image or not,
- * using either the info from a previous +image action
- * or, #ifdef FEATURE_IMAGE_DETECT_MSIE, and the browser
- * is MSIE and not on a Mac, tell from the browser's accept
- * header.
+ * Description : Given a URL, decide whether it should be treated
+ * as image URL or not.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
*
- * Returns : True (nonzero) if URL is an image, false (0)
+ * Returns : True (nonzero) if URL is an image URL, false (0)
* otherwise
*
*********************************************************************/
int is_imageurl(const struct client_state *csp)
{
-#ifdef FEATURE_IMAGE_DETECT_MSIE
- char *tmp;
-
- tmp = get_header_value(csp->headers, "User-Agent:");
- if (tmp && strstr(tmp, "MSIE") && !strstr(tmp, "Mac_"))
- {
- tmp = get_header_value(csp->headers, "Accept:");
- if (tmp && strstr(tmp, "image/gif"))
- {
- /* Client will accept HTML. If this seems counterintuitive,
- * blame Microsoft.
- */
- return(0);
- }
- else
- {
- return(1);
- }
- }
-#endif /* def FEATURE_IMAGE_DETECT_MSIE */
-
return ((csp->action->flags & ACTION_IMAGE) != 0);
}