On Friday, September 15, 2006 at 9:42 AM, Nigel Horne wrote:

> >   1) Can you describe the tool-chain you are working with on
windows?
> Visual Studio 2005
> 
> > What external packages/libraries have been configured and how were
they
> > built, where are they stored, etc?
> 
> pthread-win32

A small list, great!

You are apparently not using the pre-built library distribution since
you are currently shipping statically linked code.

> >   2) It seems that the binary files in the current clamAV.msi were
built
> > without "SUPPORT FOR DIGITAL SIGNATURES", since freshclam reports
this.
> > What are the issues and plans in this area?  Can I help?
> 
> I am yet to add GMP to the project. It is on my TODO list. You can
help
> by pointing me in the direction of the correct source version to use,
I
> hear that some are better than others ;-)

I seem to have worked out a recipe for this.  I'll document it and send
it along. 

> >   3) Are the files generated in when building clamAV.msi, merely
built
> > from the latest files from cvs.clamav.net?
> 
> Yes, but you need the patches in contrib since not all developers have
> included fixes in their code. You'll also need .vcproj files which I
can
> send you - I haven't bothered to commit them to CVS.


Please send them (or commit them to CVS).  Thanks.  Please also include
how you structure your directory tree (or Visual Studio configuration)
as to how the external libraries and include files are referenced.
Also, please describe how you apply the patch to the code from CVS
(cygwin maybe?).

> >   4) freshclam running at the start of the ClamAV service is nice,
but
> > I'd really hope that the system running ClamAV wouldn't reboot or
> > restart the ClamaAV service very often.  Meanwhile, there have been
> > virusdb updates for the last few days which have ranged from a
minimum
> > of 4 up to 8 times per day, so clearly continuously running
freshclam is
> > desirable.  What are your plans regarding getting both clamd and
> > freshclam running in the background?  Can I help?
> 
> You *should* be able to call freshclam from time to time with the
> Windows XP scheduler, however it is true that I need to get the daemon
> mode working, or modify the Windows service program to call freshclam
> from time to time.


Hmm...  Since your existing service merely runs the base clamd or
freshclam executable in another process, it would seem you could avoid
recreating the scheduling issues already included in freshclam by
starting the separate process as "%clamavpath%\freshclam.exe --daemon",
with the freshclam.conf Foreground set to True.  A remaining issue would
be how gracefully to stop the freshclam process.  A windows API is
available which is equivalent to "kill -INT".  This API is:
        GenerateConsoleCtrlEvent(CTRL_C_EVENT, dwProcessId);

I'm not sure why running the existing freshclam with the --daemon
argument doesn't run continuously right now (even when invoked from the
command line).  I get the expected behavior when I run a cygwin version
of freshclam with the same arguments and freshclam.conf Foreground set
to true.  I'll explore this when I can build what is running..


Meanwhile, I notice via network traces and examining
contrib/Windows/Projects/clamAV/patches that freshclam is not currently
doing DNS queries to get database version information.  The attached
patch provides this functionality on windows.

- Mark Pizzolato


Only in clamav-devel-20060915.win32dns: confdefs.h
diff -c -r -X excluding.txt clamav-devel-20060915/freshclam/dns.c 
clamav-devel-20060915.win32dns/freshclam/dns.c
*** clamav-devel-20060915/freshclam/dns.c       Wed Sep 13 18:30:05 2006
--- clamav-devel-20060915.win32dns/freshclam/dns.c      Sat Sep 16 04:48:20 2006
***************
*** 47,52 ****
--- 47,53 ----
        int len, exp, cttl, size, txtlen, type, qtype;
  
  
+     *ttl = 0;
      if(res_init() < 0) {
        logg("^res_init failed\n");
        return NULL;
***************
*** 106,112 ****
  
      pt += INT16SZ; /* class */
      GETLONG(cttl, pt);
-     *ttl = cttl;
      GETSHORT(size, pt);
      txtlen = *pt;
  
--- 107,112 ----
***************
*** 121,126 ****
--- 121,160 ----
      pt++;
      strncpy(txt, pt, txtlen);
      txt[txtlen] = 0;
+     *ttl = cttl;
+ 
+     return txt;
+ }
+ 
+ #elif defined(C_WINDOWS)
+ 
+ /*
+  * Note: Needs to link with dnsapi.lib.  
+  * The dll behind this library is available from Windows 2000 onward.
+  */
+ 
+ #include <string.h>
+ #include <windows.h>
+ #include <windns.h>
+ 
+ char *txtquery(const char *domain, unsigned int *ttl)
+ {
+       PDNS_RECORD pDnsRecord;
+       char *txt = NULL;
+ 
+     *ttl = 0;
+     mprintf("*Querying %s\n", domain);
+ 
+     if(DnsQuery(domain, DNS_TYPE_TEXT, DNS_QUERY_BYPASS_CACHE, NULL, 
&pDnsRecord, NULL))
+       return txt;
+ 
+     if(pDnsRecord->Data.TXT.dwStringCount > 0) {
+       txt = mmalloc(strlen(pDnsRecord->Data.TXT.pStringArray[0]) + 1);
+       if(txt)
+           strcpy(txt, pDnsRecord->Data.TXT.pStringArray[0]);
+       *ttl = pDnsRecord->dwTtl;
+     }
+     DnsRecordListFree(pDnsRecord, DnsFreeRecordList);
  
      return txt;
  }
***************
*** 129,134 ****
--- 163,169 ----
  
  char *txtquery(const char *domain, unsigned int *ttl)
  {
+     *ttl = 1;  /* ttl of 1 combined with a NULL return distinguishes a failed 
lookup from DNS queries not being available */
      return NULL;
  }
  
diff -c -r -X excluding.txt clamav-devel-20060915/freshclam/manager.c 
clamav-devel-20060915.win32dns/freshclam/manager.c
*** clamav-devel-20060915/freshclam/manager.c   Thu Sep 14 18:30:09 2006
--- clamav-devel-20060915.win32dns/freshclam/manager.c  Sat Sep 16 04:48:15 2006
***************
*** 971,979 ****
        char ipaddr[16], *dnsreply = NULL, *pt, *localip = NULL, *newver = NULL;
        const char *arg = NULL;
        struct cfgstruct *cpt;
- #ifdef HAVE_RESOLV_H
        const char *dnsdbinfo;
- #endif
  
      time(&currtime);
      logg("ClamAV update process started at %s", ctime(&currtime));
--- 971,977 ----
***************
*** 983,989 ****
      logg("See the FAQ at http://www.clamav.net/faq.html for an 
explanation.\n");
  #endif
  
- #ifdef HAVE_RESOLV_H
      dnsdbinfo = cfgopt(copt, "DNSDatabaseInfo")->strarg;
  
      if(opt_check(opt, "no-dns")) {
--- 981,986 ----
***************
*** 1042,1052 ****
            }
        }
  
!       if(!dnsreply) {
            logg("^Invalid DNS reply. Falling back to HTTP mode.\n");
        }
      }
- #endif /* HAVE_RESOLV_H */
  
      if(opt_check(opt, "local-address")) {
          localip = opt_arg(opt, "local-address");
--- 1039,1048 ----
            }
        }
  
!       if((!dnsreply) && (!ttl)) {
            logg("^Invalid DNS reply. Falling back to HTTP mode.\n");
        }
      }
  
      if(opt_check(opt, "local-address")) {
          localip = opt_arg(opt, "local-address");
_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-win32

Reply via email to