#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
/** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 2.5 2003/09/22 00:33:01 david__schmidt Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.72.2.7 2006/01/29 23:10:56 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/src/project.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/Attic/project.h,v $
*
* Purpose : Defines data structures which are widely used in the
* project. Does not define any variables or functions
* (though it does declare some macros).
*
- * Copyright : Written by and Copyright (C) 2001 the SourceForge
+ * Copyright : Written by and Copyright (C) 2001 - 2004 the SourceForge
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
*
* Revisions :
* $Log: project.h,v $
- * Revision 2.5 2003/09/22 00:33:01 david__schmidt
- * Enable sending a custom 'blocked' image. Shows up as
- * "image-blocker-custom-file" parameter in config, and
- * "+set-image-blocker{custom}" in action files.
+ * Revision 1.72.2.7 2006/01/29 23:10:56 david__schmidt
+ * Multiple filter file support
*
- * Revision 2.4 2002/12/28 03:58:19 david__schmidt
- * Initial drop of dashboard instrumentation - enabled with
- * --enable-activity-console
+ * Revision 1.72.2.6 2004/10/03 12:53:46 david__schmidt
+ * Add the ability to check jpeg images for invalid
+ * lengths of comment blocks. Defensive strategy
+ * against the exploit:
+ * Microsoft Security Bulletin MS04-028
+ * Buffer Overrun in JPEG Processing (GDI+) Could
+ * Allow Code Execution (833987)
+ * Enabled with +inspect-jpegs in actions files.
*
- * Revision 2.3 2002/09/05 08:00:23 oes
- * Synced with the stable branch:
- * Revision 1.72.2.1 2002/08/10 11:25:18 oes
- * - Include config.h for access to config data
- * - Include <pcre*.h> depending on where they are
+ * Revision 1.72.2.5 2004/01/30 15:29:29 oes
+ * Updated the copyright note
*
- * Revision 2.2 2002/07/12 04:26:17 agotneja
- * Re-factored 'chat()' to become understandable and maintainable as
- * a first step in adding Transparent Proxy functionality.
+ * Revision 1.72.2.4 2004/01/13 16:12:14 oes
+ * Fixed double slash in USER_MANUAL_URL. Closes BR #867088.
*
- * Added several new static functions in jcc.c, and moved some data
- * parameters up into project.h to allow them to be passed between
- * the new functions.
+ * Revision 1.72.2.3 2003/03/11 11:54:37 oes
+ * Introduced RC_FLAG_* flags for use in child process return code
*
- * Revision 2.1 2002/06/04 16:35:56 jongfoster
- * Moving three variable declarations to jcc.c from project.h
+ * Revision 1.72.2.2 2002/11/28 18:15:44 oes
+ * Added flag to each cgi_dispatcher that allows or denies
+ * external linking and removed const qualifier from
+ * struct list_entry.str.
*
- * Revision 2.0 2002/06/04 14:34:21 jongfoster
- * Moving source files to src/
+ * Revision 1.72.2.1 2002/08/10 11:25:18 oes
+ * - Include config.h for access to config data
+ * - Include <pcre*.h> depending on where they are
*
* Revision 1.72 2002/05/14 21:35:49 oes
* Split HELP_LINK_PREFIX into ACTIONS_HELP_PREFIX and CONFIG_HELP_PREFIX
* Revision 1.67 2002/04/24 02:12:43 oes
* - Jon's multiple AF patch:
* - Make csp->actions_list an array
- * - #define MAX_ACTION_FILES
+ * - #define MAX_AF_FILES
* - Moved CGI_PARAM_LEN_MAX (500) here
*
* Revision 1.66 2002/04/15 19:06:43 jongfoster
*/
typedef int jb_err;
-#define JB_ERR_GENERIC -1 /* General error return value */
#define JB_ERR_OK 0 /**< Success, no error */
#define JB_ERR_MEMORY 1 /**< Out of memory */
#define JB_ERR_CGI_PARAMS 2 /**< Missing or corrupt CGI parameters */
#define JB_ERR_PARSE 4 /**< Error parsing file */
#define JB_ERR_MODIFIED 5 /**< File has been modified outside of the
CGI actions editor. */
-#define JB_ERR_INTERCEPT 6 /* This page should be intercepted */
+
/**
* This macro is used to free a pointer that may be NULL.
struct list_entry
{
/**
- * The string. The "const" is only to discourage modification,
- * you can actually change it if you *really* want to.
- * You can even freez() it and replace it with another
- * malloc()d string. If you replace it with NULL, the list
- * functions will work, just be careful next time you iterate
- * through the list in your own code.
- *
- * FIXME: Should we remove the "const"?
+ * The string pointer. It must point to a dynamically malloc()ed
+ * string or be NULL for the list functions to work. In the latter
+ * case, just be careful next time you iterate through the list in
+ * your own code.
*/
- const char *str;
+ char *str;
/** Next entry in the linked list, or NULL if no more. */
struct list_entry *next;
char *dbuffer; /**< Buffer with '\0'-delimited domain name. */
char **dvec; /**< List of pointers to the strings in dbuffer. */
int dcount; /**< How many parts to this domain? (length of dvec) */
-
- const struct forward_spec *fwd ;
-
};
#define CSP_FLAG_TOGGLED_ON 0x20
+/*
+ * Flags for use in return codes of child processes
+ */
+
/**
- * Maximum number of actions files. This limit is arbitrary - it's just used
+ * Flag for process return code: Set if exiting porcess has been toggled
+ * during its lifetime.
+ */
+#define RC_FLAG_TOGGLED 0x10
+
+/**
+ * Flag for process return code: Set if exiting porcess has blocked its
+ * request.
+ */
+#define RC_FLAG_BLOCKED 0x20
+
+/**
+ * Maximum number of actions/filter files. This limit is arbitrary - it's just used
* to size an array.
*/
-#define MAX_ACTION_FILES 10
+#define MAX_AF_FILES 10
/**
* The state of a Privoxy processing thread.
char *x_forwarded;
/** Actions files associated with this client */
- struct file_list *actions_list[MAX_ACTION_FILES];
+ struct file_list *actions_list[MAX_AF_FILES];
- /** pcrs job file. */
- struct file_list *rlist;
+ /** pcrs job files. */
+ struct file_list *rlist[MAX_AF_FILES];
/** Length after content modification. */
size_t content_length;
/** Next thread in linked list. Only read or modify from the main thread! */
struct client_state *next;
-
- char *(*content_filter)() ;
- int all_headers_read ;
-
};
/** The description of the CGI, to appear on the main menu, or NULL to hide it. */
const char * const description;
+
+ /** A flag that indicates whether unintentional calls to this CGI can cause damage */
+ int harmless;
};
const char *logdir;
/** The full paths to the actions files. */
- const char *actions_file[MAX_ACTION_FILES];
+ const char *actions_file[MAX_AF_FILES];
/** The short names of the actions files. */
- const char *actions_file_short[MAX_ACTION_FILES];
+ const char *actions_file_short[MAX_AF_FILES];
/** The administrator's email address */
char *admin_address;
/** URL to the user manual (on our website or local copy) */
char *usermanual;
- /** The file name of the pcre filter file */
- const char *re_filterfile;
+ /** The file names of the pcre filter files. */
+ const char *re_filterfile[MAX_AF_FILES];
+
+ /** The short names of the pcre filter files. */
+ const char *re_filterfile_short[MAX_AF_FILES];
#ifdef FEATURE_COOKIE_JAR
/** Size limit for IOB */
size_t buffer_limit;
-#ifdef FEATURE_ACTIVITY_CONSOLE
-
- /**
- * Default IP address to send statistics to, as a string.
- * Set to "127.0.0.1".
- */
- #define ACTIVTY_ADDR_DEFAULT "127.0.0.1"
-
- /**
- * Default port to listen on, as a number.
- * Set to 8119.
- */
- #define ACTIVTY_ADDR_PORT 8119
-
- /** IP address to talk to for activity/statistics reporting. */
- const char *activity_address;
-
- /** Port to bind to. Defaults to ACTIVTY_ADDR_PORT == 8119. */
- int activity_port;
-
- /** Frequency, in seconds, of how often to update the stats console. */
- int activity_freq;
-
-#endif /* def FEATURE_ACTIVITY_CONSOLE */
-
#ifdef FEATURE_TRUST
/** The file name of the trust file. */
/** Nonzero if we need to bind() to the new port. */
int need_bind;
-
- /** The raw blocker custom bitmap data */
- char *image_blocker_data;
-
- /** The length of the blocker custom image data */
- size_t image_blocker_length;
-
- /** The mimetype of the blocker custom image data */
- char *image_blocker_format;
};
/** Calculates the number of elements in an array, using sizeof. */
#define FORCE_PREFIX "/PRIVOXY-FORCE"
#endif /* def FEATURE_FORCE_LOAD */
-#define IMAGE_MIMETYPE_PNG "image/png"
-#define IMAGE_MIMETYPE_GIF "image/gif"
-#define IMAGE_MIMETYPE_JPG "image/jpg"
-
#ifdef FEATURE_NO_GIFS
-/** The MIME type for built-in images ("image/png" or "image/gif"). */
-#define BUILTIN_IMAGE_MIMETYPE IMAGE_MIMETYPE_PNG
+/** The MIME type for images ("image/png" or "image/gif"). */
+#define BUILTIN_IMAGE_MIMETYPE "image/png"
#else
-#define BUILTIN_IMAGE_MIMETYPE IMAGE_MIMETYPE_GIF
+#define BUILTIN_IMAGE_MIMETYPE "image/gif"
#endif /* def FEATURE_NO_GIFS */
#define HOME_PAGE_URL "http://www.privoxy.org/"
/** URL for the Privoxy user manual. */
-#define USER_MANUAL_URL HOME_PAGE_URL "/" VERSION "/user-manual/"
+#define USER_MANUAL_URL HOME_PAGE_URL VERSION "/user-manual/"
/** Prefix for actions help links (append to USER_MANUAL_URL). */
#define ACTIONS_HELP_PREFIX "actions-file.html#"
#define CGI_PREFIX "http://" CGI_SITE_2_HOST CGI_SITE_2_PATH "/"
+/* HTTP snipplets.
+ *
+ * FIXME: This is very inefficient. There could be one copy of these strings
+ * for each .c file!! They should be "extern", not "static".
+ */
+static const char CSUCCEED[] =
+ "HTTP/1.0 200 Connection established\n"
+ "Proxy-Agent: Privoxy/" VERSION "\r\n\r\n";
+
+static const char CHEADER[] =
+ "HTTP/1.0 400 Invalid header received from browser\r\n\r\n";
+
+static const char CFORBIDDEN[] =
+ "HTTP/1.0 403 Connection not allowable\r\nX-Hint: If you read this message interactively, then you know why this happens ,-)\r\n\r\n";
+
#ifdef __cplusplus
} /* extern "C" */
#endif