Nmap Development mailing list archives

Re: Path to nmap.xsl for win32


From: jah <jah () zadkiel plus com>
Date: Wed, 24 Sep 2008 19:29:35 +0100

On 24/09/2008 00:24, David Fifield wrote:
On Sun, Sep 14, 2008 at 02:13:56AM +0100, jah wrote:
  
When writing xml output on windows the path to the stylesheet isn't
written into xml-stylesheet, only the filename.
Attached is a possible fix which uses GetModuleFileName in the same way
as is done in nmap.cc:2787.
I would like to have done something with the NMAPDATADIR declaration in
nmap_winconfig.h, but honestly don't know what to do with it.  Maybe
this will do for now...
    

How about using nmap_fetchfile to look up nmap.xsl? That would appear to
work for all platforms, without having to use any platform-specific
code. That would make the stylesheet location honor --datadir and
NMAPDIR too, which I think it should.

Can you try that approach and send another patch?
Aye, thanks for the tip.  The attached uses nmap_fetchfile and falls
back to the original behaviour if it fails.  I've tried it on win32 and
linux and it looks good to me.

Regards,

jah

--- NmapOps.cc.orig     2008-09-24 12:35:17.126125000 +0100
+++ NmapOps.cc  2008-09-24 19:21:23.874938600 +0100
@@ -247,11 +247,13 @@
   reason = false;
   if (datadir) free(datadir);
   datadir = NULL;
+  if (nmap_fetchfile(tmpxsl, sizeof(tmpxsl), "nmap.xsl") != 1) {
 #if WIN32
   Strncpy(tmpxsl, "nmap.xsl", sizeof(tmpxsl));
 #else
   Snprintf(tmpxsl, sizeof(tmpxsl), "%s/nmap.xsl", NMAPDATADIR);
 #endif
+  }
   if (xsl_stylesheet) free(xsl_stylesheet);
   xsl_stylesheet = strdup(tmpxsl);
   spoof_mac_set = false;

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: