Nmap Development mailing list archives

sysconfdir var fix


From: David Suarez <oxia.eikichi () gmail com>
Date: Mon, 5 Sep 2011 16:01:59 +0200


On Thu, Sep 01, 2011 at 06:17:54PM +0200, Oxia Eikichi wrote:
Atached a patch to apply the path of (configure generated) sysconfdir
(/etc
by

default) in source code. Dont sure if it is of real utility for all, but
take

a look. Thanks.


Thanks, this looks like a good idea. A few things, though:

For me, the default is not /etc but /usr/local/etc. I think this will
cause problems.


A mistake its /usr/local/etc, my fault, you are right.

Can you find a way to make it work on Windows? Windows doesn't use
configure nor Makefile. Instead, I think you have to define it in
nmap_winconfig.h.


Correct me if i´m wrong... In Windows you can find "hosts", "protocol" and
"services" files in "WINDOWS/system32/drivers/etc/", except for the
"/etc/rpc" and "/etc/resolv.conf" files that don´t have any equivalent in
Windows, so i dont see the point to let change the locations of this files.
We could fix "nmap_services_init()", "etchosts_init()" to use a consistent
method for search of this files ( the code in this two functions is
duplicate ) and fix "nmap_protocols_init()" to search the file there (is
looking for it in "/etc/protocols").

Do you see any place in the other projects (ncat, nsock, nping, zenmap)
that need such a replacement too? We should do it in all of them if we
do it in any of them.


The others projects don´t need any patch. Only libpcap need it, patch
attached and i will send it to upstream.


You can avoid Snprintf and temporary buffers by using the compilers
string literal concatenation:
-  fp = fopen("/etc/resolv.conf", "r");
+  fp = fopen(SYSCONFDIR "/resolv.conf", "r");

David Fifield


Done :)

Thanks

Attachment: fix-sysconfdir-libpcap.patch
Description:

Attachment: fix-sysconfdir.patch
Description:

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

Current thread: