From 77df357acd590e56083cd66d06e94262f7c570b9 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 25 Jun 2010 05:34:08 +0000 Subject: [PATCH] Check for target->deviceName == NULL in target_needs_new_hostgroup in targets.cc, and return false if it is so. This indicates that we are not doing a raw scan. target->deviceName != NULL is necessary before checking target->directlyConnected(), otherwise you get this assertion failure when doing any non-root scan (such as -sT or -sL) as root with two or more targets: nmap: Target.cc:369: bool Target::directlyConnected() const: Assertion `directly_connected == 0 || directly_connected == 1' failed. Aborted This is how the logic originally worked, and I accidentally broke it in r17892. --- targets.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/targets.cc b/targets.cc index 21426e9d2..2488bbd5b 100644 --- a/targets.cc +++ b/targets.cc @@ -382,12 +382,11 @@ static bool target_needs_new_hostgroup(const HostGroupState *hs, const Target *t return false; /* There are no restrictions on non-root scans. */ - if (!(o.af() == AF_INET && o.isr00t)) + if (!(o.af() == AF_INET && o.isr00t && target->deviceName() != NULL)) return false; /* Different interface name? */ if (hs->hostbatch[0]->deviceName() != NULL && - target->deviceName() != NULL && strcmp(hs->hostbatch[0]->deviceName(), target->deviceName()) != 0) { return true; }