diff --git a/Target.cc b/Target.cc index e59346eef..460754f68 100644 --- a/Target.cc +++ b/Target.cc @@ -140,7 +140,6 @@ #include #include "nbase.h" #include "NmapOps.h" -#include "utils.h" #include "nmap.h" #include "nmap_error.h" diff --git a/main.cc b/main.cc index 82cd37ca7..711ec6dd8 100644 --- a/main.cc +++ b/main.cc @@ -135,6 +135,7 @@ #include "nmap.h" #include "NmapOps.h" #include "utils.h" +#include "nmap_error.h" #ifdef MTRACE #include "mcheck.h" diff --git a/nmap_error.cc b/nmap_error.cc index e55e95ce7..7abfd5b58 100644 --- a/nmap_error.cc +++ b/nmap_error.cc @@ -143,6 +143,14 @@ extern NmapOps o; #endif /* WIN32 */ +#ifndef HAVE_STRERROR +char *strerror(int errnum) { + static char buf[1024]; + sprintf(buf, "your system is too old for strerror of errno %d\n", errnum); + return buf; +} +#endif + void fatal(const char *fmt, ...) { time_t timep; struct timeval tv; diff --git a/nmap_error.h b/nmap_error.h index ec3a9ec9c..5d1f3b3a2 100644 --- a/nmap_error.h +++ b/nmap_error.h @@ -170,6 +170,10 @@ NORETURN void pfatal(const char *err, ...) void gh_perror(const char *err, ...) __attribute__ ((format (printf, 1, 2))); +#ifndef HAVE_STRERROR +char *strerror(int errnum); +#endif + #ifdef __cplusplus } #endif diff --git a/osscan2.cc b/osscan2.cc index 10f8514c2..6e903ab1a 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -138,6 +138,7 @@ #include "tcpip.h" #include "Target.h" #include "utils.h" +#include "nmap_error.h" #include "FPEngine.h" #include "FingerPrintResults.h" #include diff --git a/osscan2.h b/osscan2.h index 1311e01a6..d6f3701de 100644 --- a/osscan2.h +++ b/osscan2.h @@ -129,8 +129,6 @@ * * ***************************************************************************/ -/* $Id: osscan.h 3636 2006-07-04 23:04:56Z fyodor $ */ - #ifndef OSSCAN2_H #define OSSCAN2_H diff --git a/output.cc b/output.cc index 9b4c66eb8..f45475bc6 100644 --- a/output.cc +++ b/output.cc @@ -146,6 +146,7 @@ #include "FingerPrintResults.h" #include "tcpip.h" #include "Target.h" +#include "nmap_error.h" #include "utils.h" #include "xml.h" #include "nbase.h" diff --git a/output.h b/output.h index 0a556a247..af429609c 100644 --- a/output.h +++ b/output.h @@ -171,7 +171,7 @@ #include "scan_lists.h" #ifndef NOLUA -#include "nse_main.h" +class ScriptResults; #endif #include class PortList; diff --git a/payload.cc b/payload.cc index b0080e83a..4e64a1a31 100644 --- a/payload.cc +++ b/payload.cc @@ -143,6 +143,7 @@ #include "nbase.h" #include "payload.h" #include "utils.h" +#include "nmap_error.h" extern NmapOps o; diff --git a/scan_engine.cc b/scan_engine.cc index 99730161f..98d0d28b4 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -147,6 +147,7 @@ #include "Target.h" #include "targets.h" #include "utils.h" +#include "nmap_error.h" #include "struct_ip.h" diff --git a/scan_engine_connect.h b/scan_engine_connect.h index 5564a6d9c..990a2ae2d 100644 --- a/scan_engine_connect.h +++ b/scan_engine_connect.h @@ -133,7 +133,10 @@ #ifndef SCAN_ENGINE_CONNECT_H #define SCAN_ENGINE_CONNECT_H -#include "scan_engine.h" +#include +class UltraProbe; +class UltraScanInfo; +class HostScanStats; UltraProbe *sendConnectScanProbe(UltraScanInfo *USI, HostScanStats *hss, u16 destport, u8 tryno, u8 pingseq); diff --git a/scan_engine_raw.h b/scan_engine_raw.h index e89aec314..2b0216a21 100644 --- a/scan_engine_raw.h +++ b/scan_engine_raw.h @@ -133,7 +133,10 @@ #ifndef SCAN_ENGINE_RAW_H #define SCAN_ENGINE_RAW_H -#include "scan_engine.h" +#include +class UltraProbe; +class UltraScanInfo; +class HostScanStats; #include class Target; diff --git a/service_scan.cc b/service_scan.cc index c184562da..167837e78 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -138,6 +138,7 @@ #include "nsock.h" #include "Target.h" #include "utils.h" +#include "nmap_error.h" #include "protocols.h" #include "scan_lists.h" diff --git a/targets.cc b/targets.cc index 956cc33a3..80c4b4dff 100644 --- a/targets.cc +++ b/targets.cc @@ -142,6 +142,7 @@ #include "scan_engine.h" #include "nmap_dns.h" #include "utils.h" +#include "nmap_error.h" #include "xml.h" extern NmapOps o; diff --git a/tcpip.cc b/tcpip.cc index 7542959c8..e33c81745 100644 --- a/tcpip.cc +++ b/tcpip.cc @@ -139,6 +139,7 @@ #include "NmapOps.h" #include "Target.h" #include "utils.h" +#include "nmap_error.h" #include "libnetutil/netutil.h" #include "struct_ip.h" diff --git a/timing.cc b/timing.cc index 6b207d176..a8b6c14a1 100644 --- a/timing.cc +++ b/timing.cc @@ -135,6 +135,7 @@ #include "timing.h" #include "NmapOps.h" #include "utils.h" +#include "nmap_error.h" #include "xml.h" #include diff --git a/utils.cc b/utils.cc index 3338123ed..27526d1f6 100644 --- a/utils.cc +++ b/utils.cc @@ -131,6 +131,7 @@ #include "nmap.h" #include "utils.h" +#include "nmap_error.h" #include "NmapOps.h" #include @@ -191,14 +192,6 @@ void nmap_hexdump(unsigned char *cp, unsigned int length) { } -#ifndef HAVE_STRERROR -char *strerror(int errnum) { - static char buf[1024]; - sprintf(buf, "your system is too old for strerror of errno %d\n", errnum); - return buf; -} -#endif - /* Like the perl equivalent, removes the terminating newline from string IF one exists. It then returns the POSSIBLY MODIFIED string. */ char *chomp(char *string) { diff --git a/utils.h b/utils.h index 7865de771..87239256f 100644 --- a/utils.h +++ b/utils.h @@ -137,8 +137,7 @@ #endif #include "nbase.h" - -#include "nmap_error.h" +#include /* Arithmatic difference modulo 2^32 */ #ifndef MOD_DIFF @@ -161,9 +160,7 @@ /* Return num if it is between min and max. Otherwise return min or max (whichever is closest to num). */ template T box(T bmin, T bmax, T bnum) { - if (bmin > bmax) - fatal("box(%d, %d, %d) called (min,max,num)", (int) bmin, (int) bmax, (int) bnum); - // assert(bmin <= bmax); + assert(bmin <= bmax); if (bnum >= bmax) return bmax; if (bnum <= bmin) @@ -190,10 +187,6 @@ void bintohexstr(char *buf, int buflen, char *src, int srclen); u8 *parse_hex_string(char *str, size_t *outlen); -#ifndef HAVE_STRERROR -char *strerror(int errnum); -#endif - int cpe_get_part(const char *cpe); char *mmapfile(char *fname, int *length, int openflags);