Nmap Development mailing list archives
[PATCH] Fix NMAP_ARGS + cmdline args handling in main.cc
From: Kris Katterjohn <kjak () ispwest com>
Date: Thu, 28 Sep 2006 23:51:53 -0500
The attached patch fixes the handling of NMAP_ARGS so that the rest of the command-line arguments nmap is called with are copied over into 'command' so they'll get passed to getopt(). As opposed to NMAP_ARGS being the only thing nmap uses for it's arguments. I ran across NMAP_ARGS in main.cc, so I wanted to test it out: # export NMAP_ARGS=-d # nmap localhost ..only to have nmap complain about not having any targets specified. This fixes that. Also, Fyodor, can you better document NMAP_ARGS? Or am I just the only one who didn't know about it? :) It's a diff against 4.20ALPHA7 Thanks, Kris Katterjohn
--- x/main.cc 2006-08-31 00:29:11.000000000 -0500
+++ y/main.cc 2006-09-28 23:31:33.000000000 -0500
@@ -212,6 +212,11 @@ int main(int argc, char *argv[]) {
if (snprintf(command, sizeof(command), "nmap %s", cptr) >= (int) sizeof(command)) {
error("Warning: NMAP_ARGS variable is too long, truncated");
}
+ /* copy rest of command-line arguments */
+ for (i = 1; i < argc && strlen(command) + strlen(argv[i]) + 1 < sizeof(command); i++) {
+ strcat(command, " ");
+ strcat(command, argv[i]);
+ }
myargc = arg_parse(command, &myargv);
if (myargc < 1) {
fatal("NMAP_ARG variable could not be parsed");
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [PATCH] Fix NMAP_ARGS + cmdline args handling in main.cc Kris Katterjohn (Sep 28)
