diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-11-27 11:25:46 +0000 |
---|---|---|
committer | Joe MacDonald <joe.macdonald@windriver.com> | 2012-11-27 14:43:58 -0500 |
commit | 2abab0e93dc5099df8a9b7466de803a2d8372eb9 (patch) | |
tree | 2389cf5f51cdd2c8d7db29720343064482b8a1ec /meta-networking | |
parent | a863b5409923189c3cfa4d82888f94258da96648 (diff) | |
download | meta-openembedded-2abab0e93dc5099df8a9b7466de803a2d8372eb9.tar.gz |
tftp-hpa: add from OE-Classic, update and tidy up
* Update to 5.2
* Add patches from Fedora
* Add DESCRIPTION and better SUMMARY
* Make LICENSE more accurate
* Add LIC_FILES_CHKSUM
* Update ALTERNATIVE_* definitions
* Handle hardcoded paths in initscript
Much of this was done by Joe MacDonald <joe.macdonald@windriver.com>.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'meta-networking')
12 files changed, 572 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/default b/meta-networking/recipes-daemons/tftp-hpa/files/default new file mode 100644 index 000000000..de2ed1820 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/default | |||
@@ -0,0 +1,3 @@ | |||
1 | #Defaults for tftpd-hpa | ||
2 | RUN_DAEMON="yes" | ||
3 | OPTIONS="-l -s /srv/tftpboot" | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/init b/meta-networking/recipes-daemons/tftp-hpa/files/init new file mode 100644 index 000000000..5ad8c52cb --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/init | |||
@@ -0,0 +1,104 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # Author: Jaakko Niemi <liiwi@iki.fi> | ||
4 | # Modified from skeleton file in sarge | ||
5 | |||
6 | ### BEGIN INIT INFO | ||
7 | # Provides: tftp-hpa | ||
8 | # Required-Start: $local_fs $remote_fs $syslog $network | ||
9 | # Required-Stop: $local_fs $remote_fs $syslog $network | ||
10 | # Default-Start: 2 3 4 5 | ||
11 | # Default-Stop: 1 | ||
12 | # Short-Description: HPA's tftp client | ||
13 | # Description: tftp server to allow booting clients which support | ||
14 | # the PXE protocol. | ||
15 | ### END INIT INFO | ||
16 | |||
17 | set -e | ||
18 | |||
19 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
20 | DESC="HPA's tftpd" | ||
21 | NAME=in.tftpd | ||
22 | DAEMON=/usr/sbin/$NAME | ||
23 | PIDFILE=/var/run/$NAME.pid | ||
24 | SCRIPTNAME=/etc/init.d/tftpd-hpa | ||
25 | |||
26 | # Gracefully exit if the package has been removed. | ||
27 | test -x $DAEMON || exit 0 | ||
28 | |||
29 | # Read config file if it is present. | ||
30 | if [ -r /etc/default/tftpd-hpa ] | ||
31 | then | ||
32 | . /etc/default/tftpd-hpa | ||
33 | fi | ||
34 | |||
35 | if [ "$RUN_DAEMON" != "yes" ] ; then | ||
36 | echo "tftpd-hpa disabled in /etc/default/tftpd-hpa" | ||
37 | exit 0 | ||
38 | fi | ||
39 | |||
40 | # | ||
41 | # Function that starts the daemon/service. | ||
42 | # | ||
43 | d_start() { | ||
44 | start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS | ||
45 | } | ||
46 | |||
47 | # | ||
48 | # Function that stops the daemon/service. | ||
49 | # | ||
50 | d_stop() { | ||
51 | start-stop-daemon --stop --quiet --name $NAME | ||
52 | } | ||
53 | |||
54 | # | ||
55 | # Function that sends a SIGHUP to the daemon/service. | ||
56 | # | ||
57 | d_reload() { | ||
58 | start-stop-daemon --stop --quiet --name $NAME --signal 1 | ||
59 | } | ||
60 | |||
61 | case "$1" in | ||
62 | start) | ||
63 | echo "Starting $DESC: $NAME" | ||
64 | d_start | ||
65 | echo "." | ||
66 | ;; | ||
67 | stop) | ||
68 | echo "Stopping $DESC: $NAME" | ||
69 | d_stop | ||
70 | echo "." | ||
71 | ;; | ||
72 | #reload) | ||
73 | # | ||
74 | # If the daemon can reload its configuration without | ||
75 | # restarting (for example, when it is sent a SIGHUP), | ||
76 | # then implement that here. | ||
77 | # | ||
78 | # If the daemon responds to changes in its config file | ||
79 | # directly anyway, make this an "exit 0". | ||
80 | # | ||
81 | # echo -n "Reloading $DESC configuration..." | ||
82 | # d_reload | ||
83 | # echo "done." | ||
84 | #;; | ||
85 | restart|force-reload) | ||
86 | # | ||
87 | # If the "reload" option is implemented, move the "force-reload" | ||
88 | # option to the "reload" entry above. If not, "force-reload" is | ||
89 | # just the same as "restart". | ||
90 | # | ||
91 | echo "Restarting $DESC: $NAME" | ||
92 | d_stop | ||
93 | sleep 1 | ||
94 | d_start | ||
95 | echo "." | ||
96 | ;; | ||
97 | *) | ||
98 | # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 | ||
99 | echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 | ||
100 | exit 1 | ||
101 | ;; | ||
102 | esac | ||
103 | |||
104 | exit 0 | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.40-remap.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.40-remap.patch new file mode 100644 index 000000000..3f690609a --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.40-remap.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.49/tftpd/remap.c.zero tftp-hpa-0.49/tftpd/remap.c | ||
8 | --- tftp-hpa-0.49/tftpd/remap.c.zero 2008-10-20 18:08:31.000000000 -0400 | ||
9 | +++ tftp-hpa-0.49/tftpd/remap.c 2008-11-25 11:41:09.000000000 -0500 | ||
10 | @@ -286,6 +286,7 @@ struct rule *parserulefile(FILE * f) | ||
11 | int lineno = 0; | ||
12 | int err = 0; | ||
13 | |||
14 | + memset(this_rule, '\0', sizeof(struct rule)); | ||
15 | while (lineno++, fgets(line, MAXLINE, f)) { | ||
16 | rv = parseline(line, this_rule, lineno); | ||
17 | if (rv < 0) | ||
18 | @@ -294,6 +295,7 @@ struct rule *parserulefile(FILE * f) | ||
19 | *last_rule = this_rule; | ||
20 | last_rule = &this_rule->next; | ||
21 | this_rule = tfmalloc(sizeof(struct rule)); | ||
22 | + memset(this_rule, '\0', sizeof(struct rule)); | ||
23 | } | ||
24 | } | ||
25 | |||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.42-tftpboot.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.42-tftpboot.patch new file mode 100644 index 000000000..98a86b78b --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.42-tftpboot.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.48/tftp-xinetd.tftpboot tftp-hpa-0.48/tftp-xinetd | ||
8 | --- tftp-hpa-0.48/tftp-xinetd.tftpboot 2007-01-31 00:51:05.000000000 +0100 | ||
9 | +++ tftp-hpa-0.48/tftp-xinetd 2008-05-20 12:05:53.000000000 +0200 | ||
10 | @@ -10,7 +10,7 @@ service tftp | ||
11 | wait = yes | ||
12 | user = root | ||
13 | server = /usr/sbin/in.tftpd | ||
14 | - server_args = -s /tftpboot | ||
15 | + server_args = -s /var/lib/tftpboot | ||
16 | disable = yes | ||
17 | per_source = 11 | ||
18 | cps = 100 2 | ||
19 | diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security | ||
20 | --- tftp-hpa-0.48/README.security.tftpboot 2008-05-29 17:36:32.000000000 +0200 | ||
21 | +++ tftp-hpa-0.48/README.security 2008-05-29 17:37:21.000000000 +0200 | ||
22 | @@ -17,10 +17,10 @@ probably the following: | ||
23 | |||
24 | 1. Create a separate "tftpd" user and group only used for tftpd; | ||
25 | 2. Have all your boot files in a single directory tree (usually called | ||
26 | - /tftpboot). | ||
27 | -3. Specify "-p -u tftpd -s /tftpboot" on the tftpd command line; if | ||
28 | + /var/lib/tftpboot). | ||
29 | +3. Specify "-p -u tftpd -s /var/lib/tftpboot" on the tftpd command line; if | ||
30 | you want clients to be able to create files use | ||
31 | - "-p -c -U 002 -u tftpd -s /tftpboot" (replace 002 with whatever | ||
32 | + "-p -c -U 002 -u tftpd -s /var/lib/tftpboot" (replace 002 with whatever | ||
33 | umask is appropriate for your setup.) | ||
34 | |||
35 | ======================================= | ||
36 | @@ -40,12 +40,12 @@ directly. Thus, if your /etc/inetd.conf | ||
37 | line): | ||
38 | |||
39 | tftp dgram udp wait root /usr/sbin/tcpd | ||
40 | -/usr/sbin/in.tftpd -s /tftpboot -r blksize | ||
41 | +/usr/sbin/in.tftpd -s /var/lib/tftpboot -r blksize | ||
42 | |||
43 | ... it's better to change to ... | ||
44 | |||
45 | tftp dgram udp wait root /usr/sbin/in.tftpd | ||
46 | -in.tftpd -s /tftpboot -r blksize | ||
47 | +in.tftpd -s /var/lib/tftpboot -r blksize | ||
48 | |||
49 | You should make sure that you are using "wait" option in tftpd; you | ||
50 | also need to have tftpd spawned as root in order for chroot (-s) to | ||
51 | diff -up tftp-hpa-0.48/tftpd/sample.rules.tftpboot tftp-hpa-0.48/tftpd/sample.rules | ||
52 | --- tftp-hpa-0.48/tftpd/sample.rules.tftpboot 2008-05-29 17:38:46.000000000 +0200 | ||
53 | +++ tftp-hpa-0.48/tftpd/sample.rules 2008-05-29 17:38:05.000000000 +0200 | ||
54 | @@ -30,5 +30,5 @@ rg \\ / # Convert backslashes to slash | ||
55 | rg \# @ # Convert hash marks to @ signs | ||
56 | rg /../ /..no../ # Convert /../ to /..no../ | ||
57 | e ^ok/ # These are always ok | ||
58 | -r ^[^/] /tftpboot/\0 # Convert non-absolute files | ||
59 | +r ^[^/] /var/lib/tftpboot/\0 # Convert non-absolute files | ||
60 | a \.pvt$ # Reject requests for private files | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-chk_retcodes.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-chk_retcodes.patch new file mode 100644 index 000000000..7ae1a8722 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-chk_retcodes.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes tftp-hpa-0.49/tftpd/tftpd.c | ||
8 | --- tftp-hpa-0.49/tftpd/tftpd.c.chk_retcodes 2009-01-15 15:28:50.000000000 +0100 | ||
9 | +++ tftp-hpa-0.49/tftpd/tftpd.c 2009-01-15 15:31:36.000000000 +0100 | ||
10 | @@ -932,7 +932,10 @@ int main(int argc, char **argv) | ||
11 | exit(EX_OSERR); | ||
12 | } | ||
13 | #ifdef __CYGWIN__ | ||
14 | - chdir("/"); /* Cygwin chroot() bug workaround */ | ||
15 | + if (chdir("/") < 0) { /* Cygwin chroot() bug workaround */ | ||
16 | + syslog(LOG_ERR, "chroot: %m"); | ||
17 | + exit(EX_OSERR); | ||
18 | + } | ||
19 | #endif | ||
20 | } | ||
21 | #ifdef HAVE_SETREGID | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-cmd_arg.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-cmd_arg.patch new file mode 100644 index 000000000..6b8ceaaeb --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-0.49-cmd_arg.patch | |||
@@ -0,0 +1,165 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.49/config.h.cmd_arg tftp-hpa-0.49/config.h | ||
8 | --- tftp-hpa-0.49/config.h.cmd_arg 2010-04-19 15:29:10.567331454 +0200 | ||
9 | +++ tftp-hpa-0.49/config.h 2010-04-20 07:33:03.133232772 +0200 | ||
10 | @@ -291,6 +291,7 @@ typedef int socklen_t; | ||
11 | /* Prototypes for libxtra functions */ | ||
12 | |||
13 | void *xmalloc(size_t); | ||
14 | +void *xrealloc(void *, size_t); | ||
15 | char *xstrdup(const char *); | ||
16 | |||
17 | #ifndef HAVE_BSD_SIGNAL | ||
18 | diff -up tftp-hpa-0.49/configure.in.cmd_arg tftp-hpa-0.49/configure.in | ||
19 | --- tftp-hpa-0.49/configure.in.cmd_arg 2008-10-21 00:08:31.000000000 +0200 | ||
20 | +++ tftp-hpa-0.49/configure.in 2010-04-19 11:05:12.387340698 +0200 | ||
21 | @@ -152,6 +152,7 @@ OBJROOT=`pwd` | ||
22 | |||
23 | XTRA=false | ||
24 | PA_SEARCH_LIBS_AND_ADD(xmalloc, iberty) | ||
25 | +PA_SEARCH_LIBS_AND_ADD(xrealloc, iberty) | ||
26 | PA_SEARCH_LIBS_AND_ADD(xstrdup, iberty) | ||
27 | PA_SEARCH_LIBS_AND_ADD(bsd_signal, bsd, bsdsignal) | ||
28 | PA_SEARCH_LIBS_AND_ADD(getopt_long, getopt, getopt_long) | ||
29 | diff -up tftp-hpa-0.49/lib/xrealloc.c.cmd_arg tftp-hpa-0.49/lib/xrealloc.c | ||
30 | --- tftp-hpa-0.49/lib/xrealloc.c.cmd_arg 2010-04-19 11:05:12.387340698 +0200 | ||
31 | +++ tftp-hpa-0.49/lib/xrealloc.c 2010-04-19 11:05:12.387340698 +0200 | ||
32 | @@ -0,0 +1,20 @@ | ||
33 | +/* | ||
34 | + * xrealloc.c | ||
35 | + * | ||
36 | + * Simple error-checking version of realloc() | ||
37 | + * | ||
38 | + */ | ||
39 | + | ||
40 | +#include "config.h" | ||
41 | + | ||
42 | +void *xrealloc(void *ptr, size_t size) | ||
43 | +{ | ||
44 | + void *p = realloc(ptr, size); | ||
45 | + | ||
46 | + if (!p) { | ||
47 | + fprintf(stderr, "Out of memory!\n"); | ||
48 | + exit(128); | ||
49 | + } | ||
50 | + | ||
51 | + return p; | ||
52 | +} | ||
53 | diff -up tftp-hpa-0.49/tftp/main.c.cmd_arg tftp-hpa-0.49/tftp/main.c | ||
54 | --- tftp-hpa-0.49/tftp/main.c.cmd_arg 2008-10-21 00:08:31.000000000 +0200 | ||
55 | +++ tftp-hpa-0.49/tftp/main.c 2010-04-19 11:05:12.389329337 +0200 | ||
56 | @@ -89,11 +89,14 @@ int connected; | ||
57 | const struct modes *mode; | ||
58 | #ifdef WITH_READLINE | ||
59 | char *line = NULL; | ||
60 | +char *remote_pth = NULL; | ||
61 | #else | ||
62 | char line[LBUFLEN]; | ||
63 | +char remote_pth[LBUFLEN]; | ||
64 | #endif | ||
65 | int margc; | ||
66 | -char *margv[20]; | ||
67 | +char **margv; | ||
68 | +int sizeof_margv=0; | ||
69 | const char *prompt = "tftp> "; | ||
70 | sigjmp_buf toplevel; | ||
71 | void intr(int); | ||
72 | @@ -379,6 +382,10 @@ static void getmoreargs(const char *part | ||
73 | free(line); | ||
74 | line = NULL; | ||
75 | } | ||
76 | + if (remote_pth) { | ||
77 | + free(remote_pth); | ||
78 | + remote_pth = NULL; | ||
79 | + } | ||
80 | line = xmalloc(len + elen + 1); | ||
81 | strcpy(line, partial); | ||
82 | strcpy(line + len, eline); | ||
83 | @@ -535,6 +542,7 @@ void put(int argc, char *argv[]) | ||
84 | int fd; | ||
85 | int n, err; | ||
86 | char *cp, *targ; | ||
87 | + long dirlen, namelen, lastlen=0; | ||
88 | |||
89 | if (argc < 2) { | ||
90 | getmoreargs("send ", "(file) "); | ||
91 | @@ -588,9 +596,22 @@ void put(int argc, char *argv[]) | ||
92 | } | ||
93 | /* this assumes the target is a directory */ | ||
94 | /* on a remote unix system. hmmmm. */ | ||
95 | - cp = strchr(targ, '\0'); | ||
96 | - *cp++ = '/'; | ||
97 | + dirlen = strlen(targ)+1; | ||
98 | +#ifdef WITH_READLINE | ||
99 | + remote_pth = xmalloc(dirlen+1); | ||
100 | +#endif | ||
101 | + strcpy(remote_pth, targ); | ||
102 | + remote_pth[dirlen-1] = '/'; | ||
103 | + cp = remote_pth + dirlen; | ||
104 | for (n = 1; n < argc - 1; n++) { | ||
105 | +#ifdef WITH_READLINE | ||
106 | + namelen = strlen(tail(argv[n])) + 1; | ||
107 | + if (namelen > lastlen) { | ||
108 | + remote_pth = xrealloc(remote_pth, dirlen + namelen + 1); | ||
109 | + cp = remote_pth + dirlen; | ||
110 | + lastlen = namelen; | ||
111 | + } | ||
112 | +#endif | ||
113 | strcpy(cp, tail(argv[n])); | ||
114 | fd = open(argv[n], O_RDONLY | mode->m_openflags); | ||
115 | if (fd < 0) { | ||
116 | @@ -600,9 +621,9 @@ void put(int argc, char *argv[]) | ||
117 | } | ||
118 | if (verbose) | ||
119 | printf("putting %s to %s:%s [%s]\n", | ||
120 | - argv[n], hostname, targ, mode->m_mode); | ||
121 | + argv[n], hostname, remote_pth, mode->m_mode); | ||
122 | sa_set_port(&peeraddr, port); | ||
123 | - tftp_sendfile(fd, targ, mode->m_mode); | ||
124 | + tftp_sendfile(fd, remote_pth, mode->m_mode); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | @@ -801,6 +822,10 @@ static void command(void) | ||
129 | free(line); | ||
130 | line = NULL; | ||
131 | } | ||
132 | + if (remote_pth) { | ||
133 | + free(remote_pth); | ||
134 | + remote_pth = NULL; | ||
135 | + } | ||
136 | line = readline(prompt); | ||
137 | if (!line) | ||
138 | exit(0); /* EOF */ | ||
139 | @@ -872,7 +897,13 @@ struct cmd *getcmd(char *name) | ||
140 | static void makeargv(void) | ||
141 | { | ||
142 | char *cp; | ||
143 | - char **argp = margv; | ||
144 | + char **argp; | ||
145 | + | ||
146 | + if (!sizeof_margv) { | ||
147 | + sizeof_margv = 20; | ||
148 | + margv = xmalloc(sizeof_margv * sizeof(char *)); | ||
149 | + } | ||
150 | + argp = margv; | ||
151 | |||
152 | margc = 0; | ||
153 | for (cp = line; *cp;) { | ||
154 | @@ -882,6 +913,11 @@ static void makeargv(void) | ||
155 | break; | ||
156 | *argp++ = cp; | ||
157 | margc += 1; | ||
158 | + if (margc == sizeof_margv) { | ||
159 | + sizeof_margv += 20; | ||
160 | + margv = xrealloc(margv, sizeof_margv * sizeof(char *)); | ||
161 | + argp = margv + margc; | ||
162 | + } | ||
163 | while (*cp != '\0' && !isspace(*cp)) | ||
164 | cp++; | ||
165 | if (*cp == '\0') | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.39-tzfix.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.39-tzfix.patch new file mode 100644 index 000000000..85110eb28 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.39-tzfix.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.49/tftpd/tftpd.c.tzfix tftp-hpa-0.49/tftpd/tftpd.c | ||
8 | --- tftp-hpa-0.49/tftpd/tftpd.c.tzfix 2008-10-20 18:08:31.000000000 -0400 | ||
9 | +++ tftp-hpa-0.49/tftpd/tftpd.c 2008-11-25 11:45:27.000000000 -0500 | ||
10 | @@ -350,6 +350,14 @@ int main(int argc, char **argv) | ||
11 | const char *pidfile = NULL; | ||
12 | u_short tp_opcode; | ||
13 | |||
14 | + time_t my_time = 0; | ||
15 | + struct tm* p_tm; | ||
16 | + char envtz[10]; | ||
17 | + my_time = time(NULL); | ||
18 | + p_tm = localtime(&my_time); | ||
19 | + snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600); | ||
20 | + setenv("TZ", envtz, 0); | ||
21 | + | ||
22 | /* basename() is way too much of a pain from a portability standpoint */ | ||
23 | |||
24 | p = strrchr(argv[0], '/'); | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-fortify-strcpy-crash.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-fortify-strcpy-crash.patch new file mode 100644 index 000000000..08d2b5b7d --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-fortify-strcpy-crash.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -urN tftp-hpa-0.49.orig/tftp/tftp.c tftp-hpa-0.49/tftp/tftp.c | ||
8 | --- tftp-hpa-0.49.orig/tftp/tftp.c 2008-10-20 18:08:31.000000000 -0400 | ||
9 | +++ tftp-hpa-0.49/tftp/tftp.c 2009-08-05 09:47:18.072585848 -0400 | ||
10 | @@ -279,15 +279,16 @@ | ||
11 | struct tftphdr *tp, const char *mode) | ||
12 | { | ||
13 | char *cp; | ||
14 | + size_t len; | ||
15 | |||
16 | tp->th_opcode = htons((u_short) request); | ||
17 | cp = (char *)&(tp->th_stuff); | ||
18 | - strcpy(cp, name); | ||
19 | - cp += strlen(name); | ||
20 | - *cp++ = '\0'; | ||
21 | - strcpy(cp, mode); | ||
22 | - cp += strlen(mode); | ||
23 | - *cp++ = '\0'; | ||
24 | + len = strlen(name) + 1; | ||
25 | + memcpy(cp, name, len); | ||
26 | + cp += len; | ||
27 | + len = strlen(mode) + 1; | ||
28 | + memcpy(cp, mode, len); | ||
29 | + cp += len; | ||
30 | return (cp - (char *)tp); | ||
31 | } | ||
32 | |||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-stats.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-stats.patch new file mode 100644 index 000000000..720cd69de --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-0.49-stats.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-0.49/tftp/tftp.c.stats tftp-hpa-0.49/tftp/tftp.c | ||
8 | --- tftp-hpa-0.49/tftp/tftp.c.stats 2011-01-03 15:38:34.217918067 +0100 | ||
9 | +++ tftp-hpa-0.49/tftp/tftp.c 2011-01-03 15:38:37.498917014 +0100 | ||
10 | @@ -400,8 +400,8 @@ static void printstats(const char *direc | ||
11 | { | ||
12 | double delta; | ||
13 | |||
14 | - delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) - | ||
15 | - (tstart.tv_sec + (tstart.tv_usec / 100000.0)); | ||
16 | + delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) - | ||
17 | + (tstart.tv_sec + (tstart.tv_usec / 1000000.0)); | ||
18 | if (verbose) { | ||
19 | printf("%s %lu bytes in %.1f seconds", direction, amount, delta); | ||
20 | printf(" [%.0f bit/s]", (amount * 8.) / delta); | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-5.2-pktinfo.patch b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-5.2-pktinfo.patch new file mode 100644 index 000000000..216349d26 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-5.2-pktinfo.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | Patch originally from Fedora | ||
2 | |||
3 | http://pkgs.fedoraproject.org/cgit/tftp.git/ | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -up tftp-hpa-5.2/tftpd/recvfrom.c.test tftp-hpa-5.2/tftpd/recvfrom.c | ||
8 | --- tftp-hpa-5.2/tftpd/recvfrom.c.test 2011-12-11 23:13:52.000000000 +0100 | ||
9 | +++ tftp-hpa-5.2/tftpd/recvfrom.c 2012-01-04 10:05:17.852042256 +0100 | ||
10 | @@ -149,16 +149,16 @@ myrecvfrom(int s, void *buf, int len, un | ||
11 | |||
12 | /* Try to enable getting the return address */ | ||
13 | #ifdef IP_RECVDSTADDR | ||
14 | - if (from->sa_family == AF_INET) | ||
15 | + if (from->sa_family == AF_INET || !from->sa_family) | ||
16 | setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)); | ||
17 | #endif | ||
18 | #ifdef IP_PKTINFO | ||
19 | - if (from->sa_family == AF_INET) | ||
20 | + if (from->sa_family == AF_INET || !from->sa_family) | ||
21 | setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on)); | ||
22 | #endif | ||
23 | #ifdef HAVE_IPV6 | ||
24 | #ifdef IPV6_RECVPKTINFO | ||
25 | - if (from->sa_family == AF_INET6) | ||
26 | + if (from->sa_family == AF_INET6 || !from->sa_family) | ||
27 | setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)); | ||
28 | #endif | ||
29 | #endif | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/tftp-xinetd b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-xinetd new file mode 100644 index 000000000..fe7016396 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/tftp-xinetd | |||
@@ -0,0 +1,18 @@ | |||
1 | # default: off | ||
2 | # description: The tftp server serves files using the trivial file transfer \ | ||
3 | # protocol. The tftp protocol is often used to boot diskless \ | ||
4 | # workstations, download configuration files to network-aware printers, \ | ||
5 | # and to start the installation process for some operating systems. | ||
6 | service tftp | ||
7 | { | ||
8 | socket_type = dgram | ||
9 | protocol = udp | ||
10 | wait = yes | ||
11 | user = root | ||
12 | server = /usr/sbin/in.tftpd-hpa | ||
13 | server_args = -s /var/lib/tftpboot | ||
14 | disable = yes | ||
15 | per_source = 11 | ||
16 | cps = 100 2 | ||
17 | flags = IPv6 | ||
18 | } | ||
diff --git a/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb new file mode 100644 index 000000000..40294b0e2 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb | |||
@@ -0,0 +1,71 @@ | |||
1 | SUMMARY = "Client for the Trivial File Transfer Protocol" | ||
2 | DESCRIPTION = \ | ||
3 | "The Trivial File Transfer Protocol (TFTP) is normally used only for \ | ||
4 | booting diskless workstations. The tftp package provides the user \ | ||
5 | interface for TFTP, which allows users to transfer files to and from a \ | ||
6 | remote machine. This program and TFTP provide very little security, \ | ||
7 | and should not be enabled unless it is expressly needed." | ||
8 | DEPENDS = "tcp-wrappers readline" | ||
9 | SECTION = "network" | ||
10 | LICENSE = "BSD-4-Clause" | ||
11 | LIC_FILES_CHKSUM = "file://MCONFIG.in;startline=1;endline=9;md5=c28ba5adb43041fae4629db05c83cbdd \ | ||
12 | file://tftp/tftp.c;startline=1;endline=32;md5=988c1cba99d70858a26cd877209857f4" | ||
13 | |||
14 | PR = "r0" | ||
15 | |||
16 | SRC_URI = "http://kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-${PV}.tar.bz2 \ | ||
17 | file://tftp-0.40-remap.patch \ | ||
18 | file://tftp-0.42-tftpboot.patch \ | ||
19 | file://tftp-0.49-chk_retcodes.patch \ | ||
20 | file://tftp-0.49-cmd_arg.patch \ | ||
21 | file://tftp-hpa-0.39-tzfix.patch \ | ||
22 | file://tftp-hpa-0.49-fortify-strcpy-crash.patch \ | ||
23 | file://tftp-hpa-0.49-stats.patch \ | ||
24 | file://tftp-hpa-5.2-pktinfo.patch \ | ||
25 | file://default \ | ||
26 | file://init" | ||
27 | |||
28 | SRC_URI[md5sum] = "46c9bd20bbffa62f79c958c7b99aac21" | ||
29 | SRC_URI[sha256sum] = "0a9f88d4c1c02687b4853b02ab5dd8779d4de4ffdb9b2e5c9332841304d1a269" | ||
30 | |||
31 | inherit autotools update-rc.d update-alternatives | ||
32 | |||
33 | EXTRA_OECONF += "--disable-option-checking" | ||
34 | |||
35 | # configure.in has errors | ||
36 | do_configure() { | ||
37 | oe_runconf | ||
38 | } | ||
39 | |||
40 | do_install() { | ||
41 | oe_runmake install INSTALLROOT=${D} | ||
42 | mv ${D}${bindir}/tftp ${D}${bindir}/tftp-hpa | ||
43 | mv ${D}${sbindir}/in.tftpd ${D}${sbindir}/in.tftpd-hpa | ||
44 | |||
45 | install -m 755 -d ${D}${localstatedir}/lib/tftpboot/ | ||
46 | install -d ${D}${sysconfdir}/init.d | ||
47 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/tftpd-hpa | ||
48 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/tftpd-hpa | ||
49 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/tftpd-hpa | ||
50 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/tftpd-hpa | ||
51 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/tftpd-hpa | ||
52 | |||
53 | install -d ${D}${sysconfdir}/default | ||
54 | install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/tftpd-hpa | ||
55 | } | ||
56 | |||
57 | FILES_${PN} = "${bindir}" | ||
58 | |||
59 | PACKAGES += "tftp-hpa-server" | ||
60 | SUMMARY_tftp-hpa-server = "Server for the Trivial File Transfer Protocol" | ||
61 | FILES_tftp-hpa-server = "${sbindir} ${sysconfdir} ${localstatedir}" | ||
62 | CONFFILES_tftp-hpa-server = "${sysconfdir}/default/tftpd-hpa" | ||
63 | |||
64 | INITSCRIPT_PACKAGES = "tftp-hpa-server" | ||
65 | INITSCRIPT_NAME = "tftpd-hpa" | ||
66 | INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 1 ." | ||
67 | |||
68 | ALTERNATIVE_${PN} = "tftp" | ||
69 | ALTERNATIVE_TARGET[tftp] = "${bindir}/tftp-hpa" | ||
70 | ALTERNATIVE_PRIORITY = "50" | ||
71 | |||