mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-08 21:42:07 +03:00
catalog integration, cleanup with the --nonet option closing #59427
* xsltproc/xsltproc.c: catalog integration, cleanup with the --nonet option closing #59427 * libxslt/xslt.c: removed a small memleak when using a stylesheet PI Daniel
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Aug 23 17:37:40 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xsltproc/xsltproc.c: catalog integration, cleanup with
|
||||||
|
the --nonet option closing #59427
|
||||||
|
* libxslt/xslt.c: removed a small memleak when using a
|
||||||
|
stylesheet PI
|
||||||
|
|
||||||
Tue Aug 21 13:17:19 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
Tue Aug 21 13:17:19 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* //Makefile.am : fixed an error I propagated to nearly all
|
* //Makefile.am : fixed an error I propagated to nearly all
|
||||||
|
@@ -5,12 +5,12 @@ dnl libxslt is the main part of the package
|
|||||||
dnl
|
dnl
|
||||||
LIBXSLT_MAJOR_VERSION=1
|
LIBXSLT_MAJOR_VERSION=1
|
||||||
LIBXSLT_MINOR_VERSION=0
|
LIBXSLT_MINOR_VERSION=0
|
||||||
LIBXSLT_MICRO_VERSION=2
|
LIBXSLT_MICRO_VERSION=3
|
||||||
PACKAGE=libxslt
|
PACKAGE=libxslt
|
||||||
LIBEXSLT_MAJOR_VERSION=0
|
LIBEXSLT_MAJOR_VERSION=0
|
||||||
LIBEXSLT_MINOR_VERSION=3
|
LIBEXSLT_MINOR_VERSION=3
|
||||||
LIBEXSLT_MICRO_VERSION=0
|
LIBEXSLT_MICRO_VERSION=1
|
||||||
LIBXML_REQUIRED_VERSION=2.4.2
|
LIBXML_REQUIRED_VERSION=2.4.3
|
||||||
|
|
||||||
|
|
||||||
LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
|
LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
|
||||||
|
@@ -2119,12 +2119,14 @@ xsltLoadStylesheetPI(xmlDocPtr doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xmlChar *URL;
|
xmlChar *URL, *base;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference to an external stylesheet
|
* Reference to an external stylesheet
|
||||||
*/
|
*/
|
||||||
URL = xmlBuildURI(href, xmlNodeGetBase(doc, (xmlNodePtr) doc));
|
|
||||||
|
base = xmlNodeGetBase(doc, (xmlNodePtr) doc);
|
||||||
|
URL = xmlBuildURI(href, base);
|
||||||
if (URL != NULL) {
|
if (URL != NULL) {
|
||||||
#ifdef WITH_XSLT_DEBUG_PARSING
|
#ifdef WITH_XSLT_DEBUG_PARSING
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
@@ -2139,6 +2141,8 @@ xsltLoadStylesheetPI(xmlDocPtr doc) {
|
|||||||
#endif
|
#endif
|
||||||
ret = xsltParseStylesheetFile(href);
|
ret = xsltParseStylesheetFile(href);
|
||||||
}
|
}
|
||||||
|
if (base != NULL)
|
||||||
|
xmlFree(base);
|
||||||
}
|
}
|
||||||
xmlFreeURI(URI);
|
xmlFreeURI(URI);
|
||||||
xmlFree(href);
|
xmlFree(href);
|
||||||
|
@@ -21,21 +21,21 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* the version string like "1.2.3"
|
* the version string like "1.2.3"
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_DOTTED_VERSION "1.0.2"
|
#define LIBXSLT_DOTTED_VERSION "1.0.3"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXSLT_VERSION:
|
* LIBXSLT_VERSION:
|
||||||
*
|
*
|
||||||
* the version number: 1.2.3 value is 1002003
|
* the version number: 1.2.3 value is 1002003
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_VERSION 10002
|
#define LIBXSLT_VERSION 10003
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXSLT_VERSION_STRING:
|
* LIBXSLT_VERSION_STRING:
|
||||||
*
|
*
|
||||||
* the version number string, 1.2.3 value is "1002003"
|
* the version number string, 1.2.3 value is "1002003"
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_VERSION_STRING "10002"
|
#define LIBXSLT_VERSION_STRING "10003"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WITH_XSLT_DEBUG:
|
* WITH_XSLT_DEBUG:
|
||||||
|
@@ -14,6 +14,9 @@
|
|||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -53,6 +56,16 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
#ifndef HAVE_STAT
|
||||||
|
# ifdef HAVE__STAT
|
||||||
|
/* MS C library seems to define stat and _stat. The definition
|
||||||
|
* is identical. Still, mapping them to each other causes a warning. */
|
||||||
|
# ifndef _MSC_VER
|
||||||
|
# define stat(x,y) _stat(x,y)
|
||||||
|
# endif
|
||||||
|
# define HAVE_STAT
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static int debug = 0;
|
static int debug = 0;
|
||||||
static int repeat = 0;
|
static int repeat = 0;
|
||||||
@@ -80,20 +93,99 @@ static const char *output = NULL;
|
|||||||
static xmlParserInputPtr
|
static xmlParserInputPtr
|
||||||
xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
|
xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
|
||||||
xmlParserCtxtPtr ctxt) {
|
xmlParserCtxtPtr ctxt) {
|
||||||
if (URL != NULL) {
|
xmlParserInputPtr input = NULL;
|
||||||
if ((!xmlStrncasecmp((const xmlChar *) URL,
|
xmlChar *resource = NULL;
|
||||||
|
|
||||||
|
#ifdef LIBXML_CATALOG_ENABLED
|
||||||
|
#ifdef HAVE_STAT
|
||||||
|
struct stat info;
|
||||||
|
#endif
|
||||||
|
xmlCatalogAllow pref;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the resource doesn't exists as a file,
|
||||||
|
* try to load it from the resource pointed in the catalogs
|
||||||
|
*/
|
||||||
|
pref = xmlCatalogGetDefaults();
|
||||||
|
|
||||||
|
if ((pref != XML_CATA_ALLOW_NONE)
|
||||||
|
#ifdef HAVE_STAT
|
||||||
|
&& ((URL == NULL) || (stat(URL, &info) < 0))
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
/*
|
||||||
|
* Do a local lookup
|
||||||
|
*/
|
||||||
|
if ((ctxt->catalogs != NULL) &&
|
||||||
|
((pref == XML_CATA_ALLOW_ALL) ||
|
||||||
|
(pref == XML_CATA_ALLOW_DOCUMENT))) {
|
||||||
|
resource = xmlCatalogLocalResolve(ctxt->catalogs,
|
||||||
|
(const xmlChar *)ID,
|
||||||
|
(const xmlChar *)URL);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Try a global lookup
|
||||||
|
*/
|
||||||
|
if ((resource == NULL) &&
|
||||||
|
((pref == XML_CATA_ALLOW_ALL) ||
|
||||||
|
(pref == XML_CATA_ALLOW_GLOBAL))) {
|
||||||
|
resource = xmlCatalogResolve((const xmlChar *)ID,
|
||||||
|
(const xmlChar *)URL);
|
||||||
|
}
|
||||||
|
if ((resource == NULL) && (URL != NULL))
|
||||||
|
resource = xmlStrdup((const xmlChar *) URL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: do an URI lookup on the reference
|
||||||
|
*/
|
||||||
|
if ((resource != NULL)
|
||||||
|
#ifdef HAVE_STAT
|
||||||
|
&& (stat((const char *) resource, &info) < 0)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
xmlChar *tmp = NULL;
|
||||||
|
|
||||||
|
if ((ctxt->catalogs != NULL) &&
|
||||||
|
((pref == XML_CATA_ALLOW_ALL) ||
|
||||||
|
(pref == XML_CATA_ALLOW_DOCUMENT))) {
|
||||||
|
tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);
|
||||||
|
}
|
||||||
|
if ((tmp == NULL) &&
|
||||||
|
((pref == XML_CATA_ALLOW_ALL) ||
|
||||||
|
(pref == XML_CATA_ALLOW_GLOBAL))) {
|
||||||
|
tmp = xmlCatalogResolveURI(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp != NULL) {
|
||||||
|
xmlFree(resource);
|
||||||
|
resource = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (resource == NULL)
|
||||||
|
resource = (xmlChar *) URL;
|
||||||
|
|
||||||
|
if (resource != NULL) {
|
||||||
|
if ((!xmlStrncasecmp((const xmlChar *) resource,
|
||||||
(const xmlChar *) "ftp://", 6)) ||
|
(const xmlChar *) "ftp://", 6)) ||
|
||||||
(!xmlStrncasecmp((const xmlChar *) URL,
|
(!xmlStrncasecmp((const xmlChar *) resource,
|
||||||
(const xmlChar *) "http://", 7))) {
|
(const xmlChar *) "http://", 7))) {
|
||||||
fprintf(stderr, "Attempt to load network entity %s \n", URL);
|
fprintf(stderr, "Attempt to load network entity %s \n", resource);
|
||||||
if (nonet)
|
|
||||||
|
if (nonet) {
|
||||||
|
if (resource != (xmlChar *) URL)
|
||||||
|
xmlFree(resource);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (defaultLoader != NULL) {
|
if (defaultLoader != NULL) {
|
||||||
return(defaultLoader(URL, ID, ctxt));
|
input = defaultLoader((const char *) resource, ID, ctxt);
|
||||||
}
|
}
|
||||||
return(NULL);
|
if (resource != (xmlChar *) URL)
|
||||||
|
xmlFree(resource);
|
||||||
|
return(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -451,7 +543,7 @@ main(int argc, char **argv)
|
|||||||
/* it is an embedded stylesheet */
|
/* it is an embedded stylesheet */
|
||||||
xsltProcess(style, cur, argv[i]);
|
xsltProcess(style, cur, argv[i]);
|
||||||
xsltFreeStylesheet(cur);
|
xsltFreeStylesheet(cur);
|
||||||
exit(0);
|
goto done;
|
||||||
}
|
}
|
||||||
cur = xsltParseStylesheetDoc(style);
|
cur = xsltParseStylesheetDoc(style);
|
||||||
if (cur != NULL) {
|
if (cur != NULL) {
|
||||||
@@ -460,6 +552,9 @@ main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
xmlIndentTreeOutput = 0;
|
xmlIndentTreeOutput = 0;
|
||||||
i++;
|
i++;
|
||||||
|
} else {
|
||||||
|
xmlFreeDoc(style);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -507,6 +602,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
xsltFreeStylesheet(cur);
|
xsltFreeStylesheet(cur);
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
xsltCleanupGlobals();
|
xsltCleanupGlobals();
|
||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
xmlMemoryDump();
|
xmlMemoryDump();
|
||||||
|
Reference in New Issue
Block a user