Changing BUFSIZ ==> BUFFER_SIZE
authorjongfoster <jongfoster@users.sourceforge.net>
Sat, 9 Jun 2001 10:55:28 +0000 (10:55 +0000)
committerjongfoster <jongfoster@users.sourceforge.net>
Sat, 9 Jun 2001 10:55:28 +0000 (10:55 +0000)
actions.c
errlog.c
filters.c
gateway.c
jcc.c
loadcfg.c
loaders.c
miscutil.c
showargs.c

index 258862f..f1d792e 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -1,4 +1,4 @@
-const char actions_rcs[] = "$Id: actions.c,v 1.5 2001/06/03 19:11:48 oes Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.6 2001/06/07 23:04:34 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/actions.c,v $
@@ -33,6 +33,9 @@ const char actions_rcs[] = "$Id: actions.c,v 1.5 2001/06/03 19:11:48 oes Exp $";
  *
  * Revisions   :
  *    $Log: actions.c,v $
+ *    Revision 1.6  2001/06/07 23:04:34  jongfoster
+ *    Made get_actions() static.
+ *
  *    Revision 1.5  2001/06/03 19:11:48  oes
  *    adapted to new enlist_unique arg format
  *
@@ -906,7 +909,7 @@ int load_actions_file(struct client_state *csp)
 
    struct url_actions *last_perm;
    struct url_actions *perm;
-   char  buf[BUFSIZ];
+   char  buf[BUFFER_SIZE];
    struct file_list *fs;
 #define MODE_START_OF_FILE 1
 #define MODE_ACTIONS       2
@@ -1003,7 +1006,7 @@ int load_actions_file(struct client_state *csp)
          {
             /* It's an actions block */
 
-            char  actions_buf[BUFSIZ];
+            char  actions_buf[BUFFER_SIZE];
             char * end;
 
             /* set mode */
@@ -1055,7 +1058,7 @@ int load_actions_file(struct client_state *csp)
       else if (mode == MODE_ALIAS)
       {
          /* define an alias */
-         char  actions_buf[BUFSIZ];
+         char  actions_buf[BUFFER_SIZE];
          struct action_alias * new_alias;
          int more = 1;
 
index ae98ed3..3832dbd 100644 (file)
--- a/errlog.c
+++ b/errlog.c
@@ -1,4 +1,4 @@
-const char errlog_rcs[] = "$Id: errlog.c,v 1.10 2001/05/29 11:52:21 oes Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.11 2001/06/01 18:14:49 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
@@ -33,6 +33,10 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.10 2001/05/29 11:52:21 oes Exp $";
  *
  * Revisions   :
  *    $Log: errlog.c,v $
+ *    Revision 1.11  2001/06/01 18:14:49  jongfoster
+ *    Changing the calls to strerr() to check HAVE_STRERR (which is defined
+ *    in config.h if appropriate) rather than the NO_STRERR macro.
+ *
  *    Revision 1.10  2001/05/29 11:52:21  oes
  *    Conditional compilation of w32_socket_error
  *
@@ -262,7 +266,7 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
 void log_error(int loglevel, char *fmt, ...)
 {
    va_list ap;
-   char outbuf[BUFSIZ];
+   char outbuf[BUFFER_SIZE];
    char * src = fmt;
    int outc = 0;
    long this_thread = 1;  /* was: pthread_t this_thread;*/
@@ -339,9 +343,9 @@ void log_error(int loglevel, char *fmt, ...)
    va_start( ap, fmt );
 
    /* build formatted message from fmt and var-args */
-   while ((*src) && (outc < BUFSIZ-2))
+   while ((*src) && (outc < BUFFER_SIZE-2))
    {
-      char tempbuf[BUFSIZ];
+      char tempbuf[BUFFER_SIZE];
       char *sval;
       int ival;
       unsigned uval;
@@ -366,7 +370,7 @@ void log_error(int loglevel, char *fmt, ...)
             ival = va_arg( ap, int );
             oldoutc = outc;
             outc += sprintf(tempbuf, "%d", ival);
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, tempbuf);
             }
@@ -379,7 +383,7 @@ void log_error(int loglevel, char *fmt, ...)
             uval = va_arg( ap, unsigned );
             oldoutc = outc;
             outc += sprintf(tempbuf, "%u", uval);
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, tempbuf);
             }
@@ -420,7 +424,7 @@ void log_error(int loglevel, char *fmt, ...)
                /* Never get here */
                break;
             }
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, tempbuf);
             }
@@ -440,7 +444,7 @@ void log_error(int loglevel, char *fmt, ...)
             sval = va_arg( ap, char * );
             oldoutc = outc;
             outc += strlen(sval);
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, sval);
             }
@@ -461,7 +465,7 @@ void log_error(int loglevel, char *fmt, ...)
             }
             oldoutc = outc;
             outc += ival;
-            if (outc < BUFSIZ-1)
+            if (outc < BUFFER_SIZE-1)
             {
                memcpy(outbuf + oldoutc, sval, ival);
             }
@@ -490,7 +494,7 @@ void log_error(int loglevel, char *fmt, ...)
 #endif /* ndef _WIN32 */
             oldoutc = outc;
             outc += strlen(sval);
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, sval);
             }
@@ -518,12 +522,12 @@ void log_error(int loglevel, char *fmt, ...)
                days = tm_now->tm_yday - gmt.tm_yday; 
                hrs = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + tm_now->tm_hour - gmt.tm_hour); 
                mins = hrs * 60 + tm_now->tm_min - gmt.tm_min; 
-               strftime (tempbuf, BUFSIZ-6, "%d/%b/%Y:%H:%M:%S ", tm_now); 
+               strftime (tempbuf, BUFFER_SIZE-6, "%d/%b/%Y:%H:%M:%S ", tm_now); 
                sprintf (tempbuf + strlen(tempbuf), "%+03d%02d", mins / 60, abs(mins) % 60); 
             }
             oldoutc = outc;
             outc += strlen(tempbuf);
-            if (outc < BUFSIZ-1) 
+            if (outc < BUFFER_SIZE-1) 
             {
                strcpy(outbuf + oldoutc, tempbuf);
             }
@@ -554,20 +558,20 @@ void log_error(int loglevel, char *fmt, ...)
    /* done with var. args */
    va_end( ap );
    
-   if (outc >= BUFSIZ-2)
+   if (outc >= BUFFER_SIZE-2)
    {
       /* insufficient room for newline and trailing null. */
 
       static const char warning[] = "... [too long, truncated]\n";
 
-      if (outc < BUFSIZ)
+      if (outc < BUFFER_SIZE)
       {
          /* Need to add terminating null in this case. */
          outbuf[outc] = '\0';
       }
 
       /* Truncate output */
-      outbuf[BUFSIZ - sizeof(warning)] = '\0';
+      outbuf[BUFFER_SIZE - sizeof(warning)] = '\0';
 
       /* Append warning */
       strcat(outbuf, warning);
index b31cb43..d6965cb 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.15 2001/06/03 19:12:00 oes Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.16 2001/06/07 23:10:26 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -38,6 +38,12 @@ const char filters_rcs[] = "$Id: filters.c,v 1.15 2001/06/03 19:12:00 oes Exp $"
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.16  2001/06/07 23:10:26  jongfoster
+ *    Allowing unanchored domain patterns to back off and retry
+ *    if they partially match.  Optimized right-anchored patterns.
+ *    Moving ACL and forward files into config file.
+ *    Replacing struct gateway with struct forward_spec
+ *
  *    Revision 1.15  2001/06/03 19:12:00  oes
  *    extracted-CGI relevant stuff
  *
@@ -944,7 +950,7 @@ const struct forward_spec * forward_url(struct http_request *http,
 struct url_spec dsplit(char *domain)
 {
    struct url_spec ret[1];
-   char *v[BUFSIZ];
+   char *v[BUFFER_SIZE];
    int size;
    char *p;
 
index 8716e16..13273f6 100644 (file)
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.1.1.1 2001/05/15 13:58:54 oes Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.2 2001/06/07 23:11:38 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -34,6 +34,17 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.1.1.1 2001/05/15 13:58:54 oes Exp
  *
  * Revisions   :
  *    $Log: gateway.c,v $
+ *    Revision 1.2  2001/06/07 23:11:38  jongfoster
+ *    Removing gateways[] list - no longer used.
+ *    Replacing function pointer in struct gateway with a directly
+ *    called function forwarded_connect(), which can do the common
+ *    task of deciding whether to connect to the web server or HTTP
+ *    proxy.
+ *    Replacing struct gateway with struct forward_spec
+ *    Fixing bug with SOCKS4A and HTTP proxy server in combination.
+ *    It was a bug which led to the connection being made to the web
+ *    server rather than the HTTP proxy, and also a buffer overrun.
+ *
  *    Revision 1.1.1.1  2001/05/15 13:58:54  oes
  *    Initial import of version 2.9.3 source tree
  *
@@ -169,8 +180,8 @@ static int socks4_connect(const struct forward_spec * fwd,
                           struct client_state *csp)
 {
    int web_server_addr;
-   unsigned char cbuf[BUFSIZ];
-   unsigned char sbuf[BUFSIZ];
+   unsigned char cbuf[BUFFER_SIZE];
+   unsigned char sbuf[BUFFER_SIZE];
    struct socks_op    *c = (struct socks_op    *)cbuf;
    struct socks_reply *s = (struct socks_reply *)sbuf;
    int n;
diff --git a/jcc.c b/jcc.c
index 102f1b0..f1f7e7e 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.18 2001/06/03 19:12:16 oes Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.19 2001/06/07 23:12:52 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,11 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.18 2001/06/03 19:12:16 oes Exp $";
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.19  2001/06/07 23:12:52  jongfoster
+ *    Replacing function pointer in struct gateway with a directly
+ *    called function forwarded_connect().
+ *    Replacing struct gateway with struct forward_spec
+ *
  *    Revision 1.18  2001/06/03 19:12:16  oes
  *    introduced new cgi handling
  *
@@ -379,7 +384,8 @@ static void chat(struct client_state *csp)
 
 #define IS_ENABLED_AND   IS_TOGGLED_ON_AND IS_NOT_FORCED_AND
 
-   char buf[BUFSIZ], *hdr, *p, *req;
+   char buf[BUFFER_SIZE];\r
+   char *hdr, *p, *req;
    char *err = NULL;
    char *eno;
    fd_set rfds;
@@ -1428,7 +1434,7 @@ static void listen_loop(void)
 
          if (child_id < 0) /* failed */
          {
-            char buf[BUFSIZ];
+            char buf[BUFFER_SIZE];
 
             log_error(LOG_LEVEL_ERROR, "can't fork: %E");
 
index 96e760a..4ce1d20 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,5 +1,5 @@
 /* vim:ts=3: */
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.14 2001/06/07 14:46:25 joergs Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.15 2001/06/07 23:13:40 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -36,6 +36,11 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.14 2001/06/07 14:46:25 joergs Exp
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.15  2001/06/07 23:13:40  jongfoster
+ *    Merging ACL and forward files into config file.
+ *    Cosmetic: Sorting config file options alphabetically.
+ *    Cosmetic: Adding brief syntax comments to config file options.
+ *
  *    Revision 1.14  2001/06/07 14:46:25  joergs
  *    Missing make_path() added for re_filterfile.
  *
@@ -433,7 +438,7 @@ void unload_configfile (void * data)
  *********************************************************************/
 struct configuration_spec * load_config(void)
 {
-   char buf[BUFSIZ];
+   char buf[BUFFER_SIZE];
    char *p, *q;
    FILE *configfp = NULL;
    struct configuration_spec * config = NULL;
@@ -496,9 +501,9 @@ struct configuration_spec * load_config(void)
 
    while (read_config_line(buf, sizeof(buf), configfp, fs) != NULL)
    {
-      char cmd[BUFSIZ];
-      char arg[BUFSIZ];
-      char tmp[BUFSIZ];
+      char cmd[BUFFER_SIZE];
+      char arg[BUFFER_SIZE];
+      char tmp[BUFFER_SIZE];
 #ifdef ACL_FILES
       struct access_control_list *cur_acl;
 #endif /* def ACL_FILES */
index 9f34331..e6edc55 100644 (file)
--- a/loaders.c
+++ b/loaders.c
@@ -1,4 +1,4 @@
-const char loaders_rcs[] = "$Id: loaders.c,v 1.14 2001/06/01 03:27:04 oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.15 2001/06/07 23:14:14 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
@@ -35,6 +35,12 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.14 2001/06/01 03:27:04 oes Exp $"
  *
  * Revisions   :
  *    $Log: loaders.c,v $
+ *    Revision 1.15  2001/06/07 23:14:14  jongfoster
+ *    Removing ACL and forward file loaders - these
+ *    files have been merged into the config file.
+ *    Cosmetic: Moving unloader funcs next to their
+ *    respective loader funcs
+ *
  *    Revision 1.14  2001/06/01 03:27:04  oes
  *    Fixed line continuation problem
  *
@@ -359,7 +365,7 @@ int create_url_spec(struct url_spec * url, char * buf)
    if (url->path)
    {
       int errcode;
-      char rebuf[BUFSIZ];
+      char rebuf[BUFFER_SIZE];
 
       if (NULL == (url->preg = zalloc(sizeof(*url->preg))))
       {
@@ -569,7 +575,7 @@ int check_file_changed(const struct file_list * current,
 char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs)
 {
    char *p, *q;
-   char linebuf[BUFSIZ];
+   char linebuf[BUFFER_SIZE];
    int contflag = 0;
 
    *buf = '\0';
@@ -692,7 +698,7 @@ int load_trustfile(struct client_state *csp)
    struct block_spec *b, *bl;
    struct url_spec **tl;
 
-   char  buf[BUFSIZ], *p, *q;
+   char  buf[BUFFER_SIZE], *p, *q;
    int reject, trusted;
    struct file_list *fs;
 
@@ -867,7 +873,7 @@ int load_re_filterfile(struct client_state *csp)
    struct re_filterfile_spec *bl;
    struct file_list *fs;
 
-   char  buf[BUFSIZ];
+   char  buf[BUFFER_SIZE];
    int error;
    pcrs_job *dummy;
 
index 8dcdd95..404602e 100644 (file)
@@ -1,5 +1,5 @@
 /* vim:ts=3: */
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.10 2001/06/07 14:51:38 joergs Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.11 2001/06/07 23:09:19 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.c,v $
@@ -37,6 +37,9 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.10 2001/06/07 14:51:38 joergs E
  *
  * Revisions   :
  *    $Log: miscutil.c,v $
+ *    Revision 1.11  2001/06/07 23:09:19  jongfoster
+ *    Cosmetic indentation changes.
+ *
  *    Revision 1.10  2001/06/07 14:51:38  joergs
  *    make_path() no longer adds '/' if the dir already ends in '/'.
  *
@@ -159,7 +162,12 @@ const char miscutil_rcs[] = "$Id: miscutil.c,v 1.10 2001/06/07 14:51:38 joergs E
 #include <malloc.h>
 #include <ctype.h>
 
-#include "miscutil.h"
+/*\r
+ * FIXME: Only need project.h for BUFFER_SIZE.  It would be nice\r
+ * to remove this dependency.\r
+ */\r
+#include "project.h"\r
+#include "miscutil.h"\r
 #include "errlog.h"
 
 const char miscutil_h_rcs[] = MISCUTIL_H_VERSION;
@@ -279,7 +287,7 @@ char *strdup( const char *s )
 char *safe_strerror(int err)
 {
    char *s = NULL;
-   char buf[BUFSIZ];
+   char buf[BUFFER_SIZE];
 
 
 #ifdef HAVE_STRERROR
index 6bd4860..e497182 100644 (file)
@@ -1,4 +1,4 @@
-const char showargs_rcs[] = "$Id: showargs.c,v 1.13 2001/06/06 09:37:59 sarantis Exp $";
+const char showargs_rcs[] = "$Id: showargs.c,v 1.14 2001/06/07 23:15:40 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/showargs.c,v $
@@ -33,6 +33,10 @@ const char showargs_rcs[] = "$Id: showargs.c,v 1.13 2001/06/06 09:37:59 sarantis
  *
  * Revisions   :
  *    $Log: showargs.c,v $
+ *    Revision 1.14  2001/06/07 23:15:40  jongfoster
+ *    Removing config->proxy_args_gateways
+ *    Missing return statement added to end_proxy_args().
+ *
  *    Revision 1.13  2001/06/06 09:37:59  sarantis
  *    Fix misplaced comment start.
  *
@@ -240,7 +244,7 @@ const char showargs_h_rcs[] = SHOWARGS_H_VERSION;
  *********************************************************************/
 void savearg(char *c, char *o, struct configuration_spec * config)
 {
-   char buf[BUFSIZ];
+   char buf[BUFFER_SIZE];
 
    *buf = '\0';
 
@@ -323,7 +327,7 @@ void init_proxy_args(int argc, const char *argv[], struct configuration_spec * c
 char *end_proxy_args(struct configuration_spec * config)
 {
    char *b = NULL;
-   char buf[BUFSIZ];
+   char buf[BUFFER_SIZE];
 
    /* Instead of including *all* dot h's in the project (thus creating a
     * tremendous amount of dependencies), I will concede to declaring them