merge soc07 r4994:5001 - Adding <portused> element for the open TCP port used when performing OS Detection. Only closed TCP and UDP were being printed; I guess it was just an oversight; Call endTask() in process_mainloop() in nse_main.cc so task ending information (like the <taskend> element) are printed; old_locale is allocated on the STACK not the HEAP; NULL is NOT a valid PCRE pointer.

This commit is contained in:
fyodor 2007-08-11 04:42:31 +00:00
parent c2e69defae
commit a09a6e2007
3 changed files with 8 additions and 2 deletions

View file

@ -279,6 +279,8 @@ int process_mainloop(lua_State* l) {
}
}
progress.endTask(NULL, NULL);
return SCRIPT_ENGINE_SUCCESS;
}

View file

@ -110,7 +110,6 @@ static const unsigned char *Lpcre_maketables(lua_State *L, int stackpos)
tables = pcre_maketables(); /* make tables with new locale */
(void)setlocale(LC_CTYPE, old_locale); /* restore the old locale */
free(old_locale);
free(locale);
return tables;
}
@ -158,7 +157,7 @@ static void Lpcre_getargs(lua_State *L, pcre2 **pud, const char **text,
size_t *text_len)
{
*pud = (pcre2 *)luaL_checkudata(L, 1, pcre_handle);
if(*pud != NULL)
if(*pud == NULL)
(void)luaL_argerror(L, 1, ("compiled regexp expected"));
*text = luaL_checklstring(L, 2, text_len);
}

View file

@ -1409,6 +1409,11 @@ void printosscanoutput(Target *currenths) {
distance = currenths->distance;
log_write(LOG_XML, "<os>");
if (FPR->osscan_opentcpport > 0) {
log_write(LOG_XML,
"<portused state=\"open\" proto=\"tcp\" portid=\"%hu\" />\n",
FPR->osscan_opentcpport);
}
if (FPR->osscan_closedtcpport > 0) {
log_write(LOG_XML,
"<portused state=\"closed\" proto=\"tcp\" portid=\"%hu\" />\n",