1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Parameterize xml_start_document and remove external DTD URI

http://seclists.org/nmap-dev/2014/q3/182
This commit is contained in:
dmiller
2014-08-21 20:13:59 +00:00
parent 1ea3557757
commit 345bfce521
3 changed files with 7 additions and 5 deletions

View File

@@ -1737,7 +1737,7 @@ int nmap_main(int argc, char *argv[]) {
Strncpy(mytime, ctime(&timep), sizeof(mytime));
chomp(mytime);
char *xslfname = o.XSLStyleSheet();
xml_start_document();
xml_start_document("nmaprun");
if (xslfname) {
xml_open_pi("xml-stylesheet");
xml_attribute("href", "%s", xslfname);

8
xml.cc
View File

@@ -308,8 +308,10 @@ int xml_write_escaped_v(const char *fmt, va_list va) {
return 0;
}
/* Write the XML declaration: <?xml version="1.0"?>. */
int xml_start_document() {
/* Write the XML declaration: <?xml version="1.0"?>
* and the DOCTYPE declaration: <!DOCTYPE rootnode>
*/
int xml_start_document(const char *rootnode) {
if (xml_open_pi("xml") < 0)
return -1;
if (xml_attribute("version", "1.0") < 0)
@@ -319,7 +321,7 @@ int xml_start_document() {
if (xml_newline() < 0)
return -1;
log_write(LOG_XML, "<!DOCTYPE nmaprun PUBLIC \"-//IDN nmap.org//DTD Nmap XML %s//EN\" \"https://svn.nmap.org/nmap/docs/nmap.dtd\">\n", NMAP_XMLOUTPUTVERSION);
log_write(LOG_XML, "<!DOCTYPE %s>\n", rootnode);
return 0;
}

2
xml.h
View File

@@ -129,7 +129,7 @@ int xml_write_raw(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int xml_write_escaped(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int xml_write_escaped_v(const char *fmt, va_list va) __attribute__ ((format (printf, 1, 0)));
int xml_start_document();
int xml_start_document(const char *rootnode);
int xml_start_comment();
int xml_end_comment();