1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-07 06:59:03 +00:00

Give a better error message "requires root privileges" when trying to run a raw

scan on Windows with --unprivileged. Previously Nmap assumed that the only way
o.isr00t could be false on Windows was if pcap functions were not available, so
the user would get the false message "requires that WinPcap version 3.1 or
higher...". NmapOps now has a state variable have_pcap so the meaning of isr00t
isn't overloaded.
This commit is contained in:
david
2008-11-20 00:15:42 +00:00
parent a6b78f7bd4
commit b87ef8aabd
3 changed files with 10 additions and 9 deletions

View File

@@ -120,8 +120,6 @@
extern NmapOps o;
int pcap_avail = 0;
/* internal functions */
static void win_cleanup(void);
static char pcaplist[4096];
@@ -173,7 +171,7 @@ void win_init()
{
ULONG len = sizeof(pcaplist);
pcap_avail = 1;
o.have_pcap = true;
if(o.debugging > 2) printf("***WinIP*** trying to initialize WinPcap\n");
PacketGetAdapterNames(pcaplist, &len);
@@ -181,7 +179,7 @@ void win_init()
if(FAILED(__HrLoadAllImportsForDll("wpcap.dll")))
{
error("WARNING: your winpcap is too old to use. Nmap may not function.\n");
pcap_avail = 0;
o.have_pcap = false;
}
#endif
if(o.debugging)
@@ -190,11 +188,11 @@ void win_init()
#ifdef _MSC_VER
__except (1) {
error("WARNING: Could not import all necessary WinPcap functions. You may need to upgrade to version 3.1 or higher from http://www.winpcap.org. Resorting to connect() mode -- Nmap may not function completely");
pcap_avail=0;
o.have_pcap=false;
}
#endif
if (!pcap_avail)
if (!o.have_pcap)
o.isr00t = 0;
atexit(win_cleanup);
}