1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 20:09:02 +00:00

o Fixed a bunch of code to avoid compilation warning messages (at

least on some Linux machines) [Andrew J. Bennieston]
This commit is contained in:
fyodor
2008-04-09 02:11:20 +00:00
parent fa9bd6be6e
commit 5551c5a311
21 changed files with 144 additions and 140 deletions

View File

@@ -6,6 +6,9 @@ o Fixed a bug on Win32 problem which caused an infinite loop when Nmap
o Fix MingW compilation by adding a signal.h include to
main.cc. [Gisle Vanem]
o Fixed a bunch of code to avoid compilation warning messages (at
least on some Linux machines) [Andrew J. Bennieston]
o Added a new --min-rate option that allows specifying a minimum rate
at which to send packets.

View File

@@ -551,7 +551,7 @@ void NmapOps::setMaxHostGroupSz(unsigned int sz) {
If this is never called, a default stylesheet distributed with
Nmap is used. If you call it with NULL as the xslname, no
stylesheet line is printed. */
void NmapOps::setXSLStyleSheet(char *xslname) {
void NmapOps::setXSLStyleSheet(const char *xslname) {
if (xsl_stylesheet) free(xsl_stylesheet);
xsl_stylesheet = xslname? strdup(xslname) : NULL;
}

View File

@@ -239,7 +239,7 @@ class NmapOps {
If this is never called, a default stylesheet distributed with
Nmap is used. If you call it with NULL as the xslname, no
stylesheet line is printed. */
void setXSLStyleSheet(char *xslname);
void setXSLStyleSheet(const char *xslname);
/* Returns the full path or URL that should be printed in the XML
output xml-stylesheet element. Returns NULL if the whole element
should be skipped */

24
nmap.cc
View File

@@ -2052,10 +2052,10 @@ void init_socket(int sd) {
* the outer part of the port expression. It's "closed".
*/
static void getpts_aux(char *origexpr, int nested, u8 *porttbl, int range_type,
static void getpts_aux(const char *origexpr, int nested, u8 *porttbl, int range_type,
int *portwarning, bool change_range_type = true);
struct scan_lists *getpts(char *origexpr) {
struct scan_lists *getpts(const char *origexpr) {
u8 *porttbl;
struct scan_lists *ports;
int range_type = 0;
@@ -2122,7 +2122,7 @@ struct scan_lists *getpts(char *origexpr) {
of ports in a struct scan_lists, it allocates only one list and stores it in
the list and count arguments. For that reason, T:, U:, and P: restrictions
are not allowed and only one bit in range_type may be set. */
void getpts_simple(char *origexpr, int range_type,
void getpts_simple(const char *origexpr, int range_type,
unsigned short **list, int *count) {
u8 *porttbl;
int portwarning = 0;
@@ -2160,15 +2160,15 @@ void getpts_simple(char *origexpr, int range_type,
/* getpts() and getpts_simple() (see above) are wrappers for this function */
static void getpts_aux(char *origexpr, int nested, u8 *porttbl, int range_type, int *portwarning, bool change_range_type) {
static void getpts_aux(const char *origexpr, int nested, u8 *porttbl, int range_type, int *portwarning, bool change_range_type) {
long rangestart = -2343242, rangeend = -9324423;
char *current_range;
const char *current_range;
char *endptr;
char servmask[128]; // A protocol name can be up to 127 chars + nul byte
int i;
/* An example of proper syntax to use in error messages. */
char *syntax_example;
const char *syntax_example;
if (change_range_type)
syntax_example = "-100,200-1024,T:3000-4000,U:60000-";
else
@@ -2385,7 +2385,7 @@ const char *seqidx2difficultystr(unsigned long idx) {
}
char *seqclass2ascii(int seqclass) {
const char *seqclass2ascii(int seqclass) {
switch(seqclass) {
case SEQ_CONSTANT:
return "constant sequence number (!)";
@@ -2406,7 +2406,7 @@ char *seqclass2ascii(int seqclass) {
}
}
char *ipidclass2ascii(int seqclass) {
const char *ipidclass2ascii(int seqclass) {
switch(seqclass) {
case IPID_SEQ_CONSTANT:
return "Duplicated ipid (!)";
@@ -2427,7 +2427,7 @@ char *ipidclass2ascii(int seqclass) {
}
}
char *tsseqclass2ascii(int seqclass) {
const char *tsseqclass2ascii(int seqclass) {
switch(seqclass) {
case TS_SEQ_ZERO:
return "zero timestamp";
@@ -2452,7 +2452,7 @@ char *tsseqclass2ascii(int seqclass) {
/* Just a routine for obtaining a string for printing based on the scantype */
char *scantype2str(stype scantype) {
const char *scantype2str(stype scantype) {
switch(scantype) {
case STYPE_UNKNOWN: return "Unknown Scan Type"; break;
@@ -2484,7 +2484,7 @@ char *scantype2str(stype scantype) {
}
char *statenum2str(int state) {
const char *statenum2str(int state) {
switch(state) {
case PORT_OPEN: return "open"; break;
case PORT_FILTERED: return "filtered"; break;
@@ -2670,7 +2670,7 @@ int nmap_fileexistsandisreadable(char* pathname) {
return fileexistsandisreadable(pathname);
}
int nmap_fetchfile(char *filename_returned, int bufferlen, char *file) {
int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file) {
char *dirptr;
int res;
int foundsomething = 0;

16
nmap.h
View File

@@ -410,8 +410,8 @@ void printinteractiveusage();
int ftp_anon_connect(struct ftpinfo *ftp);
/* port manipulators */
struct scan_lists *getpts(char *expr); /* someone stole the name getports()! */
void getpts_simple(char *origexpr, int range_type,
struct scan_lists *getpts(const char *expr); /* someone stole the name getports()! */
void getpts_simple(const char *origexpr, int range_type,
unsigned short **list, int *count);
void free_scan_lists(struct scan_lists *ports);
@@ -425,21 +425,21 @@ void nmap_free_mem();
/* general helper functions */
int parse_targets(struct targets *targets, char *h);
char *statenum2str(int state);
char *scantype2str(stype scantype);
const char *statenum2str(int state);
const char *scantype2str(stype scantype);
void sigdie(int signo);
void reaper(int signo);
char *seqreport(struct seq_info *seq);
char *seqreport1(struct seq_info *seq);
char *seqclass2ascii(int clas);
char *ipidclass2ascii(int seqclass);
char *tsseqclass2ascii(int seqclass);
const char *seqclass2ascii(int clas);
const char *ipidclass2ascii(int seqclass);
const char *tsseqclass2ascii(int seqclass);
/* Convert a TCP sequence prediction difficulty index like 1264386
into a difficulty string like "Worthy Challenge */
const char *seqidx2difficultystr(unsigned long idx);
const char *seqidx2difficultystr1(unsigned long idx);
int nmap_fetchfile(char *filename_returned, int bufferlen, char *file);
int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file);
int nmap_fileexistsandisreadable(char* pathname);
int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv);

View File

@@ -965,7 +965,7 @@ static void parse_resolvdotconf() {
}
static void parse_etchosts(char *fname) {
static void parse_etchosts(const char *fname) {
FILE *fp;
char buf[2048], hname[256], ipaddrstr[16], *tp;
struct in_addr ia;
@@ -1071,7 +1071,7 @@ static char *lookup_etchosts(u32 ip) {
/* External interface to dns cache */
const char *lookup_cached_host(u32 ip) {
const char *tmp = lookup_etchosts(ip);
return tmp==NULL?"":tmp;
return tmp;
}
static void etchosts_init(void) {

View File

@@ -67,8 +67,8 @@ int l_nsock_check_buf(lua_State* l);
int l_nsock_checkstatus(lua_State* l, nsock_event nse);
void l_nsock_trace(nsock_iod nsiod, char* message, int direction);
char* inet_ntop_both(int af, const void* v_addr, char* ipstring);
void l_nsock_trace(nsock_iod nsiod, const char* message, int direction);
const char* inet_ntop_both(int af, const void* v_addr, char* ipstring);
unsigned short inet_port_both(int af, const void* v_addr);
static luaL_reg l_nsock [] = {
@@ -246,7 +246,7 @@ static int l_nsock_connect_queued(lua_State* l) {
* is there a better way? */
int arguments = 3;
const char *how = luaL_optstring(l, 4, "");
if(how != ""){
if(*how != '\0'){
arguments = 4;
int port = luaL_optinteger(l, 5, -1);
if(port!=-1)
@@ -454,7 +454,7 @@ void l_nsock_receive_handler(nsock_pool nsp, nsock_event nse, void *lua_state) {
}
}
void l_nsock_trace(nsock_iod nsiod, char* message, int direction) {
void l_nsock_trace(nsock_iod nsiod, const char* message, int direction) {
int status;
int protocol;
int af;
@@ -486,7 +486,7 @@ void l_nsock_trace(nsock_iod nsiod, char* message, int direction) {
}
}
char* inet_ntop_both(int af, const void* v_addr, char* ipstring) {
const char* inet_ntop_both(int af, const void* v_addr, char* ipstring) {
// char* ipstring = (char*) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
if(af == AF_INET) {
@@ -965,7 +965,7 @@ char *hex(char *str, unsigned int strsz){
int ncap_restore_lua(ncap_request *nr);
void ncap_request_set_result(nsock_event nse, struct ncap_request *nr);
int ncap_request_set_results(nsock_event nse, char *key);
int ncap_request_set_results(nsock_event nse, const char *key);
void l_nsock_pcap_receive_handler(nsock_pool nsp, nsock_event nse, void *userdata);
/* next map, this time it's multimap "key"(from callback)->suspended_lua_threads */
@@ -1143,7 +1143,7 @@ void l_nsock_pcap_receive_handler(nsock_pool nsp, nsock_event nse, void *userdat
/* get data from nsock_event, and set result on ncap_requests which mach key */
int ncap_request_set_results(nsock_event nse, char *key) {
int ncap_request_set_results(nsock_event nse, const char *key) {
int this_event_restored = 0;
std::string skey = key;
@@ -1286,7 +1286,7 @@ int l_dnet_get_interface_link(lua_State* l) {
lua_pushnil(l);
return 1;
}
char *s= NULL;
const char *s= NULL;
switch(ii->device_type){
case devt_ethernet:
s = "ethernet";

View File

@@ -629,7 +629,7 @@ static bool FingerTest_lessthan(const FingerTest* a, const FingerTest* b) {
representation. Tests that are identical between more than one fingerprint
are included only once. If wrapit is true, the string is wrapped for
submission. */
char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP,
const char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP,
const struct in_addr * const addr, int distance, const u8 *mac,
int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit) {
static char str[10240];
@@ -760,7 +760,7 @@ return str;
}
}
char *fp2ascii(FingerPrint *FP) {
const char *fp2ascii(FingerPrint *FP) {
static char str[2048];
FingerPrint *current;
struct AVal *AV;
@@ -1139,7 +1139,7 @@ while(fgets(line, sizeof(line), fp)) {
return DB;
}
FingerPrintDB *parse_fingerprint_reference_file(char *dbname) {
FingerPrintDB *parse_fingerprint_reference_file(const char *dbname) {
char filename[256];
if (nmap_fetchfile(filename, sizeof(filename), dbname) != 1){

View File

@@ -1,4 +1,3 @@
/***************************************************************************
* osscan.h -- Routines used for OS detection via TCP/IP fingerprinting. *
* For more information on how this works in Nmap, see my paper at *
@@ -119,7 +118,7 @@
/* moved to global_structures.h */
/********************** PROTOTYPES ***********************************/
char *fp2ascii(FingerPrint *FP);
const char *fp2ascii(FingerPrint *FP);
/* Parses a single fingerprint from the memory region given. If a
non-null fingerprint is returned, the user is in charge of freeing it
@@ -132,7 +131,7 @@ FingerPrint *parse_single_fingerprint(char *fprint_orig);
(allocated) FingerPrintDB containing the results. They exit with
an error message in the case of error. */
FingerPrintDB *parse_fingerprint_file(char *fname);
FingerPrintDB *parse_fingerprint_reference_file(char *dbname);
FingerPrintDB *parse_fingerprint_reference_file(const char *dbname);
void free_fingerprint_file(FingerPrintDB *DB);
@@ -156,7 +155,7 @@ void match_fingerprint(FingerPrint *FP, FingerPrintResults *FPR,
/* Returns true if perfect match -- if num_subtests & num_subtests_succeeded are non_null it updates them. if shortcircuit is zero, it does all the tests, otherwise it returns when the first one fails */
void freeFingerPrint(FingerPrint *FP);
char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP, const struct in_addr * const addr, int distance, const u8 *mac, int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit);
const char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP, const struct in_addr * const addr, int distance, const u8 *mac, int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit);
#endif /*OSSCAN_H*/

View File

@@ -1563,7 +1563,7 @@ void HostOsScan::makeFP(HostOsScanStats *hss) {
received */
hss->FPtests[i] = (FingerPrint *) safe_zalloc(sizeof(FingerPrint));
pAV = (struct AVal *) safe_zalloc(sizeof(struct AVal));
pAV->attribute = "R";
pAV->attribute = (char*)"R";
strcpy(pAV->value, "N");
pAV->next = NULL;
hss->FPtests[i]->results = pAV;
@@ -1572,7 +1572,7 @@ void HostOsScan::makeFP(HostOsScanStats *hss) {
else if(hss->FPtests[i]) {
/* Replace TTL with initial TTL. */
for(pAV = hss->FPtests[i]->results; pAV; pAV = pAV->next) {
if(pAV->attribute == "T") {
if(pAV->attribute == (char*)"T") {
/* Found TTL item. The value for this attribute is the
received TTL encoded in decimal. We replace it with the
initial TTL encoded in hex. */
@@ -1588,7 +1588,7 @@ void HostOsScan::makeFP(HostOsScanStats *hss) {
sprintf(pAV->value, "%hX", ttl + hss->distance);
} else {
/* Guess the initial TTL value */
pAV->attribute = "TG";
pAV->attribute = (char*) "TG";
sprintf(pAV->value, "%hX", get_initial_ttl_guess(ttl));
}
break;
@@ -1769,13 +1769,13 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
hss->FP_TSeq->results = seq_AVs;
avnum = 0;
seq_AVs[avnum].attribute = "SP";
seq_AVs[avnum].attribute = (char*)"SP";
sprintf(seq_AVs[avnum].value, "%X", hss->si.index);
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute= "GCD";
seq_AVs[avnum].attribute = (char*)"GCD";
sprintf(seq_AVs[avnum].value, "%X", seq_gcd);
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute= "ISR";
seq_AVs[avnum].attribute = (char*)"ISR";
sprintf(seq_AVs[avnum].value, "%X", (unsigned int) seq_rate);
/* Now it is time to deal with IPIDs */
@@ -1816,32 +1816,32 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
switch(tcp_ipid_seqclass) {
case IPID_SEQ_CONSTANT:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
sprintf(seq_AVs[avnum].value, "%X", hss->ipid.tcp_ipids[0]);
break;
case IPID_SEQ_INCR:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
strcpy(seq_AVs[avnum].value, "I");
break;
case IPID_SEQ_BROKEN_INCR:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
strcpy(seq_AVs[avnum].value, "BI");
break;
case IPID_SEQ_RPI:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
strcpy(seq_AVs[avnum].value, "RI");
break;
case IPID_SEQ_RD:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
strcpy(seq_AVs[avnum].value, "RD");
break;
case IPID_SEQ_ZERO:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TI";
seq_AVs[avnum].attribute = (char*)"TI";
strcpy(seq_AVs[avnum].value, "Z");
break;
}
@@ -1850,32 +1850,32 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
switch(icmp_ipid_seqclass) {
case IPID_SEQ_CONSTANT:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
sprintf(seq_AVs[avnum].value, "%X", hss->ipid.icmp_ipids[0]);
break;
case IPID_SEQ_INCR:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
strcpy(seq_AVs[avnum].value, "I");
break;
case IPID_SEQ_BROKEN_INCR:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
strcpy(seq_AVs[avnum].value, "BI");
break;
case IPID_SEQ_RPI:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
strcpy(seq_AVs[avnum].value, "RI");
break;
case IPID_SEQ_RD:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
strcpy(seq_AVs[avnum].value, "RD");
break;
case IPID_SEQ_ZERO:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "II";
seq_AVs[avnum].attribute = (char*)"II";
strcpy(seq_AVs[avnum].value, "Z");
break;
}
@@ -1890,7 +1890,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
/* Both are incremental. Thus we have "SS" test. Check if they
are in the same sequence. */
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "SS";
seq_AVs[avnum].attribute = (char*)"SS";
int avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num-1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1);
if ( hss->ipid.icmp_ipids[0] < hss->ipid.tcp_ipids[good_tcp_ipid_num-1] + 3 * avg) {
strcpy(seq_AVs[avnum].value, "S");
@@ -1904,7 +1904,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
case TS_SEQ_ZERO:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TS";
seq_AVs[avnum].attribute = (char*)"TS";
strcpy(seq_AVs[avnum].value, "0");
break;
case TS_SEQ_2HZ:
@@ -1912,7 +1912,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
case TS_SEQ_1000HZ:
case TS_SEQ_OTHER_NUM:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TS";
seq_AVs[avnum].attribute = (char*)"TS";
/* Here we "cheat" a little to make the classes correspond more
closely to common real-life frequencies (particularly 100)
@@ -1939,7 +1939,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
break;
case TS_SEQ_UNSUPPORTED:
seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
seq_AVs[avnum].attribute = "TS";
seq_AVs[avnum].attribute = (char*)"TS";
strcpy(seq_AVs[avnum].value, "U");
break;
}
@@ -2085,22 +2085,22 @@ bool HostOsScan::processTOpsResp(HostOsScanStats *hss, struct tcp_hdr *tcp, int
switch(replyNo) {
case 0:
hss->TOps_AVs[replyNo]->attribute = "O1";
hss->TOps_AVs[replyNo]->attribute = (char*)"O1";
break;
case 1:
hss->TOps_AVs[replyNo]->attribute = "O2";
hss->TOps_AVs[replyNo]->attribute = (char*)"O2";
break;
case 2:
hss->TOps_AVs[replyNo]->attribute = "O3";
hss->TOps_AVs[replyNo]->attribute = (char*)"O3";
break;
case 3:
hss->TOps_AVs[replyNo]->attribute = "O4";
hss->TOps_AVs[replyNo]->attribute = (char*)"O4";
break;
case 4:
hss->TOps_AVs[replyNo]->attribute = "O5";
hss->TOps_AVs[replyNo]->attribute = (char*)"O5";
break;
case 5:
hss->TOps_AVs[replyNo]->attribute = "O6";
hss->TOps_AVs[replyNo]->attribute = (char*)"O6";
break;
}
@@ -2118,22 +2118,22 @@ bool HostOsScan::processTWinResp(HostOsScanStats *hss, struct tcp_hdr *tcp, int
switch(replyNo) {
case 0:
hss->TWin_AVs[replyNo]->attribute = "W1";
hss->TWin_AVs[replyNo]->attribute = (char*)"W1";
break;
case 1:
hss->TWin_AVs[replyNo]->attribute = "W2";
hss->TWin_AVs[replyNo]->attribute = (char*)"W2";
break;
case 2:
hss->TWin_AVs[replyNo]->attribute = "W3";
hss->TWin_AVs[replyNo]->attribute = (char*)"W3";
break;
case 3:
hss->TWin_AVs[replyNo]->attribute = "W4";
hss->TWin_AVs[replyNo]->attribute = (char*)"W4";
break;
case 4:
hss->TWin_AVs[replyNo]->attribute = "W5";
hss->TWin_AVs[replyNo]->attribute = (char*)"W5";
break;
case 5:
hss->TWin_AVs[replyNo]->attribute = "W6";
hss->TWin_AVs[replyNo]->attribute = (char*)"W6";
break;
}
@@ -2160,13 +2160,13 @@ bool HostOsScan::processTEcnResp(HostOsScanStats *hss, struct ip *ip) {
AVs[i].next = &AVs[i+1];
AVs[numtests-1].next = NULL;
AVs[current_testno].attribute = "R";
AVs[current_testno].attribute = (char*)"R";
strcpy(AVs[current_testno].value, "Y");
current_testno++;
/* don't frag flag */
AVs[current_testno].attribute = "DF";
AVs[current_testno].attribute = (char*)"DF";
if(ntohs(ip->ip_off) & IP_DF) {
strcpy(AVs[current_testno].value,"Y");
} else strcpy(AVs[current_testno].value, "N");
@@ -2174,19 +2174,19 @@ bool HostOsScan::processTEcnResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* TTL */
AVs[current_testno].attribute = "T";
AVs[current_testno].attribute = (char*)"T";
sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
current_testno++;
/* TCP Window size */
AVs[current_testno].attribute = "W";
AVs[current_testno].attribute = (char*)"W";
sprintf(AVs[current_testno].value, "%hX", ntohs(tcp->th_win));
current_testno++;
/* Now for the TCP options ... */
AVs[current_testno].attribute = "O";
AVs[current_testno].attribute = (char*)"O";
opsParseResult = get_tcpopt_string(tcp, this->tcpMss,
AVs[current_testno].value,
sizeof(AVs[current_testno].value));
@@ -2199,7 +2199,7 @@ bool HostOsScan::processTEcnResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* Explicit Congestion Notification support test */
AVs[current_testno].attribute = "CC";
AVs[current_testno].attribute = (char*)"CC";
if ((tcp->th_flags & TH_ECE) && (tcp->th_flags & TH_CWR))
/* echo back */
strcpy(AVs[current_testno].value,"S");
@@ -2215,7 +2215,7 @@ bool HostOsScan::processTEcnResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* TCP miscellaneous quirks test */
AVs[current_testno].attribute = "Q";
AVs[current_testno].attribute = (char*)"Q";
p = AVs[current_testno].value;
if (tcp->th_x2) {
/* Reserved field of TCP is not zero */
@@ -2263,13 +2263,13 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
/* First we give the "response" flag to say we did actually receive
a packet -- this way we won't match a template with R=N */
AVs[current_testno].attribute = "R";
AVs[current_testno].attribute = (char*)"R";
strcpy(AVs[current_testno].value, "Y");
current_testno++;
/* Next we check whether the Don't Fragment bit is set */
AVs[current_testno].attribute = "DF";
AVs[current_testno].attribute = (char*)"DF";
if(ntohs(ip->ip_off) & 0x4000) {
strcpy(AVs[current_testno].value,"Y");
} else strcpy(AVs[current_testno].value, "N");
@@ -2277,14 +2277,14 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
current_testno++;
/* TTL */
AVs[current_testno].attribute = "T";
AVs[current_testno].attribute = (char*)"T";
sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
current_testno++;
if(replyNo!=0) {
/* Now we do the TCP Window size */
AVs[current_testno].attribute = "W";
AVs[current_testno].attribute = (char*)"W";
sprintf(AVs[current_testno].value, "%hX", ntohs(tcp->th_win));
current_testno++;
@@ -2296,7 +2296,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
A+ = ack + 1
O = other
*/
AVs[current_testno].attribute = "S";
AVs[current_testno].attribute = (char*)"S";
if (ntohl(tcp->th_seq) == 0)
strcpy(AVs[current_testno].value, "Z");
else if (ntohl(tcp->th_seq) == tcpAck)
@@ -2314,7 +2314,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
S+ = syn + 1
O = other
*/
AVs[current_testno].attribute = "A";
AVs[current_testno].attribute = (char*)"A";
if (ntohl(tcp->th_ack) == 0)
strcpy(AVs[current_testno].value, "Z");
else if (ntohl(tcp->th_ack) == tcpSeqBase)
@@ -2335,7 +2335,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
S = Synchronize
F = Final
*/
AVs[current_testno].attribute = "F";
AVs[current_testno].attribute = (char*)"F";
p = AVs[current_testno].value;
if (tcp->th_flags & TH_ECE) *p++ = 'E';
if (tcp->th_flags & TH_URG) *p++ = 'U';
@@ -2350,7 +2350,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
if(replyNo!=0) {
/* Now for the TCP options ... */
AVs[current_testno].attribute = "O";
AVs[current_testno].attribute = (char*)"O";
opsParseResult = get_tcpopt_string(tcp, this->tcpMss,
AVs[current_testno].value,
sizeof(AVs[current_testno].value));
@@ -2364,7 +2364,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
}
/* Rst Data CRC16 */
AVs[current_testno].attribute = "RD";
AVs[current_testno].attribute = (char*)"RD";
length = (int) ntohs(ip->ip_len) - 4 * ip->ip_hl -4 * tcp->th_off;
if ((tcp->th_flags & TH_RST) && length>0) {
sprintf(AVs[current_testno].value, "%08lX", crc16(((u8 *)tcp) + 4 * tcp->th_off, length));
@@ -2376,7 +2376,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
current_testno++;
/* TCP miscellaneous quirks test */
AVs[current_testno].attribute = "Q";
AVs[current_testno].attribute = (char*)"Q";
p = AVs[current_testno].value;
if (tcp->th_x2) {
/* Reserved field of TCP is not zero */
@@ -2442,7 +2442,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
AVs[numtests-1].next = NULL;
/* First of all, if we got this far the response was yes */
AVs[current_testno].attribute = "R";
AVs[current_testno].attribute = (char*)"R";
strcpy(AVs[current_testno].value, "Y");
current_testno++;
@@ -2452,7 +2452,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
hss->target->FPR->osscan_closedudpport = hss->upi.dport;
/* Now let us do an easy one, Don't fragment */
AVs[current_testno].attribute = "DF";
AVs[current_testno].attribute = (char*)"DF";
if(ntohs(ip->ip_off) & 0x4000) {
strcpy(AVs[current_testno].value,"Y");
} else strcpy(AVs[current_testno].value, "N");
@@ -2460,33 +2460,33 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* TTL */
AVs[current_testno].attribute = "T";
AVs[current_testno].attribute = (char*)"T";
sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
current_testno++;
/* TOS of the response */
AVs[current_testno].attribute = "TOS";
AVs[current_testno].attribute = (char*)"TOS";
sprintf(AVs[current_testno].value, "%hX", ip->ip_tos);
current_testno++;
/* Now we look at the IP datagram length that was returned, some
machines send more of the original packet back than others */
AVs[current_testno].attribute = "IPL";
AVs[current_testno].attribute = (char*)"IPL";
sprintf(AVs[current_testno].value, "%hX", ntohs(ip->ip_len));
current_testno++;
/* unused filed not zero in Destination Unreachable Message */
AVs[current_testno].attribute = "UN";
AVs[current_testno].attribute = (char*)"UN";
sprintf(AVs[current_testno].value, "%hX", ntohl(icmp->icmp_void));
current_testno++;
/* OK, lets check the returned IP length, some systems @$@ this
up */
AVs[current_testno].attribute = "RIPL";
AVs[current_testno].attribute = (char*)"RIPL";
if(ntohs(ip2->ip_len) == 328)
strcpy(AVs[current_testno].value, "G");
else
@@ -2499,7 +2499,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
#if !defined(SOLARIS) && !defined(SUNOS) && !defined(IRIX) && !defined(HPUX)
/* Now lets see how they treated the ID we sent ... */
AVs[current_testno].attribute = "RID";
AVs[current_testno].attribute = (char*)"RID";
if (ip2->ip_id == hss->upi.ipid)
strcpy(AVs[current_testno].value, "G"); /* The good "expected" value */
else
@@ -2511,7 +2511,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
/* Let us see if the IP checksum we got back computes */
AVs[current_testno].attribute = "RIPCK";
AVs[current_testno].attribute = (char*)"RIPCK";
/* Thanks to some machines not having struct ip member ip_sum we
have to go with this BS */
checksumptr = (unsigned short *) ((char *) ip2 + 10);
@@ -2532,7 +2532,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* UDP checksum */
AVs[current_testno].attribute = "RUCK";
AVs[current_testno].attribute = (char*)"RUCK";
if (udp->uh_sum == hss->upi.udpck)
strcpy(AVs[current_testno].value, "G"); /* The "expected" good value */
else
@@ -2541,7 +2541,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
current_testno++;
/* UDP length ... */
AVs[current_testno].attribute = "RUL";
AVs[current_testno].attribute = (char*)"RUL";
if(ntohs(udp->uh_ulen) == 308)
strcpy(AVs[current_testno].value, "G"); /* The "expected" good value */
else
@@ -2557,7 +2557,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
if (*datastart != hss->upi.patternbyte) break;
datastart++;
}
AVs[current_testno].attribute = "RUD";
AVs[current_testno].attribute = (char*)"RUD";
if (datastart < dataend)
strcpy(AVs[current_testno].value, "I"); /* They fucked it up */
else
@@ -2622,7 +2622,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
AVs[i].next = &AVs[i+1];
AVs[numtests-1].next = NULL;
AVs[current_testno].attribute = "R";
AVs[current_testno].attribute = (char*)"R";
strcpy(AVs[current_testno].value, "Y");
current_testno++;
@@ -2633,7 +2633,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
* N. Both not set;
* O. Other(both different with the sender, -_-b).
*/
AVs[current_testno].attribute = "DFI";
AVs[current_testno].attribute = (char*)"DFI";
value1 = (ntohs(ip1->ip_off) & IP_DF);
value2 = (ntohs(ip2->ip_off) & IP_DF);
if (value1 && value2)
@@ -2652,7 +2652,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
/* TTL */
AVs[current_testno].attribute = "T";
AVs[current_testno].attribute = (char*)"T";
sprintf(AVs[current_testno].value, "%d", ip1->ip_ttl);
current_testno++;
@@ -2663,7 +2663,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
* S. Both use the TOS that the sender uses;
* O. Other.
*/
AVs[current_testno].attribute = "TOSI";
AVs[current_testno].attribute = (char*)"TOSI";
value1 = ip1->ip_tos;
value2 = ip2->ip_tos;
if (value1 == value2){
@@ -2685,7 +2685,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
* S. Both use the Code that the sender uses;
* O. Other.
*/
AVs[current_testno].attribute = "CD";
AVs[current_testno].attribute = (char*)"CD";
value1 = icmp1->icmp_code;
value2 = icmp2->icmp_code;
if (value1 == value2){
@@ -2708,7 +2708,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
* S. Both use the Seq value that the sender uses;
* O. Other.
*/
AVs[5].attribute = "SI";
AVs[5].attribute = (char*)"SI";
value1 = ntohs(icmp1->icmp_seq);
value2 = ntohs(icmp2->icmp_seq);
if (value1 == value2) {
@@ -2736,7 +2736,7 @@ bool HostOsScan::processTIcmpResp(HostOsScanStats *hss, struct ip *ip, int reply
* S. Both the same with the sender;
* O. Other.
*/
AVs[current_testno].attribute = "DLI";
AVs[current_testno].attribute = (char*)"DLI";
value1 = ntohs(ip1->ip_len) - 4 * ip1->ip_hl - 8;
value2 = ntohs(ip2->ip_len) - 4 * ip2->ip_hl - 8;
if (value1 == value2){

View File

@@ -123,7 +123,7 @@ namespace std {};
using namespace std;
extern NmapOps o;
static char *logtypes[LOG_NUM_FILES]=LOG_NAMES;
static const char *logtypes[LOG_NUM_FILES]=LOG_NAMES;
/* Used in creating skript kiddie style output. |<-R4d! */
static void skid_output(char *s)
@@ -430,7 +430,7 @@ void printportoutput(Target *currenths, PortList *plist) {
char grepvers[256];
char grepown[64];
char *p;
char *state;
const char *state;
char serviceinfo[64];
char *name=NULL;
int i;
@@ -761,9 +761,9 @@ char* formatScriptOutput(struct script_scan_result ssr) {
int line = 0;
#ifdef WIN32
char* sep = "\r\n";
const char* sep = "\r\n";
#else
char* sep = "\n";
const char* sep = "\n";
#endif
std::string line_prfx = "| ";
@@ -806,7 +806,7 @@ char* xml_convert (const char* str) {
temp = (char *) safe_malloc(strl*6+1);
char *end = temp + strl * 6 + 1;
for (p = temp;(prevch = ch, ch = *str);str++) {
char *a;
const char *a;
switch (ch) {
case '\t':
a = "&#x9;";
@@ -1146,7 +1146,7 @@ void output_ports_to_machine_parseable_output(struct scan_lists *ports,
}
/* Simple helper function for output_xml_scaninfo_records */
static void doscaninfo(char *type, char *proto, unsigned short *ports,
static void doscaninfo(const char *type, const char *proto, unsigned short *ports,
int numports) {
log_write(LOG_XML, "<scaninfo type=\"%s\" protocol=\"%s\" numservices=\"%d\" services=\"", type, proto, numports);
output_rangelist_given_ports(LOG_XML, ports, numports);
@@ -1359,9 +1359,9 @@ static void printosclassificationoutput(const struct OS_Classification_Results *
// Now to create the fodder for normal output
for (classno=0; classno < OSR->OSC_num_matches; classno++) {
/* We have processed enough if any of the following are true */
if (!guess && OSR->OSC_Accuracy[classno] < 1.0 ||
if ((!guess && OSR->OSC_Accuracy[classno] < 1.0) ||
OSR->OSC_Accuracy[classno] <= OSR->OSC_Accuracy[0] - 0.1 ||
OSR->OSC_Accuracy[classno] < 1.0 && classno > 9)
(OSR->OSC_Accuracy[classno] < 1.0 && classno > 9))
break;
if (addtochararrayifnew(types, &numtypes, MAX_OS_CLASSMEMBERS, OSR->OSC[classno]->Device_Type) == -1)
overflow = 1;
@@ -1738,7 +1738,7 @@ void printserviceinfooutput(Target *currenths) {
char hostname_tbl[MAX_SERVICE_INFO_FIELDS][MAXHOSTNAMELEN];
char ostype_tbl[MAX_SERVICE_INFO_FIELDS][64];
char devicetype_tbl[MAX_SERVICE_INFO_FIELDS][64];
char *delim;
const char *delim;
for (i=0; i<MAX_SERVICE_INFO_FIELDS; i++)
hostname_tbl[i][0] = ostype_tbl[i][0] = devicetype_tbl[i][0] = '\0';
@@ -1990,7 +1990,7 @@ void printdatafilepaths() {
/* If all the files were from the same directory and we're in verbose mode,
print a brief message unless we are also in debugging mode. */
log_write(LOG_PLAIN, "Read data files from: %s\n", dir.c_str());
} else if (num_dirs == 1 && o.debugging || num_dirs > 1) {
} else if ( (num_dirs == 1 && o.debugging) || num_dirs > 1) {
/* If files were read from more than one directory, or if they were read
from one directory and we are in debugging mode, display all the files
grouped by directory. */

View File

@@ -113,7 +113,7 @@ extern NmapOps o;
class PortList;
/* Possible plural and singular reasons */
char *reason_text[ER_MAX+1]={
const char *reason_text[ER_MAX+1]={
"reset", "conn-refused", "syn-ack", "syn-ack", "udp-response",
"proto-response", "perm-denied",
"net-unreach", "host-unreach", "proto-unreach",
@@ -125,7 +125,7 @@ char *reason_text[ER_MAX+1]={
"no-response", "localhost-response", "script-set", "unknown-response"
};
char *reason_pl_text[ER_MAX+1]={
const char *reason_pl_text[ER_MAX+1]={
"resets", "conn-refused", "syn-acks", "syn-acks", "udp-responses",
"proto-responses", "perm-denieds",
"net-unreaches", "host-unreaches", "proto-unreaches",
@@ -317,7 +317,7 @@ void state_reason_init(state_reason_t *reason) {
void print_state_summary(PortList *Ports, unsigned short type) {
state_reason_summary_t *reason_head, *currentr;
bool first_time = true;
char *separator = ", ";
const char *separator = ", ";
int states;
if((reason_head = print_state_summary_internal(Ports, 0)) == NULL)

View File

@@ -286,7 +286,7 @@ public:
/* Returns true if the given tryno and pingseq match those within this
probe. */
bool check_tryno_pingseq(unsigned int tryno, unsigned int pingseq) {
return pingseq == 0 && tryno >= this->tryno || pingseq > 0 && pingseq == this->pingseq;
return (pingseq == 0 && tryno >= this->tryno) || (pingseq > 0 && pingseq == this->pingseq);
}
u8 tryno; /* Try (retransmission) number of this probe */

View File

@@ -216,7 +216,7 @@ private:
// written if there is enough space. Otherwise it exits.
void addServiceChar(char c, int wrapat);
// Like addServiceChar, but for a whole zero-terminated string
void addServiceString(char *s, int wrapat);
void addServiceString(const char *s, int wrapat);
vector<ServiceProbe *>::iterator current_probe;
u8 *currentresp;
int currentresplen;
@@ -1354,7 +1354,7 @@ ServiceNFO::~ServiceNFO() {
// Adds a character to servicefp. Takes care of word wrapping if
// necessary at the given (wrapat) column. Chars will only be
// written if there is enough space. Otherwise it exits.
void ServiceNFO::addServiceChar(char c, int wrapat) {
void ServiceNFO::addServiceChar(const char c, int wrapat) {
if (servicefpalloc - servicefplen < 6)
fatal("%s - out of space for servicefp", __func__);
@@ -1369,7 +1369,7 @@ void ServiceNFO::addServiceChar(char c, int wrapat) {
}
// Like addServiceChar, but for a whole zero-terminated string
void ServiceNFO::addServiceString(char *s, int wrapat) {
void ServiceNFO::addServiceString(const char *s, int wrapat) {
while(*s)
addServiceChar(*s++, wrapat);
}
@@ -2136,7 +2136,7 @@ static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *myda
// example, if we read more data for the same probe response
// it will probably still match.
} else {
if (o.debugging > 1)
if (o.debugging > 1) {
if (MD->product || MD->version || MD->info)
log_write(LOG_PLAIN, "Service scan match (Probe %s matched with %s): %s:%hi is %s%s. Version: |%s|%s|%s|\n",
probe->getName(), (*probe->fallbacks[fallbackDepth]).getName(),
@@ -2148,6 +2148,7 @@ static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *myda
(MD->isSoft)? "soft" : "hard",
probe->getName(), (*probe->fallbacks[fallbackDepth]).getName(),
svc->target->NameIP(), svc->portno, (svc->tunnel == SERVICE_TUNNEL_SSL)? "SSL/" : "", MD->serviceName);
}
svc->probe_matched = MD->serviceName;
if (MD->product)
Strncpy(svc->product_matched, MD->product, sizeof(svc->product_matched));

View File

@@ -130,7 +130,7 @@ static inline int gethostnum(Target *hostbatch[], Target *target) {
return 0; // Unreached
}
char *readhoststate(int state) {
const char *readhoststate(int state) {
switch(state) {
case HOST_UP:
return "HOST_UP";
@@ -228,7 +228,7 @@ static int hostInExclude(struct sockaddr *checksock, size_t checksocklen,
/* For Netmasks simply compare the network bits and move to the next
* group if it does not compare, we don't care about the individual addrs */
if (targets_type == TargetGroup::IPV4_NETMASK) {
mask = htonl((unsigned long) (0-1) << 32-exclude_group[i].get_mask());
mask = htonl((unsigned long) (0-1) << (32-exclude_group[i].get_mask()));
if ((tmpTarget & mask) == (checkhost->sin_addr.s_addr & mask)) {
exclude_group[i].rewind();
return 1;
@@ -610,11 +610,12 @@ if (hs->randomize) {
hs->hostbatch[i]->reason.reason_id = ER_LOCALHOST;
}
}
} else if (!arpping_done)
} else if (!arpping_done) {
if (pingtype & PINGTYPE_ARP) /* A host that we can't arp scan ... maybe localhost */
massping(hs->hostbatch, hs->current_batch_sz, DEFAULT_PING_TYPES);
else
massping(hs->hostbatch, hs->current_batch_sz, pingtype);
}
if (!o.noresolve) nmap_mass_rdns(hs->hostbatch, hs->current_batch_sz);

View File

@@ -450,7 +450,7 @@ static const char *ippackethdrinfo(const u8 *packet, u32 len) {
Snprintf(ipinfo, sizeof(ipinfo), "ttl=%d id=%d iplen=%d%s %s%s%s",
ip->ip_ttl, ntohs(ip->ip_id), ntohs(ip->ip_len), fragnfo,
ip->ip_hl==5?"":"ipopts={",
ip->ip_hl==5?"":print_ip_options((u8*)ip + sizeof(struct ip), MIN((ip->ip_hl-5)*4,len-sizeof(struct ip))),
ip->ip_hl==5?"":print_ip_options((u8*)ip + sizeof(struct ip), MIN((unsigned)(ip->ip_hl-5)*4,len-sizeof(struct ip))),
ip->ip_hl==5?"":"}");
if (ip->ip_p == IPPROTO_TCP) {
@@ -1312,7 +1312,7 @@ int send_frag_ip_packet(int sd, struct eth_nfo *eth, u8 *packet,
return res;
}
static int Sendto(char *functionname, int sd, const unsigned char *packet,
static int Sendto(const char *functionname, int sd, const unsigned char *packet,
int len, unsigned int flags, struct sockaddr *to, int tolen) {
struct sockaddr_in *sin = (struct sockaddr_in *) to;
@@ -2473,7 +2473,7 @@ bool setTargetNextHopMAC(Target *target) {
/* Set a pcap filter */
void set_pcap_filter(const char *device,
pcap_t *pd, char *bpf, ...)
pcap_t *pd, const char *bpf, ...)
{
va_list ap;
char buf[3072];

View File

@@ -760,7 +760,7 @@ int recvtime(int sd, char *buf, int len, int seconds, int *timedout);
/* Sets a pcap filter function -- makes SOCK_RAW reads easier */
#ifndef WINIP_H
void set_pcap_filter(const char *device, pcap_t *pd, char *bpf, ...);
void set_pcap_filter(const char *device, pcap_t *pd, const char *bpf, ...);
#endif
#endif /*TCPIP_H*/

View File

@@ -388,7 +388,7 @@ bool RateMeter::isSet(const struct timeval *tv) {
return tv->tv_sec != 0 || tv->tv_usec != 0;
}
ScanProgressMeter::ScanProgressMeter(char *stypestr) {
ScanProgressMeter::ScanProgressMeter(const char *stypestr) {
scantypestr = strdup(stypestr);
gettimeofday(&begin, NULL);
last_print_test = begin;

View File

@@ -168,7 +168,7 @@ class RateMeter {
class ScanProgressMeter {
public:
/* A COPY of stypestr is made and saved for when stats are printed */
ScanProgressMeter(char *stypestr);
ScanProgressMeter(const char *stypestr);
~ScanProgressMeter();
/* Decides whether a timing report is likely to even be
printed. There are stringent limitations on how often they are

View File

@@ -743,7 +743,7 @@ Traceroute::sendProbe (TraceProbe * tp) {
tg->setState (G_ALIVE_TTL);
return -1;
}
if (!tg->ttl || tg->gotReply && tg->noDistProbe) {
if (!tg->ttl || (tg->gotReply && tg->noDistProbe) ) {
tg->setState (G_FINISH);
return 0;
}
@@ -1135,7 +1135,7 @@ Traceroute::outputXMLTrace(TraceGroup * tg) {
addr.s_addr = commonPath[ttl_count];
log_write(LOG_XML, "<hop ttl=\"%d\" rtt=\"--\" ", ttl_count);
log_write(LOG_XML, "ipaddr=\"%s\"", inet_ntoa(addr));
if((hostname_tmp = lookup_cached_host(commonPath[ttl_count])) != "")
if((hostname_tmp = lookup_cached_host(commonPath[ttl_count])) != NULL)
log_write(LOG_XML, " host=\"%s\"", hostname_tmp);
log_write(LOG_XML, "/>\n");
}
@@ -1502,7 +1502,7 @@ hostStr (u32 ip) {
memset (nameipbuf, '\0', MAXHOSTNAMELEN + INET6_ADDRSTRLEN);
addr.s_addr = ip;
if((hname = lookup_cached_host(ip)) == "")
if((hname = lookup_cached_host(ip)) == NULL)
Snprintf(nameipbuf, MAXHOSTNAMELEN+INET6_ADDRSTRLEN, "%s", inet_ntoa(addr));
else
Snprintf (nameipbuf, MAXHOSTNAMELEN + INET6_ADDRSTRLEN, "%s (%s)", hname, inet_ntoa (addr));

View File

@@ -704,7 +704,7 @@ void bintohexstr(char *buf, int buflen, char *src, int srclen){
bp += Snprintf(buf+bp, buflen-bp,"\n");
}
static inline char* STRAPP(char *fmt, ...) {
static inline char* STRAPP(const char *fmt, ...) {
static char buf[256];
static int bp;
int left = (int)sizeof(buf)-bp;