This is not-very-beautiful, but logically correct fix for http-proxy and
proxy-user support in freshclam. It fixes uninitialized pointers freeing,
too.
--
Best regards,
Nick
(GPG Key ID: 4396B2D0, fingerprint: 648E C3FE ACF6 A730 FF52 D717 776D 1CB0 4396 B2D0)
diff -r -U 3 clamav-20030522-orig/freshclam/manager.c
clamav-20030522/freshclam/manager.c
--- clamav-20030522-orig/freshclam/manager.c Thu Apr 24 02:46:57 2003
+++ clamav-20030522/freshclam/manager.c Wed May 28 13:55:51 2003
@@ -393,17 +393,21 @@
if(proxy) {
remotename = mmalloc(strlen(hostname) + 8);
sprintf(remotename, "http://%s", hostname);
- } else if(user) {
- int len;
- char* buf = mmalloc(strlen(user)*2+4);
- len=fmt_base64(buf,user,strlen(user));
- buf[len]='\0';
- authorization = mmalloc(strlen(buf) + 30);
- sprintf(authorization, "Proxy-Authorization: Basic %s\r\n", buf);
- free(buf);
+
+ if(user) {
+ int len;
+ char* buf = mmalloc(strlen(user)*2+4);
+ len=fmt_base64(buf,user,strlen(user));
+ buf[len]='\0';
+ authorization = mmalloc(strlen(buf) + 30);
+ sprintf(authorization, "Proxy-Authorization: Basic %s\r\n", buf);
+ free(buf);
+ } else {
+ authorization = strdup("");
+ }
} else {
- authorization = strdup("");
remotename = strdup("");
+ authorization = strdup("");
}
mprintf("Reading md5 sum (%s): ", file);
@@ -487,18 +491,22 @@
if(proxy) {
remotename = mmalloc(strlen(hostname) + 8);
sprintf(remotename, "http://%s", hostname);
- } else if(user) {
- int len;
- char* buf = mmalloc(strlen(user)*2+4);
- len=fmt_base64(buf,user,strlen(user));
- buf[len]='\0';
- authorization = mmalloc(strlen(buf) + 30);
- sprintf(authorization, "Proxy-Authorization: Basic %s\r\n", buf);
- free(buf);
+ if(user) {
+ int len;
+ char* buf = mmalloc(strlen(user)*2+4);
+ len=fmt_base64(buf,user,strlen(user));
+ buf[len]='\0';
+ authorization = mmalloc(strlen(buf) + 30);
+ sprintf(authorization, "Proxy-Authorization: Basic %s\r\n", buf);
+ free(buf);
+ } else {
+ authorization = strdup("");
+ }
} else {
- authorization = strdup("");
remotename = strdup("");
+ authorization = strdup("");
}
+
if((fd = open(file, O_WRONLY|O_CREAT|O_EXCL, 0644)) == -1) {
mprintf("@Can't open new file %s to write\n", file);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]