pkgsrc/net/yale-tftpd/patches/patch-ai
seb 9f974bbe50 Fix accessList processing when sub directories are involved.
From PR pkg/23650 by Luc Beurton luc at black-kettle dot univ-ubs dot fr.

While here claim stewardship, use subst.mk framework, and fix a typo
in a patch file.

Bump PKGREVISION.
2004-03-21 10:29:51 +00:00

74 lines
1.7 KiB
Text

$NetBSD: patch-ai,v 1.2 2004/03/21 10:29:51 seb Exp $
--- tftpyale.c.orig 1995-03-20 21:11:11.000000000 +0100
+++ tftpyale.c
@@ -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,