From: oes Date: Tue, 22 May 2001 18:56:28 +0000 (+0000) Subject: CRLF -> LF X-Git-Tag: v_2_9_9~508 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=6d1554928803b8cceb91a8e82de8ae3418c896f4 CRLF -> LF --- diff --git a/killpopup.c b/killpopup.c index 53a193ed..67f5de9b 100644 --- a/killpopup.c +++ b/killpopup.c @@ -1,4 +1,4 @@ -const char killpopup_rcs[] = "$Id: killpopup.c,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $"; +const char killpopup_rcs[] = "$Id: killpopup.c,v 1.2 2001/05/20 01:21:20 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/killpopup.c,v $ @@ -32,6 +32,19 @@ const char killpopup_rcs[] = "$Id: killpopup.c,v 1.1.1.1 2001/05/15 13:58:58 oes * * Revisions : * $Log: killpopup.c,v $ + * Revision 1.2 2001/05/20 01:21:20 jongfoster + * Version 2.9.4 checkin. + * - Merged popupfile and cookiefile, and added control over PCRS + * filtering, in new "permissionsfile". + * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration + * file error you now get a message box (in the Win32 GUI) rather + * than the program exiting with no explanation. + * - Made killpopup use the PCRS MIME-type checking and HTTP-header + * skipping. + * - Removed tabs from "config" + * - Moved duplicated url parsing code in "loaders.c" to a new funcition. + * - Bumped up version number. + * * Revision 1.1.1.1 2001/05/15 13:58:58 oes * Initial import of version 2.9.3 source tree * @@ -72,7 +85,7 @@ const char killpopup_h_rcs[] = KILLPOPUP_H_VERSION; * Function : filter_popups * * Description : Filter the block of data that's been read from the server. - * Caller is responsible for checking permissons list + * Caller is responsible for checking permissons list * to determine if this function should be called. * * Parameters : diff --git a/loaders.c b/loaders.c index 5767ee2e..4c218510 100644 --- a/loaders.c +++ b/loaders.c @@ -1,4 +1,4 @@ -const char loaders_rcs[] = "$Id: loaders.c,v 1.2 2001/05/17 23:01:01 oes Exp $"; +const char loaders_rcs[] = "$Id: loaders.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loaders.c,v $ @@ -35,6 +35,19 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.2 2001/05/17 23:01:01 oes Exp $"; * * Revisions : * $Log: loaders.c,v $ + * Revision 1.3 2001/05/20 01:21:20 jongfoster + * Version 2.9.4 checkin. + * - Merged popupfile and cookiefile, and added control over PCRS + * filtering, in new "permissionsfile". + * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration + * file error you now get a message box (in the Win32 GUI) rather + * than the program exiting with no explanation. + * - Made killpopup use the PCRS MIME-type checking and HTTP-header + * skipping. + * - Removed tabs from "config" + * - Moved duplicated url parsing code in "loaders.c" to a new funcition. + * - Bumped up version number. + * * Revision 1.2 2001/05/17 23:01:01 oes * - Cleaned CRLF's from the sources and related files * @@ -90,8 +103,8 @@ const char loaders_h_rcs[] = LOADERS_H_VERSION; #define NLOADERS 8 static int (*loaders[NLOADERS])(struct client_state *); - - + + /* * Currently active files. * These are also entered in the main linked list of files. @@ -115,10 +128,10 @@ static struct file_list *current_trustfile = NULL; #ifdef PCRS static struct file_list *current_re_filterfile = NULL; #endif /* def PCRS */ - - -static int create_url_spec(struct url_spec * url, char * buf); - + + +static int create_url_spec(struct url_spec * url, char * buf); + /********************************************************************* * @@ -254,125 +267,125 @@ void sweep(void) } -/********************************************************************* - * - * Function : create_url_spec - * - * Description : Creates a "url_spec" structure from a string. - * When finished, free with unload_url(). - * - * Parameters : - * 1 : url = Target url_spec to be filled in. Must be - * zeroed out before the call (e.g. using zalloc). - * 2 : buf = Source pattern, null terminated. NOTE: The - * contents of this buffer are destroyed by this - * function. If this function succeeds, the - * buffer is copied to url->spec. If this - * function fails, the contents of the buffer - * are lost forever. - * - * Returns : 0 => Ok, everything else is an error. - * - *********************************************************************/ -static int create_url_spec(struct url_spec * url, char * buf) -{ - char *p; - struct url_spec tmp_url[1]; - - /* paranoia - should never happen. */ - if ((url == NULL) || (buf == NULL)) - { - return 1; - } - - /* save a copy of the orignal specification */ - if ((url->spec = strdup(buf)) == NULL) - { - return 1; - } - - if ((p = strchr(buf, '/'))) - { - if (NULL == (url->path = strdup(p))) - { - freez(url->spec); - return 1; - } - url->pathlen = strlen(url->path); - *p = '\0'; - } - else - { - url->path = NULL; - url->pathlen = 0; - } -#ifdef REGEX - if (url->path) - { - int errcode; - char rebuf[BUFSIZ]; - - if (NULL == (url->preg = zalloc(sizeof(*url->preg)))) - { - freez(url->spec); - freez(url->path); - return 1; - } - - sprintf(rebuf, "^(%s)", url->path); - - errcode = regcomp(url->preg, rebuf, - (REG_EXTENDED|REG_NOSUB|REG_ICASE)); - if (errcode) - { - size_t errlen = - regerror(errcode, - url->preg, buf, sizeof(buf)); - - buf[errlen] = '\0'; - - log_error(LOG_LEVEL_ERROR, "error compiling %s: %s", - url->spec, buf); - - freez(url->spec); - freez(url->path); - freez(url->preg); - - return 1; - } - } -#endif - if ((p = strchr(buf, ':')) == NULL) - { - url->port = 0; - } - else - { - *p++ = '\0'; - url->port = atoi(p); - } - - if ((url->domain = strdup(buf)) == NULL) - { - freez(url->spec); - freez(url->path); -#ifdef REGEX - freez(url->preg); -#endif /* def REGEX */ - return 1; - } - - /* split domain into components */ - - *tmp_url = dsplit(url->domain); - url->dbuf = tmp_url->dbuf; - url->dcnt = tmp_url->dcnt; - url->dvec = tmp_url->dvec; - - return 0; /* OK */ -} - - +/********************************************************************* + * + * Function : create_url_spec + * + * Description : Creates a "url_spec" structure from a string. + * When finished, free with unload_url(). + * + * Parameters : + * 1 : url = Target url_spec to be filled in. Must be + * zeroed out before the call (e.g. using zalloc). + * 2 : buf = Source pattern, null terminated. NOTE: The + * contents of this buffer are destroyed by this + * function. If this function succeeds, the + * buffer is copied to url->spec. If this + * function fails, the contents of the buffer + * are lost forever. + * + * Returns : 0 => Ok, everything else is an error. + * + *********************************************************************/ +static int create_url_spec(struct url_spec * url, char * buf) +{ + char *p; + struct url_spec tmp_url[1]; + + /* paranoia - should never happen. */ + if ((url == NULL) || (buf == NULL)) + { + return 1; + } + + /* save a copy of the orignal specification */ + if ((url->spec = strdup(buf)) == NULL) + { + return 1; + } + + if ((p = strchr(buf, '/'))) + { + if (NULL == (url->path = strdup(p))) + { + freez(url->spec); + return 1; + } + url->pathlen = strlen(url->path); + *p = '\0'; + } + else + { + url->path = NULL; + url->pathlen = 0; + } +#ifdef REGEX + if (url->path) + { + int errcode; + char rebuf[BUFSIZ]; + + if (NULL == (url->preg = zalloc(sizeof(*url->preg)))) + { + freez(url->spec); + freez(url->path); + return 1; + } + + sprintf(rebuf, "^(%s)", url->path); + + errcode = regcomp(url->preg, rebuf, + (REG_EXTENDED|REG_NOSUB|REG_ICASE)); + if (errcode) + { + size_t errlen = + regerror(errcode, + url->preg, buf, sizeof(buf)); + + buf[errlen] = '\0'; + + log_error(LOG_LEVEL_ERROR, "error compiling %s: %s", + url->spec, buf); + + freez(url->spec); + freez(url->path); + freez(url->preg); + + return 1; + } + } +#endif + if ((p = strchr(buf, ':')) == NULL) + { + url->port = 0; + } + else + { + *p++ = '\0'; + url->port = atoi(p); + } + + if ((url->domain = strdup(buf)) == NULL) + { + freez(url->spec); + freez(url->path); +#ifdef REGEX + freez(url->preg); +#endif /* def REGEX */ + return 1; + } + + /* split domain into components */ + + *tmp_url = dsplit(url->domain); + url->dbuf = tmp_url->dbuf; + url->dcnt = tmp_url->dcnt; + url->dvec = tmp_url->dvec; + + return 0; /* OK */ +} + + /********************************************************************* * * Function : unload_url @@ -492,22 +505,22 @@ static void unload_imagefile(void *f) * Description : Unloads a permissions file. * * Parameters : - * 1 : file_data = the data structure associated with the + * 1 : file_data = the data structure associated with the * permissions file. * * Returns : N/A * *********************************************************************/ static void unload_permissions_file(void *file_data) -{ +{ struct permissions_spec * next; struct permissions_spec * cur = (struct permissions_spec *)file_data; - while (cur != NULL) - { + while (cur != NULL) + { next = cur->next; unload_url(cur->url); - freez(cur); - cur = next; + freez(cur); + cur = next; } } @@ -1002,13 +1015,13 @@ int load_blockfile(struct client_state *csp) bl->next = b; b->reject = reject; - - /* Save the URL pattern */ - if (create_url_spec(b->url, buf)) - { - fclose(fp); - goto load_blockfile_error; - } + + /* Save the URL pattern */ + if (create_url_spec(b->url, buf)) + { + fclose(fp); + goto load_blockfile_error; + } } fclose(fp); @@ -1122,17 +1135,17 @@ int load_imagefile(struct client_state *csp) /* add it to the list */ b->next = bl->next; bl->next = b; - - b->reject = reject; - /* Save the URL pattern */ - if (create_url_spec(b->url, buf)) + b->reject = reject; + + /* Save the URL pattern */ + if (create_url_spec(b->url, buf)) { fclose(fp); goto load_imagefile_error; } } - + fclose(fp); #ifndef SPLIT_PROXY_ARGS @@ -1166,12 +1179,12 @@ load_imagefile_error: } #endif /* def USE_IMAGE_LIST */ - + /********************************************************************* * * Function : load_permissions_file * - * Description : Read and parse a permissions file and add to files + * Description : Read and parse a permissions file and add to files * list. * * Parameters : @@ -1187,7 +1200,7 @@ int load_permissions_file(struct client_state *csp) struct permissions_spec *b, *bl; char buf[BUFSIZ], *p, *q; int permissions; - struct file_list *fs; + struct file_list *fs; int i; if (!check_file_changed(current_permissions_file, permissions_file, &fs)) @@ -1213,79 +1226,79 @@ int load_permissions_file(struct client_state *csp) if ((fp = fopen(permissions_file, "r")) == NULL) { goto load_permissions_error; - } + } + - - /* - * default_permissions is set in this file. - * - * Reset it to default first. - */ - default_permissions = PERMIT_RE_FILTER; + /* + * default_permissions is set in this file. + * + * Reset it to default first. + */ + default_permissions = PERMIT_RE_FILTER; while (read_config_line(buf, sizeof(buf), fp, fs) != NULL) { - p = buf; - - permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS; - - /* - * FIXME: for() loop is a kludge. Want to loop around until we - * find a non-control character. Assume there will be at most 4 - * characters. - */ - for (i = 0; i < 4; i++) - { + p = buf; + + permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS; + + /* + * FIXME: for() loop is a kludge. Want to loop around until we + * find a non-control character. Assume there will be at most 4 + * characters. + */ + for (i = 0; i < 4; i++) + { switch ((int)*p) { - case '>': - /* - * Allow cookies to be read by the server, but do - * not allow them to be set. - */ + case '>': + /* + * Allow cookies to be read by the server, but do + * not allow them to be set. + */ permissions = (permissions & ~PERMIT_COOKIE_SET); p++; break; case '<': - /* - * Allow server to set cookies but do not let the - * server read them. - */ - permissions = (permissions & ~PERMIT_COOKIE_READ); + /* + * Allow server to set cookies but do not let the + * server read them. + */ + permissions = (permissions & ~PERMIT_COOKIE_READ); + p++; + break; + + case '^': + /* + * Block popups + */ + permissions = (permissions & ~PERMIT_POPUPS); + p++; + break; + + case '%': + /* + * Permit filtering using PCRS + */ + permissions = (permissions | PERMIT_RE_FILTER); p++; break; - case '^': - /* - * Block popups - */ - permissions = (permissions & ~PERMIT_POPUPS); - p++; - break; - - case '%': - /* - * Permit filtering using PCRS - */ - permissions = (permissions | PERMIT_RE_FILTER); - p++; - break; - - case '~': - /* - * All of the above (maximum filtering). + case '~': + /* + * All of the above (maximum filtering). */ - permissions = PERMIT_RE_FILTER; + permissions = PERMIT_RE_FILTER; p++; break; - default: - /* - * FIXME: Should break out of the loop here. + default: + /* + * FIXME: Should break out of the loop here. */ break; - } + } } /* @@ -1293,17 +1306,17 @@ int load_permissions_file(struct client_state *csp) * front of the pattern */ q = buf; - if (p > q) - { + if (p > q) + { while ((*q++ = *p++) != '\0') { /* nop */ - } + } } /* a lines containing only "special" chars sets default */ if (*buf == '\0') - { + { default_permissions = permissions; continue; } @@ -1319,13 +1332,13 @@ int load_permissions_file(struct client_state *csp) /* add it to the list */ b->next = bl->next; bl->next = b; - + /* Save flags */ - b->permissions = permissions; - - /* Save the URL pattern */ - if (create_url_spec(b->url, buf)) - { + b->permissions = permissions; + + /* Save the URL pattern */ + if (create_url_spec(b->url, buf)) + { fclose(fp); goto load_permissions_error; } @@ -1456,8 +1469,8 @@ int load_trustfile(struct client_state *csp) b->reject = reject; - /* Save the URL pattern */ - if (create_url_spec(b->url, buf)) + /* Save the URL pattern */ + if (create_url_spec(b->url, buf)) { fclose(fp); goto load_trustfile_error; diff --git a/w32log.c b/w32log.c index 3910aec6..15a33838 100644 --- a/w32log.c +++ b/w32log.c @@ -1,4 +1,4 @@ -const char w32log_rcs[] = "$Id: w32log.c,v 1.2 2001/05/20 01:21:20 jongfoster Exp $"; +const char w32log_rcs[] = "$Id: w32log.c,v 1.3 2001/05/20 15:07:54 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/w32log.c,v $ @@ -32,6 +32,9 @@ const char w32log_rcs[] = "$Id: w32log.c,v 1.2 2001/05/20 01:21:20 jongfoster Ex * * Revisions : * $Log: w32log.c,v $ + * Revision 1.3 2001/05/20 15:07:54 jongfoster + * File is now ignored if _WIN_CONSOLE is defined. + * * Revision 1.2 2001/05/20 01:21:20 jongfoster * Version 2.9.4 checkin. * - Merged popupfile and cookiefile, and added control over PCRS @@ -78,8 +81,8 @@ const char cygwin_h_rcs[] = CYGWIN_H_VERSION; #endif const char w32log_h_rcs[] = W32LOG_H_VERSION; - -#ifndef _WIN_CONSOLE /* entire file */ + +#ifndef _WIN_CONSOLE /* entire file */ /* * Timers and the various durations @@ -1322,7 +1325,7 @@ LRESULT CALLBACK LogWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara } -#endif /* ndef _WIN_CONSOLE - entire file */ +#endif /* ndef _WIN_CONSOLE - entire file */ /* Local Variables: diff --git a/w32rulesdlg.c b/w32rulesdlg.c index b40b45ac..8b0b896a 100644 --- a/w32rulesdlg.c +++ b/w32rulesdlg.c @@ -1,4 +1,4 @@ -const char w32rulesdlg_rcs[] = "$Id: w32rulesdlg.c,v 1.1.1.1 2001/05/15 13:59:08 oes Exp $"; +const char w32rulesdlg_rcs[] = "$Id: w32rulesdlg.c,v 1.2 2001/05/20 15:07:54 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/w32rulesdlg.c,v $ @@ -32,6 +32,9 @@ const char w32rulesdlg_rcs[] = "$Id: w32rulesdlg.c,v 1.1.1.1 2001/05/15 13:59:08 * * Revisions : * $Log: w32rulesdlg.c,v $ + * Revision 1.2 2001/05/20 15:07:54 jongfoster + * File is now ignored if _WIN_CONSOLE is defined. + * * Revision 1.1.1.1 2001/05/15 13:59:08 oes * Initial import of version 2.9.3 source tree * @@ -54,8 +57,8 @@ const char w32rulesdlg_rcs[] = "$Id: w32rulesdlg.c,v 1.1.1.1 2001/05/15 13:59:08 #endif const char w32rulesdlg_h_rcs[] = W32RULESDLG_H_VERSION; - -#ifndef _WIN_CONSOLE /* entire file */ + +#ifndef _WIN_CONSOLE /* entire file */ const int nSmallIconWidth = 16; const int nSmallIconHeight = 16; @@ -529,7 +532,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } -#endif /* ndef _WIN_CONSOLE - entire file */ +#endif /* ndef _WIN_CONSOLE - entire file */ /* Local Variables: diff --git a/w32taskbar.c b/w32taskbar.c index ae08843d..63ac0d35 100644 --- a/w32taskbar.c +++ b/w32taskbar.c @@ -1,4 +1,4 @@ -const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.1.1.1 2001/05/15 13:59:08 oes Exp $"; +const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.2 2001/05/20 15:07:54 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/w32taskbar.c,v $ @@ -32,6 +32,9 @@ const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.1.1.1 2001/05/15 13:59:08 o * * Revisions : * $Log: w32taskbar.c,v $ + * Revision 1.2 2001/05/20 15:07:54 jongfoster + * File is now ignored if _WIN_CONSOLE is defined. + * * Revision 1.1.1.1 2001/05/15 13:59:08 oes * Initial import of version 2.9.3 source tree * @@ -50,8 +53,8 @@ const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.1.1.1 2001/05/15 13:59:08 o #include "w32log.h" const char w32taskbar_h_rcs[] = W32TASKBAR_H_VERSION; - -#ifndef _WIN_CONSOLE /* entire file */ + +#ifndef _WIN_CONSOLE /* entire file */ #define WM_TRAYMSG WM_USER+1 @@ -260,8 +263,8 @@ LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } -#endif /* ndef _WIN_CONSOLE - entire file */ - +#endif /* ndef _WIN_CONSOLE - entire file */ + /* Local Variables: tab-width: 3