packages: tftp-hpa/tftp-hpa.spec, tftp-hpa/tftp-0.40-remap.patch (NEW), tft...

arekm arekm at pld-linux.org
Wed Mar 14 19:05:39 CET 2012


Author: arekm                        Date: Wed Mar 14 18:05:39 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 2; patches from FC

---- Files affected:
packages/tftp-hpa:
   tftp-hpa.spec (1.62 -> 1.63) , tftp-0.40-remap.patch (NONE -> 1.1)  (NEW), tftp-0.42-tftpboot.patch (NONE -> 1.1)  (NEW), tftp-0.49-chk_retcodes.patch (NONE -> 1.1)  (NEW), tftp-0.49-cmd_arg.patch (NONE -> 1.1)  (NEW), tftp-hpa-0.39-tzfix.patch (NONE -> 1.1)  (NEW), tftp-hpa-0.49-fortify-strcpy-crash.patch (NONE -> 1.1)  (NEW), tftp-hpa-0.49-stats.patch (NONE -> 1.1)  (NEW), tftp-hpa-5.2-pktinfo.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/tftp-hpa/tftp-hpa.spec
diff -u packages/tftp-hpa/tftp-hpa.spec:1.62 packages/tftp-hpa/tftp-hpa.spec:1.63
--- packages/tftp-hpa/tftp-hpa.spec:1.62	Sat Dec 31 12:39:44 2011
+++ packages/tftp-hpa/tftp-hpa.spec	Wed Mar 14 19:05:33 2012
@@ -6,7 +6,7 @@
 Summary(tr.UTF-8):	İlkel dosya aktarım protokolu (TFTP) için sunucu ve istemci
 Name:		tftp-hpa
 Version:	5.2
-Release:	1
+Release:	2
 License:	BSD
 Group:		Applications/Networking
 Source0:	ftp://ftp.kernel.org/pub/software/network/tftp/tftp-hpa/%{name}-%{version}.tar.xz
@@ -14,6 +14,15 @@
 Source1:	tftpd-hpa.inetd
 Source2:	tftpd-hpa.init
 Source3:	tftpd-hpa.sysconfig
+# from FC
+Patch0:		tftp-0.40-remap.patch
+Patch1:		%{name}-0.39-tzfix.patch
+Patch2:		tftp-0.42-tftpboot.patch
+Patch3:		tftp-0.49-chk_retcodes.patch
+Patch4:		%{name}-0.49-fortify-strcpy-crash.patch
+Patch5:		tftp-0.49-cmd_arg.patch
+Patch6:		%{name}-0.49-stats.patch
+Patch7:		%{name}-5.2-pktinfo.patch
 URL:		http://freshmeat.net/projects/tftp-hpa/
 BuildRequires:	readline-devel
 BuildRequires:	rpmbuild(macros) >= 1.268
@@ -87,8 +96,8 @@
 Summary:	inetd configs for tftpd-hpa
 Summary(pl.UTF-8):	Pliki konfiguracyjne do użycia tftpd-hpa poprzez inetd
 Group:		Networking/Daemons/FTP
-Requires:	tftpd-hpa-common = %{version}-%{release}
 Requires:	rc-inetd >= 0.8.1
+Requires:	tftpd-hpa-common = %{version}-%{release}
 Provides:	tftpdaemon
 Obsoletes:	atftpd
 Obsoletes:	inetutils-tftpd
@@ -107,8 +116,8 @@
 Summary:	Standalone daemon configs for tftpd-hpa
 Summary(pl.UTF-8):	Pliki konfiguracyjne do startowania tftpd-hpa w trybie standalone
 Group:		Networking/Daemons/FTP
-Requires:	tftpd-hpa-common = %{version}-%{release}
 Requires:	rc-scripts
+Requires:	tftpd-hpa-common = %{version}-%{release}
 Provides:	tftpdaemon
 Obsoletes:	atftpd
 Obsoletes:	inetutils-tftpd
@@ -126,6 +135,14 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .zero
+%patch1 -p1 -b .tzfix
+%patch2 -p1 -b .tftpboot
+%patch3 -p1 -b .chk_retcodes
+%patch4 -p1 -b .fortify-strcpy-crash
+%patch5 -p1 -b .cmd_arg
+%patch6 -p1 -b .stats
+%patch7 -p1 -b .pktinfo
 
 %build
 %configure
@@ -207,6 +224,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.63  2012/03/14 18:05:33  arekm
+- rel 2; patches from FC
+
 Revision 1.62  2011/12/31 11:39:44  adamg
 - updated to 5.2
 

================================================================
Index: packages/tftp-hpa/tftp-0.40-remap.patch
diff -u /dev/null packages/tftp-hpa/tftp-0.40-remap.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-0.40-remap.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,19 @@
+diff -up tftp-hpa-0.49/tftpd/remap.c.zero tftp-hpa-0.49/tftpd/remap.c
+--- tftp-hpa-0.49/tftpd/remap.c.zero	2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftpd/remap.c	2008-11-25 11:41:09.000000000 -0500
+@@ -286,6 +286,7 @@ struct rule *parserulefile(FILE * f)
+     int lineno = 0;
+     int err = 0;
+ 
++    memset(this_rule, '\0', sizeof(struct rule));
+     while (lineno++, fgets(line, MAXLINE, f)) {
+         rv = parseline(line, this_rule, lineno);
+         if (rv < 0)
+@@ -294,6 +295,7 @@ struct rule *parserulefile(FILE * f)
+             *last_rule = this_rule;
+             last_rule = &this_rule->next;
+             this_rule = tfmalloc(sizeof(struct rule));
++            memset(this_rule, '\0', sizeof(struct rule));
+         }
+     }
+ 

================================================================
Index: packages/tftp-hpa/tftp-0.42-tftpboot.patch
diff -u /dev/null packages/tftp-hpa/tftp-0.42-tftpboot.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-0.42-tftpboot.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,54 @@
+diff -up tftp-hpa-0.48/tftp-xinetd.tftpboot tftp-hpa-0.48/tftp-xinetd
+--- tftp-hpa-0.48/tftp-xinetd.tftpboot	2007-01-31 00:51:05.000000000 +0100
++++ tftp-hpa-0.48/tftp-xinetd	2008-05-20 12:05:53.000000000 +0200
+@@ -10,7 +10,7 @@ service tftp
+ 	wait			= yes
+ 	user			= root
+ 	server			= /usr/sbin/in.tftpd
+-	server_args		= -s /tftpboot
++	server_args		= -s /var/lib/tftpboot
+ 	disable			= yes
+ 	per_source		= 11
+ 	cps			= 100 2
+diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security
+--- tftp-hpa-0.48/README.security.tftpboot	2008-05-29 17:36:32.000000000 +0200
++++ tftp-hpa-0.48/README.security	2008-05-29 17:37:21.000000000 +0200
+@@ -17,10 +17,10 @@ probably the following:
+ 
+ 1. Create a separate "tftpd" user and group only used for tftpd;
+ 2. Have all your boot files in a single directory tree (usually called 
+-   /tftpboot).
+-3. Specify "-p -u tftpd -s /tftpboot" on the tftpd command line; if
++   /var/lib/tftpboot).
++3. Specify "-p -u tftpd -s /var/lib/tftpboot" on the tftpd command line; if
+    you want clients to be able to create files use
+-   "-p -c -U 002 -u tftpd -s /tftpboot" (replace 002 with whatever
++   "-p -c -U 002 -u tftpd -s /var/lib/tftpboot" (replace 002 with whatever
+    umask is appropriate for your setup.)
+ 
+ 	       =======================================
+@@ -40,12 +40,12 @@ directly.  Thus, if your /etc/inetd.conf
+ line):
+ 
+ tftp	dgram	udp	wait	root	/usr/sbin/tcpd
+-/usr/sbin/in.tftpd -s /tftpboot -r blksize
++/usr/sbin/in.tftpd -s /var/lib/tftpboot -r blksize
+ 
+ ... it's better to change to ...
+ 
+ tftp	dgram	udp	wait	root	/usr/sbin/in.tftpd
+-in.tftpd -s /tftpboot -r blksize
++in.tftpd -s /var/lib/tftpboot -r blksize
+ 
+ You should make sure that you are using "wait" option in tftpd; you
+ also need to have tftpd spawned as root in order for chroot (-s) to
+diff -up tftp-hpa-0.48/tftpd/sample.rules.tftpboot tftp-hpa-0.48/tftpd/sample.rules
+--- tftp-hpa-0.48/tftpd/sample.rules.tftpboot	2008-05-29 17:38:46.000000000 +0200
++++ tftp-hpa-0.48/tftpd/sample.rules	2008-05-29 17:38:05.000000000 +0200
+@@ -30,5 +30,5 @@ rg	\\		/		# Convert backslashes to slash
+ rg	\#		@		# Convert hash marks to @ signs
+ rg	/../		/..no../	# Convert /../ to /..no../
+ e	^ok/				# These are always ok
+-r	^[^/]		/tftpboot/\0	# Convert non-absolute files
++r	^[^/]		/var/lib/tftpboot/\0	# Convert non-absolute files
+ a	\.pvt$				# Reject requests for private files

================================================================
Index: packages/tftp-hpa/tftp-0.49-chk_retcodes.patch
diff -u /dev/null packages/tftp-hpa/tftp-0.49-chk_retcodes.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-0.49-chk_retcodes.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,15 @@
+diff -up tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes tftp-hpa-0.49/tftpd/tftpd.c
+--- tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes	2009-01-15 15:28:50.000000000 +0100
++++ tftp-hpa-0.49/tftpd/tftpd.c	2009-01-15 15:31:36.000000000 +0100
+@@ -932,7 +932,10 @@ int main(int argc, char **argv)
+             exit(EX_OSERR);
+         }
+ #ifdef __CYGWIN__
+-        chdir("/");             /* Cygwin chroot() bug workaround */
++				if (chdir("/") < 0) {			/* Cygwin chroot() bug workaround */
++					syslog(LOG_ERR, "chroot: %m");
++					exit(EX_OSERR);
++				}
+ #endif
+     }
+ #ifdef HAVE_SETREGID

================================================================
Index: packages/tftp-hpa/tftp-0.49-cmd_arg.patch
diff -u /dev/null packages/tftp-hpa/tftp-0.49-cmd_arg.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-0.49-cmd_arg.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,159 @@
+diff -up tftp-hpa-0.49/config.h.cmd_arg tftp-hpa-0.49/config.h
+--- tftp-hpa-0.49/config.h.cmd_arg	2010-04-19 15:29:10.567331454 +0200
++++ tftp-hpa-0.49/config.h	2010-04-20 07:33:03.133232772 +0200
+@@ -291,6 +291,7 @@ typedef int socklen_t;
+ /* Prototypes for libxtra functions */
+ 
+ void *xmalloc(size_t);
++void *xrealloc(void *, size_t);
+ char *xstrdup(const char *);
+ 
+ #ifndef HAVE_BSD_SIGNAL
+diff -up tftp-hpa-0.49/configure.in.cmd_arg tftp-hpa-0.49/configure.in
+--- tftp-hpa-0.49/configure.in.cmd_arg	2008-10-21 00:08:31.000000000 +0200
++++ tftp-hpa-0.49/configure.in	2010-04-19 11:05:12.387340698 +0200
+@@ -152,6 +152,7 @@ OBJROOT=`pwd`
+ 
+ XTRA=false
+ PA_SEARCH_LIBS_AND_ADD(xmalloc, iberty)
++PA_SEARCH_LIBS_AND_ADD(xrealloc, iberty)
+ PA_SEARCH_LIBS_AND_ADD(xstrdup, iberty)
+ PA_SEARCH_LIBS_AND_ADD(bsd_signal, bsd, bsdsignal)
+ PA_SEARCH_LIBS_AND_ADD(getopt_long, getopt, getopt_long)
+diff -up tftp-hpa-0.49/lib/xrealloc.c.cmd_arg tftp-hpa-0.49/lib/xrealloc.c
+--- tftp-hpa-0.49/lib/xrealloc.c.cmd_arg	2010-04-19 11:05:12.387340698 +0200
++++ tftp-hpa-0.49/lib/xrealloc.c	2010-04-19 11:05:12.387340698 +0200
+@@ -0,0 +1,20 @@
++/*
++ * xrealloc.c
++ *
++ * Simple error-checking version of realloc()
++ *
++ */
++
++#include "config.h"
++
++void *xrealloc(void *ptr, size_t size)
++{
++    void *p = realloc(ptr, size);
++
++    if (!p) {
++        fprintf(stderr, "Out of memory!\n");
++        exit(128);
++    }
++
++    return p;
++}
+diff -up tftp-hpa-0.49/tftp/main.c.cmd_arg tftp-hpa-0.49/tftp/main.c
+--- tftp-hpa-0.49/tftp/main.c.cmd_arg	2008-10-21 00:08:31.000000000 +0200
++++ tftp-hpa-0.49/tftp/main.c	2010-04-19 11:05:12.389329337 +0200
+@@ -89,11 +89,14 @@ int connected;
+ const struct modes *mode;
+ #ifdef WITH_READLINE
+ char *line = NULL;
++char *remote_pth = NULL;
+ #else
+ char line[LBUFLEN];
++char remote_pth[LBUFLEN];
+ #endif
+ int margc;
+-char *margv[20];
++char **margv;
++int sizeof_margv=0;
+ const char *prompt = "tftp> ";
+ sigjmp_buf toplevel;
+ void intr(int);
+@@ -379,6 +382,10 @@ static void getmoreargs(const char *part
+         free(line);
+         line = NULL;
+     }
++    if (remote_pth) {
++        free(remote_pth);
++        remote_pth = NULL;
++    }
+     line = xmalloc(len + elen + 1);
+     strcpy(line, partial);
+     strcpy(line + len, eline);
+@@ -535,6 +542,7 @@ void put(int argc, char *argv[])
+     int fd;
+     int n, err;
+     char *cp, *targ;
++    long dirlen, namelen, lastlen=0;
+ 
+     if (argc < 2) {
+         getmoreargs("send ", "(file) ");
+@@ -588,9 +596,22 @@ void put(int argc, char *argv[])
+     }
+     /* this assumes the target is a directory */
+     /* on a remote unix system.  hmmmm.  */
+-    cp = strchr(targ, '\0');
+-    *cp++ = '/';
++    dirlen = strlen(targ)+1;
++#ifdef WITH_READLINE
++    remote_pth = xmalloc(dirlen+1);
++#endif
++    strcpy(remote_pth, targ);
++    remote_pth[dirlen-1] = '/';
++    cp = remote_pth + dirlen;
+     for (n = 1; n < argc - 1; n++) {
++#ifdef WITH_READLINE
++        namelen = strlen(tail(argv[n])) + 1;
++        if (namelen > lastlen) {
++            remote_pth = xrealloc(remote_pth, dirlen + namelen + 1);
++            cp = remote_pth + dirlen;
++            lastlen = namelen;
++        }
++#endif
+         strcpy(cp, tail(argv[n]));
+         fd = open(argv[n], O_RDONLY | mode->m_openflags);
+         if (fd < 0) {
+@@ -600,9 +621,9 @@ void put(int argc, char *argv[])
+         }
+         if (verbose)
+             printf("putting %s to %s:%s [%s]\n",
+-                   argv[n], hostname, targ, mode->m_mode);
++                   argv[n], hostname, remote_pth, mode->m_mode);
+         sa_set_port(&peeraddr, port);
+-        tftp_sendfile(fd, targ, mode->m_mode);
++        tftp_sendfile(fd, remote_pth, mode->m_mode);
+     }
+ }
+ 
+@@ -801,6 +822,10 @@ static void command(void)
+             free(line);
+             line = NULL;
+         }
++        if (remote_pth) {
++            free(remote_pth);
++            remote_pth = NULL;
++        }
+         line = readline(prompt);
+         if (!line)
+             exit(0);            /* EOF */
+@@ -872,7 +897,13 @@ struct cmd *getcmd(char *name)
+ static void makeargv(void)
+ {
+     char *cp;
+-    char **argp = margv;
++    char **argp;
++
++    if (!sizeof_margv) {
++        sizeof_margv = 20;
++        margv = xmalloc(sizeof_margv * sizeof(char *));
++    }
++    argp = margv;
+ 
+     margc = 0;
+     for (cp = line; *cp;) {
+@@ -882,6 +913,11 @@ static void makeargv(void)
+             break;
+         *argp++ = cp;
+         margc += 1;
++        if (margc == sizeof_margv) {
++            sizeof_margv += 20;
++            margv = xrealloc(margv, sizeof_margv * sizeof(char *));
++            argp = margv + margc;
++        }
+         while (*cp != '\0' && !isspace(*cp))
+             cp++;
+         if (*cp == '\0')

================================================================
Index: packages/tftp-hpa/tftp-hpa-0.39-tzfix.patch
diff -u /dev/null packages/tftp-hpa/tftp-hpa-0.39-tzfix.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-hpa-0.39-tzfix.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,18 @@
+diff -up tftp-hpa-0.49/tftpd/tftpd.c.tzfix tftp-hpa-0.49/tftpd/tftpd.c
+--- tftp-hpa-0.49/tftpd/tftpd.c.tzfix	2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftpd/tftpd.c	2008-11-25 11:45:27.000000000 -0500
+@@ -350,6 +350,14 @@ int main(int argc, char **argv)
+     const char *pidfile = NULL;
+     u_short tp_opcode;
+ 
++    time_t my_time = 0;
++    struct tm* p_tm;
++    char envtz[10];
++    my_time = time(NULL);
++    p_tm = localtime(&my_time);
++    snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
++    setenv("TZ", envtz, 0);
++
+     /* basename() is way too much of a pain from a portability standpoint */
+ 
+     p = strrchr(argv[0], '/');

================================================================
Index: packages/tftp-hpa/tftp-hpa-0.49-fortify-strcpy-crash.patch
diff -u /dev/null packages/tftp-hpa/tftp-hpa-0.49-fortify-strcpy-crash.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-hpa-0.49-fortify-strcpy-crash.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,26 @@
+diff -urN tftp-hpa-0.49.orig/tftp/tftp.c tftp-hpa-0.49/tftp/tftp.c
+--- tftp-hpa-0.49.orig/tftp/tftp.c	2008-10-20 18:08:31.000000000 -0400
++++ tftp-hpa-0.49/tftp/tftp.c	2009-08-05 09:47:18.072585848 -0400
+@@ -279,15 +279,16 @@
+             struct tftphdr *tp, const char *mode)
+ {
+     char *cp;
++    size_t len;
+ 
+     tp->th_opcode = htons((u_short) request);
+     cp = (char *)&(tp->th_stuff);
+-    strcpy(cp, name);
+-    cp += strlen(name);
+-    *cp++ = '\0';
+-    strcpy(cp, mode);
+-    cp += strlen(mode);
+-    *cp++ = '\0';
++    len = strlen(name) + 1;
++    memcpy(cp, name, len);
++    cp += len;
++    len = strlen(mode) + 1;
++    memcpy(cp, mode, len);
++    cp += len;
+     return (cp - (char *)tp);
+ }
+ 

================================================================
Index: packages/tftp-hpa/tftp-hpa-0.49-stats.patch
diff -u /dev/null packages/tftp-hpa/tftp-hpa-0.49-stats.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-hpa-0.49-stats.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,14 @@
+diff -up tftp-hpa-0.49/tftp/tftp.c.stats tftp-hpa-0.49/tftp/tftp.c
+--- tftp-hpa-0.49/tftp/tftp.c.stats	2011-01-03 15:38:34.217918067 +0100
++++ tftp-hpa-0.49/tftp/tftp.c	2011-01-03 15:38:37.498917014 +0100
+@@ -400,8 +400,8 @@ static void printstats(const char *direc
+ {
+     double delta;
+ 
+-    delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) -
+-        (tstart.tv_sec + (tstart.tv_usec / 100000.0));
++    delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) -
++        (tstart.tv_sec + (tstart.tv_usec / 1000000.0));
+     if (verbose) {
+         printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
+         printf(" [%.0f bit/s]", (amount * 8.) / delta);

================================================================
Index: packages/tftp-hpa/tftp-hpa-5.2-pktinfo.patch
diff -u /dev/null packages/tftp-hpa/tftp-hpa-5.2-pktinfo.patch:1.1
--- /dev/null	Wed Mar 14 19:05:39 2012
+++ packages/tftp-hpa/tftp-hpa-5.2-pktinfo.patch	Wed Mar 14 19:05:33 2012
@@ -0,0 +1,23 @@
+diff -up tftp-hpa-5.2/tftpd/recvfrom.c.test tftp-hpa-5.2/tftpd/recvfrom.c
+--- tftp-hpa-5.2/tftpd/recvfrom.c.test	2011-12-11 23:13:52.000000000 +0100
++++ tftp-hpa-5.2/tftpd/recvfrom.c	2012-01-04 10:05:17.852042256 +0100
+@@ -149,16 +149,16 @@ myrecvfrom(int s, void *buf, int len, un
+ 
+     /* Try to enable getting the return address */
+ #ifdef IP_RECVDSTADDR
+-    if (from->sa_family == AF_INET)
++    if (from->sa_family == AF_INET || !from->sa_family)
+         setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
+ #endif
+ #ifdef IP_PKTINFO
+-    if (from->sa_family == AF_INET)
++    if (from->sa_family == AF_INET || !from->sa_family)
+         setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
+ #endif
+ #ifdef HAVE_IPV6
+ #ifdef IPV6_RECVPKTINFO
+-    if (from->sa_family == AF_INET6)
++    if (from->sa_family == AF_INET6 || !from->sa_family)
+         setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
+ #endif
+ #endif
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/tftp-hpa/tftp-hpa.spec?r1=1.62&r2=1.63&f=u



More information about the pld-cvs-commit mailing list