From MAILER-DAEMON Thu Nov 01 17:02:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TU1uE-0005K1-Au
	for mharc-commit-inetutils@gnu.org; Thu, 01 Nov 2012 17:02:26 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54889)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TU1uA-0005Jd-GM
	for commit-inetutils@gnu.org; Thu, 01 Nov 2012 17:02:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TU1u7-0008FZ-Ju
	for commit-inetutils@gnu.org; Thu, 01 Nov 2012 17:02:22 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:45791)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TU1u7-0008FV-H9
	for commit-inetutils@gnu.org; Thu, 01 Nov 2012 17:02:19 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TU1u6-0004jh-Nm
	for commit-inetutils@gnu.org; Thu, 01 Nov 2012 21:02:19 +0000
Date: Thu, 01 Nov 2012 21:02:18 +0000
Message-Id: <E1TU1u6-0004jh-Nm@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-197-gd94aaf6
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: e1c5c5849a6a26e52d32cfd5c9d75d881a9c497f
X-Git-Newrev: d94aaf66915ccc93e913368bc7382c6fda6630bd
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Nov 2012 21:02:25 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  d94aaf66915ccc93e913368bc7382c6fda6630bd (commit)
       via  78b2623dd4cdf4f66397ee6a68b6661b7ffde2ce (commit)
       via  1c6c243965ba2e2e795105ff0fc78aea2742e8a8 (commit)
      from  e1c5c5849a6a26e52d32cfd5c9d75d881a9c497f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=d94aaf66915ccc93e913368bc7382c6fda6630bd


commit d94aaf66915ccc93e913368bc7382c6fda6630bd
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Nov 1 21:52:23 2012 +0100

    ftp: Building with readline is optional.

diff --git a/ChangeLog b/ChangeLog
index 38e771e..ffc7b76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2012-10-01  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ftp: Build without readline support.
+
+	* configure.ac <enable_ftp>: Remove test for disabling
+	FTP client based on `$gl_cv_lib_readline = no'.
+	* am/readline.m4 (gl_FUNC_READLINE): Create option
+	`--disable-readline' using AC_ARG_ENABLE([readline]).
+	(HAVE_READLINE): Demand also `$enable_readline = yes`.
+	* ftp/cmds.c [HAVE_READLINE_READLINE_H]: Inclusion guard
+	for <readline/readline.h>.
+	[HAVE_READLINE_HISTORY_H]: Guard <readline/history.h>.
+	(another) [HAVE_READLINE]: Conditional use of readline()
+	and of add_history().
+	* ftp/main.c [HAVE_READLINE_READLINE_H]: Inclusion guard
+	for <readline/readline.h>.
+	[HAVE_READLINE_HISTORY_H]: Guard <readline/history.h>.
+	(argp_options) [!HAVE_READLINE]: Alternate description
+	for `-e/--no-edit'.
+	(cmdscanner) [HAVE_READLINE]: Conditional use of readline()
+	and of add_history().
+
 2012-10-30  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* tests/readutmp.c: New file.
diff --git a/NEWS b/NEWS
index 6631509..b29896e 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,12 @@ Please send inetutils bug reports to <bug-inetutils@gnu.org>.
 
 * New tool 'dnsdomainname'.
 
+* ftp
+
+Called as `pftp', passive mode is preset.  New switch `-e/--no-edit'
+for compatibility with other implementations.  Can now be built
+without readline ability: configure using `--disable-readline'.
+
 
 January 6, 2012
 Version 1.9.1:
diff --git a/am/readline.m4 b/am/readline.m4
index e8704bc..be4ce86 100644
--- a/am/readline.m4
+++ b/am/readline.m4
@@ -14,6 +14,12 @@ AC_DEFUN([gl_FUNC_READLINE],
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
 
+  dnl Allow disabling the use of libreadline.
+  AC_ARG_ENABLE([readline],
+    AC_HELP_STRING([--disable-readline],
+		   [do not build against libreadline]), ,
+    [enable_readline=yes])
+
   dnl Search for libreadline and define LIBREADLINE, LTLIBREADLINE and
   dnl INCREADLINE accordingly.
   AC_LIB_LINKFLAGS_BODY([readline])
@@ -68,7 +74,8 @@ AC_DEFUN([gl_FUNC_READLINE],
     LIBREADLINE=-ledit
   fi
 
-  if test "$gl_cv_lib_readline" != no; then
+  if test "$enable_readline" = "yes" \
+     && test "$gl_cv_lib_readline" != no; then
     AC_DEFINE([HAVE_READLINE], [1], [Define if you have the readline library.])
     extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'`
     if test -n "$extra_lib"; then
diff --git a/configure.ac b/configure.ac
index 11f23d0..c37b828 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,13 +161,10 @@ AC_SEARCH_LIBS([getpeername], [socket])
 # See if a termcap library is available (under one of several names)
 IU_LIB_TERMCAP
 
-# Find libreadline -- disable the ftp client if not found.
+# Find libreadline -- the ftp client will be built without
+# command editing and history capability if readline() cannot
+# be found, neither in libreadline, nor in libedit.
 gl_FUNC_READLINE
-if test "$gl_cv_lib_readline" = no; then
-  enable_ftp=no
-  ftp_BUILD=''
-  ftp_INSTALL_HOOK=''
-fi
 
 # See if there's a separate libcrypt (many systems put crypt there).
 AC_CHECK_LIB(crypt, crypt, LIBCRYPT=-lcrypt)
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 6121c7a..9886fd2 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -78,8 +78,12 @@
    system headers on some platforms. */
 #include <glob.h>
 
-#include <readline/readline.h>
-#include <readline/history.h>
+#ifdef HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+#endif
+#ifdef HAVE_READLINE_HISTORY_H
+# include <readline/history.h>
+#endif
 
 #include "ftp_var.h"
 #include "unused-parameter.h"
@@ -151,9 +155,11 @@ another (int *pargc, char ***pargv, const char *prompt)
 
   sprintf (buffer, "(%s) ", prompt);
 
+#if HAVE_READLINE
   if (usereadline)
     arg = readline (buffer);
   else
+#endif /* HAVE_READLINE */
     {
       char *nl;
 
@@ -174,8 +180,10 @@ another (int *pargc, char ***pargv, const char *prompt)
 
   free (buffer);
 
+#if HAVE_READLINE
   if (usereadline && arg && *arg)
     add_history (arg);
+#endif /* HAVE_READLINE */
 
   if (!arg)
     intr (0);
diff --git a/ftp/main.c b/ftp/main.c
index a15c92e..7ccb967 100644
--- a/ftp/main.c
+++ b/ftp/main.c
@@ -77,8 +77,12 @@
 #include "libinetutils.h"
 #include "unused-parameter.h"
 
-#include <readline/readline.h>
-#include <readline/history.h>
+#ifdef HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+#endif
+#ifdef HAVE_READLINE_HISTORY_H
+# include <readline/history.h>
+#endif
 
 
 #define DEFAULT_PROMPT "ftp> "
@@ -94,7 +98,13 @@ enum {
 static struct argp_option argp_options[] = {
 #define GRP 0
   {"debug", 'd', NULL, 0, "set the SO_DEBUG option", GRP+1},
-  {"no-edit", 'e', NULL, 0, "disable command line editing", GRP+1},
+  {"no-edit", 'e', NULL, 0,
+#if HAVE_READLINE
+	  "disable command line editing",
+#else /* !HAVE_READLINE */
+	  "(ignored)",
+#endif /* !HAVE_READLINE */
+	  GRP+1},
   {"no-glob", 'g', NULL, 0, "turn off file name globbing", GRP+1},
   {"no-prompt", 'i', NULL, 0, "do not prompt during multiple file transfers",
    GRP+1},
@@ -351,9 +361,11 @@ cmdscanner (int top)
 	  len = 0;
 	}
 
+#if HAVE_READLINE
       if (usereadline)
 	line = readline (prompt);
       else
+#endif /* HAVE_READLINE */
 	{
 	  if (prompt)
 	    {
@@ -389,8 +401,10 @@ cmdscanner (int top)
 	  break;
 	}
 
+#if HAVE_READLINE
       if (usereadline && line && *line)
 	add_history (line);
+#endif /* HAVE_READLINE */
 
       if (l == 0)
 	break;

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=78b2623dd4cdf4f66397ee6a68b6661b7ffde2ce


commit 78b2623dd4cdf4f66397ee6a68b6661b7ffde2ce
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Tue Oct 30 11:30:51 2012 +0100

    Test script for read_utmp.

diff --git a/ChangeLog b/ChangeLog
index 02d3ee7..38e771e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-30  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* tests/readutmp.c: New file.
+	* tests/utmp.sh: New file.
+	* tests/Makefile.am (check_PROGRAMS): Add readutmp.
+	(dist_check_SCRIPTS): Add utmp.sh.
+	* tests/.gitignore: Add readutmp to list.
+
 2012-10-29  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftp: Increase universality by recognizing the alias
diff --git a/tests/.gitignore b/tests/.gitignore
index 51bb74c..fbf984c 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,3 +1,4 @@
 localhost
+readutmp
 addrpeek
 tools.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f26247d..b827bf5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,12 +21,12 @@ AM_CPPFLAGS = $(iu_INCLUDES)
 
 LDADD = $(iu_LIBRARIES)
 
-check_PROGRAMS = localhost
+check_PROGRAMS = localhost readutmp
 if ENABLE_inetd
 check_PROGRAMS += addrpeek
 endif
 
-dist_check_SCRIPTS =
+dist_check_SCRIPTS = utmp.sh
 if ENABLE_ping
 dist_check_SCRIPTS += ping-localhost.sh
 endif
diff --git a/tests/readutmp.c b/tests/readutmp.c
new file mode 100644
index 0000000..07d29ad
--- /dev/null
+++ b/tests/readutmp.c
@@ -0,0 +1,90 @@
+/* readutmp - Basic test of existing utmp/utmpx access.
+  Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils 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 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils 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, see `http://www.gnu.org/licenses/'. */
+
+/* Written by Mats Erik Andersson.  */
+
+/* Readutmp reads the system's standard UTMP or UTMPX file
+ * and verifies that a spcific user is logged in.
+ *
+ * Invocation:
+ *
+ *    readutmp
+ *    readutmp name
+ *
+ * The first mode investigates the present user.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <pwd.h>
+
+#include <progname.h>
+#include <readutmp.h>
+#include <xalloc.h>
+
+int
+main (int argc, char *argv[])
+{
+  STRUCT_UTMP *utmpp, *uptr;
+  struct passwd *pw;
+  char *name;
+  size_t count;
+  int found = 0;
+
+  set_program_name (argv[0]);
+
+  if (argc > 1)
+    pw = getpwnam (argv[1]);
+  else
+    pw = getpwuid (getuid ());
+
+  if (pw)
+    name = xstrdup (pw->pw_name);
+  else
+    {
+      fprintf (stderr, "Unknown user '%s'.\n",
+	       (argc > 1) ? argv[1] : "my own UID");
+      return EXIT_FAILURE;
+    }
+
+  if (read_utmp (UTMP_FILE, &count, &utmpp, READ_UTMP_USER_PROCESS))
+    {
+      perror ("read_utmp:");
+      return EXIT_FAILURE;
+    }
+
+  for (uptr = utmpp; uptr < utmpp + count; uptr++)
+    if (!strncmp (name, UT_USER (uptr), sizeof (UT_USER (uptr))))
+      {
+	found = 1;
+	break;
+      }
+
+  if (found)
+    return EXIT_SUCCESS;
+
+  fprintf (stderr, "User '%s' is not logged in.\n", name);
+  return EXIT_FAILURE;
+}
diff --git a/tests/utmp.sh b/tests/utmp.sh
new file mode 100755
index 0000000..f19e467
--- /dev/null
+++ b/tests/utmp.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Inetutils.
+#
+# GNU Inetutils 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 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Inetutils 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, see `http://www.gnu.org/licenses/'.
+
+# Test to establish functionality of read_utmp() from Gnulib.
+# The functionality is needed by our services syslog and talkd.
+#
+
+. ./tools.sh
+
+READUTMP=${READUTMP:-./readutmp$EXEEXT}
+
+if test ! -x $READUTMP; then
+    echo >&2 "No executable '$READUTMP' present.  Skipping test."
+    exit 77
+fi
+
+if test -n "$VERBOSE"; then
+    set -x
+fi
+
+# Execute READUTMP once without argument, and once with
+# ourself as argument.  Both should succeed, but if either
+# fails report only a skipped test, giving some complimentary
+# explanations.
+
+errno=0
+
+$READUTMP || errno=77
+
+$READUTMP `func_id_user` || errno=77
+
+if test $errno -ne 0; then
+    cat >&2 <<-EOT
+	NOTICE: read_utmp() from Gnulib just failed.  This can be
+	due to running this test in sudo mode, or using a role.
+	Should this script fail while running it as a logged in
+	user, then read_utmp() is indeed broken on this system.
+	Then the present syslog and talkd are not fully functional.
+	You are then welcome to report this failure.
+	EOT
+fi
+
+exit $errno

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=1c6c243965ba2e2e795105ff0fc78aea2742e8a8


commit 1c6c243965ba2e2e795105ff0fc78aea2742e8a8
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Oct 29 22:23:44 2012 +0100

    ftp: Support standard options.
    
    Add alias `pftp' and option `-e' for better
    prospects as drop-in replacement.

diff --git a/ChangeLog b/ChangeLog
index 489f5a4..02d3ee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-10-29  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ftp: Increase universality by recognizing the alias
+	name `pftp' and the option `-e'.
+
+	* ftp/cmds.c (another): New variable SIZE.  Use LEN
+	typed as size_t.  Condition readline() on `usereadline'
+	not `fromatty', otherwise read input based on getline().
+	Likewise, condition add_history() on `usereadline'.
+	(dotrans): Use type size_t for I, OSTOP, FOUND.
+	* ftp/ftp_var.h (usereadline): New variable.
+	* ftp/main.c (argp_options): New option `-e/--no-edit'.
+	(parse_opt) <'e'>: New case.
+	(main): Check if invoked as `pftp', setting passive mode.
+	Clear `usereadline' without a TTY.
+	(cmdscanner): Change L to ssize_t.  New variable LEN.
+	Condition readline() and add_history() on `usereadline',
+	else use a getline() block for input.
+
 2012-10-28  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ftpd/popen.c (ftpd_popen): Prevent null deference
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 7edf426..626f297 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -903,8 +903,14 @@ network site.  Synopsis:
 
 @example
 ftp [@var{option}@dots{}] [@var{host} [@var{port}]]
+pftp [@var{option}@dots{}] [@var{host} [@var{port}]]
 @end example
 
+@noindent
+The alternate name @command{pftp} is starting in passive mode,
+but is otherwise identical to @command{ftp}.
+The available command line options are as follows:
+
 @table @option
 @item -4
 @itemx --ipv4
@@ -922,19 +928,27 @@ Initially set addressing to IPv6 only.
 @itemx --active
 @opindex -A
 @opindex --active
-Enable active mode transfer.
+Enable active mode transfer.  Default mode for @command{ftp}.
 
 @item -p
 @itemx --passive
 @opindex -p
 @opindex --passive
-Enable passive mode transfer.
+Enable passive mode transfer.  Default mode when invoked
+as @command{pftp}.
 
 @item -d
 @itemx --debug
 @opindex -d
 @opindex --debug
-Enables debugging.
+Enables socket debugging.
+
+@item -e
+@itemx --no-edit
+@opindex -e
+@opindex --no-edit
+Disables the editing of commands.  This is default setting
+for batch mode, without a TTY.
 
 @item -g
 @itemx --no-glob
@@ -968,10 +982,17 @@ supplied, its value is used instead of the default @samp{ftp> }.
 Notice, that the argument is optional.
 
 @item -t
-@item --trace
+@itemx --trace
 @opindex -t
 @opindex --trace
 Enable packet tracing.
+
+@item -v
+@itemx --verbose
+@opindex -v
+@opindex --verbose
+Start in verbose mode, printing informational messages.
+This is default for interactive mode.
 @end table
 
 @menu
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 3e1328f..6121c7a 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -140,9 +140,10 @@ char *mapout = 0;
 int
 another (int *pargc, char ***pargv, const char *prompt)
 {
-  char *arg;
+  char *arg = NULL;
   char *buffer;
-  int len = strlen (line), ret;
+  size_t size = 0, len = strlen (line);
+  int ret;
 
   buffer = (char *) malloc (sizeof (char) * (strlen (prompt) + 4));
   if (!buffer)
@@ -150,10 +151,30 @@ another (int *pargc, char ***pargv, const char *prompt)
 
   sprintf (buffer, "(%s) ", prompt);
 
-  arg = readline (buffer);
+  if (usereadline)
+    arg = readline (buffer);
+  else
+    {
+      char *nl;
+
+      fprintf (stdout, "%s", buffer);
+      fflush (stdout);
+
+      if (getline (&arg, &size, stdin) <= 0)
+	{
+	  free (buffer);
+	  free (arg);
+	  intr (0);
+	}
+
+      nl = strchr (arg, '\n');
+      if (nl)
+	*nl = '\0';
+    }
+
   free (buffer);
 
-  if (fromatty && arg && *arg)
+  if (usereadline && arg && *arg)
     add_history (arg);
 
   if (!arg)
@@ -2080,7 +2101,7 @@ dotrans (char *name)
 {
   char *new = xmalloc (strlen (name) + 1);
   char *cp1, *cp2 = new;
-  int i, ostop, found;
+  size_t i, ostop, found;
 
   for (ostop = 0; *(ntout + ostop) && ostop < sizeof (ntout) - 1; ostop++)
     continue;
diff --git a/ftp/ftp_var.h b/ftp/ftp_var.h
index 6afa945..224669a 100644
--- a/ftp/ftp_var.h
+++ b/ftp/ftp_var.h
@@ -89,6 +89,7 @@ FTP_EXTERN char pasv[64];	/* passive port for proxy data connection */
 FTP_EXTERN int passivemode;	/* passive mode enabled */
 FTP_EXTERN int doepsv4;		/* EPSV/EPRT for IPv4 enabled */
 FTP_EXTERN int usefamily;	/* Precondition on an adress family */
+FTP_EXTERN int usereadline;	/* Use readline support, given a TTY.  */
 FTP_EXTERN char *altarg;	/* argv[1] with no shell-like preprocessing  */
 FTP_EXTERN char ntin[17];	/* input translation table */
 FTP_EXTERN char ntout[17];	/* output translation table */
diff --git a/ftp/main.c b/ftp/main.c
index 1c0cdec..a15c92e 100644
--- a/ftp/main.c
+++ b/ftp/main.c
@@ -82,7 +82,7 @@
 
 
 #define DEFAULT_PROMPT "ftp> "
-static char *prompt = 0;
+static char *prompt = NULL;
 
 const char args_doc[] = "[HOST [PORT]]";
 const char doc[] = "Remote file transfer.";
@@ -94,13 +94,15 @@ enum {
 static struct argp_option argp_options[] = {
 #define GRP 0
   {"debug", 'd', NULL, 0, "set the SO_DEBUG option", GRP+1},
+  {"no-edit", 'e', NULL, 0, "disable command line editing", GRP+1},
   {"no-glob", 'g', NULL, 0, "turn off file name globbing", GRP+1},
   {"no-prompt", 'i', NULL, 0, "do not prompt during multiple file transfers",
    GRP+1},
   {"no-login", 'n', NULL, 0, "do not automatically login to the remote system",
    GRP+1},
   {"trace", 't', NULL, 0, "enable packet tracing", GRP+1},
-  {"passive", 'p', NULL, 0, "enable passive mode transfer", GRP+1},
+  {"passive", 'p', NULL, 0,
+   "enable passive mode transfer, default for `pftp'", GRP+1},
   {"active", 'A', NULL, 0, "enable active mode transfer", GRP+1},
   {"prompt", OPT_PROMPT, "PROMPT", OPTION_ARG_OPTIONAL, "print a command line PROMPT "
    "(optionally), even if not on a tty", GRP+1},
@@ -121,6 +123,10 @@ parse_opt (int key, char *arg, struct argp_state *state _GL_UNUSED_PARAMETER)
       debug++;
       break;
 
+    case 'e':
+      usereadline = 0;	/* No editing.  */
+      break;
+
     case 'g':		/* No glob.  */
       doglob = 0;
       break;
@@ -188,6 +194,16 @@ main (int argc, char *argv[])
   passivemode = 0;		/* passive mode not active */
   doepsv4 = 0;			/* use EPRT/EPSV for IPv4 */
   usefamily = AF_UNSPEC;	/* allow any address family */
+  usereadline = 1;		/* normally using readline */
+
+  /* Invoked as `pftp'?  Then set passive mode.  */
+  cp = strrchr (argv[0], '/');
+  if (cp)
+    cp++;
+  else
+    cp = argv[0];
+  if (!strcmp ("pftp", cp))
+    passivemode = 1;
 
   /* Parse command line */
   iu_argp_init ("ftp", default_program_authors);
@@ -203,6 +219,8 @@ main (int argc, char *argv[])
       if (!prompt)
 	prompt = DEFAULT_PROMPT;
     }
+  else
+    usereadline = 0;
 
   cpend = 0;			/* no pending replies */
   proxy = 0;			/* proxy not active */
@@ -319,7 +337,8 @@ void
 cmdscanner (int top)
 {
   struct cmd *c;
-  int l;
+  ssize_t l;
+  size_t len;
 
   if (!top)
     putchar ('\n');
@@ -329,10 +348,40 @@ cmdscanner (int top)
 	{
 	  free (line);
 	  line = NULL;
+	  len = 0;
+	}
+
+      if (usereadline)
+	line = readline (prompt);
+      else
+	{
+	  if (prompt)
+	    {
+	      fprintf (stdout, "%s", prompt);
+	      fflush (stdout);
+	    }
+
+	  l = getline (&line, &len, stdin);
+	  if ((l > 0) && line)
+	    {
+	      char *nl = strchr (line, '\n');
+
+	      if (nl)
+		*nl = '\0';
+	    }
+	  else
+	    {
+	      free (line);	/* EOF, et cetera */
+	      line = NULL;
+	    }
+
+	  if (!fromatty && prompt)
+	    fprintf (stdout, "%s\n", line ? line : "");
 	}
-      line = readline (prompt);
+
       if (!line)
 	quit (0, 0);
+
       l = strlen (line);
       if (l >= MAXLINE)
 	{
@@ -340,7 +389,7 @@ cmdscanner (int top)
 	  break;
 	}
 
-      if (fromatty && line && *line)
+      if (usereadline && line && *line)
 	add_history (line);
 
       if (l == 0)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   49 ++++++++++++++++++++++++++++
 NEWS               |    6 +++
 am/readline.m4     |    9 +++++-
 configure.ac       |    9 ++---
 doc/inetutils.texi |   29 ++++++++++++++--
 ftp/cmds.c         |   43 +++++++++++++++++++++----
 ftp/ftp_var.h      |    1 +
 ftp/main.c         |   77 ++++++++++++++++++++++++++++++++++++++++----
 tests/.gitignore   |    1 +
 tests/Makefile.am  |    4 +-
 tests/readutmp.c   |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/utmp.sh      |   59 ++++++++++++++++++++++++++++++++++
 12 files changed, 350 insertions(+), 27 deletions(-)
 create mode 100644 tests/readutmp.c
 create mode 100755 tests/utmp.sh


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 02 06:05:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TUE7q-0007Jq-0F
	for mharc-commit-inetutils@gnu.org; Fri, 02 Nov 2012 06:05:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42290)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUE7g-0007G3-MA
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 06:05:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUE7c-000230-3m
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 06:05:08 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:51939)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUE7c-00022h-11
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 06:05:04 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TUE7b-0001hs-JJ
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 10:05:03 +0000
Date: Fri, 02 Nov 2012 10:05:03 +0000
Message-Id: <E1TUE7b-0001hs-JJ@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-198-g73d53fe
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d94aaf66915ccc93e913368bc7382c6fda6630bd
X-Git-Newrev: 73d53fe325d456898f1df0c22e79f0e6a9d797e2
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Nov 2012 10:05:16 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  73d53fe325d456898f1df0c22e79f0e6a9d797e2 (commit)
      from  d94aaf66915ccc93e913368bc7382c6fda6630bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=73d53fe325d456898f1df0c22e79f0e6a9d797e2


commit 73d53fe325d456898f1df0c22e79f0e6a9d797e2
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 2 10:49:52 2012 +0100

    telnet: Port sanity check.

diff --git a/ChangeLog b/ChangeLog
index ffc7b76..d54da07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* telnet/commands.c (tn): New block with sanity check of
+	numerical port, being out of range, or mixed with letters.
+
 2012-10-01  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftp: Build without readline support.
diff --git a/telnet/commands.c b/telnet/commands.c
index 0375e72..e49aace 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -2544,6 +2544,25 @@ tn (int argc, char *argv[])
 	}
       else
 	telnetport = 0;
+      if (*portp >= '0' && *portp <= '9')
+	{
+	  long long int val;
+	  char *endp;
+
+	  val = strtoll (portp, &endp, 10);
+
+	  if ((errno == ERANGE && (val == LLONG_MAX || val == LLONG_MIN))
+	      || (*endp == '\0' && (val < 1 || val > 65535)))
+	    {
+	      printf ("Port number %s is out of range.\n", portp);
+	      return 0;
+	    }
+	  else if (*endp)
+	    {
+	      printf ("Invalid port name '%s'.\n", portp);
+	      return 0;
+	    }
+	}
     }
 
   free (hostname);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    5 +++++
 telnet/commands.c |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 02 07:02:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TUF1F-0002Cw-RN
	for mharc-commit-inetutils@gnu.org; Fri, 02 Nov 2012 07:02:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38270)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUF15-0002Ch-VE
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 07:02:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUF0x-00010S-RL
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 07:02:23 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60810)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TUF0x-00010O-OL
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 07:02:15 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TUEzT-0004Z5-FH
	for commit-inetutils@gnu.org; Fri, 02 Nov 2012 11:01:09 +0000
Date: Fri, 02 Nov 2012 11:00:43 +0000
Message-Id: <E1TUEzT-0004Z5-FH@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-199-g302aa40
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 73d53fe325d456898f1df0c22e79f0e6a9d797e2
X-Git-Newrev: 302aa409c6b90039ee8e7a6afcd631f72c0cab20
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Nov 2012 11:02:32 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  302aa409c6b90039ee8e7a6afcd631f72c0cab20 (commit)
      from  73d53fe325d456898f1df0c22e79f0e6a9d797e2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=302aa409c6b90039ee8e7a6afcd631f72c0cab20


commit 302aa409c6b90039ee8e7a6afcd631f72c0cab20
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 2 11:58:30 2012 +0100

    telnet: Portability matter.

diff --git a/ChangeLog b/ChangeLog
index d54da07..dae5e07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	* telnet/commands.c: Include <limits.h>.  Needed
+	by Solaris to have LLONG_MAX.
+
+2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	* telnet/commands.c (tn): New block with sanity check of
 	numerical port, being out of range, or mixed with letters.
 
diff --git a/telnet/commands.c b/telnet/commands.c
index e49aace..651b3e6 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -69,6 +69,7 @@
 #include <errno.h>
 
 #include <stdlib.h>
+#include <limits.h>	/* LLONG_MAX for Solaris. */
 
 #include <arpa/inet.h>
 #include <arpa/telnet.h>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    5 +++++
 telnet/commands.c |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Nov 08 16:11:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TWZOC-0001Yr-2r
	for mharc-commit-inetutils@gnu.org; Thu, 08 Nov 2012 16:11:52 -0500
Received: from eggs.gnu.org ([208.118.235.92]:39766)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWZO9-0001Yl-5N
	for commit-inetutils@gnu.org; Thu, 08 Nov 2012 16:11:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWZO6-0006IQ-Oh
	for commit-inetutils@gnu.org; Thu, 08 Nov 2012 16:11:49 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:48366)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWZO6-0006IM-Ki
	for commit-inetutils@gnu.org; Thu, 08 Nov 2012 16:11:46 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TWZO5-0007Cq-Sz
	for commit-inetutils@gnu.org; Thu, 08 Nov 2012 21:11:46 +0000
Date: Thu, 08 Nov 2012 21:11:45 +0000
Message-Id: <E1TWZO5-0007Cq-Sz@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-201-gd4855df
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 302aa409c6b90039ee8e7a6afcd631f72c0cab20
X-Git-Newrev: d4855dfde8f2feb7ba3124924fb546cdde3bdc20
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Nov 2012 21:11:50 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  d4855dfde8f2feb7ba3124924fb546cdde3bdc20 (commit)
       via  9f35cb2128ec0421a7029aa1caa8ce78838bd036 (commit)
      from  302aa409c6b90039ee8e7a6afcd631f72c0cab20 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=d4855dfde8f2feb7ba3124924fb546cdde3bdc20


commit d4855dfde8f2feb7ba3124924fb546cdde3bdc20
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Tue Nov 6 18:41:50 2012 +0100

    rlogind: Force encrypted sessions.

diff --git a/ChangeLog b/ChangeLog
index ee503a0..78a09c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2012-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	rshd: Allow enforced encryption with libshishi,
+	rejecting other Kerberized sessions.
+
+	* src/rshd.c (uses_encryption) [SHISHI]: New variable.
+	(options) [(KERBEROS || SHISHI) && ENCRYPTION]:
+	Expose option `-x/--encrypt'.
+	(doit) [SHISHI] <client encrypts>: Set `uses_encryption'
+	instead of `doencrypt'.  Fail connection request if
+	`doencrypt && !uses_encryption', otherwise proceed.
+	[SHISHI] <logging>: Refine message to indicate whether
+	encryption is in use.
+
+	* src/rlogind.c (do_krb_login) [SHISHI]: Initialize RC
+	as SHISHI_VERIFY_FAILED.
+	[KERBEROS]: Initialize RC as 1.
+
+	* src/rlogind.c (setup_utmp): Calculate offset
+	from PATH_DEV.
+	* telnetd/pty.c (setup_utmp): Likewise.
+
 2012-10-05  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rlogind: Buffer overflow, causing stalled and
diff --git a/src/rlogind.c b/src/rlogind.c
index 5e839ff..db77df2 100644
--- a/src/rlogind.c
+++ b/src/rlogind.c
@@ -1027,7 +1027,7 @@ setup_utmp (char *line, char *host)
 {
   char *ut_id = utmp_ptsid (line, "rl");
 
-  utmp_init (line + sizeof ("/dev/") - 1, ".rlogin", ut_id, host);
+  utmp_init (line + sizeof (PATH_DEV) - 1, ".rlogin", ut_id, host);
 }
 
 void
@@ -1258,14 +1258,18 @@ do_rlogin (int infd, struct auth_data *ap)
 int
 do_krb_login (int infd, struct auth_data *ap, const char **err_msg)
 {
-  int rc;
+# if defined SHISHI
+  int rc = SHISHI_VERIFY_FAILED;
+# else /* KERBEROS */
+  int rc = 1;
+# endif
 
   *err_msg = NULL;
 # if defined KRB5
   if (kerberos == AUTH_KERBEROS_5)
     rc = do_krb5_login (infd, ap, err_msg);
   else
-# elif defined(SHISHI)
+# elif defined SHISHI
   if (kerberos == AUTH_KERBEROS_SHISHI)
     rc = do_shishi_login (infd, ap, err_msg);
   else
diff --git a/src/rshd.c b/src/rshd.c
index 35d8588..f560132 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -198,7 +198,7 @@ Shishi_ap *ap;
 Shishi_key *enckey;
 shishi_ivector iv1, iv2, iv3, iv4;
 shishi_ivector *ivtab[4];
-int protocol;
+int protocol, uses_encryption = 0;
 # endif /* SHISHI */
 # define VERSION_SIZE	9
 # define SECURE_MESSAGE  "This rsh session is using DES encryption for all transmissions.\r\n"
@@ -230,6 +230,10 @@ static struct argp_option options[] = {
     "fail for non-Kerberos authentication", GRP },
   { "server-principal", 'S', "NAME", 0,
     "set Kerberos server name, overriding canonical hostname", GRP },
+# if defined ENCRYPTION
+  { "encrypt", 'x', NULL, 0,
+    "fail for non-encrypted, Kerberized sessions", GRP },
+# endif
 # undef GRP
 #endif /* KERBEROS */
   { NULL, 0, NULL, 0, NULL, 0 }
@@ -866,7 +870,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	  {
 	    int i;
 
-	    doencrypt = 1;
+	    uses_encryption = 1;
 
 	    ivtab[0] = &iv1;
 	    ivtab[1] = &iv2;
@@ -961,6 +965,17 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	exit (EXIT_FAILURE);
       }
 
+    if (doencrypt && !uses_encryption)
+      {
+	syslog (LOG_INFO, "non-encrypted session denied");
+	free (compcksum);
+	shishi_ap_done (ap);
+	rshd_error ("Only encrypted sessions are allowed.\n");
+	exit (EXIT_FAILURE);
+      }
+    else
+      doencrypt = uses_encryption;
+
     rc = shishi_authorized_p (h, shishi_ap_tkt (ap), locuser);
     if (!rc)
       {
@@ -1615,7 +1630,9 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	syslog (LOG_INFO | LOG_AUTH,
 		"%s%s@%s as %s: cmd='%.80s'",
 #ifdef SHISHI
-		use_kerberos ? "Kerberized " : "",
+		!use_kerberos ? ""
+		  : !doencrypt ? "Kerberized "
+		    : "Kerberized and encrypted ",
 #else
 		"",
 #endif
diff --git a/telnetd/pty.c b/telnetd/pty.c
index 83fd373..0926142 100644
--- a/telnetd/pty.c
+++ b/telnetd/pty.c
@@ -32,7 +32,7 @@ void
 setup_utmp (char *line, char *host)
 {
   char *ut_id = utmp_ptsid (line, "tn");
-  utmp_init (line + sizeof ("/dev/") - 1, ".telnet", ut_id, host);
+  utmp_init (line + sizeof (PATH_DEV) - 1, ".telnet", ut_id, host);
 }
 
 

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=9f35cb2128ec0421a7029aa1caa8ce78838bd036


commit 9f35cb2128ec0421a7029aa1caa8ce78838bd036
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Nov 5 23:25:28 2012 +0100

    rlogind: Buffer overflow with encryption.

diff --git a/ChangeLog b/ChangeLog
index dae5e07..ee503a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-10-05  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	rlogind: Buffer overflow, causing stalled and
+	incomplete login for encrypted connections.
+
+	* libinetutils/shishi_def.h (SHISHI_ENCRYPT_BUFLEN):
+	Rename from previous BUFLEN.
+	* libinetutils/shishi.c (readenc): Likewise, used
+	in calling memset() on `buf'.
+	* src/rlogind.c (do_shishi_login): Replace 100 by
+	sizeof(cksumdata) when calling snprintf().  Insert
+	`encrypted' in syslog message for encrypted exchange.
+	(BUFLEN): Define as SHISHI_ENCRYPT_BUFLEN, if possible,
+	otherwise fall back to existing value, or to 1024.
+	(protocol): Declare FIBUF of length BUFLEN, and DBUF
+	of length BUFLEN+1.
+
 2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* telnet/commands.c: Include <limits.h>.  Needed
diff --git a/libinetutils/shishi.c b/libinetutils/shishi.c
index 90c79a8..21e375b 100644
--- a/libinetutils/shishi.c
+++ b/libinetutils/shishi.c
@@ -684,7 +684,7 @@ readenc (Shishi * h, int sock, char *buf, int *len, shishi_ivector * iv,
       val = sizeof (int);
     }
 
-  memset (buf, 0, BUFLEN);
+  memset (buf, 0, SHISHI_ENCRYPT_BUFLEN);
 
   /* copy decrypted data to output */
   memcpy (buf, out + val, outlen - val);
diff --git a/libinetutils/shishi_def.h b/libinetutils/shishi_def.h
index 4970cd9..1f0d3d1 100644
--- a/libinetutils/shishi_def.h
+++ b/libinetutils/shishi_def.h
@@ -22,7 +22,7 @@
 # include <netinet/in.h>
 
 # define SERVICE "host"
-# define BUFLEN 1040
+# define SHISHI_ENCRYPT_BUFLEN 1040
 
 struct shishi_iv
 {
diff --git a/src/rlogind.c b/src/rlogind.c
index c169ef5..5e839ff 100644
--- a/src/rlogind.c
+++ b/src/rlogind.c
@@ -1574,7 +1574,7 @@ do_shishi_login (int infd, struct auth_data *ad, const char **err_msg)
       fatal (infd, "Can't get sockname", 1);
     }
 
-  snprintf (cksumdata, 100, "%u:%s%s",
+  snprintf (cksumdata, sizeof (cksumdata), "%u:%s%s",
 	    (sock.ss_family == AF_INET6)
 	      ? ntohs (((struct sockaddr_in6 *) &sock)->sin6_port)
 	      : ntohs (((struct sockaddr_in *) &sock)->sin_port),
@@ -1607,7 +1607,8 @@ do_shishi_login (int infd, struct auth_data *ad, const char **err_msg)
     }
 
   syslog (LOG_INFO | LOG_AUTH,
-	  "Kerberos V login from %s on %s as `%s'.\n",
+	  "Kerberos V %slogin from %s on %s as `%s'.\n",
+	  encrypt_io ? "encrypted " : "",
 	  ad->rusername, ad->hostname, ad->lusername);
 
   shishi_ap_done (ad->ap);
@@ -1681,10 +1682,17 @@ char oobdata[] = { TIOCPKT_WINDOW };	/* May be modified by protocol/control */
 char oobdata_new[] = { 0377, 0377, 'o', 'o', TIOCPKT_WINDOW };
 #endif
 
+#ifdef SHISHI_ENCRYPT_BUFLEN
+# undef BUFLEN
+# define BUFLEN SHISHI_ENCRYPT_BUFLEN
+#elif !defined BUFLEN
+# define BUFLEN 1024
+#endif
+
 void
 protocol (int f, int p, struct auth_data *ap)
 {
-  char fibuf[1024], *pbp = NULL, *fbp = NULL;
+  char fibuf[BUFLEN], *pbp = NULL, *fbp = NULL;
   int pcc = 0, fcc = 0;
   int cc, nfd, n;
   char cntl;
@@ -1821,7 +1829,7 @@ protocol (int f, int p, struct auth_data *ap)
 
       if (FD_ISSET (p, &ibits))
 	{
-	  char dbuf[1024 + 1];
+	  char dbuf[BUFLEN + 1];
 
 	  pcc = read (p, dbuf, sizeof dbuf);
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |   39 +++++++++++++++++++++++++++++++++++++++
 libinetutils/shishi.c     |    2 +-
 libinetutils/shishi_def.h |    2 +-
 src/rlogind.c             |   26 +++++++++++++++++++-------
 src/rshd.c                |   23 ++++++++++++++++++++---
 telnetd/pty.c             |    2 +-
 6 files changed, 81 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 09 08:34:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TWoj0-0004sx-EV
	for mharc-commit-inetutils@gnu.org; Fri, 09 Nov 2012 08:34:22 -0500
Received: from eggs.gnu.org ([208.118.235.92]:43436)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWoiu-0004rc-Lx
	for commit-inetutils@gnu.org; Fri, 09 Nov 2012 08:34:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWoim-0004vN-2T
	for commit-inetutils@gnu.org; Fri, 09 Nov 2012 08:34:16 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40061)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TWoil-0004uG-Vx
	for commit-inetutils@gnu.org; Fri, 09 Nov 2012 08:34:08 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TWoig-0001WW-MN
	for commit-inetutils@gnu.org; Fri, 09 Nov 2012 13:34:05 +0000
Date: Fri, 09 Nov 2012 13:34:03 +0000
Message-Id: <E1TWoig-0001WW-MN@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-202-g6d31ccf
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d4855dfde8f2feb7ba3124924fb546cdde3bdc20
X-Git-Newrev: 6d31ccf9b3fc129875122bf3fd62834f652d3cd3
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Nov 2012 13:34:21 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  6d31ccf9b3fc129875122bf3fd62834f652d3cd3 (commit)
      from  d4855dfde8f2feb7ba3124924fb546cdde3bdc20 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=6d31ccf9b3fc129875122bf3fd62834f652d3cd3


commit 6d31ccf9b3fc129875122bf3fd62834f652d3cd3
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 9 14:15:20 2012 +0100

    rcp: Encrypted libshishi support.

diff --git a/ChangeLog b/ChangeLog
index 78a09c3..e07ed93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-10-09  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	rcp: Support encrypted libshishi sessions.
+
+	* src/rcp.c (toremote) <remote-to-remote>: In format strings,
+	put options to PATH_RSH before the host argument.
+	[(KERBEROS || SHISHI) && ENCRYPTION] <doencrypt>:
+	Add option `-x' in format strings.
+	[SHISHI && ENCRYPTION]: Close encryption handle and data.
+	(tolocal): In format string, portability needs `-R' as
+	option to PATH_CP, not `-r'.
+	[SHISHI && ENCRYPTION]: Close encryption handle and data.
+	(kerberos) [SHISHI && ENCRYPTION]: New variables I and XBP.
+	Call krcmd_mutual() and initialize encryption data.
+
+	* src/rshd.c (doit) <denied non-encryption>: Include host name
+	in syslog message.
+
 2012-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rshd: Allow enforced encryption with libshishi,
diff --git a/src/rcp.c b/src/rcp.c
index 71949a1..0e97cbd 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -311,7 +311,7 @@ main (int argc, char *argv[])
     {
 # if defined ENCRYPTION && defined KERBEROS
       shell = doencrypt ? "ekshell" : "kshell";
-# else
+# else /* SHISHI */
       shell = "kshell";		/* Libshishi uses a single service.  */
 # endif
       if ((sp = getservbyname (shell, "tcp")) == NULL)
@@ -452,8 +452,16 @@ toremote (char *targ, int argc, char *argv[])
 	      else if (!okname (suser))
 		continue;
 	      if (asprintf (&bp,
-			    "%s %s -l %s -n %s %s '%s%s%s:%s'",
-			    PATH_RSH, host, suser, command, src,
+#if defined ENCRYPTION && (defined KERBEROS || defined SHISHI)
+			    "%s%s -l %s -n %s %s %s '%s%s%s:%s'",
+#else
+			    "%s -l %s -n %s %s %s '%s%s%s:%s'",
+#endif
+			    PATH_RSH,
+#if ENCRYPTION && (defined KERBEROS || defined SHISHI)
+			    doencrypt ? " -x" : "",
+#endif
+			    suser, host, command, src,
 			    tuser ? tuser : "", tuser ? "@" : "",
 			    thost, targ) < 0)
 		xalloc_die ();
@@ -461,8 +469,16 @@ toremote (char *targ, int argc, char *argv[])
 	  else
 	    {
 	      if (asprintf (&bp,
-			    "exec %s %s -n %s %s '%s%s%s:%s'",
-			    PATH_RSH, argv[i], command, src,
+#if defined ENCRYPTION && (defined KERBEROS || defined SHISHI)
+			    "exec %s%s -n %s %s %s '%s%s%s:%s'",
+#else
+			    "exec %s -n %s %s %s '%s%s%s:%s'",
+#endif
+			    PATH_RSH,
+#if ENCRYPTION && (defined KERBEROS || defined SHISHI)
+			    doencrypt ? " -x" : "",
+#endif
+			    argv[i], command, src,
 			    tuser ? tuser : "", tuser ? "@" : "",
 			    thost, targ) < 0)
 		xalloc_die ();
@@ -520,8 +536,21 @@ toremote (char *targ, int argc, char *argv[])
 	  rem = -1;
 #ifdef SHISHI
 	  if (use_kerberos)
-	    shishi_done (h);
-#endif
+	    {
+	      shishi_done (h);
+# ifdef ENCRYPTION
+	      if (doencrypt)
+		{
+		  shishi_key_done (enckey);
+		  for (i = 0; i < 4; i++)
+		    {
+		      shishi_crypto_close (ivtab[i]->ctx);
+		      free (ivtab[i]->iv);
+		    }
+		}
+# endif /* ENCRYPTION */
+	    }
+#endif /* SHISHI */
 	}
     }
 }
@@ -544,7 +573,7 @@ tolocal (int argc, char *argv[])
 	    strlen (argv[argc - 1]) + 20;
 	  if (asprintf (&bp, "exec %s%s%s %s %s",
 			PATH_CP,
-			iamrecursive ? " -r" : "",
+			iamrecursive ? " -R" : "",
 			preserve_option ? " -p" : "",
 			argv[i], argv[argc - 1]) < 0)
 	    xalloc_die ();
@@ -610,7 +639,20 @@ tolocal (int argc, char *argv[])
 #ifdef SHISHI
       if (use_kerberos)
 	shishi_done (h);
-#endif
+	{
+# ifdef ENCRYPTION
+	  if (doencrypt)
+	    {
+	      shishi_key_done (enckey);
+	      for (i = 0; i < 4; i++)
+		{
+		  shishi_crypto_close (ivtab[i]->ctx);
+		  free (ivtab[i]->iv);
+		}
+	    }
+# endif /* ENCRYPTION */
+	}
+#endif /* SHISHI */
     }
 }
 
@@ -1124,12 +1166,69 @@ again:
 #  ifdef KERBEROS
 	  rem = krcmd_mutual (host, port, user, bp, 0, dest_realm,
 			      &cred, schedule) :
+	  krb_errno = errno;
 #  elif defined SHISHI
-	  /* Not yet supported.  */
-	  rem = -1; /* krcmd_mutual () */
-	  errno = ENOENT;
-#  endif
+	  int i;
+	  char *xbp = NULL;
+
+	  xbp = xmalloc (strlen (bp) + sizeof ("-x "));
+	  sprintf (xbp, "%s%s", "-x ", bp);
+	  rem = krcmd_mutual (&h, host, port, &user, xbp, NULL,
+			      dest_realm, &enckey, family);
 	  krb_errno = errno;
+	  if (rem > 0)
+	    {
+	      keytype = shishi_key_type (enckey);
+	      keylen = shishi_cipher_blocksize (keytype);
+
+	      ivtab[0] = &iv1;
+	      ivtab[1] = &iv2;
+	      ivtab[2] = &iv3;
+	      ivtab[3] = &iv4;
+
+	      for (i = 0; i < 4; i++)
+		{
+		  ivtab[i]->ivlen = keylen;
+
+		  switch (keytype)
+		    {
+		    case SHISHI_DES_CBC_CRC:
+		    case SHISHI_DES_CBC_MD4:
+		    case SHISHI_DES_CBC_MD5:
+		    case SHISHI_DES_CBC_NONE:
+		    case SHISHI_DES3_CBC_HMAC_SHA1_KD:
+		      ivtab[i]->keyusage = SHISHI_KEYUSAGE_KCMD_DES;
+		      ivtab[i]->iv = xmalloc (ivtab[i]->ivlen);
+		      memset (ivtab[i]->iv,
+			      2 * i + 1 * (i < 2) - 4 * (i >= 2),
+			      ivtab[i]->ivlen);
+		      ivtab[i]->ctx =
+			shishi_crypto (h, enckey, ivtab[i]->keyusage,
+				       shishi_key_type (enckey), ivtab[i]->iv,
+				       ivtab[i]->ivlen);
+		      break;
+		    case SHISHI_ARCFOUR_HMAC:
+		    case SHISHI_ARCFOUR_HMAC_EXP:
+		      ivtab[i]->keyusage =
+			SHISHI_KEYUSAGE_KCMD_DES + 2 + 4 * i;
+		      ivtab[i]->ctx =
+			shishi_crypto (h, enckey, ivtab[i]->keyusage,
+				       shishi_key_type (enckey), NULL, 0);
+		      break;
+		    default:
+		      ivtab[i]->keyusage =
+			SHISHI_KEYUSAGE_KCMD_DES + 2 + 4 * i;
+		      ivtab[i]->iv = xmalloc (ivtab[i]->ivlen);
+		      memset (ivtab[i]->iv, 0, ivtab[i]->ivlen);
+		      ivtab[i]->ctx =
+			shishi_crypto (h, enckey, ivtab[i]->keyusage,
+				       shishi_key_type (enckey), ivtab[i]->iv,
+				       ivtab[i]->ivlen);
+		    }
+		}
+	    }
+	  free (xbp);
+#  endif
 	}
       else
 # endif /* ENCRYPTION */
diff --git a/src/rshd.c b/src/rshd.c
index f560132..0feda9d 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -967,7 +967,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 
     if (doencrypt && !uses_encryption)
       {
-	syslog (LOG_INFO, "non-encrypted session denied");
+	syslog (LOG_INFO, "non-encrypted session denied from %s", hostname);
 	free (compcksum);
 	shishi_ap_done (ap);
 	rshd_error ("Only encrypted sessions are allowed.\n");

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog  |   18 +++++++++
 src/rcp.c  |  125 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 src/rshd.c |    2 +-
 3 files changed, 131 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Nov 10 13:28:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TXFnM-0004tZ-C8
	for mharc-commit-inetutils@gnu.org; Sat, 10 Nov 2012 13:28:40 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37083)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TXFnI-0004sO-5l
	for commit-inetutils@gnu.org; Sat, 10 Nov 2012 13:28:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TXFnF-00030p-3W
	for commit-inetutils@gnu.org; Sat, 10 Nov 2012 13:28:36 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:41004)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TXFnE-00030k-Vn
	for commit-inetutils@gnu.org; Sat, 10 Nov 2012 13:28:33 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TXFnE-0004D0-Cs
	for commit-inetutils@gnu.org; Sat, 10 Nov 2012 18:28:32 +0000
Date: Sat, 10 Nov 2012 18:28:32 +0000
Message-Id: <E1TXFnE-0004D0-Cs@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-203-gcd22e53
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6d31ccf9b3fc129875122bf3fd62834f652d3cd3
X-Git-Newrev: cd22e53cf78c9fd317d2b25296ebf0235c3d4644
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 10 Nov 2012 18:28:39 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  cd22e53cf78c9fd317d2b25296ebf0235c3d4644 (commit)
      from  6d31ccf9b3fc129875122bf3fd62834f652d3cd3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=cd22e53cf78c9fd317d2b25296ebf0235c3d4644


commit cd22e53cf78c9fd317d2b25296ebf0235c3d4644
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Nov 10 19:16:04 2012 +0100

    Consistent macro usage.

diff --git a/ChangeLog b/ChangeLog
index e07ed93..798fea6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,18 @@
-2012-10-09  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-10  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	Consistent use of device prefix.
+
+	* srs/rlogind.c (setup_utmp, cleanup): Use PATH_TTY_PFX,
+	not PATH_DEV.
+	* talkd/announce.c (announce): Likewise.
+	* talkd/process.c (find_user): Likewise.
+	* telnetd/pty.c (setup_utmp, cleanup): Likewise.
+
+	* src/rexecd.c (doit) [DEBUG]: Use PATH_TTY, not _PATH_TTY.
+
+	* doc/inetutils.texi: Refer to `.k5login', not `.klogin'.
+
+2012-11-09  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rcp: Support encrypted libshishi sessions.
 
@@ -16,7 +30,7 @@
 	* src/rshd.c (doit) <denied non-encryption>: Include host name
 	in syslog message.
 
-2012-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-06  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rshd: Allow enforced encryption with libshishi,
 	rejecting other Kerberized sessions.
@@ -38,7 +52,7 @@
 	from PATH_DEV.
 	* telnetd/pty.c (setup_utmp): Likewise.
 
-2012-10-05  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-05  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rlogind: Buffer overflow, causing stalled and
 	incomplete login for encrypted connections.
@@ -55,17 +69,17 @@
 	(protocol): Declare FIBUF of length BUFLEN, and DBUF
 	of length BUFLEN+1.
 
-2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-02  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* telnet/commands.c: Include <limits.h>.  Needed
 	by Solaris to have LLONG_MAX.
 
-2012-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-02  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* telnet/commands.c (tn): New block with sanity check of
 	numerical port, being out of range, or mixed with letters.
 
-2012-10-01  Mats Erik Andersson  <gnu@gisladisker.se>
+2012-11-01  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftp: Build without readline support.
 
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 626f297..8ac50ed 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -2047,15 +2047,15 @@ mode is in effect.  See the appropriate man pages for more information.
 
 If @command{rlogin} was compiled with kerberos support, options
 @option{-x}, @option{-k}, @option{-K} are available.  Each user may
-have a private authorization list in the file @file{.klogin} in their
+have a private authorization list in the file @file{.k5login} in their
 home directory.  Each line in this file should contain a Kerberos
-principal name of the form @samp{principal.instance@@realm}.  If the
+principal name of the form @samp{principal/instance@@realm}.  If the
 originating user is authenticated to one of the principals named in
-@file{.klogin}, access is granted to the account.  The principal
-@samp{accountname.@@localrealm} is granted access if there is no
-@file{.klogin} file.  Otherwise a login and password will be prompted
+@file{.k5login}, access is granted to the account.  The principal
+@samp{accountname@@localrealm} is granted access if there is no
+@file{.k5login} file.  Otherwise a login and password will be prompted
 for on the remote machine as in @command{login}.  To avoid certain
-security problems, the @file{.klogin} file must be owned by the remote
+security problems, the @file{.k5login} file must be owned by the remote
 user.  If Kerberos authentication fails, a warning message is printed
 and the standard Berkeley rlogin is used instead.
 
diff --git a/paths b/paths
index 6afb639..8a61652 100644
--- a/paths
+++ b/paths
@@ -20,7 +20,7 @@
 
 # This file describes how to set various paths used by programs in inetutils.
 #
-# The rules that determine what a given PATH_FOO define expands to are:
+# The rules determining what a given PATH_FOO expands to, are these:
 #  (1) If the user specifies --with-path-foo, that value is used.
 #  (2) If _PATH_FOO is defined in <paths.h>, that value is used.
 #  (3) The lines below are consulted.  They are whitespace-separated
@@ -30,22 +30,22 @@
 #		   it to VALUE.	 If VALUE begins with a make-variable of the
 #		   form `$(NAME)' and a corresponding shell-variable $NAME
 #		   exists at configure time, the value of $NAME is substituted
-#		   for the $(NAME) for testing (but not subsitution) purposes.
-#	test:T	-- Use `test -T' to test for file existance
+#		   for the $(NAME) for testing (but not substitution) purposes.
+#	test:T	-- Use `test -T' to test for file existance.
 #	x	-- The same as test:x
-#       d       -- The same as test:d
+#	d       -- The same as test:d
 #	c	-- The same as test:c
 #	b	-- The same as test:b
 #	<ach.h>:SYMBOL
-#		-- If SYMBOL is defined in <ack.h>, use SYM
+#		-- If SYMBOL is defined in <ack.h>, use SYMBOL.
 #       <ack.h> -- The same as <ack.h>:_PATH_FOO
 #       search:NAME:PATH
 #		-- Search for NAME in the colon-separated path PATH, and use
 #		   the first thing found; if the `:PATH' is omitted, it
-#		   uses the environment variable $PATH
-#	no	-- Set the default to `no' (even if there's already a default).
-#       FILE	-- The same as "FILE" (the quoted syntax only need be used if
-#		   the contents could match one of the special syntaxes)
+#		   uses the environment variable $PATH.
+#	no	-- Set the default to `no' (even if there already is a default).
+#	FILE	-- The same as "FILE" (the quoted syntax only need be used if
+#		   the contents could match one of the special syntaxes).
 #
 #      If cross-compiling then every file-existance test is made to fail
 #      (regardless of what exists on the compilation system), forcing
@@ -58,13 +58,13 @@
 #      the value `no', but that's probably not a severe problem).
 #
 #  (4) If the resulting value is the string `no', then PATH_FOO is never
-#      defined by any method (programs that use it should check that it's
-#      defined before using it).
+#      defined by any method. (Programs that use it should check that the
+#      symbol is defined before using it).
 #
 # Programs wanting to use a particular path PATH_FOO should:
-#  (1) Add the make variable $(PATHDEF_FOO) to CPPFLAGS while compiling (this
-#      expands either into either -D... for the path variable, or nothing).
-#  (2) Include any appropriate headers to match <header.h> entries below
+#  (1) Add the make variable $(PATHDEF_FOO) to CPPFLAGS while compiling. (This
+#      expands either into either -D... for the path variable, or nothing.)
+#  (2) Include any appropriate headers to match <header.h> entries below.
 #
 
 PATH_BSHELL	x $(bindir)/sh search:sh
diff --git a/src/rexecd.c b/src/rexecd.c
index ce61cc9..32a2228 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -266,7 +266,7 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
   signal (SIGTERM, SIG_DFL);
 #ifdef DEBUG
   {
-    int t = open (_PATH_TTY, O_RDWR);
+    int t = open (PATH_TTY, O_RDWR);
     if (t >= 0)
       {
 	ioctl (t, TIOCNOTTY, (char *) 0);
diff --git a/src/rlogind.c b/src/rlogind.c
index db77df2..2a5428e 100644
--- a/src/rlogind.c
+++ b/src/rlogind.c
@@ -1027,7 +1027,7 @@ setup_utmp (char *line, char *host)
 {
   char *ut_id = utmp_ptsid (line, "rl");
 
-  utmp_init (line + sizeof (PATH_DEV) - 1, ".rlogin", ut_id, host);
+  utmp_init (line + sizeof (PATH_TTY_PFX) - 1, ".rlogin", ut_id, host);
 }
 
 void
@@ -1915,7 +1915,7 @@ cleanup (int signo _GL_UNUSED_PARAMETER)
 {
   char *p;
 
-  p = line + sizeof (PATH_DEV) - 1;
+  p = line + sizeof (PATH_TTY_PFX) - 1;
 #if !defined HAVE_LOGOUT || !defined HAVE_LOGWTMP
   utmp_logout (p);
   chmod (line, 0644);
diff --git a/talkd/announce.c b/talkd/announce.c
index 7bf1818..3362969 100644
--- a/talkd/announce.c
+++ b/talkd/announce.c
@@ -132,14 +132,14 @@ announce (CTL_MSG * request, char *remote_machine)
   struct stat st;
   int rc;
 
-  len = sizeof (PATH_DEV) + strlen (request->r_tty) + 2;
+  len = sizeof (PATH_TTY_PFX) + strlen (request->r_tty) + 2;
   ttypath = malloc (len);
   if (!ttypath)
     {
       syslog (LOG_ERR, "Out of memory");
       exit (EXIT_FAILURE);
     }
-  sprintf (ttypath, "%s/%s", PATH_DEV, request->r_tty);
+  sprintf (ttypath, "%s/%s", PATH_TTY_PFX, request->r_tty);
   rc = stat (ttypath, &st);
   free (ttypath);
   if (rc < 0 || (st.st_mode & S_IWGRP) == 0)
diff --git a/talkd/process.c b/talkd/process.c
index 7107135..8b02779 100644
--- a/talkd/process.c
+++ b/talkd/process.c
@@ -177,14 +177,14 @@ find_user (char *name, char *tty)
   size_t utmp_count;
   int status;
   struct stat statb;
-  char ftty[sizeof (PATH_DEV) + sizeof (uptr->ut_line)];
+  char ftty[sizeof (PATH_TTY_PFX) + sizeof (uptr->ut_line)];
   time_t last_time = 0;
   int notty;
 
   notty = (*tty == '\0');
 
   status = NOT_HERE;
-  strcpy (ftty, PATH_DEV);
+  strcpy (ftty, PATH_TTY_PFX);
 
   read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
 	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
@@ -196,8 +196,9 @@ find_user (char *name, char *tty)
 	  if (notty)
 	    {
 	      /* no particular tty was requested */
-	      strncpy (ftty + sizeof (PATH_DEV) - 1,
-		       uptr->ut_line, sizeof (ftty) - sizeof (PATH_DEV) - 1);
+	      strncpy (ftty + sizeof (PATH_TTY_PFX) - 1,
+		       uptr->ut_line,
+		       sizeof (ftty) - sizeof (PATH_TTY_PFX) - 1);
 	      ftty[sizeof (ftty) - 1] = 0;
 
 	      if (stat (ftty, &statb) == 0)
diff --git a/telnetd/pty.c b/telnetd/pty.c
index 0926142..53a3049 100644
--- a/telnetd/pty.c
+++ b/telnetd/pty.c
@@ -32,7 +32,7 @@ void
 setup_utmp (char *line, char *host)
 {
   char *ut_id = utmp_ptsid (line, "tn");
-  utmp_init (line + sizeof (PATH_DEV) - 1, ".telnet", ut_id, host);
+  utmp_init (line + sizeof (PATH_TTY_PFX) - 1, ".telnet", ut_id, host);
 }
 
 
@@ -149,7 +149,7 @@ cleanup (int sig)
 	      (long) pid, WEXITSTATUS (status));
     }
 
-  p = line + sizeof (PATH_DEV) - 1;
+  p = line + sizeof (PATH_TTY_PFX) - 1;
   utmp_logout (p);
   chmod (line, 0644);
   chown (line, 0, 0);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   26 ++++++++++++++++++++------
 doc/inetutils.texi |   12 ++++++------
 paths              |   28 ++++++++++++++--------------
 src/rexecd.c       |    2 +-
 src/rlogind.c      |    4 ++--
 talkd/announce.c   |    4 ++--
 talkd/process.c    |    9 +++++----
 telnetd/pty.c      |    4 ++--
 8 files changed, 52 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Nov 14 17:02:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TYl2U-0004o1-13
	for mharc-commit-inetutils@gnu.org; Wed, 14 Nov 2012 17:02:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:35025)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TYl2P-0004jO-Nu
	for commit-inetutils@gnu.org; Wed, 14 Nov 2012 17:02:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TYl2M-0006Gv-M9
	for commit-inetutils@gnu.org; Wed, 14 Nov 2012 17:02:25 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49638)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TYl2M-0006Gc-IK
	for commit-inetutils@gnu.org; Wed, 14 Nov 2012 17:02:22 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TYl2L-00032y-K8
	for commit-inetutils@gnu.org; Wed, 14 Nov 2012 22:02:21 +0000
Date: Wed, 14 Nov 2012 22:02:21 +0000
Message-Id: <E1TYl2L-00032y-K8@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-204-g3299ba8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: cd22e53cf78c9fd317d2b25296ebf0235c3d4644
X-Git-Newrev: 3299ba83d9bac4ea2dae81cb6adcc5d04187f79f
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Nov 2012 22:02:28 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  3299ba83d9bac4ea2dae81cb6adcc5d04187f79f (commit)
      from  cd22e53cf78c9fd317d2b25296ebf0235c3d4644 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3299ba83d9bac4ea2dae81cb6adcc5d04187f79f


commit 3299ba83d9bac4ea2dae81cb6adcc5d04187f79f
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Nov 14 13:24:12 2012 +0100

    Mixed testing issues.

diff --git a/ChangeLog b/ChangeLog
index 798fea6..4b9bb6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2012-11-14  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* libinetutils/daemon.c (waitdaemon) [_SC_OPEN_MAX]:
+	Remove HAVE_SYSCONF from preprocessor conditional.
+
+	* src/syslogd.c (main): Install `die' for SIGINT, SIGQUIT,
+	and SIGUSR1 based on NoDetach.  Initially set `dpg_output = 1'
+	only in debug mode.  Print a notice also in non-detached mode.
+	(cfline): Move assignment to `f->f_file' outside of
+	if-statement.
+	(dbg_printf): Test `!(NoDetach && dbg_output)' for output.
+
+	* tests/waitdaemon.c: New source file.
+	* tests/Makefile.am (check_PROGRAMS): Add waitdaemon.
+	(TESTS): Likewise.
+	* tests/.gitignore: Likewise.
+
+	* tests/syslogd.sh: Add a sleep period after `kill -HUP'.
+	(OBSCURE): New environment variable.  Conduct configuration
+	test for non-existent log host only if OBSCURE is set.
+
+	* tests/utmp.sh: Use who(1), if possible, to improve
+	reliability of test, checking known users only.
+	* configure.ac <*-freebsd9* || *-freebsd10*>:
+	Do not disable syslogd and talkd, as the updated test script
+	`utmp.sh' will catch the failure as long as it remains.
+
+	* src/Makefile.am (AM_CPPFLAGS): Add $(PATHDEF_TTY_PFX).
+	* talkd/Makefile.am (AM_CPPFLAGS): Likewise.
+	* telnetd/Makefile.am (AM_CPPFLAGS): Likewise.
+
+	* whois/Makefile.am: Set `LANG=C' when invoking perl.
+
 2012-11-10  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	Consistent use of device prefix.
diff --git a/configure.ac b/configure.ac
index c37b828..4ce360f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -966,8 +966,6 @@ case "$host" in
   # readutmp module from GNUlib.
   enable_ftpd=no  ftpd_BUILD=''
   enable_rlogind=no  rlogind_BUILD=''
-  enable_syslogd=no  syslogd_BUILD=''
-  enable_talkd=no  talkd_BUILD=''
   enable_telnetd=no  telnetd_BUILD=''
   enable_uucpd=no  uucpd_BUILD=''
   ;;
diff --git a/libinetutils/daemon.c b/libinetutils/daemon.c
index 1265c68..9a20442 100644
--- a/libinetutils/daemon.c
+++ b/libinetutils/daemon.c
@@ -174,7 +174,7 @@ waitdaemon (int nochdir, int noclose, int maxwait)
       int i;
       long fdlimit = -1;
 
-#if defined HAVE_SYSCONF && defined _SC_OPEN_MAX
+#if defined _SC_OPEN_MAX
       fdlimit = sysconf (_SC_OPEN_MAX);
 #elif defined (HAVE_GETDTABLESIZE)
       fdlimit = getdtablesize ();
diff --git a/src/Makefile.am b/src/Makefile.am
index 05e3aa1..7242eb4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,7 +102,7 @@ EXTRA_PROGRAMS += uucpd
 
 INCLUDES = $(iu_INCLUDES) $(INCAUTH) -I$(top_srcdir)/libicmp $(INCIDN)
 
-AM_CPPFLAGS = $(PATHDEF_BSHELL) $(PATHDEF_CONSOLE) $(PATHDEF_CP) $(PATHDEF_DEFPATH) $(PATHDEF_DEV) $(PATHDEF_INETDCONF) $(PATHDEF_INETDDIR) $(PATHDEF_INETDPID) $(PATHDEF_KLOG) $(PATHDEF_LOG) $(PATHDEF_LOGCONF) $(PATHDEF_LOGIN) $(PATHDEF_LOGPID) $(PATHDEF_NOLOGIN) $(PATHDEF_RLOGIN) $(PATHDEF_RSH) $(PATHDEF_TTY) $(PATHDEF_UTMP) $(PATHDEF_UTMPX) $(PATHDEF_UUCICO)
+AM_CPPFLAGS = $(PATHDEF_BSHELL) $(PATHDEF_CONSOLE) $(PATHDEF_CP) $(PATHDEF_DEFPATH) $(PATHDEF_DEV) $(PATHDEF_INETDCONF) $(PATHDEF_INETDDIR) $(PATHDEF_INETDPID) $(PATHDEF_KLOG) $(PATHDEF_LOG) $(PATHDEF_LOGCONF) $(PATHDEF_LOGIN) $(PATHDEF_LOGPID) $(PATHDEF_NOLOGIN) $(PATHDEF_RLOGIN) $(PATHDEF_RSH) $(PATHDEF_TTY) $(PATHDEF_TTY_PFX) $(PATHDEF_UTMP) $(PATHDEF_UTMPX) $(PATHDEF_UUCICO)
 
 SUIDMODE = -o root -m 4775
 
diff --git a/src/syslogd.c b/src/syslogd.c
index 4008967..1c36250 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -506,7 +506,8 @@ main (int argc, char *argv[])
     }
   else
     {
-      dbg_output = 1;
+      if (Debug)
+	dbg_output = 1;
       setvbuf (stdout, 0, _IOLBF, 0);
     }
 
@@ -554,10 +555,10 @@ main (int argc, char *argv[])
   consfile.f_un.f_fname = strdup (ctty);
 
   signal (SIGTERM, die);
-  signal (SIGINT, Debug ? die : SIG_IGN);
-  signal (SIGQUIT, Debug ? die : SIG_IGN);
+  signal (SIGINT, NoDetach ? die : SIG_IGN);
+  signal (SIGQUIT, NoDetach ? die : SIG_IGN);
   signal (SIGALRM, domark);
-  signal (SIGUSR1, Debug ? dbg_toggle : SIG_IGN);
+  signal (SIGUSR1, NoDetach ? dbg_toggle : SIG_IGN);
   alarm (TIMERINTVL);
 
   /* We add  3 = 1(klog) + 2(inet,inet6), even if they may stay unused.  */
@@ -640,8 +641,9 @@ main (int argc, char *argv[])
 
   signal (SIGHUP, trigger_restart);
 
-  if (Debug)
+  if (NoDetach)
     {
+      dbg_output = 1;
       dbg_printf ("Debugging disabled, send SIGUSR1 to turn on debugging.\n");
       dbg_output = 0;
     }
@@ -2134,7 +2136,8 @@ cfline (const char *line, struct filed *f)
 
     case '|':
       f->f_un.f_fname = strdup (p);
-      if ((f->f_file = open (++p, O_RDWR | O_NONBLOCK)) < 0)
+      f->f_file = open (++p, O_RDWR | O_NONBLOCK);
+      if (f->f_file < 0)
 	{
 	  f->f_type = F_UNUSED;
 	  logerror (p);
@@ -2152,7 +2155,8 @@ cfline (const char *line, struct filed *f)
 
     case '/':
       f->f_un.f_fname = strdup (p);
-      if ((f->f_file = open (p, O_WRONLY | O_APPEND | O_CREAT, 0644)) < 0)
+      f->f_file = open (p, O_WRONLY | O_APPEND | O_CREAT, 0644);
+      if (f->f_file < 0)
 	{
 	  f->f_type = F_UNUSED;
 	  logerror (p);
@@ -2231,7 +2235,7 @@ dbg_printf (const char *fmt, ...)
 {
   va_list ap;
 
-  if (!(Debug && dbg_output))
+  if (!(NoDetach && dbg_output))
     return;
 
   va_start (ap, fmt);
diff --git a/talkd/Makefile.am b/talkd/Makefile.am
index 320f52c..f654a05 100644
--- a/talkd/Makefile.am
+++ b/talkd/Makefile.am
@@ -35,6 +35,6 @@ talkd_SOURCES = \
 
 @PATHDEFS_MAKE@
 
-AM_CPPFLAGS = $(PATHDEF_DEV) $(PATHDEF_UTMP) $(PATHDEF_UTMPX)
+AM_CPPFLAGS = $(PATHDEF_DEV) $(PATHDEF_TTY_PFX) $(PATHDEF_UTMP) $(PATHDEF_UTMPX)
 INCLUDES = $(iu_INCLUDES)
 LDADD = $(iu_LIBRARIES)
diff --git a/telnetd/Makefile.am b/telnetd/Makefile.am
index 1f8d961..e18943a 100644
--- a/telnetd/Makefile.am
+++ b/telnetd/Makefile.am
@@ -29,7 +29,7 @@ noinst_HEADERS = telnetd.h
 
 @PATHDEFS_MAKE@
 
-AM_CPPFLAGS = $(PATHDEF_DEV) $(PATHDEF_TTY) $(PATHDEF_LOGIN)
+AM_CPPFLAGS = $(PATHDEF_DEV) $(PATHDEF_TTY) $(PATHDEF_TTY_PFX) $(PATHDEF_LOGIN)
 INCLUDES = $(iu_INCLUDES) -I$(top_srcdir) $(INCAUTH) $(NCURSES_INCLUDE)
 
 LDADD = $(iu_LIBRARIES) $(top_builddir)/libtelnet/libtelnet.a $(LIBTERMCAP) $(LIBUTIL) $(LIBCRYPT) $(LIBAUTH)
diff --git a/tests/.gitignore b/tests/.gitignore
index fbf984c..1901dcd 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,5 @@
+addrpeek
 localhost
 readutmp
-addrpeek
 tools.sh
+waitdaemon
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b827bf5..d7d72a1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,7 @@ AM_CPPFLAGS = $(iu_INCLUDES)
 
 LDADD = $(iu_LIBRARIES)
 
-check_PROGRAMS = localhost readutmp
+check_PROGRAMS = localhost readutmp waitdaemon
 if ENABLE_inetd
 check_PROGRAMS += addrpeek
 endif
@@ -68,7 +68,7 @@ if ENABLE_dnsdomainname
 dist_check_SCRIPTS += dnsdomainname.sh
 endif
 
-TESTS = localhost $(dist_check_SCRIPTS)
+TESTS = localhost waitdaemon $(dist_check_SCRIPTS)
 
 TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT)
 
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index c91a485..a1092f2 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -43,6 +43,9 @@ IU_TESTDIR	If set, use this as testing dir.  Unless
 		NOCLEAN is also set, any created \$IU_TESTDIR
 		will be erased after the test.  A non-existing
 		directory must be named as a template for mktemp(1).
+OBSCURE		If set, make additional tests that are prone to
+		false negatives in some setups lacking full
+		connectivity.
 REMOTE_LOGHOST	Add this host as a receiving loghost.
 TARGET		Receiving IPv4 address.
 TARGET6		Receiving IPv6 address.
@@ -307,8 +310,6 @@ fi
 #
 cat > "$CONF" <<-EOT
 	*.*	$OUT
-	# Test incorrect forwarding.
-	*.*	@not.in.existence
 	# Recover from missing action field and short selector.
 	12345
 	*.*
@@ -318,6 +319,18 @@ EOT
 # Add a user recipient in verbose mode.
 $silence false || echo "*.*	$USER" >> "$CONF"
 
+# Testing a remote log host known not to exist,
+# will introduce sizable timeout.  We avoid it
+# unless told to include this test, based on
+# OBSCURE in our environment.
+if [ -n "$OBSCURE" ]; then
+    # Append an invalid recipient.
+    cat >> "$CONF" <<-EOT
+	# Test incorrect forwarding.
+	*.*	@not.in.existence
+	EOT
+fi
+
 # Set REMOTE_LOGHOST to activate forwarding
 #
 if [ -n "$REMOTE_LOGHOST" ]; then
@@ -435,6 +448,7 @@ TAG2="syslogd-reload-test"
 
 # Load the new configuration
 kill -HUP `cat "$PID"`
+sleep 1
 
 if $do_unix_socket; then
     # Two messages, but absence is also awarded credit.
diff --git a/tests/utmp.sh b/tests/utmp.sh
index f19e467..556985c 100755
--- a/tests/utmp.sh
+++ b/tests/utmp.sh
@@ -34,25 +34,35 @@ if test -n "$VERBOSE"; then
     set -x
 fi
 
-# Execute READUTMP once without argument, and once with
-# ourself as argument.  Both should succeed, but if either
-# fails report only a skipped test, giving some complimentary
-# explanations.
-
 errno=0
 
-$READUTMP || errno=77
-
-$READUTMP `func_id_user` || errno=77
+if who >/dev/null 2>&1; then
+    # Check that readutmp agrees with who(1),
+    # limiting ourselves to at most three users.
+    for nn in `who | sed 's/ .*//; 3q;'`; do
+	$READUTMP $nn || errno=1
+    done
+else
+    # Execute READUTMP once without argument, and once with
+    # ourself as argument.  Both should succeed, but are reported
+    # as skipped test in case of failure.  They are known to be
+    # produce false positives in some circumstances.
+    $READUTMP || errno=77
+    $READUTMP `func_id_user` || errno=77
+fi
 
-if test $errno -ne 0; then
+if test $errno -eq 77; then
     cat >&2 <<-EOT
 	NOTICE: read_utmp() from Gnulib just failed.  This can be
 	due to running this test in sudo mode, or using a role.
 	Should this script fail while running it as a logged in
 	user, then read_utmp() is indeed broken on this system.
-	Then the present syslog and talkd are not fully functional.
-	You are then welcome to report this failure.
+	Then the present executables syslogd and talkd are not
+	fully functional.
+	EOT
+elif test $errno -eq 1; then
+    cat >&2 <<-EOT
+	User messaging is broken in syslogd and talkd.
 	EOT
 fi
 
diff --git a/tests/waitdaemon.c b/tests/waitdaemon.c
new file mode 100644
index 0000000..1d66ee0
--- /dev/null
+++ b/tests/waitdaemon.c
@@ -0,0 +1,65 @@
+/* waitdaemon -- Verify that waitdaemon() is functional.
+  Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils 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 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils 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, see `http://www.gnu.org/licenses/'. */
+
+/* Verify that waitdaemon() in libinetutils.a is functional.
+   This is needed by syslogd.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <signal.h>
+#include <errno.h>
+
+#include <error.h>
+#include <progname.h>
+#include <libinetutils.h>
+#include <unused-parameter.h>
+
+extern int waitdaemon (int nochdir, int noclose, int maxwait);
+
+void
+doexit (int signo _GL_UNUSED_PARAMETER)
+{
+  _exit (EXIT_SUCCESS);
+}
+
+int
+main (int argc _GL_UNUSED_PARAMETER, char *argv[])
+{
+  pid_t ppid;
+
+  set_program_name (argv[0]);
+
+  signal (SIGTERM, doexit);	/* Parent exits nicely at SIGTERM.  */
+
+  ppid = waitdaemon (0, 0, 5);	/* Five seconds of delay.  */
+
+  /* Child should return here before parent.  */
+  if (ppid > 0)
+    kill (ppid, SIGTERM);	/* Bless the parent process.  */
+
+  /* Only grand child reaches this statement.  */
+  return EXIT_FAILURE;
+}
diff --git a/whois/Makefile.am b/whois/Makefile.am
index f1363c0..5d59cf7 100644
--- a/whois/Makefile.am
+++ b/whois/Makefile.am
@@ -34,10 +34,10 @@ INCLUDES = $(iu_INCLUDES)
 LDADD = $(iu_LIBRARIES)
 
 as_del.h: $(srcdir)/as_del_list $(srcdir)/make_as_del.pl
-	perl $(srcdir)/make_as_del.pl < $(srcdir)/as_del_list > as_del.h
+	LANG=C perl $(srcdir)/make_as_del.pl < $(srcdir)/as_del_list > as_del.h
 
 ip_del.h: $(srcdir)/ip_del_list $(srcdir)/make_ip_del.pl
-	perl $(srcdir)/make_ip_del.pl < $(srcdir)/ip_del_list > ip_del.h
+	LANG=C perl $(srcdir)/make_ip_del.pl < $(srcdir)/ip_del_list > ip_del.h
 
 tld_serv.h: $(srcdir)/tld_serv_list $(srcdir)/make_tld_serv.pl
-	perl $(srcdir)/make_tld_serv.pl < $(srcdir)/tld_serv_list > tld_serv.h
+	LANG=C perl $(srcdir)/make_tld_serv.pl < $(srcdir)/tld_serv_list > tld_serv.h

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   33 +++++++++++++++++++++++++
 configure.ac          |    2 -
 libinetutils/daemon.c |    2 +-
 src/Makefile.am       |    2 +-
 src/syslogd.c         |   20 +++++++++------
 talkd/Makefile.am     |    2 +-
 telnetd/Makefile.am   |    2 +-
 tests/.gitignore      |    3 +-
 tests/Makefile.am     |    4 +-
 tests/syslogd.sh      |   18 ++++++++++++-
 tests/utmp.sh         |   32 ++++++++++++++++--------
 tests/waitdaemon.c    |   65 +++++++++++++++++++++++++++++++++++++++++++++++++
 whois/Makefile.am     |    6 ++--
 13 files changed, 158 insertions(+), 33 deletions(-)
 create mode 100644 tests/waitdaemon.c


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Nov 15 15:37:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZ6BR-0001Kz-9p
	for mharc-commit-inetutils@gnu.org; Thu, 15 Nov 2012 15:37:09 -0500
Received: from eggs.gnu.org ([208.118.235.92]:36575)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZ6BM-0001KU-6d
	for commit-inetutils@gnu.org; Thu, 15 Nov 2012 15:37:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZ6BJ-00081N-4W
	for commit-inetutils@gnu.org; Thu, 15 Nov 2012 15:37:04 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40808)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZ6BJ-00081D-0y
	for commit-inetutils@gnu.org; Thu, 15 Nov 2012 15:37:01 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZ6BI-0002Ve-CY
	for commit-inetutils@gnu.org; Thu, 15 Nov 2012 20:37:00 +0000
Date: Thu, 15 Nov 2012 20:37:00 +0000
Message-Id: <E1TZ6BI-0002Ve-CY@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-205-ga6766e1
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3299ba83d9bac4ea2dae81cb6adcc5d04187f79f
X-Git-Newrev: a6766e1a0e7b4fb9403f64b548b8c32701692673
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 15 Nov 2012 20:37:07 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  a6766e1a0e7b4fb9403f64b548b8c32701692673 (commit)
      from  3299ba83d9bac4ea2dae81cb6adcc5d04187f79f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=a6766e1a0e7b4fb9403f64b548b8c32701692673


commit a6766e1a0e7b4fb9403f64b548b8c32701692673
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Nov 15 21:02:45 2012 +0100

    Disable targets robustly.
    
    The source builds with clang on FreeBSD.

diff --git a/ChangeLog b/ChangeLog
index 4b9bb6f..8f242a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-11-15  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	Disable targets robustly.
+
+	* am/enable.m4 (IU_DISABLE_TARGET): New macro.
+	* configure.ac <ftpd, rlogind, rshd, talk, talkd, telnetd>
+	<uucpd>: Use IU_DISABLE_TARGET to disable unbuildable targets,
+	avoiding the incomplete manipulations used so far.
+
 2012-11-14  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* libinetutils/daemon.c (waitdaemon) [_SC_OPEN_MAX]:
diff --git a/am/enable.m4 b/am/enable.m4
index 217699d..7076fbf 100644
--- a/am/enable.m4
+++ b/am/enable.m4
@@ -37,3 +37,8 @@ fi;]
 
 AC_DEFUN([IU_ENABLE_CLIENT], [IU_ENABLE_FOO($1, clients)])
 AC_DEFUN([IU_ENABLE_SERVER], [IU_ENABLE_FOO($1, servers)])
+
+AC_DEFUN([IU_DISABLE_TARGET],
+  [enable_$1=no $1_BUILD='' $1_INSTALL_HOOK=''
+  AM_CONDITIONAL([ENABLE_$1], test "$enable_$1" != no)
+])
diff --git a/configure.ac b/configure.ac
index 4ce360f..296db8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,10 +232,8 @@ AC_CHECK_HEADER(protocols/talkd.h, , ,
 
 if test "$ac_cv_header_protocols_talkd_h" = no; then
   AC_MSG_WARN([protocols/talkd.h is not available, not building talk, nor talkd])
-  enable_talk=no
-  talk_BUILD=''
-  enable_talkd=no
-  talkd_BUILD=''
+  IU_DISABLE_TARGET(talk)
+  IU_DISABLE_TARGET(talkd)
 fi
 
 # Only talk uses curses, so only check for it if we want that
@@ -248,8 +246,7 @@ else
   if test "$enable_talk" = yes; then
     AC_MSG_WARN([curses is not available, so not building talk])
   fi
-  enable_talk=no
-  talk_BUILD=''
+  IU_DISABLE_TARGET(talk)
 fi
 
 # NetBSD offers orcmd() and orcmd_af() for getting
@@ -302,10 +299,8 @@ else
     fi
   else
     AC_MSG_WARN([Disabling rlogind and rshd, since no iruserok and no ruserok.])
-    enable_rlogind=no
-    rlogind_BUILD=''
-    enable_rshd=no
-    rshd_BUILD=''
+    IU_DISABLE_TARGET(rlogind)
+    IU_DISABLE_TARGET(rshd)
   fi
 fi
 
@@ -964,10 +959,10 @@ case "$host" in
   # FreeBSD 9.0 has implemented a non-standard and singular
   # UTMPX interface.  We do not support it, nor does the
   # readutmp module from GNUlib.
-  enable_ftpd=no  ftpd_BUILD=''
-  enable_rlogind=no  rlogind_BUILD=''
-  enable_telnetd=no  telnetd_BUILD=''
-  enable_uucpd=no  uucpd_BUILD=''
+  IU_DISABLE_TARGET(ftpd)
+  IU_DISABLE_TARGET(rlogind)
+  IU_DISABLE_TARGET(telnetd)
+  IU_DISABLE_TARGET(uucpd)
   ;;
 *olaris*)
   AC_DEFINE([SOLARIS], 1, [FIXME])

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog    |    9 +++++++++
 am/enable.m4 |    5 +++++
 configure.ac |   23 +++++++++--------------
 3 files changed, 23 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 16 07:44:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZLHM-00053g-M7
	for mharc-commit-inetutils@gnu.org; Fri, 16 Nov 2012 07:44:16 -0500
Received: from eggs.gnu.org ([208.118.235.92]:43523)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZLHJ-00052i-3F
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 07:44:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZLHG-0000VK-06
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 07:44:12 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:39331)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZLHF-0000VG-SP
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 07:44:09 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZLHF-0002ym-MR
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 12:44:09 +0000
Date: Fri, 16 Nov 2012 12:44:09 +0000
Message-Id: <E1TZLHF-0002ym-MR@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-206-gb7a8038
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a6766e1a0e7b4fb9403f64b548b8c32701692673
X-Git-Newrev: b7a8038f64cd995f8a2afc563b80d320dc0b2866
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 16 Nov 2012 12:44:16 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  b7a8038f64cd995f8a2afc563b80d320dc0b2866 (commit)
      from  a6766e1a0e7b4fb9403f64b548b8c32701692673 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=b7a8038f64cd995f8a2afc563b80d320dc0b2866


commit b7a8038f64cd995f8a2afc563b80d320dc0b2866
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 16 12:30:02 2012 +0100

    syslogd, talkd: Alternative utmp access.
    
    These servers are now functional with FreeBSD 9.

diff --git a/ChangeLog b/ChangeLog
index 8f242a9..6cf857f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-11-16  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	syslogd, talkd: Alternative utmp access.
+
+	* configure.ac: Check for getutxuser.
+	* src/syslogd.c (wallmsg) [!UTMP_NAME_FUNCTION]:
+	Remove UTMPBUF and COUNT.  Call setutxent(),
+	getutxent(), and endutxent().
+	* talkd/process.c (find_user) [HAVE_GETUTXUSER]:
+	Remove UTMPBUF and UTMP_COUNT.  Call setutxent(),
+	getutxuser(), and endutxent().
+	* tests/readutmp.c (main) [HAVE_GETUTXUSER]: Remove
+	UTMPP, UPTR, and COUNT.  Call setutxent(), getutxuser(),
+	and endutxent().
+	[!HAVE_GETUTXUSER]: Free UTMPP.
+
 2012-11-15  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	Disable targets robustly.
diff --git a/configure.ac b/configure.ac
index 296db8b..477726f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -737,7 +737,7 @@ AC_FUNC_MMAP
 
 AC_CHECK_FUNCS(cfsetspeed cgetent dirfd fchdir flock \
                fork fpathconf ftruncate \
-               getcwd getmsg getpwuid_r getspnam \
+               getcwd getmsg getpwuid_r getspnam getutxuser \
                initgroups initsetproctitle killpg \
                ptsname pututline pututxline \
                setegid seteuid setpgid \
@@ -957,8 +957,9 @@ AH_BOTTOM(
 case "$host" in
 *-freebsd9* | *-freebsd10*)
   # FreeBSD 9.0 has implemented a non-standard and singular
-  # UTMPX interface.  We do not support it, nor does the
-  # readutmp module from GNUlib.
+  # UTMPX interface.  The readutmp module from GNUlib does
+  # not support it, but we can fall back to getutxuser() for
+  # use in syslogd and talkd.
   IU_DISABLE_TARGET(ftpd)
   IU_DISABLE_TARGET(rlogind)
   IU_DISABLE_TARGET(telnetd)
diff --git a/src/syslogd.c b/src/syslogd.c
index 1c36250..f8e1f6d 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1511,14 +1511,17 @@ fprintlog (struct filed *f, const char *from, int flags, const char *msg)
     f->f_prevcount = 0;
 }
 
-/* Write the specified message to either the entire world, or a list
-   of approved users.  */
+/* Write the specified message to either the entire world,
+ * or to a list of approved users.  */
 void
 wallmsg (struct filed *f, struct iovec *iov)
 {
-  static int reenter;		/* avoid calling ourselves */
-  STRUCT_UTMP *utmpbuf, *utp;
+  static int reenter;		/* Avoid calling ourselves.  */
+  STRUCT_UTMP *utp;
+#ifdef UTMP_NAME_FUNCTION	/* From module readutmp.  */
+  STRUCT_UTMP *utmpbuf;
   size_t utmp_count;
+#endif /* UTMP_NAME_FUNCTION */
   int i;
   char *p;
   char line[sizeof (utp->ut_line) + 1];
@@ -1526,10 +1529,16 @@ wallmsg (struct filed *f, struct iovec *iov)
   if (reenter++)
     return;
 
+#ifndef UTMP_NAME_FUNCTION
+  setutxent ();
+
+  while ((utp = getutxent ()))
+#else /* UTMP_NAME_FUNCTION */
   read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
 	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
 
   for (utp = utmpbuf; utp < utmpbuf + utmp_count; utp++)
+#endif /* UTMP_NAME_FUNCTION */
     {
       strncpy (line, utp->ut_line, sizeof (utp->ut_line));
       line[sizeof (utp->ut_line)] = '\0';
@@ -1560,7 +1569,11 @@ wallmsg (struct filed *f, struct iovec *iov)
 	    break;
 	  }
     }
+#ifdef UTMP_NAME_FUNCTION
   free (utmpbuf);
+#else /* !UTMP_NAME_FUNCTION */
+  endutxent ();
+#endif
   reenter = 0;
 }
 
diff --git a/talkd/process.c b/talkd/process.c
index 8b02779..b2974b0 100644
--- a/talkd/process.c
+++ b/talkd/process.c
@@ -169,12 +169,15 @@ do_announce (CTL_MSG * mp, CTL_RESPONSE * rp)
     }
 }
 
-/* Search utmp for the local user */
+/* Search utmp for the local user.  */
 int
 find_user (char *name, char *tty)
 {
-  STRUCT_UTMP *utmpbuf, *uptr;
+  STRUCT_UTMP *uptr;
+#ifndef HAVE_GETUTXUSER
+  STRUCT_UTMP *utmpbuf;
   size_t utmp_count;
+#endif /* HAVE_GETUTXUSER */
   int status;
   struct stat statb;
   char ftty[sizeof (PATH_TTY_PFX) + sizeof (uptr->ut_line)];
@@ -186,12 +189,18 @@ find_user (char *name, char *tty)
   status = NOT_HERE;
   strcpy (ftty, PATH_TTY_PFX);
 
+#ifdef HAVE_GETUTXUSER
+  setutxent ();
+
+  while ((uptr = getutxuser (name)))
+#else /* !HAVE_GETUTXUSER */
   read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
 	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
 
   for (uptr = utmpbuf; uptr < utmpbuf + utmp_count; uptr++)
     {
       if (!strncmp (UT_USER (uptr), name, sizeof (UT_USER (uptr))))
+#endif /* !HAVE_GETUTXUSER */
 	{
 	  if (notty)
 	    {
@@ -224,8 +233,12 @@ find_user (char *name, char *tty)
 	      break;
 	    }
 	}
+#ifndef HAVE_GETUTXUSER
     }
-
   free (utmpbuf);
+#else /* HAVE_GETUTXUSER */
+  endutxent ();
+#endif
+
   return status;
 }
diff --git a/tests/readutmp.c b/tests/readutmp.c
index 07d29ad..59b788d 100644
--- a/tests/readutmp.c
+++ b/tests/readutmp.c
@@ -47,10 +47,12 @@
 int
 main (int argc, char *argv[])
 {
+#ifndef HAVE_GETUTXUSER
   STRUCT_UTMP *utmpp, *uptr;
+  size_t count;
+#endif
   struct passwd *pw;
   char *name;
-  size_t count;
   int found = 0;
 
   set_program_name (argv[0]);
@@ -69,9 +71,14 @@ main (int argc, char *argv[])
       return EXIT_FAILURE;
     }
 
+#ifdef HAVE_GETUTXUSER
+  setutxent ();
+  found = (getutxuser (name) != 0);
+  endutxent ();
+#else /* !HAVE_GETUTXUSER */
   if (read_utmp (UTMP_FILE, &count, &utmpp, READ_UTMP_USER_PROCESS))
     {
-      perror ("read_utmp:");
+      perror ("read_utmp");
       return EXIT_FAILURE;
     }
 
@@ -82,6 +89,9 @@ main (int argc, char *argv[])
 	break;
       }
 
+  free (utmpp);
+#endif /* HAVE_GETUTXUSER */
+
   if (found)
     return EXIT_SUCCESS;
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |   16 ++++++++++++++++
 configure.ac     |    7 ++++---
 src/syslogd.c    |   21 +++++++++++++++++----
 talkd/process.c  |   19 ++++++++++++++++---
 tests/readutmp.c |   14 ++++++++++++--
 5 files changed, 65 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 16 11:43:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZP0a-0004Or-S3
	for mharc-commit-inetutils@gnu.org; Fri, 16 Nov 2012 11:43:12 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40232)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZP0W-0004OQ-3h
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 11:43:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZP0T-0007Xh-1K
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 11:43:08 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:52932)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZP0S-0007Xc-UL
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 11:43:04 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZP0R-0006IX-T8
	for commit-inetutils@gnu.org; Fri, 16 Nov 2012 16:43:04 +0000
Date: Fri, 16 Nov 2012 16:43:03 +0000
Message-Id: <E1TZP0R-0006IX-T8@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-207-g4ebf95e
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: b7a8038f64cd995f8a2afc563b80d320dc0b2866
X-Git-Newrev: 4ebf95e90700da5cc244e7c8a18d66468c858cc6
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 16 Nov 2012 16:43:11 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  4ebf95e90700da5cc244e7c8a18d66468c858cc6 (commit)
      from  b7a8038f64cd995f8a2afc563b80d320dc0b2866 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=4ebf95e90700da5cc244e7c8a18d66468c858cc6


commit 4ebf95e90700da5cc244e7c8a18d66468c858cc6
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 16 17:10:09 2012 +0100

    syslogd: Adapt to legacy utmp.
    
    The legacy implementation of the utmp structure
    is still in use within FreeBSD 8 and OpenBSD.

diff --git a/ChangeLog b/ChangeLog
index 6cf857f..5f8b23c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2012-11-16  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	syslogd: Adapt to legacy utmp.
+
+	* configure.ac: Check for getutxent.
+	* srs/syslogd.c (wallmsg)
+	[UTMP_NAME_FUNCTION || !HAVE_GETUTXENT]: Refine
+	preprocessor conditional to let read_utmp() handle
+	systems with legacy implementation of utmp.  Adding
+	a test of !HAVE_GETUTXENT achieves this.
+
+2012-11-16  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	syslogd, talkd: Alternative utmp access.
 
 	* configure.ac: Check for getutxuser.
diff --git a/configure.ac b/configure.ac
index 477726f..9ecc492 100644
--- a/configure.ac
+++ b/configure.ac
@@ -737,7 +737,7 @@ AC_FUNC_MMAP
 
 AC_CHECK_FUNCS(cfsetspeed cgetent dirfd fchdir flock \
                fork fpathconf ftruncate \
-               getcwd getmsg getpwuid_r getspnam getutxuser \
+               getcwd getmsg getpwuid_r getspnam getutxent getutxuser \
                initgroups initsetproctitle killpg \
                ptsname pututline pututxline \
                setegid seteuid setpgid \
diff --git a/src/syslogd.c b/src/syslogd.c
index f8e1f6d..4fa459a 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -122,7 +122,7 @@
 #include <error.h>
 #include <progname.h>
 #include <libinetutils.h>
-#include <readutmp.h>
+#include <readutmp.h>		/* May define UTMP_NAME_FUNCTION.  */
 #include "unused-parameter.h"
 #include "xalloc.h"
 
@@ -1518,10 +1518,10 @@ wallmsg (struct filed *f, struct iovec *iov)
 {
   static int reenter;		/* Avoid calling ourselves.  */
   STRUCT_UTMP *utp;
-#ifdef UTMP_NAME_FUNCTION	/* From module readutmp.  */
+#if defined UTMP_NAME_FUNCTION || !defined HAVE_GETUTXENT
   STRUCT_UTMP *utmpbuf;
   size_t utmp_count;
-#endif /* UTMP_NAME_FUNCTION */
+#endif /* UTMP_NAME_FUNCTION || !HAVE_GETUTXENT */
   int i;
   char *p;
   char line[sizeof (utp->ut_line) + 1];
@@ -1529,16 +1529,16 @@ wallmsg (struct filed *f, struct iovec *iov)
   if (reenter++)
     return;
 
-#ifndef UTMP_NAME_FUNCTION
+#if !defined UTMP_NAME_FUNCTION && defined HAVE_GETUTXENT
   setutxent ();
 
   while ((utp = getutxent ()))
-#else /* UTMP_NAME_FUNCTION */
+#else /* UTMP_NAME_FUNCTION || !HAVE_GETUTXENT */
   read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
 	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
 
   for (utp = utmpbuf; utp < utmpbuf + utmp_count; utp++)
-#endif /* UTMP_NAME_FUNCTION */
+#endif /* UTMP_NAME_FUNCTION || !HAVE_GETUTXENT */
     {
       strncpy (line, utp->ut_line, sizeof (utp->ut_line));
       line[sizeof (utp->ut_line)] = '\0';
@@ -1569,9 +1569,9 @@ wallmsg (struct filed *f, struct iovec *iov)
 	    break;
 	  }
     }
-#ifdef UTMP_NAME_FUNCTION
+#if defined UTMP_NAME_FUNCTION || !defined HAVE_GETUTXENT
   free (utmpbuf);
-#else /* !UTMP_NAME_FUNCTION */
+#else /* !UTMP_NAME_FUNCTION && HAVE_GETUTXENT */
   endutxent ();
 #endif
   reenter = 0;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |   11 +++++++++++
 configure.ac  |    2 +-
 src/syslogd.c |   16 ++++++++--------
 3 files changed, 20 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Nov 17 11:12:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZl0F-0001MW-11
	for mharc-commit-inetutils@gnu.org; Sat, 17 Nov 2012 11:12:19 -0500
Received: from eggs.gnu.org ([208.118.235.92]:39527)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZl0A-0001Lr-7N
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 11:12:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZl07-0007NP-47
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 11:12:14 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40959)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZl07-0007NL-0T
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 11:12:11 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZl06-0005Wv-An
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 16:12:10 +0000
Date: Sat, 17 Nov 2012 16:12:10 +0000
Message-Id: <E1TZl06-0005Wv-An@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-208-g01217fa
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4ebf95e90700da5cc244e7c8a18d66468c858cc6
X-Git-Newrev: 01217fa19cb46a9013b89e93432f9dfbe48ddbad
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 17 Nov 2012 16:12:17 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  01217fa19cb46a9013b89e93432f9dfbe48ddbad (commit)
      from  4ebf95e90700da5cc244e7c8a18d66468c858cc6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=01217fa19cb46a9013b89e93432f9dfbe48ddbad


commit 01217fa19cb46a9013b89e93432f9dfbe48ddbad
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Nov 17 16:52:05 2012 +0100

    ifconfig: Stub for BSD systems.
    
    Quickly adapt the generic template to BSD systems.

diff --git a/ChangeLog b/ChangeLog
index 5f8b23c..9eb52af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Implement stub for BSD systems.
+
+	* ifconfig/options.c (formats) <unix format>:
+	Add metric to printout.
+	* ifconfig/system.c [__DragonFly__ || __FreeBSD__ ||
+	__NetBSD__ || __OpenBSD__]: Include "system/bsd.c".
+	* ifconfig/system.h [__DragonFly__ || __FreeBSD__ ||
+	__NetBSD__ || __OpenBSD__]: Include "system/bsd.h".
+	* ifconfig/system/bsd.c, ifconfig/system/bsd.h:
+	New source files.
+
 2012-11-16  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	syslogd: Adapt to legacy utmp.
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 7720c8d..f4a07cb 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -140,6 +140,7 @@ struct format formats[] = {
    "${format}{check-existence}"
    "${ifdisplay?}{"
    "${name}: flags=${flags}{number}{%hx}<${flags}{string}{,}>"
+   "${metric?}{ metric ${metric}}"
    "${mtu?}{ mtu ${mtu}}${\\n}"
    "${addr?}{${\\t}inet ${addr}"
    " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
diff --git a/ifconfig/system.c b/ifconfig/system.c
index 525f16e..d8d1bf4 100644
--- a/ifconfig/system.c
+++ b/ifconfig/system.c
@@ -21,10 +21,13 @@
 
 #if defined __linux__
 # include "system/linux.c"
-#elif defined(__sun__)
+#elif defined __sun__
 # include "system/solaris.c"
-#elif defined(__QNX__)
+#elif defined __QNX__
 # include "system/qnx.c"
+# elif defined __DragonFly__ || defined __FreeBSD__ || \
+       defined __NetBSD__ || defined __OpenBSD__
+#  include "system/bsd.c"
 #else
 # include "system/generic.c"
 #endif
diff --git a/ifconfig/system.h b/ifconfig/system.h
index f5ac40f..0108aff 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -91,10 +91,13 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
 
 # if defined __linux__
 #  include "system/linux.h"
-# elif defined(__sun__)
+# elif defined __sun__
 #  include "system/solaris.h"
-# elif defined(__QNX__)
+# elif defined __QNX__
 #  include "system/qnx.h"
+# elif defined __DragonFly__ || defined __FreeBSD__ || \
+       defined __NetBSD__ || defined __OpenBSD__
+#  include "system/bsd.h"
 # else
 #  include "system/generic.h"
 # endif
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
new file mode 100644
index 0000000..7a50731
--- /dev/null
+++ b/ifconfig/system/bsd.c
@@ -0,0 +1,75 @@
+/* generic.c -- generic system code for ifconfig
+  Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010, 2011, 2012 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils 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 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils 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, see `http://www.gnu.org/licenses/'. */
+
+#include <config.h>
+
+#include <unistd.h>
+#include "../ifconfig.h"
+
+
+/* Output format stuff.  */
+
+const char *system_default_format = "unix";
+
+
+/* Argument parsing stuff.  */
+
+const char *system_help = "\
+NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] [metric N] [mtu N]";
+
+struct argp_child system_argp_child;
+
+int
+system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+{
+  return 0;
+}
+
+int
+system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+{
+  return 0;
+}
+
+int
+system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
+{
+  return 0;
+}
+
+
+/* System hooks. */
+
+struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
+
+void
+system_fh_metric (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFMETRIC
+  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFMETRIC failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    put_int (form, argc, argv, form->ifr->ifr_metric);
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
diff --git a/ifconfig/system/generic.h b/ifconfig/system/bsd.h
similarity index 75%
copy from ifconfig/system/generic.h
copy to ifconfig/system/bsd.h
index ac546e5..e6aeec2 100644
--- a/ifconfig/system/generic.h
+++ b/ifconfig/system/bsd.h
@@ -17,10 +17,11 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see `http://www.gnu.org/licenses/'. */
 
-/* Written by Marcus Brinkmann.  */
-
-#ifndef IFCONFIG_SYSTEM_GENERIC_H
-# define IFCONFIG_SYSTEM_GENERIC_H
+#ifndef IFCONFIG_SYSTEM_BSD_H
+# define IFCONFIG_SYSTEM_BSD_H
+# include "../printif.h"
+# include "../options.h"
+# include <sys/sockio.h>
 
 
 /* Option support.  */
@@ -40,14 +41,21 @@ struct system_ifconfig
    format_handler entries.  They are inserted at the beginning of the
    default list, so they override generic implementations if they have
    the same name.  For example:
-   #define SYSTEN_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
+   #define SYSTEM_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
    { "newline", system_fh_newline },
    Define some architecture symbol like "foobar", so it can be tested
    for in generic format strings with ${exists?}{foobar?}.  */
-# undef SYSTEM_FORMAT_HANDLER
+# define SYSTEM_FORMAT_HANDLER	\
+  {"bsd", fh_nothing},		\
+  {"dragonflybsd", fh_nothing},	\
+  {"freebsd", fh_nothing},	\
+  {"netbsd", fh_nothing},	\
+  {"openbsd", fh_nothing},	\
+  {"metric", system_fh_metric},
 
 /* Prototype system_fh_* functions here.
    void system_fh_newline (format_data_t, int, char **);
 */
+void system_fh_metric (format_data_t form, int argc, char *argv[]);
 
 #endif
diff --git a/ifconfig/system/generic.h b/ifconfig/system/generic.h
index ac546e5..986226f 100644
--- a/ifconfig/system/generic.h
+++ b/ifconfig/system/generic.h
@@ -40,7 +40,7 @@ struct system_ifconfig
    format_handler entries.  They are inserted at the beginning of the
    default list, so they override generic implementations if they have
    the same name.  For example:
-   #define SYSTEN_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
+   #define SYSTEM_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
    { "newline", system_fh_newline },
    Define some architecture symbol like "foobar", so it can be tested
    for in generic format strings with ${exists?}{foobar?}.  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                            |   13 +++++++++++++
 ifconfig/options.c                   |    1 +
 ifconfig/system.c                    |    7 +++++--
 ifconfig/system.h                    |    7 +++++--
 ifconfig/system/{qnx.c => bsd.c}     |   34 +++++++++++++++++++---------------
 ifconfig/system/{generic.h => bsd.h} |   20 ++++++++++++++------
 ifconfig/system/generic.h            |    2 +-
 7 files changed, 58 insertions(+), 26 deletions(-)
 copy ifconfig/system/{qnx.c => bsd.c} (72%)
 copy ifconfig/system/{generic.h => bsd.h} (75%)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Nov 17 12:42:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZmPw-0006AM-Df
	for mharc-commit-inetutils@gnu.org; Sat, 17 Nov 2012 12:42:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34080)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmPs-00069o-33
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 12:42:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmPp-0006MJ-0r
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 12:42:52 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:41433)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmPo-0006MF-TG
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 12:42:48 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZmPo-0001qf-7X
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 17:42:48 +0000
Date: Sat, 17 Nov 2012 17:42:48 +0000
Message-Id: <E1TZmPo-0001qf-7X@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-209-gb610d6c
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 01217fa19cb46a9013b89e93432f9dfbe48ddbad
X-Git-Newrev: b610d6c6e0a001fa2d22b658d9fd4110708a91f2
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 17 Nov 2012 17:42:55 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  b610d6c6e0a001fa2d22b658d9fd4110708a91f2 (commit)
      from  01217fa19cb46a9013b89e93432f9dfbe48ddbad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=b610d6c6e0a001fa2d22b658d9fd4110708a91f2


commit b610d6c6e0a001fa2d22b658d9fd4110708a91f2
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Nov 17 18:40:49 2012 +0100

    Distribute new files.

diff --git a/ChangeLog b/ChangeLog
index 9eb52af..29e9968 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	* ifconfig/system/Makefile.am (noinst_HEADERS):
+	Add `bsd.h' and `bsd.c' for distribution.
+
+2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig: Implement stub for BSD systems.
 
 	* ifconfig/options.c (formats) <unix format>:
diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
index 5b61817..431b964 100644
--- a/ifconfig/system/Makefile.am
+++ b/ifconfig/system/Makefile.am
@@ -21,10 +21,11 @@
 # but I'm too tired to figure out the right way right now. -jb
 
 noinst_HEADERS = \
+	bsd.h \
 	generic.h \
 	linux.h \
-	solaris.h \
 	qnx.h \
+	bsd.c \
 	generic.c \
 	linux.c \
 	solaris.c \

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    5 +++++
 ifconfig/system/Makefile.am |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Nov 17 13:18:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TZmyY-0006jk-CJ
	for mharc-commit-inetutils@gnu.org; Sat, 17 Nov 2012 13:18:42 -0500
Received: from eggs.gnu.org ([208.118.235.92]:35594)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmyU-0006hj-A2
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 13:18:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmyR-0007YY-87
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 13:18:38 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:35618)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TZmyR-0007Xc-4S
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 13:18:35 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TZmyQ-0003ty-Do
	for commit-inetutils@gnu.org; Sat, 17 Nov 2012 18:18:34 +0000
Date: Sat, 17 Nov 2012 18:18:34 +0000
Message-Id: <E1TZmyQ-0003ty-Do@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-210-g3182dcc
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: b610d6c6e0a001fa2d22b658d9fd4110708a91f2
X-Git-Newrev: 3182dccb1a168c3eac728a0035caaca20f614bdd
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 17 Nov 2012 18:18:41 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  3182dccb1a168c3eac728a0035caaca20f614bdd (commit)
      from  b610d6c6e0a001fa2d22b658d9fd4110708a91f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3182dccb1a168c3eac728a0035caaca20f614bdd


commit 3182dccb1a168c3eac728a0035caaca20f614bdd
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Nov 17 19:13:43 2012 +0100

    Add a lost file.

diff --git a/ChangeLog b/ChangeLog
index 29e9968..431e924 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ifconfig/system/Makefile.am (noinst_HEADERS):
+	Add `solaris.h' which was accidentally removed.
+
+2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* ifconfig/system/Makefile.am (noinst_HEADERS):
 	Add `bsd.h' and `bsd.c' for distribution.
 
 2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
index 431b964..b6ffd40 100644
--- a/ifconfig/system/Makefile.am
+++ b/ifconfig/system/Makefile.am
@@ -24,6 +24,7 @@ noinst_HEADERS = \
 	bsd.h \
 	generic.h \
 	linux.h \
+	solaris.h \
 	qnx.h \
 	bsd.c \
 	generic.c \

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    5 +++++
 ifconfig/system/Makefile.am |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Nov 21 15:55:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TbHKR-0001p8-9O
	for mharc-commit-inetutils@gnu.org; Wed, 21 Nov 2012 15:55:27 -0500
Received: from eggs.gnu.org ([208.118.235.92]:41736)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbHKP-0001ov-Ca
	for commit-inetutils@gnu.org; Wed, 21 Nov 2012 15:55:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbHKN-0000Oc-9l
	for commit-inetutils@gnu.org; Wed, 21 Nov 2012 15:55:25 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:36844)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbHKN-0000Nt-6Q
	for commit-inetutils@gnu.org; Wed, 21 Nov 2012 15:55:23 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TbHKM-0008B4-HE
	for commit-inetutils@gnu.org; Wed, 21 Nov 2012 20:55:22 +0000
Date: Wed, 21 Nov 2012 20:55:22 +0000
Message-Id: <E1TbHKM-0008B4-HE@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-212-gdbf10eb
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3182dccb1a168c3eac728a0035caaca20f614bdd
X-Git-Newrev: dbf10eb3d0fc58d109931d00cc46caedc46ab909
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Nov 2012 20:55:26 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  dbf10eb3d0fc58d109931d00cc46caedc46ab909 (commit)
       via  3430b8bd5544dc978228f844112d4944750bb563 (commit)
      from  3182dccb1a168c3eac728a0035caaca20f614bdd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=dbf10eb3d0fc58d109931d00cc46caedc46ab909


commit dbf10eb3d0fc58d109931d00cc46caedc46ab909
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Nov 21 20:57:40 2012 +0100

    ifconfig: Address changing on BSD.

diff --git a/ChangeLog b/ChangeLog
index 862670d..733b0aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-11-21  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Make address changes possible on BSD.
+
+	* ifconfig/changeif.c (SET_SIN_LEN): New macro.
+	(SIOCSIF): Add SET_SIN_LEN, which is needed by
+	every BSD system.
+
+	* ifconfig/options.c (formats) <unix format>:
+	Add `dstaddr?' stanza for tunnel interfaces.
+
 2012-11-18  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ifconfig/ifconfig.c (main): New independent code
diff --git a/ifconfig/changeif.c b/ifconfig/changeif.c
index 1f1f6a8..fbe7fe8 100644
--- a/ifconfig/changeif.c
+++ b/ifconfig/changeif.c
@@ -34,6 +34,13 @@
 #include <netdb.h>
 #include "ifconfig.h"
 
+/* Necessary for BSD systems.  */
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+# define SET_SIN_LEN	sin->sin_len = sizeof (struct sockaddr_in);
+#else /* !HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+# define SET_SIN_LEN
+#endif
+
 #define SIOCSIF(type, addr)						\
   int err = 0;								\
   struct sockaddr_in *sin = (struct sockaddr_in *) &ifr->ifr_addr;	\
@@ -45,6 +52,7 @@
       error (0, 0, "`%s' is not a valid address", addr);		\
       return -1;							\
     }									\
+  SET_SIN_LEN								\
   err = ioctl (sfd, SIOCSIF##type, ifr);				\
   if (err < 0)								\
     {									\
@@ -137,7 +145,8 @@ set_netmask (int sfd, struct ifreq *ifr, char *netmask)
   return -1;
 #else
 
-  SIOCSIF (NETMASK, netmask) if (verbose)
+  SIOCSIF (NETMASK, netmask)
+  if (verbose)
     printf ("Set interface netmask of `%s' to %s.\n",
 	    ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
@@ -152,7 +161,8 @@ set_dstaddr (int sfd, struct ifreq *ifr, char *dstaddr)
          "don't know how to set an interface peer address on this system");
   return -1;
 #else
-  SIOCSIF (DSTADDR, dstaddr) if (verbose)
+  SIOCSIF (DSTADDR, dstaddr)
+  if (verbose)
     printf ("Set interface peer address of `%s' to %s.\n",
 	    ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
@@ -167,7 +177,8 @@ set_brdaddr (int sfd, struct ifreq *ifr, char *brdaddr)
          "don't know how to set an interface broadcast address on this system");
   return -1;
 #else
-  SIOCSIF (BRDADDR, brdaddr) if (verbose)
+  SIOCSIF (BRDADDR, brdaddr)
+  if (verbose)
     printf ("Set interface broadcast address of `%s' to %s.\n",
 	    ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
diff --git a/ifconfig/options.c b/ifconfig/options.c
index abba812..364a55d 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -146,6 +146,7 @@ struct format formats[] = {
    "${metric?}{ metric ${metric}}"
    "${mtu?}{ mtu ${mtu}}${\\n}"
    "${addr?}{${\\t}inet ${addr}"
+   "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
    "${netmask}{2}{%02x}${netmask}{3}{%02x}"
    "${brdaddr?}{ broadcast ${brdaddr}}${\\n}}"

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3430b8bd5544dc978228f844112d4944750bb563


commit 3430b8bd5544dc978228f844112d4944750bb563
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sun Nov 18 22:51:56 2012 +0100

    ifconfig: Interface listing mode.

diff --git a/ChangeLog b/ChangeLog
index 431e924..862670d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-11-18  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* ifconfig/ifconfig.c (main): New independent code
+	to be executed when `list_mode' is true.
+	* ifconfig/options.c (list_mode): New variable.
+	(argp_options): New option `-l/--list'.
+	(parse_opt) <'l'>: New case.
+	* ifconfig/options.h (list_mode): New variable.
+
 2012-11-17  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ifconfig/system/Makefile.am (noinst_HEADERS):
diff --git a/ifconfig/ifconfig.c b/ifconfig/ifconfig.c
index b767628..9cef95f 100644
--- a/ifconfig/ifconfig.c
+++ b/ifconfig/ifconfig.c
@@ -65,11 +65,28 @@ main (int argc, char *argv[])
 
   for (ifp = ifs; ifp < ifs + nifs; ifp++)
     {
+      if (list_mode)
+	{
+	  /* Protect against mistakes in use of `-i'.  */
+	  if (!if_nametoindex (ifp->name))
+	    continue;
+
+	  /* Use ERR as a marker of previous output.
+	   * It will never mix with a call to configure_if().  */
+	  if (err++)
+	    putchar (' ');
+	  printf ("%s", ifp->name);
+	  continue;
+	}
+
       err = configure_if (sfd, ifp);
       if (err)
 	break;
     }
 
+  if (list_mode && err)
+    putchar ('\n');
+
   close (sfd);
   return err;
 }
diff --git a/ifconfig/options.c b/ifconfig/options.c
index f4a07cb..abba812 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -39,6 +39,9 @@
 #include <net/if.h>
 #include "ifconfig.h"
 
+/* List available interfaces.  */
+int list_mode;
+
 /* Be verbose about actions.  */
 int verbose;
 
@@ -228,6 +231,8 @@ static struct argp_option argp_options[] = {
     "shut the interface down" },
   { "flags", 'F', "FLAG[,FLAG...]", 0,
     "set interface flags" },
+  { "list", 'l', NULL, 0,
+    "list available or selected interfaces" },
   { "short", 's', NULL, 0,
     "short output format" },
   { NULL }
@@ -495,6 +500,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       parse_opt_set_default_format ("netstat");
       break;
 
+    case 'l':
+      list_mode++;
+      break;
+
     case 'v':
       verbose++;
       break;
diff --git a/ifconfig/options.h b/ifconfig/options.h
index 822100b..bc2060d 100644
--- a/ifconfig/options.h
+++ b/ifconfig/options.h
@@ -69,6 +69,9 @@ extern int ifs_cmdline;
 extern struct ifconfig *ifs;
 extern int nifs;
 
+/* List available interfaces.  */
+extern int list_mode;
+
 /* Be verbose about what we do.  */
 extern int verbose;
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |   20 ++++++++++++++++++++
 ifconfig/changeif.c |   17 ++++++++++++++---
 ifconfig/ifconfig.c |   17 +++++++++++++++++
 ifconfig/options.c  |   10 ++++++++++
 ifconfig/options.h  |    3 +++
 5 files changed, 64 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Nov 22 19:40:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TbhKC-0005km-Ik
	for mharc-commit-inetutils@gnu.org; Thu, 22 Nov 2012 19:40:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40642)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbhK6-0005k5-B5
	for commit-inetutils@gnu.org; Thu, 22 Nov 2012 19:40:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbhK0-0005nS-Qe
	for commit-inetutils@gnu.org; Thu, 22 Nov 2012 19:40:50 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54241)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TbhK0-0005nO-MI
	for commit-inetutils@gnu.org; Thu, 22 Nov 2012 19:40:44 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TbhK0-00022R-8Z
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 00:40:44 +0000
Date: Fri, 23 Nov 2012 00:40:44 +0000
Message-Id: <E1TbhK0-00022R-8Z@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-213-g8583f18
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: dbf10eb3d0fc58d109931d00cc46caedc46ab909
X-Git-Newrev: 8583f18c3f7829a3d7c3413fd1446679b26f6652
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Nov 2012 00:40:54 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  8583f18c3f7829a3d7c3413fd1446679b26f6652 (commit)
      from  dbf10eb3d0fc58d109931d00cc46caedc46ab909 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=8583f18c3f7829a3d7c3413fd1446679b26f6652


commit 8583f18c3f7829a3d7c3413fd1446679b26f6652
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 23 00:52:38 2012 +0100

    ifconfig: Hwaddr support for BSD.

diff --git a/ChangeLog b/ChangeLog
index 733b0aa..2bcb796 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Initial hwaddr support for BSD.
+
+	* ifconfig/options.c (formats) <unix format>:
+	Place hwtype/hwaddr stanza before addr stanza,
+	and emit text only if hwtype evaluates to true.
+	(argp_options): Mention `--format=help' in usage.
+	* ifconfig/system/bsd.c: Multiple inclusions.
+	(ifp): New variable.
+	(ESTABLISH_IFADDRS): New macro.
+	(system_fh_hwaddr_query, system_fh_hwaddr)
+	(system_fh_hwtype_query, system_fh_hwtype):
+	New functions.
+	* ifconfig/system/bsd.h (IU_BSD_TYPE, ETHERNAME):
+	New macros.
+	(SYSTEM_FORMAT_HANDLER): Replace keys "dragonflybsd",
+	"freebsd", "netbsd", and "openbsd" by the single
+	IU_BSD_TYPE, encoding the only relevant system type.
+	Add keys "hwaddr?", "hwaddr", "hwtype?", and "hwtype".
+	(system_fh_hwaddr_query, system_fh_hwaddr)
+	(system_fh_hwtype_query, system_fh_hwtype):
+	New prototypes.
+
 2012-11-21  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Make address changes possible on BSD.
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 364a55d..43f4902 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -139,19 +139,21 @@ struct format formats[] = {
   /* Resembles the output of ifconfig shipped with unix systems like
      Solaris 2.7 or HPUX 10.20.  */
   {"unix",
-   "Traditional UNIX interface listing.  Default for Solaris and HPUX.",
+   "Traditional UNIX interface listing.  Default for Solaris, BSD and HPUX.",
    "${format}{check-existence}"
    "${ifdisplay?}{"
    "${name}: flags=${flags}{number}{%hx}<${flags}{string}{,}>"
    "${metric?}{ metric ${metric}}"
    "${mtu?}{ mtu ${mtu}}${\\n}"
+   /* Print only if hwtype emits something.  */
+   "${exists?}{hwtype?}{"
+     "${hwtype?}{${\\t}${hwtype}${exists?}{hwaddr?}{"
+       "${hwaddr?}{ ${hwaddr}}}${\\n}}}"
    "${addr?}{${\\t}inet ${addr}"
    "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
    "${netmask}{2}{%02x}${netmask}{3}{%02x}"
    "${brdaddr?}{ broadcast ${brdaddr}}${\\n}}"
-   "${exists?}{hwtype?}{${hwtype?}{${\\t}${hwtype}"
-   "}${exists?}{hwaddr?}{${hwaddr?}{ ${hwaddr}}}${\\n}}"
    "}"
   },
   /* Resembles the output of ifconfig shipped with OSF 4.0g.  */
@@ -225,7 +227,7 @@ static struct argp_option argp_options[] = {
   { "metric", METRIC_OPTION, "N", 0,
     "set metric of interface to N" },
   { "format", FORMAT_OPTION, "FORMAT", 0,
-    "select output format (or set back to default)" },
+    "select output format; set to `help' for info" },
   { "up", UP_OPTION, NULL, 0,
     "activate the interface (default if address is given)" },
   { "down", DOWN_OPTION, NULL, 0,
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index 7a50731..4b337ed 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -21,6 +21,13 @@
 
 #include <unistd.h>
 #include "../ifconfig.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/if_dl.h>
+#include <netinet/if_ether.h>
+#include <ifaddrs.h>
 
 
 /* Output format stuff.  */
@@ -55,10 +62,115 @@ system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
 
 
 /* System hooks. */
+static struct ifaddrs *ifp = NULL;
+
+#define ESTABLISH_IFADDRS \
+  if (!ifp) \
+    getifaddrs (&ifp);
 
 struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
 
 void
+system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
+{
+  ESTABLISH_IFADDRS
+  if (!ifp)
+    select_arg (form, argc, argv, 1);
+  else
+    {
+      int missing = 1;
+      struct ifaddrs *fp;
+
+      for (fp = ifp; fp; fp = fp->ifa_next)
+	{
+	  struct sockaddr_dl *dl;
+
+	  if (fp->ifa_addr->sa_family != AF_LINK ||
+	      strcmp (fp->ifa_name, form->ifr->ifr_name))
+	    continue;
+
+	  dl = (struct sockaddr_dl *) fp->ifa_addr;
+	  if (dl && (dl->sdl_len > 0) &&
+	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
+	    missing = 0;
+	  break;
+	}
+      select_arg (form, argc, argv, missing);
+    }
+}
+
+void
+system_fh_hwaddr (format_data_t form, int argc, char *argv[])
+{
+  ESTABLISH_IFADDRS
+  if (!ifp)
+    put_string (form, "(hwaddr unknown)");
+  else
+    {
+      int missing = 1;
+      struct ifaddrs *fp;
+
+      for (fp = ifp; fp; fp = fp->ifa_next)
+	{
+	  struct sockaddr_dl *dl;
+
+	  if (fp->ifa_addr->sa_family != AF_LINK ||
+	      strcmp (fp->ifa_name, form->ifr->ifr_name))
+	    continue;
+
+	  dl = (struct sockaddr_dl *) fp->ifa_addr;
+	  if (dl && (dl->sdl_len > 0) &&
+	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
+	    {
+	      missing = 0;
+	      put_string (form, ether_ntoa ((struct ether_addr *) LLADDR (dl)));
+	    }
+	  break;
+	}
+      if (missing)
+	put_string (form, "(hwaddr unknown)");
+    }
+}
+
+void
+system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
+{
+  system_fh_hwaddr_query (form, argc, argv);
+}
+
+void
+system_fh_hwtype (format_data_t form, int argc, char *argv[])
+{
+  ESTABLISH_IFADDRS
+  if (!ifp)
+    put_string (form, "(hwtype unknown)");
+  else
+    {
+      int found = 0;
+      struct ifaddrs *fp;
+      struct sockaddr_dl *dl = NULL;
+
+      for (fp = ifp; fp; fp = fp->ifa_next)
+	{
+	  if (fp->ifa_addr->sa_family != AF_LINK ||
+	      strcmp (fp->ifa_name, form->ifr->ifr_name))
+	    continue;
+
+	  dl = (struct sockaddr_dl *) fp->ifa_addr;
+	  if (dl && (dl->sdl_len > 0) &&
+	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
+	    {
+	      found = 1;
+	      put_string (form, ETHERNAME);
+	    }
+	  break;
+	}
+      if (!found)
+	put_string (form, "(unknown hwtype)");
+    }
+}
+
+void
 system_fh_metric (format_data_t form, int argc, char *argv[])
 {
 #ifdef SIOCGIFMETRIC
diff --git a/ifconfig/system/bsd.h b/ifconfig/system/bsd.h
index e6aeec2..49dcfaa 100644
--- a/ifconfig/system/bsd.h
+++ b/ifconfig/system/bsd.h
@@ -22,6 +22,24 @@
 # include "../printif.h"
 # include "../options.h"
 # include <sys/sockio.h>
+
+/* BSD variant chooser.  */
+# if defined __DragonFly__
+#  define IU_BSD_TYPE "dragonfly"
+# elif defined __FreeBSD__
+#  define IU_BSD_TYPE "freebsd"
+# elif defined __NetBSD__
+#  define IU_BSD_TYPE "netbsd"
+# elif defined __OpenBSD__
+#  define IU_BSD_TYPE "openbsd"
+#  define ETHERNAME "lladdr"
+# else /* Exotic BSD versions.  */
+#  define IU_BSD_TYPE "unknownbsd"
+# endif
+
+# ifndef ETHERNAME
+#  define ETHERNAME "ether"
+# endif
 
 
 /* Option support.  */
@@ -37,25 +55,19 @@ struct system_ifconfig
 
 /* Output format support.  */
 
-/* Set this to a comma seperated, comma terminated list of struct
-   format_handler entries.  They are inserted at the beginning of the
-   default list, so they override generic implementations if they have
-   the same name.  For example:
-   #define SYSTEM_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
-   { "newline", system_fh_newline },
-   Define some architecture symbol like "foobar", so it can be tested
-   for in generic format strings with ${exists?}{foobar?}.  */
 # define SYSTEM_FORMAT_HANDLER	\
   {"bsd", fh_nothing},		\
-  {"dragonflybsd", fh_nothing},	\
-  {"freebsd", fh_nothing},	\
-  {"netbsd", fh_nothing},	\
-  {"openbsd", fh_nothing},	\
+  {IU_BSD_TYPE, fh_nothing},	\
+  {"hwaddr?", system_fh_hwaddr_query}, \
+  {"hwaddr", system_fh_hwaddr}, \
+  {"hwtype?", system_fh_hwtype_query}, \
+  {"hwtype", system_fh_hwtype}, \
   {"metric", system_fh_metric},
 
-/* Prototype system_fh_* functions here.
-   void system_fh_newline (format_data_t, int, char **);
-*/
+void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
 void system_fh_metric (format_data_t form, int argc, char *argv[]);
 
-#endif
+#endif /* IFCONFIG_SYSTEM_BSD_H */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   24 ++++++++++
 ifconfig/options.c    |   10 +++--
 ifconfig/system/bsd.c |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
 ifconfig/system/bsd.h |   44 ++++++++++++-------
 4 files changed, 170 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 23 07:53:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tbskm-0006yN-0l
	for mharc-commit-inetutils@gnu.org; Fri, 23 Nov 2012 07:53:08 -0500
Received: from eggs.gnu.org ([208.118.235.92]:35496)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbskf-0006xz-Ak
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 07:53:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbskb-0002AH-4F
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 07:53:01 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:33435)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbskb-0002AD-0P
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 07:52:57 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1Tbska-00019p-3e
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 12:52:56 +0000
Date: Fri, 23 Nov 2012 12:52:56 +0000
Message-Id: <E1Tbska-00019p-3e@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-214-gf84a8f0
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8583f18c3f7829a3d7c3413fd1446679b26f6652
X-Git-Newrev: f84a8f027c1b5989b7bbbe1cde8748909314734d
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Nov 2012 12:53:07 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  f84a8f027c1b5989b7bbbe1cde8748909314734d (commit)
      from  8583f18c3f7829a3d7c3413fd1446679b26f6652 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=f84a8f027c1b5989b7bbbe1cde8748909314734d


commit f84a8f027c1b5989b7bbbe1cde8748909314734d
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 23 13:18:26 2012 +0100

    ifconfig: Output formatting.

diff --git a/ChangeLog b/ChangeLog
index 2bcb796..9d0cad3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	ifconfig: Output formatting.
+
+	* ifconfig/options.c (formats) <gnu format>:
+	Test with `ifdisplay?' to suppress empty lines
+	for dormant interfaces.
+	<net-tools format>: Remove a newline for txqlen.
+	<netstat format>: Use `exists?' on `ifstat?',
+	leaving statistics empty if `ifstat?' fails.
+
+2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig: Initial hwaddr support for BSD.
 
 	* ifconfig/options.c (formats) <unix format>:
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 43f4902..6e6317d 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -65,7 +65,8 @@ struct format formats[] = {
   /* This is the standard GNU output.  */
   {"gnu",
    "Standard GNU output format.",
-   "${first?}{}{${\\n}}${format}{gnu-one-entry}"},
+   "${ifdisplay?}{${first?}{}{${\\n}}${format}{gnu-one-entry}}"
+  },
   {"gnu-one-entry",
    "Same as GNU, but without additional newlines between the entries.",
    "${format}{check-existence}"
@@ -111,7 +112,6 @@ struct format formats[] = {
    "${newline}"
    "          RX bytes:${rxbytes}  TX bytes:${txbytes}"
    "}}{"
-   "${newline}"
    "${exists?}{txqlen?}{${txqlen?}{ ${tab}{10}txqueuelen:${txqlen}}${\\n}}}"
    "${newline}"
    "${exists?}{map?}{${map?}{${irq?}{"
@@ -129,10 +129,12 @@ struct format formats[] = {
    "${first?}{Iface    MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg${newline}}"
    "${format}{check-existence}"
    "${name}${tab}{6}${mtu}{%6d} ${metric}{%3d}"
+   /* Insert blanks without ifstat.  */
+   "${exists?}{ifstat?}{"
    "${ifstat?}{"
    " ${rxpackets}{%8lu} ${rxerrors}{%6lu} ${rxdropped}{%6lu} ${rxfifoerr}{%6lu}"
    " ${txpackets}{%8lu} ${txerrors}{%6lu} ${txdropped}{%6lu} ${txfifoerr}{%6lu}"
-   "}{   - no statistics available -}"
+   "}{   - no statistics available -}}"
    "${tab}{76} ${flags?}{${flags}{short}}{[NO FLAGS]}"
    "${newline}"
   },

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   11 +++++++++++
 ifconfig/options.c |    8 +++++---
 2 files changed, 16 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Nov 23 11:01:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tbvh1-0007oN-Ok
	for mharc-commit-inetutils@gnu.org; Fri, 23 Nov 2012 11:01:27 -0500
Received: from eggs.gnu.org ([208.118.235.92]:39812)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbvgv-0007nt-VR
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 11:01:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbvgr-00027m-NP
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 11:01:21 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49929)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tbvgr-00027h-K0
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 11:01:17 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1Tbvgr-00034C-6o
	for commit-inetutils@gnu.org; Fri, 23 Nov 2012 16:01:17 +0000
Date: Fri, 23 Nov 2012 16:01:17 +0000
Message-Id: <E1Tbvgr-00034C-6o@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-215-ge9a6037
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: f84a8f027c1b5989b7bbbe1cde8748909314734d
X-Git-Newrev: e9a6037fb15d706a00a9212c1e3a3c1b89ab9429
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Nov 2012 16:01:26 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  e9a6037fb15d706a00a9212c1e3a3c1b89ab9429 (commit)
      from  f84a8f027c1b5989b7bbbe1cde8748909314734d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=e9a6037fb15d706a00a9212c1e3a3c1b89ab9429


commit e9a6037fb15d706a00a9212c1e3a3c1b89ab9429
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Nov 23 16:45:51 2012 +0100

    syslogd: Reuse socket addresses.

diff --git a/ChangeLog b/ChangeLog
index 9d0cad3..ab9b7a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	syslogd: Reusable IP sockets.
+	Automated test systems seemingly fail here.
+
+	* src/syslogd.c (create_inet_socket): Set socket
+	option SO_REUSEADDR on IP sockets.
+
+2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig: Output formatting.
 
 	* ifconfig/options.c (formats) <gnu format>:
diff --git a/src/syslogd.c b/src/syslogd.c
index 4fa459a..3568c93 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -888,15 +888,21 @@ create_inet_socket (int af, int fd46[2])
 
   for (ai = rp; ai; ai = ai->ai_next)
     {
+      int yes = 1;
+
       fd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
       if (fd < 0)
 	continue;
       if (ai->ai_family == AF_INET6)
 	{
-	  int yes = 1;
 	  /* Avoid dual stacked sockets.  Better to use distinct sockets.  */
 	  (void) setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof (yes));
 	}
+
+      err = setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (yes));
+      if (err < 0)
+	logerror ("failed to set SO_REUSEADDR");
+
       if (bind (fd, ai->ai_addr, ai->ai_addrlen) < 0)
 	{
 	  close (fd);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |    8 ++++++++
 src/syslogd.c |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Nov 28 14:44:29 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TdnYb-0003C3-HW
	for mharc-commit-inetutils@gnu.org; Wed, 28 Nov 2012 14:44:29 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40826)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnYY-0003Be-WF
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 14:44:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnYW-0002Bn-T7
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 14:44:26 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40974)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnYW-0002B6-Oo
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 14:44:24 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TdnYU-0000UM-He
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 19:44:23 +0000
Date: Wed, 28 Nov 2012 19:44:22 +0000
Message-Id: <E1TdnYU-0000UM-He@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-216-g0dc3545
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: e9a6037fb15d706a00a9212c1e3a3c1b89ab9429
X-Git-Newrev: 0dc3545ca84c8a713810a4b86555824332b3d500
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Nov 2012 19:44:28 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  0dc3545ca84c8a713810a4b86555824332b3d500 (commit)
      from  e9a6037fb15d706a00a9212c1e3a3c1b89ab9429 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=0dc3545ca84c8a713810a4b86555824332b3d500


commit 0dc3545ca84c8a713810a4b86555824332b3d500
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Nov 28 18:32:53 2012 +0100

    Move if_nameindex to libinetutils.
    
    Build if_nametoindex() and if_nameindex() in libinetutils.a
    if they are missing in the system library.

diff --git a/ChangeLog b/ChangeLog
index ab9b7a1..787dd48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2012-11-28  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	libinetutils.a: Build if_nametoindex(), if_nameindex(),
+	and if_freenameindex() into library, if they are missing
+	in the system library.
+
+	* libinetutils/Makefile.am (libinetutils_a_SOURCES):
+	Add if_index.c.
+	* libinetutils/if_index.c: Moved from old location at
+	`ifconfig/if_index.c'.  Do not include <ifconfig.h>.
+	* libinetutils/libinetutils.h (if_nameindex)
+	[!HAVE_STRUCT_IF_NAMEINDEX): New structure declaration.
+	(if_nametoindex, if_nameindex, if_freenameindex)
+	[!HAVE_STRUCT_IF_NAMEINDEX): New function declarations.
+
+	* ifconfig/Makefile.am (ifconfig_SOURCES): Remove if_index.c.
+	(noinst_HEADERS): Remove if_index.h.
+	* ifconfig/if_index.c, ifconfig/if_index.h: Deleted files.
+	* ifconfig/ifconfig.h: Do not include "if_index.h".
+	* ifconfig/system.h: Do not include <if_index.h>.
+
+	Test script for ifconfig utility.
+
+	* tests/ifconfig.sh: New file.
+	* tests/Makefile.am (dist_check_SCRIPTS) [ENABLE_ifconfig]:
+	Add ifconfig.sh.
+
 2012-11-23  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	syslogd: Reusable IP sockets.
diff --git a/TODO b/TODO
index 757daae..a296de9 100644
--- a/TODO
+++ b/TODO
@@ -129,7 +129,6 @@ Ability to ping multiple host in one go.
 * ifconfig
 
 ** Implement flags support in changeif.c and options.c
-** Fix and move if_index.c to libinetutils.
 ** Port to BSD.
 ** Make sure it is a drop in replacement at least for the most
    common options on Linux and BSD.
diff --git a/ifconfig/Makefile.am b/ifconfig/Makefile.am
index f01bf62..7cd0e16 100644
--- a/ifconfig/Makefile.am
+++ b/ifconfig/Makefile.am
@@ -23,9 +23,9 @@ bin_PROGRAMS = $(ifconfig_BUILD)
 
 EXTRA_PROGRAMS = ifconfig
 
-ifconfig_SOURCES = ifconfig.c flags.c changeif.c options.c printif.c system.c if_index.c
+ifconfig_SOURCES = ifconfig.c flags.c changeif.c options.c printif.c system.c
 
-noinst_HEADERS = ifconfig.h if_index.h flags.h options.h printif.h system.h
+noinst_HEADERS = ifconfig.h flags.h options.h printif.h system.h
 
 @PATHDEFS_MAKE@
 AM_CPPFLAGS = $(PATHDEF_PROCNET_DEV)
diff --git a/ifconfig/if_index.h b/ifconfig/if_index.h
deleted file mode 100644
index 280eae6..0000000
--- a/ifconfig/if_index.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-  Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-  2010, 2011, 2012 Free Software Foundation, Inc.
-
-  This file is part of GNU Inetutils.
-
-  GNU Inetutils 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 3 of the License, or (at
-  your option) any later version.
-
-  GNU Inetutils 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, see `http://www.gnu.org/licenses/'. */
-
-#ifndef IF_INDEX_H
-# define IF_INDEX_H
-
-# ifndef HAVE_STRUCT_IF_NAMEINDEX
-struct if_nameindex
-{
-  char *if_name;
-  int if_index;
-};
-extern unsigned int if_nametoindex (const char *ifname);
-extern struct if_nameindex *if_nameindex (void);
-extern void if_freenameindex (struct if_nameindex *ptr);
-# endif
-
-#endif
diff --git a/ifconfig/ifconfig.h b/ifconfig/ifconfig.h
index 35045b7..6fb61d2 100644
--- a/ifconfig/ifconfig.h
+++ b/ifconfig/ifconfig.h
@@ -23,7 +23,6 @@
 # define IFCONFIG_IFCONFIG_H
 
 # include "flags.h"
-# include "if_index.h"
 # include "options.h"
 # include "printif.h"
 # include "system.h"
diff --git a/ifconfig/system.h b/ifconfig/system.h
index 0108aff..2352081 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -23,8 +23,6 @@
 # define IFCONFIG_SYSTEM_H
 
 
-# include <if_index.h>
-
 /* Option parsing.  */
 
 extern struct argp_child system_argp_child;
diff --git a/libinetutils/Makefile.am b/libinetutils/Makefile.am
index f674eeb..7c599bc 100644
--- a/libinetutils/Makefile.am
+++ b/libinetutils/Makefile.am
@@ -30,6 +30,7 @@ libinetutils_a_SOURCES = \
  daemon.c\
  defauthors.c\
  des_rw.c\
+ if_index.c \
  kcmd.c\
  krcmd.c\
  localhost.c\
diff --git a/ifconfig/if_index.c b/libinetutils/if_index.c
similarity index 99%
rename from ifconfig/if_index.c
rename to libinetutils/if_index.c
index b3dc590..a063101 100644
--- a/ifconfig/if_index.c
+++ b/libinetutils/if_index.c
@@ -36,8 +36,6 @@
 #include <sys/ioctl.h>
 #include <net/if.h>
 
-#include <ifconfig.h>
-
 #ifndef HAVE_STRUCT_IF_NAMEINDEX
 unsigned int
 if_nametoindex (const char *ifname)
diff --git a/libinetutils/libinetutils.h b/libinetutils/libinetutils.h
index 5dc329d..617cf5c 100644
--- a/libinetutils/libinetutils.h
+++ b/libinetutils/libinetutils.h
@@ -33,6 +33,18 @@ void logwtmp (const char *, const char *, const char *);
 void cleanup_session (char *tty, int pty_fd);
 void logwtmp_keep_open (char *line, char *name, char *host);
 
+#ifndef HAVE_STRUCT_IF_NAMEINDEX
+struct if_nameindex
+{
+  char *if_name;
+  int if_index;
+};
+
+unsigned int if_nametoindex (const char *ifname);
+struct if_nameindex *if_nameindex (void);
+void if_freenameindex (struct if_nameindex *ptr);
+#endif
+
 extern const char *default_program_authors[];
 
 #define iu_argp_init(name, authors)				\
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d7d72a1..1419a26 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,6 +68,10 @@ if ENABLE_dnsdomainname
 dist_check_SCRIPTS += dnsdomainname.sh
 endif
 
+if ENABLE_ifconfig
+dist_check_SCRIPTS += ifconfig.sh
+endif
+
 TESTS = localhost waitdaemon $(dist_check_SCRIPTS)
 
 TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                             |   27 ++++++++++++++++++++++++++
 TODO                                  |    1 -
 ifconfig/Makefile.am                  |    4 +-
 ifconfig/if_index.h                   |   34 ---------------------------------
 ifconfig/ifconfig.h                   |    1 -
 ifconfig/system.h                     |    2 -
 libinetutils/Makefile.am              |    1 +
 {ifconfig => libinetutils}/if_index.c |    2 -
 libinetutils/libinetutils.h           |   12 +++++++++++
 tests/Makefile.am                     |    4 +++
 10 files changed, 46 insertions(+), 42 deletions(-)
 delete mode 100644 ifconfig/if_index.h
 rename {ifconfig => libinetutils}/if_index.c (99%)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Nov 28 15:07:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tdnub-0008QE-Ee
	for mharc-commit-inetutils@gnu.org; Wed, 28 Nov 2012 15:07:13 -0500
Received: from eggs.gnu.org ([208.118.235.92]:48916)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnuU-00089Y-Ut
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 15:07:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnuO-0000W5-9y
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 15:07:06 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:59066)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TdnuO-0000Vq-73
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 15:07:00 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TdnuN-0001sG-LB
	for commit-inetutils@gnu.org; Wed, 28 Nov 2012 20:06:59 +0000
Date: Wed, 28 Nov 2012 20:06:59 +0000
Message-Id: <E1TdnuN-0001sG-LB@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-217-g150fca4
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 0dc3545ca84c8a713810a4b86555824332b3d500
X-Git-Newrev: 150fca45402469de012f4bd9f64bd8ca5b2e89f2
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Nov 2012 20:07:11 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  150fca45402469de012f4bd9f64bd8ca5b2e89f2 (commit)
      from  0dc3545ca84c8a713810a4b86555824332b3d500 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=150fca45402469de012f4bd9f64bd8ca5b2e89f2


commit 150fca45402469de012f4bd9f64bd8ca5b2e89f2
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Nov 28 21:03:17 2012 +0100

    Add tests/ifconfig.sh. (silent change)

diff --git a/tests/ifconfig.sh b/tests/ifconfig.sh
new file mode 100755
index 0000000..dbb6e8e
--- /dev/null
+++ b/tests/ifconfig.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+# Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Inetutils.
+#
+# GNU Inetutils 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 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Inetutils 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, see `http://www.gnu.org/licenses/'.
+
+# Tests to establish functionality of ifconfig utility.
+#
+# Written by Mats Erik Andersson.
+
+# Prerequisites:
+#
+#  * Shell: SVR4 Bourne shell, or newer.
+
+# Is usage explanation in demand?
+#
+if test "$1" = "-h" || test "$1" = "--help" || test "$1" = "--usage"; then
+    cat <<HERE
+Test utility for ifconfig.
+
+The following environment variables are used:
+
+VERBOSE		Be verbose, if set.
+FORMAT		Test only these output formats.  A list of
+		formats is excepted.
+
+HERE
+    exit 0
+fi
+
+# Step into `tests/', should the invokation
+# have been made outside of it.
+#
+[ -d src ] && [ -f tests/syslogd.sh ] && cd tests/
+
+. ./tools.sh
+
+# Executable uder test.
+#
+IFCONFIG=${IFCONFIG:-../ifconfig/ifconfig$EXEEXT}
+
+
+if test ! -x "$IFCONFIG"; then
+    echo >&2 "Missing executable '$IFCONFIG'.  Skipping test."
+    exit 77
+fi
+
+if test -z "${VERBOSE+set}"; then
+    silence=:
+    bucket='>/dev/null'
+fi
+
+if test -n "$VERBOSE"; then
+    set -x
+    $IFCONFIG --version | $SED '1q'
+fi
+
+# Locate the loopback interface.
+#
+IF_LIST=`$IFCONFIG -l`
+LO=`expr "$IF_LIST" : '.*\(lo0\{0,\}\).*'`
+
+if test -z "$LO"; then
+    echo >&2 'Unable to locate loopback interface.  Failing.'
+    exit 1
+fi
+
+find_lo_addr () {
+   $IFCONFIG ${1+--format=$1} -i $LO | \
+   eval $GREP '"inet .*127\.0\.0\.1"' $bucket 2>/dev/null
+}
+
+errno=0
+
+for fmt in ${FORMAT:-gnu gnu-one-entry net-tools osf unix}; do
+    $silence echo "Checking format $fmt."
+    find_lo_addr $fmt || { errno=1; echo >&2 "Failed with format '$fmt'."; }
+done
+
+test $errno -ne 0 || $silence echo "Successful testing".
+
+exit $errno

-----------------------------------------------------------------------

Summary of changes:
 tests/ifconfig.sh |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100755 tests/ifconfig.sh


hooks/post-receive
-- 
GNU Inetutils 


