From b688cac3d673bdc0188107c8ab602ee313a3b792 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 30 Jan 2024 14:07:44 -0500 Subject: [PATCH] "To hell with cloud. Run Citadel." --Taylor Swift --- webcit-ng/server/html2html.c | 63 +++++++++++++++++++----------------- webcit-ng/server/webcit.h | 4 +-- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/webcit-ng/server/html2html.c b/webcit-ng/server/html2html.c index 506a70de7..5a76bc2fc 100644 --- a/webcit-ng/server/html2html.c +++ b/webcit-ng/server/html2html.c @@ -181,10 +181,11 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam // Any of these tags cause everything up to and including // the tag to be removed. - if ((!strncasecmp(ptr, "HTML", 4)) - || (!strncasecmp(ptr, "HEAD", 4)) - || (!strncasecmp(ptr, "/HEAD", 5)) - || (!strncasecmp(ptr, "BODY", 4))) { + if ( (!strncasecmp(ptr, "HTML", 4)) + || (!strncasecmp(ptr, "HEAD", 4)) + || (!strncasecmp(ptr, "/HEAD", 5)) + || (!strncasecmp(ptr, "BODY", 4)) + ) { char *pBody = NULL; if (!strncasecmp(ptr, "BODY", 4)) { @@ -252,10 +253,10 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam converted_msg = NewStrBufPlain(NULL, content_length + 8192); // Convert foreign character sets to UTF-8 if necessary - if ((strcasecmp(charset, "us-ascii")) - && (strcasecmp(charset, "UTF-8")) - && (strcasecmp(charset, "")) - ) { + if ( (strcasecmp(charset, "us-ascii")) + && (strcasecmp(charset, "UTF-8")) + && (strcasecmp(charset, "")) + ) { syslog(LOG_DEBUG, "Converting %s to UTF-8", charset); ctdl_iconv_open("UTF-8", charset, &ic); if (ic == (iconv_t) (-1)) { @@ -341,10 +342,10 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam ptr = &ptr[8]; } else if ((treat_as_wiki) - && (strncasecmp(ptr, "') + || (ptr[i] == '[') + || (ptr[i] == ']') + || (ptr[i] == '"') + || (ptr[i] == '\'') + ) { linklen = i; + } // entity tag? if (ptr[i] == '&') { if ((ptr[i + 2] == ';') || diff --git a/webcit-ng/server/webcit.h b/webcit-ng/server/webcit.h index 3679d245c..54529c83b 100644 --- a/webcit-ng/server/webcit.h +++ b/webcit-ng/server/webcit.h @@ -45,8 +45,8 @@ //#define DEBUG_HTTP // uncomment to debug HTTP headers // XML_StopParser is present in expat 2.x -#if XML_MAJOR_VERSION > 1 -#define HAVE_XML_STOPPARSER +#if XML_MAJOR_VERSION < 2 +#error WebCit requires expat v2.0 or newer. #endif struct client_handle { // this gets passed up the stack from the webserver to the application code -- 2.30.2