summaryrefslogtreecommitdiff
path: root/net/yale-tftpd/patches/patch-ai
blob: 0eb5bb9608f62ec995f9a3ae679c6e5adf9e09d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$NetBSD: patch-ai,v 1.3 2007/10/02 20:23:08 heinz Exp $

--- tftpyale.c.orig	1995-03-20 21:11:11.000000000 +0100
+++ tftpyale.c
@@ -2,8 +2,8 @@
 #include <string.h>
 #include <syslog.h>
 #include <ctype.h>
-#include <arpa/tftp.h>
 #include <sys/types.h>
+#include <arpa/tftp.h>
 #include <sys/stat.h>
 #include <netinet/in.h>
 #include "tftpyale.h"
@@ -95,7 +95,7 @@ addFileRestriction (ac, av)
 int	ac;
 char**	av;
 {
-	int list;
+	long list;
 
 	ac--; av++;
 	if (ac != 2) {
@@ -104,7 +104,7 @@ char**	av;
 	}
 
 	/* get list number */
-	list = atoi (av[1]);
+	list = atol (av[1]);
 	if (list <= 0) {
 		accessFormatError = "list argument not positive integer";
 		return 0;
@@ -157,27 +157,24 @@ struct stat* sb;
  * qualified (starts with '/') check to see if the
  * prefix matches the default directory.
  */
-static int
+static long
 getAccessList (fileName)
 char* fileName;
 {
-	unsigned int list;
+	unsigned long list;
 	char* rindex();
 
 	if (*fileName == '/') {
-		char* sep = rindex (fileName, '/');
-		int count = sep - fileName;
-
-		if (count > 0)
-			count--;
 		if (tftpDefaultDirectory
 		    && strncmp(fileName, tftpDefaultDirectory,
 				strlen(tftpDefaultDirectory))==0) {
-			fileName = sep+1;
+			fileName +=strlen(tftpDefaultDirectory);
+			if(*fileName == '/')
+				fileName++;
 		}
 	}
 
-	list = (int)dict_find (fileAccessDict, fileName);
+	list = (long)dict_find (fileAccessDict, fileName);
 
 	return list ? list : defaultAccessList;
 }
@@ -269,7 +266,7 @@ char**	argv;
 			continue;
 
 		cargv = config_fields(cnf);
-		switch ((int)dict_find (commandDict, cargv[0])) {
+		switch ((long)dict_find (commandDict, cargv[0])) {
 		  /* specify default directory */
 		  case CMD_DEFAULT_DIR:
 			if (cargc != 2)
@@ -481,7 +478,7 @@ char*	buf;
 
 static struct CMDS {
 	char* cmdName;
-	int cmdVal;
+	long cmdVal;
 } configCmds[] ={
 	"default-directory",	CMD_DEFAULT_DIR,
 	"defaultDirectory",	CMD_DEFAULT_DIR,