From MAILER-DAEMON Fri Oct 04 17:43:04 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VSD9M-0004lB-FZ
	for mharc-commit-inetutils@gnu.org; Fri, 04 Oct 2013 17:43:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52115)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSD9J-0004ka-AR
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 17:43:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSD9H-0001Dp-Uu
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 17:43:01 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:53392)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSD9H-0001Dj-Ql
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 17:42:59 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VSD9G-0008VZ-SJ
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 21:42:59 +0000
Date: Fri, 04 Oct 2013 21:42:58 +0000
Message-Id: <E1VSD9G-0008VZ-SJ@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-5-g1d9298c
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 88488ebc5adbce76551d85945c3033553db666c7
X-Git-Newrev: 1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4
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, 04 Oct 2013 21:43:02 -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  1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4 (commit)
      from  88488ebc5adbce76551d85945c3033553db666c7 (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=1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4


commit 1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Oct 2 14:26:14 2013 +0200

    ftpd: Capture syntax errors.
    
    Scanner and parser were not sufficiently tuned
    to each other, and could produce inconclusive
    error messages and even duplicate messages from
    a single error.

diff --git a/ChangeLog b/ChangeLog
index 0d1aa41..bf3c796 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2013-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ftpd: Capture syntax errors.
+	Scanner and parser are insufficiently trimmed to
+	each other, producing duplicate and inconclusive
+	diagnostic messages.
+
+	* ftpd/ftpcmd.y (yylex) <STR1 || ZSTR1 || dostr1>:
+	Remove a break at the end, continue into ZSTR2.
+	This allows detection of syntax errors.  A test
+	case is `quote site chmod 0750' by a client.
+	(yylex): Call yyerror() only if `yynerrs' is zero.
+	Otherwise both scanner and parser would send error
+	messages to the client.  Specify an explicit message
+	in this call to yyerror().
+	(yyerror): Use parameter `s' in reply message, but
+	keep a default message in case `s' is empty.  This
+	passes on any diagnostic message from the parser.
+
 2013-09-26  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftpd: Implement FEAT and OPTS.
diff --git a/ftpd/ftpcmd.y b/ftpd/ftpcmd.y
index b2f4081..9dcd06c 100644
--- a/ftpd/ftpcmd.y
+++ b/ftpd/ftpcmd.y
@@ -1300,10 +1300,10 @@ check_login
 #define	CMD	0	/* beginning of command */
 #define	ARGS	1	/* expect miscellaneous arguments */
 #define	STR1	2	/* expect SP followed by STRING */
-#define	STR2	3	/* expect STRING */
+#define	STR2	3	/* expect STRING (must be STR2 + 1)*/
 #define	OSTR	4	/* optional SP then STRING */
 #define	ZSTR1	5	/* SP then optional STRING */
-#define	ZSTR2	6	/* optional STRING after SP */
+#define	ZSTR2	6	/* optional STRING after SP (must be ZSTR1 + 1) */
 #define	SITECMD	7	/* SITE command */
 #define	NSTR	8	/* Number followed by a string */
 #define	DLIST	9	/* SP and delimited list for EPRT/EPSV */
@@ -1373,7 +1373,7 @@ static struct tab cmdtab[] = {
   /* Long addressing in RFC 1639.  Obsoleted in RFC 5797.  */
   { "LPRT", LPRT, ARGS, 1,	"<sp> af,hal,h0..hn,2,p0,p1" },
   { "LPSV", LPSV, ARGS, 1,	"(set server in long passive mode)" },
-  { NULL,   0,    0,    0,	0 }
+  { NULL,   0,    0,    0,	NULL }
 };
 
 static struct tab sitetab[] = {
@@ -1381,7 +1381,7 @@ static struct tab sitetab[] = {
   { "HELP", HELP, OSTR, 1,	"[ <sp> <string> ]" },
   { "IDLE", IDLE, ARGS, 1,	"[ <sp> maximum-idle-time ]" },
   { "UMASK", UMASK, ARGS, 1,	"[ <sp> umask ]" },
-  { NULL,   0,    0,    0,	0 }
+  { NULL,   0,    0,    0,	NULL }
 };
 
 /* Extensions beyond RFC 959 and RFC 2389.  Ordered as implemented.  */
@@ -1572,7 +1572,7 @@ yylex (void)
 	      yylval.s = (char*) p->name;
 	      return (p->token);
 	    }
-	  break;
+	  break;	/* Command not known.  */
 
 	case SITECMD:
 	  if (cbuf[cpos] == ' ')
@@ -1607,7 +1607,7 @@ yylex (void)
 	      return (p->token);
 	    }
 	  state = CMD;
-	  break;
+	  break;	/* Command not known.  */
 
 	case OSTR:
 	  if (cbuf[cpos] == '\n')
@@ -1629,7 +1629,7 @@ yylex (void)
 
 	      return (SP);
 	    }
-	  break;
+	  /* Intentional continuation.  */
 
 	case ZSTR2:
 	  if (cbuf[cpos] == '\n')
@@ -1653,7 +1653,7 @@ yylex (void)
 	      state = ARGS;
 	      return (STRING);
 	    }
-	  break;
+	  break;	/* Empty string, missing NL.  */
 
 	case NSTR:
 	  if (cbuf[cpos] == ' ')
@@ -1727,7 +1727,7 @@ yylex (void)
 	      yylval.i = c;
 	      return (CHAR);
 	    }
-	  break;
+	  break;	/* Not reachable.  */
 
 	case ARGS:
 	  if (isdigit (cbuf[cpos]))
@@ -1803,13 +1803,33 @@ yylex (void)
 	    case 't':
 	      return (T);
 	    }
-	  break;
+	  break;	/* No number, not in [\n ,aAbBcCeEfFiIlLnNpPrRsSttT] */
 
 	default:
 	  fatal ("Unknown state in scanner.");
 	}
 
-      yyerror ((char *) 0);
+      /*
+       * Analysis: Cases when this point is reached.
+       *
+       *  CMD:      command not known
+       *  SITECMD:  site command not known (state changed to CMD)
+       *
+       *  OSTR, STR1, ZSTR1, STR2, ZSTR2, NSTR:
+       *            empty string or string without NL
+       *
+       *  ARGS:     not a number, not a special character
+       */
+
+      /*
+       * Issue a new error message only if the parser has not
+       * yet reported a complaint.  Without this precaution
+       * two messages would be directed to the client, thus
+       * upsetting all following exchange.
+       */
+      if (!yynerrs)
+	yyerror ("command not recognized");
+
       state = CMD;
       longjmp (errcatch, 0);
     } /* for (;;) */
@@ -1980,9 +2000,9 @@ yyerror (const char *s)
 {
   char *cp;
 
-  (void) s;
   cp = strchr (cbuf, '\n');
   if (cp != NULL)
     *cp = '\0';
-  reply (500, "'%s': command not understood.", cbuf);
+
+  reply (500, "'%s': %s", cbuf, (s ? s : "command not understood."));
 }

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

Summary of changes:
 ChangeLog     |   19 +++++++++++++++++++
 ftpd/ftpcmd.y |   46 +++++++++++++++++++++++++++++++++-------------
 2 files changed, 52 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Oct 04 18:13:11 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VSDcV-0002is-5s
	for mharc-commit-inetutils@gnu.org; Fri, 04 Oct 2013 18:13:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58380)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSDcS-0002fI-2g
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 18:13:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSDcQ-0002GQ-Ps
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 18:13:08 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:42137)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSDcQ-0002GM-Ly
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 18:13:06 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VSDcQ-0002OV-7J
	for commit-inetutils@gnu.org; Fri, 04 Oct 2013 22:13:06 +0000
Date: Fri, 04 Oct 2013 22:13:06 +0000
Message-Id: <E1VSDcQ-0002OV-7J@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-6-g13a585a
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4
X-Git-Newrev: 13a585a09a9aedd20bcf1cbee3eeada1a10d0624
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, 04 Oct 2013 22:13:09 -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  13a585a09a9aedd20bcf1cbee3eeada1a10d0624 (commit)
      from  1d9298cfaf6dcc690ade8cbfa1a81bedd03197a4 (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=13a585a09a9aedd20bcf1cbee3eeada1a10d0624


commit 13a585a09a9aedd20bcf1cbee3eeada1a10d0624
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Oct 3 23:02:58 2013 +0200

    Minor issues during configuration.

diff --git a/ChangeLog b/ChangeLog
index bf3c796..0a4556c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-10-03  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* configure.ac (HAVE_SYSLOG_INTERNAL): Remove
+	a misplaced character.
+
+	* am/libcurses.m4 (IU_LIB_TERMCAP): Rework the
+	message in AC_MSG_CHECKING() and always call
+	AC_MSG_RESULT().
+
 2013-10-02  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftpd: Capture syntax errors.
diff --git a/am/libcurses.m4 b/am/libcurses.m4
index 962a6e6..a32ae89 100644
--- a/am/libcurses.m4
+++ b/am/libcurses.m4
@@ -96,8 +96,8 @@ AC_DEFUN([IU_LIB_TERMCAP], [
     dnl
     _IU_SAVE_LIBS=$LIBS
     AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap)
-    AC_MSG_CHECKING([where tgetent is declared])
-    location_tgetent=none
+    AC_MSG_CHECKING([whether tgetent needs support])
+    location_tgetent=no
     LIBS="$LIBS $LIBTERMCAP"
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([[#include <termcap.h>]],
@@ -116,10 +116,11 @@ AC_DEFUN([IU_LIB_TERMCAP], [
 	 location_tgetent=term.h])
       ])
     LIBS=$_IU_SAVE_LIBS
+    AC_MSG_RESULT($location_tgetent)
 
     if test "$ac_cv_lib_termcap_tgetent" = yes \
 	&& test "$ac_cv_have_decl_tgetent" = yes; then
-      AC_MSG_RESULT($location_tgetent)
+      :
     else
       AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses)
       AC_CHECK_DECLS([tgetent], , , [[#include <curses.h>
diff --git a/configure.ac b/configure.ac
index 4197de9..fc1194d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -870,7 +870,7 @@ IU_CHECK_MACRO(syslog internal macros,
   [LOG_PRI LOG_FAC],
   AC_CHECK_TYPE(CODE,
     AC_CHECK_DECL(prioritynames,
-      [§AC_DEFINE([HAVE_SYSLOG_INTERNAL], 1,
+      [AC_DEFINE([HAVE_SYSLOG_INTERNAL], 1,
         [Define to 1 if <syslog.h> defines prioritynames])], ,
       iu_syslog_includes), , iu_syslog_includes),)
 undefine([iu_syslog_includes])

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

Summary of changes:
 ChangeLog       |    9 +++++++++
 am/libcurses.m4 |    7 ++++---
 configure.ac    |    2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sun Oct 06 09:26:13 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VSoLd-0002WQ-JG
	for mharc-commit-inetutils@gnu.org; Sun, 06 Oct 2013 09:26:13 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55573)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSoLb-0002WJ-35
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 09:26:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSoLY-0003I6-N9
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 09:26:11 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:50448)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSoLY-0003Hj-J1
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 09:26:08 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VSoLX-0004Fi-IW
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 13:26:08 +0000
Date: Sun, 06 Oct 2013 13:26:07 +0000
Message-Id: <E1VSoLX-0004Fi-IW@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-7-g52e6331
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 13a585a09a9aedd20bcf1cbee3eeada1a10d0624
X-Git-Newrev: 52e6331fe7cc311fa53776cd94988f3cecad0728
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: Sun, 06 Oct 2013 13:26:12 -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  52e6331fe7cc311fa53776cd94988f3cecad0728 (commit)
      from  13a585a09a9aedd20bcf1cbee3eeada1a10d0624 (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=52e6331fe7cc311fa53776cd94988f3cecad0728


commit 52e6331fe7cc311fa53776cd94988f3cecad0728
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sun Oct 6 13:35:00 2013 +0200

    rexec, rexecd: Small changes.
    
    Turn echo off while reading password by rexec.

diff --git a/ChangeLog b/ChangeLog
index 0a4556c..13a82ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2013-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	rexec: No echoing of passwords.
+
+	* src/rexec.c: Include <termios.h>.
+	(main) <password is '-'>: Call isatty().  If this
+	is a terminal, print `Password:' and disable echo
+	while reading password string.
+	(do_rexec) <FD_ISSET(STDIN_FD)>: Write input from
+	client to the outgoing socket SOCK.  This restores
+	the ability to transfer contents to the server.
+
+
+	rexecd: Better adaption to BSD.
+
+	* configure.ac: Check for function setlogin.
+	* src/rexecd.c (doit) [HAVE_SETLOGIN]: Before
+	setting underpriviledged user, call setlogin().
+	(doit) <with error port && child process>:
+	Close PV[1], which is duplicate of stderr.
+	[HAVE_SETLOGIN]: Call setsid(), not setpgid().
+
 2013-10-03  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* configure.ac (HAVE_SYSLOG_INTERNAL): Remove
diff --git a/configure.ac b/configure.ac
index fc1194d..229f814 100644
--- a/configure.ac
+++ b/configure.ac
@@ -732,7 +732,7 @@ AC_CHECK_FUNCS(cfsetspeed cgetent dirfd fchdir flock \
                getcwd getmsg getpwuid_r getspnam getutxent getutxuser \
                initgroups initsetproctitle killpg \
                ptsname pututline pututxline \
-               setegid seteuid setpgid \
+               setegid seteuid setpgid setlogin \
                setsid setregid setreuid setresgid setresuid setutent_r \
                sigaction sigvec strchr setproctitle tcgetattr tzset utimes \
                utime uname \
diff --git a/src/rexec.c b/src/rexec.c
index 05e358a..bb222ee 100644
--- a/src/rexec.c
+++ b/src/rexec.c
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <termios.h>
 
 #include <sys/select.h>
 
@@ -188,7 +189,30 @@ main (int argc, char **argv)
       password[0] = '\0';
 
       alarm (15);
-      fgets (password, sizeof (password), stdin);
+
+      if (isatty (STDIN_FILENO))
+	{
+	  int changed = 0;
+	  struct termios tt, newtt;
+
+	  if (tcgetattr (STDIN_FILENO, &tt) >= 0)
+	    {
+	      memcpy (&newtt, &tt, sizeof (newtt));
+	      newtt.c_lflag &= ~ECHO;
+	      newtt.c_lflag |= ECHONL;
+	      if (tcsetattr (STDIN_FILENO, TCSANOW, &newtt))
+		error (0, errno, "failed to turn off echo");
+	      changed = 1;
+	    }
+
+	  printf ("Password: ");
+	  fgets (password, sizeof (password), stdin);
+
+	  if (changed && (tcsetattr (STDIN_FILENO, TCSANOW, &tt) < 0))
+	    error (0, errno, "failed to restore terminal");
+	}
+      else
+	fgets (password, sizeof (password), stdin);
       alarm (0);
 
       n = strlen (password);
@@ -391,7 +415,7 @@ do_rexec (struct arguments *arguments)
               continue;
             }
 
-          if (write (STDOUT_FILENO, buffer, err) < 0)
+          if (write (sock, buffer, err) < 0)
             error (EXIT_FAILURE, errno, "error writing");
         }
 
diff --git a/src/rexecd.c b/src/rexecd.c
index 360684b..4678380 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -439,6 +439,11 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
     }
 #endif /* WITH_PAM */
 
+#ifdef HAVE_SETLOGIN
+  if (setlogin (pwd->pw_name) < 0)
+    syslog (LOG_ERR, "setlogin() failed: %m");
+#endif
+
   /* Step down from superuser personality.
    *
    * The changing of group membership will seldomly
@@ -549,13 +554,20 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
 	    }
 	  while (FD_ISSET (pv[0], &readfrom) || FD_ISSET (s, &readfrom));
 	  exit (EXIT_SUCCESS);
-	}
-#ifdef HAVE_SETPGID
+	} /* Parent process.  */
+
+#ifdef HAVE_SETLOGIN
+      /* Not sufficient to call setpgid() on BSD systems.  */
+      if (setsid () < 0)
+	syslog (LOG_ERR, "setsid() failed: %m");
+#elif defined HAVE_SETPGID /* !HAVE_SETLOGIN */
       setpgid (0, getpid ());
 #endif
+
       close (s);
       close (pv[0]);
       dup2 (pv[1], STDERR_FILENO);
+      close (pv[1]);
     }
 
   if (f > 2)

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

Summary of changes:
 ChangeLog    |   22 ++++++++++++++++++++++
 configure.ac |    2 +-
 src/rexec.c  |   28 ++++++++++++++++++++++++++--
 src/rexecd.c |   16 ++++++++++++++--
 4 files changed, 63 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sun Oct 06 16:33:28 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VSv16-0002K9-9L
	for mharc-commit-inetutils@gnu.org; Sun, 06 Oct 2013 16:33:28 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43256)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSv11-0002Ib-8N
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 16:33:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSv0z-0003i3-4I
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 16:33:23 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:36777)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VSv0z-0003hw-0e
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 16:33:21 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VSv0y-0007yF-6v
	for commit-inetutils@gnu.org; Sun, 06 Oct 2013 20:33:20 +0000
Date: Sun, 06 Oct 2013 20:33:20 +0000
Message-Id: <E1VSv0y-0007yF-6v@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-8-g096ec84
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 52e6331fe7cc311fa53776cd94988f3cecad0728
X-Git-Newrev: 096ec84d46960adec56ed2d28eeda2fbd83cdb1f
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: Sun, 06 Oct 2013 20:33: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  096ec84d46960adec56ed2d28eeda2fbd83cdb1f (commit)
      from  52e6331fe7cc311fa53776cd94988f3cecad0728 (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=096ec84d46960adec56ed2d28eeda2fbd83cdb1f


commit 096ec84d46960adec56ed2d28eeda2fbd83cdb1f
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sun Oct 6 21:25:06 2013 +0200

    rsh, rshd: Minor issues.
    
    Properly implement null-input in rsh client.

diff --git a/ChangeLog b/ChangeLog
index 13a82ae..35ca670 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,30 @@
 2013-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	rsh: Detach input stream.
+	The option `-n/--no-input' was incomplete.
+
+	* src/rsh.c (main) <try_connect && null_input_option>:
+	Call shutdown(SHUT_WR) on socket REM.
+	(talk): Use symbolic macro SHUT_WR in shutdown().
+
+	* doc/inetutils.texi (rsh invocation) <option '-n'>:
+	Give an accurate description, forgetting about stderr.
+
+
+	rshd: Better adaption to BSD.
+
+	* src/rshd.c (doit): Use SHUT_RDWR in shutdown().
+	(doit) [SHISHI] <verify checksum>: Rename local PORT
+	to PPORT, since is shadows a variable of wider scope.
+	(doit): Delay the call of setpgid() to also execute
+	in the child process when PAM is supported.
+	(doit) [HAVE_SETLOGIN]: Call setsid() and setlogin().
+	Replace conditional `BSD > 43' with HAVE_SETLOGIN for
+	better precision.
+	[!HAVE_SETLOGIN]: Keep old call to setpgid().
+
+2013-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	rexec: No echoing of passwords.
 
 	* src/rexec.c: Include <termios.h>.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 80c6cda..fe5b016 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -2276,8 +2276,10 @@ whenever available, and authorization is determined as in @command{rlogin}
 @itemx --no-input
 @opindex -n
 @opindex --no-input
-Use @file{/dev/null} for all input, and use no separate @samp{stderr}
-at remote end.  This option is void together with encryption.
+Use @file{/dev/null} for all input, telling the server side that
+we send no material.  This can prevent the remote process from
+blocking, should it optionally accept more input.
+The option is void together with encryption.
 @end table
 
 @noindent
diff --git a/src/rsh.c b/src/rsh.c
index d17bbad..bf3b47c 100644
--- a/src/rsh.c
+++ b/src/rsh.c
@@ -551,7 +551,12 @@ try_connect:
   if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
     signal (SIGTERM, sendsig);
 
-  if (!null_input_option)
+  if (null_input_option)
+    /* Nothing from stdin will be written to the socket,
+     * but we still expect response from the server.
+     */
+    shutdown (rem, SHUT_WR);
+  else
     {
       pid = fork ();
       if (pid < 0)
@@ -649,7 +654,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
 	goto reread;
       goto rewrite;
     done:
-      shutdown (rem, 1);
+      shutdown (rem, SHUT_WR);
       exit (EXIT_SUCCESS);
     }
 
diff --git a/src/rshd.c b/src/rshd.c
index 4751b1f..cde8dca 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -631,7 +631,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	{
 	  if (cc < 0)
 	    syslog (LOG_NOTICE, "read: %m");
-	  shutdown (sockfd, 2);
+	  shutdown (sockfd, SHUT_RDWR);
 	  exit (EXIT_FAILURE);
 	}
       /* null byte terminates the string */
@@ -1085,7 +1085,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 
     /* verify checksum */
     {
-      unsigned short port;
+      unsigned short pport;
 
       socklen = sizeof (sock);
       if (getsockname (STDIN_FILENO, (struct sockaddr *)&sock, &socklen) < 0)
@@ -1094,11 +1094,11 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	  exit (EXIT_FAILURE);
 	}
 
-      port = (sock.ss_family == AF_INET6)
-	     ? ((struct sockaddr_in6 *) &sock)->sin6_port
-	     : ((struct sockaddr_in *) &sock)->sin_port;
+      pport = (sock.ss_family == AF_INET6)
+	      ? ((struct sockaddr_in6 *) &sock)->sin6_port
+	      : ((struct sockaddr_in *) &sock)->sin_port;
 
-      snprintf (cksumdata, 100, "%u:%s%s", ntohs (port), cmdbuf, locuser);
+      snprintf (cksumdata, 100, "%u:%s%s", ntohs (pport), cmdbuf, locuser);
     }
 
     rc = shishi_checksum (h, enckey, 0, cksumtype,
@@ -1665,7 +1665,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 		  cc = read (pv[0], buf, sizeof buf);
 		  if (cc <= 0)
 		    {
-		      shutdown (s, 1 + 1);
+		      shutdown (s, SHUT_RDWR);
 		      FD_CLR (pv[0], &readfrom);
 		    }
 		  else
@@ -1692,7 +1692,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 		  cc = read (pv1[0], buf, sizeof (buf));
 		  if (cc <= 0)
 		    {
-		      shutdown (pv1[0], 1 + 1);
+		      shutdown (pv1[0], SHUT_RDWR);
 		      FD_CLR (pv1[0], &readfrom);
 		    }
 		  else
@@ -1714,7 +1714,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 #  endif
 		  if (cc <= 0)
 		    {
-		      shutdown (pv2[0], 1 + 1);
+		      shutdown (pv2[0], SHUT_RDWR);
 		      FD_CLR (pv2[0], &writeto);
 		    }
 		  else
@@ -1749,15 +1749,8 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 #endif /* WITH_PAM */
 
 	  exit (EXIT_SUCCESS);
-	}
+	} /* Parent process ends.  */
 
-      /* Child process. Become a process group leader, so that
-       * the control process above can send signals to all the
-       * processes we may be the parent of.  The process group ID
-       * (the getpid() value below) equals the childpid value from
-       * the fork above.
-       */
-      setpgid (0, getpid ());
       close (s);		/* control process handles this fd */
       close (pv[0]);		/* close read end of pipe */
 #ifdef ENCRYPTION
@@ -1829,17 +1822,31 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
 	  pam_end (pam_handle, pam_rc);
 
 	  exit (WIFEXITED (status) ? WEXITSTATUS (status) : EXIT_FAILURE);
-	}
+	} /* Parent process ends.  */
     }
 #endif /* WITH_PAM */
 
-  if (*pwd->pw_shell == '\0')
-    pwd->pw_shell = PATH_BSHELL;
-#if BSD > 43
+  /* Child process, with and without handler for stderr.
+   * Become a process group leader, so that the control
+   * process above can send signals to all the processes
+   * we may be the parent of.  The process group ID
+   * (the getpid() value below) equals the childpid value
+   * from the fork above.
+   */
+#ifdef HAVE_SETLOGIN
+  /* Not sufficient to call setpgid() on BSD systems.  */
+  if (setsid () < 0)
+    syslog (LOG_ERR, "setsid() failed: %m");
+
   if (setlogin (pwd->pw_name) < 0)
     syslog (LOG_ERR, "setlogin() failed: %m");
+#else /* !HAVE_SETLOGIN */
+  setpgid (0, getpid ());
 #endif
 
+  if (*pwd->pw_shell == '\0')
+    pwd->pw_shell = PATH_BSHELL;
+
   /* Set the gid, then uid to become the user specified by "locuser" */
   setegid ((gid_t) pwd->pw_gid);
   setgid ((gid_t) pwd->pw_gid);

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

Summary of changes:
 ChangeLog          |   25 +++++++++++++++++++++++++
 doc/inetutils.texi |    6 ++++--
 src/rsh.c          |    9 +++++++--
 src/rshd.c         |   49 ++++++++++++++++++++++++++++---------------------
 4 files changed, 64 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Oct 16 14:25:19 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VWVmZ-0000XR-Qg
	for mharc-commit-inetutils@gnu.org; Wed, 16 Oct 2013 14:25:19 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41594)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWVmV-0000VK-RG
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 14:25:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWVmT-0001n3-Ki
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 14:25:15 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:33141)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWVmT-0001mx-Cj
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 14:25:13 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VWVmN-0007dJ-NA
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 18:25:09 +0000
Date: Wed, 16 Oct 2013 18:25:07 +0000
Message-Id: <E1VWVmN-0007dJ-NA@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-9-g807de6d
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 096ec84d46960adec56ed2d28eeda2fbd83cdb1f
X-Git-Newrev: 807de6dd3342a98ed655e0cae783d34e6c9c6ad5
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, 16 Oct 2013 18:25: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  807de6dd3342a98ed655e0cae783d34e6c9c6ad5 (commit)
      from  096ec84d46960adec56ed2d28eeda2fbd83cdb1f (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=807de6dd3342a98ed655e0cae783d34e6c9c6ad5


commit 807de6dd3342a98ed655e0cae783d34e6c9c6ad5
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Oct 16 19:32:06 2013 +0200

    rsh: Kill child process after SIGPIPE.
    
    The default action for SIGPIPE causes the child
    process to remain as an orphaned process, stealing
    stdin from the command line.

diff --git a/ChangeLog b/ChangeLog
index 35ca670..6a3872b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-10-16  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	rsh: Kill child process after SIGPIPE.
+	The default action for SIGPIPE will leave the
+	child process running.  This caused, until now
+	and including legacy implementations, blocking
+	of stdin, and to conditionally leave also the
+	remote server running.
+
+	* src/rsh.c (end_of_pipe): New variable.
+	(sigpipe): New function.
+	(talk) [HAVE_SIGACTION]: New variable SA.
+	<parent process>: Assign a signal handler to SIGPIPE.
+	Add `&& !end_of_pipe' to the loop condition, so that
+	talk() returns after SIGPIPE.  The child process will
+	then be killed at the end of main().
+
 2013-10-06  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rsh: Detach input stream.
diff --git a/src/rsh.c b/src/rsh.c
index bf3b47c..87356f2 100644
--- a/src/rsh.c
+++ b/src/rsh.c
@@ -126,9 +126,11 @@ int wlen;
  * rsh - remote shell
  */
 int rfd2;
+int end_of_pipe = 0;		/* Used by parent process.  */
 
 char *copyargs (char **);
 void sendsig (int);
+void sigpipe (int);
 void talk (int, sigset_t *, pid_t, int);
 void warning (const char *, ...);
 
@@ -607,6 +609,9 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
   int cc, wc;
   fd_set readfrom, ready, rembits;
   char *bp, buf[BUFSIZ];
+#ifdef HAVE_SIGACTION
+  struct sigaction sa;
+#endif
 
   if (!null_input_option && pid == 0)
     {
@@ -660,9 +665,23 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
 
 #ifdef HAVE_SIGACTION
   sigprocmask (SIG_SETMASK, osigs, NULL);
-#else
+#else /* !HAVE_SIGACTION */
   sigsetmask (*osigs);
 #endif
+
+  /* The access to SIGPIPE is neeeded to kill the child process
+   * in an orderly fashion, for example when a command line
+   * pipe fails.  Otherwise the child lives on eternally.
+   */
+#ifdef HAVE_SIGACTION
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_RESTART;
+  sa.sa_handler = sigpipe;
+  (void) sigaction (SIGPIPE, &sa, NULL);
+#else /* !HAVE_SIGACTION */
+  signal (SIGPIPE, sigpipe);
+#endif
+
   FD_ZERO (&readfrom);
   FD_SET (rfd2, &readfrom);
   FD_SET (rem, &readfrom);
@@ -725,7 +744,8 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
 	    write (1, buf, cc);
 	}
     }
-  while (FD_ISSET (rfd2, &readfrom) || FD_ISSET (rem, &readfrom));
+  while ((FD_ISSET (rfd2, &readfrom) || FD_ISSET (rem, &readfrom))
+	 && !end_of_pipe);
 }
 
 void
@@ -753,6 +773,12 @@ sendsig (int sig)
     write (rfd2, &signo, 1);
 }
 
+void
+sigpipe (int sig _GL_UNUSED_PARAMETER)
+{
+  ++end_of_pipe;
+}
+
 #if defined KERBEROS || defined SHISHI
 void
 warning (const char *fmt, ...)

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

Summary of changes:
 ChangeLog |   17 +++++++++++++++++
 src/rsh.c |   30 ++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Oct 16 18:08:19 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1VWZGM-0008Ro-VP
	for mharc-commit-inetutils@gnu.org; Wed, 16 Oct 2013 18:08:18 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34009)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWZGK-0008RU-7p
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 18:08:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWZGI-0003yL-Qf
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 18:08:16 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:45498)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1VWZGI-0003yH-NR
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 18:08:14 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1VWZGI-0000Tt-5J
	for commit-inetutils@gnu.org; Wed, 16 Oct 2013 22:08:14 +0000
Date: Wed, 16 Oct 2013 22:08:14 +0000
Message-Id: <E1VWZGI-0000Tt-5J@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1_100-10-gf475b43
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 807de6dd3342a98ed655e0cae783d34e6c9c6ad5
X-Git-Newrev: f475b43550975cf05f7a06c35b0e4d0506d47c5f
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, 16 Oct 2013 22:08: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  f475b43550975cf05f7a06c35b0e4d0506d47c5f (commit)
      from  807de6dd3342a98ed655e0cae783d34e6c9c6ad5 (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=f475b43550975cf05f7a06c35b0e4d0506d47c5f


commit f475b43550975cf05f7a06c35b0e4d0506d47c5f
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Oct 16 22:54:01 2013 +0200

    Act on failed read_utmp.
    
    A failed call to read_utmp() is very rare,
    but is best checked none the less.

diff --git a/ChangeLog b/ChangeLog
index 6a3872b..d954b04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2013-10-16  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	syslogd, talkd: Act on failed read_utmp.
+
+	* src/syslogd.c (wallmsg)
+	[UTMP_NAME_FUNCTION || !HAVE_GETUTXENT]: Check call
+	to read_utmp() for failure, filing an error massage.
+	* talkd/process.c (find_user) [!HAVE_GETUTXUSER]:
+	Likewise, then returning FAILED.
+
+	rsh: Symbolic descriptor name.
+
+	* src/rsh.d (talk): Use STDOUT_FILENO and STDERR_FILENO
+	as arguments to write().
+
+2013-10-16  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	rsh: Kill child process after SIGPIPE.
 	The default action for SIGPIPE will leave the
 	child process running.  This caused, until now
diff --git a/src/rsh.c b/src/rsh.c
index 87356f2..6f63118 100644
--- a/src/rsh.c
+++ b/src/rsh.c
@@ -718,7 +718,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
 		FD_CLR (rfd2, &readfrom);
 	    }
 	  else
-	    write (2, buf, cc);
+	    write (STDERR_FILENO, buf, cc);
 	}
       if (FD_ISSET (rem, &ready))
 	{
@@ -741,7 +741,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem)
 		FD_CLR (rem, &readfrom);
 	    }
 	  else
-	    write (1, buf, cc);
+	    write (STDOUT_FILENO, buf, cc);
 	}
     }
   while ((FD_ISSET (rfd2, &readfrom) || FD_ISSET (rem, &readfrom))
diff --git a/src/syslogd.c b/src/syslogd.c
index 7af10f3..fd77aed 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1603,8 +1603,12 @@ wallmsg (struct filed *f, struct iovec *iov)
 
   while ((utp = getutxent ()))
 #else /* UTMP_NAME_FUNCTION || !HAVE_GETUTXENT */
-  read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
-	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
+  if (read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
+		 READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS) < 0)
+    {
+      logerror ("opening utmp file");
+      return;
+    }
 
   for (utp = utmpbuf; utp < utmpbuf + utmp_count; utp++)
 #endif /* UTMP_NAME_FUNCTION || !HAVE_GETUTXENT */
@@ -2179,7 +2183,7 @@ cfline (const char *line, struct filed *f)
 	      selector ? " tagged " : "",
 	      selector ? selector : "");
 
-  errno = 0;			/* keep strerror() stuff out of logerror messages */
+  errno = 0;	/* keep strerror() stuff out of logerror messages */
 
   /* Clear out file entry.  */
   memset (f, 0, sizeof (*f));
diff --git a/talkd/process.c b/talkd/process.c
index e70172c..9dd1b9e 100644
--- a/talkd/process.c
+++ b/talkd/process.c
@@ -217,8 +217,9 @@ find_user (char *name, char *tty)
 
   while ((uptr = getutxuser (name)))
 #else /* !HAVE_GETUTXUSER */
-  read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
-	     READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS);
+  if (read_utmp (UTMP_FILE, &utmp_count, &utmpbuf,
+		 READ_UTMP_USER_PROCESS | READ_UTMP_CHECK_PIDS) < 0)
+    return FAILED;
 
   for (uptr = utmpbuf; uptr < utmpbuf + utmp_count; uptr++)
     {

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

Summary of changes:
 ChangeLog       |   15 +++++++++++++++
 src/rsh.c       |    4 ++--
 src/syslogd.c   |   10 +++++++---
 talkd/process.c |    5 +++--
 4 files changed, 27 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


