1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Remove unused members from ServiceProbeMatch class

This commit is contained in:
dmiller
2022-09-19 17:51:45 +00:00
parent 0d8916b2c9
commit c39ed4d7c7
2 changed files with 1 additions and 14 deletions

View File

@@ -267,11 +267,9 @@ ServiceProbeMatch::~ServiceProbeMatch() {
if (devicetype_template) free(devicetype_template);
for (it = cpe_templates.begin(); it != cpe_templates.end(); it++)
free(*it);
matchstrlen = 0;
if (regex_compiled) pcre_free(regex_compiled);
if (regex_extra) pcre_free(regex_extra);
isInitialized = false;
matchops_anchor = -1;
}
/* Realloc a malloc-allocated string and put a given prefix at the front. */
@@ -391,7 +389,6 @@ void ServiceProbeMatch::InitMatch(const char *matchtext, int lineno) {
if (strcmp(modestr, "m") != 0)
fatal("%s: parse error on line %d of nmap-service-probes: matchtext must begin with 'm'", __func__, lineno);
matchtype = SERVICEMATCH_REGEX;
// any options?
for (p = flags; *p != '\0'; p++) {
@@ -505,8 +502,6 @@ const struct MatchDetails *ServiceProbeMatch::testMatch(const u8 *buf, int bufle
int ovector[150]; // allows 50 substring matches (including the overall match)
assert(isInitialized);
assert (matchtype == SERVICEMATCH_REGEX);
// Clear out the output struct
memset(&MD_return, 0, sizeof(MD_return));
MD_return.isSoft = isSoft;

View File

@@ -90,11 +90,8 @@
#define DEFAULT_TCPWRAPPEDMS 2000 // connections closed after this timeout are not considered "tcpwrapped"
#define DEFAULT_CONNECT_TIMEOUT 5000
#define DEFAULT_CONNECT_SSL_TIMEOUT 8000 // includes connect() + ssl negotiation
#define SERVICEMATCH_REGEX 1
#define MAXFALLBACKS 20 /* How many comma separated fallbacks are allowed in the service-probes file? */
// #define SERVICEMATCH_STATIC 2 -- no longer supported
/********************** STRUCTURES ***********************************/
// This is returned when we find a match
@@ -159,9 +156,7 @@ class ServiceProbeMatch {
int deflineno; // The line number where this match is defined.
bool isInitialized; // Has InitMatch yet been called?
char *servicename;
int matchtype; // SERVICEMATCH_REGEX or SERVICESCAN_STATIC
char *matchstr; // Regular expression text, or static string
int matchstrlen; // Because static strings may have embedded NULs
char *matchstr; // Regular expression text
pcre *regex_compiled;
pcre_extra *regex_extra;
bool matchops_ignorecase;
@@ -178,9 +173,6 @@ class ServiceProbeMatch {
char *ostype_template;
char *devicetype_template;
std::vector<char *> cpe_templates;
// The anchor is for SERVICESCAN_STATIC matches. If the anchor is not -1, the match must
// start at that zero-indexed position in the response str.
int matchops_anchor;
// Details to fill out and return for testMatch() calls
struct MatchDetails MD_return;