diff options
author | Dave Woodfall <dave@slackbuilds.org> | 2020-01-25 18:52:51 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-01-26 08:09:41 +0700 |
commit | 68c5ea2fc3ee36d437939b35c3303b1dfc095c07 (patch) | |
tree | 22ca5d4839d664efde36062a4fdfb7593d143573 /network | |
parent | cbda98a1f743e556d3e6f79c24e0394b025090b0 (diff) | |
download | slackbuilds-68c5ea2fc3ee36d437939b35c3303b1dfc095c07.tar.gz |
network/elinks: Fix gopher HTML entities
Diffstat (limited to 'network')
-rw-r--r-- | network/elinks/elinks.SlackBuild | 2 | ||||
-rw-r--r-- | network/elinks/patches/0001-gopher_html_links.patch | 9 | ||||
-rw-r--r-- | network/elinks/patches/0002-gopher_index_queries.patch | 125 | ||||
-rw-r--r-- | network/elinks/patches/0003-gopher_directory_links.patch | 31 | ||||
-rw-r--r-- | network/elinks/patches/0004-ssl_cert_verify.patch | 8 | ||||
-rw-r--r-- | network/elinks/patches/0005-gopher_newlines_tabs_entity.patch | 58 | ||||
-rw-r--r-- | network/elinks/patches/0006-gopher-indexes_nocr.patch | 16 | ||||
-rw-r--r-- | network/elinks/patches/0007-gopher-move_null.patch | 10 | ||||
-rw-r--r-- | network/elinks/patches/0008-gopher-html-entities.patch (renamed from network/elinks/patches/0008-gopher-encode-html.patch) | 20 |
9 files changed, 136 insertions, 143 deletions
diff --git a/network/elinks/elinks.SlackBuild b/network/elinks/elinks.SlackBuild index eafc45eb53..e14f23f274 100644 --- a/network/elinks/elinks.SlackBuild +++ b/network/elinks/elinks.SlackBuild @@ -23,7 +23,7 @@ PRGNAM=elinks VERSION=${VERSION:-git20131231} -BUILD=${BUILD:-11} +BUILD=${BUILD:-12} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then diff --git a/network/elinks/patches/0001-gopher_html_links.patch b/network/elinks/patches/0001-gopher_html_links.patch index e2a927f9c8..38a2dd0b10 100644 --- a/network/elinks/patches/0001-gopher_html_links.patch +++ b/network/elinks/patches/0001-gopher_html_links.patch @@ -1,8 +1,5 @@ ################################################################ -# There is a problem that html links that contain URL:http:// -# aren't being followed. This fixes that issue and also chtml. -# Normally those kind of links go to a redirect page that the -# server generates, which then sends you on your way. +# Fix for HTML links that contain URL:http:// # dave@slackbuilds.org ############################################################### diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c @@ -25,13 +22,13 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c + if(strstr(selector, URL) != NULL || strstr(selector, URI) != NULL) { + entity = GOPHER_HTML; -+ *selector++; ++ selector++; + selectorlen--; + } + + if(strstr(selector, CURL) != NULL || strstr(selector, CURI) != NULL) { + entity = GOPHER_CHTML; -+ *selector++; ++ selector++; + selectorlen--; + } + diff --git a/network/elinks/patches/0002-gopher_index_queries.patch b/network/elinks/patches/0002-gopher_index_queries.patch index ce92695a0a..662fd13a7f 100644 --- a/network/elinks/patches/0002-gopher_index_queries.patch +++ b/network/elinks/patches/0002-gopher_index_queries.patch @@ -1,71 +1,53 @@ ####################################################################### -# elinks by default generates its own search query form when it sees -# a type 7 index entity. The problem is that it didn't read the -# served results page and instead generated another search page after -# you had entered the first. This patch fixes that and in my tests it -# seems to work so far. I've also added a primitive debug log. +# Fix for type 7 entities. # dave@slackbuilds.org ####################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-08 05:37:57.443382095 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-08 05:36:42.849199857 +0000 -@@ -43,6 +43,34 @@ - #include "util/memory.h" - #include "util/string.h" +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-13 22:35:13.663935305 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-13 23:16:00.053003768 +0000 +@@ -197,7 +197,7 @@ + command->length = strlen(command->source); + } -+#ifdef HAVE_FCNTL_H -+#include <fcntl.h> /* OS/2 needs this after sys/types.h */ -+#endif -+ -+/* To enable logging for debugging purposes. */ -+#if 0 -+ -+#define LOGFILE "/tmp/log" -+ -+static void -+debug_log(unsigned char *data, int NL) -+{ -+ int fd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0622); -+ -+ if (fd == -1) return; -+ -+ set_bin(fd); -+ write(fd, data, strlen(data)); -+ if (NL) -+ write(fd, "\n", 1); -+ close(fd); -+} -+#undef LOGFILE -+ -+#else -+#define debug_log(data, len) -+#endif -+ - struct module gopher_protocol_module = struct_module( - /* name: */ N_("Gopher"), - /* options: */ NULL, -@@ -219,11 +247,13 @@ +-static struct connection_state init_gopher_index_cache_entry(struct connection *conn); ++/* static struct connection_state init_gopher_index_cache_entry(struct connection *conn); */ + + static struct connection_state + add_gopher_command(struct connection *conn, struct string *command, +@@ -205,7 +205,7 @@ + unsigned char *selector, int selectorlen) + { + unsigned char *query; +- int querylen; ++ int querylen = 0; + + if (!init_string(command)) + return connection_state(S_OUT_OF_MEM); +@@ -218,13 +218,14 @@ + /* Exclude '?' */ if (query) selectorlen -= 1; query = NULL; - querylen = 0; +- querylen = 0; - } else { - query += 1; + } else if (entity == GOPHER_INDEX) { -+ /* fix query size to not include the search= part */ ++ /* fix query size to not include the search= part */ + query += 8; querylen = selector + selectorlen - query; /* Exclude '?' */ - selectorlen -= querylen + 1; -+ /* fix selector length to fit with query */ +- if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) { ++ /* fix selector length to fit with query */ + selectorlen -= querylen + 8; - if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) { ++ if (querylen >= 7 && !c_strncasecmp(query, "submit=", 7)) { query += 7; querylen -= 7; -@@ -233,9 +263,11 @@ + } +@@ -233,9 +234,11 @@ switch (entity) { case GOPHER_INDEX: /* No search required? */ -+ /* Don't display the form page */ ++ /* Don't display the form page */ if (!query) { done_string(command); - return init_gopher_index_cache_entry(conn); @@ -74,19 +56,58 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c } add_uri_decoded(command, selector, selectorlen, 0); -@@ -371,13 +403,14 @@ +@@ -371,13 +374,14 @@ add_gopher_search_field(struct string *buffer, const unsigned char *text, const unsigned char *addr) { -+ /* Not *every* query is a search */ ++ /* Not *every* query is a search! */ add_format_to_string(buffer, "<form action=\"%s\">" "<table>" "<td> </td>" "<td>%s:</td>" - "<td><input maxlength=\"256\" name=\"search\" value=\"\"></td>" +- "<td><input maxlength=\"256\" name=\"search\" value=\"\"></td>" - "<td><input type=submit value=\"Search\"></td>" ++ "<td><input maxlength=\"256\" name=\"submit\" value=\"\"></td>" + "<td><input type=submit value=\"Submit\"></td>" "</table>" "</form>", addr, text); +@@ -662,6 +666,7 @@ + } + + /* Display a Gopher Index document. */ ++/* Use the page that the gopher site sends us + static struct connection_state + init_gopher_index_cache_entry(struct connection *conn) + { +@@ -674,9 +679,9 @@ + + where = get_uri_string(conn->uri, URI_PUBLIC); + +- /* TODO: Use different function when using UTF-8 ++ TODO: Use different function when using UTF-8 + * in terminal (decode_uri_for_display replaces +- * bytes of UTF-8 characters width '*'). */ ++ * bytes of UTF-8 characters width '*'). * + if (where) decode_uri_for_display(where); + + add_format_to_string(&buffer, +@@ -695,7 +700,7 @@ + + mem_free_if(where); + +- /* FIXME: I think this needs a form or something */ ++ * FIXME: I think this needs a form or something * + + add_fragment(conn->cached, conn->from, buffer.source, buffer.length); + conn->from += buffer.length; +@@ -707,7 +712,7 @@ + ? connection_state(S_OK) + : connection_state(S_OUT_OF_MEM); + } +- ++*/ + + static void + read_gopher_response_data(struct socket *socket, struct read_buffer *rb) diff --git a/network/elinks/patches/0003-gopher_directory_links.patch b/network/elinks/patches/0003-gopher_directory_links.patch index 8c61f281bb..15a89fac2f 100644 --- a/network/elinks/patches/0003-gopher_directory_links.patch +++ b/network/elinks/patches/0003-gopher_directory_links.patch @@ -1,35 +1,22 @@ ####################################################################### -# elinks does not follow links to directories on other servers -# properly. This adds a '/' before the '1' at the start of a link and -# removes any trailing 1. +# Fix remote directory links. # dave@slackbuilds.org ####################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-08 04:56:18.809169382 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-08 04:52:43.722879240 +0000 -@@ -313,6 +313,9 @@ - unsigned char const* URL = "hURL%3"; - unsigned char const* CURI = "HURI%3"; - unsigned char const* CURL = "HURL%3"; -+ unsigned char *DIR = "1"; -+ unsigned char *SLASHDIR = "/1"; -+ unsigned char *SLASHPOS; - int selectorlen = conn->uri->datalen; - struct gopher_entity_info *entity_info; - size_t size; -@@ -350,6 +353,19 @@ +diff -Naur -x .git bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-13 23:22:18.918292198 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-13 23:21:00.631960039 +0000 +@@ -321,6 +321,18 @@ selectorlen++; } + if (entity_info->type == '1') { -+ if (strstr(selector, DIR) == selector) { -+ *selector++; ++ if (strchr(selector, '1') == (char *) selector) { ++ selector++; + selectorlen--; + } + else { -+ SLASHPOS = strstr(selector, SLASHDIR); -+ if (SLASHPOS != NULL && strlen(SLASHPOS) == 2) { -+ selectorlen--; ++ if ((char *) selector == "/1") { ++ selectorlen--; + } + } + } diff --git a/network/elinks/patches/0004-ssl_cert_verify.patch b/network/elinks/patches/0004-ssl_cert_verify.patch index 0cb51242f7..3b56e1ae40 100644 --- a/network/elinks/patches/0004-ssl_cert_verify.patch +++ b/network/elinks/patches/0004-ssl_cert_verify.patch @@ -1,9 +1,7 @@ ############################################################################## -# elinks does not verify ssl host names with openssl -# This is a modifed version of the patch here that fixes that issue: +# Verify SSL host names with OpenSSL. +# Turn on verification by default. # http://lists.linuxfromscratch.org/pipermail/elinks-dev/2015-June/002099.html -# This patch turns on verification by default, and differentiates -# between host verification fail and normal SSL errors, but more needs doing. # dave@slackbuilds.org ############################################################################## --- a/configure.in 2017-12-21 15:58:12.470247050 +0000 @@ -75,7 +73,7 @@ diff -Naur a/src/network/ssl/socket.c b/src/network/ssl/socket.c default: socket->no_tls = !socket->no_tls; - socket->ops->retry(socket, connection_state(S_SSL_ERROR)); -+ if (SSL_VERIFY_FAIL_IF_NO_PEER_CERT != NULL) ++ if (SSL_VERIFY_FAIL_IF_NO_PEER_CERT) + socket->ops->retry(socket, connection_state(S_SSL_CERTFAIL)); + else + socket->ops->retry(socket, connection_state(S_SSL_ERROR)); diff --git a/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch b/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch index f27b655cc6..b255fb4f98 100644 --- a/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch +++ b/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch @@ -1,13 +1,13 @@ ##################################################################### -# Some fixes for having line feeds in text without a carriage return. +# Fix line feeds without carriage returns. # Make sure that only lines with tabs are treated as links. # Support links that don't begin with a '/'. # dave@slackbuilds.org ##################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-08 05:43:40.148408539 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-08 05:43:26.357005028 +0000 -@@ -322,7 +322,7 @@ +diff -Naur -x .git bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 03:19:39.956296190 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 03:20:05.295045232 +0000 +@@ -290,7 +290,7 @@ /* Get entity type, and selector string. */ /* Pick up gopher_entity */ @@ -16,42 +16,36 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c entity = *selector++; selectorlen--; } -@@ -472,6 +472,7 @@ - unsigned char *host = NULL; - unsigned char *port = NULL; - enum gopher_entity entity = *name++; -+ int link = 0; - - if (!entity) { - add_char_to_string(buffer, '\n'); -@@ -481,6 +482,7 @@ - if (*name) { - selector = strchr(name, ASCII_TAB); - if (selector) { -+ link = 1; - /* Terminate name */ - *selector++ = '\0'; - -@@ -551,7 +553,7 @@ - switch (entity) { - case GOPHER_WWW: - /* Gopher pointer to W3 */ -- if (selector) { -+ if (selector && link == 1) { - add_gopher_link(buffer, name, selector); - break; +@@ -333,6 +333,18 @@ } -@@ -603,7 +605,8 @@ + } + ++ if (entity_info->type == '1') { ++ if (strchr(selector, '1') == (char *) selector) { ++ selector++; ++ selectorlen--; ++ } ++ else { ++ if ((char *) selector == "/1") { ++ selectorlen--; ++ } ++ } ++ } ++ + state = add_gopher_command(conn, &command, entity, selector, selectorlen); + if (!is_in_state(state, S_CONN)) + return state; +@@ -570,7 +582,8 @@ } else if (address.length > 0 && strlcmp(address.source, address.length - 1, - "gopher://error.host:1/", -1)) { + "gopher://error.host:1/", -1) -+ && link == 1) { ++ && selector) { add_gopher_link(buffer, name, address.source); } else { -@@ -623,7 +626,7 @@ +@@ -590,7 +603,7 @@ get_gopher_line_end(unsigned char *data, int datalen) { for (; datalen > 1; data++, datalen--) diff --git a/network/elinks/patches/0006-gopher-indexes_nocr.patch b/network/elinks/patches/0006-gopher-indexes_nocr.patch index 797c9a8b55..9e4a441db6 100644 --- a/network/elinks/patches/0006-gopher-indexes_nocr.patch +++ b/network/elinks/patches/0006-gopher-indexes_nocr.patch @@ -1,22 +1,18 @@ ####################################################################### -# Fixes index listings with only LF and no CRs. +# Fix index listings with only LF and no CRs. # dave@slackbuilds.org ####################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-08 07:39:33.403725857 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-08 07:40:30.587406965 +0000 -@@ -779,6 +779,15 @@ +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 06:42:11.030536586 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 06:42:26.710000886 +0000 +@@ -757,6 +757,11 @@ switch (gopher->entity->type) { case GOPHER_DIRECTORY: case GOPHER_INDEX: + /* Lines with no carriage returns */ + if (strchr(rb->data, ASCII_CR) == NULL) { -+ unsigned char *tmp = malloc(rb->length + 3); -+ tmp[0] = 'i'; -+ tmp = stpcpy(stpcpy(stpcpy(tmp, rb->data), '\r'), '\n'); ++ strncat(rb->data, "\r\n", 2); + rb->length += 3; -+ memcpy(rb->data, tmp, rb->length); -+ free(tmp); + } state = read_gopher_directory_data(conn, rb); break; diff --git a/network/elinks/patches/0007-gopher-move_null.patch b/network/elinks/patches/0007-gopher-move_null.patch index 01751c497a..8f259e55cf 100644 --- a/network/elinks/patches/0007-gopher-move_null.patch +++ b/network/elinks/patches/0007-gopher-move_null.patch @@ -1,11 +1,11 @@ ################################################################### -# Move the added null terminator one char forwards +# Move the null terminator one char forwards. # dave@slackbuilds.org ################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-08 06:52:23.491455711 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-08 06:51:41.160210431 +0000 -@@ -638,7 +638,7 @@ +diff -Naur -x .git bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 03:24:11.259323801 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 03:24:49.452454019 +0000 +@@ -615,7 +615,7 @@ assert(line < end); /* Just to be safe NUL terminate the line */ diff --git a/network/elinks/patches/0008-gopher-encode-html.patch b/network/elinks/patches/0008-gopher-html-entities.patch index 21486ff1a4..750d1a49de 100644 --- a/network/elinks/patches/0008-gopher-encode-html.patch +++ b/network/elinks/patches/0008-gopher-html-entities.patch @@ -1,7 +1,10 @@ -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2020-01-09 09:19:54.983674477 +0000 -+++ b/src/protocol/gopher/gopher.c 2020-01-09 09:21:58.885286474 +0000 -@@ -663,6 +663,25 @@ +################################################################### +# Encode < > to HTML. +################################################################### +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 03:26:41.791778387 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 06:19:56.964025440 +0000 +@@ -620,6 +620,25 @@ return line[0] == '.' && !line[1] ? NULL : line; } @@ -10,7 +13,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c +str_replace(char * in_string, char * s_string, char * r_string) +{ + /* max == replace all characters */ -+ char temp[strlen(in_string) * (strlen(r_string) - strlen(s_string))]; ++ char temp[strlen(in_string) * (strlen(r_string) - strlen(s_string)) + 1]; + char * pos; + + if (!(pos = strstr(in_string, s_string))) @@ -18,7 +21,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c + + strncpy(temp, in_string, pos - in_string); + temp[pos - in_string] = 0; -+ sprintf(temp + (pos - in_string), "%s%s", r_string, pos + strlen(s_string)); ++ sprintf(temp + (pos - in_string), "%s%s", r_string, pos + 1); + in_string[0] = 0; + strcpy(in_string, temp); + return str_replace(in_string, s_string, r_string); @@ -27,7 +30,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c /* Parse a Gopher Menu document */ static struct connection_state read_gopher_directory_data(struct connection *conn, struct read_buffer *rb) -@@ -682,6 +701,17 @@ +@@ -639,6 +658,14 @@ return connection_state(S_OUT_OF_MEM); } @@ -38,9 +41,6 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c + if (strstr(rb->data, ">")) { + str_replace(rb->data, ">", ">"); + } -+ if (strstr(rb->data, "\"")) { -+ str_replace(rb->data, "\"", """); -+ } + while ((end = get_gopher_line_end(rb->data, rb->length))) { unsigned char *line = check_gopher_last_line(rb->data, end); |