Your message dated Fri, 03 Jan 2014 10:20:07 +0000
with message-id <[email protected]>
and subject line Bug#675070: fixed in openbsd-inetd 0.20091229-3
has caused the Debian Bug report #675070,
regarding openbsd-inetd: Please switch to use libbsd
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
675070: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=675070
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: openbsd-inetd
Source-Version: 0.20091229-2
Severity: wishlist
Tags: patch

Hi!

This source includes embedded copies (which implies a delta with
upstream) of closefrom() and strlcpy(). The attached patch switches it
to use those transparently from libbsd (through its system overlay).

In the future I'll be adding a functional setproctitle(), so that the
additional delta could go too. I'm thinking of adding a compat header
for <sys/time.h> so that the usual missing <time.h> from BSD headers
does not need to be patched in either.

Beware I've only build tested this. And the patch contains quite some
noise, but only due to the refresh.

thanks,
guillem
>From 63a607828d326a269d4f0456e8d743425fe62b80 Mon Sep 17 00:00:00 2001
From: Guillem Jover <[email protected]>
Date: Tue, 29 May 2012 19:48:51 +0200
Subject: [PATCH] Switch to use libbsd

---
 debian/control                  |    3 +-
 debian/patches/buftuning        |   17 ++--
 debian/patches/discard_env      |   15 ++-
 debian/patches/global_queuelen  |   17 ++--
 debian/patches/libwrap          |   19 ++--
 debian/patches/makefile         |    8 +-
 debian/patches/misc_portability |  213 +++------------------------------------
 debian/patches/nodaemon         |   15 ++-
 debian/patches/print_pause_time |    6 +-
 debian/patches/setproctitle     |   14 ++-
 debian/patches/tcp46            |   11 +-
 11 files changed, 98 insertions(+), 240 deletions(-)

diff --git a/debian/control b/debian/control
index cc5c625..ae872db 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,8 @@ Source: openbsd-inetd
 Section: net
 Priority: optional
 Maintainer: Marco d'Itri <[email protected]>
-Build-Depends: debhelper (>= 5.0), libwrap0-dev
+Build-Depends: debhelper (>= 5.0), pkg-config, libbsd-dev (>= 0.4.0),
+ libwrap0-dev
 Standards-Version: 3.9.3.1
 
 Package: openbsd-inetd
diff --git a/debian/patches/buftuning b/debian/patches/buftuning
index fc6f613..ee49594 100644
--- a/debian/patches/buftuning
+++ b/debian/patches/buftuning
@@ -1,6 +1,11 @@
+---
+ inetd.8 |   28 ++++++++++++++++++-
+ inetd.c |   91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 117 insertions(+), 2 deletions(-)
+
 --- a/inetd.8
 +++ b/inetd.8
-@@ -107,7 +107,7 @@ The fields of the configuration file are
+@@ -108,7 +108,7 @@ The fields of the configuration file are
  .Bd -unfilled -offset indent
  service name
  socket type
@@ -9,7 +14,7 @@
  wait/nowait[.max]
  user[.group] or user[:group]
  server program
-@@ -119,7 +119,7 @@ based service, the entry would contain t
+@@ -120,7 +120,7 @@ based service, the entry would contain t
  .Bd -unfilled -offset indent
  service name/version
  socket type
@@ -18,7 +23,7 @@
  wait/nowait[.max]
  user[.group] or user[:group]
  server program
-@@ -234,6 +234,30 @@ of
+@@ -235,6 +235,30 @@ of
  is used to specify a socket in the
  .Ux Ns -domain .
  .Pp
@@ -51,7 +56,7 @@
  entry is used to tell
 --- a/inetd.c
 +++ b/inetd.c
-@@ -198,6 +198,8 @@ struct	servtab {
+@@ -196,6 +196,8 @@ struct	servtab {
  	int	se_socktype;		/* type of socket to use */
  	int	se_family;		/* address family */
  	char	*se_proto;		/* protocol used */
@@ -60,7 +65,7 @@
  	int	se_rpcprog;		/* rpc program number */
  	int	se_rpcversl;		/* rpc program lowest version */
  	int	se_rpcversh;		/* rpc program highest version */
-@@ -1240,6 +1242,8 @@ getconfigent(void)
+@@ -1238,6 +1240,8 @@ getconfigent(void)
  {
  	struct servtab *sep, *tsep;
  	char *arg, *cp, *hostdelim, *s;
@@ -69,7 +74,7 @@
  	int argc;
  
  	sep = (struct servtab *) malloc(sizeof(struct servtab));
-@@ -1315,6 +1319,93 @@ more:
+@@ -1313,6 +1317,93 @@ more:
  
  	sep->se_proto = newstr(arg);
  
diff --git a/debian/patches/discard_env b/debian/patches/discard_env
index a1b2462..09d5b98 100644
--- a/debian/patches/discard_env
+++ b/debian/patches/discard_env
@@ -1,6 +1,11 @@
+---
+ inetd.8 |    8 ++++++++
+ inetd.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 61 insertions(+), 2 deletions(-)
+
 --- a/inetd.c
 +++ b/inetd.c
-@@ -293,6 +293,7 @@ int	bump_nofile(void);
+@@ -291,6 +291,7 @@ int	bump_nofile(void);
  struct servtab *enter(struct servtab *);
  int	matchconf(struct servtab *, struct servtab *);
  int	dg_broadcast(struct in_addr *in);
@@ -8,7 +13,7 @@
  
  #define NUMINT	(sizeof(intab) / sizeof(struct inent))
  char	*CONFIG = _PATH_INETDCONF;
-@@ -324,17 +325,21 @@ main(int argc, char *argv[], char *envp[
+@@ -322,17 +323,21 @@ main(int argc, char *argv[], char *envp[
  {
  	fd_set *fdsrp = NULL;
  	int readablen = 0, ch;
@@ -31,7 +36,7 @@
  		case 'R': {	/* invocation rate */
  			char *p;
  			int val;
-@@ -352,12 +357,16 @@ main(int argc, char *argv[], char *envp[
+@@ -350,12 +355,16 @@ main(int argc, char *argv[], char *envp[
  		case '?':
  		default:
  			fprintf(stderr,
@@ -49,7 +54,7 @@
  	uid = getuid();
  	if (uid != 0)
  		CONFIG = NULL;
-@@ -2057,3 +2066,45 @@ spawn(struct servtab *sep, int ctrl)
+@@ -2055,3 +2064,45 @@ spawn(struct servtab *sep, int ctrl)
  	if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
  		close(ctrl);
  }
@@ -105,7 +110,7 @@
  .Op Fl R Ar rate
  .Op Ar configuration_file
  .Sh DESCRIPTION
-@@ -62,6 +63,13 @@ The options are as follows:
+@@ -58,6 +59,13 @@ The options are as follows:
  .Bl -tag -width Ds
  .It Fl d
  Turns on debugging.
diff --git a/debian/patches/global_queuelen b/debian/patches/global_queuelen
index ed52ddf..2445145 100644
--- a/debian/patches/global_queuelen
+++ b/debian/patches/global_queuelen
@@ -1,6 +1,11 @@
+---
+ inetd.8 |    5 +++++
+ inetd.c |   12 +++++++++---
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
 --- a/inetd.c
 +++ b/inetd.c
-@@ -170,6 +170,7 @@ int lflag = 0;
+@@ -168,6 +168,7 @@ int lflag = 0;
  #endif
  
  int	 debug = 0;
@@ -8,7 +13,7 @@
  int	 nsock, maxsock;
  fd_set	*allsockp;
  int	 allsockn;
-@@ -338,7 +339,7 @@ main(int argc, char *argv[], char *envp[
+@@ -336,7 +337,7 @@ main(int argc, char *argv[], char *envp[
  	
  	initsetproctitle(argc, argv, envp);
  
@@ -17,7 +22,7 @@
  		switch (ch) {
  		case 'd':
  			debug = 1;
-@@ -358,6 +359,11 @@ main(int argc, char *argv[], char *envp[
+@@ -356,6 +357,11 @@ main(int argc, char *argv[], char *envp[
  			    progname);
  			exit(1);
  #endif
@@ -29,7 +34,7 @@
  		case 'R': {	/* invocation rate */
  			char *p;
  			int val;
-@@ -375,7 +381,7 @@ main(int argc, char *argv[], char *envp[
+@@ -373,7 +379,7 @@ main(int argc, char *argv[], char *envp[
  		case '?':
  		default:
  			fprintf(stderr,
@@ -38,7 +43,7 @@
  			exit(1);
  		}
  	argc -= optind;
-@@ -1060,7 +1066,7 @@ setsockopt(fd, SOL_SOCKET, opt, &on, siz
+@@ -1058,7 +1064,7 @@ setsockopt(fd, SOL_SOCKET, opt, &on, siz
  		return;
  	}
  	if (sep->se_socktype == SOCK_STREAM)
@@ -57,7 +62,7 @@
  .Op Fl R Ar rate
  .Op Ar configuration_file
  .Sh DESCRIPTION
-@@ -81,6 +82,10 @@ Internal services cannot be wrapped.  Wh
+@@ -77,6 +78,10 @@ Internal services cannot be wrapped.  Wh
  is silently not executed even if present in
  .Pa /etc/inetd.conf
  and instead libwrap is called directly by inetd.
diff --git a/debian/patches/libwrap b/debian/patches/libwrap
index 18d6605..547df1a 100644
--- a/debian/patches/libwrap
+++ b/debian/patches/libwrap
@@ -1,6 +1,11 @@
+---
+ inetd.8 |   25 +++++++++++++++++++++++++
+ inetd.c |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 82 insertions(+), 2 deletions(-)
+
 --- a/inetd.c
 +++ b/inetd.c
-@@ -164,6 +164,11 @@ size_t strlcpy(char *, const char *, siz
+@@ -162,6 +162,11 @@
  #define	CNT_INTVL	60		/* servers in CNT_INTVL sec. */
  #define	RETRYTIME	(60*10)		/* retry after bind or server fail */
  
@@ -12,7 +17,7 @@
  int	 debug = 0;
  int	 nsock, maxsock;
  fd_set	*allsockp;
-@@ -332,7 +337,7 @@ main(int argc, char *argv[], char *envp[
+@@ -330,7 +335,7 @@ main(int argc, char *argv[], char *envp[
  	
  	initsetproctitle(argc, argv, envp);
  
@@ -21,7 +26,7 @@
  		switch (ch) {
  		case 'd':
  			debug = 1;
-@@ -340,6 +345,15 @@ main(int argc, char *argv[], char *envp[
+@@ -338,6 +343,15 @@ main(int argc, char *argv[], char *envp[
  		case 'E':
  			keepenv = 1;
  			break;
@@ -37,7 +42,7 @@
  		case 'R': {	/* invocation rate */
  			char *p;
  			int val;
-@@ -357,7 +371,7 @@ main(int argc, char *argv[], char *envp[
+@@ -355,7 +369,7 @@ main(int argc, char *argv[], char *envp[
  		case '?':
  		default:
  			fprintf(stderr,
@@ -46,7 +51,7 @@
  			exit(1);
  		}
  	argc -= optind;
-@@ -1952,6 +1966,47 @@ spawn(struct servtab *sep, int ctrl)
+@@ -1950,6 +1964,47 @@ spawn(struct servtab *sep, int ctrl)
  	}
  	sigprocmask(SIG_SETMASK, &emptymask, NULL);
  	if (pid == 0) {
@@ -104,7 +109,7 @@
  .Op Fl R Ar rate
  .Op Ar configuration_file
  .Sh DESCRIPTION
-@@ -70,6 +71,13 @@ from laundering the environment.  Withou
+@@ -66,6 +67,13 @@ from laundering the environment.  Withou
  potentially harmful environent variables, including
  .Pa PATH ,
  will be removed and not inherited by services.
@@ -118,7 +123,7 @@
  .It Fl R Ar rate
  Specify the maximum number of times a service can be invoked
  in one minute; the default is 256.
-@@ -353,6 +361,23 @@ is reread.
+@@ -349,6 +357,23 @@ is reread.
  creates a file
  .Em /var/run/inetd.pid
  that contains its process identifier.
diff --git a/debian/patches/makefile b/debian/patches/makefile
index 1972c42..2bcef25 100644
--- a/debian/patches/makefile
+++ b/debian/patches/makefile
@@ -3,12 +3,12 @@
 @@ -0,0 +1,20 @@
 +CFLAGS ?= -g -O2
 +
-+DEFS := -DLIBWRAP
-+LIBS := -lwrap
++DEFS := -DLIBWRAP `pkg-config --cflags libbsd-overlay`
++LIBS := -lwrap `pkg-config --libs libbsd-overlay`
 +
 +CPPFLAGS += $(DEFS)
 +
-+inetd_OBJECTS := inetd.o setproctitle.o strlcpy.o bsd-closefrom.o
++inetd_OBJECTS := inetd.o setproctitle.o
 +
 +all: inetd
 +
@@ -19,5 +19,5 @@
 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 +
 +clean:
-+	rm -f inetd inetd.o setproctitle.o strlcpy.o
++	rm -f inetd inetd.o setproctitle.o
 +
diff --git a/debian/patches/misc_portability b/debian/patches/misc_portability
index d546f53..c17a6b9 100644
--- a/debian/patches/misc_portability
+++ b/debian/patches/misc_portability
@@ -1,3 +1,8 @@
+---
+ inetd.8 |   32 ++++++++++++++++++---------
+ inetd.c |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
+ 2 files changed, 91 insertions(+), 16 deletions(-)
+
 --- a/inetd.8
 +++ b/inetd.8
 @@ -42,11 +42,7 @@
@@ -86,7 +91,7 @@
  #include <sys/time.h>
  #include <sys/resource.h>
  
-@@ -146,13 +147,18 @@
+@@ -146,11 +147,14 @@
  #include <stdlib.h>
  #include <unistd.h>
  #include <string.h>
@@ -101,12 +106,8 @@
 -#include <rpcsvc/nfs_prot.h>
  #include "pathnames.h"
  
-+size_t strlcpy(char *, const char *, size_t);
-+
  #define	TOOMANY		256		/* don't start more than TOOMANY */
- #define	CNT_INTVL	60		/* servers in CNT_INTVL sec. */
- #define	RETRYTIME	(60*10)		/* retry after bind or server fail */
-@@ -325,7 +331,6 @@ main(int argc, char *argv[])
+@@ -325,7 +329,6 @@ main(int argc, char *argv[])
  		switch (ch) {
  		case 'd':
  			debug = 1;
@@ -114,7 +115,7 @@
  			break;
  		case 'R': {	/* invocation rate */
  			char *p;
-@@ -367,9 +372,13 @@ main(int argc, char *argv[])
+@@ -367,9 +370,13 @@ main(int argc, char *argv[])
  	umask(022);
  	if (debug == 0) {
  		daemon(0, 0);
@@ -128,7 +129,7 @@
  
  	if (uid == 0) {
  		gid_t gid = getgid();
-@@ -414,6 +423,15 @@ main(int argc, char *argv[])
+@@ -414,6 +421,15 @@ main(int argc, char *argv[])
  	sa.sa_handler = SIG_IGN;
  	sigaction(SIGPIPE, &sa, &sapipe);
  
@@ -144,7 +145,7 @@
  	for (;;) {
  		int n, ctrl = -1;
  
-@@ -569,9 +587,6 @@ dg_badinput(struct sockaddr *sa)
+@@ -569,9 +585,6 @@ dg_badinput(struct sockaddr *sa)
  		return 0;
  	}
  
@@ -154,7 +155,7 @@
  	return (0);
  
  bad:
-@@ -581,6 +596,7 @@ bad:
+@@ -581,6 +594,7 @@ bad:
  int
  dg_broadcast(struct in_addr *in)
  {
@@ -162,7 +163,7 @@
  	struct ifaddrs *ifa, *ifap;
  	struct sockaddr_in *sin;
  
-@@ -597,6 +613,7 @@ dg_broadcast(struct in_addr *in)
+@@ -597,6 +611,7 @@ dg_broadcast(struct in_addr *in)
  		}
  	}
  	freeifaddrs(ifap);
@@ -170,7 +171,7 @@
  	return (0);
  }
  
-@@ -1843,7 +1860,7 @@ print_service(char *action, struct servt
+@@ -1843,7 +1858,7 @@ print_service(char *action, struct servt
  	fprintf(stderr,
  	    " wait.max=%hd.%d user:group=%s:%s builtin=%lx server=%s\n",
  	    sep->se_wait, sep->se_max, sep->se_user,
@@ -179,7 +180,7 @@
  	    (long)sep->se_bi, sep->se_server);
  }
  
-@@ -1951,6 +1968,7 @@ spawn(struct servtab *sep, int ctrl)
+@@ -1951,6 +1966,7 @@ spawn(struct servtab *sep, int ctrl)
  				if (uid != pwd->pw_uid)
  					exit(1);
  			} else {
@@ -187,7 +188,7 @@
  				tmpint = LOGIN_SETALL &
  				    ~(LOGIN_SETGROUP|LOGIN_SETLOGIN);
  				if (pwd->pw_uid)
-@@ -1966,6 +1984,53 @@ spawn(struct servtab *sep, int ctrl)
+@@ -1966,6 +1982,53 @@ spawn(struct servtab *sep, int ctrl)
  					    sep->se_service, sep->se_proto);
  					exit(1);
  				}
@@ -241,187 +242,3 @@
  			}
  			if (debug)
  				fprintf(stderr, "%ld execv %s\n",
---- /dev/null
-+++ b/strlcpy.c
-@@ -0,0 +1,63 @@
-+/*	$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $	*/
-+
-+/*
-+ * Copyright (c) 1998 Todd C. Miller <[email protected]>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ *    notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ *    notice, this list of conditions and the following disclaimer in the
-+ *    documentation and/or other materials provided with the distribution.
-+ * 3. The name of the author may not be used to endorse or promote products
-+ *    derived from this software without specific prior written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
-+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ *
-+ * (Old style prototype traslated)
-+ */
-+
-+#include <sys/types.h>
-+#include <string.h>
-+
-+/*
-+ * Copy src to string dst of size siz.  At most siz-1 characters
-+ * will be copied.  Always NUL terminates (unless siz == 0).
-+ * Returns strlen(src); if retval >= siz, truncation occurred.
-+ */
-+size_t strlcpy(char *dst, const char *src, size_t siz)
-+{
-+	register char *d = dst;
-+	register const char *s = src;
-+	register size_t n = siz;
-+
-+	/* Copy as many bytes as will fit */
-+	if (n != 0 && --n != 0) {
-+		do {
-+			if ((*d++ = *s++) == 0)
-+				break;
-+		} while (--n != 0);
-+	}
-+
-+	/* Not enough room in dst, add NUL and traverse rest of src */
-+	if (n == 0) {
-+		if (siz != 0)
-+			*d = '\0';		/* NUL-terminate dst */
-+		while (*s++)
-+			;
-+	}
-+
-+	return(s - src - 1);	/* count does not include NUL */
-+}
---- /dev/null
-+++ b/bsd-closefrom.c
-@@ -0,0 +1,115 @@
-+/*
-+ * Copyright (c) 2004-2005 Todd C. Miller <[email protected]>
-+ *
-+ * Permission to use, copy, modify, and distribute this software for any
-+ * purpose with or without fee is hereby granted, provided that the above
-+ * copyright notice and this permission notice appear in all copies.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ */
-+
-+#define HAVE_FCNTL_H
-+#define HAVE_DIRENT_H
-+#ifdef linux
-+#define HAVE_DIRFD
-+#define HAVE_PROC_PID
-+#endif
-+#define HAVE_SYSCONF
-+
-+#ifndef HAVE_CLOSEFROM
-+
-+#include <sys/types.h>
-+#include <sys/param.h>
-+#include <unistd.h>
-+#include <stdio.h>
-+#ifdef HAVE_FCNTL_H
-+# include <fcntl.h>
-+#endif
-+#include <limits.h>
-+#include <stdlib.h>
-+#include <stddef.h>
-+#include <string.h>
-+#include <unistd.h>
-+#ifdef HAVE_DIRENT_H
-+# include <dirent.h>
-+# define NAMLEN(dirent) strlen((dirent)->d_name)
-+#else
-+# define dirent direct
-+# define NAMLEN(dirent) (dirent)->d_namlen
-+# ifdef HAVE_SYS_NDIR_H
-+#  include <sys/ndir.h>
-+# endif
-+# ifdef HAVE_SYS_DIR_H
-+#  include <sys/dir.h>
-+# endif
-+# ifdef HAVE_NDIR_H
-+#  include <ndir.h>
-+# endif
-+#endif
-+
-+#ifndef OPEN_MAX
-+# define OPEN_MAX	256
-+#endif
-+
-+#if 0
-+__unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 15:26:54 millert Exp $";
-+#endif /* lint */
-+
-+/*
-+ * Close all file descriptors greater than or equal to lowfd.
-+ */
-+#ifdef HAVE_FCNTL_CLOSEM
-+void
-+closefrom(int lowfd)
-+{
-+    (void) fcntl(lowfd, F_CLOSEM, 0);
-+}
-+#else
-+void
-+closefrom(int lowfd)
-+{
-+    long fd, maxfd;
-+#if defined(HAVE_DIRFD) && defined(HAVE_PROC_PID)
-+    char fdpath[PATH_MAX], *endp;
-+    struct dirent *dent;
-+    DIR *dirp;
-+    int len;
-+
-+    /* Check for a /proc/$$/fd directory. */
-+    len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
-+    if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
-+	while ((dent = readdir(dirp)) != NULL) {
-+	    fd = strtol(dent->d_name, &endp, 10);
-+	    if (dent->d_name != endp && *endp == '\0' &&
-+		fd >= 0 && fd < INT_MAX && fd >= lowfd && fd != dirfd(dirp))
-+		(void) close((int) fd);
-+	}
-+	(void) closedir(dirp);
-+    } else
-+#endif
-+    {
-+	/*
-+	 * Fall back on sysconf() or getdtablesize().  We avoid checking
-+	 * resource limits since it is possible to open a file descriptor
-+	 * and then drop the rlimit such that it is below the open fd.
-+	 */
-+#ifdef HAVE_SYSCONF
-+	maxfd = sysconf(_SC_OPEN_MAX);
-+#else
-+	maxfd = getdtablesize();
-+#endif /* HAVE_SYSCONF */
-+	if (maxfd < 0)
-+	    maxfd = OPEN_MAX;
-+
-+	for (fd = lowfd; fd < maxfd; fd++)
-+	    (void) close((int) fd);
-+    }
-+}
-+#endif /* !HAVE_FCNTL_CLOSEM */
-+#endif /* HAVE_CLOSEFROM */
diff --git a/debian/patches/nodaemon b/debian/patches/nodaemon
index 1f3887e..909a983 100644
--- a/debian/patches/nodaemon
+++ b/debian/patches/nodaemon
@@ -1,3 +1,8 @@
+---
+ inetd.8 |    3 +++
+ inetd.c |   14 +++++++++++---
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
 --- a/inetd.8
 +++ b/inetd.8
 @@ -39,6 +39,7 @@
@@ -8,7 +13,7 @@
  .Op Fl l
  .Op Fl R Ar rate
  .Op Ar configuration_file
-@@ -71,6 +72,8 @@ from laundering the environment.  Withou
+@@ -67,6 +68,8 @@ from laundering the environment.  Withou
  potentially harmful environent variables, including
  .Pa PATH ,
  will be removed and not inherited by services.
@@ -19,7 +24,7 @@
  Internal services cannot be wrapped.  When enabled,
 --- a/inetd.c
 +++ b/inetd.c
-@@ -331,13 +331,14 @@ main(int argc, char *argv[], char *envp[
+@@ -329,13 +329,14 @@ main(int argc, char *argv[], char *envp[
  	fd_set *fdsrp = NULL;
  	int readablen = 0, ch;
  	int keepenv = 0;
@@ -35,7 +40,7 @@
  		switch (ch) {
  		case 'd':
  			debug = 1;
-@@ -345,6 +346,9 @@ main(int argc, char *argv[], char *envp[
+@@ -343,6 +344,9 @@ main(int argc, char *argv[], char *envp[
  		case 'E':
  			keepenv = 1;
  			break;
@@ -45,7 +50,7 @@
  		case 'l':
  #ifdef LIBWRAP
  			lflag = 1;
-@@ -371,7 +375,7 @@ main(int argc, char *argv[], char *envp[
+@@ -369,7 +373,7 @@ main(int argc, char *argv[], char *envp[
  		case '?':
  		default:
  			fprintf(stderr,
@@ -54,7 +59,7 @@
  			exit(1);
  		}
  	argc -= optind;
-@@ -397,7 +401,11 @@ main(int argc, char *argv[], char *envp[
+@@ -395,7 +399,11 @@ main(int argc, char *argv[], char *envp[
  
  	umask(022);
  	if (debug == 0) {
diff --git a/debian/patches/print_pause_time b/debian/patches/print_pause_time
index 734a763..95ecf2f 100644
--- a/debian/patches/print_pause_time
+++ b/debian/patches/print_pause_time
@@ -1,6 +1,10 @@
+---
+ inetd.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
 --- a/inetd.c
 +++ b/inetd.c
-@@ -1944,8 +1944,9 @@ spawn(struct servtab *sep, int ctrl)
+@@ -1942,8 +1942,9 @@ spawn(struct servtab *sep, int ctrl)
  					return;
  				}
  				syslog(LOG_ERR,
diff --git a/debian/patches/setproctitle b/debian/patches/setproctitle
index c2dcb55..df7ae3b 100644
--- a/debian/patches/setproctitle
+++ b/debian/patches/setproctitle
@@ -1,3 +1,9 @@
+---
+ inetd.c        |    5 +
+ setproctitle.c |  146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ setproctitle.h |    4 +
+ 3 files changed, 154 insertions(+), 1 deletion(-)
+
 --- a/inetd.c
 +++ b/inetd.c
 @@ -156,6 +156,7 @@
@@ -6,9 +12,9 @@
  #include "pathnames.h"
 +#include "setproctitle.h"
  
- size_t strlcpy(char *, const char *, size_t);
- 
-@@ -319,7 +320,7 @@ fd_grow(fd_set **fdsp, int *bytes, int f
+ #define	TOOMANY		256		/* don't start more than TOOMANY */
+ #define	CNT_INTVL	60		/* servers in CNT_INTVL sec. */
+@@ -317,7 +318,7 @@ fd_grow(fd_set **fdsp, int *bytes, int f
  struct sigaction sa, sapipe;
  
  int
@@ -17,7 +23,7 @@
  {
  	fd_set *fdsrp = NULL;
  	int readablen = 0, ch;
-@@ -327,6 +328,8 @@ main(int argc, char *argv[])
+@@ -325,6 +326,8 @@ main(int argc, char *argv[])
  	extern char *optarg;
  	extern int optind;
  	
diff --git a/debian/patches/tcp46 b/debian/patches/tcp46
index f616097..85b9767 100644
--- a/debian/patches/tcp46
+++ b/debian/patches/tcp46
@@ -1,6 +1,11 @@
+---
+ inetd.8 |    5 +++++
+ inetd.c |   18 ++++++++++++++++--
+ 2 files changed, 21 insertions(+), 2 deletions(-)
+
 --- a/inetd.8
 +++ b/inetd.8
-@@ -413,6 +413,11 @@ and IPv6 traffic will go to server on
+@@ -414,6 +414,11 @@ and IPv6 traffic will go to server on
  If you have only one server on
  .Dq tcp6 ,
  only IPv6 traffic will be routed to the server.
@@ -14,7 +19,7 @@
  .Xr fingerd 8 ,
 --- a/inetd.c
 +++ b/inetd.c
-@@ -814,10 +814,14 @@ doconfig(void)
+@@ -812,10 +812,14 @@ doconfig(void)
  
  				if (!port) {
  					/* XXX */
@@ -31,7 +36,7 @@
  					sp = getservbyname(sep->se_service,
  					    protoname);
  					if (sp == 0) {
-@@ -1011,6 +1015,16 @@ setup(struct servtab *sep)
+@@ -1009,6 +1013,16 @@ setup(struct servtab *sep)
  		    sep->se_service, sep->se_proto);
  		return;
  	}
-- 
1.7.10


--- End Message ---
--- Begin Message ---
Source: openbsd-inetd
Source-Version: 0.20091229-3

We believe that the bug you reported is fixed in the latest version of
openbsd-inetd, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Marco d'Itri <[email protected]> (supplier of updated openbsd-inetd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Fri, 03 Jan 2014 10:41:38 +0100
Source: openbsd-inetd
Binary: openbsd-inetd
Architecture: source i386
Version: 0.20091229-3
Distribution: unstable
Urgency: medium
Maintainer: Marco d'Itri <[email protected]>
Changed-By: Marco d'Itri <[email protected]>
Description: 
 openbsd-inetd - OpenBSD Internet Superserver
Closes: 675070 691852
Changes: 
 openbsd-inetd (0.20091229-3) unstable; urgency=medium
 .
   * Updated patch libwrap: do not wrap internal services as documented,
     to prevent a segfault. (Closes: #691852)
   * Private implementations replaced with libbsd. (Closes: #675070)
   * Removed from the maintainer scripts the code needed to handle upgrade
     from netkit-inetd.
   * Support cross-compilation.
Checksums-Sha1: 
 820918dc9ceba39be95593c06464def620f05a40 1140 openbsd-inetd_0.20091229-3.dsc
 c8ad1739ba97986ea0f0c55f12ba59ff75dc1e17 13268 
openbsd-inetd_0.20091229-3.debian.tar.xz
 669fef8947bde600a0473f05b59a36c4b33e4144 33188 
openbsd-inetd_0.20091229-3_i386.deb
Checksums-Sha256: 
 9785b967d3e020910a8b92b075be80ce1eb8da35545abbd5bd6e669954b400d6 1140 
openbsd-inetd_0.20091229-3.dsc
 98241e827be70ca7538924c7e69a579454ed3d63c3f9e8a79fc0b0e37a1abbaf 13268 
openbsd-inetd_0.20091229-3.debian.tar.xz
 8462aecf8bbfa815ce9efffbf0967515df13f1201af579241398cf2ef41ab7b9 33188 
openbsd-inetd_0.20091229-3_i386.deb
Files: 
 340e5d8952bb332e91b8f8359497e538 1140 net optional 
openbsd-inetd_0.20091229-3.dsc
 28de6adcbd0fe0cfb5b4da937dca4103 13268 net optional 
openbsd-inetd_0.20091229-3.debian.tar.xz
 22590fd689028834dad2344f3117b540 33188 net optional 
openbsd-inetd_0.20091229-3_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iEYEARECAAYFAlLGhlcACgkQFGfw2OHuP7EcegCcD+2vvVR1MuuDZg0Gy0zrPjnT
5IsAn0794ZU8PPurgrn361z13TO/d0rM
=uC4D
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to