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

Removed the log-errors option from the code, by treating it as if it was always true. This was done for the action item of o Remove Nmap's --log-errors feature and make its behavior the default. I also updated the docs/refguide.xml to reflect this change. I have not yet compiled the Dockbook.xml however.

This commit is contained in:
sean
2012-06-30 00:36:15 +00:00
parent 6a0771f3b7
commit 0909f12308
5 changed files with 14 additions and 52 deletions

View File

@@ -316,7 +316,6 @@ void NmapOps::Initialize() {
xsl_stylesheet = NULL;
spoof_mac_set = false;
mass_dns = true;
log_errors = false;
deprecated_xml_osclass = false;
resolve_all = 0;
dns_servers = NULL;

View File

@@ -321,8 +321,7 @@ class NmapOps {
int resolve_all;
char *dns_servers;
// Logging options
bool log_errors;
// If true, write <os><osclass/><osmatch/></os> as in xmloutputversion 1.03
// rather than <os><osmatch><osclass/></osmatch></os> as in 1.04 and later.
bool deprecated_xml_osclass;

View File

@@ -3872,36 +3872,7 @@ hosts with at least one
by Nmap. This is useful for debugging routing problems or
device mischaracterization (such as Nmap treating a PPP
connection as ethernet).</para> </listitem> </varlistentry>
<varlistentry>
<term>
<option>--log-errors</option> (Log errors/warnings to normal mode output file)
<indexterm significance="preferred"><primary><option>--log-errors</option></primary></indexterm>
</term>
<listitem>
<para>Warnings and errors printed by Nmap usually go only to
the screen (interactive output), leaving any normal-format
output files (usually specified with <option>-oN</option>)
uncluttered. When you do want to see those messages in the
normal output file you specified, add this option. It is
useful when you aren't watching the interactive output or
when you want to record errors while debugging a problem.
The error and warning messages will still appear in
interactive mode too. This won't work for most errors
related to bad command-line arguments because Nmap may not
have initialized its output files yet. In addition, some
Nmap error and warning messages use a different system which
does not yet support this option.</para>
<para>An alternative to <option>--log-errors</option> is
redirecting interactive output (including the standard error
stream) to a file. Most Unix shells make this
approach easy, though it can be difficult on Windows.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist><title>Miscellaneous output options</title>

View File

@@ -847,7 +847,6 @@ void parse_options(int argc, char **argv) {
} else if (optcmp(long_options[option_index].name, "dns-servers") == 0) {
o.dns_servers = strdup(optarg);
} else if (optcmp(long_options[option_index].name, "log-errors") == 0) {
o.log_errors = 1;
} else if (optcmp(long_options[option_index].name, "deprecated-xml-osclass") == 0) {
o.deprecated_xml_osclass = true;
} else if (strcmp(long_options[option_index].name, "webxml") == 0) {

View File

@@ -115,12 +115,11 @@ void fatal(const char *fmt, ...) {
va_start(ap, fmt);
log_vwrite(LOG_STDERR, fmt, ap);
va_end(ap);
if (o.log_errors) {
va_start(ap, fmt);
log_vwrite(LOG_NORMAL, fmt, ap);
va_end(ap);
}
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "\nQUITTING!\n");
va_start(ap, fmt);
log_vwrite(LOG_NORMAL, fmt, ap);
va_end(ap);
log_write(LOG_NORMAL|LOG_STDERR, "\nQUITTING!\n");
if (xml_tag_open())
xml_close_start_tag();
@@ -163,13 +162,10 @@ void error(const char *fmt, ...) {
va_start(ap, fmt);
log_vwrite(LOG_STDERR, fmt, ap);
va_end(ap);
if (o.log_errors) {
va_start(ap, fmt);
va_start(ap, fmt);
log_vwrite(LOG_NORMAL, fmt, ap);
va_end(ap);
}
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "\n");
log_write(LOG_NORMAL|LOG_STDERR , "\n");
return;
}
@@ -197,7 +193,7 @@ void pfatal(const char *fmt, ...) {
Vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
va_end(ap);
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "%s: %s (%d)\n",
log_write(LOG_NORMAL|LOG_STDERR, "%s: %s (%d)\n",
errbuf, strerror_s, error_number);
if (xml_tag_open())
@@ -230,7 +226,7 @@ void pfatal(const char *fmt, ...) {
HeapFree(GetProcessHeap(), 0, strerror_s);
#endif
if (o.log_errors) log_flush(LOG_NORMAL);
log_flush(LOG_NORMAL);
fflush(stderr);
exit(1);
}
@@ -255,19 +251,17 @@ void gh_perror(const char *fmt, ...) {
va_start(ap, fmt);
log_vwrite(LOG_STDERR, fmt, ap);
va_end(ap);
if (o.log_errors) {
va_start(ap, fmt);
va_start(ap, fmt);
log_vwrite(LOG_NORMAL, fmt, ap);
va_end(ap);
}
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, ": %s (%d)\n",
log_write(LOG_NORMAL|LOG_STDERR, ": %s (%d)\n",
strerror_s, error_number);
#ifdef WIN32
HeapFree(GetProcessHeap(), 0, strerror_s);
#endif
if (o.log_errors) log_flush(LOG_NORMAL);
log_flush(LOG_NORMAL);
fflush(stderr);
return;
}