add tftp servers with filecase patch
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@886 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
15
net-ftp/tftp-hpa/files/in.tftpd.confd-0.44
Normal file
15
net-ftp/tftp-hpa/files/in.tftpd.confd-0.44
Normal file
@@ -0,0 +1,15 @@
|
||||
# /etc/init.d/in.tftpd
|
||||
|
||||
# Path to server files from
|
||||
# Depending on your application you may have to change this.
|
||||
# This is commented out to force you to look at the file!
|
||||
#INTFTPD_PATH="/var/tftp/"
|
||||
#INTFTPD_PATH="/tftpboot/"
|
||||
#INTFTPD_PATH="/tftproot/"
|
||||
|
||||
# For more options, see in.tftpd(8)
|
||||
# -R 4096:32767 solves problems with ARC firmware, and obsoletes
|
||||
# the /proc/sys/net/ipv4/ip_local_port_range hack.
|
||||
# -s causes $INTFTPD_PATH to be the root of the TFTP tree.
|
||||
# -l is passed by the init script in addition to these options.
|
||||
INTFTPD_OPTS="-R 4096:32767 -s ${INTFTPD_PATH}"
|
||||
20
net-ftp/tftp-hpa/files/in.tftpd.rc6
Normal file
20
net-ftp/tftp-hpa/files/in.tftpd.rc6
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2005 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-ftp/tftp-hpa/files/in.tftpd.rc6,v 1.2 2005/07/30 06:29:14 vapier Exp $
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting tftpd"
|
||||
/usr/sbin/in.tftpd -l ${INTFTPD_OPTS}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping tftpd"
|
||||
start-stop-daemon --stop --exec /usr/sbin/in.tftpd
|
||||
eend $?
|
||||
}
|
||||
100
net-ftp/tftp-hpa/files/tftp-hpa-filecase.diff
Normal file
100
net-ftp/tftp-hpa/files/tftp-hpa-filecase.diff
Normal file
@@ -0,0 +1,100 @@
|
||||
Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
|
||||
Date: 2009-03-19
|
||||
Initial Package Version: 0.49
|
||||
Origin: http://oss.netfarm.it/guides/ris-linux.php
|
||||
Upstream Status: unknown
|
||||
Description: A patch for hpa-tftp to permit case insensitive file lookups
|
||||
|
||||
diff -Naur tftp-hpa-0.49.orig/tftpd/tftpd.c tftp-hpa-0.49/tftpd/tftpd.c
|
||||
--- tftp-hpa-0.49.orig/tftpd/tftpd.c 2009-03-19 17:50:47.883141096 +0000
|
||||
+++ tftp-hpa-0.49/tftpd/tftpd.c 2009-03-19 18:00:20.991735706 +0000
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <pwd.h>
|
||||
#include <limits.h>
|
||||
#include <syslog.h>
|
||||
+#include <dirent.h>
|
||||
|
||||
#include "common/tftpsubs.h"
|
||||
#include "recvfrom.h"
|
||||
@@ -972,6 +973,9 @@
|
||||
static void tftp_sendfile(struct formats *, struct tftphdr *, int);
|
||||
static void tftp_recvfile(struct formats *, struct tftphdr *, int);
|
||||
|
||||
+int lookup_entry(const char *comp, char *dest);
|
||||
+void lookup_file(char *filename);
|
||||
+
|
||||
struct formats {
|
||||
const char *f_mode;
|
||||
char *(*f_rewrite) (char *, int, const char **);
|
||||
@@ -1332,6 +1336,63 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+int lookup_entry(const char *comp, char *dest)
|
||||
+{
|
||||
+ DIR *dirp;
|
||||
+ struct dirent *dptr;
|
||||
+ dirp = opendir(dest[0] ? dest : ".");
|
||||
+ if (!dirp) return 0;
|
||||
+ while ((dptr = readdir(dirp)))
|
||||
+ {
|
||||
+ if (!strcasecmp(dptr->d_name, comp))
|
||||
+ {
|
||||
+ if (dest[0]) strcat(dest, "/");
|
||||
+ strcat(dest, dptr->d_name);
|
||||
+ closedir(dirp);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ closedir(dirp);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void lookup_file(char *filename)
|
||||
+{
|
||||
+ int found = 0;
|
||||
+ int len = 0;
|
||||
+ char dest[1024];
|
||||
+ char comp[1024];
|
||||
+ char *check = filename;
|
||||
+ char *seek = NULL;
|
||||
+
|
||||
+ dest[0] = 0;
|
||||
+ check++;
|
||||
+ while (*check)
|
||||
+ {
|
||||
+ seek = strchr(check, '\\');
|
||||
+ if (!seek)
|
||||
+ {
|
||||
+ if ((*check) && (lookup_entry(check, dest)))
|
||||
+ found = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ len = seek - check;
|
||||
+ memcpy(comp, check, len);
|
||||
+ comp[len]=0;
|
||||
+ if (!lookup_entry(comp, dest))
|
||||
+ break;
|
||||
+ check += len + 1;
|
||||
+ }
|
||||
+
|
||||
+ if (found)
|
||||
+ {
|
||||
+ filename[0] = 0;
|
||||
+ strcat(filename, dest);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static FILE *file;
|
||||
/*
|
||||
* Validate file access. Since we
|
||||
@@ -1357,6 +1418,7 @@
|
||||
tsize_ok = 0;
|
||||
*errmsg = NULL;
|
||||
|
||||
+ if (*filename == '\\') lookup_file(filename);
|
||||
if (!secure) {
|
||||
if (*filename != '/') {
|
||||
*errmsg = "Only absolute filenames allowed";
|
||||
Reference in New Issue
Block a user