commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1_100-8-g096


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1_100-8-g096ec84
Date: Sun, 06 Oct 2013 20:33:20 +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 <address@hidden>
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  <address@hidden>
 
+       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  <address@hidden>
+
        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 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]