Update patches for this package so that it builds with -Werror and

-Wall with the gcc in NetBSD 5.1, i.e. gcc 4.1.3.  Fixes prompted
by reports that a build outside of pkgsrc for "64-bit Linux" (amd64)
but using this set of patches, gets a segfault, and this fixes that
problem.  Bump pkgrevision.
This commit is contained in:
he 2012-01-25 09:56:08 +00:00
parent 20c9e6dc4e
commit 28a053164b
15 changed files with 842 additions and 67 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.20 2011/12/21 12:03:45 wiz Exp $
# $NetBSD: Makefile,v 1.21 2012/01/25 09:56:08 he Exp $
DISTNAME= yale-tftpd-3.0
PKGREVISION= 5
PKGREVISION= 6
CATEGORIES= net
MASTER_SITES= ftp://ftp.cert.dfn.de/pub/tools/net/yale-tftpd/

View file

@ -1,16 +1,18 @@
$NetBSD: distinfo,v 1.10 2011/09/06 11:20:19 obache Exp $
$NetBSD: distinfo,v 1.11 2012/01/25 09:56:08 he Exp $
SHA1 (yale-tftpd-3.0.tar.gz) = 5f87e3d37feb5c5c8b7f2db34a0c87ee537727af
RMD160 (yale-tftpd-3.0.tar.gz) = 207b88c4383b283e3c0d81a50061a65513031854
Size (yale-tftpd-3.0.tar.gz) = 33469 bytes
SHA1 (patch-aa) = 9523f1d0727be08b2ebea275f0676f824f06c82a
SHA1 (patch-ab) = e6eb66ed95139b47ee1df07014a636803e89ad47
SHA1 (patch-ac) = bd44bf8d19079e1a74850dbcc8cfea3d82f36c3e
SHA1 (patch-ad) = 2ac867228602d860e6cf39ad08dc5bec732fe52e
SHA1 (patch-ae) = 61ae35f5e8d5d8f3cd60ba515a925a4098628fb1
SHA1 (patch-af) = d51ac136dc653395faea0c6f2c748f57584d47b5
SHA1 (patch-ag) = be6114e57b7c154eccd09ac4b9187957d2ba4dde
SHA1 (patch-ah) = aee72d3af9fd015b9e1563610b7e72011ce07a05
SHA1 (patch-ai) = 3624ecf5d448358834e5ace2f18bfd4caaf954db
SHA1 (patch-aj) = 289bd4840cabe516f9ab09e883089f4aa4f7763b
SHA1 (patch-ak) = 48c125fc5012e65b9310298dba29f76e5b60b078
SHA1 (patch-aa) = 3ee2118e261ed2012932ec87f998aa309d187a86
SHA1 (patch-ab) = b32890019b289362b2b0f626394eba128585c9fc
SHA1 (patch-ac) = a009cf18fa7413f1d3b2523f5ad7db600cc7cc57
SHA1 (patch-ad) = 04a5079132a2e9f01c37c9551a09ac244217d2dd
SHA1 (patch-ae) = 8a1da199365465d35b903578323485404155803e
SHA1 (patch-af) = 4d36c2bf21d5f100d012eb8bc83f9770085216f6
SHA1 (patch-ag) = 04f68d8cb30c146978bf5b2d18623645a07cd137
SHA1 (patch-ah) = 105c226bcc36fb14279333ec013340b809eca915
SHA1 (patch-ai) = df8ac74bc8c2517f34f028667470468ad2ba9eef
SHA1 (patch-aj) = 6628e046d2040a9c9ef02acf2f1228a77fcffcf4
SHA1 (patch-ak) = ffcaedfa9937f2b587a06a31ef0a2a3ceeb64a9d
SHA1 (patch-al) = 72a41ee9799ccd6f8d65b650ae73bc405d159b9d
SHA1 (patch-am) = a1d89211e1495c2eb2f6f1a83d822e652fbb41b2

View file

@ -1,4 +1,6 @@
$NetBSD: patch-aa,v 1.3 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-aa,v 1.4 2012/01/25 09:56:08 he Exp $
Adapt for build with pkgsrc.
--- Makefile.orig 1994-10-07 01:41:10.000000000 +0100
+++ Makefile

View file

@ -1,4 +1,6 @@
$NetBSD: patch-ab,v 1.1.1.1 2001/07/30 19:43:49 nra Exp $
$NetBSD: patch-ab,v 1.2 2012/01/25 09:56:08 he Exp $
Don't do lint by default.
--- classes/Makefile.orig Mon Mar 20 21:11:53 1995
+++ classes/Makefile

View file

@ -1,4 +1,6 @@
$NetBSD: patch-ac,v 1.3 2004/03/21 10:29:51 seb Exp $
$NetBSD: patch-ac,v 1.4 2012/01/25 09:56:08 he Exp $
Adapt for build with pkgsrc.
--- tftpd.8.orig Wed Oct 5 06:18:21 1994
+++ tftpd.8

View file

@ -1,7 +1,18 @@
$NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
$NetBSD: patch-ad,v 1.7 2012/01/25 09:56:08 he Exp $
A number of changes to make this build with no warnings under -Wall.
--- tftpd.c.orig 1995-03-20 20:14:39.000000000 +0000
+++ tftpd.c
@@ -24,7 +24,7 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)tftpd.c 5.12 (Berkeley) 6/1/90";
+char tftpd_sccsid[] = "@(#)tftpd.c 5.12 (Berkeley) 6/1/90";
#endif /* not lint */
/*
@@ -43,9 +43,13 @@ static char sccsid[] = "@(#)tftpd.c 5.12
#include <sys/signal.h>
#include <sys/time.h>
@ -16,7 +27,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
#include <arpa/tftp.h>
#include <netdb.h>
@@ -56,17 +60,22 @@ static char sccsid[] = "@(#)tftpd.c 5.12
@@ -56,19 +60,45 @@ static char sccsid[] = "@(#)tftpd.c 5.12
#include <syslog.h>
#include <string.h>
@ -29,6 +40,27 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
#define TIMEOUT 5
-extern int errno;
+extern int readConfigFile(int, char**);
+extern int realPath(char *, char*);
+extern int validateAccessToFile(char *, unsigned long, int);
+extern int isConfigFile(struct stat*);
+
+extern int readit(FILE *, struct tftphdr **, int);
+extern void read_ahead(FILE *, int);
+extern int synchnet(int);
+extern int write_behind(FILE *, int);
+extern int writeit(FILE *, struct tftphdr **, int, int);
+
+
+static void setUpForDebugging();
+static void reapChildren();
+static int awaitInput(int);
+static int createChild();
+static void runChild(struct tftphdr*, int);
+static void tftp(struct tftphdr *, int);
+static void nak(int);
+static int validate_access(char *, int);
+
struct sockaddr_in sock_in = { AF_INET };
int peer;
int rexmtval = TIMEOUT;
@ -41,9 +73,20 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
+char buf[BUF_PKTSIZE];
+char ackbuf[BUF_PKTSIZE];
struct sockaddr_in from;
int fromlen;
-int fromlen;
+socklen_t fromlen;
@@ -105,6 +114,8 @@ char **argv;
extern int tftpDebugLevel;
extern char* tftpDefaultDirectory;
@@ -92,6 +122,7 @@ int n;
}
#endif
+int
main(argc, argv)
int argc;
char **argv;
@@ -105,6 +136,8 @@ char **argv;
if (argc > 1 && strcmp (argv[1], "-d") == 0) {
setUpForDebugging();
@ -52,7 +95,28 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
}
if (ioctl(0, FIONBIO, &on) < 0) {
syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
@@ -202,7 +213,7 @@ setUpForDebugging()
@@ -165,6 +198,7 @@ char **argv;
/* Run directly, rather than called from inetd.
*/
+static void
setUpForDebugging()
{
int peer;
@@ -182,7 +216,7 @@ setUpForDebugging()
listenSock.sin_family = AF_INET;
listenSock.sin_addr.s_addr = htonl(INADDR_ANY);
- if (serv = getservbyname("tftpd", "udp"))
+ if ((serv = getservbyname("tftpd", "udp")) != 0)
listenSock.sin_port = serv->s_port;
else
listenSock.sin_port = htons(69);
@@ -199,10 +233,11 @@ setUpForDebugging()
* wait for <maxInputWait> seconds, or a default
* of 5 minutes if that is not set.
*/
+static int
awaitInput(chan)
int chan;
{
@ -61,7 +125,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
int nready;
struct timeval tv;
extern int maxInputWait;
@@ -212,8 +223,9 @@ int chan;
@@ -212,8 +247,9 @@ int chan;
else
tv.tv_sec = 5*60; /* default: wait for 5 minutes */
tv.tv_usec = 0;
@ -73,7 +137,36 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
return nready;
}
@@ -294,7 +306,10 @@ int n;
@@ -228,6 +264,7 @@ int signum;
}
/* Create a child process */
+static int
createChild()
{
int i, pid;
@@ -247,6 +284,7 @@ createChild()
}
/* check for any terminated child processes */
+static void
reapChildren()
{
int p;
@@ -262,9 +300,10 @@ reapChildren()
* Get a connected socket to the client and process
* the request.
*/
+static void
runChild(tp, n)
-register struct tftphdr *tp;
-int n;
+ struct tftphdr *tp;
+ int n;
{
from.sin_family = AF_INET;
@@ -294,7 +333,10 @@ int n;
}
int validate_access();
@ -85,7 +178,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
struct formats {
char *f_mode;
@@ -303,8 +318,8 @@ struct formats {
@@ -303,8 +345,8 @@ struct formats {
int (*f_recv)();
int f_convert;
} formats[] = {
@ -96,7 +189,35 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
#ifdef notdef
{ "mail", validate_user, sendmail, recvmail, 1 },
#endif
@@ -355,13 +370,13 @@ again:
@@ -314,6 +356,7 @@ struct formats {
/*
* Handle initial connection protocol.
*/
+static void
tftp(tp, size)
struct tftphdr *tp;
int size;
@@ -323,6 +366,8 @@ tftp(tp, size)
register struct formats *pf;
char *filename, *mode;
+ mode = "";
+
#ifdef BROKEN_TH_STUFF /* solaris 2.3 redefiened th_stuff */
filename = cp = (char *) &tp->th_stuff;
#else
@@ -345,8 +390,8 @@ again:
goto again;
}
for (cp = mode; *cp; cp++)
- if (isupper(*cp))
- *cp = tolower(*cp);
+ if (isupper((unsigned char)*cp))
+ *cp = tolower((unsigned char)*cp);
for (pf = formats; pf->f_mode; pf++)
if (strcmp(pf->f_mode, mode) == 0)
break;
@@ -355,13 +400,13 @@ again:
exit(1);
}
if (tftpDebugLevel > 0) {
@ -113,7 +234,15 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
}
ecode = (*pf->f_validate)(filename, tp->th_opcode);
if (ecode) {
@@ -459,17 +474,25 @@ validate_access(filename, mode)
@@ -438,6 +483,7 @@ FILE *file;
*
*/
#define IS_ROOTED(S) (*(S) == '/')
+static int
validate_access(filename, mode)
char *filename;
int mode;
@@ -459,17 +505,25 @@ validate_access(filename, mode)
/* Rule 2:
*/
@ -142,7 +271,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
/* Insure our temporary space is big enough */
maxPath = ((sizeof _tmp) - 1) - rootLen;
@@ -481,6 +504,8 @@ validate_access(filename, mode)
@@ -481,6 +535,8 @@ validate_access(filename, mode)
return EACCESS;
}
@ -151,7 +280,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
/* Squeeze out any '.' or '..' components */
strcpy (tmpPath, filename);
if (realPath (tmpPath, _tmp) < 0) {
@@ -492,21 +517,54 @@ validate_access(filename, mode)
@@ -492,21 +548,54 @@ validate_access(filename, mode)
/* Create the full pathname, prefixed by the
* virtual root.
*/
@ -210,7 +339,7 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
/* Check access lists */
/* Rules 4&5:
*/
@@ -565,7 +623,7 @@ validate_access(filename, mode)
@@ -565,7 +654,7 @@ validate_access(filename, mode)
* This will be done with the effective permissions of the TFTPD
* process.
*/
@ -219,25 +348,27 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
if (fd < 0) {
syslog (LOG_DEBUG, "open fails; errno = %d", errno);
return errno+100;
@@ -593,7 +651,7 @@ void timer()
@@ -593,7 +682,8 @@ void timer()
/*
* Send the requested file.
*/
-sendfile(pf)
+int
+tftpsendfile(pf)
struct formats *pf;
{
struct tftphdr *dp, *r_init();
@@ -664,7 +722,7 @@ void justquit()
@@ -664,7 +754,8 @@ void justquit()
/*
* Receive a file.
*/
-recvfile(pf)
+int
+tftprecvfile(pf)
struct formats *pf;
{
struct tftphdr *dp, *w_init();
@@ -688,7 +746,7 @@ send_ack:
@@ -688,7 +779,7 @@ send_ack:
write_behind(file, pf->f_convert);
for ( ; ; ) {
alarm(rexmtval);
@ -246,3 +377,11 @@ $NetBSD: patch-ad,v 1.6 2011/09/06 11:20:19 obache Exp $
alarm(0);
if (n < 0) { /* really? */
syslog(LOG_ERR, "tftpd: read: %m\n");
@@ -758,6 +849,7 @@ struct errmsg {
* standard TFTP codes, or a UNIX errno
* offset by 100.
*/
+static void
nak(error)
int error;
{

View file

@ -1,4 +1,6 @@
$NetBSD: patch-ae,v 1.2 2005/12/18 18:37:16 joerg Exp $
$NetBSD: patch-ae,v 1.3 2012/01/25 09:56:08 he Exp $
A number of changes to make this build with no warnings under -Wall.
--- classes/access.c.orig 1994-10-05 05:20:44.000000000 +0000
+++ classes/access.c
@ -9,7 +11,43 @@ $NetBSD: patch-ae,v 1.2 2005/12/18 18:37:16 joerg Exp $
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -92,7 +94,6 @@ AccessGroup
@@ -39,7 +41,7 @@ typedef struct ACCESSLISTHEAD {
#if defined (__STDC__)
- int accessGroup_printOn (
+ void accessGroup_printOn (
AccessGroup self,
FILE* file
);
@@ -51,13 +53,14 @@ typedef struct ACCESSLISTHEAD {
listhead_t* alp,
condition_t* condition
);
+/*
static int accessList_validateAddress (
listhead_t* alp,
unsigned long source,
int type
);
-
- static int accessListPrintOn (
+*/
+ static void accessListPrintOn (
listhead_t* alp,
FILE* file
);
@@ -69,6 +72,9 @@ typedef struct ACCESSLISTHEAD {
condition_t* ptr
);
static int accessListVerifyAddress ();
+
+void accessGroup_addCondition(AccessGroup, int, condition_t*);
+
#else
static int accessList_dispose ();
static int accessList_addCondition ();
@@ -92,7 +98,6 @@ AccessGroup
accessGroup_new ()
{
AccessGroup self;
@ -17,3 +55,82 @@ $NetBSD: patch-ae,v 1.2 2005/12/18 18:37:16 joerg Exp $
self = (AccessGroup)calloc (1, sizeof (*self));
return self;
@@ -123,9 +128,9 @@ AccessGroup self;
*/
int
accessGroup_add (self, argc, argv)
-AccessGroup self;
-int argc;
-char **argv;
+ AccessGroup self;
+ int argc;
+ char **argv;
{
condition_t condition;
int list;
@@ -137,14 +142,13 @@ char **argv;
}
-int
+void
accessGroup_addCondition (self, list, condition)
-AccessGroup self;
-condition_t* condition;
-int list;
+ AccessGroup self;
+ int list;
+ condition_t* condition;
{
- condition_t* cp, * lp;
- listhead_t* hp;
+ condition_t* cp;
char *tcp;
/* get enough space for the condition */
@@ -218,9 +222,10 @@ int type;
/* Debugging function */
+void
accessGroup_printOn(self, file)
-AccessGroup self;
-FILE* file;
+ AccessGroup self;
+ FILE* file;
{
register int i;
@@ -365,9 +370,10 @@ static char* permNames[] ={ "deny", "rea
? "<unknown>" : permNames[N])
+void
accessListPrintOn (alp, file)
-listhead_t* alp;
-FILE* file;
+ listhead_t* alp;
+ FILE* file;
{
char* permission;
char addrbuf[32], maskbuf[32];
@@ -426,7 +432,7 @@ condition_t* ptr;
}
av++; ac--;
- if (ac == 1 && **av == '-' || **av == '+') {
+ if ((ac == 1 && **av == '-') || **av == '+') {
int addlist;
listhead_t* hp;
condition_t* cp;
@@ -435,7 +441,9 @@ condition_t* ptr;
self->accessError = "-<list> not implemented yet";
return 0;
}
- if (!isdigit (av[0][1]) || (addlist = atoi (&av[0][1])) < 0) {
+ if (!isdigit ((unsigned char)av[0][1]) ||
+ (addlist = atoi (&av[0][1])) < 0)
+ {
self->accessError =
"+<list> requires positive integer argument";
return 0;

View file

@ -1,6 +1,8 @@
$NetBSD: patch-af,v 1.3 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-af,v 1.4 2012/01/25 09:56:08 he Exp $
--- classes/config.c.orig 1994-10-05 06:18:21.000000000 +0100
A number of changes to make this build with no warnings under -Wall.
--- classes/config.c.orig 1994-10-05 05:18:21.000000000 +0000
+++ classes/config.c
@@ -1,8 +1,12 @@
#define CLASS_Config_PRIVATE
@ -15,23 +17,163 @@ $NetBSD: patch-af,v 1.3 2007/10/02 20:23:08 heinz Exp $
#define DFLT_NFIELDS 10
#define START_FIELD(S) \
@@ -35,10 +39,6 @@ static Config config_expand();
static unsigned char* config_copy();
static unsigned char* get_quoted_string();
@@ -31,13 +35,12 @@ static char quote_delimiters[] = "'\"";
* a normal character.
*/
-static Config config_expand();
-static unsigned char* config_copy();
-static unsigned char* get_quoted_string();
-
-extern char* malloc();
-extern char* realloc();
-extern char* strdup();
-
+static Config config_expand(Config, char*);
+static char* config_copy(Config, char*, char**, int);
+static char* get_quoted_string(char, char*, char**);
+
+void config_setbreak (Config, const char*, const char*);
+
static int dflt_options = CFG_OPT_UCASE;
Config
@@ -130,7 +130,7 @@ char* buf;
@@ -45,7 +48,6 @@ Config
config_new()
{
Config self;
- register char* p;
self = (Config)calloc (1, sizeof (*self));
config_setbreak (self, default_separators, default_delimiters);
@@ -69,17 +71,13 @@ Config self;
return 0;
}
-#ifndef __STDC__
-# define const
-#endif
-int
+void
config_setbreak (self, separators, delimiters)
-Config self;
-const char* separators;
-const char* delimiters;
-#undef const
+ Config self;
+ const char* separators;
+ const char* delimiters;
{
- register unsigned char* p;
+ unsigned char* p;
self->separators = (char*)separators;
self->delimiters = (char*)delimiters;
@@ -112,21 +110,21 @@ Config self;
}
/* Okay, start stashing tokens away */
+int
config_scanbuf (self, buf)
-Config self;
-char* buf;
+ Config self;
+ char* buf;
{
- register unsigned char* fr;
- unsigned char* to;
+ char* fr;
+ char* to;
int type;
- int len;
self->buf = buf;
self->tbuf = strdup(buf);
self->nfields = 0;
- fr = (unsigned char*)self->tbuf; to = (unsigned char*)self->buf;
- while ((type = self->brk[*fr]) != BRK_EOS) {
+ fr = self->tbuf; to = self->buf;
+ while ((type = self->brk[(unsigned char)*fr]) != BRK_EOS) {
switch (type) {
case BRK_QUOTE:
START_FIELD(to);
- fr = get_quoted_string (*fr, fr+1, &to);
+ fr = get_quoted_string (*fr, fr+1, (char**)&to);
fr++; /* skip terminating quote */
break;
@@ -176,8 +174,8 @@ int options;
/* Private methods */
static Config
config_expand (self, fieldstart)
-Config self;
-char* fieldstart;
+ Config self;
+ char* fieldstart;
{
self->maxfields += DFLT_NFIELDS;
@@ -229,11 +227,11 @@ char* fieldstart;
* returns: the location in <ss> where the scan terminated (i.e., the
* terminating instances of <qc>).
*/
-static unsigned char*
+static char*
get_quoted_string (qc, ss, rsd)
-char qc;
-register unsigned char* ss;
-char** rsd;
+ char qc;
+ char* ss;
+ char** rsd;
{
int v;
register char* sd = *rsd;
@@ -251,11 +249,12 @@ char** rsd;
ss++;
/* \xDD: hex digit escape */
- if (*ss == 'x' && isxdigit (ss[1])) {
+ if (*ss == 'x' && isxdigit ((unsigned char)ss[1])) {
v = 0;
ss++;
- v = (hex_ord(*ss) << 4) + hex_ord(ss[1]);
+ v = (hex_ord((unsigned char)*ss) << 4) +
+ hex_ord((unsigned char)ss[1]);
ss++;
*sd++ = v;
continue;
@@ -264,10 +263,12 @@ char** rsd;
/* \DDD: octal digit escape. Up to 3 octal
* digits.
*/
- else if (isodigit(*ss)) {
+ else if (isodigit((unsigned char)*ss)) {
int n = 3;
- for (v = 0; isodigit(*ss) && n > 0; ss++,n--) {
+ for (v = 0; isodigit((unsigned char)*ss) &&
+ n > 0; ss++,n--)
+ {
v = (v << 3) + *ss - '0';
}
ss--;
@@ -297,15 +298,15 @@ char** rsd;
}
/* Copy characters and map to upper-case */
-static unsigned char*
+static char*
config_copy (self, fr, pto, brk)
-Config self;
-register unsigned char* fr;
-unsigned char** pto;
-int brk;
+ Config self;
+ char* fr;
+ char** pto;
+ int brk;
{
- register unsigned char* to = *pto;
- register unsigned char c;
+ char* to = *pto;
+ unsigned char c;
if (self->options & CFG_OPT_UCASE) {
while ((self->brk[c = *fr] & brk) == 0) {

View file

@ -1,10 +1,14 @@
$NetBSD: patch-ag,v 1.2 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-ag,v 1.3 2012/01/25 09:56:08 he Exp $
--- classes/dict.c.orig 1994-10-05 06:20:48.000000000 +0100
A number of changes to make this build with no warnings under -Wall.
--- classes/dict.c.orig 1994-10-05 05:20:48.000000000 +0000
+++ classes/dict.c
@@ -14,8 +14,13 @@
@@ -13,9 +13,15 @@
* [X] provide sequencing over all elements.
*/
+#include <inttypes.h>
#include <stdio.h>
+#include <stdlib.h>
#include <strings.h>
@ -16,3 +20,90 @@ $NetBSD: patch-ag,v 1.2 2007/10/02 20:23:08 heinz Exp $
extern int strcasecmp();
#define _CLASS_Dict_PRIVATE_
@@ -51,16 +57,18 @@ struct _SymEnt_ {
int mayAdd
);
static SymEnt syment_new (void);
- static SymEnt syment_dispose (SymEnt sep);
static Hash_t symhash (Key_t key);
static Hash_t symcasehash (Key_t key);
+#if 0
+static void dict_printOn(Dict, FILE*);
+#endif
+
#else
static Dict dict_expand ();
static SymEnt* dict_locationOf ();
static SymEnt syment_new ();
- static SymEnt syment_dispose ();
static Hash_t symhash ();
static Hash_t symcasehash ();
@@ -164,7 +172,6 @@ Value_t v;
{
SymEnt* psep, sep;
struct _SymEnt_ tmp;
- Hash_t hsh;
tmp.name = n;
psep = dict_locationOf (self, &tmp, 1);
@@ -205,7 +212,6 @@ Key_t n;
{
register SymEnt* psep, sep;
struct _SymEnt_ tmp;
- Value_t v = 0;
tmp.name = n;
psep = dict_locationOf (self, &tmp, 0);
@@ -270,7 +276,6 @@ Value_t v;
{
SymEnt* psep, sep;
struct _SymEnt_ tmp;
- Hash_t hsh;
Value_t oldValue;
@@ -389,15 +394,18 @@ int yesno;
return 0;
}
+#if 0
+static void
dict_printOn (self, file)
-Dict self;
-FILE* file;
+ Dict self;
+ FILE* file;
{
fprintf (file, "Dict(0x%x): nhead=%d; nheadinuse=%d\n",
- self, self->nhead, self->nheadinuse);
+ (intptr_t)self, self->nhead, self->nheadinuse);
fprintf (file, " nitems=%d; avgChain = %.2f\n", self->nitems,
self->nheadinuse ? (double)self->nitems/self->nheadinuse : (double )0);
}
+#endif
/* Private Functions:
*
@@ -477,7 +485,7 @@ Key_t ptr;
{
Hash_t ret = 0;
register unsigned char* nhp = (unsigned char*)ptr;
- register cv;
+ int cv;
while (*nhp) {
cv = *nhp++;
@@ -545,8 +553,8 @@ int mayAdd;
static SymEnt
syment_new()
{
- register SymEnt sep;
- register n;
+ SymEnt sep;
+ int n;
sep = (SymEnt) calloc (DFLTSYMENT, sizeof (*sep));
for (n = 0; n < DFLTSYMENT; n++, sep++)

View file

@ -1,6 +1,8 @@
$NetBSD: patch-ah,v 1.2 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-ah,v 1.3 2012/01/25 09:56:08 he Exp $
--- classes/fuzzdict.c.orig 1994-10-05 06:18:22.000000000 +0100
A number of changes to make this build with no warnings under -Wall.
--- classes/fuzzdict.c.orig 1994-10-05 05:18:22.000000000 +0000
+++ classes/fuzzdict.c
@@ -4,6 +4,9 @@
* unique prefix. Need to find a better name.
@ -22,3 +24,28 @@ $NetBSD: patch-ah,v 1.2 2007/10/02 20:23:08 heinz Exp $
/* Private function declarations */
#ifdef __STDC__
@@ -111,7 +116,7 @@ Key_t key;
{
Value_t rslt;
- if (rslt = SUPER_remove (self, key))
+ if ((rslt = SUPER_remove (self, key)) != 0)
self->keylistValid = 0;
return rslt;
}
@@ -128,13 +133,13 @@ Key_t key;
Value_t ret;
/* Do we have an exact match? */
- if (ret = SUPER_find (self, key))
+ if ((ret = SUPER_find (self, key)) != 0)
return ret;
/*
* See if we can find a unique match on the prefix.
*/
- if (key = fuzzdict_bsearch (self, key))
+ if ((key = fuzzdict_bsearch (self, key)) != 0)
return SUPER_find (self, key);
/* Can't find it */

View file

@ -1,4 +1,6 @@
$NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
$NetBSD: patch-ai,v 1.5 2012/01/25 09:56:08 he Exp $
A number of changes to make this build with no warnings under -Wall.
--- tftpyale.c.orig 1995-03-20 20:11:11.000000000 +0000
+++ tftpyale.c
@ -13,7 +15,24 @@ $NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
#include <sys/stat.h>
#include <netinet/in.h>
#include "tftpyale.h"
@@ -95,7 +96,7 @@ addFileRestriction (ac, av)
@@ -73,6 +74,10 @@ static char* accessFormatError;
static char* cfgets();
static struct stat configStat;
static int defaultAccessList;
+static int addFileRestriction(int, char **);
+static void resetConfig();
+static void accessDebugDump();
+
/* for debugging printouts */
static char* permNames[] ={ "deny", "readonly", "writeonly", "readwrite" };
@@ -90,12 +95,12 @@ static char* permNames[] ={ "deny", "rea
#define CMD_INPUT_WAIT 7
/* Add a file restriction clause to the list */
-static
+static int
addFileRestriction (ac, av)
int ac;
char** av;
{
@ -22,7 +41,7 @@ $NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
ac--; av++;
if (ac != 2) {
@@ -104,7 +105,7 @@ char** av;
@@ -104,7 +109,7 @@ char** av;
}
/* get list number */
@ -31,7 +50,15 @@ $NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
if (list <= 0) {
accessFormatError = "list argument not positive integer";
return 0;
@@ -157,27 +158,24 @@ struct stat* sb;
@@ -142,6 +147,7 @@ int *lineCount;
/* Return whether the file named by the argument stat structure
* is the same as the configuration file.
*/
+int
isConfigFile (sb)
struct stat* sb;
{
@@ -157,27 +163,24 @@ struct stat* sb;
* qualified (starts with '/') check to see if the
* prefix matches the default directory.
*/
@ -65,7 +92,57 @@ $NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
return list ? list : defaultAccessList;
}
@@ -269,7 +267,7 @@ char** argv;
@@ -202,7 +205,7 @@ char* arg;
* on the file and check to see if it's been modified since
* the last read.
*/
-
+int
readConfigFile(argc, argv)
int argc;
char** argv;
@@ -216,12 +219,14 @@ char** argv;
struct stat statb;
Config cnf;
+ fileName="";
/* If given an argument, it must be the name
* of a configuration file. Otherwise use
* the default.
*/
if (tftpDebugLevel > 3) {
- syslog(LOG_DEBUG, "readConfigFile(%d,0x%08x)", argc, argv);
+ syslog(LOG_DEBUG, "readConfigFile(%d,0x%08x)",
+ argc, (intptr_t) argv);
}
if (configf == 0) {
fileName = dfltConfigFile;
@@ -238,7 +243,7 @@ char** argv;
}
if (tftpDebugLevel > 3) {
syslog(LOG_DEBUG, "configFile = '%s'; FILE* = 0x%08x",
- fileName, configf);
+ fileName, (intptr_t)configf);
}
/* See if the file has been changed since the last time we
@@ -250,7 +255,7 @@ char** argv;
fstat(fileno(configf), &statb);
configStat = statb;
if (statb.st_mtime == configModTime)
- return;
+ return 0;
configModTime = statb.st_mtime;
/* Read the config file */
@@ -262,14 +267,13 @@ char** argv;
config_setoptions (cnf, config_getoptions (cnf)& ~CFG_OPT_CASEMAP);
while (cfgets (buf, sizeof buf, configf, &configLineNumber) != NULL) {
- char* end;
cargc = config_scanbuf (cnf, buf);
if (cargc == 0)
continue;
cargv = config_fields(cnf);
@ -74,12 +151,72 @@ $NetBSD: patch-ai,v 1.4 2011/09/06 11:20:19 obache Exp $
/* specify default directory */
case CMD_DEFAULT_DIR:
if (cargc != 2)
@@ -481,7 +479,7 @@ char* buf;
@@ -446,7 +450,7 @@ char* buf;
/* squeeze out current and parent entries */
{
- register i, j;
+ int i, j;
for (i=0, j=0; i < num; i++) {
char* cur = obuf[i];
@@ -481,28 +485,28 @@ char* buf;
static struct CMDS {
char* cmdName;
- int cmdVal;
+ long cmdVal;
} configCmds[] ={
"default-directory", CMD_DEFAULT_DIR,
"defaultDirectory", CMD_DEFAULT_DIR,
- "default-directory", CMD_DEFAULT_DIR,
- "defaultDirectory", CMD_DEFAULT_DIR,
- "debug-level", CMD_DEBUG_LEVEL,
- "debugLevel", CMD_DEBUG_LEVEL,
- "root-directory", CMD_ROOT_DIR,
- "rootDirectory", CMD_ROOT_DIR,
- "access-list", CMD_ACCESS_LIST,
- "accessList", CMD_ACCESS_LIST,
- "default-access-list", CMD_DEFAULT_ACCESS_LIST,
- "defaultAccessList", CMD_DEFAULT_ACCESS_LIST,
- "restrict", CMD_RESTRICT,
- "inputWait", CMD_INPUT_WAIT,
- "input-wait", CMD_INPUT_WAIT,
- (char*)0, 0
+ { "default-directory", CMD_DEFAULT_DIR },
+ { "defaultDirectory", CMD_DEFAULT_DIR },
+ { "debug-level", CMD_DEBUG_LEVEL },
+ { "debugLevel", CMD_DEBUG_LEVEL },
+ { "root-directory", CMD_ROOT_DIR },
+ { "rootDirectory", CMD_ROOT_DIR },
+ { "access-list", CMD_ACCESS_LIST },
+ { "accessList", CMD_ACCESS_LIST },
+ { "default-access-list",CMD_DEFAULT_ACCESS_LIST },
+ { "defaultAccessList", CMD_DEFAULT_ACCESS_LIST },
+ { "restrict", CMD_RESTRICT },
+ { "inputWait", CMD_INPUT_WAIT },
+ { "input-wait", CMD_INPUT_WAIT },
+ { (char*)0, 0 }
};
/* reset configuration options to defaults */
+static void
resetConfig()
{
- register int i;
extern char* dfltDefaultDirectory;
extern char* dfltRootDirectory;
extern int dfltDebugLevel;
@@ -603,12 +607,14 @@ int type;
#ifndef DEBUG
+static void
accessDebugDump()
{
}
#else
#include <stdio.h>
+static void
accessDebugDump()
{
FILE* logf;

View file

@ -1,14 +1,26 @@
$NetBSD: patch-aj,v 1.2 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-aj,v 1.3 2012/01/25 09:56:08 he Exp $
--- tftpsubs.c.orig 1994-10-05 06:20:49.000000000 +0100
A number of changes to make this build with no warnings under -Wall.
--- tftpsubs.c.orig 1994-10-05 05:20:49.000000000 +0000
+++ tftpsubs.c
@@ -38,12 +38,15 @@ static char sccsid[] = "@(#)tftpsubs.c 5
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)tftpsubs.c 5.5 (Berkeley) 6/1/90";
+char subs_sccsid[] = "@(#)tftpsubs.c 5.5 (Berkeley) 6/1/90";
#endif /* not lint */
/* Simple minded read-ahead/write-behind subroutines for tftp user and
@@ -38,12 +38,16 @@ static char sccsid[] = "@(#)tftpsubs.c 5
#include <netinet/in.h>
#include <arpa/tftp.h>
#include <stdio.h>
+#ifdef __sun
+#include <sys/filio.h>
+#endif
+#include <unistd.h>
-#define PKTSIZE SEGSIZE+4 /* should be moved to tftp.h */
+#define BUF_PKTSIZE SEGSIZE+4 /* should be moved to tftp.h */
@ -20,12 +32,73 @@ $NetBSD: patch-aj,v 1.2 2007/10/02 20:23:08 heinz Exp $
} bfs[2];
/* Values for bf.counter */
@@ -233,7 +236,7 @@ synchnet(f)
@@ -58,8 +62,12 @@ static int current; /* index of buff
int newline = 0; /* fillbuf: in middle of newline expansion */
int prevchar = -1; /* putbuf: previous char (cr check) */
+void read_ahead(FILE *, int);
+int write_behind(FILE *, int);
+
struct tftphdr *rw_init();
+
struct tftphdr *w_init() { return rw_init(0); } /* write-behind */
struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */
@@ -80,6 +88,7 @@ int x; /* zero for writ
/* Have emptied current buffer by sending to net and getting ack.
Free it and return next buffer filled with data.
*/
+int
readit(file, dpp, convert)
FILE *file; /* file opened for read */
struct tftphdr **dpp;
@@ -93,7 +102,7 @@ readit(file, dpp, convert)
b = &bfs[current]; /* look at new buffer */
if (b->counter == BF_FREE) /* if it's empty */
read_ahead(file, convert); /* fill it */
-/* assert(b->counter != BF_FREE); /* check */
+/* assert(b->counter != BF_FREE); check */
*dpp = (struct tftphdr *)b->buf; /* set caller's ptr */
return b->counter;
}
@@ -102,6 +111,7 @@ readit(file, dpp, convert)
* fill the input buffer, doing ascii conversions if requested
* conversions are lf -> cr,lf and cr -> cr, nul
*/
+void
read_ahead(file, convert)
FILE *file; /* file opened for read */
int convert; /* if true, convert to ascii */
@@ -150,9 +160,11 @@ read_ahead(file, convert)
from the queue. Calls write_behind only if next buffer not
available.
*/
+int
writeit(file, dpp, ct, convert)
FILE *file;
struct tftphdr **dpp;
+ int ct;
int convert;
{
bfs[current].counter = ct; /* set size of data to write */
@@ -170,6 +182,7 @@ writeit(file, dpp, ct, convert)
* Note spec is undefined if we get CR as last byte of file or a
* CR followed by anything else. In this case we leave it alone.
*/
+int
write_behind(file, convert)
FILE *file;
int convert;
@@ -233,9 +246,9 @@ synchnet(f)
int f; /* socket to flush */
{
int i, j = 0;
- char rbuf[PKTSIZE];
+ char rbuf[BUF_PKTSIZE];
struct sockaddr_in from;
int fromlen;
- int fromlen;
+ socklen_t fromlen;
while (1) {
(void) ioctl(f, FIONREAD, &i);

View file

@ -1,6 +1,8 @@
$NetBSD: patch-ak,v 1.1 2007/10/02 20:23:08 heinz Exp $
$NetBSD: patch-ak,v 1.2 2012/01/25 09:56:08 he Exp $
--- tftpyale.h.orig 1995-03-20 21:19:10.000000000 +0100
A number of changes to make this build with no warnings under -Wall.
--- tftpyale.h.orig 1995-03-20 20:19:10.000000000 +0000
+++ tftpyale.h
@@ -24,6 +24,10 @@ extern int dfltDebugLevel;
#include <stdlib.h>

View file

@ -0,0 +1,24 @@
$NetBSD: patch-al,v 1.1 2012/01/25 09:56:09 he Exp $
A number of changes to make this build with no warnings under -Wall.
--- classes/access.h.orig 1994-10-05 05:18:21.000000000 +0000
+++ classes/access.h
@@ -16,7 +16,7 @@ typedef struct _AccessGroup_* AccessGrou
);
struct _AccessCondition_;
- int accessGroup_addCondition (
+ void accessGroup_addCondition (
AccessGroup self,
int list,
struct _AccessCondition_* condition
@@ -31,7 +31,7 @@ typedef struct _AccessGroup_* AccessGrou
char* accessGroup_lastError ( AccessGroup self );
- int accessGroup_printOn (
+ void accessGroup_printOn (
AccessGroup self,
FILE* file
);

View file

@ -0,0 +1,15 @@
$NetBSD: patch-am,v 1.1 2012/01/25 09:56:09 he Exp $
A number of changes to make this build with no warnings under -Wall.
--- classes/config.h.orig 2012-01-24 11:37:19.000000000 +0000
+++ classes/config.h
@@ -11,7 +11,7 @@ typedef struct _Config_* Config;
int config_nfields (Config self);
char** config_fields (Config self);
int config_scanbuf (Config self, char* buf);
- int config_setbreak (
+ void config_setbreak (
Config self,
const char* delimiters,
const char* punctuation