jesred (1.2pl1-17) 02_warnings.dpatch

Summary

 tmp/dpep.Grn4T0/jesred-1.2pl1/config.c       |    8 ++++----
 tmp/dpep.Grn4T0/jesred-1.2pl1/ip_list.c      |    8 ++++----
 tmp/dpep.Grn4T0/jesred-1.2pl1/log.c          |    2 +-
 tmp/dpep.Grn4T0/jesred-1.2pl1/log.h          |    2 +-
 tmp/dpep.Grn4T0/jesred-1.2pl1/main.c         |   10 +++++-----
 tmp/dpep.Grn4T0/jesred-1.2pl1/pattern_list.c |   12 ++++++------
 tmp/dpep.Grn4T0/jesred-1.2pl1/rewrite.c      |   16 ++++++++--------
 tmp/dpep.Grn4T0/jesred-1.2pl1/util.c         |    7 ++++---
 8 files changed, 33 insertions(+), 32 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_warnings.dpatch by  <az@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: fix warnings

@DPATCH@
diff -urNad jesred-1.2pl1/config.c /tmp/dpep.Grn4T0/jesred-1.2pl1/config.c
--- jesred-1.2pl1/config.c	2003-05-25 11:09:44.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/config.c	2005-09-17 18:00:33.000000000 +1000
@@ -58,13 +58,13 @@
     fd = fopen(*file, "r");
     if(fd == NULL) {
 	token = strerror(errno);
-	log(ERROR, "unable to open local addresses file %s: %s\n",
+	mylog(ERROR, "unable to open local addresses file %s: %s\n",
 	    *file ? *file : "", token);
 	echo_mode = 1;
 	return;
     }
     
-    log(INFO, "Loading IP List from %s\n",*file);
+    mylog(INFO, "Loading IP List from %s\n",*file);
     while( !echo_mode && (fgets(buff, BUFSIZE, fd) != NULL) ) {
 	token = CleanLine(buff);
 	if ( token == NULL )
@@ -177,11 +177,11 @@
     if ( ! *file || (fd = fopen(*file, "rt")) == NULL ) {
 	echo_mode = 1;
 	token = strerror(errno);
-	log(ERROR, "unable to open redirect patterns file %s: %s\n",
+	mylog(ERROR, "unable to open redirect patterns file %s: %s\n",
 	    *file ? *file : "", token);
 	return;
     }
-    log(INFO, "Reading Patterns from config %s\n", *file);
+    mylog(INFO, "Reading Patterns from config %s\n", *file);
     
     while(!echo_mode && (fgets(buff, BUFSIZE, fd) != NULL)) {
 	
diff -urNad jesred-1.2pl1/ip_list.c /tmp/dpep.Grn4T0/jesred-1.2pl1/ip_list.c
--- jesred-1.2pl1/ip_list.c	2003-05-25 11:09:44.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/ip_list.c	2005-09-17 18:00:25.000000000 +1000
@@ -136,17 +136,17 @@
 
 #ifdef DEBUG
     if (!list) {
-	log(DEBG, "ACL: denied %s\n", inet_ntoa(address));
+	mylog(DEBG, "ACL: denied %s\n", inet_ntoa(address));
 	return IP_DENY;
     }
     for (p = list; p; p = p->next) {
 	if (ip_acl_match(address, p)) {
-	    log(DEBG, "ACL: %s %s\n", p->access==IP_DENY ? "denied" : "allowed",
+	    mylog(DEBG, "ACL: %s %s\n", p->access==IP_DENY ? "denied" : "allowed",
 		inet_ntoa(address));
 	    return p->access;
 	}
     }
-    log(DEBG, "ACL: denied %s\n", inet_ntoa(address));
+    mylog(DEBG, "ACL: denied %s\n", inet_ntoa(address));
     return IP_DENY;
 #else
     if (!list)
@@ -194,7 +194,7 @@
     a1 = a2 = a3 = a4 = 0;
     c = sscanf(ip_str, "%d.%d.%d.%d/%d", &a1, &a2, &a3, &a4, &m1);
     if (m1 < 0 || m1 > 32) {
-	log(ERROR, "addToIPACL: Ignoring invalid IP acl line '%s'\n",
+	mylog(ERROR, "addToIPACL: Ignoring invalid IP acl line '%s'\n",
 	      ip_str);
 	return;
     }
diff -urNad jesred-1.2pl1/log.c /tmp/dpep.Grn4T0/jesred-1.2pl1/log.c
--- jesred-1.2pl1/log.c	1998-05-18 01:24:54.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/log.c	2005-09-17 17:58:34.000000000 +1000
@@ -63,7 +63,7 @@
 }
 
 void
-log(log_code c, char *format, ...) {
+mylog(log_code c, char *format, ...) {
     FILE *fd;
     
     char msg[BUFSIZE];
diff -urNad jesred-1.2pl1/log.h /tmp/dpep.Grn4T0/jesred-1.2pl1/log.h
--- jesred-1.2pl1/log.h	1998-05-18 01:25:08.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/log.h	2005-09-17 17:58:17.000000000 +1000
@@ -30,7 +30,7 @@
     INFO
 } log_code;
 
-extern void log(log_code c, char *format, ...);
+extern void mylog(log_code c, char *format, ...);
 extern void closeLogs(void);
 extern void openLogs(char **, char **);
 
diff -urNad jesred-1.2pl1/main.c /tmp/dpep.Grn4T0/jesred-1.2pl1/main.c
--- jesred-1.2pl1/main.c	2003-05-25 11:09:44.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/main.c	2005-09-17 18:00:15.000000000 +1000
@@ -96,7 +96,7 @@
 	int val;
 	
 	sig_hup = 0;
-	log(INFO, "Freeing up old linked lists\n");
+	mylog(INFO, "Freeing up old linked lists\n");
 	ip_acl_destroy(&ip_list);
 	plist_destroy(&pattern_list);
 	closeLogs();
@@ -107,8 +107,8 @@
 	read_rules(&f_rules, &pattern_list);
 	
 	if(echo_mode)
-	    log(ERROR, "Invalid condition - continuing in ECHO mode\n");
-	log(INFO, "%s (PID %d) started\n", APPNAME, (int)getpid());
+	    mylog(ERROR, "Invalid condition - continuing in ECHO mode\n");
+	mylog(INFO, "%s (PID %d) started\n", APPNAME, (int)getpid());
 	
 	while((!sig_hup) && (fgets(buff, BUFSIZE, stdin) != NULL)){
 	    if(echo_mode) {
@@ -129,7 +129,7 @@
 	    if(echo_mode) {
 		puts("");
 		fflush(stdout);
-		log(ERROR, "Invalid condition - continuing in ECHO mode\n");
+		mylog(ERROR, "Invalid condition - continuing in ECHO mode\n");
 		continue;
 	    }
 	    /* find a rule for rewriting the URL */
@@ -151,7 +151,7 @@
 		    printf("%s %s %s %s\n",
 			   redirect_url, src_addr, ident, method);
 		    fflush(stdout);
-		    log(MATCH, "%s %s %s %d\n", src_addr, url, redirect_url,
+		    mylog(MATCH, "%s %s %s %d\n", src_addr, url, redirect_url,
 			val);
 		}
 	    }
diff -urNad jesred-1.2pl1/pattern_list.c /tmp/dpep.Grn4T0/jesred-1.2pl1/pattern_list.c
--- jesred-1.2pl1/pattern_list.c	2003-05-25 15:02:10.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/pattern_list.c	2005-09-17 18:00:06.000000000 +1000
@@ -80,7 +80,7 @@
     stored = sscanf(pattern, "%s %s %s", type, first, second);
 #endif
     if((stored < 2) || (stored > 4)) {
-	log(ERROR, "unable to get a pair of patterns in add_to_patterns() "
+	mylog(ERROR, "unable to get a pair of patterns in add_to_patterns() "
 	    "for [%s]\n", pattern);
 	echo_mode = 1;
 	return;
@@ -118,21 +118,21 @@
     }
   
     if(regcomp(&compiled, first, regex_flags)) {
-	log(ERROR, "Invalid regex [%s] in pattern file\n", first);
+	mylog(ERROR, "Invalid regex [%s] in pattern file\n", first);
 	echo_mode = 1;
 	return;
     }
     rpattern.cpattern = compiled;
     rpattern.pattern = (char *)malloc(sizeof(char) * (strlen(first) +1));
     if(rpattern.pattern == NULL) {
-	log(ERROR, "unable to allocate memory in add_to_patterns()\n");
+	mylog(ERROR, "unable to allocate memory in add_to_patterns()\n");
 	echo_mode = 1;
 	return;
     }
     strcpy(rpattern.pattern, first);
     rpattern.replacement = (char *)malloc(sizeof(char) * (strlen(second) +1));
     if(rpattern.replacement == NULL) {
-	log(ERROR, "unable to allocate memory in add_to_patterns()\n");
+	mylog(ERROR, "unable to allocate memory in add_to_patterns()\n");
 	echo_mode = 1;
 	return;
     }
@@ -145,7 +145,7 @@
 	rpattern.accel = get_accel(accel, &rpattern.accel_type, 
 				   rpattern.case_sensitive);
 	if(rpattern.accel == NULL) {
-	    log(ERROR, "unable to allocate memory from get_accel()\n");
+	    mylog(ERROR, "unable to allocate memory from get_accel()\n");
 	    echo_mode = 1;
 	    return;
 	}
@@ -238,7 +238,7 @@
 	curr->next = new;
     }
     if(! new) {
-	log(ERROR, "unable to allocate memory in add_to_plist()\n");
+	mylog(ERROR, "unable to allocate memory in add_to_plist()\n");
 	/* exit(3); */
 	echo_mode = 1;
 	return;
diff -urNad jesred-1.2pl1/rewrite.c /tmp/dpep.Grn4T0/jesred-1.2pl1/rewrite.c
--- jesred-1.2pl1/rewrite.c	2003-05-25 11:09:44.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/rewrite.c	2005-09-17 17:59:58.000000000 +1000
@@ -102,11 +102,11 @@
 	    if ( end[i] )
 		*end[i] = ' ';
 	}
-	log(ERROR, "incorrect input (%d): %s", c, buff);
+	mylog(ERROR, "incorrect input (%d): %s", c, buff);
 	return 1;
     }
 #ifdef DEBUG
-    log(DEBG, "Request: %s %s %s %s\n", *url, *src_addr, *ident, *method);
+    mylog(DEBG, "Request: %s %s %s %s\n", *url, *src_addr, *ident, *method);
 #endif    
     
     /* all methods must be GET or ICP_QUERY */
@@ -121,14 +121,14 @@
 	    if ( end[c] )
 		*end[c] = ' ';
 	}
-	log(DEBG, "method not \"GET\" %s\n", buff);
+	mylog(DEBG, "method not \"GET\" %s\n", buff);
 #endif	
 	return 1;
     }
 	    
     /* URL with less than 7 char is invalid */
     if(strlen(*url) <= 7) {
-	log(ERROR, "strlen url to short (%d)\n", strlen(*url));
+	mylog(ERROR, "strlen url to short (%d)\n", strlen(*url));
 	return 1;
     }
 
@@ -141,7 +141,7 @@
        it is already loaded, when squid runs - so not much waste of
        memory ;-) */
     if ( (address.s_addr = inet_addr(*src_addr)) == -1 ) {
-	log(ERROR, "client IP address not valid %s\n",
+	mylog(ERROR, "client IP address not valid %s\n",
 	    *src_addr ? *src_addr : "");
 	if ( token )
 	    *token = '/';
@@ -153,7 +153,7 @@
     /* make sure the IP source address matches that of the ones in our list */
     if( ip_access_check(address, ip) == IP_DENY ) {
 #ifdef DEBUG
-	log(DEBG, "client IP address %s not matched\n", *src_addr);
+	mylog(DEBG, "client IP address %s not matched\n", *src_addr);
 #endif  
 	return 1;
     }
@@ -190,7 +190,7 @@
 	    }
 	    if(matched) {
 #ifdef DEBUG
-		log(DEBG, "abort pattern matched: %s (rule %d)\n",
+		mylog(DEBG, "abort pattern matched: %s (rule %d)\n",
 		    url, pattern_no);
 #endif		
 		return (0 - pattern_no); /* URL matches abort file extension */
@@ -206,7 +206,7 @@
 			       curr->accel_type, 
 			       curr->case_sensitive)) {
 #ifdef DEBUG
-		    log(DEBG, "URL %s matches accelerator %s (rule %d)\n",
+		    mylog(DEBG, "URL %s matches accelerator %s (rule %d)\n",
 			url, curr->accel, pattern_no);
 #endif		    
 		    /* Now we must test for normal or extended */
diff -urNad jesred-1.2pl1/util.c /tmp/dpep.Grn4T0/jesred-1.2pl1/util.c
--- jesred-1.2pl1/util.c	1998-05-18 01:27:29.000000000 +1000
+++ /tmp/dpep.Grn4T0/jesred-1.2pl1/util.c	2005-09-17 17:58:04.000000000 +1000
@@ -100,6 +100,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <signal.h>
+#include <string.h>
 
 #include "util.h"
 #include "log.h"
@@ -109,7 +110,7 @@
 HUPhandler(int kill)
 {
     sig_hup = 1;
-    log(ERROR, "HUP received.  Reconfiguring....\n");
+    mylog(ERROR, "HUP received.  Reconfiguring....\n");
     signal(SIGHUP, HUPhandler);
 }
 
@@ -117,7 +118,7 @@
 KILLhandler(int kill)
 {
     sig_hup = 1;
-    log(ERROR, "KILL received.  Shutting down....\n");
+    mylog(ERROR, "KILL received.  Shutting down....\n");
     closeLogs();
     exit(1);
 }
@@ -150,7 +151,7 @@
         save = (char *)malloc(strlen(str) + 1);
         if ( save == NULL ) {
             perror("Problems allocating memory for a string:");
-            log(ERROR,"Problems allocating memory for \"%s\"",str);
+            mylog(ERROR,"Problems allocating memory for \"%s\"",str);
         }
         else {
             strcpy(save, str);