code:
Index: os-prober-1.58/linux-boot-probes/mounted/common/40grub2
===================================================================
--- os-prober-1.58.orig/linux-boot-probes/mounted/common/40grub2
+++ os-prober-1.58/linux-boot-probes/mounted/common/40grub2
@@ -77,7 +77,7 @@ parse_grub_menu () {
 					ignore_item=1
 				fi
 			;;
-			linux)
+			linux*)
 				# Hack alert: sed off any (hdn,n) but
 				# assume the kernel is on the same
 				# partition.
@@ -90,7 +90,7 @@ parse_grub_menu () {
 					kernel="/boot$kernel"
 				fi
 			;;
-			initrd)
+			initrd*)
 				initrd="$(echo "$2" | sed 's/(.*)//')"
 				# Initrd same.
 				if [ "$partition" != "$bootpart" ]; then


code:
Index: os-prober/os-prober
===================================================================
--- os-prober.orig/os-prober
+++ os-prober/os-prober
@@ -64,6 +64,11 @@ partitions () {
 		exit 0
 	fi

+	# Add MD RAID devices
+	if [ -f /proc/mdstat ] ; then
+		awk '/^md/ {printf "/dev/"$1"\n"}' /proc/mdstat
+	fi
+
 	# Also detect OSes on LVM volumes (assumes LVM is active)
 	if type lvs >/dev/null 2>&1; then
 		echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name |
@@ -123,7 +128,7 @@ if [ -f /proc/swaps ]; then
 fi
 : >"$OS_PROBER_TMP/raided-map"
 if [ -f /proc/mdstat ] ; then
-	grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
+	grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
 fi

 for partition in $(partitions); do

repo_name: dustdfg/dragora

license: mit


code:
Index: os-prober/common.sh
===================================================================
--- os-prober.orig/common.sh
+++ os-prober/common.sh
@@ -146,7 +146,7 @@ parse_proc_mounts () {
 		set -f
 		set -- $line
 		set +f
-		printf '%s %s %s\n' "$(mapdevfs "$1")" "$2" "$3"
+		printf '%s %s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" "$1"
 	done
 }

Index: os-prober/linux-boot-prober
===================================================================
--- os-prober.orig/linux-boot-prober
+++ os-prober/linux-boot-prober
@@ -167,7 +167,7 @@ else
 			bootpart="${mountboot%% *}"
 			bootmounted="${mountboot#* }"
 		else
-			bootpart="$partition"
+			bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)"
 			bootmounted=0
 		fi
 		for test in /usr/lib/linux-boot-probes/mounted/*; do


code:
From f71f7eb5c492720c24033901ef8c6c420e188ff2 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2012 14:47:35 -0400
Subject: [PATCH] Don't count our dummy mach_kernel as real MacOS X.

---
 os-probes/mounted/powerpc/20macosx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/os-probes/mounted/powerpc/20macosx
===================================================================
--- a/os-probes/mounted/powerpc/20macosx
+++ b/os-probes/mounted/powerpc/20macosx
@@ -21,7 +21,7 @@ esac
 # but I don't think it exists on Mac OS <= 9, and it's XML so parsing in
 # shell will be nasty.

-if [ -e "$2/mach_kernel" ]; then
+if [ -e "$2/mach_kernel" ] && ! dd if="$2/mach_kernel" count=1 bs=5 2>/dev/null | grep -aq Dummy ; then
   label="$(count_next_label MacOSX)"
   result "$1:Mac OS X:$label:macosx"
   exit 0


code:
Index: os-prober/common.sh
===================================================================
--- os-prober.orig/common.sh
+++ os-prober/common.sh
@@ -336,3 +336,13 @@ linux_mount_boot () {

 	mountboot="$bootpart $mounted"
 }
+
+umount_exec=$(which umount)
+umount() {
+	if ! $umount_exec $@ 2> /dev/null; then
+		error "umount error, retrying after 1 sec"
+		sleep 1
+		$umount_exec $@
+	fi
+}
+


code:
From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 11:34:51 +0200
Subject: Allow input files to be missing for ed-style patches

* src/pch.c (do_ed_script): Allow input files to be missing so that new
files will be created as with non-ed-style patches.
---
 src/pch.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/pch.c b/src/pch.c
index bc6278c..0c5cc26 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname,

     if (! dry_run && ! skip_rest_of_patch) {
 	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
-	assert (! inerrno);
-	*outname_needs_removal = true;
-	copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+	if (inerrno != ENOENT)
+	  {
+	    *outname_needs_removal = true;
+	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+	  }
 	sprintf (buf, "%s %s%s", editor_program,
 		 verbosity == VERBOSE ? "" : "- ",
 		 outname);
--
cgit v1.0-41-gc330


code:
From 123eaff0d5d1aebe128295959435b9ca5909c26d Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 12:14:49 +0200
Subject: Fix arbitrary command execution in ed-style patches
 (CVE-2018-1000156)

* src/pch.c (do_ed_script): Write ed script to a temporary file instead
of piping it to ed: this will cause ed to abort on invalid commands
instead of rejecting them and carrying on.
* tests/ed-style: New test case.
* tests/Makefile.am (TESTS): Add test case.
---
 src/pch.c         | 91 ++++++++++++++++++++++++++++++++++++++++---------------
 tests/Makefile.am |  1 +
 tests/ed-style    | 41 +++++++++++++++++++++++++
 3 files changed, 108 insertions(+), 25 deletions(-)
 create mode 100644 tests/ed-style

diff --git a/src/pch.c b/src/pch.c
index 0c5cc26..4fd5a05 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -33,6 +33,7 @@
 # include <io.h>
 #endif
 #include <safe.h>
+#include <sys/wait.h>

 #define INITHUNKMAX 125			/* initial dynamic allocation size */

@@ -2389,24 +2390,28 @@ do_ed_script (char const *inname, char const *outname,
     static char const editor_program[] = EDITOR_PROGRAM;

     file_offset beginning_of_this_line;
-    FILE *pipefp = 0;
     size_t chars_read;
+    FILE *tmpfp = 0;
+    char const *tmpname;
+    int tmpfd;
+    pid_t pid;
+
+    if (! dry_run && ! skip_rest_of_patch)
+      {
+	/* Write ed script to a temporary file.  This causes ed to abort on
+	   invalid commands such as when line numbers or ranges exceed the
+	   number of available lines.  When ed reads from a pipe, it rejects
+	   invalid commands and treats the next line as a new command, which
+	   can lead to arbitrary command execution.  */
+
+	tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
+	if (tmpfd == -1)
+	  pfatal ("Can't create temporary file %s", quotearg (tmpname));
+	tmpfp = fdopen (tmpfd, "w+b");
+	if (! tmpfp)
+	  pfatal ("Can't open stream for file %s", quotearg (tmpname));
+      }

-    if (! dry_run && ! skip_rest_of_patch) {
-	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
-	if (inerrno != ENOENT)
-	  {
-	    *outname_needs_removal = true;
-	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
-	  }
-	sprintf (buf, "%s %s%s", editor_program,
-		 verbosity == VERBOSE ? "" : "- ",
-		 outname);
-	fflush (stdout);
-	pipefp = popen(buf, binary_transput ? "wb" : "w");
-	if (!pipefp)
-	  pfatal ("Can't open pipe to %s", quotearg (buf));
-    }
     for (;;) {
 	char ed_command_letter;
 	beginning_of_this_line = file_tell (pfp);
@@ -2417,14 +2422,14 @@ do_ed_script (char const *inname, char const *outname,
 	}
 	ed_command_letter = get_ed_command_letter (buf);
 	if (ed_command_letter) {
-	    if (pipefp)
-		if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
+	    if (tmpfp)
+		if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
 		    write_fatal ();
 	    if (ed_command_letter != 'd' && ed_command_letter != 's') {
 	        p_pass_comments_through = true;
 		while ((chars_read = get_line ()) != 0) {
-		    if (pipefp)
-			if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
+		    if (tmpfp)
+			if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
 			    write_fatal ();
 		    if (chars_read == 2  &&  strEQ (buf, ".\n"))
 			break;
@@ -2437,13 +2442,49 @@ do_ed_script (char const *inname, char const *outname,
 	    break;
 	}
     }
-    if (!pipefp)
+    if (!tmpfp)
       return;
-    if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0
-	|| fflush (pipefp) != 0)
+    if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0
+	|| fflush (tmpfp) != 0)
       write_fatal ();
-    if (pclose (pipefp) != 0)
-      fatal ("%s FAILED", editor_program);
+
+    if (lseek (tmpfd, 0, SEEK_SET) == -1)
+      pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
+
+    if (! dry_run && ! skip_rest_of_patch) {
+	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+	*outname_needs_removal = true;
+	if (inerrno != ENOENT)
+	  {
+	    *outname_needs_removal = true;
+	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+	  }
+	sprintf (buf, "%s %s%s", editor_program,
+		 verbosity == VERBOSE ? "" : "- ",
+		 outname);
+	fflush (stdout);
+
+	pid = fork();
+	if (pid == -1)
+	  pfatal ("Can't fork");
+	else if (pid == 0)
+	  {
+	    dup2 (tmpfd, 0);
+	    execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
+	    _exit (2);
+	  }
+	else
+	  {
+	    int wstatus;
+	    if (waitpid (pid, &wstatus, 0) == -1
+	        || ! WIFEXITED (wstatus)
+		|| WEXITSTATUS (wstatus) != 0)
+	      fatal ("%s FAILED", editor_program);
+	  }
+    }
+
+    fclose (tmpfp);
+    safe_unlink (tmpname);

     if (ofp)
       {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6b6df63..16f8693 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@ TESTS = \
 	crlf-handling \
 	dash-o-append \
 	deep-directories \
+	ed-style \
 	empty-files \
 	false-match \
 	fifo \
diff --git a/tests/ed-style b/tests/ed-style
new file mode 100644
index 0000000..d8c0689
--- /dev/null
+++ b/tests/ed-style
@@ -0,0 +1,41 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > ed1.diff <<EOF
+0a
+foo
+.
+EOF
+
+check 'patch -e foo -i ed1.diff' <<EOF
+EOF
+
+check 'cat foo' <<EOF
+foo
+EOF
+
+cat > ed2.diff <<EOF
+1337a
+r !echo bar
+,p
+EOF
+
+check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
+?
+Status: 2
+EOF
+
+check 'cat foo' <<EOF
+foo
+EOF
--
cgit v1.0-41-gc330


code:
From f290f48a621867084884bfff87f8093c15195e6a Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Mon, 12 Feb 2018 16:48:24 +0100
Subject: Fix segfault with mangled rename patch

http://savannah.gnu.org/bugs/?53132
* src/pch.c (intuit_diff_type): Ensure that two filenames are specified
for renames and copies (fix the existing check).
---
 src/pch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pch.c b/src/pch.c
index ff9ed2c..bc6278c 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -974,7 +974,8 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
     if ((pch_rename () || pch_copy ())
 	&& ! inname
 	&& ! ((i == OLD || i == NEW) &&
-	      p_name[! reverse] &&
+	      p_name[reverse] && p_name[! reverse] &&
+	      name_is_valid (p_name[reverse]) &&
 	      name_is_valid (p_name[! reverse])))
       {
 	say ("Cannot %s file without two valid file names\n", pch_rename () ? "rename" : "copy");
--
cgit v1.0-41-gc330


code:
--- Configure.orig	2013-05-10 11:13:56.000000000 -0300
+++ Configure	2013-05-20 17:02:58.000000000 -0300
@@ -5119,7 +5119,7 @@
 	# as that way the compiler can do the right implementation dependant
 	# thing. (NWC)
 	case "$gccversion" in
-	?*)	set stack-protector -fstack-protector
+	?*)	set stack-protector -fnostack-protector
 		eval $checkccflag
 		;;
 	esac
@@ -5261,12 +5261,12 @@
 	;;
 *) dflt="$ldflags";;
 esac
-# See note above about -fstack-protector
+# See note above about -fnostack-protector
 case "$ccflags" in
-*-fstack-protector*)
+*-fnostack-protector*)
 	case "$dflt" in
-	*-fstack-protector*) ;; # Don't add it again
-	*) dflt="$dflt -fstack-protector" ;;
+	*-fnostack-protector*) ;; # Don't add it again
+	*) dflt="$dflt -fnostack-protector" ;;
 	esac
 	;;
 esac
@@ -8091,10 +8091,10 @@
 	esac

 	case "$ldflags" in
-	*-fstack-protector*)
+	*-fnostack-protector*)
 	    case "$dflt" in
-			*-fstack-protector*) ;; # Don't add it again
-			*) dflt="$dflt -fstack-protector" ;;
+			*-fnostack-protector*) ;; # Don't add it again
+			*) dflt="$dflt -fnostack-protector" ;;
 		esac
 		;;
 	esac

path: patches/perl/perl-fnostack-protector


code:
--- Configure.orig	2012-10-25 23:44:14.000000000 -0300
+++ Configure	2012-11-24 08:39:34.000000000 -0300
@@ -2461,9 +2461,9 @@
 esac
 case "$less" in
 '')	;;
-*)	if $less -R </dev/null >/dev/null; then
-	       echo "Substituting less -R for less."
-	       less="$less -R"
+*)	if $less </dev/null >/dev/null; then
+	       echo "Substituting less for less."
+	       less="$less"
 	       _less=$less
 	fi
 	;;


code:
--- hints/linux.sh.orig	2013-03-04 12:16:22.000000000 -0300
+++ hints/linux.sh	2013-05-08 11:28:30.000000000 -0300
@@ -66,10 +66,7 @@
 # We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
 # are insufficiently precise to distinguish things like
 # libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
-    libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
-    libc=/lib/$libc
-fi
+libc=${prefix}/lib/libc.a

 # Configure may fail to find lstat() since it's a static/inline
 # function in <sys/stat.h>.
@@ -167,11 +164,7 @@
 # we don't want its libraries. So we try to prefer the system gcc
 # Still, as an escape hatch, allow Configure command line overrides to
 # plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
-    gcc=/usr/bin/gcc
-else
-    gcc=gcc
-fi
+gcc=gcc

 case "$plibpth" in
 '') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
@@ -466,3 +459,8 @@
     libswanted="$libswanted pthread"
     ;;
 esac
+
+locincpth=""
+loclibpth=""
+glibpth="${prefix}/lib"
+usrinc="${prefix}/include"


code:
--- conf.mk.orig	2013-01-11 12:10:32.000000000 -0300
+++ conf.mk	2016-12-16 10:32:28.000000000 -0300
@@ -5,7 +5,7 @@

 ## build configuration, standard gcc + libc:
 CC = gcc
-CFLAGS = -Wall -Wextra -Wshadow -DNDEBUG -O2
+CFLAGS = -Wall -Wextra -Wshadow -DNDEBUG $(QICFLAGS)
 #CFLAGS = -Wall -Wextra -Wshadow -O2

 ## build configuration, dietlibc:


code:
diff --git a/lasagna/cdb/cdb_dynread.c b/lasagna/cdb/cdb_dynread.c
index b7135c5..f5e7ab8 100644
--- a/lasagna/cdb/cdb_dynread.c
+++ b/lasagna/cdb/cdb_dynread.c
@@ -23,7 +23,7 @@ cdb_dynread(struct cdb *C, struct dynbuf *B, size_t len, uint32_t offset)
   if(dynbuf_grow(B, len) == -1)
       return -1;

-  if(cdb_read(C, dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1)
+  if(cdb_read(C, (uchar_t *)dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1)
       return -1;

   dynbuf_LEN(B) += len;
diff --git a/lasagna/dynbuf/dynbuf_pack.c b/lasagna/dynbuf/dynbuf_pack.c
index 84727cb..4543a0a 100644
--- a/lasagna/dynbuf/dynbuf_pack.c
+++ b/lasagna/dynbuf/dynbuf_pack.c
@@ -46,7 +46,7 @@ dynbuf_pack(struct dynbuf *D, const char *fmt, ...)
   }

   /* with need satisfied, append directly into buf: */
-  b = (D->buf + D->p);
+  b = (uchar_t *)D->buf + D->p;

   va_start(args, fmt);
   w = upak_vpack(b, fmt, args);
diff --git a/lasagna/dynbuf/dynbuf_put.c b/lasagna/dynbuf/dynbuf_put.c
index 6ff7bdb..46989c4 100644
--- a/lasagna/dynbuf/dynbuf_put.c
+++ b/lasagna/dynbuf/dynbuf_put.c
@@ -19,10 +19,11 @@ dynbuf_putbuf(struct dynbuf *d, const void *buf, size_t len)
     if(dynbuf_grow(d, (len + 1)) != 0)
         return -1;  /* error! */

-    buf_copy((d->buf + d->p), buf, len);
+    b = d->buf;
+    buf_copy(b + d->p, buf, len);

     d->p += len;
-    b = d->buf; b[d->p] = 'Q'; /* "offensive programming" */
+    b[d->p] = 'Q'; /* "offensive programming" */

     return 0; /* no error */
 }
diff --git a/lasagna/hdb/hdb_dynread.c b/lasagna/hdb/hdb_dynread.c
index cd818bc..82d20d2 100644
--- a/lasagna/hdb/hdb_dynread.c
+++ b/lasagna/hdb/hdb_dynread.c
@@ -23,7 +23,7 @@ hdb_dynread(struct hdb *H, struct dynbuf *B, size_t len, uint32_t offset)
   if(dynbuf_grow(B, len) == -1)
       return -1;

-  if(hdb_read(H, dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1)
+  if(hdb_read(H, (uchar_t *)dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1)
       return -1;

   dynbuf_LEN(B) += len;
diff --git a/lasagna/ioq/iobuf_getnets.c b/lasagna/ioq/iobuf_getnets.c
deleted file mode 100644
index 55447ee..0000000
--- a/lasagna/ioq/iobuf_getnets.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-** iobuf_getnets.c
-** wcm, 2004.04.28 - 2004.04.29
-** ===
-*/
-#include "iobuf.h"
-
-#include "buf.h"
-#include "dynbuf.h"
-
-
-static
-int
-get_netslen(iobuf *ibuf, size_t *len, size_t max)
-{
-    char    c;
-    size_t  n = 0;
-    int     digits = 0;
-
-/*
-** returns length in len and:
-**   -3, netstring format error
-**   -1, io error
-**    0, EOF
-**    1, ok
-*/
-
-  for(;;){
-      switch(iobuf_GETC(ibuf, &c)){
-          case -1: return -1;  /* io error */
-          case  0: return 0;   /* EOF */
-          default: break;      /* ok */
-      }
-      if(c == ':'){
-          if(digits){
-              *len = n;
-              return 1;
-          }
-          else break;
-      }
-      if((c < '0') || (c > '9')) break;
-      n = 10 * n + (c - '0');
-      if((digits && (n == 0)) || (n > max)) break;
-      ++digits;
-  }
-
-  /* netstring format error: */
-  return -3;
-}
-
-
-int iobuf_getnets(iobuf *ibuf, dynbuf *b, size_t max)
-{
-  int     r;
-  size_t  len = 0;
-  char   *buf;
-  char    c;
-
-/*
-** returns netstring in dynbuf:
-**  -3, netstring format error
-**  -1, error (io or malloc)
-**   0, EOF
-**   1, ok
-*/
-
-  switch(get_netslen(ibuf, &len, max)){
-      case -3: return -3;
-      case -1: return -1;
-      case  0: return 0;
-      default: break;
-  }
-
-  if(dynbuf_grow(b, len) != 0)
-      return -1; /* malloc error */
-
-  buf = dynbuf_BUF(b);
-  while(len){
-      r = iobuf_get(ibuf, buf, len);
-      switch(r){
-          case -1: return -1; /* io error */
-          case  0: return -3; /* eof before complete */
-          default: break;
-      }
-      dynbuf_LEN(b) += r;
-      if(r == len) break;
-      /* else: */
-      buf += r;
-      len -= r;
-  }
-
-  /* so far, so good; now comma? */
-  switch(iobuf_GETC(ibuf, &c)){
-      case -1: return -1;  /* io error */
-      case  0: return -3;  /* eof before comma */
-      default: break;
-  }
-  if(c != ',') return -3;
-
-  /* success: */
-  return 1;
-}
-
-/* that's all, folks! */
diff --git a/lasagna/ioq/iobuf_getrec.c b/lasagna/ioq/iobuf_getrec.c
deleted file mode 100644
index 6462452..0000000
--- a/lasagna/ioq/iobuf_getrec.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-** iobuf_getrec.c
-** wcm, 2004.04.28 - 2004.04.29
-** ===
-*/
-#include "iobuf.h"
-
-#include "buf.h"
-#include "dynbuf.h"
-
-int iobuf_getrec(iobuf *ibuf, dynbuf *b, int sep)
-{
-  int    r;
-  int    n;
-  char  *x;
-
-/*
-** returns:
-**  -1, error (io or malloc)
-**   0, EOF
-**   1, ok
-*/
-
-  for(;;){
-      r = iobuf_feed(ibuf);
-      if(r <= 0) return r;   /* EOF (0) or io error (-1) */
-
-      x = (char *)iobuf_PEEK(ibuf);
-      n = buf_ndx(x, r, sep);
-      if(n < r){ /* sep found */
-          if(dynbuf_putbuf(b, x, n) == 0) { /* ok */
-              /* strip contents out of ibuf */
-              iobuf_SEEK(ibuf, (n+1));
-              /* success: */
-              return 1;
-          }
-          else /* dynbuf malloc failure: */
-              return -1;
-      }
-      /* else: */
-      if(dynbuf_grow(b, r) != 0)
-          return -1;
-      dynbuf_LEN(b) += iobuf_get(ibuf, dynbuf_BUF(b)+dynbuf_LEN(b), r);
-  }
-
-  /* not here: */
-  return -1;
-}
-
-/* that's all, folks! */
diff --git a/lasagna/ioq/ioq_put.c b/lasagna/ioq/ioq_put.c
index 47f4897..20737a6 100644
--- a/lasagna/ioq/ioq_put.c
+++ b/lasagna/ioq/ioq_put.c
@@ -44,7 +44,7 @@

 /* internal declarations: */
-static int write_all(int fd, void *buf, size_t to_write, ssize_t (*op)());
+static int write_all(int fd, uchar_t *buf, size_t to_write, ssize_t (*op)());

 /*
@@ -63,13 +63,13 @@ static int write_all(int fd, void *buf, size_t to_write, ssize_t (*op)());
 */
 static
 int
-write_all(int fd, void *buf, size_t to_write, ssize_t (*op)())
+write_all(int fd, uchar_t *buf, size_t to_write, ssize_t (*op)())
 {
   ssize_t  w = 0;

   while(to_write){
       do{
-          w =  op(fd, buf, to_write);
+          w =  op(fd, (void *)buf, to_write);
       }while((w == -1) && (errno == EINTR));

       if(w == -1)  return -1;  /* error! */
@@ -137,7 +137,7 @@ ioq_put(ioq_t *ioq, const uchar_t *data, size_t len)
       while(len > ioq->n){
           /* don't write more than len! */
           if(len < n) n = len;
-          if(write_all(ioq->fd, (void *)data, n, ioq->op) == -1){
+          if(write_all(ioq->fd, (uchar_t *)data, n, ioq->op) == -1){
               /* write() error: */
               return -1;
           }
@@ -178,7 +178,7 @@ ioq_putflush(ioq_t *ioq, const uchar_t *data, size_t len)
   if(ioq_flush(ioq) == -1) return -1;

   /* write() the rest */
-  return write_all(ioq->fd, (void *)data, len, ioq->op);
+  return write_all(ioq->fd, (uchar_t *)data, len, ioq->op);
 }

diff --git a/lasagna/packet/packet_write.c b/lasagna/packet/packet_write.c
index 66c5f8c..6af6a94 100644
--- a/lasagna/packet/packet_write.c
+++ b/lasagna/packet/packet_write.c
@@ -50,11 +50,12 @@ packet_write(int fd, const void *packet, size_t n)
 {
    ssize_t  w = 0;
    size_t   to_write = n;
+   const char *b = packet;

    while(to_write > 0){

        do{
-           w = write(fd, packet, to_write);
+           w = write(fd, b, to_write);
        }while((w == -1) && (errno == EINTR));

        if(w == -1)
@@ -63,7 +64,7 @@ packet_write(int fd, const void *packet, size_t n)
        if(w == 0)
            continue;

-       packet += w;
+       b += w;
        to_write -= w;
    }

diff --git a/lasagna/tain/tain_now.c b/lasagna/tain/tain_now.c
index 3c790be..ba53864 100644
--- a/lasagna/tain/tain_now.c
+++ b/lasagna/tain/tain_now.c
@@ -6,18 +6,17 @@

 #include <stdlib.h>
 #include <time.h>
-#include <sys/time.h>

 #include "tain.h"

 struct tain *
 tain_now(struct tain *t)
 {
-  struct timeval now;
+  struct timespec now;

-  gettimeofday(&now, NULL);
+  clock_gettime(CLOCK_REALTIME, &now);
   tain_load_utc(t, now.tv_sec);
-  t->nsec = (1000 * now.tv_usec) + 500;
+  t->nsec = now.tv_nsec;

   return t;
 }
diff --git a/perp/perpd.c b/perp/perpd.c
index 2bf5553..1b29577 100644
--- a/perp/perpd.c
+++ b/perp/perpd.c
@@ -217,8 +217,9 @@ static
 void
 perpd_control_init(void)
 {
-  int  fdbase;
-  int  fd = -1;
+  int     fdbase;
+  int     fd = -1;
+  mode_t  umask_orig;

   /* setup for return to base directory: */
   if((fdbase = open(".", O_RDONLY)) == -1){
@@ -226,7 +227,7 @@ perpd_control_init(void)
   }

   /* setup umask for intentional mode on file creation: */
-  umask(0);
+  umask_orig = umask(0);

   /* initialize .control directory: */
   if(mkdir(PERP_CONTROL, 0700) == -1){
@@ -286,6 +287,9 @@ perpd_control_init(void)
   }
   close(fdbase);

+  /* restore umask: */
+  umask(umask_orig);
+
   return;
 }

diff --git a/perp/perpd_svdef.c b/perp/perpd_svdef.c
index 82fb0a0..7b5e87f 100644
--- a/perp/perpd_svdef.c
+++ b/perp/perpd_svdef.c
@@ -186,7 +186,7 @@ void
 perpd_svdef_checkfail(struct svdef *svdef)
 {
   struct subsv  *subsv;
-  int            target, r = 0;
+  int            target;

   /* insanity? */
   if(!(svdef->bitflags & SVDEF_FLAG_ACTIVE))
@@ -201,7 +201,7 @@ perpd_svdef_checkfail(struct svdef *svdef)
   subsv = (svdef->bitflags & SVDEF_FLAG_HASLOG) ? &svdef->svpair[SUBSV_LOG] : NULL;
   if((subsv != NULL) && (subsv->bitflags & SUBSV_FLAG_FAILING)){
       target = (subsv->bitflags & SUBSV_FLAG_ISRESET) ? SVRUN_RESET : SVRUN_START;
-      r = perpd_svdef_run(svdef, SUBSV_LOG, target);
+      perpd_svdef_run(svdef, SUBSV_LOG, target);
   }

   /* XXX, bail here if log is failing? */
diff --git a/perp/tinylog.c b/perp/tinylog.c
index 8df6283..a593a66 100644
--- a/perp/tinylog.c
+++ b/perp/tinylog.c
@@ -124,7 +124,7 @@ const char *gzip_path = NULL;
 /*
 ** declarations in scope:
 */
-static void  write_all(int fd, void *buf, size_t len);
+static void  write_all(int fd, char *buf, size_t len);
 static void stamp8601_make(char *stamp_buf);
 static void init_logdir(struct tinylog *tinylog);
 static void init_current(struct tinylog *tinylog, int resume);
@@ -182,7 +182,7 @@ ssize_t read_op(int fd, void *buf, size_t len)
 */
 static
 void
-write_all(int fd, void *buf, size_t len)
+write_all(int fd, char *buf, size_t len)
 {
   ssize_t w = 0;
   tain_t  epause = tain_INIT(0, EPAUSE);
diff --git a/runtools/runchoom.c b/runtools/runchoom.c
index e318e2a..0682ad3 100644
--- a/runtools/runchoom.c
+++ b/runtools/runchoom.c
@@ -59,7 +59,7 @@ static char  setbuf[256];
 static char  pidfmt[NFMT_SIZE];

 /* functions in scope: */
-static int write_all(int fd, void *buf, size_t to_write);
+static int write_all(int fd, char *buf, size_t to_write);
 static void do_choom(void);

 /* syserr_warn() macro: */
@@ -77,7 +77,7 @@ static void do_choom(void);

 static
 int
-write_all(int fd, void *buf, size_t to_write)
+write_all(int fd, char *buf, size_t to_write)
 {
   ssize_t  w = 0;

path: patches/perp/perp-patches


code:
--- perp-2.07/runtools/runchoom.c.orig	2019-12-18 13:00:02.306978796 +0000
+++ perp-2.07/runtools/runchoom.c	2019-12-18 13:01:01.463113686 +0000
@@ -1,5 +1,5 @@
 /* runchoom.c
-** run a program after writing "-17\n" to /proc/<pid>/oom_adj
+** run a program after writing "-17\n" to /proc/<pid>/oom_score_adj
 ** (abatement for "dreaded linux oom killer")
 ** wcm, 2011.03.18 - 2011.03.22
 ** ===
@@ -32,7 +32,7 @@
 #endif

 #ifndef CHOOM_KEY_DEFAULT
-#define CHOOM_KEY_DEFAULT  "oom_adj"
+#define CHOOM_KEY_DEFAULT  "oom_score_adj"
 #endif

 /* see proc(5) manual (linux-specific): */
--- perp-2.07/runtools/man/runchoom.8.orig	2013-01-11 15:10:33.000000000 +0000
+++ perp-2.07/runtools/man/runchoom.8	2019-12-18 13:01:10.967139845 +0000
@@ -21,7 +21,7 @@
 .SH DESCRIPTION
 .B runchoom
 writes the string ``-17'' and a newline into the procfile
-.IR /proc/<pid>/oom_adj ,
+.IR /proc/<pid>/oom_score_adj ,
 where
 .I <pid>
 is the process id of
@@ -79,7 +79,7 @@
 Normally
 .B runchoom
 uses the compiled-in default value
-.I oom_adj
+.I oom_score_adj
 for the last element of the target procfile.
 The
 .B \-k
@@ -193,7 +193,7 @@
 .RE
 .SH NOTES
 On a system where the
-.I oom_adj
+.I oom_score_adj
 procfile is operative,
 the setting installed by
 .B runchoom
@@ -210,7 +210,7 @@
 .BR perpetrate (5)
 runscripts of any selected services to
 reset the
-.I oom_adj
+.I oom_score_adj
 parameter of a process to a default state:
 .PP
 .RS


code:
--- pmount-0.9.23/src/utils.c.orig	2009-02-12 19:45:40.000000000 -0300
+++ pmount-0.9.23/src/utils.c	2020-02-15 11:18:25.157020070 -0300
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <libintl.h>
+#include <limits.h>

 /* File name used to tag directories created by pmount */
 #define CREATED_DIR_STAMP ".created_by_pmount"


code:
Pulling in utmpx.h which does not have UT_HOSTSIZE, UT_LINESIZE & UT_NAMESIZE defined.

Causing:
w.c: In function 'print_from':
w.c:236:43: error: 'UT_HOSTSIZE' undeclared (first use in this function)
  236 |    print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len);
      |                                           ^~~~~~~~~~~
w.c:236:43: note: each undeclared identifier is reported only once for each function it appears in
w.c: In function 'getproc':
w.c:357:12: error: 'UT_NAMESIZE' undeclared (first use in this function)
  357 |   char buf[UT_NAMESIZE + 1];
....

proc/escape.c:237:30: error: 'CODESET' undeclared (first use in this function)
  237 |      char *enc = nl_langinfo(CODESET);

--- a/w.c
+++ b/w.c
@@ -55,11 +55,7 @@
 #include <termios.h>
 #include <time.h>
 #include <unistd.h>
-#ifdef HAVE_UTMPX_H
-#	include <utmpx.h>
-#else
-#	include <utmp.h>
-#endif
+#include <utmp.h>
 #include <arpa/inet.h>

 static int ignoreuser = 0;	/* for '-u' */
--- a/proc/escape.c
+++ b/proc/escape.c
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <string.h>
 #include <limits.h>
+#include <langinfo.h>
 #include "procps.h"
 #include "escape.h"
 #include "readproc.h"


code:
Include fcntl.h to pacify compiler errors on musl
like

error: unknown type name 'loff_t'
Cover rpc headers under proper conditional
Dont use __P its undefined

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>

diff --git a/quota.h b/quota.h
index 4c21411..d20c217 100644
--- a/quota.h
+++ b/quota.h
@@ -182,6 +182,6 @@ enum {
 	#endif
 #endif

-long quotactl __P((int, const char *, qid_t, caddr_t));
+long quotactl (int, const char *, qid_t, caddr_t);

 #endif /* _QUOTA_ */
diff --git a/quotacheck.c b/quotacheck.c
index 2cdf475..07c18a7 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <fcntl.h>

 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/quotaio.c b/quotaio.c
index 94ae458..d57fc1a 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/file.h>
diff --git a/rquota_client.c b/rquota_client.c
index a3a4ae3..0ffe7a9 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -19,7 +19,9 @@

 #include "config.h"

+#if defined(RPC)
 #include <rpc/rpc.h>
+#endif
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -35,7 +37,9 @@
 #include <stdint.h>

 #include "mntopt.h"
+#if defined(RPC)
 #include "rquota.h"
+#endif
 #include "common.h"
 #include "quotaio.h"
 #include "quotasys.h"


code:
--- readline-8.0/shlib/Makefile.in.orig	2015-07-12 19:41:58.000000000 -0300
+++ readline-8.0/shlib/Makefile.in	2019-09-25 18:49:51.862317024 -0300
@@ -86,7 +86,7 @@
 SHOBJ_LIBS = @SHOBJ_LIBS@

 SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
-SHLIB_LIBS = @SHLIB_LIBS@
+SHLIB_LIBS = @SHLIB_LIBS@ -lncursesw

 SHLIB_DOT = @SHLIB_DOT@
 SHLIB_LIBPREF = @SHLIB_LIBPREF@


code:
			   READLINE PATCH REPORT
			   =====================

Readline-Release: 8.1
Patch-ID: readline81-001

Bug-Reported-by:	Tom Tromey <tom@tromey.com>
Bug-Reference-ID:	<875z3u9fd0.fsf@tromey.com>
Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-readline/2021-01/msg00009.html

Bug-Description:

The code to check readline versions in an inputrc file had the sense of the
comparisons reversed.

Patch (apply with `patch -p0'):

*** ../readline-8.1-patched/bind.c	2020-10-26 10:03:14.000000000 -0400
--- bind.c	2021-01-18 16:38:48.000000000 -0500
***************
*** 1235,1239 ****
    else if (_rl_strnicmp (args, "version", 7) == 0)
      {
!       int rlversion, versionarg, op, previ, major, minor;

        _rl_parsing_conditionalized_out = 1;
--- 1235,1239 ----
    else if (_rl_strnicmp (args, "version", 7) == 0)
      {
!       int rlversion, versionarg, op, previ, major, minor, opresult;

        _rl_parsing_conditionalized_out = 1;
***************
*** 1295,1316 ****
  	{
  	case OP_EQ:
! 	  _rl_parsing_conditionalized_out = rlversion == versionarg;
  	  break;
  	case OP_NE:
! 	  _rl_parsing_conditionalized_out = rlversion != versionarg;
  	  break;
  	case OP_GT:
! 	  _rl_parsing_conditionalized_out = rlversion > versionarg;
  	  break;
  	case OP_GE:
! 	  _rl_parsing_conditionalized_out = rlversion >= versionarg;
  	  break;
  	case OP_LT:
! 	  _rl_parsing_conditionalized_out = rlversion < versionarg;
  	  break;
  	case OP_LE:
! 	  _rl_parsing_conditionalized_out = rlversion <= versionarg;
  	  break;
  	}
      }
    /* Check to see if the first word in ARGS is the same as the
--- 1295,1317 ----
  	{
  	case OP_EQ:
!  	  opresult = rlversion == versionarg;
  	  break;
  	case OP_NE:
! 	  opresult = rlversion != versionarg;
  	  break;
  	case OP_GT:
! 	  opresult = rlversion > versionarg;
  	  break;
  	case OP_GE:
! 	  opresult = rlversion >= versionarg;
  	  break;
  	case OP_LT:
! 	  opresult = rlversion < versionarg;
  	  break;
  	case OP_LE:
! 	  opresult = rlversion <= versionarg;
  	  break;
  	}
+       _rl_parsing_conditionalized_out = 1 - opresult;
      }
    /* Check to see if the first word in ARGS is the same as the

*** ../readline-8.1/patchlevel	2013-11-15 08:11:11.000000000 -0500
--- patchlevel	2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 0
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 1


code:
			   READLINE PATCH REPORT
			   =====================

Readline-Release: 8.1
Patch-ID: readline81-002

Bug-Reported-by:	Volodymyr Prodan <vovcat@gmail.com>
Bug-Reference-ID:
Bug-Reference-URL:	https://savannah.gnu.org/patch/?10076

Bug-Description:

There are some characters (e.g., cyrillic) that can't be displayed using
certain single-byte encodings (e.g., cp1251) because the negative signed
int is interpreted as EOF and not displayed.

Patch (apply with `patch -p0'):

*** ../readline-8.1-patched/display.c	2021-03-16 18:12:20.000000000 -0400
--- display.c	2021-06-07 16:53:08.000000000 -0400
***************
*** 1599,1603 ****

    for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
!     putc_face (str[i], face[i], &cur_face);
    putc_face (EOF, FACE_NORMAL, &cur_face);
  }
--- 1599,1603 ----

    for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
!     putc_face ((unsigned char) str[i], face[i], &cur_face);
    putc_face (EOF, FACE_NORMAL, &cur_face);
  }

*** ../readline-8.1/patchlevel	2013-11-15 08:11:11.000000000 -0500
--- patchlevel	2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 1
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 2


code:
--- ./src/pppoe.h.orig
+++ ./src/pppoe.h
@@ -127,10 +127,6 @@
 #error Could not find a 32-bit integer type
 #endif

-#ifdef HAVE_LINUX_IF_ETHER_H
-#include <linux/if_ether.h>
-#endif
-
 #include <netinet/in.h>

 #ifdef HAVE_NETINET_IF_ETHER_H


code:
Don't install bundled gems - we package them separately.

--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -947,6 +947,7 @@
   end
 end

+=begin XXX-Patched
 install?(:ext, :comm, :gem, :'bundled-gems') do
   gem_dir = Gem.default_dir
   install_dir = with_destdir(gem_dir)
@@ -1026,6 +1027,7 @@
     puts "skip installing bundled gems because of lacking zlib"
   end
 end
+=end

 parse_args()


code:
diff --git a/thread_pthread.c b/thread_pthread.c
index 951885ffa0..cf90321d1d 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -656,9 +656,6 @@ hpux_attr_getstackaddr(const pthread_attr_t *attr, void **addr)
 #   define MAINSTACKADDR_AVAILABLE 0
 # endif
 #endif
-#if MAINSTACKADDR_AVAILABLE && !defined(get_main_stack)
-# define get_main_stack(addr, size) get_stack(addr, size)
-#endif

 #ifdef STACKADDR_AVAILABLE
 /*
@@ -740,6 +737,55 @@ get_stack(void **addr, size_t *size)
     return 0;
 #undef CHECK_ERR
 }
+
+#if defined(__linux__) && !defined(__GLIBC__) && defined(HAVE_GETRLIMIT)
+
+#ifndef PAGE_SIZE
+#include <unistd.h>
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
+static int
+get_main_stack(void **addr, size_t *size)
+{
+    size_t start, end, limit, prevend = 0;
+    struct rlimit r;
+    FILE *f;
+    char buf[PATH_MAX+80], s[8];
+    int n;
+    STACK_GROW_DIR_DETECTION;
+
+    f = fopen("/proc/self/maps", "re");
+    if (!f)
+        return -1;
+    n = 0;
+    while (fgets(buf, sizeof buf, f)) {
+        n = sscanf(buf, "%zx-%zx %*s %*s %*s %*s %7s", &start, &end, s);
+        if (n >= 2) {
+            if (n == 3 && strcmp(s, "[stack]") == 0)
+                break;
+            prevend = end;
+        }
+        n = 0;
+    }
+    fclose(f);
+    if (n == 0)
+        return -1;
+
+    limit = 100 << 20; /* 100MB stack limit */
+    if (getrlimit(RLIMIT_STACK, &r)==0 && r.rlim_cur < limit)
+        limit = r.rlim_cur & -PAGE_SIZE;
+    if (limit > end) limit = end;
+    if (prevend < end - limit) prevend = end - limit;
+    if (start > prevend) start = prevend;
+    *addr = IS_STACK_DIR_UPPER() ? (void *)start : (void *)end;
+    *size = end - start;
+    return 0;
+}
+#else
+# define get_main_stack(addr, size) get_stack(addr, size)
+#endif
+
 #endif

 static struct {


code:
The patched test is a recursion function. We have lower stack size,
so we hit SystemStackError sooner than on other platforms.

  #361 test_insns.rb:389:in `block in <top (required)>':
     # recursive once
     def once n
       return %r/#{
         if n == 0
           true
         else
           once(n-1)             # here
         end
       }/ox
     end
     x = once(128); x = once(7); x = once(16);
     x =~ "true" && $~
    #=> "" (expected "true")  once
  Stderr output is not empty
     bootstraptest.tmp.rb:3:in `once': stack level too deep (SystemStackError)
             from bootstraptest.tmp.rb:7:in `block in once'
             from bootstraptest.tmp.rb:3:in `once'
             from bootstraptest.tmp.rb:7:in `block in once'
             from bootstraptest.tmp.rb:3:in `once'
             from bootstraptest.tmp.rb:7:in `block in once'
             from bootstraptest.tmp.rb:3:in `once'
             from bootstraptest.tmp.rb:7:in `block in once'
             from bootstraptest.tmp.rb:3:in `once'
              ... 125 levels...
             from bootstraptest.tmp.rb:3:in `once'
             from bootstraptest.tmp.rb:7:in `block in once'
             from bootstraptest.tmp.rb:3:in `once'
             from bootstraptest.tmp.rb:11:in `<main>'
  Test_insns.rb           FAIL 1/187
  FAIL 1/1197 tests failed
  Make: *** [uncommon.mk:666: yes-btest-ruby] Error 1

--- a/bootstraptest/test_insns.rb
+++ b/bootstraptest/test_insns.rb
@@ -276,7 +276,7 @@
         end
       }/ox
     end
-    x = once(128); x = once(7); x = once(16);
+    x = once(32); x = once(7); x = once(16);
     x =~ "true" && $~
   },
   [ 'once', <<-'},', ],         # {


code:
Submitted By: Thomas Pegg <lnxfreak123 at insightbb dot com>
Date: 2003-11-18
Initial Package Version: 0.6.3
Origin: Thomas Pegg
Description: Fixes syntax of Makefile.am for installation of man pages,
for use with current automake versions 1.7.8 and higher.

diff -Naur sgml-common-0.6.3.orig/doc/man/Makefile.am sgml-common-0.6.3/doc/man/Makefile.am
--- sgml-common-0.6.3.orig/doc/man/Makefile.am	2001-01-30 14:42:22.000000000 +0000
+++ sgml-common-0.6.3/doc/man/Makefile.am	2003-11-18 16:48:47.000000000 +0000
@@ -1,2 +1 @@
-man8dir	  = $(mandir)/man8
-man8_DATA = *.8
+man_MANS = install-catalog.8


code:
--- sgml-common-0.6.3/bin/install-catalog.in.quotes	Mon Nov  5 11:19:23 2001
+++ sgml-common-0.6.3/bin/install-catalog.in	Mon Nov  5 11:20:12 2001
@@ -39,8 +39,8 @@
 # Process actions
 case $1 in
    -a|--add)    SGML_ACTION="addition"
-		SGML_CENTRALIZED=$2
-		SGML_ORDINARY=$3
+		SGML_CENTRALIZED="$2"
+		SGML_ORDINARY="$3"
 		;;
    -r|--remove)	if [ -z "$3" -o "$3" = "--version" ]
 		then
@@ -48,8 +48,8 @@
 		  exit 0
 		fi
    		SGML_ACTION="removal"
-		SGML_CENTRALIZED=$2
-		SGML_ORDINARY=$3
+		SGML_CENTRALIZED="$2"
+		SGML_ORDINARY="$3"
 		;;
    -h|--help)	echo -e $SGML_HELP_MESSAGE
 		exit 0
@@ -96,14 +96,14 @@
 fi
 case $SGML_ACTION in
    addition)
-	if [ -e $SGML_CENTRALIZED -a ! -w $SGML_CENTRALIZED ]
+	if [ -e "$SGML_CENTRALIZED" -a ! -w "$SGML_CENTRALIZED" ]
 	then
 	  echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2
 	  exit 2
 	fi
 	;;
    removal)
-	if [ ! -w $SGML_CENTRALIZED ]
+	if [ ! -w "$SGML_CENTRALIZED" ]
 	then
 	  echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2
 	  exit 2
@@ -119,7 +119,7 @@
 fi
 case $SGML_ACTION in
    addition)
-	if [ ! -s $SGML_ORDINARY ]
+	if [ ! -s "$SGML_ORDINARY" ]
 	then
 	  echo "`basename $0`: \"$SGML_ORDINARY\" does not exist or is empty." >&2
 	  exit 2
@@ -131,33 +131,33 @@
 case $SGML_ACTION in
     addition)
 	echo "`basename $0`: addition of $SGML_ORDINARY in $SGML_CENTRALIZED"
-	if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null
+	if grep -q "$SGML_ORDINARY" "$SGML_CENTRALIZED" 2>/dev/null
 	then
 	  echo "Warning: $SGML_ORDINARY is already installed in the centralized catalog $SGML_CENTRALIZED" >&2
 	else
-	  echo "$SGML_POINTER $SGML_ORDINARY" >> $SGML_CENTRALIZED
+	  echo "$SGML_POINTER \"$SGML_ORDINARY\"" >> "$SGML_CENTRALIZED"
 	fi
-	grep -q $SGML_CENTRALIZED /etc/sgml/catalog 2>/dev/null
+	grep -q "$SGML_CENTRALIZED" /etc/sgml/catalog 2>/dev/null
 	if [ $? -ne 0 ]
 	then
 	  echo "`basename $0`: addition of $SGML_CENTRALIZED in /etc/sgml/catalog"
-	  echo "$SGML_POINTER $SGML_CENTRALIZED" >> /etc/sgml/catalog
+	  echo "$SGML_POINTER \"$SGML_CENTRALIZED\"" >> /etc/sgml/catalog
 	fi
 	;;
    removal)
 	echo "`basename $0`: removal of $SGML_ORDINARY from $SGML_CENTRALIZED"
-	if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null
+	if grep -q "$SGML_ORDINARY" "$SGML_CENTRALIZED" 2>/dev/null
 	then
-          sed -e "\:$SGML_POINTER $SGML_ORDINARY:d" < $SGML_CENTRALIZED > ${SGML_CENTRALIZED}.new
-          mv ${SGML_CENTRALIZED}.new $SGML_CENTRALIZED
+          sed -e "\:$SGML_POINTER \"\\?$SGML_ORDINARY\"\\?:d" < "$SGML_CENTRALIZED" > "${SGML_CENTRALIZED}.new"
+          mv "${SGML_CENTRALIZED}.new" "$SGML_CENTRALIZED"
 	else
 	  echo "Warning: $SGML_ORDINARY was not found in the centralized catalog $SGML_CENTRALIZED" >&2
 	fi
-	if [ ! -s $SGML_CENTRALIZED ]
+	if [ ! -s "$SGML_CENTRALIZED" ]
 	then
-	  rm $SGML_CENTRALIZED
+	  rm "$SGML_CENTRALIZED"
 	  echo "`basename $0`: removal of $SGML_CENTRALIZED from /etc/sgml/catalog"
-          sed -e "\:$SGML_POINTER $SGML_CENTRALIZED:d" < /etc/sgml/catalog > /etc/sgml/catalog.new
+          sed -e "\:$SGML_POINTER \"\\?$SGML_CENTRALIZED\"\\?:d" < /etc/sgml/catalog > /etc/sgml/catalog.new
           mv /etc/sgml/catalog.new /etc/sgml/catalog
 	fi
 	;;


code:
--- sgml-common-0.6.3/bin/install-catalog.in.umask	Mon May 21 11:48:37 2001
+++ sgml-common-0.6.3/bin/install-catalog.in	Mon May 21 12:00:34 2001
@@ -13,6 +13,9 @@
 \040 -h, --help: \t\t\t\t Print this help message and exit\n\
 \040 -v, --version: \t\t\t Print the version number and exit\n"

+# We need the files we create to be world readable
+umask 022
+
 # Set version message
 SGML_VERSION_MESSAGE="sgml-common version @VERSION@ (install-catalog version 1.0)"


code:
--- sgml-common-0.6.3/xml-iso-entities/Makefile.am.xmldir	Fri Oct  5 16:37:43 2001
+++ sgml-common-0.6.3/xml-iso-entities/Makefile.am	Fri Oct  5 16:37:57 2001
@@ -1,4 +1,4 @@
-isoentdir = $(prefix)/share/sgml/xml-iso-entities-8879.1986
+isoentdir = $(prefix)/share/xml/xml-iso-entities-8879.1986
 isoent_DATA = ISOamsa.ent ISOamsb.ent ISOamsc.ent ISOamsn.ent ISOamso.ent ISOamsr.ent \
               ISObox.ent ISOcyr1.ent ISOcyr2.ent ISOdia.ent ISOgrk1.ent ISOgrk2.ent \
               ISOgrk3.ent ISOgrk4.ent ISOlat1.ent ISOlat2.ent ISOnum.ent ISOpub.ent \
--- sgml-common-0.6.3/xml-iso-entities/Makefile.in.xmldir	2007-05-15 17:21:31.000000000 +0100
+++ sgml-common-0.6.3/xml-iso-entities/Makefile.in	2007-05-15 17:21:43.000000000 +0100
@@ -62,7 +62,7 @@
 VERSION = @VERSION@
 docdir = @docdir@

-isoentdir = $(prefix)/share/sgml/xml-iso-entities-8879.1986
+isoentdir = $(prefix)/share/xml/xml-iso-entities-8879.1986
 isoent_DATA = ISOamsa.ent ISOamsb.ent ISOamsc.ent ISOamsn.ent ISOamso.ent ISOamsr.ent               ISObox.ent ISOcyr1.ent ISOcyr2.ent ISOdia.ent ISOgrk1.ent ISOgrk2.ent               ISOgrk3.ent ISOgrk4.ent ISOlat1.ent ISOlat2.ent ISOnum.ent ISOpub.ent               ISOtech.ent catalog


code:
--- shadow-4.11.1/etc/login.defs.orig	2021-12-24 13:31:16.000000000 -0300
+++ shadow-4.11.1/etc/login.defs	2022-01-25 03:50:01.944724386 -0300
@@ -9,7 +9,7 @@
 # Note: When PAM is used, some modules may enforce a minimum delay (e.g.
 #       pam_unix(8) enforces a 2s delay)
 #
-FAIL_DELAY		3
+FAIL_DELAY		2

 #
 # Enable logging and display of /var/log/faillog login(1) failure info.
@@ -127,7 +127,7 @@
 #   Directory where mailboxes reside, _or_ name of file, relative to the
 #   home directory.  If you _do_ define both, MAIL_DIR takes precedence.
 #
-MAIL_DIR	/var/spool/mail
+MAIL_DIR	/var/mail
 #MAIL_FILE	.mail

 #
@@ -144,7 +144,7 @@
 # fully-rooted pathname of a file containing such a spec.
 #
 #ENV_TZ		TZ=CST6CDT
-#ENV_TZ		/etc/tzname
+ENV_TZ		/etc/localtime

 #
 # If defined, an HZ environment parameter spec.
@@ -158,8 +158,8 @@
 # *REQUIRED*  The default PATH settings, for superuser and normal users.
 #
 # (they are minimal, add the rest in the shell startup files)
-ENV_SUPATH	PATH=/sbin:/bin:/usr/sbin:/usr/bin
-ENV_PATH	PATH=/bin:/usr/bin
+ENV_SUPATH     PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
+ENV_PATH       PATH=/usr/local/bin:/bin:/usr/bin

 #
 # Terminal permissions
@@ -173,7 +173,7 @@
 # set TTYPERM to either 622 or 600.
 #
 TTYGROUP	tty
-TTYPERM		0600
+TTYPERM		0620

 #
 # Login configuration initializations:
@@ -199,7 +199,7 @@
 # 022 is the default value, but 027, or even 077, could be considered
 # for increased privacy. There is no One True Answer here: each sysadmin
 # must make up their mind.
-UMASK		022
+UMASK		077

 # HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
 # home directories.
@@ -230,7 +230,7 @@
 #
 # If compiled with cracklib support, sets the path to the dictionaries
 #
-CRACKLIB_DICTPATH	/var/cache/cracklib/cracklib_dict
+#CRACKLIB_DICTPATH	/var/cache/cracklib/cracklib_dict

 #
 # Min/max values for automatic uid selection in useradd(8)
@@ -296,7 +296,7 @@
 # phone, home phone).  If not defined, no changes are allowed.
 # For backward compatibility, "yes" = "rwh" and "no" = "frwh".
 #
-CHFN_RESTRICT		rwh
+CHFN_RESTRICT		frwh

 #
 # Password prompt (%s will be replaced by user name).
@@ -334,7 +334,7 @@
 # Note: If you use PAM, it is recommended to use a value consistent with
 # the PAM modules configuration.
 #
-#ENCRYPT_METHOD DES
+ENCRYPT_METHOD SHA512

 #
 # Only works if ENCRYPT_METHOD is set to SHA256 or SHA512.
@@ -410,7 +410,7 @@
 # If this file exists and is readable, login environment will be
 # read from it.  Every line should be in the form name=value.
 #
-ENVIRON_FILE	/etc/environment
+#ENVIRON_FILE	/etc/environment

 #
 # If defined, this command is run when removing a user.
@@ -445,7 +445,7 @@
 # This option is overridden with the -M or -m flags on the useradd(8)
 # command-line.
 #
-#CREATE_HOME     yes
+CREATE_HOME     yes

 #
 # Force use shadow, even if shadow passwd & shadow group files are


code:
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,7 @@

 /* socket is used to keep single instance */
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <sys/socket.h>
 #include <sys/un.h>


code:
diff -urdN squashfs-tools-4.5/squashfs-tools/Makefile squashfs-tools-4.5.new/squashfs-tools/Makefile
--- squashfs-tools-4.5/squashfs-tools/Makefile	2021-07-22 22:11:24.000000000 +0200
+++ squashfs-tools-4.5.new/squashfs-tools/Makefile	2021-07-26 13:43:34.591645074 +0200
@@ -21,6 +21,15 @@
 #
 GZIP_SUPPORT = 1

+########### Building LZIP support #############
+#
+# The lzlib library (http://www.nongnu.org/lzip/lzlib.html) is supported.
+#
+# To build using lzlib - install the library and uncomment the
+# LZIP_SUPPORT line below.
+#
+LZIP_SUPPORT = 1
+
 ########### Building XZ support #############
 #
 # LZMA2 compression.
@@ -89,7 +98,7 @@
 # in Mksquashfs.  Obviously the compression algorithm must have been
 # selected to be built
 #
-COMP_DEFAULT = gzip
+COMP_DEFAULT = lzip

 ###############################################
@@ -177,6 +186,14 @@
 COMPRESSORS += gzip
 endif

+ifeq ($(LZIP_SUPPORT),1)
+CFLAGS += -DLZIP_SUPPORT
+MKSQUASHFS_OBJS += lzip_wrapper.o
+UNSQUASHFS_OBJS += lzip_wrapper.o
+LIBS += -llz
+COMPRESSORS += lzip
+endif
+
 ifeq ($(LZMA_SUPPORT),1)
 LZMA_OBJS = $(LZMA_DIR)/C/Alloc.o $(LZMA_DIR)/C/LzFind.o \
 	$(LZMA_DIR)/C/LzmaDec.o $(LZMA_DIR)/C/LzmaEnc.o $(LZMA_DIR)/C/LzmaLib.o
@@ -361,6 +378,8 @@

 gzip_wrapper.o: gzip_wrapper.c squashfs_fs.h gzip_wrapper.h compressor.h

+lzip_wrapper.o: lzip_wrapper.c squashfs_fs.h lzip_wrapper.h compressor.h
+
 lzma_wrapper.o: lzma_wrapper.c compressor.h squashfs_fs.h

 lzma_xz_wrapper.o: lzma_xz_wrapper.c compressor.h squashfs_fs.h
diff -urdN squashfs-tools-4.5/squashfs-tools/compressor.c squashfs-tools-4.5.new/squashfs-tools/compressor.c
--- squashfs-tools-4.5/squashfs-tools/compressor.c	2021-07-22 22:11:24.000000000 +0200
+++ squashfs-tools-4.5.new/squashfs-tools/compressor.c	2021-07-26 13:43:34.591645074 +0200
@@ -33,6 +33,14 @@
 extern struct compressor gzip_comp_ops;
 #endif

+#ifndef LZIP_SUPPORT
+static struct compressor lzip_comp_ops =  {
+	LZIP_COMPRESSION, "lzip"
+};
+#else
+extern struct compressor lzip_comp_ops;
+#endif
+
 #ifndef LZMA_SUPPORT
 static struct compressor lzma_comp_ops = {
 	LZMA_COMPRESSION, "lzma"
@@ -80,6 +88,7 @@

 struct compressor *compressor[] = {
 	&gzip_comp_ops,
+	&lzip_comp_ops,
 	&lzma_comp_ops,
 	&lzo_comp_ops,
 	&lz4_comp_ops,
diff -urdN squashfs-tools-4.5/squashfs-tools/lzip_wrapper.c squashfs-tools-4.5.new/squashfs-tools/lzip_wrapper.c
--- squashfs-tools-4.5/squashfs-tools/lzip_wrapper.c	1970-01-01 01:00:00.000000000 +0100
+++ squashfs-tools-4.5.new/squashfs-tools/lzip_wrapper.c	2021-07-26 13:55:50.771645074 +0200
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2014
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ * Copyright (C) 2018-2021 Antonio Diaz Diaz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * lzip_wrapper.c
+ *
+ * Support for LZIP compression using lzlib
+ * http://www.nongnu.org/lzip/lzlib.html
+ */
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <lzlib.h>
+
+#include "squashfs_fs.h"
+#include "lzip_wrapper.h"
+#include "compressor.h"
+
+static int dictionary_size = 0;
+static float dictionary_percent = 0;
+
+/* default compression level */
+static int compression_level = LZIP_DEFAULT_COMPRESSION_LEVEL;
+
+/* match_len_limit of each compression level */
+const int match_len[] = { 16, 5, 6, 8, 12, 20, 36, 68, 132, 273 };
+
+static inline int isvalid_ds( const int dictionary_size )
+{
+	return (dictionary_size >= LZ_min_dictionary_size() &&
+		dictionary_size <= LZ_max_dictionary_size());
+}
+
+/*
+ * This function is called by the options parsing code in mksquashfs.c
+ * to parse any -X compressor option.
+ *
+ * Two specific options are supported:
+ *	-Xcompression-level
+ *	-Xdict-size
+ *
+ * This function returns:
+ *	>=0 (number of additional args parsed) on success
+ *	-1 if the option was unrecognised, or
+ *	-2 if the option was recognised, but otherwise bad in
+ *	   some way (e.g. invalid parameter)
+ *
+ * Note: this function sets internal compressor state, but does not
+ * pass back the results of the parsing other than success/failure.
+ * The lzip_dump_options() function is called later to get the options in
+ * a format suitable for writing to the filesystem.
+ */
+static int lzip_options(char *argv[], int argc)
+{
+	if(strcmp(argv[0], "-Xcompression-level") == 0) {
+		if(argc < 2) {
+			fprintf(stderr, "lzip: -Xcompression-level missing "
+				"compression level\n");
+			fprintf(stderr, "lzip: -Xcompression-level it "
+				"should be 0 <= n <= 9\n");
+			goto failed;
+		}
+
+		compression_level = atoi(argv[1]);
+		if(compression_level < 0 || compression_level > 9) {
+			fprintf(stderr, "lzip: -Xcompression-level invalid, it "
+				"should be 0 <= n <= 9\n");
+			goto failed;
+		}
+		if(compression_level == 0) {
+			dictionary_size = 65535;
+			dictionary_percent = 0;
+		}
+
+		return 1;
+	} else if(strcmp(argv[0], "-Xdict-size") == 0) {
+		char *b;
+		float size;
+
+		if(argc < 2) {
+			fprintf(stderr, "lzip: -Xdict-size missing dict-size\n");
+			goto failed;
+		}
+
+		size = strtof(argv[1], &b);
+		if(*b == '%') {
+			if(size <= 0 || size > 100) {
+				fprintf(stderr, "lzip: -Xdict-size percentage "
+					"should be 0%% < dict-size <= 100%%\n");
+				goto failed;
+			}
+
+			dictionary_size = 0;
+			dictionary_percent = size;
+		} else {
+			if((float) ((int) size) != size) {
+				fprintf(stderr, "lzip: -Xdict-size can't be "
+					"fractional unless a percentage of the"
+					" block size\n");
+				goto failed;
+			}
+
+			dictionary_size = (int) size;
+			dictionary_percent = 0;
+
+			if(*b == 'k' || *b == 'K')
+				dictionary_size *= 1024;
+			else if(*b == 'm' || *b == 'M')
+				dictionary_size *= 1024 * 1024;
+			else if(*b != '\0') {
+				fprintf(stderr, "lzip: -Xdict-size invalid "
+					"dict-size\n");
+				goto failed;
+			}
+			if(!isvalid_ds(dictionary_size)) {
+				fprintf(stderr, "lzip: -Xdict-size invalid, it "
+					"should be %d <= n <= %d\n",
+					LZ_min_dictionary_size(),
+					LZ_max_dictionary_size());
+				goto failed;
+			}
+		}
+
+		return 1;
+	}
+
+	return -1;
+
+failed:
+	return -2;
+}
+
+
+/*
+ * This function is called after all options have been parsed.
+ * It is used to do post-processing on the compressor options using
+ * values that were not expected to be known at option parse time.
+ *
+ * In this case block_size may not be known until after -Xdict-size has
+ * been processed (in the case where -b is specified after -Xdict-size)
+ *
+ * This function returns 0 on successful post processing, or
+ *			-1 on error
+ */
+static int lzip_options_post(int block_size)
+{
+	/*
+	 * if -Xdict-size has been specified use this to compute the datablock
+	 * dictionary size
+	 */
+	if(dictionary_size || dictionary_percent) {
+		if(dictionary_size) {
+			if(dictionary_size > block_size) {
+				fprintf(stderr, "lzip: -Xdict-size is larger than"
+				" block_size\n");
+				goto failed;
+			}
+		} else
+			dictionary_size = block_size * dictionary_percent / 100;
+
+		if(dictionary_size < 4096) {
+			fprintf(stderr, "lzip: -Xdict-size should be 4096 bytes "
+				"or larger\n");
+			goto failed;
+		}
+
+	} else
+		/* No -Xdict-size specified, use defaults */
+		dictionary_size = block_size;
+
+	return 0;
+
+failed:
+	return -1;
+}
+
+
+/*
+ * This function is called by mksquashfs to dump the parsed
+ * compressor options in a format suitable for writing to the
+ * compressor options field in the filesystem (stored immediately
+ * after the superblock).
+ *
+ * This function returns a pointer to the compression options structure
+ * to be stored (and the size), or NULL if there are no compression
+ * options
+ */
+static void *lzip_dump_options(int block_size, int *size)
+{
+	static struct lzip_comp_opts comp_opts;
+
+	/*
+	 * don't store compressor specific options in file system if the
+	 * default options are being used - no compressor options in the
+	 * file system means the default options are always assumed
+	 *
+	 * Defaults are:
+	 *  compression_level: LZIP_DEFAULT_COMPRESSION_LEVEL
+	 *  metadata dictionary size: SQUASHFS_METADATA_SIZE
+	 *  datablock dictionary size: block_size
+	 */
+	if(dictionary_size == block_size &&
+		compression_level == LZIP_DEFAULT_COMPRESSION_LEVEL)
+		return NULL;
+
+	comp_opts.dictionary_size = dictionary_size;
+	comp_opts.compression_level = compression_level;
+
+	SQUASHFS_INSWAP_COMP_OPTS(&comp_opts);
+
+	*size = sizeof(comp_opts);
+	return &comp_opts;
+}
+
+
+/* Check and swap options read from the filesystem. */
+static int lzip_check_options(struct lzip_comp_opts *comp_opts, int size)
+{
+	/* check passed comp opts struct is of the correct length */
+	if(size != sizeof(struct lzip_comp_opts))
+		goto failed;
+
+	SQUASHFS_INSWAP_COMP_OPTS(comp_opts);
+
+	/* Check comp_opts structure for correctness */
+	if(!isvalid_ds(comp_opts->dictionary_size)) {
+		fprintf(stderr, "lzip: bad dictionary size in "
+			"compression options structure\n");
+		goto failed;
+	}
+
+	if(comp_opts->compression_level > 9) {
+		fprintf(stderr, "lzip: bad compression level in "
+			"compression options structure\n");
+		goto failed;
+	}
+
+	return 1;
+
+failed:
+	fprintf(stderr, "lzip: error reading stored compressor options from "
+		"filesystem!\n");
+	return 0;
+}
+
+
+/*
+ * This function is a helper specifically for the append mode of
+ * mksquashfs.  Its purpose is to set the internal compressor state
+ * to the stored compressor options in the passed compressor options
+ * structure.
+ *
+ * In effect this function sets up the compressor options
+ * to the same state they were when the filesystem was originally
+ * generated, this is to ensure on appending, the compressor uses
+ * the same compression options that were used to generate the
+ * original filesystem.
+ *
+ * Note, even if there are no compressor options, this function is still
+ * called with an empty compressor structure (size == 0), to explicitly
+ * set the default options, this is to ensure any user supplied
+ * -X options on the appending mksquashfs command line are over-ridden
+ *
+ * This function returns 0 on sucessful extraction of options, and
+ *			-1 on error
+ */
+static int lzip_extract_options(int block_size, void *buffer, int size)
+{
+	if(size == 0) {
+		/* set defaults */
+		dictionary_size = block_size;
+		compression_level = LZIP_DEFAULT_COMPRESSION_LEVEL;
+	} else {
+		struct lzip_comp_opts *comp_opts = buffer;
+		if(!lzip_check_options(comp_opts, size))
+			return -1;
+
+		dictionary_size = comp_opts->dictionary_size;
+		compression_level = comp_opts->compression_level;
+	}
+
+	return 0;
+}
+
+
+static void lzip_display_options(void *buffer, int size)
+{
+	struct lzip_comp_opts *comp_opts = buffer;
+	if(!lzip_check_options(comp_opts, size))
+		return;
+
+	printf("\tcompression-level %d\n", comp_opts->compression_level);
+	printf("\tDictionary size %d\n", comp_opts->dictionary_size);
+}
+
+
+/*
+ * This function is called by mksquashfs to allocate and initialise
+ * a lzip_stream struct, before compress() is called.
+ *
+ * This function returns 0 on success, and
+ *			-1 on error
+ */
+static int lzip_init(void **strm, int block_size, int datablock)
+{
+	struct lzip_stream * const stream = malloc(sizeof(struct lzip_stream));
+
+	if(!stream)
+		return -1;
+
+	/* dict == 65535 and match_len == 16 choose fast encoder */
+	stream->dictionary_size =
+	(datablock || (compression_level == 0 && dictionary_size == 65535)) ?
+		dictionary_size : SQUASHFS_METADATA_SIZE;
+	stream->match_len_limit = match_len[compression_level];
+	*strm = stream;
+	return 0;
+}
+
+
+/* Can be called multiple times after each call to lzip_init */
+static int lzip_compress(void *strm, void *dest, void *src, int size,
+			int block_size, int *error)
+{
+	int ipos = 0, opos = 0;
+	struct lzip_stream * const stream = strm;
+	struct LZ_Encoder * const encoder =
+		LZ_compress_open(stream->dictionary_size,
+				stream->match_len_limit, LLONG_MAX);
+
+	if(!encoder || LZ_compress_errno(encoder) != LZ_ok) {
+		*error = LZ_mem_error;
+		goto failed2;
+	}
+
+	for(;;) {
+		int rd = LZ_compress_write(encoder, src + ipos, size - ipos);
+		if(rd < 0)
+			goto failed;
+		ipos += rd;
+		if(ipos >= size)
+			LZ_compress_finish(encoder);
+		rd = LZ_compress_read(encoder, dest + opos, block_size - opos);
+		if(rd < 0)
+			goto failed;
+		opos += rd;
+		if(LZ_compress_finished(encoder) == 1)
+			break;
+		if(opos >= block_size) {
+		/* Output buffer overflow.  Return out of buffer space */
+			opos = 0;
+			break;
+		}
+	}
+
+	LZ_compress_close(encoder);
+	return opos;
+
+failed:
+	/*
+	 * All other errors return failure, with the compressor
+	 * specific error code in *error
+	 */
+	*error = LZ_compress_errno(encoder);
+failed2:
+	LZ_compress_close(encoder);
+	return -1;
+}
+
+
+static int lzip_uncompress(void *dest, void *src, int size, int outsize,
+	int *error)
+{
+	int ipos = 0, opos = 0;
+	struct LZ_Decoder * const decoder = LZ_decompress_open();
+
+	if(!decoder || LZ_decompress_errno(decoder) != LZ_ok) {
+		*error = LZ_mem_error;
+		goto failed2;
+	}
+
+	for(;;) {
+		int rd = LZ_decompress_write(decoder, src + ipos, size - ipos);
+		if(rd < 0)
+			goto failed;
+		ipos += rd;
+		if(ipos >= size)
+			LZ_decompress_finish(decoder);
+		rd = LZ_decompress_read(decoder, dest + opos, outsize - opos);
+		if(rd < 0)
+			goto failed;
+		opos += rd;
+		if(LZ_decompress_finished(decoder) == 1)
+			break;
+		if(opos >= outsize) {
+		/* Output buffer overflow.  Return out of buffer space */
+			*error = LZ_mem_error;
+			goto failed2;
+		}
+	}
+
+	LZ_decompress_close(decoder);
+	return opos;
+
+failed:
+	/*
+	 * All other errors return failure, with the compressor
+	 * specific error code in *error
+	 */
+	*error = LZ_decompress_errno(decoder);
+failed2:
+	LZ_decompress_close(decoder);
+	return -1;
+}
+
+
+static void lzip_usage()
+{
+	fprintf(stderr, "\t  -Xcompression-level <compression-level>\n"
+		"\t\t<compression-level> should be 0 .. 9 (default %d)\n",
+		LZIP_DEFAULT_COMPRESSION_LEVEL);
+	fprintf(stderr, "\t  -Xdict-size <dict-size>\n"
+		"\t\tUse <dict-size> as the LZIP dictionary size.  The dictionary\n"
+		"\t\tsize can be specified as a percentage of the block size, or\n"
+		"\t\tas an absolute value.  The dictionary size must be less than\n"
+		"\t\tor equal to the block size and 4096 bytes or larger.\n"
+		"\t\tExample dict-sizes are 25%%, 37.5%% or 8K, 32K, etc.\n");
+}
+
+
+struct compressor lzip_comp_ops = {
+	.init = lzip_init,
+	.compress = lzip_compress,
+	.uncompress = lzip_uncompress,
+	.options = lzip_options,
+	.options_post = lzip_options_post,
+	.dump_options = lzip_dump_options,
+	.extract_options = lzip_extract_options,
+	.display_options = lzip_display_options,
+	.usage = lzip_usage,
+	.id = LZIP_COMPRESSION,
+	.name = "lzip",
+	.supported = 1
+};
diff -urdN squashfs-tools-4.5/squashfs-tools/lzip_wrapper.h squashfs-tools-4.5.new/squashfs-tools/lzip_wrapper.h
--- squashfs-tools-4.5/squashfs-tools/lzip_wrapper.h	1970-01-01 01:00:00.000000000 +0100
+++ squashfs-tools-4.5.new/squashfs-tools/lzip_wrapper.h	2021-07-26 13:55:50.771645074 +0200
@@ -0,0 +1,58 @@
+#ifndef LZIP_WRAPPER_H
+#define LZIP_WRAPPER_H
+/*
+ * Squashfs
+ *
+ * Copyright (c) 2014
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ * Copyright (C) 2018-2021 Antonio Diaz Diaz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * lzip_wrapper.h
+ *
+ */
+
+#ifndef linux
+#define __BYTE_ORDER BYTE_ORDER
+#define __BIG_ENDIAN BIG_ENDIAN
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#else
+#include <endian.h>
+#endif
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+extern unsigned int inswap_le32(unsigned int);
+
+#define SQUASHFS_INSWAP_COMP_OPTS(s) { \
+	(s)->dictionary_size = inswap_le32((s)->dictionary_size); \
+}
+#else
+#define SQUASHFS_INSWAP_COMP_OPTS(s)
+#endif
+
+/* Default compression */
+#define LZIP_DEFAULT_COMPRESSION_LEVEL 9
+
+struct lzip_comp_opts {
+	int32_t dictionary_size;
+	uint8_t compression_level;
+};
+
+struct lzip_stream {
+	int dictionary_size;
+	short match_len_limit;
+};
+#endif
diff -urdN squashfs-tools-4.5/squashfs-tools/squashfs_fs.h squashfs-tools-4.5.new/squashfs-tools/squashfs_fs.h
--- squashfs-tools-4.5/squashfs-tools/squashfs_fs.h	2021-07-22 22:11:24.000000000 +0200
+++ squashfs-tools-4.5.new/squashfs-tools/squashfs_fs.h	2021-07-26 13:43:34.591645074 +0200
@@ -285,6 +285,7 @@
 #define XZ_COMPRESSION		4
 #define LZ4_COMPRESSION		5
 #define ZSTD_COMPRESSION	6
+#define LZIP_COMPRESSION	7

 struct squashfs_super_block {
 	unsigned int		s_magic;


code:
--- sysvinit-2.98/src/Makefile.orig	2020-11-16 22:52:07.000000000 -0300
+++ sysvinit-2.98/src/Makefile	2021-01-20 07:02:04.447372390 -0300
@@ -23,19 +23,19 @@

 # For some known distributions we do not build all programs, otherwise we do.
 BIN	=
-SBIN	= init halt shutdown runlevel killall5 fstab-decode logsave
-USRBIN	= last mesg readbootlog
+SBIN	= init halt shutdown runlevel killall5 fstab-decode
+USRBIN	= readbootlog

-MAN1	= last.1 lastb.1 mesg.1 readbootlog.1
+MAN1	= readbootlog.1
 MAN5	= initscript.5 inittab.5 initctl.5
-MAN8	= halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
-MAN8	+= shutdown.8 telinit.8 fstab-decode.8 logsave.8
+MAN8	= halt.8 init.8 killall5.8 poweroff.8 reboot.8 runlevel.8
+MAN8	+= shutdown.8 telinit.8 fstab-decode.8

 ifeq ($(DISTRO),)
-SBIN	+= sulogin bootlogd
-USRBIN	+= utmpdump wall
-MAN1	+= utmpdump.1 wall.1
-MAN8	+= sulogin.8 bootlogd.8
+SBIN	+= bootlogd
+#USRBIN	+= utmpdump wall
+#MAN1	+= utmpdump.1 wall.1
+MAN8	+= bootlogd.8
 endif

 ifeq ($(DISTRO),Debian)
@@ -90,16 +90,16 @@
 endif

 # Additional libs for GNU libc.
-ifneq ($(wildcard $(ROOT)/usr/lib*/libcrypt.*),)
-  SULOGINLIBS	+= -lcrypt
-endif
+#ifneq ($(wildcard $(ROOT)/usr/lib*/libcrypt.*),)
+#  SULOGINLIBS	+= -lcrypt
+#endif

 # Additional libs for GNU libc / multiarch on Debian based systems.
-ifneq ($(wildcard $(ROOT)/usr/lib/*/libcrypt.*),)
-ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt)
-  SULOGINLIBS	+= -lcrypt
-endif
-endif
+#ifneq ($(wildcard $(ROOT)/usr/lib/*/libcrypt.*),)
+#ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt)
+#  SULOGINLIBS	+= -lcrypt
+#endif
+#endif

 all:		$(BIN) $(SBIN) $(USRBIN)

@@ -208,10 +208,10 @@
 		ln -sf halt $(ROOT)/sbin/reboot
 		ln -sf halt $(ROOT)/sbin/poweroff
 		ln -sf init $(ROOT)/sbin/telinit
-		ln -sf /sbin/killall5 $(ROOT)/bin/pidof
-		if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
-			ln -sf last $(ROOT)/usr/bin/lastb; \
-		fi
+		#ln -sf /sbin/killall5 $(ROOT)/bin/pidof
+		#if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
+		#	ln -sf last $(ROOT)/usr/bin/lastb; \
+		#fi
 		$(INSTALL_DIR) $(ROOT)/usr/include/
 		$(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
 		$(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
@@ -233,8 +233,8 @@
 		#
 		# This part is skipped on Debian systems, the
 		# debian.preinst script takes care of it.
-		@if [ ! -p /run/initctl ]; then \
-		 echo "Creating /run/initctl"; \
-		 rm -f /run/initctl; \
-		 mknod -m 600 /run/initctl p; fi
+		#@if [ ! -p /run/initctl ]; then \
+		# echo "Creating /run/initctl"; \
+		# rm -f /run/initctl; \
+		# mknod -m 600 /run/initctl p; fi
 endif


code:
--- src/paths.h.orig	2020-11-16 22:52:07.000000000 -0300
+++ src/paths.h	2021-01-20 07:07:21.393878441 -0300
@@ -45,8 +45,8 @@
 #define INITLVL2	"/var/log/initrunlvl"	/* COMPAT: New runlevel */
 				/* Note: INITLVL2 definition needs INITLVL */
 #define HALTSCRIPT1	"/etc/init.d/halt"	/* Called by "fast" shutdown */
-#define HALTSCRIPT2	"/etc/rc.d/rc.0"	/* Called by "fast" shutdown */
+#define HALTSCRIPT2	"/etc/rc.d/rc.shutdown"	/* Called by "fast" shutdown */
 #define REBOOTSCRIPT1	"/etc/init.d/reboot"	/* Ditto. */
-#define REBOOTSCRIPT2	"/etc/rc.d/rc.6"	/* Ditto. */
+#define REBOOTSCRIPT2	"/etc/rc.d/rc.reboot"	/* Ditto. */
 #endif


code:
From 24d10919b4bc5e37a2d80b274d2cd2ee77b03549 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 13 Jan 2020 14:25:47 -0800
Subject: [PATCH] Remove fgets() extern declaration

These sources already include <stdio.h> which should bring the correct
declaration

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 hosts_access.c | 1 -
 misc.c         | 2 --
 2 files changed, 3 deletions(-)

diff --git a/hosts_access.c b/hosts_access.c
index 329b35e..0133e5e 100644
--- a/hosts_access.c
+++ b/hosts_access.c
@@ -44,7 +44,6 @@ static char sccsid[] = "@(#) hosts_access.c 1.21 97/02/12 02:13:22";
 #include <netdb.h>
 #endif

-extern char *fgets();
 extern int errno;

 #ifndef	INADDR_NONE
diff --git a/misc.c b/misc.c
index 74ca319..9a5e73a 100644
--- a/misc.c
+++ b/misc.c
@@ -18,8 +18,6 @@ static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29";

 #include "tcpd.h"

-extern char *fgets();
-
 #ifndef	INADDR_NONE
 #define	INADDR_NONE	(-1)		/* XXX should be 0xffffffff */
 #endif
--
2.24.1


code:
diff -ruN tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
--- tcp_wrappers_7.6.orig/hosts_access.5	1995-01-30 19:51:47.000000000 +0100
+++ tcp_wrappers_7.6/hosts_access.5	2004-04-09 16:59:45.000000000 +0200
@@ -173,7 +173,7 @@
 Patterns like these can be used when the machine has different internet
 addresses with different internet hostnames.  Service providers can use
 this facility to offer FTP, GOPHER or WWW archives with internet names
-that may even belong to different organizations. See also the `twist'
+that may even belong to different organizations. See also the `twist\'
 option in the hosts_options(5) document. Some systems (Solaris,
 FreeBSD) can have more than one internet address on one physical
 interface; with other systems you may have to resort to SLIP or PPP
@@ -236,10 +236,10 @@
 Before accepting a client request, the wrappers can use the IDENT
 service to find out that the client did not send the request at all.
 When the client host provides IDENT service, a negative IDENT lookup
-result (the client matches `UNKNOWN@host') is strong evidence of a host
+result (the client matches `UNKNOWN@host\') is strong evidence of a host
 spoofing attack.
 .PP
-A positive IDENT lookup result (the client matches `KNOWN@host') is
+A positive IDENT lookup result (the client matches `KNOWN@host\') is
 less trustworthy. It is possible for an intruder to spoof both the
 client connection and the IDENT lookup, although doing so is much
 harder than spoofing just a client connection. It may also be that
diff -ruN tcp_wrappers_7.6.orig/hosts_options.5 tcp_wrappers_7.6/hosts_options.5
--- tcp_wrappers_7.6.orig/hosts_options.5	1994-12-28 17:42:29.000000000 +0100
+++ tcp_wrappers_7.6/hosts_options.5	2004-04-09 16:59:49.000000000 +0200
@@ -124,7 +124,7 @@
 value is taken.
 .SH MISCELLANEOUS
 .IP "banners /some/directory"
-Look for a file in `/some/directory' with the same name as the daemon
+Look for a file in `/some/directory\' with the same name as the daemon
 process (for example in.telnetd for the telnet service), and copy its
 contents to the client. Newline characters are replaced by
 carriage-return newline, and %<letter> sequences are expanded (see
diff -ruN tcp_wrappers_7.6.orig/tcpdmatch.8 tcp_wrappers_7.6/tcpdmatch.8
--- tcp_wrappers_7.6.orig/tcpdmatch.8	1996-02-11 17:01:36.000000000 +0100
+++ tcp_wrappers_7.6/tcpdmatch.8	2004-04-09 17:00:49.000000000 +0200
@@ -26,7 +26,7 @@
 A daemon process name. Typically, the last component of a daemon
 executable pathname.
 .IP client
-A host name or network address, or one of the `unknown' or `paranoid'
+A host name or network address, or one of the `unknown\' or `paranoid\'
 wildcard patterns.
 .sp
 When a client host name is specified, \fItcpdmatch\fR gives a
@@ -37,13 +37,13 @@
 .PP
 Optional information specified with the \fIdaemon@server\fR form:
 .IP server
-A host name or network address, or one of the `unknown' or `paranoid'
-wildcard patterns. The default server name is `unknown'.
+A host name or network address, or one of the `unknown\' or `paranoid\'
+wildcard patterns. The default server name is `unknown\'.
 .PP
 Optional information specified with the \fIuser@client\fR form:
 .IP user
 A client user identifier. Typically, a login name or a numeric userid.
-The default user name is `unknown'.
+The default user name is `unknown\'.
 .SH OPTIONS
 .IP -d
 Examine \fIhosts.allow\fR and \fIhosts.deny\fR files in the current
@@ -70,7 +70,7 @@
 .ti +5
 tcpdmatch in.telnetd paranoid
 .PP
-On some systems, daemon names have no `in.' prefix, or \fItcpdmatch\fR
+On some systems, daemon names have no `in.\' prefix, or \fItcpdmatch\fR
 may need some help to locate the inetd configuration file.
 .SH FILES
 .PP


code:
diff -ruNp tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
--- tcp_wrappers_7.6.orig/hosts_access.5	2007-07-29 19:46:22.000000000 +0200
+++ tcp_wrappers_7.6/hosts_access.5	2007-07-29 19:46:16.000000000 +0200
@@ -12,7 +12,7 @@ An extended version of the access contro
 \fIhosts_options\fR(5) document. The extensions are turned on at
 program build time by building with -DPROCESS_OPTIONS.
 .PP
-In the following text, \fIdaemon\fR is the the process name of a
+In the following text, \fIdaemon\fR is the process name of a
 network daemon process, and \fIclient\fR is the name and/or address of
 a host requesting service. Network daemon process names are specified
 in the inetd configuration file.
diff -ruNp tcp_wrappers_7.6.orig/tcpdchk.8 tcp_wrappers_7.6/tcpdchk.8
--- tcp_wrappers_7.6.orig/tcpdchk.8	1995-01-08 17:00:31.000000000 +0100
+++ tcp_wrappers_7.6/tcpdchk.8	2007-07-29 19:46:01.000000000 +0200
@@ -1,7 +1,7 @@
 .TH TCPDCHK 8
 .SH NAME
 tcpdchk \- tcp wrapper configuration checker
-.SH SYNOPSYS
+.SH SYNOPSIS
 tcpdchk [-a] [-d] [-i inet_conf] [-v]
 .SH DESCRIPTION
 .PP
diff -ruNp tcp_wrappers_7.6.orig/tcpdmatch.8 tcp_wrappers_7.6/tcpdmatch.8
--- tcp_wrappers_7.6.orig/tcpdmatch.8	2007-07-29 19:46:22.000000000 +0200
+++ tcp_wrappers_7.6/tcpdmatch.8	2007-07-29 19:46:01.000000000 +0200
@@ -1,7 +1,7 @@
 .TH TCPDMATCH 8
 .SH NAME
 tcpdmatch \- tcp wrapper oracle
-.SH SYNOPSYS
+.SH SYNOPSIS
 tcpdmatch [-d] [-i inet_conf] daemon client
 .sp
 tcpdmatch [-d] [-i inet_conf] daemon[@server] [user@]client


code:
diff -ruNp tcp_wrappers_7.6.orig/hosts_access.3 tcp_wrappers_7.6/hosts_access.3
--- tcp_wrappers_7.6.orig/hosts_access.3	2005-03-09 18:30:25.000000000 +0100
+++ tcp_wrappers_7.6/hosts_access.3	2005-03-09 18:27:03.000000000 +0100
@@ -3,7 +3,7 @@
 hosts_access, hosts_ctl, request_init, request_set \- access control library
 .SH SYNOPSIS
 .nf
-#include "tcpd.h"
+#include <tcpd.h>

 extern int allow_severity;
 extern int deny_severity;
diff -ruNp tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
--- tcp_wrappers_7.6.orig/hosts_access.5	2005-03-09 18:30:25.000000000 +0100
+++ tcp_wrappers_7.6/hosts_access.5	2005-03-09 18:30:18.000000000 +0100
@@ -8,9 +8,9 @@ name, host name/address) patterns.  Exam
 impatient reader is encouraged to skip to the EXAMPLES section for a
 quick introduction.
 .PP
-An extended version of the access control language is described in the
-\fIhosts_options\fR(5) document. The extensions are turned on at
-program build time by building with -DPROCESS_OPTIONS.
+The extended version of the access control language is described in the
+\fIhosts_options\fR(5) document. \fBNote that this language supersedes
+the meaning of \fIshell_command\fB as documented below.\fR
 .PP
 In the following text, \fIdaemon\fR is the process name of a
 network daemon process, and \fIclient\fR is the name and/or address of
@@ -346,8 +346,8 @@ in.tftpd: LOCAL, .my.domain
 /etc/hosts.deny:
 .in +3
 .nf
-in.tftpd: ALL: (/some/where/safe_finger -l @%h | \\
-	/usr/ucb/mail -s %d-%h root) &
+in.tftpd: ALL: (/usr/sbin/safe_finger -l @%h | \\
+	/usr/bin/mail -s %d-%h root) &
 .fi
 .PP
 The safe_finger command comes with the tcpd wrapper and should be
@@ -383,6 +383,7 @@ that shouldn\'t.  All problems are repor
 .fi
 .SH SEE ALSO
 .nf
+hosts_options(5) extended syntax.
 tcpd(8) tcp/ip daemon wrapper program.
 tcpdchk(8), tcpdmatch(8), test programs.
 .SH BUGS
diff -ruNp tcp_wrappers_7.6.orig/hosts_options.5 tcp_wrappers_7.6/hosts_options.5
--- tcp_wrappers_7.6.orig/hosts_options.5	2005-03-09 18:30:24.000000000 +0100
+++ tcp_wrappers_7.6/hosts_options.5	2005-03-09 18:27:03.000000000 +0100
@@ -2,10 +2,8 @@
 .SH NAME
 hosts_options \- host access control language extensions
 .SH DESCRIPTION
-This document describes optional extensions to the language described
-in the hosts_access(5) document. The extensions are enabled at program
-build time. For example, by editing the Makefile and turning on the
-PROCESS_OPTIONS compile-time option.
+This document describes extensions to the language described
+in the hosts_access(5) document.
 .PP
 The extensible language uses the following format:
 .sp
@@ -58,12 +56,12 @@ Notice the leading dot on the domain nam
 Execute, in a child process, the specified shell command, after
 performing the %<letter> expansions described in the hosts_access(5)
 manual page.  The command is executed with stdin, stdout and stderr
-connected to the null device, so that it won\'t mess up the
+connected to the null device, so that it won't mess up the
 conversation with the client host. Example:
 .sp
 .nf
 .ti +3
-spawn (/some/where/safe_finger -l @%h | /usr/ucb/mail root) &
+spawn (/usr/sbin/safe_finger -l @%h | /usr/bin/mail root) &
 .fi
 .sp
 executes, in a background child process, the shell command "safe_finger
diff -ruNp tcp_wrappers_7.6.orig/inetcf.c tcp_wrappers_7.6/inetcf.c
--- tcp_wrappers_7.6.orig/inetcf.c	1997-02-12 02:13:24.000000000 +0100
+++ tcp_wrappers_7.6/inetcf.c	2005-03-09 18:27:03.000000000 +0100
@@ -26,13 +26,17 @@ extern void exit();
   * guesses. Shorter names follow longer ones.
   */
 char   *inet_files[] = {
+#if 0
     "/private/etc/inetd.conf",		/* NEXT */
     "/etc/inet/inetd.conf",		/* SYSV4 */
     "/usr/etc/inetd.conf",		/* IRIX?? */
+#endif
     "/etc/inetd.conf",			/* BSD */
+#if 0
     "/etc/net/tlid.conf",		/* SYSV4?? */
     "/etc/saf/tlid.conf",		/* SYSV4?? */
     "/etc/tlid.conf",			/* SYSV4?? */
+#endif
     0,
 };

diff -ruNp tcp_wrappers_7.6.orig/tcpd.8 tcp_wrappers_7.6/tcpd.8
--- tcp_wrappers_7.6.orig/tcpd.8	1996-02-21 16:39:16.000000000 +0100
+++ tcp_wrappers_7.6/tcpd.8	2005-03-09 18:27:03.000000000 +0100
@@ -12,7 +12,11 @@ The program supports both 4.3BSD-style s
 TLI.  Functionality may be limited when the protocol underneath TLI is
 not an internet protocol.
 .PP
-Operation is as follows: whenever a request for service arrives, the
+There are two possible modes of operation: execution of \fItcpd\fP
+before a service started by \fIinetd\fP, or linking a daemon with
+the \fIlibwrap\fP shared library as documented in the \fIhosts_access\fR(3)
+manual page. Operation when started by \fIinetd\fP
+is as follows: whenever a request for service arrives, the
 \fIinetd\fP daemon is tricked into running the \fItcpd\fP program
 instead of the desired server. \fItcpd\fP logs the request and does
 some additional checks. When all is well, \fItcpd\fP runs the
@@ -88,11 +92,11 @@ configuration files.
 .sp
 .in +5
 # mkdir /other/place
-# mv /usr/etc/in.fingerd /other/place
-# cp tcpd /usr/etc/in.fingerd
+# mv /usr/sbin/in.fingerd /other/place
+# cp tcpd /usr/sbin/in.fingerd
 .fi
 .PP
-The example assumes that the network daemons live in /usr/etc. On some
+The example assumes that the network daemons live in /usr/sbin. On some
 systems, network daemons live in /usr/sbin or in /usr/libexec, or have
 no `in.\' prefix to their name.
 .SH EXAMPLE 2
@@ -101,35 +105,34 @@ are left in their original place.
 .PP
 In order to monitor access to the \fIfinger\fR service, perform the
 following edits on the \fIinetd\fR configuration file (usually
-\fI/etc/inetd.conf\fR or \fI/etc/inet/inetd.conf\fR):
+\fI/etc/inetd.conf\fR):
 .nf
 .sp
 .ti +5
-finger  stream  tcp  nowait  nobody  /usr/etc/in.fingerd  in.fingerd
+finger  stream  tcp  nowait  nobody  /usr/sbin/in.fingerd  in.fingerd
 .sp
 becomes:
 .sp
 .ti +5
-finger  stream  tcp  nowait  nobody  /some/where/tcpd     in.fingerd
+finger  stream  tcp  nowait  nobody  /usr/sbin/tcpd     in.fingerd
 .sp
 .fi
 .PP
-The example assumes that the network daemons live in /usr/etc. On some
+The example assumes that the network daemons live in /usr/sbin. On some
 systems, network daemons live in /usr/sbin or in /usr/libexec, the
 daemons have no `in.\' prefix to their name, or there is no userid
 field in the inetd configuration file.
 .PP
 Similar changes will be needed for the other services that are to be
 covered by \fItcpd\fR.  Send a `kill -HUP\' to the \fIinetd\fR(8)
-process to make the changes effective. AIX users may also have to
-execute the `inetimp\' command.
+process to make the changes effective.
 .SH EXAMPLE 3
 In the case of daemons that do not live in a common directory ("secret"
 or otherwise), edit the \fIinetd\fR configuration file so that it
 specifies an absolute path name for the process name field. For example:
 .nf
 .sp
-    ntalk  dgram  udp  wait  root  /some/where/tcpd  /usr/local/lib/ntalkd
+    ntalk  dgram  udp  wait  root  /usr/sbin/tcpd  /usr/local/lib/ntalkd
 .sp
 .fi
 .PP
@@ -164,6 +167,7 @@ The default locations of the host access
 .SH SEE ALSO
 .na
 .nf
+hosts_access(3), functions provided by the libwrap library.
 hosts_access(5), format of the tcpd access control tables.
 syslog.conf(5), format of the syslogd control file.
 inetd.conf(5), format of the inetd control file.
diff -ruNp tcp_wrappers_7.6.orig/tcpdchk.8 tcp_wrappers_7.6/tcpdchk.8
--- tcp_wrappers_7.6.orig/tcpdchk.8	1995-01-08 17:00:31.000000000 +0100
+++ tcp_wrappers_7.6/tcpdchk.8	2005-03-09 18:27:03.000000000 +0100
@@ -9,8 +9,8 @@ tcpdchk [-a] [-d] [-i inet_conf] [-v]
 potential and real problems it can find. The program examines the
 \fItcpd\fR access control files (by default, these are
 \fI/etc/hosts.allow\fR and \fI/etc/hosts.deny\fR), and compares the
-entries in these files against entries in the \fIinetd\fR or \fItlid\fR
-network configuration files.
+entries in these files against entries in the \fIinetd\fR
+network configuration file.
 .PP
 \fItcpdchk\fR reports problems such as non-existent pathnames; services
 that appear in \fItcpd\fR access control rules, but are not controlled
@@ -26,14 +26,13 @@ problem.
 .SH OPTIONS
 .IP -a
 Report access control rules that permit access without an explicit
-ALLOW keyword. This applies only when the extended access control
-language is enabled (build with -DPROCESS_OPTIONS).
+ALLOW keyword.
 .IP -d
 Examine \fIhosts.allow\fR and \fIhosts.deny\fR files in the current
 directory instead of the default ones.
 .IP "-i inet_conf"
 Specify this option when \fItcpdchk\fR is unable to find your
-\fIinetd.conf\fR or \fItlid.conf\fR network configuration file, or when
+\fIinetd.conf\fR network configuration file, or when
 you suspect that the program uses the wrong one.
 .IP -v
 Display the contents of each access control rule.  Daemon lists, client
@@ -54,7 +53,6 @@ tcpdmatch(8), explain what tcpd would do
 hosts_access(5), format of the tcpd access control tables.
 hosts_options(5), format of the language extensions.
 inetd.conf(5), format of the inetd control file.
-tlid.conf(5), format of the tlid control file.
 .SH AUTHORS
 .na
 .nf
diff -ruNp tcp_wrappers_7.6.orig/tcpdmatch.8 tcp_wrappers_7.6/tcpdmatch.8
--- tcp_wrappers_7.6.orig/tcpdmatch.8	2005-03-09 18:30:24.000000000 +0100
+++ tcp_wrappers_7.6/tcpdmatch.8	2005-03-09 18:27:03.000000000 +0100
@@ -13,7 +13,7 @@ request for service.  Examples are given
 The program examines the \fItcpd\fR access control tables (default
 \fI/etc/hosts.allow\fR and \fI/etc/hosts.deny\fR) and prints its
 conclusion.  For maximal accuracy, it extracts additional information
-from your \fIinetd\fR or \fItlid\fR network configuration file.
+from your \fIinetd\fR network configuration file.
 .PP
 When \fItcpdmatch\fR finds a match in the access control tables, it
 identifies the matched rule. In addition, it displays the optional
@@ -50,7 +50,7 @@ Examine \fIhosts.allow\fR and \fIhosts.d
 directory instead of the default ones.
 .IP "-i inet_conf"
 Specify this option when \fItcpdmatch\fR is unable to find your
-\fIinetd.conf\fR or \fItlid.conf\fR network configuration file, or when
+\fIinetd.conf\fR network configuration file, or when
 you suspect that the program uses the wrong one.
 .SH EXAMPLES
 To predict how \fItcpd\fR would handle a telnet request from the local
@@ -86,7 +86,6 @@ tcpdchk(8), tcpd configuration checker
 hosts_access(5), format of the tcpd access control tables.
 hosts_options(5), format of the language extensions.
 inetd.conf(5), format of the inetd control file.
-tlid.conf(5), format of the tlid control file.
 .SH AUTHORS
 .na
 .nf


code:
See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=17847
(Though the original code needs to be patched to be case-insensitive.)

--- a/hosts_access.5
+++ b/hosts_access.5
@@ -89,6 +89,10 @@ An expression of the form `n.n.n.n/m.m.m
 bitwise AND of the address and the `mask\'. For example, the net/mask
 pattern `131.155.72.0/255.255.254.0\' matches every address in the
 range `131.155.72.0\' through `131.155.73.255\'.
+.IP \(bu
+Wildcards `*\' and `?\' can be used to match hostnames or IP addresses.  This
+method of matching cannot be used in conjunction with `net/mask\' matching,
+hostname matching beginning with `.\' or IP address matching ending with `.\'.
 .SH WILDCARDS
 The access control language supports explicit wildcards:
 .IP ALL
--- a/hosts_access.c
+++ b/hosts_access.c
@@ -82,6 +82,7 @@ static int client_match();
 static int host_match();
 static int string_match();
 static int masked_match();
+static int match_pattern_ylo();

 /* Size of logical line buffer. */

@@ -289,6 +290,11 @@ char   *string;
 {
     int     n;

+#ifndef DISABLE_WILDCARD_MATCHING
+    if (strchr(tok, '*') || strchr(tok,'?')) {  /* contains '*' or '?' */
+        return (match_pattern_ylo(string,tok));
+    } else
+#endif
     if (tok[0] == '.') {			/* suffix */
 	n = strlen(string) - strlen(tok);
 	return (n > 0 && STR_EQ(tok, string + n));
@@ -329,3 +335,78 @@ char   *string;
     }
     return ((addr & mask) == net);
 }
+
+#ifndef DISABLE_WILDCARD_MATCHING
+/* Note: this feature has been adapted in a pretty straightforward way
+   from Tatu Ylonen's last SSH version under free license by
+   Pekka Savola <pekkas@netcore.fi>.
+
+   Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
+*/
+
+/* Returns true if the given string matches the pattern (which may contain
+   ? and * as wildcards), and zero if it does not match. */
+
+static int match_pattern_ylo(const char *s, const char *pattern)
+{
+  char src;
+  char pat;
+  while (1)
+    {
+      /* If at end of pattern, accept if also at end of string. */
+      if (!*pattern)
+        return !*s;
+
+      /* Process '*'. */
+      if (*pattern == '*')
+        {
+	  /* Skip the asterisk. */
+	  pattern++;
+
+	  /* If at end of pattern, accept immediately. */
+          if (!*pattern)
+            return 1;
+
+	  /* If next character in pattern is known, optimize. */
+          if (*pattern != '?' && *pattern != '*')
+            {
+	      /* Look instances of the next character in pattern, and try
+		 to match starting from those. */
+              pat = *pattern;
+              for (; *s; s++) {
+                src = *s;
+                if (toupper(src) == toupper(pat) &&
+                    match_pattern_ylo(s + 1, pattern + 1))
+                  return 1;
+              }
+	      /* Failed. */
+              return 0;
+            }
+
+	  /* Move ahead one character at a time and try to match at each
+	     position. */
+          for (; *s; s++)
+            if (match_pattern_ylo(s, pattern))
+              return 1;
+	  /* Failed. */
+          return 0;
+        }
+
+      /* There must be at least one more character in the string.  If we are
+	 at the end, fail. */
+      if (!*s)
+        return 0;
+
+      /* Check if the next character of the string is acceptable. */
+      pat = *pattern;
+      src = *s;
+      if (*pattern != '?' && toupper(pat) != toupper(src))
+	return 0;
+
+      /* Move to the next character, both in string and in pattern. */
+      s++;
+      pattern++;
+    }
+  /*NOTREACHED*/
+}
+#endif /* DISABLE_WILDCARD_MATCHING */


code:
* Mon Feb  5 2001 Preston Brown <pbrown@redhat.com>
- fix gethostbyname to work better with dot "." notation (#16949)

--- tcp_wrappers_7.6/socket.c.fixgethostbyname	Fri Mar 21 13:27:25 1997
+++ tcp_wrappers_7.6/socket.c	Mon Feb  5 14:09:40 2001
@@ -52,7 +52,8 @@
 char   *name;
 {
     char    dot_name[MAXHOSTNAMELEN + 1];
-
+    struct hostent *hp;
+
     /*
      * Don't append dots to unqualified names. Such names are likely to come
      * from local hosts files or from NIS.
@@ -61,8 +62,12 @@
     if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) {
 	return (gethostbyname(name));
     } else {
-	sprintf(dot_name, "%s.", name);
-	return (gethostbyname(dot_name));
+        sprintf(dot_name, "%s.", name);
+        hp = gethostbyname(dot_name);
+	if (hp)
+	    return hp;
+	else
+	    return (gethostbyname(name));
     }
 }