forked from mirrors/tftp-hpa-google
Major overhaul of the portability stuff; port to autoconf 2.52
This commit is contained in:
parent
4c0a635276
commit
2c31169f57
16 changed files with 236 additions and 176 deletions
21
MCONFIG.in
21
MCONFIG.in
|
@ -1,3 +1,20 @@
|
||||||
|
## -*- makefile -*- ------------------------------------------------------
|
||||||
|
##
|
||||||
|
## Copyright 2001 H. Peter Anvin - All Rights Reserved
|
||||||
|
##
|
||||||
|
## This program is free software available under the same license
|
||||||
|
## as the "OpenBSD" operating system, distributed at
|
||||||
|
## http://www.openbsd.org/.
|
||||||
|
##
|
||||||
|
## -----------------------------------------------------------------------
|
||||||
|
## $Id$
|
||||||
|
|
||||||
|
##
|
||||||
|
## MCONFIG.in
|
||||||
|
##
|
||||||
|
## Basic Makefile definitions
|
||||||
|
##
|
||||||
|
|
||||||
# Prefixes
|
# Prefixes
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
|
@ -11,7 +28,7 @@ MANDIR = @mandir@
|
||||||
# System binaries
|
# System binaries
|
||||||
SBINDIR = @sbindir@
|
SBINDIR = @sbindir@
|
||||||
|
|
||||||
# Install into chroot area
|
# Install into alternate root area, e.g. for package generation
|
||||||
INSTALLROOT =
|
INSTALLROOT =
|
||||||
|
|
||||||
# Install program
|
# Install program
|
||||||
|
@ -21,7 +38,7 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
# Compiler and compiler flags
|
# Compiler and compiler flags
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@ -I$(SRCROOT)
|
||||||
|
|
||||||
# Link flags
|
# Link flags
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
17
Makefile
17
Makefile
|
@ -22,24 +22,29 @@ install: MCONFIG $(patsubst %, %.install, $(SUB))
|
||||||
clean: $(patsubst %, %.clean, $(SUB))
|
clean: $(patsubst %, %.clean, $(SUB))
|
||||||
|
|
||||||
distclean: $(patsubst %, %.distclean, $(SUB))
|
distclean: $(patsubst %, %.distclean, $(SUB))
|
||||||
rm -f MCONFIG config.status config.cache config.log config.h *~ \#*
|
rm -f MCONFIG config.status config.log acconfig.h *~ \#*
|
||||||
|
rm -rf *.cache
|
||||||
find . -type f \( -name \*.orig -o -name \*.rej \) | xargs -r rm -f
|
find . -type f \( -name \*.orig -o -name \*.rej \) | xargs -r rm -f
|
||||||
|
|
||||||
spotless: distclean
|
spotless: distclean
|
||||||
rm -f configure
|
rm -f configure acconfig.h.in
|
||||||
|
|
||||||
config: MCONFIG
|
config: MCONFIG
|
||||||
|
|
||||||
release:
|
release:
|
||||||
$(MAKE) configure
|
$(MAKE) configure acconfig.h.in
|
||||||
$(MAKE) distclean
|
$(MAKE) distclean
|
||||||
|
|
||||||
MCONFIG: configure MCONFIG.in config.h.in
|
MCONFIG: configure MCONFIG.in acconfig.h.in
|
||||||
./configure
|
./configure
|
||||||
|
|
||||||
config.h: MCONFIG
|
acconfig.h: MCONFIG
|
||||||
: Generated by side effect
|
: Generated by side effect
|
||||||
|
|
||||||
|
acconfig.h.in: configure.in aclocal.m4
|
||||||
|
autoheader
|
||||||
|
rm -f acconfig.h
|
||||||
|
|
||||||
configure: configure.in aclocal.m4
|
configure: configure.in aclocal.m4
|
||||||
autoconf
|
autoconf
|
||||||
rm -f MCONFIG config.cache config.log config.h
|
rm -f MCONFIG config.cache config.log acconfig.h
|
||||||
|
|
7
README
7
README
|
@ -22,10 +22,13 @@ Changes in 0.22:
|
||||||
Even more portability improvements: FreeBSD and
|
Even more portability improvements: FreeBSD and
|
||||||
Tru64/Digital Unix.
|
Tru64/Digital Unix.
|
||||||
|
|
||||||
Some minor source cleanups.
|
|
||||||
|
|
||||||
Fix tsize option on systems on which off_t is "long long".
|
Fix tsize option on systems on which off_t is "long long".
|
||||||
|
|
||||||
|
Support large files on systems which need _LARGE_FILE_BITS or
|
||||||
|
similar.
|
||||||
|
|
||||||
|
Some source cleanups; change to autoconf 2.52.
|
||||||
|
|
||||||
|
|
||||||
Changes in 0.21:
|
Changes in 0.21:
|
||||||
Support running in standalone mode, without inetd.
|
Support running in standalone mode, without inetd.
|
||||||
|
|
27
aclocal.m4
vendored
27
aclocal.m4
vendored
|
@ -31,29 +31,14 @@ AC_DEFUN(PA_SIGSETJMP,
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
$2)])
|
$2)])
|
||||||
|
|
||||||
dnl --------------------------------------------------------------------------
|
|
||||||
dnl PA_HAVE_LONG_LONG
|
|
||||||
dnl
|
|
||||||
dnl Does the C compiler support long long?
|
|
||||||
dnl --------------------------------------------------------------------------
|
|
||||||
AC_DEFUN(PA_HAVE_LONG_LONG,
|
|
||||||
[AC_MSG_CHECKING([if C compiler supports long long])
|
|
||||||
AC_TRY_LINK(
|
|
||||||
[],
|
|
||||||
[long long foo = 1LL;
|
|
||||||
unsigned long long bar = 1ULL;
|
|
||||||
return (int)(foo-bar);
|
|
||||||
],
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
$1,
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
$2)])
|
|
||||||
|
|
||||||
dnl --------------------------------------------------------------------------
|
dnl --------------------------------------------------------------------------
|
||||||
dnl PA_MSGHDR_MSG_CONTROL
|
dnl PA_MSGHDR_MSG_CONTROL
|
||||||
dnl
|
dnl
|
||||||
dnl Does struct msghdr have the msg_control field?
|
dnl Does struct msghdr have the msg_control field?
|
||||||
dnl --------------------------------------------------------------------------
|
dnl --------------------------------------------------------------------------
|
||||||
|
AH_TEMPLATE([HAVE_MSGHDR_MSG_CONTROL],
|
||||||
|
[Define to 1 if struct msghdr has the msg_control field.])
|
||||||
|
|
||||||
AC_DEFUN(PA_MSGHDR_MSG_CONTROL,
|
AC_DEFUN(PA_MSGHDR_MSG_CONTROL,
|
||||||
[AC_MSG_CHECKING([for msg_control in struct msghdr])
|
[AC_MSG_CHECKING([for msg_control in struct msghdr])
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
|
@ -82,6 +67,9 @@ dnl Look for definition of struct in_pktinfo. Some versions of glibc
|
||||||
dnl lack struct in_pktinfo; if so we need to include the definition
|
dnl lack struct in_pktinfo; if so we need to include the definition
|
||||||
dnl ourselves -- but we only want to do that if absolutely necessary!
|
dnl ourselves -- but we only want to do that if absolutely necessary!
|
||||||
dnl ------------------------------------------------------------------------
|
dnl ------------------------------------------------------------------------
|
||||||
|
AH_TEMPLATE([HAVE_STRUCT_IN_PKTINFO],
|
||||||
|
[Define to 1 if struct in_pktinfo is defined.])
|
||||||
|
|
||||||
AC_DEFUN(PA_STRUCT_IN_PKTINFO,
|
AC_DEFUN(PA_STRUCT_IN_PKTINFO,
|
||||||
[AC_MSG_CHECKING([for definition of struct in_pktinfo])
|
[AC_MSG_CHECKING([for definition of struct in_pktinfo])
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
|
@ -112,6 +100,9 @@ dnl
|
||||||
dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS
|
dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS
|
||||||
dnl due to the need to provide "allow_severity" and "deny_severity" variables
|
dnl due to the need to provide "allow_severity" and "deny_severity" variables
|
||||||
dnl --------------------------------------------------------------------------
|
dnl --------------------------------------------------------------------------
|
||||||
|
AH_TEMPLATE([HAVE_TCPWRAPPERS],
|
||||||
|
[Define to 1 if we have tcpwrappers (-lwrap) and <tcpd.h>.])
|
||||||
|
|
||||||
AC_DEFUN(PA_HAVE_TCPWRAPPERS,
|
AC_DEFUN(PA_HAVE_TCPWRAPPERS,
|
||||||
[AC_CHECK_LIB([wrap], [main])
|
[AC_CHECK_LIB([wrap], [main])
|
||||||
AC_MSG_CHECKING([for tcpwrappers])
|
AC_MSG_CHECKING([for tcpwrappers])
|
||||||
|
|
144
config.h
Normal file
144
config.h
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
/* -*- c -*- ------------------------------------------------------------- *
|
||||||
|
*
|
||||||
|
* Copyright 2001 H. Peter Anvin - All Rights Reserved
|
||||||
|
*
|
||||||
|
* This program is free software available under the same license
|
||||||
|
* as the "OpenBSD" operating system, distributed at
|
||||||
|
* http://www.openbsd.org/.
|
||||||
|
*
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* config.h
|
||||||
|
*
|
||||||
|
* Sets up a common baseline environment, based on "autoconf" findings...
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H 1
|
||||||
|
|
||||||
|
/* Must be included before we include any system headers! */
|
||||||
|
#include "acconfig.h"
|
||||||
|
|
||||||
|
/* Standard includes */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STDC_HEADERS
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_MEMORY_H
|
||||||
|
#ifndef STDC_HEADERS
|
||||||
|
#include <memory.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
|
#include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
/* If we don't have intmax_t, try creating it */
|
||||||
|
|
||||||
|
#ifndef HAVE_INTMAX_T
|
||||||
|
#ifdef HAVE_LONG_LONG
|
||||||
|
typedef long long intmax_t;
|
||||||
|
typedef unsigned long long uintmax_t;
|
||||||
|
#define PRIdMAX "%Ld"
|
||||||
|
#define PRIuMAX "%Lu"
|
||||||
|
#define PRIxMAX "%Lx"
|
||||||
|
#define INTMAX_C(x) (x##LL)
|
||||||
|
#define UINTMAX_C(x) (x##ULL)
|
||||||
|
#define strtoumax(p,e,b) strtoull(p,e,b)
|
||||||
|
#else
|
||||||
|
typedef long intmax_t;
|
||||||
|
typedef unsigned long uintmax_t;
|
||||||
|
#define PRIdMAX "%ld"
|
||||||
|
#define PRIuMAX "%lu"
|
||||||
|
#define PRIxMAX "%lx"
|
||||||
|
#define INTMAX_C(x) (x##L)
|
||||||
|
#define UINTMAX_C(x) (x##UL)
|
||||||
|
#define strtoumax(p,e,b) strtoul(p,e,b)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYSEXITS_H
|
||||||
|
#include <sysexits.h>
|
||||||
|
#else
|
||||||
|
#define EX_USAGE 64 /* command line usage error */
|
||||||
|
#define EX_DATAERR 65 /* data format error */
|
||||||
|
#define EX_NOINPUT 66 /* cannot open input */
|
||||||
|
#define EX_NOUSER 67 /* addressee unknown */
|
||||||
|
#define EX_NOHOST 68 /* host name unknown */
|
||||||
|
#define EX_UNAVAILABLE 69 /* service unavailable */
|
||||||
|
#define EX_SOFTWARE 70 /* internal software error */
|
||||||
|
#define EX_OSERR 71 /* system error (e.g., can't fork) */
|
||||||
|
#define EX_OSFILE 72 /* critical OS file missing */
|
||||||
|
#define EX_CANTCREAT 73 /* can't create (user) output file */
|
||||||
|
#define EX_IOERR 74 /* input/output error */
|
||||||
|
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
|
||||||
|
#define EX_PROTOCOL 76 /* remote error in protocol */
|
||||||
|
#define EX_NOPERM 77 /* permission denied */
|
||||||
|
#define EX_CONFIG 78 /* configuration error */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we don't have sigsetjmp() et all, setjmp() will have to do */
|
||||||
|
|
||||||
|
#ifndef HAVE_SIGSETJMP
|
||||||
|
#define sigsetjmp(x,y) setjmp(x)
|
||||||
|
#define siglongjmp(x,y) longjmp(x,y)
|
||||||
|
#define sigjmp_buf jmp_buf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* How do we annotate unused data items? */
|
||||||
|
|
||||||
|
#ifndef UNUSED
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define UNUSED
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sometimes IPPORT_TFTP isn't defined */
|
||||||
|
#ifndef HAVE_IPPORT_TFTP_DEFINITION
|
||||||
|
#ifndef IPPORT_TFTP
|
||||||
|
#define IPPORT_TFTP 69
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
57
config.h.in
57
config.h.in
|
@ -1,57 +0,0 @@
|
||||||
/* $Id$ */
|
|
||||||
/* ----------------------------------------------------------------------- *
|
|
||||||
*
|
|
||||||
* Copyright 2001 H. Peter Anvin - All Rights Reserved
|
|
||||||
*
|
|
||||||
* This program is free software available under the same license
|
|
||||||
* as the "OpenBSD" operating system, distributed at
|
|
||||||
* http://www.openbsd.org/.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* config.h.in
|
|
||||||
*
|
|
||||||
* Pattern file for configurations
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef HAVE_SIGSETJMP
|
|
||||||
#undef HAVE_MSGHDR_MSG_CONTROL
|
|
||||||
#undef HAVE_RECVMSG
|
|
||||||
#undef HAVE_TCPWRAPPERS
|
|
||||||
#undef HAVE_STRUCT_IN_PKTINFO
|
|
||||||
#undef HAVE_SETREUID
|
|
||||||
#undef HAVE_SETREGID
|
|
||||||
#undef HAVE_SETSID
|
|
||||||
#undef HAVE_IPPORT_TFTP_DEFINITION
|
|
||||||
#undef HAVE_SYSEXITS_H
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
#undef HAVE_LIBGEN_H
|
|
||||||
#undef HAVE_SYS_FILIO_H
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
#undef HAVE_LONG_LONG
|
|
||||||
#undef WITH_REGEX
|
|
||||||
|
|
||||||
#ifdef HAVE_INTTYPES_H
|
|
||||||
#include <inttypes.h>
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
typedef long long intmax_t;
|
|
||||||
typedef unsigned long long uintmax_t;
|
|
||||||
#define PRIdMAX "%Ld"
|
|
||||||
#define PRIuMAX "%Lu"
|
|
||||||
#define PRIxMAX "%Lx"
|
|
||||||
#define INTMAX_C(x) (x##LL)
|
|
||||||
#define UINTMAX_C(x) (x##ULL)
|
|
||||||
#define strtoumax(p,e,b) strtoull(p,e,b)
|
|
||||||
#else
|
|
||||||
typedef long intmax_t;
|
|
||||||
typedef unsigned long uintmax_t;
|
|
||||||
#define PRIdMAX "%ld"
|
|
||||||
#define PRIuMAX "%lu"
|
|
||||||
#define PRIxMAX "%lx"
|
|
||||||
#define INTMAX_C(x) (x##L)
|
|
||||||
#define UINTMAX_C(x) (x##UL)
|
|
||||||
#define strtoumax(p,e,b) strtoul(p,e,b)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
36
configure.in
36
configure.in
|
@ -2,15 +2,20 @@ dnl
|
||||||
dnl autoconf input file to generate MCONFIG
|
dnl autoconf input file to generate MCONFIG
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_PREREQ(2.13)
|
AC_PREREQ(2.52)
|
||||||
AC_REVISION([$Id$])
|
AC_REVISION([$Id$])
|
||||||
AC_INIT(MCONFIG.in)
|
AC_INIT(MCONFIG.in)
|
||||||
AC_PREFIX_DEFAULT(/usr)
|
AC_PREFIX_DEFAULT(/usr)
|
||||||
|
|
||||||
|
AC_ISC_POSIX
|
||||||
|
AC_AIX
|
||||||
|
AC_MINIX
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
|
||||||
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
PA_ADD_CFLAGS(-W)
|
PA_ADD_CFLAGS(-W)
|
||||||
PA_ADD_CFLAGS(-Wall)
|
PA_ADD_CFLAGS(-Wall)
|
||||||
PA_ADD_CFLAGS(-Wpointer-arith)
|
PA_ADD_CFLAGS(-Wpointer-arith)
|
||||||
|
@ -27,11 +32,24 @@ PA_ADD_CFLAGS(-Wshadow)
|
||||||
PA_ADD_CFLAGS(-Wsign-compare)
|
PA_ADD_CFLAGS(-Wsign-compare)
|
||||||
PA_ADD_CFLAGS(-pipe)
|
PA_ADD_CFLAGS(-pipe)
|
||||||
|
|
||||||
AC_CHECK_HEADERS(sysexits.h)
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(strings.h)
|
|
||||||
AC_CHECK_HEADERS(libgen.h)
|
|
||||||
AC_CHECK_HEADERS(inttypes.h)
|
AC_CHECK_HEADERS(inttypes.h)
|
||||||
|
AC_CHECK_HEADERS(libgen.h)
|
||||||
|
AC_CHECK_HEADERS(memory.h)
|
||||||
|
AC_CHECK_HEADERS(stddef.h)
|
||||||
|
AC_CHECK_HEADERS(stdint.h)
|
||||||
|
AC_CHECK_HEADERS(stdlib.h)
|
||||||
|
AC_CHECK_HEADERS(string.h)
|
||||||
|
AC_CHECK_HEADERS(strings.h)
|
||||||
|
AC_CHECK_HEADERS(sysexits.h)
|
||||||
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
AC_CHECK_HEADERS(sys/filio.h)
|
AC_CHECK_HEADERS(sys/filio.h)
|
||||||
|
AC_CHECK_HEADERS(sys/stat.h)
|
||||||
|
AC_CHECK_HEADERS(sys/types.h)
|
||||||
|
|
||||||
|
AC_CHECK_TYPES(intmax_t)
|
||||||
|
AC_CHECK_TYPES(long long)
|
||||||
|
AC_TYPE_PID_T
|
||||||
|
|
||||||
AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR(socket library not found)])
|
AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR(socket library not found)])
|
||||||
AC_SEARCH_LIBS(gethostbyname, [nsl resolv], , [AC_MSG_ERROR(gethostbyname not found)])
|
AC_SEARCH_LIBS(gethostbyname, [nsl resolv], , [AC_MSG_ERROR(gethostbyname not found)])
|
||||||
|
@ -45,6 +63,8 @@ AC_CHECK_FUNCS(setregid)
|
||||||
PA_MSGHDR_MSG_CONTROL
|
PA_MSGHDR_MSG_CONTROL
|
||||||
PA_STRUCT_IN_PKTINFO
|
PA_STRUCT_IN_PKTINFO
|
||||||
|
|
||||||
|
AH_TEMPLATE([HAVE_IPPORT_TFTP_DEFINITION],
|
||||||
|
[Define to 1 if netinet/in.h defines IPPORT_TFTP.])
|
||||||
PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP)
|
PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP)
|
||||||
|
|
||||||
PA_WITH_BOOL(tcpwrappers, 1,
|
PA_WITH_BOOL(tcpwrappers, 1,
|
||||||
|
@ -54,6 +74,9 @@ PA_WITH_BOOL(tcpwrappers, 1,
|
||||||
PA_HAVE_TCPWRAPPERS
|
PA_HAVE_TCPWRAPPERS
|
||||||
],:)
|
],:)
|
||||||
|
|
||||||
|
AH_TEMPLATE([WITH_REGEX],
|
||||||
|
[Define to 1 if we are compiling with regex filename remapping.])
|
||||||
|
|
||||||
PA_WITH_BOOL(remap, 1,
|
PA_WITH_BOOL(remap, 1,
|
||||||
[ --without-remap Disable regex-based filename remapping],
|
[ --without-remap Disable regex-based filename remapping],
|
||||||
[
|
[
|
||||||
|
@ -67,8 +90,9 @@ PA_WITH_BOOL(remap, 1,
|
||||||
])
|
])
|
||||||
],:)
|
],:)
|
||||||
|
|
||||||
|
AH_TEMPLATE([HAVE_SIGSETJMP],
|
||||||
|
[Define to 1 if we have sigsetjmp, siglongjmp and sigjmp_buf.])
|
||||||
PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)])
|
PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)])
|
||||||
PA_HAVE_LONG_LONG([AC_DEFINE(HAVE_LONG_LONG)])
|
|
||||||
|
|
||||||
LIBXTRA=false
|
LIBXTRA=false
|
||||||
AC_SEARCH_LIBS(xmalloc, iberty, , LIBXTRA=true LIBOBJS="$LIBOBJS xmalloc.o")
|
AC_SEARCH_LIBS(xmalloc, iberty, , LIBXTRA=true LIBOBJS="$LIBOBJS xmalloc.o")
|
||||||
|
@ -84,5 +108,5 @@ AC_SUBST(TFTPDOBJS)
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(acconfig.h)
|
||||||
AC_OUTPUT(MCONFIG)
|
AC_OUTPUT(MCONFIG)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Extra functions which may not be available everywhere
|
# Extra functions which may not be available everywhere
|
||||||
#
|
#
|
||||||
|
|
||||||
|
SRCROOT = ..
|
||||||
|
|
||||||
-include ../MCONFIG
|
-include ../MCONFIG
|
||||||
include ../MRULES
|
include ../MRULES
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
all: tftp
|
all: tftp
|
||||||
|
|
||||||
|
SRCROOT = ..
|
||||||
|
|
||||||
-include ../MCONFIG
|
-include ../MCONFIG
|
||||||
include ../MRULES
|
include ../MRULES
|
||||||
|
|
||||||
|
|
|
@ -45,15 +45,7 @@
|
||||||
#ifndef TFTPSUBS_H
|
#ifndef TFTPSUBS_H
|
||||||
#define TFTPSUBS_H
|
#define TFTPSUBS_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "config.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <setjmp.h>
|
|
||||||
#include "../config.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_IPPORT_TFTP_DEFINITION
|
|
||||||
#define IPPORT_TFTP 69
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct tftphdr;
|
struct tftphdr;
|
||||||
|
|
||||||
|
@ -81,19 +73,4 @@ extern char *xstrdup(const char *);
|
||||||
*/
|
*/
|
||||||
void (*bsd_signal(int, void (*)(int)))(int);
|
void (*bsd_signal(int, void (*)(int)))(int);
|
||||||
|
|
||||||
#ifndef HAVE_SIGSETJMP
|
|
||||||
#define sigsetjmp(x,y) setjmp(x)
|
|
||||||
#define siglongjmp(x,y) longjmp(x,y)
|
|
||||||
#define sigjmp_buf jmp_buf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* How to annotate unused variables
|
|
||||||
*/
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define UNUSED __attribute__((unused))
|
|
||||||
#else
|
|
||||||
#define UNUSED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
all: tftpd
|
all: tftpd
|
||||||
|
|
||||||
|
SRCROOT = ..
|
||||||
|
|
||||||
-include ../MCONFIG
|
-include ../MCONFIG
|
||||||
include ../MRULES
|
include ../MRULES
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
* Minor help routines.
|
* Minor help routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h" /* Must be included first! */
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
|
||||||
#include "tftpd.h"
|
#include "tftpd.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -18,19 +18,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _XPG4_2 /* Needed on Solaris */
|
#include "config.h" /* Must be included first! */
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../config.h"
|
|
||||||
#include "recvfrom.h"
|
#include "recvfrom.h"
|
||||||
#include "tftpsubs.h"
|
#include "tftpsubs.h"
|
||||||
|
|
||||||
|
|
|
@ -15,20 +15,16 @@
|
||||||
* Perform regular-expression based filename remapping.
|
* Perform regular-expression based filename remapping.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "config.h" /* Must be included first! */
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <sys/types.h> /* FreeBSD 3.3 need this before regex.h */
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <syslog.h>
|
|
||||||
|
|
||||||
#include "tftpd.h"
|
#include "tftpd.h"
|
||||||
#include "remap.h"
|
#include "remap.h"
|
||||||
|
|
||||||
#define DEADMAN_MAX_STEPS 1024 /* Timeout after this many steps */
|
#define DEADMAN_MAX_STEPS 1024 /* Timeout after this many steps */
|
||||||
#define LINE_MAX 16384 /* Truncate a line at this many bytes */
|
#define MAXLINE 16384 /* Truncate a line at this many bytes */
|
||||||
|
|
||||||
#define RULE_REWRITE 0x01 /* This is a rewrite rule */
|
#define RULE_REWRITE 0x01 /* This is a rewrite rule */
|
||||||
#define RULE_GLOBAL 0x02 /* Global rule (repeat until no match) */
|
#define RULE_GLOBAL 0x02 /* Global rule (repeat until no match) */
|
||||||
|
@ -134,7 +130,7 @@ static int readescstring(char *buf, char **str)
|
||||||
/* Parse a line into a set of instructions */
|
/* Parse a line into a set of instructions */
|
||||||
static int parseline(char *line, struct rule *r, int lineno)
|
static int parseline(char *line, struct rule *r, int lineno)
|
||||||
{
|
{
|
||||||
char buffer[LINE_MAX];
|
char buffer[MAXLINE];
|
||||||
char *p;
|
char *p;
|
||||||
int rv;
|
int rv;
|
||||||
int rxflags = REG_EXTENDED;
|
int rxflags = REG_EXTENDED;
|
||||||
|
@ -211,7 +207,7 @@ static int parseline(char *line, struct rule *r, int lineno)
|
||||||
/* Read a rule file */
|
/* Read a rule file */
|
||||||
struct rule *parserulefile(FILE *f)
|
struct rule *parserulefile(FILE *f)
|
||||||
{
|
{
|
||||||
char line[LINE_MAX];
|
char line[MAXLINE];
|
||||||
struct rule *first_rule = NULL;
|
struct rule *first_rule = NULL;
|
||||||
struct rule **last_rule = &first_rule;
|
struct rule **last_rule = &first_rule;
|
||||||
struct rule *this_rule = tfmalloc(sizeof(struct rule));
|
struct rule *this_rule = tfmalloc(sizeof(struct rule));
|
||||||
|
@ -219,7 +215,7 @@ struct rule *parserulefile(FILE *f)
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
while ( lineno++, fgets(line, LINE_MAX, f) ) {
|
while ( lineno++, fgets(line, MAXLINE, f) ) {
|
||||||
rv = parseline(line, this_rule, lineno);
|
rv = parseline(line, this_rule, lineno);
|
||||||
if ( rv < 0 )
|
if ( rv < 0 )
|
||||||
err = 1;
|
err = 1;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h" /* Must be included first */
|
||||||
#include "tftpd.h"
|
#include "tftpd.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
@ -203,7 +204,7 @@ main(int argc, char **argv)
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
int standalone = 0; /* Standalone (listen) mode */
|
int standalone = 0; /* Standalone (listen) mode */
|
||||||
char *address = NULL; /* Address to listen to */
|
char *address = NULL; /* Address to listen to */
|
||||||
int pid;
|
pid_t pid;
|
||||||
int c;
|
int c;
|
||||||
int setrv;
|
int setrv;
|
||||||
int waittime = 900; /* Default time to wait for a connect*/
|
int waittime = 900; /* Default time to wait for a connect*/
|
||||||
|
@ -358,7 +359,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* Daemonize this process */
|
/* Daemonize this process */
|
||||||
{
|
{
|
||||||
int f = fork();
|
pid_t f = fork();
|
||||||
if ( f > 0 )
|
if ( f > 0 )
|
||||||
exit(0);
|
exit(0);
|
||||||
if ( f < 0 ) {
|
if ( f < 0 ) {
|
||||||
|
|
|
@ -18,45 +18,10 @@
|
||||||
#ifndef TFTPD_TFTPD_H
|
#ifndef TFTPD_TFTPD_H
|
||||||
#define TFTPD_TFTPD_H
|
#define TFTPD_TFTPD_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../config.h"
|
|
||||||
#ifdef HAVE_SYSEXITS_H
|
|
||||||
#include <sysexits.h>
|
|
||||||
#else
|
|
||||||
#define EX_USAGE 64 /* command line usage error */
|
|
||||||
#define EX_DATAERR 65 /* data format error */
|
|
||||||
#define EX_NOINPUT 66 /* cannot open input */
|
|
||||||
#define EX_NOUSER 67 /* addressee unknown */
|
|
||||||
#define EX_NOHOST 68 /* host name unknown */
|
|
||||||
#define EX_UNAVAILABLE 69 /* service unavailable */
|
|
||||||
#define EX_SOFTWARE 70 /* internal software error */
|
|
||||||
#define EX_OSERR 71 /* system error (e.g., can't fork) */
|
|
||||||
#define EX_OSFILE 72 /* critical OS file missing */
|
|
||||||
#define EX_CANTCREAT 73 /* can't create (user) output file */
|
|
||||||
#define EX_IOERR 74 /* input/output error */
|
|
||||||
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
|
|
||||||
#define EX_PROTOCOL 76 /* remote error in protocol */
|
|
||||||
#define EX_NOPERM 77 /* permission denied */
|
|
||||||
#define EX_CONFIG 78 /* configuration error */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_SIGSETJMP
|
|
||||||
#define sigsetjmp(x,y) setjmp(x)
|
|
||||||
#define siglongjmp(x,y) longjmp(x,y)
|
|
||||||
#define sigjmp_buf jmp_buf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void set_signal(int, void (*)(int), int);
|
void set_signal(int, void (*)(int), int);
|
||||||
void *tfmalloc(size_t);
|
void *tfmalloc(size_t);
|
||||||
char *tfstrdup(const char *);
|
char *tfstrdup(const char *);
|
||||||
|
|
||||||
extern int verbosity;
|
extern int verbosity;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define UNUSED __attribute__((unused))
|
|
||||||
#else
|
|
||||||
#define UNUSED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue