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:
2
nmap.cc
2
nmap.cc
@@ -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
8
xml.cc
@@ -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
2
xml.h
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user