Nmap Development mailing list archives

Re: max-retries not playing well


From: Jon Passki <jon.passki () hursk com>
Date: Sun, 2 Jul 2006 13:38:29 -0500

(Gratuitous self-reply because of stupidity )

On Jul 2, 2006, at 11:45 AM, Jon Passki wrote:

(Gratuitous self-reply)

On Jun 30, 2006, at 12:56 PM, Jon Passki wrote:


[snipped]

Ah ha!!!  Found the bug :-)  Scoping issue caused by casting
pre_max_retries twice in nmap_main()

--- nmap.cc     2006-07-02 11:42:34.000000000 -0500
+++ nmap.cc.orig        2006-07-02 11:31:30.000000000 -0500
@@ -685,7 +685,7 @@
         if (l < 0) fatal("--max-scan-delay cannot be negative.");
         pre_max_scan_delay = l;
        } else if (optcmp(long_options[option_index].name, "max-
retries") == 0) {
-        pre_max_retries = atoi(optarg);
+        int pre_max_retries = atoi(optarg);
          if (pre_max_retries < 0)
            fatal("max-retransmissions must be positive");
        } else if (optcmp(long_options[option_index].name, "randomize-
hosts") == 0


begin 644 nmap.cc.patch
M+2TM(&YM87`N8V,),C`P-BTP-RTP,B`Q,3HT,CHS-"XP,#`P,#`P,#`@+3`U
M,#`**RLK(&YM87`N8V,N;W)I9PDR,#`V+3`W+3`R(#$Q.C,Q.C,P+C`P,#`P
M,#`P,"`M,#4P,`I`0"`M-C@U+#<@*S8X-2PW($!`"B`):68@*&P@/"`P*2!F
M871A;"@B+2UM87@M<V-A;BUD96QA>2!C86YN;W0@8F4@;F5G871I=F4N(BD[
M"B`)<')E7VUA>%]S8V%N7V1E;&%Y(#T@;#L*("`@("`@('T@96QS92!I9B`H
M;W!T8VUP*&QO;F=?;W!T:6]N<UMO<'1I;VY?:6YD97A=+FYA;64L(")M87@M
M<F5T<FEE<R(I(#T](#`I('L*+2`@("`@("`@<')E7VUA>%]R971R:65S(#T@
M871O:2AO<'1A<F<I.PHK("`@("`@("!I;G0@<')E7VUA>%]R971R:65S(#T@
M871O:2AO<'1A<F<I.PH@("`@("`@("!I9B`H<')E7VUA>%]R971R:65S(#P@
M,"D*("`@("`@("`@("!F871A;"@B;6%X+7)E=')A;G-M:7-S:6]N<R!M=7-T
M(&)E('!O<VET:79E(BD["B`@("`@("!](&5L<V4@:68@*&]P=&-M<"AL;VYG
M7V]P=&EO;G-;;W!T:6]N7VEN9&5X72YN86UE+"`B<F%N9&]M:7IE+6AO<W1S
((BD@/3T@,`H`
`
end

Okay, I blame it on the lack of coffee...  I had the files reversed  
in the previous patch...

diff -u nmap.cc.orig nmap.cc
--- nmap.cc.orig        2006-07-02 13:35:55.000000000 -0500
+++ nmap.cc     2006-07-02 13:36:09.000000000 -0500
@@ -685,7 +685,7 @@
         if (l < 0) fatal("--max-scan-delay cannot be negative.");
         pre_max_scan_delay = l;
        } else if (optcmp(long_options[option_index].name, "max- 
retries") == 0) {
-        int pre_max_retries = atoi(optarg);
+        pre_max_retries = atoi(optarg);
          if (pre_max_retries < 0)
            fatal("max-retransmissions must be positive");
        } else if (optcmp(long_options[option_index].name, "randomize- 
hosts") == 0


diff -u nmap.cc.orig nmap.cc | uuencode nmap.cc.patch
begin 644 nmap.cc.patch
M+2TM(&YM87`N8V,N;W)I9PDR,#`V+3`W+3`R(#$S.C,U.C4U+C`P,#`P,#`P
M,"`M,#4P,`HK*RL@;FUA<"YC8PDR,#`V+3`W+3`R(#$S.C,V.C`Y+C`P,#`P
M,#`P,"`M,#4P,`I`0"`M-C@U+#<@*S8X-2PW($!`"B`):68@*&P@/"`P*2!F
M871A;"@B+2UM87@M<V-A;BUD96QA>2!C86YN;W0@8F4@;F5G871I=F4N(BD[
M"B`)<')E7VUA>%]S8V%N7V1E;&%Y(#T@;#L*("`@("`@('T@96QS92!I9B`H
M;W!T8VUP*&QO;F=?;W!T:6]N<UMO<'1I;VY?:6YD97A=+FYA;64L(")M87@M
M<F5T<FEE<R(I(#T](#`I('L*+2`@("`@("`@:6YT('!R95]M87A?<F5T<FEE
M<R`](&%T;VDH;W!T87)G*3L**R`@("`@("`@<')E7VUA>%]R971R:65S(#T@
M871O:2AO<'1A<F<I.PH@("`@("`@("!I9B`H<')E7VUA>%]R971R:65S(#P@
M,"D*("`@("`@("`@("!F871A;"@B;6%X+7)E=')A;G-M:7-S:6]N<R!M=7-T
M(&)E('!O<VET:79E(BD["B`@("`@("!](&5L<V4@:68@*&]P=&-M<"AL;VYG
M7V]P=&EO;G-;;W!T:6]N7VEN9&5X72YN86UE+"`B<F%N9&]M:7IE+6AO<W1S
((BD@/3T@,`H`
`
end




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


Current thread: