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-14-gfa


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1_100-14-gfa00853
Date: Wed, 27 Nov 2013 17:17:18 +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  fa0085314a98c2acce9a5a99116f829c4a46f742 (commit)
       via  7123f5cbf232992fe9365c67537af91766046af9 (commit)
      from  2d4d6b7a24252f463bef8413ab2dffc9cac621e0 (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=fa0085314a98c2acce9a5a99116f829c4a46f742


commit fa0085314a98c2acce9a5a99116f829c4a46f742
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Nov 25 00:02:00 2013 +0100

    inetd: Ensure successful daemon mode.
    
    Check all remaining calls to chdir.

diff --git a/ChangeLog b/ChangeLog
index a30dc39..f03aa11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-11-24  Mats Erik Andersson  <address@hidden>
+
+       inetd: Ensure successful daemon mode.
+
+       * src/inetd.c (main) <!debug>: Abort with a syslog message,
+       should daemon() return unsuccessfully.
+       * libinetutils/damon.c (waitdaemon): Return with failure,
+       should chdir("/") fail.
+
+
+       Check all calls to chdir.
+
+       * src/rshd.c (doit): Make a syslog error message and abort
+       execution, should chdir("/") fail.
+       * src/uucpd.c (doit): Abort with a message to stderr,
+       should chdir("/") fail.
+
 2013-11-23  Mats Erik Andersson  <address@hidden>
 
        Check all returns from fgets.
diff --git a/libinetutils/daemon.c b/libinetutils/daemon.c
index af4a383..5c8b739 100644
--- a/libinetutils/daemon.c
+++ b/libinetutils/daemon.c
@@ -166,8 +166,8 @@ waitdaemon (int nochdir, int noclose, int maxwait)
       _exit (EXIT_SUCCESS);
     }
 
-  if (!nochdir)
-    chdir ("/");
+  if (!nochdir && chdir ("/") < 0)
+    return -1;                 /* Unlikely failure, but check it.  */
 
   if (!noclose)
     {
diff --git a/src/inetd.c b/src/inetd.c
index bd67e9a..7d1cd5e 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1938,7 +1938,12 @@ main (int argc, char *argv[], char *envp[])
 
   if (!debug)
     {
-      daemon (0, 0);
+      if (daemon (0, 0) < 0)
+       {
+         syslog (LOG_DAEMON | LOG_ERR,
+                 "%s: Unable to enter daemon mode, %m", argv[0]);
+         exit (EXIT_FAILURE);
+       };
     }
 
   openlog ("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
diff --git a/src/rshd.c b/src/rshd.c
index cde8dca..4dc6f50 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -1880,11 +1880,18 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t 
fromlen)
    */
   if (chdir (pwd->pw_dir) < 0)
     {
-      chdir ("/");
       syslog (LOG_INFO | LOG_AUTH,
              "address@hidden as %s: no home directory. cmd='%.80s'", remuser,
              hostname, locuser, cmdbuf);
       rshd_error ("No remote directory.\n");
+
+      if (chdir ("/") < 0)
+       {
+         syslog (LOG_ERR | LOG_AUTH,
+                 "address@hidden as %s: access denied to '/'",
+                 remuser, hostname, locuser);
+         exit (EXIT_FAILURE);
+       }
     }
 
   /* Set up an initial environment for the shell that we exec() */
diff --git a/src/uucpd.c b/src/uucpd.c
index 4467d6c..1c898eb 100644
--- a/src/uucpd.c
+++ b/src/uucpd.c
@@ -258,7 +258,11 @@ doit (struct sockaddr *sap, socklen_t salen)
 #ifdef HAVE_INITGROUPS
   initgroups (pw->pw_name, pw->pw_gid);
 #endif
-  chdir (pw->pw_dir);
+  if (chdir (pw->pw_dir) < 0)
+    {
+      fprintf (stderr, "Login incorrect.");
+      return;
+    }
   setuid (pw->pw_uid);
   execl (uucico_location, "uucico", NULL);
   perror ("uucico server: execl");

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=7123f5cbf232992fe9365c67537af91766046af9


commit 7123f5cbf232992fe9365c67537af91766046af9
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Nov 23 23:57:17 2013 +0100

    Check all returns from fgets.

diff --git a/ChangeLog b/ChangeLog
index 2a1f676..a30dc39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-11-23  Mats Erik Andersson  <address@hidden>
+
+       Check all returns from fgets.
+       Handle every failed fgets() with care.
+
+       * ftp/cmds.c (user): Set account string to empty when
+       fgets() fails.
+       * src/rexec.c (main): Likewise for password string.
+       * src/tftp.c (get_args): Call makeargv() only on successful
+       call to fgets().  Otherwise, instantiate a trivial command
+       list containing command name only.
+       * telnet/commands.c (setescape): Leave escape character
+       unchanged when fgets() fails.
+       (tn) <get host>: Call makeargv() only for successful fgets().
+       Otherwise, print a message and rely on later usage printout.
+       (command): Print a line feed at EOF on stream error.
+
 2013-11-15  Mats Erik Andersson  <address@hidden>
 
        tftp: Buffer size checking.
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 15ecefc..52da092 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -1695,8 +1695,10 @@ user (int argc, char **argv)
        {
          printf ("Account: ");
          fflush (stdout);
-         fgets (acct, sizeof (acct) - 1, stdin);
-         acct[strlen (acct) - 1] = '\0';
+         if (fgets (acct, sizeof (acct) - 1, stdin))
+           acct[strlen (acct) - 1] = '\0';     /* Erase newline.  */
+         else
+           acct[0] = '\0';                     /* Set empty name.  */
          argv[3] = acct;
          argc++;
        }
diff --git a/src/rexec.c b/src/rexec.c
index bb222ee..a5bcae7 100644
--- a/src/rexec.c
+++ b/src/rexec.c
@@ -206,13 +206,14 @@ main (int argc, char **argv)
            }
 
          printf ("Password: ");
-         fgets (password, sizeof (password), stdin);
+         if (fgets (password, sizeof (password), stdin) == NULL)
+           password[0] = '\0';
 
          if (changed && (tcsetattr (STDIN_FILENO, TCSANOW, &tt) < 0))
            error (0, errno, "failed to restore terminal");
        }
-      else
-       fgets (password, sizeof (password), stdin);
+      else if (fgets (password, sizeof (password), stdin) == NULL)
+       password[0] = '\0';
       alarm (0);
 
       n = strlen (password);
diff --git a/src/tftp.c b/src/tftp.c
index f50abc1..d668075 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -404,11 +404,17 @@ get_args (char *arg0, char *prompt, int *argc, char 
***argv)
   strcat (line, " ");
 
   printf ("%s", prompt);
-  fgets (line + arg0_len + 1, sizeof line - arg0_len - 1, stdin);
-
-  makeargv ();
-  *argc = margc;
-  *argv = margv;
+  if (fgets (line + arg0_len + 1, sizeof line - arg0_len - 1, stdin))
+    {
+      makeargv ();
+      *argc = margc;
+      *argv = margv;
+    }
+  else
+    {
+      *argv[0] = arg0;
+      *argc = 1;               /* Will produce a usage printout.  */
+    }
 }
 
 void
diff --git a/telnet/commands.c b/telnet/commands.c
index f0307f7..25ed235 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -1505,7 +1505,11 @@ setescape (int argc, char *argv[])
   else
     {
       printf ("new escape character: ");
-      fgets (buf, sizeof (buf), stdin);
+      if (fgets (buf, sizeof (buf), stdin) == NULL)
+       {
+         buf[0] = '\0';
+         printf ("\n");
+       }
       arg = buf;
     }
   if (arg[0] != '\0')
@@ -2472,10 +2476,15 @@ tn (int argc, char *argv[])
     {
       strcpy (line, "open ");
       printf ("(to) ");
-      fgets (&line[strlen (line)], sizeof (line) - strlen (line), stdin);
-      makeargv ();
-      argc = margc;
-      argv = margv;
+      if (fgets (&line[strlen (line)],
+                sizeof (line) - strlen (line), stdin))
+       {
+         makeargv ();
+         argc = margc;
+         argv = margv;
+       }
+      else
+       printf ("?Name of host was not understood.\n");
     }
   cmd = *argv;
   --argc;
@@ -2967,6 +2976,7 @@ command (int top, char *tbuf, int cnt)
            {
              if (feof (stdin) || ferror (stdin))
                {
+                 printf ("\n");
                  quit ();
                }
              break;

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

Summary of changes:
 ChangeLog             |   34 ++++++++++++++++++++++++++++++++++
 ftp/cmds.c            |    6 ++++--
 libinetutils/daemon.c |    4 ++--
 src/inetd.c           |    7 ++++++-
 src/rexec.c           |    7 ++++---
 src/rshd.c            |    9 ++++++++-
 src/tftp.c            |   16 +++++++++++-----
 src/uucpd.c           |    6 +++++-
 telnet/commands.c     |   20 +++++++++++++++-----
 9 files changed, 89 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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