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-232-g894c3


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-232-g894c336
Date: Tue, 08 Jan 2013 20:56: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  894c336937692e1813aab50348c10686df37518e (commit)
      from  19c966ef509931470c379f8e15da511a19bbf8f2 (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=894c336937692e1813aab50348c10686df37518e


commit 894c336937692e1813aab50348c10686df37518e
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Jan 7 23:51:51 2013 +0100

    tftpd: Error handling.

diff --git a/ChangeLog b/ChangeLog
index ccc45e0..8ec09ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-07  Mats Erik Andersson  <address@hidden>
+
+       tftpd: Error handling.
+       Send NAK on error conditions in chrooted mode,
+       preventing the client from hanging indefinitely.
+
+       * src/tftpd.c (main): Send NAK with ENOUSER as
+       response, should chrooted mode specify non-existent
+       user or group.  Likewise when setgid() or setuid()
+       fails.  Send NAK with EACCESS, should chroot() fail.
+       (usage_str, usage): Remove unused constructs.
+
 2013-01-05  Mats Erik Andersson  <address@hidden>
 
        tftpd: Group setting.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index e13a5c7..954c2b9 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -3695,7 +3695,7 @@ for a read request, or a write request, to succeed.
 The standard use case is an entry in @file{/etc/inetd.conf} like
 
 @example
-tftp dgram udp4 wait root nobody /usr/sbin/tftpd \
+tftp dgram udp4 wait root /usr/sbin/tftpd \
 @verb{        } tftpd /tftpboot /altboot
 @end example
 
@@ -3720,7 +3720,7 @@ meaning that the serving process is running in a chrooted 
mode.
 Then a suitable configuration could be
 
 @example
-tftp dgram udp4 wait root nobody /usr/sbin/tftpd \
+tftp dgram udp4 wait root /usr/sbin/tftpd \
 @verb{        } tftpd --secure-dir=/srv/tftp-root  /tftpboot /altboot
 @end example
 
diff --git a/src/tftpd.c b/src/tftpd.c
index 7f078ee..2492f3e 100644
--- a/src/tftpd.c
+++ b/src/tftpd.c
@@ -90,8 +90,6 @@
 #include <progname.h>
 #include <libinetutils.h>
 
-void usage (void);
-
 #define TIMEOUT                5
 
 #ifndef LOG_FTP
@@ -352,6 +350,7 @@ main (int argc, char *argv[])
          if (!pwd)
            {
              syslog (LOG_ERR, "getpwnam('%s'): %m", user);
+             nak (ENOUSER);
              exit (EXIT_FAILURE);
            }
 
@@ -365,6 +364,7 @@ main (int argc, char *argv[])
              if (!grp)
                {
                  syslog (LOG_ERR, "getgrnam('%s'): %m", group);
+                 nak (ENOUSER);
                  exit (EXIT_FAILURE);
                }
            }
@@ -373,6 +373,7 @@ main (int argc, char *argv[])
       if (chroot (chrootdir) || chdir ("/"))
        {
          syslog (LOG_ERR, "chroot('%s'): %m", chrootdir);
+         nak (EACCESS);
          exit (EXIT_FAILURE);
        }
 
@@ -383,6 +384,7 @@ main (int argc, char *argv[])
              if (setgid (grp->gr_gid))
                {
                  syslog (LOG_ERR, "setgid: %m");
+                 nak (ENOUSER);
                  exit (EXIT_FAILURE);
                }
            }
@@ -391,6 +393,7 @@ main (int argc, char *argv[])
              if (setgid (pwd->pw_gid))
                {
                  syslog (LOG_ERR, "setgid: %m");
+                 nak (ENOUSER);
                  exit (EXIT_FAILURE);
                }
            }
@@ -398,6 +401,7 @@ main (int argc, char *argv[])
          if (setuid (pwd->pw_uid))
            {
              syslog (LOG_ERR, "setuid: %m");
+             nak (ENOUSER);
              exit (EXIT_FAILURE);
            }
        }
@@ -884,19 +888,3 @@ verifyhost (struct sockaddr_storage *fromp, socklen_t 
frlen)
       return "0.0.0.0";
     }
 }
-
-static const char usage_str[] =
-  "Usage: tftpd [OPTIONS...]\n"
-  "\n"
-  "Options are:\n"
-  "   -l                      Enable logging\n"
-  "   -n                      Supress negative acknowledgement of\n"
-  "                           requests for nonexistent relative filenames\n"
-  "       --help              Display usage instructions\n"
-  "       --version           Display program version\n";
-
-void
-usage (void)
-{
-  printf ("%s\n" "Send bug reports to <%s>\n", usage_str, PACKAGE_BUGREPORT);
-}

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

Summary of changes:
 ChangeLog          |   12 ++++++++++++
 doc/inetutils.texi |    4 ++--
 src/tftpd.c        |   24 ++++++------------------
 3 files changed, 20 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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