Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [PATCH] Don't compile non-OPENSSL code when using OPENSSL and vice versa
From: Andreas Ericsson <ae () op5 se>
Date: Tue, 28 Feb 2006 10:53:46 +0100

Kris Katterjohn wrote:
This prevents some non-OpenSSL code from being compiled when using OpenSSL and
vice versa.

Thanks,
Kris Katterjohn


--- service_scan.cc.orig      2006-02-27 15:52:56.000000000 -0600
+++ service_scan.cc   2006-02-27 15:52:59.000000000 -0600
@@ -1785,10 +1785,7 @@ static int scanThroughTunnel(nsock_pool 
     return 0;
   }
 
-#ifndef HAVE_OPENSSL
-  return 0;
-#endif
-
+#ifdef HAVE_OPENSSL
   if (svc->tunnel != SERVICE_TUNNEL_NONE) {
     // Another tunnel type has already been tried.  Let's not go recursive.
     return 0;
@@ -1808,6 +1805,9 @@ static int scanThroughTunnel(nsock_pool 
    svc->resetProbes(true);
   startNextProbe(nsp, nsi, SG, svc, true);
   return 1;
+#else
+  return 0;
+#endif
 }
 

I'd be surprised if this actually makes the binary smaller. Any sane 
compiler recognizes and removes dead code when it's as obvious as this 
(most do when it's less obvious). In fact, even code like

#define HAVE_OPENSSL 0

if (HAVE_OPENSSL && some_other_condition)
        do_fun_things();

would be left out entirely. If do_fun_things() is static and called only 
from that point (or within blocks like this), it too will be removed.

-- 
Andreas Ericsson                   andreas.ericsson () op5 se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231


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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault