[packages/links] - updated to 1.04 - updated gzip_fallback,content_encoding,openssl patches - fixed memleak in gzip_f

qboosh qboosh at pld-linux.org
Sun Sep 6 15:44:27 CEST 2020


commit c6ec6a04f45d3e7293835a518eeb85baede577a2
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Sep 6 15:47:06 2020 +0200

    - updated to 1.04
    - updated gzip_fallback,content_encoding,openssl patches
    - fixed memleak in gzip_fallback patch, adjusted not to decode gzip when accessing .gz directly (not using fallback)
    - added pl-update patch

 links-content_encoding.patch | 54 +++++++++++++++++--------------------
 links-gzip_fallback.patch    | 64 ++++++++++++++++++++++++++------------------
 links.spec                   | 21 ++++++++-------
 openssl.patch                | 45 +++++++------------------------
 4 files changed, 85 insertions(+), 99 deletions(-)
---
diff --git a/links.spec b/links.spec
index fb1a1a7..decedf7 100644
--- a/links.spec
+++ b/links.spec
@@ -1,3 +1,4 @@
+# TODO: update IPv6 support
 Summary:	Lynx-like text WWW browser
 Summary(es.UTF-8):	El links es un browser para modo texto, similar a lynx
 Summary(pl.UTF-8):	Podobna do Lynksa tekstowa przeglądarka WWW
@@ -5,13 +6,13 @@ Summary(pt_BR.UTF-8):	O links é um browser para modo texto, similar ao lynx
 Summary(ru.UTF-8):	Текстовый WWW броузер типа Lynx
 Summary(uk.UTF-8):	Текстовий WWW броузер типу Lynx
 Name:		links
-Version:	1.03
-Release:	4.1
+Version:	1.04
+Release:	0.1
 Epoch:		2
 License:	GPL v2+
 Group:		Applications/Networking
 Source0:	http://www.jikos.cz/~mikulas/links/download/%{name}-%{version}.tar.gz
-# Source0-md5:	41ab5dd9ffdd5b8dbed2214eee2bc23c
+# Source0-md5:	ed149649bbe6813c5f74ce4ed26385d9
 Source1:	%{name}.desktop
 Source2:	%{name}.1.pl
 Source3:	%{name}.png
@@ -20,6 +21,7 @@ Patch1:		%{name}-gzip_fallback.patch
 Patch2:		%{name}-content_encoding.patch
 Patch3:		%{name}-home_etc.patch
 Patch4:		openssl.patch
+Patch5:		%{name}-pl-update.patch
 URL:		http://www.jikos.cz/~mikulas/links/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -87,9 +89,10 @@ Links - це текстовий WWW броузер, на перший погля
 %patch2 -p1
 #%patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
-#cd intl
-#./gen-intl
+cd intl
+./gen-intl
 
 %build
 %{__aclocal}
@@ -106,16 +109,16 @@ install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}} \
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT%{_desktopdir}
-install %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/pl/man1/links.1
-install %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_desktopdir}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/pl/man1/links.1
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS BUGS ChangeLog NEWS README SITES TODO
+%doc AUTHORS ChangeLog KEYS NEWS README SITES
 %attr(755,root,root) %{_bindir}/links
 %{_desktopdir}/links.desktop
 %{_pixmapsdir}/links.png
diff --git a/links-content_encoding.patch b/links-content_encoding.patch
index a575c73..c3fb529 100644
--- a/links-content_encoding.patch
+++ b/links-content_encoding.patch
@@ -1,17 +1,17 @@
---- links-1.00/Makefile.am.orig	2007-12-24 23:11:54.000000000 +0100
-+++ links-1.00/Makefile.am	2008-08-17 13:55:31.433242824 +0200
+--- links-1.04/Makefile.am.orig	2020-09-06 09:49:55.873368277 +0200
++++ links-1.04/Makefile.am	2020-09-06 09:52:55.222396660 +0200
 @@ -8,7 +8,7 @@
- EXTRA_DIST=$(man_MANS) Unicode/* intl/* config2.h Makefile.gen BUGS TODO SITES mailcap.pl wipe-out-ssl wipe-out-ssl.awk links.nsi
+ EXTRA_DIST=$(man_MANS) descrip.mms *.opt Unicode/* intl/* KEYS SITES mailcap.pl wipe-out-ssl wipe-out-ssl.awk links.nsi rebuild rebuild.cmd pkg-config.m4
  
  bin_PROGRAMS=links
--links_SOURCES=af_unix.c beos.c bfu.c bookmark.c cache.c charsets.c connect.c cookies.c default.c dns.c error.c file.c finger.c ftp.c html.c html_r.c html_tbl.c http.c https.c kbd.c kbdbind.c language.c mailto.c main.c menu.c os_dep.c sched.c select.c session.c smb.c terminal.c types.c url.c view.c links.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc upcase.inc rebuild rebuild.cmd
-+links_SOURCES=af_unix.c beos.c bfu.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c default.c dns.c error.c file.c finger.c ftp.c html.c html_r.c html_tbl.c http.c https.c kbd.c kbdbind.c language.c mailto.c main.c menu.c os_dep.c sched.c select.c session.c smb.c terminal.c types.c url.c view.c links.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc upcase.inc rebuild rebuild.cmd
+-links_SOURCES=af_unix.c beos.c bfu.c bookmark.c cache.c charsets.c connect.c cookies.c default.c dns.c error.c file.c finger.c fn_impl.c ftp.c hpux.c html.c html_r.c html_tbl.c http.c https.c kbd.c kbdbind.c language.c mailto.c main.c menu.c os_dep.c sched.c select.c session.c smb.c terminal.c types.c url.c view.c vms.c codepage.h com-defs.h config-vms.h hpux.h language.h links.h os_dep.h os_depx.h setup.h codepage.inc entity.inc language.inc uni_7b.inc upcase.inc
++links_SOURCES=af_unix.c beos.c bfu.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c default.c dns.c error.c file.c finger.c fn_impl.c ftp.c hpux.c html.c html_r.c html_tbl.c http.c https.c kbd.c kbdbind.c language.c mailto.c main.c menu.c os_dep.c sched.c select.c session.c smb.c terminal.c types.c url.c view.c vms.c codepage.h com-defs.h config-vms.h hpux.h language.h links.h os_dep.h os_depx.h setup.h codepage.inc entity.inc language.inc uni_7b.inc upcase.inc
  
  datadir = $(prefix)/@DATADIRNAME@
  LIBS = @LIBS@
 --- /dev/null	Tue May  5 22:32:27 1998
 +++ links-0.97.newer/compress.c	Wed Jul  3 19:28:29 2002
-@@ -0,0 +1,166 @@
+@@ -0,0 +1,164 @@
 +#include "links.h"
 +
 +#define WMAXBITS 15
@@ -32,8 +32,6 @@
 +{
 +   mem_free(address);
 +}
-+      
-+
 +
 +static z_streamp gzip_init(unsigned char *buf_old, int l)
 +{
@@ -178,7 +176,6 @@
 +   *z = NULL;
 +   return output;
 +}
-+             
 --- links-0.97/http.c	Tue Mar 26 22:49:22 2002
 +++ links-0.97/http.c.new	Thu Jul  4 20:02:21 2002
 @@ -262,6 +262,7 @@
@@ -242,12 +239,12 @@
  			kill_buffer_data(rb, l);
  			if (!info->chunk_remaining && rb->len >= 1) {
  				if (rb->data[0] == 10) kill_buffer_data(rb, 1);
-@@ -635,6 +665,18 @@
+@@ -635,6 +665,19 @@
  	if (!e->last_modified && (d = parse_http_header(e->head, "Date", NULL)))
  		e->last_modified = d;
  	if (info->length == -1 || (version < 11 && info->close)) rb->close = 1;
-+	d = parse_http_header(e->head, "Content-Encoding", NULL);
 +	c->gzip = 0;
++	d = parse_http_header(e->head, "Content-Encoding", NULL);
 +	if (d) {
 +		if (!strcasecmp(d, "gzip") || !strcasecmp(d, "x-gzip")) {
 +			mem_free(d);
@@ -256,14 +253,15 @@
 +				if (!strncasecmp(d, "text", 4)) c->gzip = 1;
 +				mem_free(d);
 +			}
-+		}
++		} else
++			mem_free(d);
 +	} 
  	read_http_data(c, rb);
  }
  
---- links-0.97/links.h	Wed Jul  3 19:31:24 2002
-+++ links-0.97.newer/links.h	Wed Jul  3 18:59:03 2002
-@@ -99,6 +99,8 @@
+--- links-1.04/links.h.orig	2020-09-06 10:02:40.652558446 +0200
++++ links-1.04/links.h	2020-09-06 11:07:38.991439332 +0200
+@@ -197,6 +197,8 @@ strtoq(const char *, char **, int);
  
  #ifdef HAVE_ZLIB_H
  #include <zlib.h>
@@ -272,27 +270,25 @@
  #endif
  
  #include "os_depx.h"
-@@ -684,6 +685,8 @@
+@@ -1087,6 +1089,8 @@ struct connection {
  	SSL *ssl;
- 	int no_tsl;
+ 	int no_tls;
  #endif
 +   int gzip;
 +   z_streamp z;
  };
  
- static inline int getpri(struct connection *c)
---- links-0.97/sched.c	Wed Mar 27 00:32:49 2002
-+++ links-0.97.newer/sched.c	Wed Jul  3 18:26:17 2002
-@@ -220,7 +220,11 @@
+ extern tcount netcfg_stamp;
+--- links-1.04/sched.c.orig	2020-09-06 09:49:55.873368277 +0200
++++ links-1.04/sched.c	2020-09-06 09:54:13.408639755 +0200
+@@ -232,6 +232,10 @@ void del_connection(struct connection *c
  {
  	del_from_list(c);
  	send_connection_info(c);
--	mem_free(c->url);
 +	if (c->z) {
-+      inflateEnd(c->z);
-+      mem_free(c->z);
-+   }
-+   mem_free(c->url);
- 	mem_free(c);
- }
- 
++		inflateEnd(c->z);
++		mem_free(c->z);
++	}
+ 	if (c->detached) {
+ 		struct cache_entry *ce = c->cache;
+ 		if (ce && !ce->url[0] && !is_entry_used(ce) && !ce->refcount)
diff --git a/links-gzip_fallback.patch b/links-gzip_fallback.patch
index 1c72f28..aeafbdc 100644
--- a/links-gzip_fallback.patch
+++ b/links-gzip_fallback.patch
@@ -10,36 +10,48 @@
  #ifdef HAVE_SSL
  ssld=yes
  AC_ARG_WITH(ssl, [  --with-ssl(=directory)  enable SSL support], [if test "$withval" = no; then disable_ssl=yes; else ssld="$withval"; fi])
---- links-1.03/file.c.orig	2011-11-16 03:26:53.000000000 +0100
-+++ links-1.03/file.c	2013-06-21 21:00:28.615796496 +0200
-@@ -228,9 +228,14 @@
- 		mem_free(name);
- 		setcstate(c, S_FILE_TYPE); abort_connection(c); return;
+--- links-1.04/file.c.orig	2018-03-31 18:29:41.000000000 +0200
++++ links-1.04/file.c	2020-09-06 12:21:37.464060729 +0200
+@@ -224,6 +224,7 @@ void file_func(struct connection *c)
+ 	int h, r;
+ 	struct stat stt;
+ 	int rs;
++	int gz_fallback = 0;
+ 	if (anonymous) {
+ 		setcstate(c, S_BAD_URL);
+ 		abort_connection(c);
+@@ -232,8 +233,14 @@ void file_func(struct connection *c)
+ 	if (!(name = get_filename(c->url))) {
+ 		setcstate(c, S_OUT_OF_MEM); abort_connection(c); return;
  	}
-+opening:
- 	if ((h = open(name, O_RDONLY | O_NOCTTY)) == -1) {
- 		int er = errno;
- 		if ((d = opendir(name))) goto dir;
-+		if (strncmp(name + strlen(name) - 3, ".gz", 3) != 0) {
++checking:
+ 	EINTRLOOP(rs, stat(cast_const_char name, &stt));
+ 	if (rs) {
++		if ((strlen(name) <= 3) || (strncmp(name + strlen(name) - 3, ".gz", 3) != 0)) {
 +			add_to_strn(&name, ".gz");
-+			goto opening;
++			gz_fallback = 1;
++			goto checking;
 +		} 
  		mem_free(name);
- 		setcstate(c, get_error_from_errno(er));
- 		abort_connection(c);
-@@ -363,12 +368,43 @@
- 		add_to_str(&file, &fl, "</pre></body></html>\n");
- 		head = stracpy("\r\nContent-Type: text/html\r\n");
+ 		setcstate(c, get_error_from_errno(errno)); abort_connection(c); return;
+ 	}
+@@ -385,16 +392,47 @@ void file_func(struct connection *c)
+ 		add_to_str(&file, &fl, cast_uchar "</pre></body></html>\n");
+ 		head = stracpy(cast_uchar "\r\nContent-Type: text/html\r\n");
  	} else {
 -		mem_free(name);
- 		if (stt.st_size > MAXINT) {
+ 		if (
+ #ifndef __WATCOMC__
+ 		    stt.st_size < 0 ||
+ #endif
+ 		    stt.st_size > MAXINT) {
 +			mem_free(name);
- 			close(h);
+ 			EINTRLOOP(rs, close(h));
  			setcstate(c, S_LARGE_FILE); abort_connection(c);
  			return;
  		}
 +#ifdef HAVE_ZLIB_H
-+		if (strncmp(name + strlen(name) - 3, ".gz", 3) == 0) {
++		if (gz_fallback) {
 +		/* decompression */
 +			gzFile gh = gzdopen(h, "r");
 +			fl = 0;
@@ -71,15 +83,15 @@
 +  		mem_free(name);
  		/* + !stt.st_size is there because of bug in Linux. Read returns
  		   -EACCES when reading 0 bytes to invalid address */
- 		file = mem_alloc(stt.st_size + !stt.st_size);
-@@ -380,6 +416,7 @@
- 		close(h);
- 		fl = stt.st_size;
- 		head = stracpy("");
+ 		file = mem_alloc_mayfail((size_t)stt.st_size + !stt.st_size);
+@@ -418,6 +456,7 @@ void file_func(struct connection *c)
+ 		fl = r;
+ 		EINTRLOOP(rs, close(h));
+ 		head = stracpy(cast_uchar "");
 +		}
  	}
- 	if (get_cache_entry(c->url, &e)) {
- 		mem_free(file);
+ 	if (!c->cache) {
+ 		if (get_cache_entry(c->url, &c->cache)) {
 --- links-0.97/links.h	Wed Jul  3 10:36:17 2002
 +++ links-0.97/links.h.new	Wed Jul  3 10:44:18 2002
 @@ -97,6 +97,10 @@
diff --git a/openssl.patch b/openssl.patch
index 296ce9e..2a6bc19 100644
--- a/openssl.patch
+++ b/openssl.patch
@@ -1,39 +1,14 @@
---- links-1.03/connect.c.orig	2018-09-21 14:20:27.000000000 +0000
-+++ links-1.03/connect.c	2018-09-21 14:30:55.284823551 +0000
-@@ -106,7 +106,7 @@
- 
- 	set_timeout(c);
- 
--	if (c->no_tsl) c->ssl->options |= SSL_OP_NO_TLSv1;
-+	if (c->no_tsl) SSL_set_options(c->ssl, SSL_OP_NO_TLSv1);
- 	switch (SSL_get_error(c->ssl, SSL_connect(c->ssl))) {
- 		case SSL_ERROR_NONE:
- 			c->newconn = NULL;
-@@ -187,7 +186,7 @@
- 	if (c->ssl) {
- 		c->ssl = getSSL();
- 		SSL_set_fd(c->ssl, *b->sock);
--		if (c->no_tsl) c->ssl->options |= SSL_OP_NO_TLSv1;
-+		if (c->no_tsl) SSL_set_options(c->ssl, SSL_OP_NO_TLSv1);
- 		switch (SSL_get_error(c->ssl, SSL_connect(c->ssl))) {
- 			case SSL_ERROR_WANT_READ:
- 				setcstate(c, S_SSL_NEG);
---- links-1.03/https.c~	2006-09-11 02:09:24.000000000 +0000
-+++ links-1.03/https.c	2018-09-21 14:32:10.946014296 +0000
-@@ -30,15 +30,7 @@
- SSL *getSSL(void)
- {
- 	if (!context) {
--		char f_randfile[PATH_MAX];
--
--		const char *f = RAND_file_name(f_randfile, sizeof(f_randfile));
--		if (f && RAND_egd(f)<0) {
--			/* Not an EGD, so read and write to it */
--			if (RAND_load_file(f_randfile, -1))
--				RAND_write_file(f_randfile);
--		}
--		SSLeay_add_ssl_algorithms();
+--- links-1.04/https.c.orig	2018-02-08 19:01:11.000000000 +0100
++++ links-1.04/https.c	2020-09-06 10:00:32.673251769 +0200
+@@ -53,7 +53,11 @@ SSL *getSSL(void)
+ 			RAND_add(pool, sizeof pool, sizeof pool);
+ 		}
+ #endif
++#if !(OPENSSL_API_COMPAT < 0x10100000L)
 +		OPENSSL_init_ssl(0, NULL);
++#else
+ 		SSLeay_add_ssl_algorithms();
++#endif
  		context = SSL_CTX_new(SSLv23_client_method());
  		SSL_CTX_set_options(context, SSL_OP_ALL);
  		SSL_CTX_set_default_verify_paths(context);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/links.git/commitdiff/c6ec6a04f45d3e7293835a518eeb85baede577a2



More information about the pld-cvs-commit mailing list