Bugfix: report correct library versions

Lukas Schwaighofer <[email protected]>
Newsgroups gmane.comp.security.nmap.devel
Message-ID <20170908192717.623e518a@butterfly>
Hi,

I noticed that for the libssh2 and zlib libraries, nmap always reports
the versions specified in libssh2/libssh2v.h and libz/libzv.h
respectively, even when nmap is linked against the system-wide versions
of libssh2/zlib.

I've written a small patch to address this by using the version number
provided by the libraries themselves.  After applying the patch the
libssh2/libssh2v.h and libz/libzv.h files can be dropped.

Regards
Lukas

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
ibrary-versions.patch (text/x-patch, 1.1 KB)
--- a/nmap.cc
+++ b/nmap.cc
@@ -182,11 +182,11 @@
 #endif
 
 #if HAVE_LIBSSH2
-#include "libssh2/libssh2v.h"
+#include "libssh2.h"
 #endif
 
 #if HAVE_LIBZ
-#include "libz/libzv.h"
+#include "zlib.h"
 #endif
 
 /* To get the version number only. */
@@ -2844,9 +2844,9 @@
 
 #if HAVE_LIBSSH2
 #ifdef LIBSSH2_INCLUDED
-  with.push_back(std::string("nmap-libssh2-") + get_word_or_quote(LIBSSH2_VERSION_TEXT, 1));
+  with.push_back(std::string("nmap-libssh2-") + get_word_or_quote(LIBSSH2_VERSION, 1));
 #else
-  with.push_back(std::string("libssh2-") + get_word_or_quote(LIBSSH2_VERSION_TEXT, 1));
+  with.push_back(std::string("libssh2-") + get_word_or_quote(LIBSSH2_VERSION, 1));
 #endif
 #else
   without.push_back("libssh2");
@@ -2854,9 +2854,9 @@
 
 #if HAVE_LIBZ
 #ifdef ZLIB_INCLUDED
-  with.push_back(std::string("nmap-libz-") + get_word_or_quote(LIBZ_VERSION_TEXT, 1));
+  with.push_back(std::string("nmap-libz-") + get_word_or_quote(ZLIB_VERSION, 1));
 #else
-  with.push_back(std::string("libz-") + get_word_or_quote(LIBZ_VERSION_TEXT, 1));
+  with.push_back(std::string("libz-") + get_word_or_quote(ZLIB_VERSION, 1));
 #endif
 #else
   without.push_back("libz");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.