remove redundant code from old ant build format (not in gradle modules)

This commit is contained in:
Nathan Freitas 2016-06-29 09:54:03 -04:00
parent 18682e4b97
commit 54b3349344
380 changed files with 0 additions and 84345 deletions

View File

@ -1,22 +0,0 @@
obfs3 83.212.101.3:80 A09D536DD1752D542E1FBB3C9CE4449D51298239
obfs3 169.229.59.74:31493 AF9F66B7B04F8FF6F32D455F05135250A16543C9
obfs3 169.229.59.75:46328 AF9F66B7B04F8FF6F32D455F05135250A16543C9
obfs3 109.105.109.163:38980 1E05F577A0EC0213F971D81BF4D86A9E4E8229ED
obfs3 109.105.109.163:47779 4C331FA9B3D1D6D8FB0D8FBBF0C259C360D97E6A
scramblesuit 83.212.101.3:443 A09D536DD1752D542E1FBB3C9CE4449D51298239 password=XTCXLG2JAMJKZW2POLBAOWOQETQSMASH
obfs4 198.245.60.50:443 752CF7825B3B9EA6A98C83AC41F7099D67007EA5 cert=xpmQtKUqQ/6v5X7ijgYE/f03+l2/EuQ1dexjyUhh16wQlu/cpXUGalmhDIlhuiQPNEKmKw iat-mode=0
obfs4 109.105.109.165:10527 8DFCD8FB3285E855F5A55EDDA35696C743ABFC4E cert=Bvg/itxeL4TWKLP6N1MaQzSOC6tcRIBv6q57DYAZc3b2AzuM+/TfB7mqTFEfXILCjEwzVA iat-mode=0
obfs4 83.212.101.3:41213 A09D536DD1752D542E1FBB3C9CE4449D51298239 cert=lPRQ/MXdD1t5SRZ9MquYQNT9m5DV757jtdXdlePmRCudUU9CFUOX1Tm7/meFSyPOsud7Cw iat-mode=0
obfs4 104.131.108.182:56880 EF577C30B9F788B0E1801CF7E433B3B77792B77A cert=0SFhfDQrKjUJP8Qq6wrwSICEPf3Vl/nJRsYxWbg3QRoSqhl2EB78MPS2lQxbXY4EW1wwXA iat-mode=0
obfs4 109.105.109.147:13764 BBB28DF0F201E706BE564EFE690FE9577DD8386D cert=KfMQN/tNMFdda61hMgpiMI7pbwU1T+wxjTulYnfw+4sgvG0zSH7N7fwT10BI8MUdAD7iJA iat-mode=0
obfs4 154.35.22.10:41835 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
obfs4 154.35.22.11:49868 A832D176ECD5C7C6B58825AE22FC4C90FA249637 cert=YPbQqXPiqTUBfjGFLpm9JYEFTBvnzEJDKJxXG5Sxzrr/v2qrhGU4Jls9lHjLAhqpXaEfZw iat-mode=0
obfs4 154.35.22.12:80 00DC6C4FA49A65BD1472993CF6730D54F11E0DBB cert=N86E9hKXXXVz6G7w2z8wFfhIDztDAzZ/3poxVePHEYjbKDWzjkRDccFMAnhK75fc65pYSg iat-mode=0
obfs4 154.35.22.13:443 FE7840FE1E21FE0A0639ED176EDA00A3ECA1E34D cert=fKnzxr+m+jWXXQGCaXe4f2gGoPXMzbL+bTBbXMYXuK0tMotd+nXyS33y2mONZWU29l81CA iat-mode=0
obfs4 154.35.22.10:1984 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
obfs4 154.35.22.11:1984 A832D176ECD5C7C6B58825AE22FC4C90FA249637 cert=YPbQqXPiqTUBfjGFLpm9JYEFTBvnzEJDKJxXG5Sxzrr/v2qrhGU4Jls9lHjLAhqpXaEfZw iat-mode=0
obfs4 154.35.22.12:1984 00DC6C4FA49A65BD1472993CF6730D54F11E0DBB cert=N86E9hKXXXVz6G7w2z8wFfhIDztDAzZ/3poxVePHEYjbKDWzjkRDccFMAnhK75fc65pYSg iat-mode=0
obfs4 154.35.22.13:1984 FE7840FE1E21FE0A0639ED176EDA00A3ECA1E34D cert=fKnzxr+m+jWXXQGCaXe4f2gGoPXMzbL+bTBbXMYXuK0tMotd+nXyS33y2mONZWU29l81CA iat-mode=0
meek 0.0.2.0:1 46D4A71197B8FA515A826C6B017C522FE264655B url=https://meek-reflect.appspot.com/ front=www.google.com
meek 0.0.2.0:2 B9E7141C594AF25699E0079C1F0146F409495296 url=https://d2zfqthxsdq309.cloudfront.net/ front=a0.awsstatic.com
meek 0.0.2.0:3 A2C13B7DFCAB1CBF3A884B6EB99A98067AB6EF44 url=https://az786092.vo.msecnd.net/ front=ajax.aspnetcdn.com

View File

@ -1,145 +0,0 @@
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
LOCAL_PATH := $(call my-dir)
ROOT_PATH := $(LOCAL_PATH)
EXTERN_PATH := $(LOCAL_PATH)/../external
########################################################
## pdnsd library
########################################################
include $(CLEAR_VARS)
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
LOCAL_MODULE := pdnsd
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd -DHAVE_STPCPY
include $(BUILD_EXECUTABLE)
########################################################
## libancillary
########################################################
include $(CLEAR_VARS)
ANCILLARY_SOURCE := fd_recv.c fd_send.c
LOCAL_MODULE := libancillary
LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libancillary
LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## tun2socks
########################################################
include $(CLEAR_VARS)
LOCAL_CFLAGS := -std=gnu99
LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
LOCAL_CFLAGS += -DNDEBUG -DANDROID
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
LOCAL_CFLAGS += -DPSIPHON
LOCAL_STATIC_LIBRARIES := libancillary
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/libancillary \
$(EXTERN_PATH)/badvpn/ \
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv4 \
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv6 \
$(EXTERN_PATH)/badvpn/lwip/src/include \
$(EXTERN_PATH)/badvpn/lwip/custom \
TUN2SOCKS_SOURCES := \
base/BLog_syslog.c \
system/BReactor_badvpn.c \
system/BSignal.c \
system/BConnection_unix.c \
system/BTime.c \
system/BUnixSignal.c \
system/BNetwork.c \
flow/StreamRecvInterface.c \
flow/PacketRecvInterface.c \
flow/PacketPassInterface.c \
flow/StreamPassInterface.c \
flow/SinglePacketBuffer.c \
flow/BufferWriter.c \
flow/PacketBuffer.c \
flow/PacketStreamSender.c \
flow/PacketPassConnector.c \
flow/PacketProtoFlow.c \
flow/PacketPassFairQueue.c \
flow/PacketProtoEncoder.c \
flow/PacketProtoDecoder.c \
socksclient/BSocksClient.c \
tuntap/BTap.c \
lwip/src/core/timers.c \
lwip/src/core/udp.c \
lwip/src/core/memp.c \
lwip/src/core/init.c \
lwip/src/core/pbuf.c \
lwip/src/core/tcp.c \
lwip/src/core/tcp_out.c \
lwip/src/core/netif.c \
lwip/src/core/def.c \
lwip/src/core/mem.c \
lwip/src/core/tcp_in.c \
lwip/src/core/stats.c \
lwip/src/core/inet_chksum.c \
lwip/src/core/ipv4/icmp.c \
lwip/src/core/ipv4/igmp.c \
lwip/src/core/ipv4/ip4_addr.c \
lwip/src/core/ipv4/ip_frag.c \
lwip/src/core/ipv4/ip4.c \
lwip/src/core/ipv4/autoip.c \
lwip/src/core/ipv6/ethip6.c \
lwip/src/core/ipv6/inet6.c \
lwip/src/core/ipv6/ip6_addr.c \
lwip/src/core/ipv6/mld6.c \
lwip/src/core/ipv6/dhcp6.c \
lwip/src/core/ipv6/icmp6.c \
lwip/src/core/ipv6/ip6.c \
lwip/src/core/ipv6/ip6_frag.c \
lwip/src/core/ipv6/nd6.c \
lwip/custom/sys.c \
tun2socks/tun2socks.c \
base/DebugObject.c \
base/BLog.c \
base/BPending.c \
system/BDatagram_unix.c \
flowextra/PacketPassInactivityMonitor.c \
tun2socks/SocksUdpGwClient.c \
udpgw_client/UdpGwClient.c
LOCAL_MODULE := tun2socks
LOCAL_LDLIBS := -ldl -llog
LOCAL_SRC_FILES := $(addprefix ../external/badvpn/, $(TUN2SOCKS_SOURCES))
##include $(BUILD_EXECUTABLE)
include $(BUILD_SHARED_LIBRARY)
# Import cpufeatures
$(call import-module,android/cpufeatures)

View File

@ -1,4 +0,0 @@
APP_ABI := armeabi x86
APP_PLATFORM := android-16
APP_STL := stlport_static
NDK_TOOLCHAIN_VERSION := 4.8

View File

@ -1,139 +0,0 @@
This library provide an easy interface to the black magic that can be done
on Unix domain sockets, like passing file descriptors from one process to
another.
Programs that uses this library should include the ancillary.h header file.
Nothing else is required.
All functions of this library require the following header:
#include <ancillary.h>
At this time, the only ancillary data defined by the Single Unix
Specification (v3) is file descriptors.
Passing file descriptors
int ancil_send_fd(socket, file_descriptor)
int socket: the Unix socket
int file_descriptor: the file descriptor
Return value: 0 for success, -1 for failure.
Sends one file descriptor on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
int ancil_recv_fd(socket, file_descriptor)
int socket: the Unix socket
int *file_descriptor: pointer to the returned file descriptor
Return value: 0 for success, -1 for failure
Receives one file descriptor from a socket.
In case of success, the file descriptor is stored in the integer pointed
to by file_descriptor.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The behavior is undefined if the recv_fd does not match a send_fd* on the
other side.
int ancil_send_fds(socket, file_descriptors, num_file_descriptors)
int socket: the Unix socket
const int *file_descriptors: array of file descriptors
unsigned num_file_descriptors: number of file descriptors
Return value: 0 for success, -1 for failure
Sends several file descriptors on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
The maximum number of file descriptors that can be sent using this
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
overflow, probably a stack corruption.
int ancil_recv_fds(socket, file_descriptors, num_file_descriptors)
int socket: the Unix socket
int *file_descriptors: return array of file descriptors
unsigned num_file_descriptors: number of file descriptors
Return value: number of received fd for success, -1 for failure
Receives several file descriptors from a socket, no more than
num_file_descriptors.
In case of success, the received file descriptors are stored in the array
pointed to by file_descriptors.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The maximum number of file descriptors that can be received using this
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
overflow, probably a stack corruption.
The behavior is undefined if the recv_fds does not match a send_fd* on
the other side, or if the number of received file descriptors is more than
num_file_descriptors.
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
int socket: the Unix socket
const int *fds: array of file descriptors
unsigned num: number of file descriptors
void *buffer: buffer to hold the system data structures
Return value: 0 for success, -1 for failure
Sends several file descriptors on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
The buffer argument must point to a memory area large enough to hold the
system data structures, see ANCIL_FD_BUFFER.
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
int socket: the Unix socket
int *fds: return array of file descriptors
unsigned num: number of file descriptors
void *buffer: buffer to hold the system data structures
Return value: number of received fd for success, -1 for failure
Receives several file descriptors from a socket, no more than
num_file_descriptors.
In case of success, the received file descriptors are stored in the array
pointed to by file_descriptors.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The behavior is undefined if the recv_fds does not match a send_fd* on
the other side, or if the number of received file descriptors is more than
num_file_descriptors.
The buffer argument must point to a memory area large enough to hold the
system data structures, see ANCIL_FD_BUFFER.
ANCIL_MAX_N_FDS
Maximum number of file descriptors that can be sent with the sent_fds and
recv_fds functions. If you have to send more at once, use the
*_with_buffer versions. The value is enough to send "quite a few" file
descriptors.
ANCIL_FD_BUFFER(n)
int n: number of file descriptors
Expands to a structure data type large enough to hold the system data
structures for n file descriptors. So the address of a variable declared
of type ANCIL_FD_BUFFER(n) is suitable as the buffer argument for
*_with_buffer on n file descriptors.
To use this macro, you need <sys/types.h> and <sys/socket.h>. Bevare: with
Solaris, the _XPG4_2 macro must be defined before sys/socket is included.
Tuning the compilation
This library is designed to be included in projects, not installed in
/usr/lib. If your project does not use some of the functions, the
TUNE_OPTS variable in the Makefile allows not to build them. It is a list
of proprocessor options:
-DNDEBUG: turn assertions off (see assert(3))
-DSPARE_SEND_FDS: do not build ancil_send_fds
-DSPARE_SEND_FD: do not build ancil_send_fd
-DSPARE_RECV_FDS: do not build ancil_recv_fds
-DSPARE_RECV_FD: do not build ancil_recv_fd

View File

@ -1,21 +0,0 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,73 +0,0 @@
###########################################################################
# libancillary - black magic on Unix domain sockets
# (C) Nicolas George
# Makefile - guess what
###########################################################################
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CC=gcc
CFLAGS=-Wall -g -O2
LDFLAGS=
LIBS=
AR=ar
RANLIB=ranlib
RM=rm
CP=cp
MKDIR=mkdir
TAR=tar
GZIP=gzip -9
NAME=libancillary
DISTRIBUTION=API COPYING Makefile ancillary.h fd_send.c fd_recv.c test.c
VERSION=0.9.1
OBJECTS=fd_send.o fd_recv.o
TUNE_OPTS=-DNDEBUG
#TUNE_OPTS=-DNDEBUG \
-DSPARE_SEND_FDS -DSPARE_SEND_FD -DSPARE_RECV_FDS -DSPARE_RECV_FD
.c.o:
$(CC) -c $(CFLAGS) $(TUNE_OPTS) $<
all: libancillary.a
libancillary.a: $(OBJECTS)
$(AR) cr $@ $(OBJECTS)
$(RANLIB) $@
fd_send.o: ancillary.h
fd_recv.o: ancillary.h
test: test.c libancillary.a
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) -L. test.c -lancillary $(LIBS)
clean:
-$(RM) -f *.o *.a test
dist:
$(MKDIR) $(NAME)-$(VERSION)
$(CP) $(DISTRIBUTION) $(NAME)-$(VERSION)
$(TAR) -cf - $(NAME)-$(VERSION) | $(GZIP) > $(NAME)-$(VERSION).tar.gz
$(RM) -rf $(NAME)-$(VERSION)

View File

@ -1,131 +0,0 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* ancillary.c - public header
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ANCILLARY_H__
#define ANCILLARY_H__
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
* Start of the readable part.
***************************************************************************/
#define ANCIL_MAX_N_FDS 960
/*
* Maximum number of fds that can be sent or received using the "esay"
* functions; this is so that all can fit in one page.
*/
extern int
ancil_send_fds_with_buffer(int, const int *, unsigned, void *);
/*
* ancil_send_fds_with_buffer(sock, n_fds, fds, buffer)
*
* Sends the file descriptors in the array pointed by fds, of length n_fds
* on the socket sock.
* buffer is a writeable memory area large enough to hold the required data
* structures.
* Returns: -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fds_with_buffer(int, int *, unsigned, void *);
/*
* ancil_recv_fds_with_buffer(sock, n_fds, fds, buffer)
*
* Receives *n_fds file descriptors into the array pointed by fds
* from the socket sock.
* buffer is a writeable memory area large enough to hold the required data
* structures.
* Returns: -1 and errno in case of error, the actual number of received fd
* in case of success
*/
#define ANCIL_FD_BUFFER(n) \
struct { \
struct cmsghdr h; \
int fd[n]; \
}
/* ANCIL_FD_BUFFER(n)
*
* A structure type suitable to be used as buffer for n file descriptors.
* Requires <sys/socket.h>.
* Example:
* ANCIL_FD_BUFFER(42) buffer;
* ancil_recv_fds_with_buffer(sock, 42, my_fds, &buffer);
*/
extern int
ancil_send_fds(int, const int *, unsigned);
/*
* ancil_send_fds(sock, n_fds, fds)
*
* Sends the file descriptors in the array pointed by fds, of length n_fds
* on the socket sock.
* n_fds must not be greater than ANCIL_MAX_N_FDS.
* Returns: -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fds(int, int *, unsigned);
/*
* ancil_recv_fds(sock, n_fds, fds)
*
* Receives *n_fds file descriptors into the array pointed by fds
* from the socket sock.
* *n_fds must not be greater than ANCIL_MAX_N_FDS.
* Returns: -1 and errno in case of error, the actual number of received fd
* in case of success.
*/
extern int
ancil_send_fd(int, int);
/* ancil_recv_fd(sock, fd);
*
* Sends the file descriptor fd on the socket sock.
* Returns : -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fd(int, int *);
/* ancil_send_fd(sock, &fd);
*
* Receives the file descriptor fd from the socket sock.
* Returns : -1 and errno in case of error, 0 in case of success.
*/
#ifdef __cplusplus
}
#endif
#endif /* ANCILLARY_H__ */

View File

@ -1,98 +0,0 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* fd_send.c - receiving file descriptors
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _XPG4_2 /* Solaris sucks */
# define _XPG4_2
#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <assert.h>
#if defined(__FreeBSD__)
# include <sys/param.h> /* FreeBSD sucks */
#endif
#include "ancillary.h"
int
ancil_recv_fds_with_buffer(int sock, int *fds, unsigned n_fds, void *buffer)
{
struct msghdr msghdr;
char nothing;
struct iovec nothing_ptr;
struct cmsghdr *cmsg;
int i;
nothing_ptr.iov_base = &nothing;
nothing_ptr.iov_len = 1;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &nothing_ptr;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_control = buffer;
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
cmsg = CMSG_FIRSTHDR(&msghdr);
cmsg->cmsg_len = msghdr.msg_controllen;
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
for(i = 0; i < n_fds; i++)
((int *)CMSG_DATA(cmsg))[i] = -1;
if(recvmsg(sock, &msghdr, 0) < 0)
return(-1);
for(i = 0; i < n_fds; i++)
fds[i] = ((int *)CMSG_DATA(cmsg))[i];
n_fds = (msghdr.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
return(n_fds);
}
#ifndef SPARE_RECV_FDS
int
ancil_recv_fds(int sock, int *fd, unsigned n_fds)
{
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
assert(n_fds <= ANCIL_MAX_N_FDS);
return(ancil_recv_fds_with_buffer(sock, fd, n_fds, &buffer));
}
#endif /* SPARE_RECV_FDS */
#ifndef SPARE_RECV_FD
int
ancil_recv_fd(int sock, int *fd)
{
ANCIL_FD_BUFFER(1) buffer;
return(ancil_recv_fds_with_buffer(sock, fd, 1, &buffer) == 1 ? 0 : -1);
}
#endif /* SPARE_RECV_FD */

View File

@ -1,92 +0,0 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* fd_send.c - sending file descriptors
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _XPG4_2 /* Solaris sucks */
# define _XPG4_2
#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <assert.h>
#if defined(__FreeBSD__)
# include <sys/param.h> /* FreeBSD sucks */
#endif
#include "ancillary.h"
int
ancil_send_fds_with_buffer(int sock, const int *fds, unsigned n_fds, void *buffer)
{
struct msghdr msghdr;
char nothing = '!';
struct iovec nothing_ptr;
struct cmsghdr *cmsg;
int i;
nothing_ptr.iov_base = &nothing;
nothing_ptr.iov_len = 1;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &nothing_ptr;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_control = buffer;
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
cmsg = CMSG_FIRSTHDR(&msghdr);
cmsg->cmsg_len = msghdr.msg_controllen;
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
for(i = 0; i < n_fds; i++)
((int *)CMSG_DATA(cmsg))[i] = fds[i];
return(sendmsg(sock, &msghdr, 0) >= 0 ? 0 : -1);
}
#ifndef SPARE_SEND_FDS
int
ancil_send_fds(int sock, const int *fds, unsigned n_fds)
{
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
assert(n_fds <= ANCIL_MAX_N_FDS);
return(ancil_send_fds_with_buffer(sock, fds, n_fds, &buffer));
}
#endif /* SPARE_SEND_FDS */
#ifndef SPARE_SEND_FD
int
ancil_send_fd(int sock, int fd)
{
ANCIL_FD_BUFFER(1) buffer;
return(ancil_send_fds_with_buffer(sock, &fd, 1, &buffer));
}
#endif /* SPARE_SEND_FD */

View File

@ -1,112 +0,0 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* test.c - testing and example program
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include "ancillary.h"
void child_process(int sock)
{
int fd;
int fds[3], nfds;
char b[] = "This is on the received fd!\n";
if(ancil_recv_fd(sock, &fd)) {
perror("ancil_recv_fd");
exit(1);
} else {
printf("Received fd: %d\n", fd);
}
write(fd, b, sizeof(b));
close(fd);
sleep(2);
nfds = ancil_recv_fds(sock, fds, 3);
if(nfds < 0) {
perror("ancil_recv_fds");
exit(1);
} else {
printf("Received %d/3 fds : %d %d %d.\n", nfds,
fds[0], fds[1], fds[2]);
}
}
void parent_process(int sock)
{
int fds[2] = { 1, 2 };
if(ancil_send_fd(sock, 1)) {
perror("ancil_send_fd");
exit(1);
} else {
printf("Sent fd.\n");
}
sleep(1);
if(ancil_send_fds(sock, fds, 2)) {
perror("ancil_send_fds");
exit(1);
} else {
printf("Sent two fds.\n");
}
}
int main(void)
{
int sock[2];
if(socketpair(PF_UNIX, SOCK_STREAM, 0, sock)) {
perror("socketpair");
exit(1);
} else {
printf("Established socket pair: (%d, %d)\n", sock[0], sock[1]);
}
switch(fork()) {
case 0:
close(sock[0]);
child_process(sock[1]);
break;
case -1:
perror("fork");
exit(1);
default:
close(sock[1]);
parent_process(sock[0]);
wait(NULL);
break;
}
return(0);
}

View File

@ -1,58 +0,0 @@
Most of pdnsd was written by Thomas Moestl (tmoestl@gmx.net).
In the "par" versions large parts of the code have been revised
and several features have been added by Paul Rombouts.
Small parts of this program are based on code that was taken from nmap (IP
checksumming), the isdn4k-utils (ippp interface uptest), glibc 2.1.2 (some
definitions for kernel 2.2.x missing in 2.0 glibcs) and FreeBSD
(SIZEOF_ADDR_IFREQ in netdev.c).
nmap was written by Fyodor. The insd4k-utils were written by Fritz Elfert and
others. The GNU C library (glibc) is copyright by the Free Software
Foundation.
The following people have contributed code:
Andrew M. Bishop contributed support for server labels
Carsten Block contributed 'configure'-able rc scripts
Stephan Boettcher contributed the SCHEME= option.
P.J. Bostley contributed patches to get pdnsd working on
alpha
Frank Elsner contributed rc script fixes
Christian Engstler contributed patches for SuSE compatability
Bjoern Fischer contributed code to make pdnsd leave the case of names
in the cache unchanged
Torben Janssen contributed RedHat rc scripts
Olaf Kirch contributed a security fix for the run_as()
function
Bernd Leibing contributed fixes to the spec file.
Sourav K. Mandal contributed the autoconf/automake code, gdbm
caching facility and many suggestions
Markus Mohr contributed Debian rc scripts
Alexandre Nunes contributed autoconf fixes
Wolfgang Ocker contributed the server_ip option
Soenke J. Peters contributed patches and suggestions for RedHat
compatability
Roman Shterenzon contributed many helpful hints and patches for
FreeBSD compatability.
Andreas Steinmetz contributed the code for the query_port_start and
query_port_end options (which I changed slightly,
so blame any breakage on me ;)
Marko Stolle contributed the contrib/pdnsd_update.pl script that
makes pdnsd usable in a DHCP setup.
Lyonel Vincent extended the serve_aliases option to support an
arbitrary number of aliases
Paul Wagland contributed a patches for bind9-compatability
and for some memory leaks on error paths.
Sverker Wiberg contributed IPv6 build fixes
Michael Wiedmann contributed the pdnsd-ctl.8 man page.
Ron Yorston contributed the dev-uptest for Linux ppp dial-
on-demand devices
Nikita V. Youshchenko contributed extensions to the "if" uptest
Mahesh T. Pai contributed the pdnsd.8 man page.
Nikola Kotur contributed the Slackware start-up script.
Kiyo Kelvin Lee contributed a patch for Cygwin support.
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
Jan-Marek Glogowski contributed a patch implementing the "use_nss" option.
Please look into the THANKS file for people who helped me in various ways on
this project.
If this list is incomplete, pease drop me a mail!

View File

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -1,26 +0,0 @@
A small part of the pdnsd source is licensed under the following BSD-style
license:
Copyright (C) 2001 Thomas Moestl
This file is part of the pdnsd package.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

View File

@ -1,161 +0,0 @@
2000-02-15
Version 0.2. First working alpha with the extended feature set.
2000-02-16
Version 0.3 with many bugfixes, better standard conformity and
some new features.
2000-02-17
Did a lint on the code, implemented soft timeouts, again bugfixes,
drastically reduced cache memory requirements, implemented local
records.
Version 0.4 released.
2000-02-19
Recursive query finally implemented. Version 0.5 out.
2000-02-20
Various bugfixes. The server now always tries to get an AA answer
if possible; this implies recursion. This is to deal better with
caching servers that may return incomplete results on * queries.
This may be a little sub-optimal since it may not take the full
effect of caching, but it is the only real possibility of getting
complete records.
Redid the deps in the makefile for now.
Version is now 0.6.
2000-02-21
Another set of bugfixes. Version is 0.6.1.
2000-02-22
Another set of bugfixes. It should stabilize by now. Answer compression
is there finally. Version is therefore up again, 0.7 by now.
2000-02-23
Minor bugfixes, isdn interface uptest added. The new record types as of
rfc1700 are implemented, but as a compile-time option, since normally
there is no need to waste space for them.
Version is 0.7.1.
2000-02-24
Version 0.7.2 with all rrs up to KX (36). #define DNS_NEW_RRS in
config.h and (re)compile if you want to use them. Delete the cache
file before using a version with this option changed!
NSAP-PTR does NOT WORK (any incoming answer containing it may cause
a format error) because it is ill-designed (see TODO). Never mind, it
is officially deprecated anyway.
The secure DNS extension record types defined in RFC 2065 (KEY, SIG,
NXT) are cached only and therefore useless.
2000-02-26
Version 0.8 with parallel query (and probably new bugs) introduced.
2000-02-27
Version 0.8.1 with minor bugfixes on the new features.
2000-02-27
Version 0.8.5 with authority support and the usual bugifxes. Some issues
with standard conformity were also fixed (wow, two versions a day).
2000-02-28
Implemented caching of non-authoritative records. This allows better
usage of other caching name servers. This may return non-authoritative
records to any non-wildcard query. If a wildcard query arrives, we
always look for authoritative records, so we do if the non-authoritative
answer does not contain at least one answering record to the query.
This fixes the sub-optimal behaviour since 0.6.
Version is therefore up to 0.8.7 (0.8.6 was also released today
containing bugfixes)
2000-02-29
Better thread support, avoiding deadlocks in signal handling. The cost
is unfortunately one more thread.
New option server_port in config file.
Version is 0.8.8.
2000-03-01
Nailed a renitent memory leak bug to the wall (shame, what a trivial
mistake). Also improved handling of error conditions slightly.
Version is 0.8.9.
2000-03-01
Cache code cleanup. The development of the non-parallel query code
is discontinued, although it still works. If you want serial query,
just set PAR_QUERIES to 1.
Additional information finally implemented.
We are up to 0.9.
2000-03-02
Fixed a DoS possibility.
More rfc compatability fixups and a smarter resolver logic.
Version 0.9.1
2000-03-02
Added the source section to the config file handling. This allows to
source your /etc/hosts file. Version 0.9.2.
2000-03-02
Avoiding double additional records now. Version 0.9.3.
2000-03-09
Fixed some REALLY STUPID bugs. Uuummph, thought it was finished.
However, the number of bugs remaining is always n+1...
Anyway, we are up to 0.9.4. Hope that there are no mean bugs left.
2000-03-14
Added another uptest, exec. See README for details. Also grained the
cache size finer (it's now specified in kB). Version 0.9.5
2000-04-07
Fixed some really stupid bugs, what else? Version is 0.9.6
To be more exact: fixed misc bugs, cleaned up hash.c and cache.c
2000-04-20
Again fixed some bugs, version is now 0.9.7.
2000-04-29
Fixed a build problem caused by some missing #defines in glibc2.0 and a
minor bug.
Version is up to 0.9.8
2000-04-30
Fixed some unclean C code and did a general C lint. Thanks to Byrial
Jensen for pointing out some issues. Now using stricter compiler flags.
Also replaced the daemon() call in main.c for improved portability.
Pre-Released 0.9.9p1
2000-05-03
Released 0.9.9p2 with the changes of 0.9.9p1, Documentation updates,
bugfixes, and the Red Hat rc scripts contributed by Torben Janssen.
Also, the meaning of the command line option -v has changed.
There is a new config file option "lean_query" that is on by
default. It is an optimization, so please look in the docs when
updating whether you want it switched on or not.
Removed the long-dead serial query code from the distribution tree.
Some resolvers seem to be broken somehow in a respect that it cares
about order in which the records appear. In particular, it wants
cname to appear before other records. Ok, so it be...
2000-05-04
Save all names in lower case in the rrs.
Tidying up the source tree.
The long-awaited cache structure changes have been started. Please
delete you cache files before using this new release.
2000-05-05
Fixed several bugs in the old and in the new source tree.
Use time_t instead of long for internal time storage for compatibility.
2000-05-06
Version 0.9.10.
This fixes a bug in uptest=if. Red Hat and configuration fixes
suggested by Soeren J. Peters were included.
2000-05-08
Version 0.9.11
This fixes a locally exploitable security problem (pdnsd.cache was
world-writeable). This is actually a one-line fix; for a description of
possible dangers, please refer to the html documentation.
Thanks to Alan Swanson for reporting.

View File

@ -1,190 +0,0 @@
The installation instructions are in doc/html/doc.html and doc/txt/manual.txt.
The system requirements are listed in doc/html/index.html and doc/txt/intro.txt.
I recommend using the html version.
Following are generic installation instructions for autoconf programs.
I strongly recommend to read the Installation section in the docs!
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,40 +0,0 @@
SUBDIRS = src doc contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
# The sample configuration is handled in doc/Makefile.am
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
if test `whoami` = "root"; then \
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
fi
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
chmod 0750 "$(DESTDIR)$(cachedir)"
dist-hook: $(PACKAGE).spec.in
sed -e '/^%{!?distro: %define distro /c\
%if 0%{!?distro:1}\
%if "%{_vendor}" == "redhat"\
%define distro RedHat\
%else\
%if "%{_vendor}" == "suse"\
%define distro SuSE\
%else\
%if "%{_vendor}" == "SuSE"\
%define distro SuSE\
%endif\
%endif\
%endif\
%endif' \
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
-e 's:[@]VERSION[@]:$(VERSION):g' \
-e 's:[@]fullversion[@]:$(fullversion):g' \
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
-e 's:[@]def_id[@]:$(PACKAGE):g' \
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec

View File

@ -1,734 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/PKGBUILD.in \
$(srcdir)/config.h.in $(srcdir)/file-list.base.in \
$(srcdir)/pdnsd.spec.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS THANKS TODO acconfig.h compile \
depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = pdnsd.spec file-list.base PKGBUILD
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src doc contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps) $(top_srcdir)/acconfig.h
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
pdnsd.spec: $(top_builddir)/config.status $(srcdir)/pdnsd.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
file-list.base: $(top_builddir)/config.status $(srcdir)/file-list.base.in
cd $(top_builddir) && $(SHELL) ./config.status $@
PKGBUILD: $(top_builddir)/config.status $(srcdir)/PKGBUILD.in
cd $(top_builddir) && $(SHELL) ./config.status $@
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-data-am install-strip \
tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-hook install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am
# The sample configuration is handled in doc/Makefile.am
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
if test `whoami` = "root"; then \
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
fi
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
chmod 0750 "$(DESTDIR)$(cachedir)"
dist-hook: $(PACKAGE).spec.in
sed -e '/^%{!?distro: %define distro /c\
%if 0%{!?distro:1}\
%if "%{_vendor}" == "redhat"\
%define distro RedHat\
%else\
%if "%{_vendor}" == "suse"\
%define distro SuSE\
%else\
%if "%{_vendor}" == "SuSE"\
%define distro SuSE\
%endif\
%endif\
%endif\
%endif' \
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
-e 's:[@]VERSION[@]:$(VERSION):g' \
-e 's:[@]fullversion[@]:$(fullversion):g' \
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
-e 's:[@]def_id[@]:$(PACKAGE):g' \
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,324 +0,0 @@
Version 1.2.9a fixes a bug in the 1.2.9 release that causes a build failure when
pdnsd is configured with --enable-strict-rfc2181. Unless you use this option to
compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
Version 1.2.9 has support for many additional RR types, in particular those
needed for DNSSEC (though no support for the DNSSEC protocol itself yet in
pdnsd). Caching data structures are now more efficient when they only store the
most commonly used RR types. Fine-grained configurability over which RR-types
are cache-able. Pdnsd now has support for EDNS (Extension mechanisms for DNS),
although its usefulness is currently limited to enabling UDP messages larger
than 512 bytes. Defining local TXT records in the configuration file is now
supported. A new configuration option provides a fix in case the query uptest
fails due to remote servers ignoring empty queries. Several bugs have been fixed
including a UDP socket descriptor leak that affected the FreeBSD platform, and
an IPv6 port binding bug.
Version 1.2.8 implements support for automatic discovery of root servers.
There are also some improvements in the resolver and a new default setting for
the neg_rrs_pol configuration option.
Version 1.2.7-par fixes some security problems. It contains a fix for a
"dangling pointer" bug that could cause pdnsd to crash when it received a long
reply. It also addresses some of the issues raised in the CERT vulnerability
note VU#800113 by making the default of query_port_start equal to 1024, thereby
ensuring that source ports are randomly selected by the pdnsd resolver in the
range 1024-65535. This release also fixes problems with compiling pdnsd for the
ARM architecture and for the Darwin platform (Max OS X). There are a number of
(minor) new features. pdnsd now supports "include" files, essentially
configuration files that only contain definitions for local records. It is now
possible to define interactively, using pdnsd-ctl, any local record that can be
defined in a configuration file.
Version 1.2.6-par has an upgraded license: GPL version 3.
A bug has been fixed which which caused pdnsd to handle NXDOMAIN replies
inefficiently when configured with neg_domain_pol=on. Also the code for the
ping test has been fixed, which was broken for 64-bit systems. A new option
randomize_servers can be used to give each server in a section of the
configuration file an equal chance of being queried. The new options reject,
reject_policy and reject_recursively make it possible to check for the presence
of certain IP addresses in the replies of name servers and to correct some types
of unwanted replies or to censor these IP addresses.
The pdnsd-ctl 'add a' and 'add aaaa' commands now allow multiple IP addresses to
be specified for the same name. There are some further improvements to pdnsd's
recursive resolver.
Version 1.2.5-par introduces a new query method: udp_tcp. With this method a UDP
query is tried first and, if the UDP answer is truncated, the query is repeated
using TCP, which is the behaviour that seems to be recommended by the DNS
standards. There is a new configuration option use_nss, which can be turned off
to prevent lengthy timeouts and stalls in certain situations. A bug has been
fixed which could cause pdnsd to crash if debug output was generated before the
debug output stream was properly initialized.
In version 1.2.4-par a memory leak and a minor buffer-overflow problem have been
fixed. There is now a fix for some situations that would previously cause pdnsd
to exit prematurely (such as ACPI S3 sleep or trying to attach strace to pdnsd).
Time intervals specified in the configuration file can now be expressed in
minutes, hours, days and weeks as well as seconds. Support for Apple Mac OS X
v10.4 Tiger has been improved. The "pdnsd-ctl status" command now also provides
some information about the status of the running threads. There are some further
improvements in the debugging information provided by pdnsd.
TCP-query support is now compiled in by default (but can still be disabled using
the configure option --disable-tcp-queries).
In version 1.2.3-par the "pdnsd-ctl empty-cache" command can be provided with an
include/exclude list, allowing the user to specify a selection of names to be
removed, instead of emptying the cache completely.
Additional improvements: pdnsd should now remain responsive while executing the
"pdnsd-ctl empty-cache" command. With the query_method=tcp_udp option pdnsd will
now also try a UDP query after a TCP connection times out, which should allow
pdnsd to resolve the same names with query_method=tcp_udp as with
query_method=udp_only, although perhaps with an occasional delay.
"pdnsd-ctl config" or "pdnsd-ctl server" commands should now run without delays,
even if pdnsd is performing ping or query uptests at the time. A problem with
resolving certain names using root servers has been fixed.
Version 1.2.2-par has a number of important portability improvements. A bug has
been fixed that prevented pdnsd from compiling successfully on some 64 bit
architectures. The code for determining endianness (most significant or least
significant byte first) should now be more portable. This release has
(experimental) support for the Darwin (Apple Mac OS X) platform. On Linux
systems, the configure script will now try to detect automatically whether the
system implements the Native POSIX Thread Library, but the method used may not
necessarily be foolproof. In addition, the debug features have been improved and
should make it easier to find out why pdnsd considers some queries or replies
malformed.
Version 1.2.1-par has improved support for non-Linux platforms. This release has
(experimental) support for the Cygwin platform, and should also fix some
compilation glitches that have been reported by FreeBSD users.
Version 1.2-par is a new and improved version of pdnsd! Most of the changes
effect the internal workings of pdnsd, but there are also a number of
interesting new features (well, I think they are interesting). Among the bugs
fixed are two rather nasty ones which involve the handling of NXT and NAPTR
records and which can cause pdnsd to crash or abort. The new features include a
new server availability test which can be specified with uptest=query, support
for reading the DNS configuration from resolv.conf files, a new option for
optimizing the use of root servers, a new option that makes defining local
records for reverse resolving easier, support for defining wildcard records, a
new pdnsd-ctl command for reloading the config file without restarting pdnsd,
and a new pdnsd-ctl command for dumping information about the names stored in
the cache.
The documentation has also been updated: there is now a pdnsd.conf man page. For
a more complete list of the changes I'll have to refer you to README.par and the
ChangeLog.
Version 1.1.11a-par contains a fix for FreeBSD users that bypasses a problem
with the macro ENONET, which can cause a compilation failure when it is
undefined. Linux users will notice no difference between 1.1.11a-par and
1.1.11-par.
Version 1.1.11-par has a rather large number of small changes, which are rather
difficult to summarize. Among the bugs fixed are a race condition in the cache
lookup code, a flaw in the code that caused a busy spin when a remote server
answered with "Not Implemented", and problems with the -4 and -6 command-line
options. Among the improvements are an alternative sorting algorithm which
should allow pdnsd to start up faster when reading a large cache file from disk,
automatic mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat
more efficient memory use, better compression of the replies and changes in the
parallel querying algorithm that should improve the chances of catching a reply
from a remote server. For a more complete list of the changes I'll have to
refer you to README.par and the ChangeLog.
Version 1.1.10-par has a new parser for configuration files, completely
rewritten from scratch in C. The main advantages are: (f)lex and yacc/bison are
no longer needed to build pdnsd, more informative error messages instead of
merely "parse error", and string literals no longer need to be enclosed in
quotes in most cases. Furthermore, a bug has been fixed that caused incorrect
IPV6-type PTR records to be generated when sourcing /etc/hosts like files.
There have been other small changes, more details can be found in the ChangeLog.
Version 1.1.9-par adds some missing pieces to the documentation (the pdnsd
manual and the man page for pdnsd-ctl). The changes to the code consist mostly
of optimizations, removal of some size limits due to fixed-size buffers, and
some cleaning up. I've also tried to make the error responses of pdnsd-ctl more
helpful. More details can be found in the ChangeLog.
Version 1.1.8b1-par8 introduces a "delegation-only" feature that may be useful
for blocking Verisign's Sitefinder. The parser for the configuration file now
tolerates domain names missing a dot at the end. I have provided alternative
implementations for some GNU extensions that I used in an effort to make the
code more portable. In particular, the code should build on FreeBSD again. More
details can be found in the README.par file.
Version 1.1.8b1-par7 fixing a number of bugs. I have also reworked some of the
code for adding and removing entries in the cache in an effort to improve
efficiency and stability. More details can be found in the ChangeLog.
Version 1.1.8b1-par6 introduces some further code cleanup. In addition the
documentation has been revised.
Version 1.1.8b1-par5 fixes a troublesome allocation size error that has been
discovered in Thomas Moestl's code. In practice this bug only wastes memory but
it could also potentially lead to memory corruption. Upgrading is
recommended. More details can be found in the ChangeLog.
Version 1.1.8b1-par4 has been released. Due to incompatibilities between
various implementations of the pthread library on Linux systems, problems can
occur with signal handling in pdnsd. The usual symptom is failure by pdnsd to
save the cache to disk, and /var/cache/pdnsd/pdnsd.cache remaining empty. If you
experience this kind of trouble, try reconfiguring with different values for the
new --with-thread-lib option. The allowable values are described in the
documentation.
pdnsd is no longer maintained by Thomas Moestl: I have not had time to maintain
pdnsd for quite a while now, and have been very slow to respond to issues, or
did not respond at all. It is time that I officially announce that pdnsd is no
longer actively maintained; I apologize to all those who reported bugs or asked
questions without receiving any reply. However, Paul A. Rombouts has published a
patch set against the last released version at
http://www.phys.uu.nl/~rombouts/pdnsd.html, which cleans up a lot of code fixes
many bugs.
Version 1.1.7a fixes a reversed assertion that would cause pdnsd to terminate
if used with the ping uptest. No other changes were made.
Version 1.1.7 fixes some problems that might be remotely exploitable to
gain access as the user pdnsd runs as (an unprivileged user by default). To do
this, an attacker needs to control a name server that is queried by pdnsd, and
send a malicious reply to such a query. Upgrading is strongly recommended!
There are also minor bug fixes and stability improvements.
Version 1.1.6 adds the query_port_start and query_port_end options (contributed
by Andreas Steinmetz), that allow confining the ports pdnsd uses for outgoing
queries to a certain range. It also fixes numerous bugs, one of which could
cause pdnsd to hang; update is therefore recommended.
Version 1.1.5 contains a fix for a security bug that would allow local users
that are allowed to use pdnsd-ctl on a running pdnsd server to execute
arbitrary code as the user that pdnsd runs as (or on Linux, when strict_setuid
is not enabled, as the user that started pdnsd). The danger of this is usually
quite limited; the status socket is not enabled by default, it's default
permissions do only allow the user pdnsd runs as to use the socket,
strict_setuid is enabled by default and pdnsd runs as an unprivileged user.
There is also a new configure option, --enable-underscores, that will make
pdnsd allow underscores in domain names. Furthermore, the SRV record handling
has been fixed to allow underscores in any case (this was not allowed
previously, but is required by the RFC). SOA records are not put in the
answer section any more if no answers are found (this violates the RFC's).
It may be put in the authority section in a later version.
There are also various bugfixes in this release.
Upgrade is recommended.
Version 1.1.4 fixes various smaller bugs, and should also improve the cache
write performance especially for larger caches. There are also two new
features: servers can now be given a label (using the label server option)
which can be used to identify them for the pdnsd-ctl server command
(contributed by Andrew M. Bishop), and local records can be marked to make
the domain record authoritative in pdnsd's cache (which means that pdnsd will
assume that records that are not present in the cache for that domain are
non-existent); this is on by default now, and can be controlled using the new
authrec server option).
Version 1.1.3 added contrib/ and had a lot of robustness fixes.
This release addresses a security hole that affects only Linux systems. Due to
a bug in glibc, pdnsd could crash during a port scan. This release contains
a workaround for this, as well as a fix for a deadlock under heavy load
conditions. It also fixes a possible problem that could be triggered by
malicious servers, and contains numerous bug fixes.
A script, contributed by Marko Stolle, makes pdnsd useful in a DHCP setup.
pdnsd also preservers the case of names in the cache, and should work much
better on alpha machines (thanks for the contributions by Bjoern Fischer
and P.J. Bostley that made this possible). New types were dded for rr
sections and pdnsd-ctl.
Upgrade is recommended.
Version 1.1.2 has a fix for a bug that could cause SERVFAIL to be
returned when NXDOMAIN would be appropriate. The bug surfaced only when
pdnsd queried name servers with a behaviour different from BIND's in the
NXDOMAIN case, e.g. pdnsd querying another pdnsd or e.g. djbdns.
Version 1.1.1 fixes a possible race condition in status socket creation.
This race might be used by a local attacker to change the access
permissions of a certain file in /tmp. The risk of this is probably
negligible. The default setup uses a non-privileged user, default mode
0600, and the status socket is disabled normally, so this should be
relatively safe. I don't see any possibility to exploit this, it is
more of a paranoia fix.
There are also some other minor fixes and documentation improvements.
Upgrade is recommended.
Version 1.1.0 introduces negative cacheing, pdnsd-ctl enhancements and
a much improved FreeBSD support. The cache file format has changed from
prior releases. Some configuration defaults have changed, too.
Version 1.0.15 is mostly a bugfix release. It also has a new option:
randomize_recs in the global section.
Version 1.0.14 has a fix in icmp.c that will make it build properly
on FreeBSD and older Linux systems.
Version 1.0.13 has some code cleanup, a fix for the Debian rc install,
and a security fix (contributed by Olaf Kirch): when changing
user and group id, pdnsd did not drop supplementary group IDs that
the original user was member of.
Version 1.0.12 is a bugfix release and contains some security
enhancements. There are also inclusion/exclusion lists for servers
(new options include=, exclude=, policy= in the server
section).
Version 1.0.11 fixes two bugs that might be used for denial-of-service
attacks, upgrading is recommended.
Versions 1.0.9 and 1.0.10 are bugfix releases.
Version 1.0.8 introduces special linux ppp device support contributed
by Ron Yorston, and has some bugfixes.
Version 1.0.7 introduces autoconf support, many new config file options and
the new pdnsd-ctl run-time configuration program.
Version 1.0.6 has another set of bugfixes, in addition to higher compile-
time configurability and UDP query support. It also contains Debian rc
scripts contributed by Markus Mohr.
Version 1.0.5 has some bugfixes and the new "server_ip" option
contributed by Wolfgang Ocker.
Version 1.0.4 introduces the new options run_as, strict_setuid and
paranoid. These new options are optional security enhancements.
Versions 1.0.1, 1.0.2 and 1.0.3 are bugfix releases.
Version 1.0.0 has a lot of changes compared to the 0.9.x tree, but much of
them "under the hood":
- IPv6 support (experimental; compile- and run-time configurable)
- FreeBSD (and such hopefully *BSD) support
- better rfc2181 compatability
- new options:
- serve_aliases in source section
- linkdown_kluge in global section
- max_ttl in global section
- cache-code reorganization, only one unified hash (of variable depth)
- Optimizations & cleanups
- Automatic deps (only interesting for developers ;-)
Version 0.9.11 fixes a locally exploitable security hole (the cache file was
world writeable by default). Please see ChangeLog.old for details.
Version 0.9.10 fixes some bugs and improves build on Red Hat.
Version 0.9.9 contains the rc scripts for Red Hat Linux contributed by Torben
Janssen, in addition to code cleanups and bugfixes.
The meaning of the option -v has changed in this release.
There is also a new config file option "lean_query" that is on by default. It
is an optimization, so please look in the docs when updating whether you want
it switched on or not.
When compiling versions after 0.9.8, you will probably get more
compiler warningsthan before. This is because the C compiler settings
have been made stricter.
Version 0.9.8 fixes a minor bug some build problems with glibc2.0 systems.
The versions 0.9.6 and 0.9.7 are bugfix releases.
Version 0.9.5 introduces uptest=exec, and a modified config file syntax (cache
sizes are now specified in kB).
Version 0.9.4 was the first to be released to the public. For information on
changes, see ChangeLog.

View File

@ -1,24 +0,0 @@
# Package build script for Arch Linux,
# contributed by Alexander Drozdov.
pkgname=@PACKAGE@
pkgver=@VERSION@
pkgrel=@packagerelease@
pkgdesc="pdnsd is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers."
url="http://members.home.nl/p.a.rombouts/pdnsd.html"
license="GPLv3"
depends=()
makedepends=(glibc)
conflicts=()
replaces=()
backup=()
install=
source=(http://members.home.nl/p.a.rombouts/pdnsd/releases/$pkgname-$pkgver-$pkgrel.tar.gz)
md5sums=()
build() {
cd $startdir/src/$pkgname-$pkgver
./configure --prefix=/usr --enable-ipv6 --sysconfdir=/etc --with-distribution=ArchLinux
make || return 1
make DESTDIR=$startdir/pkg install
}

View File

@ -1,22 +0,0 @@
You can find the documentation for pdnsd in the doc/ directory. The html
documentation (which I recommend) is in the doc/html/ subdirectory.
The pure text documentation (which is generated automatically from the
html documentation) is in doc/txt/.
The following documents are available:
index.html / intro.txt Overview, system requirements
doc.html / manual.txt Building, installation and usage instructions
faq.html / faq.txt The FAQ
Share and enjoy!
Thomas <tmoestl@gmx.net>
For news about recent changes in pdnsd the following files may be of
interest to you:
README.par
ChangeLog
NEWS
Last revised: 08 July 2007 by Paul Rombouts

View File

@ -1,216 +0,0 @@
pdnsd version 1.2.9a by Paul Rombouts
=====================================
This file describes the version of pdnsd that I maintain personally and am
making available so other people can enjoy the latest features and fixes. Thomas
Moestl no longer maintains pdnsd himself, so I am effectively the new
maintainer. This README describes the new features in version 1.2. This version
has a rather large number of internal changes and also some new features, which
I am rather pleased with, even if I say so myself. I think the changes are
significant enough to warrant increasing the minor version number from 1.1 to
1.2. The differences between my previous "official" release 1.1.11 and Thomas'
last release 1.1.7a are described in my previous README, which I have renamed
REAME.par.old. In this README I restrict myself to describing changes between
1.1.11 and 1.2.
The main difference between versions 1.2 and 1.2.1, aside from some minor
changes, is that 1.2.1 has (experimental) support for the Cygwin platform.
Version 1.2.2 has further improvements in portability and should in
particular now also compile on the Darwin (Apple Mac OS X) platform.
Version 1.2.4 has some important fixes for a memory leak, a minor buffer-
overflow problem and some situations which could cause pdnsd to exit
prematurely. Note that TCP-query support is now compiled in by default, but can
still be disabled using a configure option.
The main new feature of version 1.2.5 is the new query method "udp_tcp".
Version 1.2.6 has an updated license: GPL version 3. The main new feature of
version 1.2.6 is the "reject" option, which makes it possible to censor or
correct for unwanted IP addresses in replies.
Version 1.2.7 contains an important fix for a "dangling pointer" bug and
attempts to make pdnsd less vulnerable to the issues raised in CERT
vulnerability note VU#800113. It also contains some improvements for defining
local records interactively using the pdnsd-ctl utility.
The main new feature of version 1.2.8 is automatic discovery of root servers,
as well as some minor improvements in the resolver.
Version 1.2.9 among other things supports many addtional RR types, uses data
structures that should be more slightly more memory efficient and has support
for EDNS, which allows DNS UDP messages to be larger than 512 bytes.
Version 1.2.9a is a simple bugfix release that fixes a problem with compiling
1.2.9 after configuring with --enable-strict-rfc2181. Unless you use this option
to compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
For instructions how to compile and install pdnsd see doc/html/doc.html or
doc/txt/manual.txt. Note that I am no longer distributing a patch w.r.t. Thomas'
version because the (compressed) patch file is barely smaller than the
(compressed) tar archive.
Here follows a list of some of changes in version 1.2 from a user's perspective.
For a more technical description of some of the changes in the code see the ChangeLog.
For a short history about recent releases have a look at NEWS or doc/html/index.html.
- First of all, two potentially rather nasty bugs have been fixed in the code
for the handling of NXT and NAPTR records. A response from a remote server
containing NXT records (even well-formed ones) will very likely cause pdnsd to
crash. The code for handling NAPTR records contained incorrect ASSERT
statements, which could cause pdnsd to abort in a controlled fashion, but
completely unnecessarily.
- Sampo Lehtinen has remarked that pdnsd sometimes failed to resolve classless
reversed-delegated IP addresses, and that this has something to do with the
fact that pdnsd didn't accept '/' characters in domain names. After reading
some of the relevant RFCs I decided to remove all restrictions on the types
of characters that pdnsd accepts in domain names. Of course for most
applications, there are many characters which don't make sense in domain
names, but I feel that it is the responsibility of the client application to
reject these, not the proxy server.
- At the suggestion of Dan Tihelka, I have expanded to the server_ip= option to
allow the name of an interface to be specified instead of an IP address.
Presently this has been tested on Linux only. Can someone running pdnsd on
*BSD tell me if the code for getting the address of an interface is different
for Linux and BSD-type systems?
- At the suggestion of Juliusz Chroboczek I've added an new server availability
test which can be specified with uptest=query. This can be useful as an
alternative to "uptest=ping" in case the remote server does not respond to
ICMP_ECHO requests at all, which unfortunately is quite common these days.
"uptest=query" causes pdnsd to send an empty query to remote name servers. Any
well-formed response (apart from SERVFAIL) within the timeout period will be
interpreted as a sign that the server is "up".
- Instead of specifying the IP addresses of the name servers that pdnsd should
query in a server section of the config file, you may also specify a
resolv.conf-style file. Preferably this should not be /etc/resolv.conf. If the
contents of the resolv.conf type file changes while pdnsd is running, you can
make pdnsd aware of the changes with the "pdnsd-ctl config" command, see
below. Example:
server {
label=myisp;
file=/etc/ppp/resolv.conf;
timeout=10;
}
- There is a new option for "server" sections in the config file:
root_server=on/off.
In case a server section contains only addresses of root servers, which
usually only give the name servers of top level domains in their reply,
setting root_server=on will enable certain optimizations. This involves using
cached information to reduce queries to the root servers, thus speeding up the
resolving of new names.
- New option for "rr" sections in the config file: reverse=on/off.
If you want a locally defined name to resolve to a numeric address and vice
versa, you can now achieve this by setting reverse=on before defining the A
record, making it unnecessary to define a separate PTR record for the reverse
resolving.
Example:
rr {
name = localhost;
reverse = on;
a = 127.0.0.1;
}
has the same effect as:
rr {
name = localhost;
a = 127.0.0.1;
}
rr {
name = 1.0.0.127.in-addr.arpa;
ptr = localhost;
}
- In rr sections it is now possible to specify a wildcard name, i.e. a name
starting with the label *. The * in a wildcard can match one or more labels in
a queried name, but only whole labels. For example, *.mydomain will match
a.mydomain or www.a.mydomain, but not mydomain. Before you can specify an rr
section with name=*.mydomain you must define some records for mydomain,
typically NS and/or SOA records.
Example:
rr {
name = mydomain;
ns = localhost;
soa = localhost, root.localhost, 42, 86400, 900, 86400, 86400;
}
rr {
name = *.mydomain;
a = 192.168.1.10;
}
- There is a slight backwards compatibility problem which involves the name= and
owner= options in rr sections. The new version does not allow you to place
owner= before name=. On the other hand, you may now freely mix the owner
option with the a,ptr,cname,mx and soa options and define as many records of
this type as you like (including zero).
- pdnsd-ctl has three new commands:
config: Reloads pdnsd's configuration file. This is more efficient than
restarting pdnsd, and should not cause only noticeable interruption in DNS
service. However, some types of configuration changes cannot be put into
effect this way, and you will be prompted to restart pdnsd instead.
empty-cache: Empties the cache completely, freeing all existing entries.
In version 1.2.3 you can specify a selection of entries to delete by providing
a list of include/exclude patterns.
dump: Prints information about all the names stored in the cached. This is
mainly useful for diagnostic purposes.
- There is now a pdnsd.conf(5) man page, describing pdnsd's configuration file.
The man page has been generated from the html documentation using a customized
Perl script.
- New in version 1.2.4: Time intervals in the configuration files can now be
expressed in seconds, minutes, hours, days and weeks, using the suffixes
s,m,h,d,and w.
Example: 2h30m is interpreted as 2*60*60 + 30*60 = 9000 seconds.
- Version 1.2.5 introduces a new configuration option, contributed by Jan-Marek
Glogowski, called "use_nss" which can be turned off to prevent nasty delays in
certain situations.
Besides the query methods "udp_only", "tcp_only" and "tcp_udp" you can now
also specify "udp_tcp", which more closely adheres to the behaviour
recommended by DNS standards.
- Version 1.2.6 introduces the "randomize_servers" and "reject" options. By
setting "randomize_servers" on you can give each server in a server section an
equal chance of being queried, which is useful when resolving from root
servers, for instance. The "reject" option can be used to censor certain IP
addresses or correct for unwanted replies from servers you don't completely
trust.
- Version 1.2.7 contains support for "include" files which can be referenced
from configuration files or read interactively using pdnsd-ctl. These files
can be used to add local definitions to the cache without reconfiguring pdnsd.
The new "pdnsd-ctl eval" command can be used to interactively define local
records that could previously only be defined in configuration files but not
with the "pdnsd-ctl add" command.
- Version 1.2.8 contains support for automatic discovery of root servers.
Instead of supplying a complete list of IP addresses of root servers in a
server section of the configuration file, you need only enter one or two
addresses of name servers which know the names and addresses of the root
servers and set "root_server=discover".
The "neg_rrs_pol" option has a new default setting, which should allow
sensible negative caching of RRs in most situations, even if "proxy_only=on".
- Version 1.2.9 contains support for EDNS (Extension mechanisms for DNS), which
allows UDP messages to be larger than 512 bytes. Whether pdnsd uses EDNS in
outgoing queries is determined by the configuration option "edns_query". If
pdnsd receives a query using EDNS, it will reply using EDNS regardless of the
configuration settings.
Local TXT records can now be defined in the configuration file.
If the query uptest fails due to remote servers ignoring empty queries, this
can now be remedied using the new "query_test_name" config option.
The new features are described in greater detail in the manual doc/html/doc.html
or doc/txt/manual.txt.
Enjoy!
If you have any questions about my version of pdnsd, you can send these
to <p.a.rombouts@home.nl>. Questions about the original (unmaintained) pdnsd
version should be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.

View File

@ -1,249 +0,0 @@
pdnsd maintenance version 1.1.11-par by Paul Rombouts
=======================================================
This file describes the version of pdnsd that I maintain personally and am
making available so other people can enjoy the latest features and fixes.
Thomas Moestl no longer maintains pdnsd himself, so I am effectively the new
maintainer. The current version is 1.1.11-par, which has a rather large number
of small changes. Among the bugs fixed are a race condition in the cache lookup
code, a flaw in the code that caused a busy spin when a remote server answered
with "Not Implemented", and problems with the -4 and -6 command-line options.
Among the improvements are an alternative sorting algorithm which should allow
pdnsd to start up faster when reading a large cache file from disk, automatic
mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat more
efficient memory use, and better compression of the replies. Some of the new
features are described in the second half of this file (look for "new in version
1.1.11"). For the rest of the changes I will have to refer you to the ChangeLog.
For a short history about recent releases have a look at doc/html/index.html.
Since version 1.1.9 I've added some missing pieces to the documentation (the
manual doc/html/doc.html,doc/txt/manual.txt and the man page doc/pdnsd-ctl.8).
Version 1.1.11 finally has a man page doc/pdnsd.8, thanks to a contribution by
Mahesh T. Pai.
The first part of this file describes how to patch, compile, install and run
pdnsd. The second part describes some of the changes I've made to Thomas
Moestl's code.
Unless you're using the pre-patched source archive pdnsd-1.1.11-par.tar.gz you
must first apply my patch file pdnsd-1.1.11-par.diff.gz before compiling and
installing pdnsd according to Thomas Moestl's instructions described in the the
documentation. Use a freshly untarred copy of Thomas Moestl's original version
1.1.7a source, cd into the source directory pdnsd-1.1.7a and apply the command:
gzip -cd <path_to_patch>/pdnsd-1.1.11-par.diff.gz | patch -p2 -N -Z
Note: I have used GNU extensions so there may be some portability issues. I have
supplied alternatives for some of the less portable functions. There should be no
problem with most Linux distributions.
That's it! You should now be able to compile, install and run pdnsd. See the
documentation in doc/html/doc.html or doc/txt/manual.txt for more detailed
instructions.
Some people may want change the compiler optimization flag. I use the -O2 flag,
but it might be safer to use a lower level of optimization or no optimization at
all. In that case prefix the configure command with the desired compiler flags
like this (assuming you're using a bash shell):
CFLAGS="-O1 -g -Wall" ./configure ...
I have added a new configuration option "--with-thread-lib=<lib>", which you
should use if you experience problems with signal handling under Linux. The
usual symptom is failure by pdnsd to save the cache to disk, and
/var/cache/pdnsd/pdnsd.cache remaining empty. If you experience this kind of
trouble, try reconfiguring with different values for the --with-thread-lib
option. The allowable values are "linuxthreads" (the default), "linuxthreads2"
(or "lt2" for short), and "nptl". I recommend that you first configure and
compile without the --with-thread-lib option, then if you experience trouble try
again with --with-thread-lib=lt2 and recompile.
If your Linux system has an implementation of the Native POSIX Thread Library,
which is the case with Red Hat 9 for instance, you should use
--with-thread-lib=nptl .
Ideally, I would like to write a configure script which automatically detects
which kind of thread library is being used on a Linux system, but I don't have a
clue yet how to do this. If you can help me with this please write to me at the
email address listed at the end of this file.
The rest of this file describes some of the modifications I've made, but you
don't have to read it if you simply want to run pdnsd as you're used to.
- The main new feature I've added enables you to change the server addresses
that pdnsd uses at run-time using pdnsd-ctl. I've done this because the ISPs I
use do not specify fixed DNS server addresses, but expect their clients to use
dynamic DNS configuration (DHCP in the case of the cable connection, RFC1877
in case of isdn). I've extended the options that can be given with the
"server" command to pdnsd-ctl, to allow IP addresses to be specified as an
additional argument after "up|down|retest". This allows me to put something
like this in my ifup-local script:
pdnsd-ctl server isp-label up "$DNS1 $DNS2"
For more details how to use pdnsd-ctl read the updated documentation in
the doc/html directory. There is also a manpage for pdnsd-ctl.
This was quite tricky to implement because there might be pending queries
while the addresses are being changed. It certainly was an interesting
exercise in writing multi-threaded code for me.
- I've implemented a feature which allowed me to specify multiple IP addresses
per server section in the configuration file. This allowed for a much more
compact configuration file (3 server sections instead of 7 in my case),
because most configuration options are identical for servers belonging to the
same ISP. It also made the output of "pdnsd-ctl status" more compact. And it
was necessary to enable a satisfactory implementation of the previous feature.
Example of the new syntax:
ip = 123.456.789.001, 123.456.789.002, 123.456.789.003;
At the suggestion of Greg Norris server sections no longer have to specify IP
addresses. A server section without IP addresses will remain inactive until it
is assigned one more addresses at run-time with pdnsd-ctl.
- I've changed the implementation of dynamic arrays to make it slightly more
efficient, and improve type safety. I also got rid of several arrays of fixed
size in favor of dynamically allocated arrays. In particular, I got rid of
all occurrences of MAXPATH. I also made several static variables "automatic".
- The output of the "status" command of pdnsd-ctl now gives more meaningful
constant names "ping|none|if|exec" instead of numbers for the "uptest" option.
I've also added some information that was previously missing.
- I've fixed I a problem that caused pdnsd to use up a lot of CPU time and slow
down my system considerably when it received a query that took a long time to
resolve. It turned out that pdnsd can get into a "busy spin" when one of the
DNS servers pdnsd is querying refuses the connection. Apart from fixing this
bug, to speed things up additionally, I thought it would be a good idea to
mark a server down (without retesting it) after detecting errno==ECONNREFUSED.
This gives me very satisfactory performance, with the problematic server being
tried only once during every testing interval.
New in version 1.1.11: An additional busy spin condition, triggered when a
remote server answers with "Not Implemented", has been discovered and fixed.
In case there are remaining bugs in the multiplexing code, I've added a test
that checks if the number of events reported by poll/select matches the number
of events handled by pdnsd. If not, pdnsd will log an error message and give
up. Although the bugs still need to be reported and fixed, at least this
should prevent pdnsd from wasting CPU cycles.
- Due to a bug in Thomas' code, pdnsd tries, but fails, to remove the control
socket "pdnsd.status" before exiting. This has also been fixed. In version
1.1.8b1-par6 I have cleaned this up some more so that pdnsd will handle
situations where it can't open or bind the control socket more gracefully.
- I've rewritten some of the code that saves the contents of the cache to the
file "pdnsd.cache" just before pdnsd exits. This is because I noticed in my
logfiles that pdnsd occasionally had problems reading this file back at
startup. I eliminated the use of fseek() in Thomas' code. I could not find
anything that was demonstrably incorrect about his use of fseek(), but it
seemed better to me to do without it and write the file in a strictly
sequential order. Anyway, it turned out my hunch paid off: no more error
messages about "pdnsd.cache" in my logfile.
New in version 1.1.11: I've added some new code for sorting the queue used for
purging stale cache entries. This should allow pdnsd to start up faster when
reading large cache files from disk.
- I've extended the configuration options for policies of inclusion/exclusion
lists in server sections. The new policies options are "simple_only" and
"fqdn_only". Setting policy=simple_only will cause the server to used only for
simple hostnames if no other rule matches. On the other hand, setting
policy=fqdn_only will cause the server to be used only for fully qualified
domain names (i.e. the name has at least one dot in-between). I find these
options useful for controlling which name servers (if any) will be used by
pdnsd for simple host names.
- I've added a new "delegation_only" option that can be used to undo the
unwanted effects of DNS "wildcards". It works roughly as the feature by the
same name in BIND. It is turned off by default. To block Verisign's
Sitefinder, add the following line to the global section of the configuration
file:
delegation_only= com, net;
If you find that this feature blocks some legitimate domain names, you will
probably need to add the address of a nameserver that provides good authority
information. More information can be found at
http://www.phys.uu.nl/~rombouts/pdnsd/delegationonly.html
- It is no longer mandatory that domain names in the configuration file end in a
dot.
- The parser for configuration files has been rewritten purely in C, so (f)lex
and yacc/bison are no longer needed to build pdnsd.
It is no longer necessary to place strings between quotes in the configuration
file, unless a string contains a special character such as whitespace, a token
that normally starts a comment, or one of the characters ",;{}". Note that
these special characters are illegal in domain names anyway.
- New in version 1.1.11: Negating whole domains with a neg section in the
config file will result in all the subdomains being negated as well.
For example, adding the lines
neg {name=doubleclick.com; types=domain;}
neg {name=doubleclick.net; types=domain;}
will also negate ad.doubleclick.com, ad.fr.doubleclick.net, etc.
- New in version 1.1.11: When running in IPv6 mode, pdnsd will now automatically
map any IPv4 addresses it reads in the config file to IPv6 addresses.
When pdnsd has been compiled with IPv6 support and runs in IPv4 mode, it will
skip IPv6 addresses with a warning message. This may result in certain server
sections becoming inactive, though.
The -4 and -6 options should now work as advertised.
I've added two new command-line options, "-a" and "-i <prefix>".
With the -a flag pdnsd will try to detect automatically if IPv6 support is
available on a system, and fall back to IPv4 if not. The -a flag can be used
instead of -4 or -6.
The -i option can be used to specify a prefix for mapping IPv4 to IPv6
address. The default is ::ffff.0.0.0.0. There is also a corresponding
ipv4_6_prefix= option for the config file.
- New in version 1.1.11: I've slightly changed the way pdnsd does parallel
queries. Active queries or not canceled until we have received a useful
response from a remote name server, or all the queries have failed or timed
out. Thus the par_queries parameter is no longer the maximum number of
parallel queries, but rather the increment with which the number of parallel
queries is increased when the previous set has timed out. In the worst case
there will be pending queries to all the servers in the list of available
servers simultaneously. We may be wasting more system resources this way, but
the advantage is that we have a greater chance of catching a reply. After all,
if we wait longer anyway, why not for more servers.
I've also introduced a global timeout parameter. This is the minimum period of
time pdnsd will wait after sending the first query to a remote server before
giving up without having received a reply. The timeout options in the
configuration file are now only minimum timeout intervals. Setting the global
timeout option makes it possible to specify quite short timeout intervals in
the server sections. This will have the effect that pdnsd will start querying
additional servers fairly quickly if the first servers are slow to respond
(but will still continue to listen for responses from the first ones). This
may allow pdnsd to get an answer more quickly in certain situations.
After receiving a reply from a remote server the server is marked up and its
time stamp is updated. This will have the effect that pdnsd doesn't bother
testing this server for availability for a period of time, and thus the
overhead caused by testing is reduced. After server timeouts, uptests are
performed by the separate server status thread, not by threads that have to
answer queries. Unresponsive servers with uptest=ping will not be marked down
immediately any more, but only after the ping test has definitely failed.
I've also included a number of bug-fixes contained in a patch file supplied to
me by Thomas Moestl. In addition to the things I had already fixed, the
following issues are addressed: some memory leaks, dropping of root privileges
before calling uptest scripts in case pdnsd was started setuid root (which is a
bad idea anyway), passing on open fd's to uptests, integer overruns in the
status reporting code, fixing string passing from the lexer, more consistent
treatment of underscores in domain names.
In addition to the things I've listed above, I've made various little changes to
fix minor bugs, improve efficiency or elegance, or simply to suit my my own
coding style. These changes are too numerous to list here, but some of them are
listed in the ChangeLog. Of course if you are really interested in the
nitty-gritty you can always compare the source of my version with Thomas'
original code.
If you have any questions about the modifications I've made, you can send these
to <p.a.rombouts@home.nl>. Questions about the original pdnsd version should
be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.

View File

@ -1,66 +0,0 @@
This is a (hopefully complete) list of people I have to thank for helping me
develop and improve pdnsd:
David G. Andersen
Andrew M. Bishop
Daniel Black
Carsten Block
Stephan Boettcher
P.J. Bostley
Rodney Brown
Kevin A. Burton
Juliusz Chroboczek
Joachim Dorner
Frank Elsner
Christian Engstler
Stefan Erhardt
Bjoern Fischer
Stefan Förster
Bert Frederiks
Mike Hammer
Jonathan Hudson
Torben Janssen
Byrial Jensen
Olaf Kirch
Nikola Kotur
Kiyo Kelvin Lee
Bernd Leibing
Patrick Loschmidt
James MacLean
Sourav K. Mandal
Fraser McCrossan
Markus Mohr
Michael Müller
Gustavo Niemeyer
Alexandre Nunes
Wolfgang Ocker
Mahesh T. Pai
Bernhard Pelz
Soenke J. Peters
Erich Reitz
Paul A. Rombouts
Brian Schroeder
Roman Shterenzon
Daniel Smolik
Milan P. Stanic
Michael Steiner
Norbert Steinl
Andreas Steinmetz
Marko Stolle
Markus Storm
Michael Ströder
Thomas Stromberg
Alan Swanson
Lyonel Vincent
Eelco Vriezekolk
Paul Wagland
Sverker Wiberg
Michael Wiedmann
Ron Yorston
Nikita V. Youshchenko
Jan-Marek Glogowski
Thomas Cort
Pierre Habouzit
Dirk Armbrust
Georg Schwarz
Ashish Shukla

View File

@ -1,20 +0,0 @@
- Implement a reference counter to ensure that newly entered records are not
purged immediately (really needed?)
- Perhaps do a two-step form of recursive query: first query those servers we
have got cached, then (if unsuccessful) look the others up and query again.
The impact of this optimisation may not be very big, because all sane servers
give A records for NS records if possible.
- Test for compatibility on other Unix-like Systems other than the BSDs and
Linux; rewrite the functions in netdev.c and icmp.c for those OSs if
necessary. Also try to get compatibility for other compilers than gcc.
- Write an install rule for the Slackware start-up script.
- Update the FAQ.
- Implement DNSSEC support. Since version 1.2.9, pdnsd is able to cache the RR
types necessary for DNSSEC, but the resolver is not yet security aware.
- Implement a lookup table (hash table) for queries in progress. This would
enable a thread that is resolving a query that is already being handled by
another thread to wait for that other thread to finish and copy its result
rather than independently query remote servers. It is very common for
resolvers to resend UDP queries if they don't get a reply within a timeout
period and if the answer is not yet cached, this will result in multiple
threads duplicating each others work in the current implementation.

View File

@ -1,191 +0,0 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
/* Define your Target here. Currently defined are TARGET_LINUX (any
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
* works for other BSD variants) and TARGET_CYGWIN. */
#define TARGET TARGET_LINUX
/* change the #undef to #define if you do not want to compile with special
* ISDN support for Linux. Note that the ISDN support will not compile ok on
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
* it may work fine). This is not on by default because it will cause compile
* problems on some systems */
#undef ISDN_SUPPORT
/* The following regulates the IP Protocol support. Supported types are IPv4
* and IPv6 (aka IPng). You may enable either or both of these protocols.
* Enabling in this context means that support for the respective protocol
* will be in the binary. When running the binary, one of the protocols may
* be activated via command line switches. Note that activating both IPv4 and
* IPv6 is pointless (and will not work because two UDP and two TCP threads
* will be started that concur for ports). Because of that, it is not allowed.
* When pdnsd runs with IPv6 activated it should be able to service queries
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
* properly.
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
* control whether support for the respective protocol is available in the
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
* a protocol was included in the executable, you can specify command line
* parameters to activate or deactivate that protocol (the options are -4 and
* -6), but it makes more sense to use the run_ipv4=on/off option in the
* configuration file.
* Make your choice. Note that IPv6 support is experimental in pdnsd.
* In normal operation, you will currently only need IPv4. */
#undef ENABLE_IPV4
#define DEFAULT_IPV4 1
#undef ENABLE_IPV6
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
* TCP. Now, you have the choice. You can control that behaviour using
* the -m command line switch, and you can give a preset here. There
* are 3 different modes:
* UDP_ONLY: This is undoubtedly the fastest query method, because
* no TCP negotiation needs to be done.
* TCP_ONLY: This is slower than uo, but generally more secure
* against DNS spoofing. Note that some name servers on the
* internet do not support TCP queries, notably dnscache.
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
* error or times out, the query is retried using UDP.
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
* the query is retried using TCP. */
#define M_PRESET UDP_ONLY
/* In addition to choosing the presets, you may also completely disable
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
* This saves some executable space. */
#undef NO_UDP_QUERIES
#undef NO_TCP_QUERIES
/* With the following option, you can disable the TCP server functionality
* of pdnsd. Nearly no program does TCP queries, so you probably can do
* this safely and save some executable space and one thread.
* You also can turn off the TCP server at runtime with the --notcp option. */
#undef NO_TCP_SERVER
/* By undefining the following, you can disable the UDP source address
* discovery code. This is not recommended, but you may need it when
* running into compilation problems. */
#undef SRC_ADDR_DISC
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
* unsure about what this means, just leave this as it is.*/
#undef NO_POLL
/* Define this for "hard" RFC 2181 compliance: this RFC states that
* implementations should discard answers whose RR sets have multiple
* different time stamps. While correct answers are generated, incorrect
* ones are normally tolerated and corrected. Full RFC compliance is
* however only achieved by deactivating this behaviour and thus being
* intolerant. */
#undef RFC2181_ME_HARDER
/* Define this to the device you want to use for getting random numbers.
* Leave this undefined if you wand to use the standard C library random
* function, which basically should be sufficient.
* Linux and FreeBSD have two random number devices: /dev/random and
* /dev/urandom. /dev/urandom might be less secure in some cases, but
* should still be more than sufficient. The use of /dev/random is
* discouraged, as reading from this device blocks when new random bits
* need to be gathered. */
#undef RANDOM_DEVICE
#undef R_DEFAULT
#undef R_RANDOM
#undef R_ARC4RANDOM
/*#define RANDOM_DEVICE "/dev/urandom"*/
/* Designate which database manager to use for cacheing.
* default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE
#define CACHEDIR "/var/cache/pdnsd"
#define TEMPDIR "/tmp";
/* This is for various debugging facilities that produce debug output and
* double-check some values. You can enable debug messages with the -g option.
* Normally, you can switch this off safely by setting the number after DEBUG
* to 0. This will increase speed (although only marginally), save space
* in the executable (only about 12kB) and some stack space per thread
* (which may be significant if you have many threads running simultaneously).
* However, it may be an aid when debugging config files.
* The only defined debug levels by now are in the range 0 - 9.
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
* When in doubt, leave it defined to 1. */
#define DEBUG 1
/* This defines the default verbosity of informational messages you will get.
This has nothing to to with the debug option (-g), but may be set with -v
option. 0 is for normal operation, up to 3 for debugging.
Unlike the debug messages, these messages will also be written to the syslog.*/
#define VERBOSITY 0
/* Redefine this if you want another hash size.
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
* you are nuts.) */
#define HASH_SZ 10
/* Set this to debug the hash tables. Turn this off normally, or you will get
* flooded with diagnostic messages */
#undef DEBUG_HASH
/* Define if you have working C99 Variadic macro support */
#undef CPP_C99_VARIADIC_MACROS
/* Define as int if socklen_t typedef is missing */
#undef socklen_t
/* Lock the UDP socket before using it? */
#undef SOCKET_LOCKING
/* Default TCP timeout when receiving queries */
#define TCP_TIMEOUT 30
/* Allow subsequent TCP queries on one connection? */
#undef TCP_SUBSEQ
/* Default value for parallel query number */
#define PAR_QUERIES 2
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
#define MAXNAMESERVIPS 3
/* These are the possible targets. Normally no need to touch these
* definitions. */
#define TARGET_LINUX 0
#define TARGET_BSD 1
#define TARGET_CYGWIN 2
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
#undef THREADLIB_NPTL
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
#undef THREADLIB_LINUXTHREADS2
/* The following is needed for using LinuxThreads. Better don't touch. */
#define _REENTRANT 1
#define _THREAD_SAFE 1
/* It appears the newer versions of gcc won't convert a pointer to char into
a pointer to unsigned char and vice versa without complaining.
By using casts these warning messages can be suppressed, but at the cost
of losing some type safety.
Define charp and ucharp to be empty if you are a developer and find type
safety more important.
Leave the definitions unchanged to avoid distracting warning messages. */
#define charp (char *)
#define ucharp (unsigned char *)
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
* contents of ./version */
#define VERSION "@VERSION@"
#endif

1021
jni/pdnsd/aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,142 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,437 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
/* Define your Target here. Currently defined are TARGET_LINUX (any
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
* works for other BSD variants) and TARGET_CYGWIN. */
#define TARGET TARGET_LINUX
/* change the #undef to #define if you do not want to compile with special
* ISDN support for Linux. Note that the ISDN support will not compile ok on
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
* it may work fine). This is not on by default because it will cause compile
* problems on some systems */
/* #undef ISDN_SUPPORT */
/* The following regulates the IP Protocol support. Supported types are IPv4
* and IPv6 (aka IPng). You may enable either or both of these protocols.
* Enabling in this context means that support for the respective protocol
* will be in the binary. When running the binary, one of the protocols may
* be activated via command line switches. Note that activating both IPv4 and
* IPv6 is pointless (and will not work because two UDP and two TCP threads
* will be started that concur for ports). Because of that, it is not allowed.
* When pdnsd runs with IPv6 activated it should be able to service queries
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
* properly.
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
* control whether support for the respective protocol is available in the
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
* a protocol was included in the executable, you can specify command line
* parameters to activate or deactivate that protocol (the options are -4 and
* -6), but it makes more sense to use the run_ipv4=on/off option in the
* configuration file.
* Make your choice. Note that IPv6 support is experimental in pdnsd.
* In normal operation, you will currently only need IPv4. */
#define ENABLE_IPV4 1
#define DEFAULT_IPV4 1
#undef ENABLE_IPV6
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
* TCP. Now, you have the choice. You can control that behaviour using
* the -m command line switch, and you can give a preset here. There
* are 3 different modes:
* UDP_ONLY: This is undoubtedly the fastest query method, because
* no TCP negotiation needs to be done.
* TCP_ONLY: This is slower than uo, but generally more secure
* against DNS spoofing. Note that some name servers on the
* internet do not support TCP queries, notably dnscache.
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
* error or times out, the query is retried using UDP.
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
* the query is retried using TCP. */
#define M_PRESET TCP_ONLY
/* In addition to choosing the presets, you may also completely disable
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
* This saves some executable space. */
/* #undef NO_UDP_QUERIES */
/* #undef NO_TCP_QUERIES */
/* With the following option, you can disable the TCP server functionality
* of pdnsd. Nearly no program does TCP queries, so you probably can do
* this safely and save some executable space and one thread.
* You also can turn off the TCP server at runtime with the --notcp option. */
/* #undef NO_TCP_SERVER */
/* By undefining the following, you can disable the UDP source address
* discovery code. This is not recommended, but you may need it when
* running into compilation problems. */
#define SRC_ADDR_DISC 1
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
* unsure about what this means, just leave this as it is.*/
/* #undef NO_POLL */
/* Define this for "hard" RFC 2181 compliance: this RFC states that
* implementations should discard answers whose RR sets have multiple
* different time stamps. While correct answers are generated, incorrect
* ones are normally tolerated and corrected. Full RFC compliance is
* however only achieved by deactivating this behaviour and thus being
* intolerant. */
/* #undef RFC2181_ME_HARDER */
/* Define this to the device you want to use for getting random numbers.
* Leave this undefined if you wand to use the standard C library random
* function, which basically should be sufficient.
* Linux and FreeBSD have two random number devices: /dev/random and
* /dev/urandom. /dev/urandom might be less secure in some cases, but
* should still be more than sufficient. The use of /dev/random is
* discouraged, as reading from this device blocks when new random bits
* need to be gathered. */
/* #undef RANDOM_DEVICE */
#define R_DEFAULT 1
/* #undef R_RANDOM */
/* #undef R_ARC4RANDOM */
/*#define RANDOM_DEVICE "/dev/urandom"*/
/* Designate which database manager to use for cacheing.
* default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE
#define CONFDIR "/data/data/net.typeblog.socks"
#define CACHEDIR "/data/data/net.typeblog.socks"
#define TEMPDIR "/data/data/net.typeblog.socks/cache";
/* This is for various debugging facilities that produce debug output and
* double-check some values. You can enable debug messages with the -g option.
* Normally, you can switch this off safely by setting the number after DEBUG
* to 0. This will increase speed (although only marginally), save space
* in the executable (only about 12kB) and some stack space per thread
* (which may be significant if you have many threads running simultaneously).
* However, it may be an aid when debugging config files.
* The only defined debug levels by now are in the range 0 - 9.
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
* When in doubt, leave it defined to 1. */
#define DEBUG 1
/* This defines the default verbosity of informational messages you will get.
This has nothing to to with the debug option (-g), but may be set with -v
option. 0 is for normal operation, up to 3 for debugging.
Unlike the debug messages, these messages will also be written to the syslog.*/
#define VERBOSITY 0
/* Redefine this if you want another hash size.
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
* you are nuts.) */
#define HASH_SZ 10
/* Set this to debug the hash tables. Turn this off normally, or you will get
* flooded with diagnostic messages */
/* #undef DEBUG_HASH */
/* Define if you have working C99 Variadic macro support */
#define CPP_C99_VARIADIC_MACROS 1
/* Define as int if socklen_t typedef is missing */
/* #undef socklen_t */
/* Lock the UDP socket before using it? */
/* #undef SOCKET_LOCKING */
/* Default TCP timeout when receiving queries */
#define TCP_TIMEOUT 5
/* Allow subsequent TCP queries on one connection? */
/* #undef TCP_SUBSEQ */
/* Default value for parallel query number */
#define PAR_QUERIES 4
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
#define MAXNAMESERVIPS 3
/* These are the possible targets. Normally no need to touch these
* definitions. */
#define TARGET_LINUX 0
#define TARGET_BSD 1
#define TARGET_CYGWIN 2
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
#define THREADLIB_NPTL 1
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
/* #undef THREADLIB_LINUXTHREADS2 */
/* The following is needed for using LinuxThreads. Better don't touch. */
#define _REENTRANT 1
#define _THREAD_SAFE 1
/* It appears the newer versions of gcc won't convert a pointer to char into
a pointer to unsigned char and vice versa without complaining.
By using casts these warning messages can be suppressed, but at the cost
of losing some type safety.
Define charp and ucharp to be empty if you are a developer and find type
safety more important.
Leave the definitions unchanged to avoid distracting warning messages. */
#define charp (char *)
#define ucharp (unsigned char *)
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
* contents of ./version */
#define VERSION "1.2.9a-par"
#endif
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the `asprintf' function. */
#define HAVE_ASPRINTF 1
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* #undef HAVE_DOPRNT */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getline' function. */
#if defined(__aarch64__) || defined(__x86_64__)
#define HAVE_GETLINE 1
#endif
/* Define to 1 if you have the `getpwnam_r' function. */
//#define HAVE_GETPWNAM_R 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `inet_ntop' function. */
#define HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
#define HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */
//#define HAVE_MEMPCPY 1
/* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1
/* Define to 1 if you have the `nanosleep' function. */
#define HAVE_NANOSLEEP 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if the system has the type `socklen_t'. */
#define HAVE_SOCKLEN_T 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */
#if defined(__aarch64__) || defined(__x86_64__)
#define HAVE_STPCPY 1
#endif
/* Define to 1 if you have the `stpncpy' function. */
//#define HAVE_STPNCPY 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1
/* Define to 1 if the system has the type `struct ifreq'. */
#define HAVE_STRUCT_IFREQ 1
/* Define to 1 if the system has the type `struct in6_addr'. */
#define HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if the system has the type `struct in_pktinfo'. */
#define HAVE_STRUCT_IN_PKTINFO 1
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `vasprintf' function. */
#define HAVE_VASPRINTF 1
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

View File

@ -1,430 +0,0 @@
/* config.h.in. Generated from configure.in by autoheader. */
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
/* Define your Target here. Currently defined are TARGET_LINUX (any
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
* works for other BSD variants) and TARGET_CYGWIN. */
#define TARGET TARGET_LINUX
/* change the #undef to #define if you do not want to compile with special
* ISDN support for Linux. Note that the ISDN support will not compile ok on
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
* it may work fine). This is not on by default because it will cause compile
* problems on some systems */
#undef ISDN_SUPPORT
/* The following regulates the IP Protocol support. Supported types are IPv4
* and IPv6 (aka IPng). You may enable either or both of these protocols.
* Enabling in this context means that support for the respective protocol
* will be in the binary. When running the binary, one of the protocols may
* be activated via command line switches. Note that activating both IPv4 and
* IPv6 is pointless (and will not work because two UDP and two TCP threads
* will be started that concur for ports). Because of that, it is not allowed.
* When pdnsd runs with IPv6 activated it should be able to service queries
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
* properly.
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
* control whether support for the respective protocol is available in the
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
* a protocol was included in the executable, you can specify command line
* parameters to activate or deactivate that protocol (the options are -4 and
* -6), but it makes more sense to use the run_ipv4=on/off option in the
* configuration file.
* Make your choice. Note that IPv6 support is experimental in pdnsd.
* In normal operation, you will currently only need IPv4. */
#undef ENABLE_IPV4
#define DEFAULT_IPV4 1
#undef ENABLE_IPV6
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
* TCP. Now, you have the choice. You can control that behaviour using
* the -m command line switch, and you can give a preset here. There
* are 3 different modes:
* UDP_ONLY: This is undoubtedly the fastest query method, because
* no TCP negotiation needs to be done.
* TCP_ONLY: This is slower than uo, but generally more secure
* against DNS spoofing. Note that some name servers on the
* internet do not support TCP queries, notably dnscache.
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
* error or times out, the query is retried using UDP.
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
* the query is retried using TCP. */
#define M_PRESET UDP_ONLY
/* In addition to choosing the presets, you may also completely disable
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
* This saves some executable space. */
#undef NO_UDP_QUERIES
#undef NO_TCP_QUERIES
/* With the following option, you can disable the TCP server functionality
* of pdnsd. Nearly no program does TCP queries, so you probably can do
* this safely and save some executable space and one thread.
* You also can turn off the TCP server at runtime with the --notcp option. */
#undef NO_TCP_SERVER
/* By undefining the following, you can disable the UDP source address
* discovery code. This is not recommended, but you may need it when
* running into compilation problems. */
#undef SRC_ADDR_DISC
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
* unsure about what this means, just leave this as it is.*/
#undef NO_POLL
/* Define this for "hard" RFC 2181 compliance: this RFC states that
* implementations should discard answers whose RR sets have multiple
* different time stamps. While correct answers are generated, incorrect
* ones are normally tolerated and corrected. Full RFC compliance is
* however only achieved by deactivating this behaviour and thus being
* intolerant. */
#undef RFC2181_ME_HARDER
/* Define this to the device you want to use for getting random numbers.
* Leave this undefined if you wand to use the standard C library random
* function, which basically should be sufficient.
* Linux and FreeBSD have two random number devices: /dev/random and
* /dev/urandom. /dev/urandom might be less secure in some cases, but
* should still be more than sufficient. The use of /dev/random is
* discouraged, as reading from this device blocks when new random bits
* need to be gathered. */
#undef RANDOM_DEVICE
#undef R_DEFAULT
#undef R_RANDOM
#undef R_ARC4RANDOM
/*#define RANDOM_DEVICE "/dev/urandom"*/
/* Designate which database manager to use for cacheing.
* default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE
#define CACHEDIR "/var/cache/pdnsd"
#define TEMPDIR "/tmp";
/* This is for various debugging facilities that produce debug output and
* double-check some values. You can enable debug messages with the -g option.
* Normally, you can switch this off safely by setting the number after DEBUG
* to 0. This will increase speed (although only marginally), save space
* in the executable (only about 12kB) and some stack space per thread
* (which may be significant if you have many threads running simultaneously).
* However, it may be an aid when debugging config files.
* The only defined debug levels by now are in the range 0 - 9.
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
* When in doubt, leave it defined to 1. */
#define DEBUG 1
/* This defines the default verbosity of informational messages you will get.
This has nothing to to with the debug option (-g), but may be set with -v
option. 0 is for normal operation, up to 3 for debugging.
Unlike the debug messages, these messages will also be written to the syslog.*/
#define VERBOSITY 0
/* Redefine this if you want another hash size.
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
* you are nuts.) */
#define HASH_SZ 10
/* Set this to debug the hash tables. Turn this off normally, or you will get
* flooded with diagnostic messages */
#undef DEBUG_HASH
/* Define if you have working C99 Variadic macro support */
#undef CPP_C99_VARIADIC_MACROS
/* Define as int if socklen_t typedef is missing */
#undef socklen_t
/* Lock the UDP socket before using it? */
#undef SOCKET_LOCKING
/* Default TCP timeout when receiving queries */
#define TCP_TIMEOUT 30
/* Allow subsequent TCP queries on one connection? */
#undef TCP_SUBSEQ
/* Default value for parallel query number */
#define PAR_QUERIES 2
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
#define MAXNAMESERVIPS 3
/* These are the possible targets. Normally no need to touch these
* definitions. */
#define TARGET_LINUX 0
#define TARGET_BSD 1
#define TARGET_CYGWIN 2
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
#undef THREADLIB_NPTL
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
#undef THREADLIB_LINUXTHREADS2
/* The following is needed for using LinuxThreads. Better don't touch. */
#define _REENTRANT 1
#define _THREAD_SAFE 1
/* It appears the newer versions of gcc won't convert a pointer to char into
a pointer to unsigned char and vice versa without complaining.
By using casts these warning messages can be suppressed, but at the cost
of losing some type safety.
Define charp and ucharp to be empty if you are a developer and find type
safety more important.
Leave the definitions unchanged to avoid distracting warning messages. */
#define charp (char *)
#define ucharp (unsigned char *)
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
* contents of ./version */
#define VERSION "@VERSION@"
#endif
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `getline' function. */
#undef HAVE_GETLINE
/* Define to 1 if you have the `getpwnam_r' function. */
#undef HAVE_GETPWNAM_R
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `inet_ntop' function. */
#undef HAVE_INET_NTOP
/* Define to 1 if you have the `inet_pton' function. */
#undef HAVE_INET_PTON
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mempcpy' function. */
#undef HAVE_MEMPCPY
/* Define to 1 if you have the `mkfifo' function. */
#undef HAVE_MKFIFO
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if the system has the type `socklen_t'. */
#undef HAVE_SOCKLEN_T
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `stpcpy' function. */
#undef HAVE_STPCPY
/* Define to 1 if you have the `stpncpy' function. */
#undef HAVE_STPNCPY
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if the system has the type `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ
/* Define to 1 if the system has the type `struct in6_addr'. */
#undef HAVE_STRUCT_IN6_ADDR
/* Define to 1 if the system has the type `struct in_pktinfo'. */
#undef HAVE_STRUCT_IN_PKTINFO
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

11389
jni/pdnsd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,548 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src)
package="pdnsd"
version=`cut -d - -f 1 "$srcdir"/version`
fullversion=`cat "$srcdir"/version`
packagerelease=`cut -d - -f 2- "$srcdir"/version`
distribution="Generic"
target="autodetect"
cachedir="/var/cache/$package"
ipv4_default=1
have_ipv4="yes"
#newrrs="yes"
query_m="udponly"
have_tcp_server="yes"
adisc="default"
slock="no";
def_id="nobody"
#have_rcsids="no"
udp_queries="yes"
tcp_queries="yes"
tempdir="/tmp"
randomdev=default
freebsd_pthread="4"
specbuild=no
threadlib=default
AM_INIT_AUTOMAKE($package, $version, [no-define])
AM_CONFIG_HEADER(config.h)
AC_GNU_SOURCE
AC_DEFINE_UNQUOTED(VERSION,"$fullversion")
AC_SUBST(fullversion)
AC_SUBST(packagerelease)
AC_ARG_WITH(distribution,
[ --with-distribution=distro Specify target distribution (default=Generic;
others: RedHat, SuSE, Debian, ArchLinux)],
distribution=$withval)
AC_SUBST(distribution)
AC_ARG_WITH(target,
[ --with-target=platform Change compilation target platform (default:
autodetect; others: Linux, BSD, Cygwin)],
target=$withval)
case $target in
Linux|linux)
AC_DEFINE(TARGET, TARGET_LINUX)
target="Linux"
;;
BSD| bsd)
AC_DEFINE(TARGET, TARGET_BSD)
target="BSD"
;;
Cygwin|CYGWIN|cygwin)
AC_DEFINE(TARGET, TARGET_CYGWIN)
target="cygwin"
;;
autodetect)
;;
*)
AC_MSG_ERROR([--with-target must have Linux, BSD or Cygwin as parameter.])
;;
esac
AC_ARG_WITH(cachedir,
[ --with-cachedir=dir Default directory for pdnsd cache
(default=/var/cache/pdnsd)],
cachedir=$withval)
AC_DEFINE_UNQUOTED(CACHEDIR, "$cachedir")
AC_SUBST(cachedir)
AC_ARG_ENABLE(isdn,
[ --enable-isdn Enable ISDN support (may cause problems on
some systems; only for Linux)],
test $enableval = "yes" && AC_DEFINE(ISDN_SUPPORT))
AC_ARG_ENABLE(ipv4,
[ --disable-ipv4 Disable IPv4 networking support
(default=enabled)],
have_ipv4=$enableval)
test $have_ipv4 = "yes" && AC_DEFINE(ENABLE_IPV4)
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable IPv6 networking support],
[ if test $enableval = "yes" ; then
AC_DEFINE(ENABLE_IPV6)
if test $have_ipv4 != "yes" ; then
ipv4_default=0
fi
fi])
AC_ARG_ENABLE(ipv4-startup,
[ --disable-ipv4-startup Disable IPv4 on pdnsd startup by default
(default=enabled)],
[ if test $enableval = "yes" ; then
ipv4_default=1
else
ipv4_default=0
fi])
AC_ARG_ENABLE(ipv6-startup,
[ --enable-ipv6-startup Enable IPV6 on pdnsd startup by default
(default=IPv4)],
[ if test $enableval = "yes" ; then
ipv4_default=0
else
ipv4_default=1
fi])
AC_DEFINE_UNQUOTED(DEFAULT_IPV4, $ipv4_default)
AC_ARG_ENABLE(udp-queries,
[ --disable-udp-queries Disable udp as query method.],
udp_queries=$enableval)
AC_ARG_ENABLE(tcp-queries,
[ --disable-tcp-queries Disable tcp as query method.],
tcp_queries=$enableval)
AC_ARG_WITH(query-method,
[ --with-query-method=qm Specify the query method (default=udponly;
others: tcponly, tcpudp, udptcp)],
query_m=$withval)
case $query_m in
udponly|UDPonly)
AC_DEFINE(M_PRESET, UDP_ONLY)
udp_queries=yes;
;;
tcponly|TCPonly)
AC_DEFINE(M_PRESET, TCP_ONLY)
tcp_queries=yes;
;;
tcpudp|TCPUDP)
AC_DEFINE(M_PRESET, TCP_UDP)
udp_queries=yes;
tcp_queries=yes;
;;
udptcp|UDPTCP)
AC_DEFINE(M_PRESET, UDP_TCP)
udp_queries=yes;
tcp_queries=yes;
;;
*)
AC_MSG_ERROR([--with-query-method must have udponly, tcponly, tcpudp or udptcp as parameter.])
;;
esac
test $udp_queries != "yes" && AC_DEFINE(NO_UDP_QUERIES)
test $tcp_queries != "yes" && AC_DEFINE(NO_TCP_QUERIES)
AC_ARG_ENABLE(tcp-server,
[ --disable-tcp-server Disable the TCP serving ability of pdnsd],
have_tcp_server=$enableval)
test $have_tcp_server != "yes" && AC_DEFINE(NO_TCP_SERVER)
AC_ARG_ENABLE(src-addr-disc,
[ --disable-src-addr-disc Disable the UDP source address discovery],
adisc=$enableval)
AC_ARG_ENABLE(socket-locking,
[ --enable-socket-locking Enable the UDP socket locking],
slock=$enableval)
test $slock = "yes" && AC_DEFINE(SOCKET_LOCKING)
AC_ARG_ENABLE(poll,
[ --disable-poll Disable poll(2) and use select(2)
(default=enabled)],
test $enableval != "yes" && AC_DEFINE(NO_POLL))
AC_ARG_ENABLE(new-rrs,
[ --disable-new-rrs Disable new DNS RR types (obsolete, currently ignored)],
newrrs=$enableval)
AC_ARG_ENABLE(strict-rfc2181,
[ --enable-strict-rfc2181 Enforce strict RFC 2181 compliance],
test $enableval = "yes" && AC_DEFINE(RFC2181_ME_HARDER))
AC_ARG_WITH(random-device,
[ --with-random-device=device Specify random device other than
/dev/random; default: C Library random() PRNG;
special value arc4random for BSD C Library
arc4random function (default on FreeBSD)],
randomdev=$withval)
if test "$randomdev" = arc4random ; then
AC_DEFINE(R_ARC4RANDOM)
elif test "$randomdev" = random ; then
AC_DEFINE(R_RANDOM)
elif test "$randomdev" = default ; then
AC_DEFINE(R_DEFAULT)
else
AC_DEFINE_UNQUOTED(RANDOM_DEVICE, "$randomdev")
fi
AC_ARG_ENABLE(underscores,
[ --enable-underscores Allow _ in domain names (obsolete, currently ignored)],
underscores=$enableval)
AC_ARG_WITH(default-id,
[ --with-default-id=id Specify default uid/gid for pdnsd
(default=nobody)],
def_id=$withval)
AC_SUBST(def_id)
AC_ARG_WITH(debug,
[ --with-debug=level Specify debugging level (0 means no debug support)],
AC_DEFINE_UNQUOTED(DEBUG, $withval))
AC_ARG_WITH(verbosity,
[ --with-verbosity=level Specify default message verbosity],
AC_DEFINE_UNQUOTED(VERBOSITY, $withval))
AC_ARG_WITH(hash-buckets,
[ --with-hash-buckets=num Number of hash buckets to use (default=1024).
The number actually used is the smallest power of two
greater or equal to the number specified here.],
powof2=1
hashsz=0
while test $powof2 -lt "$withval"
do
powof2=`expr 2 '*' $powof2`
hashsz=`expr $hashsz '+' 1`
done
AC_DEFINE_UNQUOTED(HASH_SZ, $hashsz)
)
AC_ARG_ENABLE(hash-debug,
[ --enable-hash-debug Debug hash tables (warning: massive output)],
test $enableval = "yes" && AC_DEFINE(DEBUG_HASH))
AC_ARG_ENABLE(rcsids,
[ --enable-rcsids Enable RCS IDs in executables (obsolete, currently ignored)],
have_rcsids=$enableval)
AC_ARG_WITH(tcp-qtimeout,
[ --with-tcp-qtimeout=secs Specify default tcp query timeout (default=30)],
AC_DEFINE_UNQUOTED(TCP_TIMEOUT, $withval))
AC_ARG_ENABLE(tcp-subseq,
[ --enable-tcp-subseq Enable multiple dns querys using one
tcp connection],
test $enableval = "yes" && AC_DEFINE(TCP_SUBSEQ))
AC_ARG_WITH(par-queries,
[ --with-par-queries=num Specify default parallel query number (default=2)],
AC_DEFINE_UNQUOTED(PAR_QUERIES, $withval))
AC_ARG_WITH(max-nameserver-ips,
[ --with-max-nameserver-ips=num Specify maximum number of IP addresses used per nameserver obtained from NS records (default=3)],
AC_DEFINE_UNQUOTED(MAXNAMESERVIPS, $withval))
AC_ARG_ENABLE(specbuild,
[ --enable-specbuild Only used when building pdnsd from spec files],
specbuild=$enableval)
AC_SUBST(specbuild)
AC_ARG_WITH(thread-lib,
[ --with-thread-lib=lib Specify thread library, overriding automatic detection (for Linux only).
Possible values: LinuxThreads,
LinuxThreads2 (implements a fix for newer glibcs)
or NPTL (Native POSIX Thread Library)],
threadlib=$withval)
AC_SUBST(threadlib)
dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_INSTALL
dnl For dbm subsystem libraries
AC_PROG_RANLIB
if test "$target" = "autodetect" ; then
AC_MSG_CHECKING([for autodetect build target])
uname_sys=`uname`
if test $? -ne 0 ; then
AC_MSG_RESULT([failed])
AC_MSG_ERROR([uname failed or was not found in path])
else
case "${uname_sys}" in
Linux)
AC_MSG_RESULT(Linux)
AC_DEFINE(TARGET, TARGET_LINUX)
target="Linux"
;;
FreeBSD|NetBSD|OpenBSD|Darwin)
AC_MSG_RESULT("${uname_sys}")
AC_DEFINE(TARGET, TARGET_BSD)
target="BSD"
;;
CYGWIN*)
AC_MSG_RESULT("${uname_sys}")
AC_DEFINE(TARGET, TARGET_CYGWIN)
target="cygwin"
;;
*)
AC_MSG_RESULT([failed])
AC_MSG_ERROR(
[Your system type could not be identified. Try setting it manually using
--with-target])
;;
esac
fi
fi
#if test "$target" = BSD ; then
# uname_sys=`uname`
# if test "$uname_sys" = FreeBSD ; then
# AC_MSG_CHECKING([for FreeBSD version])
# osrel=`sysctl -n kern.osreldate`
# if test $osrel -ge 500016 ; then
# AC_MSG_RESULT([5.0 (>= 500016)])
# freebsd_pthread="5"
# else
# AC_MSG_RESULT([<=5.0 (< 500016)])
# freebsd_pthread="4"
# fi
# fi
#fi
if test "$adisc" = "default"; then
if test "$target" = "cygwin" ; then
# Don't do UDP source address discovery on Cygwin platform by default.
adisc="no"
else
adisc="yes"
fi
fi
test "$adisc" = "yes" && AC_DEFINE(SRC_ADDR_DISC)
dnl Checks for libraries.
if test "$target" = "Linux"; then
AC_MSG_CHECKING([if we can compile and link with -pthread])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -pthread"
AC_LINK_IFELSE([
#include <pthread.h>
void *thread_func(void *data)
{
*((int *)data)=1;
return data;
}
int main()
{
pthread_t thread;
void *retval;
int val;
if(pthread_create(&thread, NULL, thread_func, &val))
return 1;
if(pthread_join(thread,&retval))
return 1;
return (*((int *)retval)!=1);
}
],
gcc_pthread_flag="yes", gcc_pthread_flag="no")
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$gcc_pthread_flag])
if test "$gcc_pthread_flag" = yes ; then
thread_CFLAGS="-pthread"
AC_SUBST(thread_CFLAGS)
else
AC_CHECK_LIB(pthread, pthread_create)
fi
fi
if test "$target" = "BSD" -a `uname` != Darwin ; then
# if test $freebsd_pthread = 4 ; then
thread_CFLAGS="-pthread"
AC_SUBST(thread_CFLAGS)
# else
# AC_CHECK_LIB(c_r, pthread_create, ,
# AC_MSG_ERROR([You must have libc_r installed to build/run pdnsd!]))
# fi;
fi
if test "$target" = "Linux" -a "$threadlib" = default; then
AC_MSG_CHECKING([if this is an NPTL-based system])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $thread_CFLAGS"
AC_RUN_IFELSE([
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <pthread.h>
/* All this function does is return its PID (in a roundabout way). */
void *thread_func(void *data)
{
*((int *)data)=getpid();
return data;
}
int main()
{
pthread_t thread;
void *retval;
int err,mainpid,thrdpid;
err=pthread_create(&thread, NULL, thread_func, &thrdpid);
if(err) {
fprintf(stderr,"pthread_create failed: %s\n",strerror(err));
return 1;
}
err=pthread_join(thread,&retval);
if(err) {
fprintf(stderr,"pthread_join failed: %s\n",strerror(err));
return 1;
}
mainpid=getpid();
/* In LinuxThreads implementations, the pids of the threads will usually differ
in a non Posix-compliant way. */
fprintf(stderr,"main pid=%d, thread pid=%d\n",mainpid,*((int *)retval));
return (*((int *)retval)!=mainpid);
}
],
[
AC_MSG_RESULT([yes])
threadlib=nptl
],
[
AC_MSG_RESULT([no])
threadlib=linuxthreads
],
[
AC_MSG_RESULT([couldn't run test program])
threadlib=linuxthreads
])
CFLAGS="$old_CFLAGS"
fi
if test "$threadlib" = nptl -o "$threadlib" = NPTL; then
AC_DEFINE(THREADLIB_NPTL)
elif test "$threadlib" = linuxthreads2 -o "$threadlib" = LinuxThreads2 -o "$threadlib" = lt2; then
AC_DEFINE(THREADLIB_LINUXTHREADS2)
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h sys/time.h syslog.h unistd.h)
AC_CHECK_HEADERS(sys/types.h sys/socket.h net/if.h netinet/in.h sys/poll.h,,,
[#include <stdio.h>
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPES(socklen_t,, AC_DEFINE(socklen_t,int),[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>])
AC_CHECK_TYPES([struct in6_addr, struct in_pktinfo, struct ifreq],,,[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>])
AC_MSG_CHECKING([for CPP C99 Variadic macro support])
AC_COMPILE_IFELSE([
#define a(...) junk(0,__VA_ARGS__)
extern void junk(int i,...);
int main()
{
a(0);
a("a");
a(0, "a", 1);
return 0;
}
],
cpp_c99_variadic="yes", cpp_c99_variadic="no")
AC_MSG_RESULT([$cpp_c99_variadic])
if test $cpp_c99_variadic = yes; then
AC_DEFINE(CPP_C99_VARIADIC_MACROS)
else
if test "$GCC" != yes; then
AC_MSG_ERROR([Compiler must support C99 or gcc variadic macros])
fi;
fi
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_SEARCH_LIBS(nanosleep, rt)
AC_SEARCH_LIBS(socket, socket,,,-lnsl)
AC_SEARCH_LIBS(inet_aton, resolv)
AC_CHECK_FUNCS(nanosleep gettimeofday mkfifo select socket strerror uname snprintf vsnprintf, true,
AC_MSG_ERROR([One of the functions required for pdnsd were not found.]))
AC_CHECK_FUNCS(poll, true, AC_DEFINE(NO_POLL))
AC_CHECK_FUNCS(strdup strndup stpcpy stpncpy strlcpy mempcpy getline asprintf vasprintf getpwnam_r inet_ntop inet_pton)
AC_OUTPUT([
pdnsd.spec
Makefile
file-list.base
contrib/Makefile
doc/Makefile
doc/pdnsd.8
doc/pdnsd.conf.5
doc/pdnsd.conf
src/Makefile
src/pdnsd-ctl/Makefile
src/rc/Makefile
src/rc/RedHat/Makefile
src/rc/RedHat/pdnsd
src/rc/SuSE/Makefile
src/rc/SuSE/pdnsd
src/rc/Debian/Makefile
src/rc/Debian/pdnsd
src/rc/Slackware/Makefile
src/rc/Slackware/rc.pdnsd
src/rc/ArchLinux/Makefile
src/rc/ArchLinux/pdnsd
src/test/Makefile
PKGBUILD
])

View File

@ -1,2 +0,0 @@
EXTRA_DIST = pdnsd_dhcp.pl dhcp2pdnsd change_pdnsd_server_ip.pl README

View File

@ -1,323 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = contrib
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = pdnsd_dhcp.pl dhcp2pdnsd change_pdnsd_server_ip.pl README
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu contrib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,30 +0,0 @@
Last revised: 27 July 2003 by Paul Rombouts
This directory contains user-contributed scripts for use with pdnsd.
So far there are:
pdnsd_dhcp.pl, save_ram.pl
A perl script contributed by Marko Stolle (derived from a script by
Mike Stella) to watch a ISC DHCPD leases file and add local records for
the hosts listed there. This makes pdnsd useable in a DHCP setup.
Please look into the script for usage instructions (you will probably
also need to customize some settings there).
For details about save_ram.pl, please look into pdnsd_dhcp.pl
dhcp2pdnsd
A rc script for pdnsd, also by Marko Stolle. You might need to change
it slightly to make it run with your distro.
change_pdnsd_server_ip.pl
A perl script contributed by Paul Rombouts for automatically updating
the configuration file if the DNS server configuration has changed.
For instance, you could place the following line in the script
/sbin/ifup-local
/usr/local/sbin/change_pdnsd_server_ip.pl isplabel "$DNS" /etc/pdnsd.conf
where $DNS contains the IP addresses (in comma separated format) of the
DNS servers obtained by DHCP negotiation. The perl script only
overwrites /etc/pdnsd.conf if the DNS configuration has actually
changed, in which case the previous configuration file is saved as
/etc/pdnsd.conf.save

View File

@ -1,124 +0,0 @@
#!/usr/bin/perl -w
#
# A Perl script to change the ip addresses of dns servers
# in the pdnsd configuration file.
#
# Written by Paul A. Rombouts
#
# This file Copyright 2002, 2004 Paul A. Rombouts
# It may be distributed under the GNU Public License, version 2, or
# any higher version. See section COPYING of the GNU Public license
# for conditions under which this file may be redistributed.
#
use strict;
unless(@ARGV) {die "Error: no label specified.\n"}
my $label=shift;
unless(@ARGV) {die "Error: no DNS addresses specified.\n"}
my $dns_str=shift;
my $pdnsd_conf='/etc/pdnsd.conf';
if(@ARGV) {
$pdnsd_conf=shift;
if(@ARGV) {warn "Warning: spurious arguments ignored: @ARGV\n"}
}
#unless($label =~ /^\".*\"$/) {$label="\"$label\""}
#unless($dns_str =~ /^\".*\"$/) {$dns_str =~ s/^[\s,]*/\"/; $dns_str =~ s/[\s,]*$/\"/}
#unless($dns_str =~ /\"\s*\,\s*\"/) {$dns_str =~ s/[\s,]+/","/g}
my @lines=();
my $found_section=0;
my $changed=0;
my $ip_patt = qr/^((?:[^#]*?(?:\{|;))*?)(\s*ip\s*=\s*)("?[\w.:]+"?(?:\s*,\s*"?[\w.:]+"?)*)\s*;/;
open(CONFFILE,$pdnsd_conf) or die "Can't open $pdnsd_conf: $!\n";
while(<CONFFILE>) {
if(/^\s*server\s*\{/) {
my $sect_beg=$#lines+1;
my $sect_end;
my $found_label=0;
LOOP: {
do {
push @lines,$_;
if(/^(?:.*(?:\{|;))?\s*label\s*=\s*"?\Q$label\E"?\s*;/) {
if($found_label++) {
warn "Server section with multiple labels found.\n";
close(CONFFILE);
exit 2;
}
}
if(/\}\s*$/) {
$sect_end=$#lines;
last LOOP;
}
} while(<CONFFILE>);
}
unless(defined($sect_end)) {
warn "Server section without proper ending found.\n";
close(CONFFILE);
exit 2;
}
if(!$found_label) {next}
if(!($found_section++)) {
my $found_ip=0;
for(my $i=$sect_beg; $i<=$sect_end;++$i) {
if($lines[$i] =~ $ip_patt) {
my $matched=''; my $rest;
do {
$rest=$';
if(!($found_ip++)) {
if($3 eq $dns_str) {
$matched.=$&;
}
else {
$matched.="$1$2$dns_str;";
$changed=1;
}
}
else {
$matched.=$1;
$changed=1;
}
} while($rest =~ $ip_patt);
$lines[$i] = $matched.$rest;
}
}
if(!$found_ip) {
unless($lines[$sect_end] =~ s/\}\s*$/ ip=$dns_str;\n$&/) {
warn "Can't add ip specification to server section labeled $label.\n";
close(CONFFILE);
exit 2;
}
$changed=1;
}
}
else {
splice @lines,$sect_beg;
$changed=1;
}
}
else {push @lines,$_}
}
close(CONFFILE) or die "Can't close $pdnsd_conf: $!\n";
if(!$found_section) {
warn "No server sections labeled $label found.\n";
exit 2;
}
elsif(!$changed) {
exit 0;
}
rename($pdnsd_conf,"$pdnsd_conf.save") or die "Can't rename $pdnsd_conf: $!\n";
unless((open(CONFFILE,">$pdnsd_conf") or (warn("Can't open $pdnsd_conf for writing: $!\n"),0)) and
(print CONFFILE (@lines) or (warn("Can't write to $pdnsd_conf: $!\n"),0)) and
(close(CONFFILE) or (warn("Can't close $pdnsd_conf after writing: $!\n"),0))) {
rename("$pdnsd_conf.save",$pdnsd_conf) or die "Can't rename $pdnsd_conf.save: $!\n";
exit 3;
}
exit 1;

View File

@ -1,45 +0,0 @@
#! /bin/sh
#
# dhcp2pdnsd Start/Stop DHCP to DNS update script
#
# chkconfig: 345 96 99
# description: DHCP to DNS update script
# processname: dhcp2pdnsd.pl
#
# $Id: dhcp2pdnsd,v 1.1 2001/03/25 20:01:34 tmm Exp $
where="/usr/local/bin/"
name="pdnsd_dhcp.pl"
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# See how we were called.
case "$1" in
start)
$where$name > /dev/null 2> /dev/null &
action "Starting DHCP to DNS update script: " /bin/true
;;
stop)
p=`ps h -C $name | awk '{print $1}'`
[ $p -gt 0 ] 2> /dev/null && kill $p && action "Stopping DHCP to DNS update script: " /bin/true
[ $p -gt 0 ] 2> /dev/null || action "Stopping DHCP to DNS update script: " /bin/false
;;
status)
p=`ps h -C $name | awk '{print $1}'`
[ $p -gt 0 ] 2> /dev/null && echo 'running as '$p
[ $p -gt 0 ] 2> /dev/null || echo 'not running'
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "Usage: dhcp2pdnsd {start|stop|status|restart|reload}"
exit 1
esac
exit 0

View File

@ -1,246 +0,0 @@
#!/usr/bin/perl
# $Id: pdnsd_dhcp.pl,v 1.2 2001/03/25 20:01:34 tmm Exp $
##########################################################################
#
# Filename: pdnsd_dhcp.pl
# Description: Dynamic DNS-DHCP update script for pdnsd
# Author: Mike Stella
# Modified by: Marko Stolle
# Created: November 19, 2001
# Last Updated: February 28, 2001
# Email: fwd2m@gmx.de
#
###########################################################################
#
# This code is Copyright (c) 1998-2001 by Mike Stella and Marko Stolle
#
# NO WARRANTY is given for this program. If it doesn't
# work on your system, sorry. If it eats your hard drive,
# again, sorry. It works fine on mine. Good luck!
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
###########################################################################
#
# This script reads a dhcpd.leases file and dynamically updates pdnsd with
# hostname and ip information.
#
# It assumes that your DHCP server recieves hostnames from the
# clients, and that your clients offer their hostnames to the server.
# Some versions of Linux DHCP clients don't do that. I use ISC's
# DHCPD, found at http://www.isc.org - though others may work just
# fine.
#
# This version of the script updates the pdnsd database. The status
# control socket of pdnsd has to be enabled (psnsd -d -s).
#
###########################################################################
#
# 02/20/2001 - first working version
# 02/21/2001 - security patches by Thomas Moestl
# 02/22/2001 - re-read dhcpd.leases if ttl has expireds since last update
# 02/24/2001 - try to get domainname if not specified
# 02/28/2001 - randomized temporary filename
# added possibility to save some RAM (read below)
#
###########################################################################
# You may save some memory if you use absolute values with sysopen
# in sub update_dns and don't use tmpnam()..
# Just switch the '#' in front of the 'until sysopen' in the sub
# update_dns, check the necessary modes on your system using save_ram.pl
# and add a '#' in front of the following three lines.
# Not using the tmpnam() function may open a security breach on systems
# with not absolute trustworthy local users (Risk: a user may write a
# script which creates files with the same names as this script and block
# it that way. Unlikely because the filenames are now even without tmpnam()
# randomized and an attacker has to create a very large number of files.)
use Fcntl;
use strict;
use POSIX qw(tmpnam);
$|=1;
###########################################################################
### Globals - you can change these as needed
# Domain name
# if not changed script will try to get it from the system
my $domain_name = "domain";
# DHCPD lease file
my $lease_file = "/var/lib/dhcp/dhcpd.leases";
# path to pdnsd-ctl
my $pdnsd_ctl = "/usr/local/sbin/pdnsd-ctl";
# owning name server for the newly added records
my $nameserver = "localhost.";
# TTL (Time To Live) for the new records
my $ttl = "86400";
# number of seconds to check the lease file for updates
my $update_freq = 30;
my $debug = 0;
###########################################################################
### Don't mess with anything below unless you REALLY need to modify the
### code. And if you do, please let me know, I'm always interested in
### in improving this program.
# Make a pid file
`echo $$ > /var/run/pdnsd_update.pid`;
my $logstr;
my $modtime = 0;
my $temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
use vars qw (%db);
my $version = "1.03";
###########################################################################
# Main Loop
# try to find domainname if necessary
if ($domain_name eq "domain") {
$domain_name = `dnsdomainname`;
}
else {
$domain_name = "$domain_name\n";
}
while (1) {
# check the file's last updated time, if it's been changed, update
# the DNS and save the time. Update DNS even if there a no changes on
# the leases file if ttl since last DNS update has expired.
# This will ALWAYS run once - on startup, since $modtime starts at zero.
my @stats = stat ($lease_file);
if (($stats[9] > $modtime) or (time >= $modtime+$ttl)){
# clear the old hash
undef %db;
printf STDERR "updating DNS with dhcpd.leases\n";
$modtime = time;
&read_lease_file;
&update_dns;
}
# wait till next check time
sleep $update_freq;
} # end main
###########################################################################
### write out the import file
sub update_dns {
my ($ip, $hostname, $fname);
do { $fname = tmpnam() }
until sysopen(DNSFILE, $fname, O_WRONLY|O_CREAT|O_EXCL, 0600);
# do { $fname = "$temp_dir/d2d".int(rand(time())) }
# until sysopen(DNSFILE, $fname, 1|64|128, 0600);
while (($hostname,$ip) = each (%db)) {
print DNSFILE "$ip $hostname.$domain_name";
}
close DNSFILE;
system ("$pdnsd_ctl source $fname $nameserver $ttl");
unlink($fname);
}
### reads the lease file & makes a hash of what's in there.
sub read_lease_file {
unless (open(LEASEFILE,$lease_file)) {
#`logger -t dns_update.pl error opening dhcpd lease file`;
print STDERR "Can't open lease file\n";
return;
}
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $curdate = sprintf "%02d%02d%02d%02d%02d%20d%20d",
($year+1900),($mon+1),$mday,$hour,$min,$sec;
## Loop here, reading from LEASEFILE
while (<LEASEFILE>) {
my ($ip, $hostname, $mac, $enddate,$endtime);
if (/^\s*lease/i) {
# find ip address
$_ =~ /^\s*lease\s+(\S+)/;
$ip = $1;
# do the rest of the block - we're interested in hostname,
# mac address, and the lease time
while ($_ !~ /^}/) {
$_ = <LEASEFILE>;
# find hostname
if ($_ =~ /^\s*client/i) {
#chomp $_;
#chop $_;
$_ =~ /\"(.*)\"/;
$hostname = $1;
# change spaces to dash, remove dots - microsoft
# really needs to not do this crap
$hostname =~ s/\s+/-/g;
$hostname =~ s/\.//g;
}
# get the lease end date
elsif ($_ =~ /^\s*ends/i) {
$_ =~ m/^\s*ends\s+\d\s+([^;]+);/;
$enddate = $1;
$enddate =~ s|[/: ]||g;
}
}
# lowercase it - stupid dhcp clients
$hostname =~ tr/[A-Z]/[a-z]/;
($debug < 1 ) || print STDERR "$hostname $ip $enddate $curdate\n";
# Store hostname/ip in hash - this way we can do easy dupe checking
if (($hostname ne "") and ($enddate > $curdate)) {
$db{$hostname} = $ip;
}
}
}
close LEASEFILE;
}
### left around for testing
sub print_db {
my ($key,$value);
while (($key,$value) = each (%db)) {
print "$key - $value\n";
}
}

View File

@ -1,530 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,28 +0,0 @@
man_MANS = pdnsd.8 pdnsd-ctl.8 pdnsd.conf.5
# Note: pdnsd-ctl.8, pdnsd.conf.5.in, dl.html and the txt docs are handled by dist-hook rule.
EXTRA_DIST = pdnsd.conf.in pdnsd.8.in \
html/dl.html.in html/doc.html html/faq.html html/index.html \
doc_makefile html/doc_makefile txt/doc_makefile \
html2confman.pl html/htmlsubst.pl
# XXX: Do not insist to set the config file owner to root to avoid breaking RPM
# builds
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(sysconfdir)"
if test `whoami` = "root"; then \
$(INSTALL) -o 0 -g 0 -m 644 pdnsd.conf "$(DESTDIR)$(sysconfdir)/pdnsd.conf.sample" ; \
else \
$(INSTALL) -m 644 pdnsd.conf "$(DESTDIR)$(sysconfdir)/pdnsd.conf.sample" ; \
fi
dist-hook: doc_makefile
@$(MAKE) -f doc_makefile doc
cp -p --parents pdnsd-ctl.8 pdnsd.conf.5.in \
html/dl.html txt/faq.txt txt/intro.txt txt/manual.txt \
$(distdir)
distclean-local: doc_makefile
@$(MAKE) -f doc_makefile clean

View File

@ -1,483 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/pdnsd.8.in $(srcdir)/pdnsd.conf.5.in \
$(srcdir)/pdnsd.conf.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = pdnsd.8 pdnsd.conf.5 pdnsd.conf
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
man5dir = $(mandir)/man5
am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
man_MANS = pdnsd.8 pdnsd-ctl.8 pdnsd.conf.5
# Note: pdnsd-ctl.8, pdnsd.conf.5.in, dl.html and the txt docs are handled by dist-hook rule.
EXTRA_DIST = pdnsd.conf.in pdnsd.8.in \
html/dl.html.in html/doc.html html/faq.html html/index.html \
doc_makefile html/doc_makefile txt/doc_makefile \
html2confman.pl html/htmlsubst.pl
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
pdnsd.8: $(top_builddir)/config.status $(srcdir)/pdnsd.8.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
pdnsd.conf.5: $(top_builddir)/config.status $(srcdir)/pdnsd.conf.5.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
pdnsd.conf: $(top_builddir)/config.status $(srcdir)/pdnsd.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-man5: $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
@list=''; test -n "$(man5dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.5[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
done; }
uninstall-man5:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man5dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.5[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
install-man8: $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@list=''; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.8[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
done; }
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-local
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man5 install-man8
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man5 uninstall-man8
.MAKE: install-am install-data-am install-strip
.PHONY: all all-am check check-am clean clean-generic dist-hook \
distclean distclean-generic distclean-local distdir dvi dvi-am \
html html-am info info-am install install-am install-data \
install-data-am install-data-hook install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-man5 \
install-man8 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-man uninstall-man5 uninstall-man8
# XXX: Do not insist to set the config file owner to root to avoid breaking RPM
# builds
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(sysconfdir)"
if test `whoami` = "root"; then \
$(INSTALL) -o 0 -g 0 -m 644 pdnsd.conf "$(DESTDIR)$(sysconfdir)/pdnsd.conf.sample" ; \
else \
$(INSTALL) -m 644 pdnsd.conf "$(DESTDIR)$(sysconfdir)/pdnsd.conf.sample" ; \
fi
dist-hook: doc_makefile
@$(MAKE) -f doc_makefile doc
cp -p --parents pdnsd-ctl.8 pdnsd.conf.5.in \
html/dl.html txt/faq.txt txt/intro.txt txt/manual.txt \
$(distdir)
distclean-local: doc_makefile
@$(MAKE) -f doc_makefile clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,38 +0,0 @@
# This file was written by Paul Rombouts.
# Because pdnsd currently has a very idiosyncratic method of building documentation
# I prefer to keep the actual build rules outside of the Makefiles an ordinary user
# would use to compile pdnsd and therefore I have put them into separate 'doc_makefile's.
#
# To rebuild pdnsd docs after you have modified something that other files depend on,
# run 'make -f doc_makefile doc' in the doc/ directory.
# This makefile is also invoked when you build a pdnsd distribution tarball
# using 'make dist' in the toplevel pdnsd source directory.
#
# If anyone thinks there is a much more elegant method for building the pdnsd docs
# using a conventional autoconf/automake process, please let me know.
versionfile = ../version
doc: pdnsd-ctl.8 pdnsd.conf.5.in html txt
.PHONY: pdnsd-ctl.8 doc html txt clean
pdnsd-ctl.8:
@pver=`cat $(versionfile)` && \
mver=`perl -e 'while(<>) {if(/^\s*\.TH(?:\s+(?:"[^"]*"|[^"\s]+)){3}\s+"pdnsd\s+([^"]*)"/) {print "$$1\n";exit 0}} \
die "Cannot find version in $$ARGV\n"' $@` && { \
test "$$mver" = "$$pver" || { \
perl -p -i.makesave -e 's/^(\s*\.TH(?:\s+(?:"[^"]*"|[^"\s]+)){3}\s+"pdnsd\s+)[^"]*(")/$${1}'"$$pver"'$${2}/' $@ && \
echo "Updated version in $@: $$mver -> $$pver"; \
}; \
}
pdnsd.conf.5.in: html/doc.html html2confman.pl
perl html2confman.pl $< > $@
html txt:
@cd $@ && $(MAKE) -f doc_makefile
clean:
@rm -fv pdnsd.conf.5.in
@cd html && $(MAKE) -f doc_makefile clean
@cd txt && $(MAKE) -f doc_makefile clean

View File

@ -1,96 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>pdnsd Download Page</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
.small { font-family:helvetica; font-size:small; text-align:center; }
// -->
</style>
</head>
<!--notext(-->
<body bgcolor="#EEEEEE">
<table width="100%">
<tr>
<td> <span class="small">
<a href="index.html">pdnsd Homepage</a>
</span></td>
<td> <span class="small">
<a href="faq.html">pdnsd FAQ</a>
</span></td>
<td> <span class="small">
<a href="doc.html">Documentation</a>
</span></td>
<td> <span class="small">
<a href="../../COPYING">GNU GPL (pdnsd's License)</a>
</span> </td>
<td><span class="small">
<a href="dl.html">Download Section</a>
</span></td>
</tr>
</table>
<!--)notext-->
<center><h1>pdnsd Download Page</h1></center>
<!-- For obvious reasons, the real download page is not included in the distribution ;-) -->
<p>The original author of pdnsd is <a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>,
but since 2003, he no longer maintains pdnsd.
However, <a href="mailto:p.a.rombouts@home.nl">Paul A. Rombouts</a> has extensively revised the code and maintains
a version with many fixes and improvements at
<a href="http://members.home.nl/p.a.rombouts/pdnsd.html">http://members.home.nl/p.a.rombouts/pdnsd.html</a>.<br>
He has pre-patched tarballs and RPM packages available for download at this site.<br>
</p>
<p>
If you are interested in the very latest code or if you want to participate in
pdnsd development, checkout the <a href="http://gitorious.org/pdnsd/pdnsd">pdnsd git repository</a>
at <a href="http://gitorious.org/">gitorious.org</a>.
</p>
The most recent tarball is <a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9b-par.tar.gz">pdnsd-1.2.9b-par.tar.gz</a>
(<a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9b-par.tar.gz.asc">GPG signature</a>).<br>
The most recent RPM packages are:
<table cellspacing=1 cellpadding=7>
<tr>
<td width="30%"><b>Package Name</b></td>
<td width="10%" align=right><b>Size</b></td>
<td width="60%"><b>Description</b></td>
</tr>
<tr>
<td width="30%"><a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9b-par.src.rpm">pdnsd-1.2.9b-par.src.rpm</a></td>
<td width="10%" align=right>514kB</td>
<td width="60%">Source RPM (binary packages can also be built directly from the tarball).
</td>
</tr>
<tr>
<td width="30%"><a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9b-par_sl6.i686.rpm">pdnsd-1.2.9b-par_sl6.i686.rpm</a></td>
<td width="10%" align=right>???</td>
<td width="60%">i686 binary built on a Scientific Linux 6.2 system.
</td>
</tr>
<tr>
<td width="30%"><a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9b-par_sl6.x86_64.rpm">pdnsd-1.2.9b-par_sl6.x86_64.rpm</a></td>
<td width="10%" align=right>282kB</td>
<td width="60%">x86_64 binary built on a Scientific Linux 6.2 system.
</td>
</tr>
</table>
If you want to check the signatures on these packages you will need a copy of my GPG key
which you can get <a href="http://members.home.nl/p.a.rombouts/paromb.asc">here</a>
or from a public key server.
<p>
There are also <a href="http://packages.debian.org/pdnsd">Debian</a>,
Ubuntu,
<a href="http://packages.gentoo.org/package/net-dns/pdnsd">Gentoo</a>,
<a href="http://www.rpmfind.net/linux/rpm2html/search.php?query=pdnsd">Mandriva</a>
and <a href="http://cvsweb.freebsd.org/ports/dns/pdnsd">FreeBSD</a>
packages, but these may not include the latest version.<br>
If you are looking for other versions released by Paul Rombouts, visit this
<a href="http://members.home.nl/p.a.rombouts/pdnsd/releases/">download directory</a>.
</p>
<hr>
<br>
<p>
<i>Last revised: 24 Apr 2012 by Paul A. Rombouts</i>
</p>
</body>
</html>

View File

@ -1,96 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>pdnsd Download Page</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
.small { font-family:helvetica; font-size:small; text-align:center; }
// -->
</style>
</head>
<!--notext(-->
<body bgcolor="#EEEEEE">
<table width="100%">
<tr>
<td> <span class="small">
<a href="index.html">pdnsd Homepage</a>
</span></td>
<td> <span class="small">
<a href="faq.html">pdnsd FAQ</a>
</span></td>
<td> <span class="small">
<a href="doc.html">Documentation</a>
</span></td>
<td> <span class="small">
<a href="../../COPYING">GNU GPL (pdnsd's License)</a>
</span> </td>
<td><span class="small">
<a href="dl.html">Download Section</a>
</span></td>
</tr>
</table>
<!--)notext-->
<center><h1>pdnsd Download Page</h1></center>
<!-- For obvious reasons, the real download page is not included in the distribution ;-) -->
<p>The original author of pdnsd is <a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>,
but since 2003, he no longer maintains pdnsd.
However, <a href="mailto:p.a.rombouts@home.nl">Paul A. Rombouts</a> has extensively revised the code and maintains
a version with many fixes and improvements at
<a href="http://members.home.nl/p.a.rombouts/pdnsd.html">http://members.home.nl/p.a.rombouts/pdnsd.html</a>.<br>
He has pre-patched tarballs and RPM packages available for download at this site.<br>
</p>
<p>
If you are interested in the very latest code or if you want to participate in
pdnsd development, checkout the <a href="http://gitorious.org/pdnsd/pdnsd">pdnsd git repository</a>
at <a href="http://gitorious.org/">gitorious.org</a>.
</p>
The most recent tarball is <a href="${baseurl}releases/pdnsd-$version.tar.gz">pdnsd-$version.tar.gz</a>
(<a href="${baseurl}releases/pdnsd-$version.tar.gz.asc">GPG signature</a>).<br>
The most recent RPM packages are:
<table cellspacing=1 cellpadding=7>
<tr>
<td width="30%"><b>Package Name</b></td>
<td width="10%" align=right><b>Size</b></td>
<td width="60%"><b>Description</b></td>
</tr>
<tr>
<td width="30%"><a href="${baseurl}releases/pdnsd-$version.src.rpm">pdnsd-$version.src.rpm</a></td>
<td width="10%" align=right>$sizeof("$HOME/rpmbuild/SRPMS/pdnsd-$version.src.rpm")</td>
<td width="60%">Source RPM (binary packages can also be built directly from the tarball).
</td>
</tr>
<tr>
<td width="30%"><a href="${baseurl}releases/pdnsd-${version}${extver}.${arch}.rpm">pdnsd-${version}${extver}.${arch}.rpm</a></td>
<td width="10%" align=right>$sizeof("$HOME/rpmbuild/RPMS/pdnsd-${version}${extver}.${arch}.rpm")</td>
<td width="60%">${arch} binary built on a $system.
</td>
</tr>
<tr>
<td width="30%"><a href="${baseurl}releases/pdnsd-${version}${extver}.${arch2}.rpm">pdnsd-${version}${extver}.${arch2}.rpm</a></td>
<td width="10%" align=right>$sizeof("$HOME/rpmbuild/RPMS/pdnsd-${version}${extver}.${arch2}.rpm")</td>
<td width="60%">${arch2} binary built on a $system.
</td>
</tr>
</table>
If you want to check the signatures on these packages you will need a copy of my GPG key
which you can get <a href="http://members.home.nl/p.a.rombouts/paromb.asc">here</a>
or from a public key server.
<p>
There are also <a href="http://packages.debian.org/pdnsd">Debian</a>,
Ubuntu,
<a href="http://packages.gentoo.org/package/net-dns/pdnsd">Gentoo</a>,
<a href="http://www.rpmfind.net/linux/rpm2html/search.php?query=pdnsd">Mandriva</a>
and <a href="http://cvsweb.freebsd.org/ports/dns/pdnsd">FreeBSD</a>
packages, but these may not include the latest version.<br>
If you are looking for other versions released by Paul Rombouts, visit this
<a href="${baseurl}releases/">download directory</a>.
</p>
<hr>
<br>
<p>
<i>Last revised: $date by Paul A. Rombouts</i>
</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
versionfile = ../../version
arch = i686
arch2 = x86_64
extver = _sl6
system = Scientific Linux 6.2 system
doc: dl.html
.PHONY: doc clean
# If the existing dl.html contains '???', then certain packages were missing
# during the previous build and dl.html needs to be built again.
ifneq ($(shell grep -F -l -e '???' dl.html),)
.PHONY: dl.html
endif
dl.html: %.html: %.html.in htmlsubst.pl $(versionfile)
perl htmlsubst.pl version=`cat $(versionfile)` \
baseurl='http://members.home.nl/p.a.rombouts/pdnsd/' \
arch=$(arch) arch2=$(arch2) extver=$(extver) system="$(system)" $< > $@
clean:
@rm -fv dl.html

View File

@ -1,412 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>The pdnsd FAQ</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
.small { font-family:helvetica; font-size:small; text-align:center; }
// -->
</style>
</head>
<body bgcolor="#EEEEEE">
<!--notext(-->
<table width="100%">
<tr>
<td> <span class="small">
<a href="index.html">pdnsd Homepage</a>
</span></td>
<td> <span class="small">
<a href="faq.html">pdnsd FAQ</a>
</span></td>
<td> <span class="small">
<a href="doc.html">Documentation</a>
</span></td>
<td> <span class="small">
<a href="../../COPYING">GNU GPL (pdnsd's License)</a>
</span> </td>
<td><span class="small">
<a href="dl.html">Download Section</a>
</span></td>
</tr>
</table>
<!--)notext-->
<h1>The pdnsd FAQ</h1>
<a name="q001"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
There are complete and well-tested name servers around, such as the BIND.
These do also perform caching. Why should I use pdnsd?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
pdnsd does not aim to be a complete name server implementation, such as the
BIND. It is optimized for caching, and you can only specify a small subset of all
dns record types pdnsd knows in your local &quot;zone&quot; definitions.
This of course reduces the code size drastically, and such the memory footprint.
There are some features especially interesting for dialin networks, ordinary
(non-server) internet hosts and computers that are often not connected to
to their network, e.g. notebooks (I originally wrote this program for use
with my notebook).
These features are:
<ul>
<li> permanent disk cache (useful for frequent power-offs/reboots)
<li> usually smaller memory footprint (depends on cache size) (see next question)
<li> offline-detection prevents hangs (e.g. the typical hang on startup of some
Netscape Navigator versions if not dialled in)
<li> better control about timeouts (also to prevent hangs)
<li> better control over the cache
<li> better run-time control
</ul>
</td>
</tr>
</table>
<hr>
<a name="q002"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
When I look at the process size with ps, top, gtop, or a similar tool, I see
some processes with a total size well above 3.5 MB. This is much more than
e.g. BIND named (about 1.4 MB). Why?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
Really, it is not.
pdnsd uses multithreading, not multiprocessing. That means that the processes
share most of their process space. In the LinuxThreads library
or NPTL (Native Posix Thread Libary),
which are used by pdnsd on Linux, in fact the total process address space is shared
(although the processes have different stacks, these are in one process
address space). You may check this by looking at the at the process sizes of
the pdnsd threads: all should be the same. The effective size that pdnsd
occupies is thus the size of any of the processes, not the sum of those.
So, pdnsd with empty cache occupies about 800 kB, and the maximum size
should be about the cache size plus this size (in fact, ca 5-10% more).
</td>
</tr>
</table>
<hr>
<a name="q003"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
What do I need the status control (option -s) for?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
It enables you to do some things you might or might not need. With it, you can:
<ul>
<li> query pdnsd's settings at runtime to debug configuration files and
see which servers are regarded to be available
<li> mark servers as available or unavailable, or force a status retest - very
handy if you want to control which servers pdnsd queries, e.g for muliple
dial-up accounts
<li> delete, invalidate or add DNS records - useful e.g. when you want to build
records for dynamically assigned IP addresses or domain names
<li> reload pdnsd's configuration file without restarting pdnsd
<li> print information about the contents of pdnsd's cache.
</ul>
</td>
</tr>
</table>
<hr>
<a name="q004"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
What do I need local records (rr- and source-sections in the config file) for?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
Some resolver programs, e.g. nslookup, want to look up the name of the
server they are using before doing anything else. This option is for defining
a PTR record for your IP such that those programs get an answer even if the
name server you are caching is not available or does not offer these records.
By extension, you may also define A and SOA records. This allows you to build
very small zones without having to use a &quot;big&quot; name server. It is NOT
intended to replace such a complete server in anything but VERY small
networks. Alternatively, you may start a named on another host or on the
same host on another port and cache it with pdnsd in addition to other (more
distant) name servers.
<br>
The <code>source</code> section allows you to let pdnsd read in your
<code>/etc/hosts</code> file on startup and serve its contents. This file is used by your local
resolver before it even tries the name servers and usually contains
fully-qualified domain names (FQDNs) for all of the internet addresses your host has.
If you source this file, you usually won't need any additional <code>rr</code> sections. Sourcing it also allows
other hosts (eg. in your local network) to access the names defined in your
hosts file. You can of course just add other hosts in your local network to the
servers <code>hosts</code> file, thus making them known to your server's resolver
and pdnsd (if you sourced that file).
<br>
If you don't know what this answer was all about, you should just take the
source section in the sample config file that comes with pdnsd, copy it
into your config file and forget about it.
</td>
</tr>
</table>
<hr>
<a name="q005"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
When compiling, I get an error message like <br><i>Please define __BYTE_ORDER to
be __LITTLE_ENDIAN or __BIG_ENDIAN</i><br> What's up?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
Normally, this macros should be defined in your C library's header files.
There are two different methods, most C libraries support both (and pdnsd
honors both): either <code>__BYTE_ORDER</code> is set to <code>__LITTLE_ENDIAN</code>
or <code>__BIG_ENDIAN</code>, or <code>__LITTLE_ENDIAN</code> or <code>__BIG_ENDIAN</code>
are directly defined as macros.
<br>
Linux glibc, for example, does set those macros correctly. Never mind. You just have to know
whether your machine is little-endian or big-endian, this means wheter your
machine saves the least significant byte of a word or double-word first in memory (little-endian) or
the most significant first (big-endian).
All intel x86 and Alpha machines are little-endian, for example, while SPARC
and PowerPC architectures are big-endian.
If your machine is little-endian, add the following line to your config.h:
<br><code>
#define __BYTE_ORDER __LITTLE_ENDIAN
</code><br>
Likewise, if your machines byte order is big-endian:
<br><code>
#define __BYTE_ORDER __BIG_ENDIAN
</code><br>
Pathological byte orders like pdp-endian are not yet supported really;
However, for the place the endianess is needed, <code>__LITTLE_ENDIAN</code> should do
(it deals only with 16 bits; for all other occurances, ntoh[sl]/hton[sl] is used).
</td>
</tr>
</table>
<hr>
<a name="q007"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
At startup, I get a warning saying:<br>
<i>
Uptest command [...] will implicitly be executed as root
</i> <br>
What does that mean?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
This warning only occurs if you use the <code>uptest=exec</code> option in your
configuration. It means that the uptest command is run as root
because pdnsd is running as root, and this was not explicitely specified.
The idea is that it may introduce security holes (in the programs being run)
when they run as root, and so they shouldn't do that if possible.
You can specify the user that shall run the command by appending its name
comma-separated as string to the <code>uptest_cmd</code> line: <br>
<code>
uptest_cmd=&quot;&lt;your command&gt;&quot;,&quot;&lt;user&gt;&quot;;
</code> <br>
If it is correctly running as root, just append the user string <code>&quot;root&quot;</code> to
the command and the warning will not occur again.
</td>
</tr>
</table>
<hr>
<a name="q008"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
I cannot run my <code>uptest_cmd</code> command as root (it says <i>permission denied</i>),
although the pdnsd executable is setuid root. Why?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
pdnsd will drop privileges gained through setuid/setgid before executing the
uptest commands (you shouldn't set the pdnsd executable setuid/setgid anyway).
The reason is clear: if you install the pdnsd
executable as setuid root and this wouln't be done, any user could execute
shellcode with root privileges using that option!
</td>
</tr>
</table>
<hr>
<a name="q009"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
At startup, I get an error saying:<br>
<i>
Bad config file permissions: the file must be only writeable by the user
</i><br>
Why is that?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
pdnsd has an option (<code>uptest=exec</code>) that allows the execution of arbitrary
shell code (for testing whether an interface is up). This must be
of course secured against unauthorized use. One of these
protection is the one that produces the error message: if you routinely run
pdnsd, e.g. at system startup, and your config file is editable for others,
someone could change it and insert shell code that is executed in the next
pdnsd run -- with your user privileges! To prevent this, pdnsd will exit if the config file is writeable
by others than the owner.
To get rid of this message, just do <br>
<code>
chmod go-w &lt;filename&gt;
</code><br>
on your config
file (for the default file: <code>chmod go-w /etc/pdnsd.conf</code>).
You should also check that the ownership is set correct.
</td>
</tr>
</table>
<hr>
<a name="q010"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
<code>serve_aliases</code> does not seem to work.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
Some resolvers (e.g. of the glibc 2.1) seem sometimes not to look up unmodified names, but the names with
an entry of the search path already appended. Since pdnsd will serve short names with this
option anyway, you can delete the search an domain options from your /etc/resolv.conf. This is reported to
work in some cases.
</td>
</tr>
</table>
<hr>
<a name="q011"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
Some queries for domains that have many records (e.g. www.gmx.de) fail mysteriously.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
pdnsd versions prior to 1.1.0 had the tcp server thread disabled by default. Most resolvers
repeat their query using tcp when they receive a truncated answer (the answer is truncated
when it exceeds a length of 512 bytes). You need to recompile pdnsd with the option
<code>--enable-tcp-server</code> to fix this.
</td>
</tr>
</table>
<hr>
<a name="q012"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
I am behind some kind of firewall. In the configuration file
I have only listed addresses of name servers on the local (ISP's) network,
but pdnsd is slow and DNS queries frequently time out.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
In some cases pdnsd will not consider the answer of the local name server
authoritative enough, and will try to get answers from the name servers listed in the
authority section of the reply message. If pdnsd is behind a firewall that blocks the
UDP reply packets from remote name servers, pdnsd will wait in vain for a reply.
One solution is to set <a href="doc.html#proxyonly"><code>proxy_only=on</code></a>
in the servers sections of the configuration file.
This will prevent pdnsd from querying name servers that are not listed in the configuration
file.
Another solution that can be tried is specifying
<a href="doc.html#querymethod"><code>query_method=tcp_only</code></a>
in the global section of the configuration file, because a firewall that blocks
UDP packets from outside might still allow outgoing TCP connections to port 53.
</td>
</tr>
</table>
<hr>
<a name="q013"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
Is pdnsd vulnerable to DNS cache poisoning as described in
<a href="http://www.kb.cert.org/vuls/id/800113">CERT vulnerability note VU#800113</a>?
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
Short answer: Yes.<br>
Somewhat longer answer: The problem is not so much that pdnsd's implementation is flawed
but rather that the DNS protocol currently being used is fundamentally flawed from
a security viewpoint. As long as a more secure protocol is not in place,
all that the developers of pdnsd can do is to try to tweak the current implementation
to make it as difficult as possible for an attacker to succeed.<br>
From version 1.2.7 onwards, the default for the <code>query_port_start</code> option
is 1024, which means that the pdnsd resolver will randomly select source ports
in the range 1024-65535. (In previous versions the default was to let the kernel select
the source ports, which will often result in a more or less predictable sequence of ports.)
It also helps to use a good quality source of random numbers. On platforms where this is
supported, it is preferable to configure with <code>--with-random-device=/dev/urandom</code>.
There is still more that can be done to make pdnsd less vulnerable, but this remains
(as of this writing) a work in progress.
<br>
Please note that pdnsd was designed for small (private) networks, and that it is generally
not recommended to let untrusted users access pdnsd.
</td>
</tr>
</table>
<!--<hr>
<a name="q014"></a>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#FFCCFF"><b>Q:</b></td>
<td bgcolor="#CCFFFF">
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF"><b>A:</b></td>
<td bgcolor="#DDFFEE">
</td>
</tr>
</table>-->
<hr>
<address><a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>
and <a href="mailto:p.a.rombouts@home.nl">Paul Rombouts</a>
</address>
<br>
<p>
<i>Last revised: 18 August 2008 by Paul Rombouts</i>
</p>
</body>
</html>

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl -w
# Primitive ad-hoc script for updating pdnsd html doc files.
# Written by Paul Rombouts.
use strict;
use integer;
use POSIX qw(strftime);
my %paramvals=();
while(@ARGV && $ARGV[0]=~/^([^=]*)=(.*)$/) {
my $param=$1; my $val=$2;
if($param =~ /^[[:alpha:]]\w*$/) {
$paramvals{$param}=$val;
}
else {warn "Warning: invalid parameter '$param' ignored.\n"}
shift @ARGV;
}
sub sizeof {
my($arg)=@_;
(my $str= $arg) =~ s/\$(?:([[:alpha:]]\w*)\b|\{([[:alpha:]]\w*)\})/
defined($paramvals{$+})?$paramvals{$+}:defined($ENV{$+})?$ENV{$+}:''/eg;
my $filename=eval($str);
(-f $filename) or return '???';
(((-s $filename)+1023)/1024).'kB';
}
while(<>) {
s/\$(?:date\b|\{date\})/strftime("%d %b %Y",localtime)/eg;
s/\$sizeof\(([^()]*)\)/sizeof($1)/eg;
s/\$(?:([[:alpha:]]\w*)\b|\{([[:alpha:]]\w*)\})/
defined($paramvals{$+})?$paramvals{$+}:defined($ENV{$+})?$ENV{$+}:''/eg;
print;
}

View File

@ -1,686 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>pdnsd homepage</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
.small { font-family:helvetica; font-size:small; text-align:center; }
// -->
</style>
</head>
<body bgcolor="#EEEEEE">
<!-- This html code is used for the homepage and for the pdnsd documentation. Since there are some sections that
are unwanted in the documentation (particularly the link section with non-local images), and some things that shall
not appear in the textified version (some links etc), I introduce 4 tags: the homepage html code is translated to
documentation html code by replacing the "nodoc(" comment with the html start comment tag, and the ")nodoc" comment
with the html end comment tag.
Likewise, before the doc html version is translated to text, the "notext(" and ")notext" comments are translated to
html comment tags.
-->
<!--notext(-->
<table width="100%">
<tr>
<td> <span class="small">
<a href="index.html#aboutpdnsd">About pdnsd</a>
</span></td>
<td> <span class="small">
<a href="faq.html">pdnsd FAQ</a>
</span></td>
<td> <span class="small">
<a href="doc.html">Documentation</a>
</span></td>
<td> <span class="small">
<a href="../../COPYING">GNU GPL (pdnsd's License)</a>
</span> </td>
<td><span class="small">
<a href="dl.html">Download Section</a>
</span></td>
</tr>
</table>
<center><h1>The pdnsd Homepage</h1></center>
<center><h2>News</h2></center>
<table width="100%" cellspacing=1 cellpadding=7>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2012-03-17</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.9a-par has been released.</b>
Version 1.2.9a fixes a bug in the 1.2.9 release that causes a build failure when pdnsd is
configured with <span style="white-space:nowrap;"><code>--enable-strict-rfc2181</code></span>.
If you do not use this option to compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2012-02-27</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.9-par has been released.</b>
Version 1.2.9 supports many more RR types (including those necessary for DNSSEC) and
EDNS (Extension mechanisms for DNS) to enable UDP messages larger than 512 bytes.
It also has support for defining local TXT records and has several new options and bugfixes
(including file descriptor leaks that effect FreeBSD users).
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2011-05-03</b></td>
<td bgcolor="#ccffff" width="80%"><b>The latest source code is available from a
<a href="http://gitorious.org/pdnsd">git repository</a>.</b><br>
In response to frequent requests I have uploaded a git tree including the latest code
and a fairly extensive history of pdnsd development to
<a href="http://gitorious.org/pdnsd/pdnsd">gitorious.org</a>.
Anyone who wants to participate in pdnsd development is free to create a
<a href="http://gitorious.org/pdnsd/pdnsd/clone">clone repo on gitorious.org</a>
and push his modifications there.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2010-02-22</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.8-par has been released.</b>
The main new feature of version 1.2.8 is automatic discovery of root servers.
Furthermore, there are some additional improvements in the resolver.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2008-09-04</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.7-par has been released.</b>
Foremost, this release fixes some security problems.
It contains a fix for a "dangling pointer" bug that could cause pdnsd to
crash when it received a long reply. It also addresses some of the issues
raised in the <a href="http://www.kb.cert.org/vuls/id/800113">CERT
vulnerability note VU#800113</a> by making the default of
<code>query_port_start</code> equal to 1024, thereby ensuring that source
ports are randomly selected by the pdnsd resolver in the range 1024-65535.
This release also fixes problems with compiling pdnsd for the ARM architecture
and for the Darwin platform (Max OS X).
<br>
There are a number of (minor) new features.
pdnsd now supports "include" files, essentially configuration files that
only contain definitions for local records.
It is now possible to define interactively, using <code>pdnsd-ctl</code>,
any local record that can be defined in a configuration file.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2007-09-04</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.6-par has been released.</b>
pdnsd's license has been upgraded to GPL version 3.
A bug has been fixed which which caused pdnsd to handle NXDOMAIN replies
inefficiently when configured with <code>neg_domain_pol=on</code>. The
code that implements the ping test has been fixed, which was broken for
64-bit systems. A new option <code>randomize_servers</code> can be used
to give each server in a section of the configuration file an equal
chance of being queried. The new options <code>reject</code>,
<code>reject_policy</code> and <code>reject_recursively</code> make it
possible to check for the presence of certain IP addresses in the
replies of name servers and to avoid some types of unwanted replies.
The pdnsd-ctl '<code>add a</code>' and '<code>add aaaa</code>' commands
now allow multiple IP addresses to be specified for the same name.
pdnsd's ability to resolve from root servers has been improved.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2006-09-02</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.5-par has been released.</b>
This release introduces a new query method: <code>udp_tcp</code>.
With this method a UDP query is tried first and, if the UDP answer is
truncated, the query is repeated using TCP, which is the behaviour that
seems to be recommended by the DNS standards. There is a new
configuration option <code>use_nss</code>, which can be turned off to
prevent lengthy timeouts and stalls in certain situations. A bug has
been fixed which could cause pdnsd to crash if debug output was
generated before the debug output stream was properly initialized.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2006-01-09</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.4-par has been released.</b>
A memory leak and a minor buffer-overflow problem have been fixed.
There is now a fix for some situations that would previously cause pdnsd to
exit prematurely (such as ACPI S3 sleep or trying to attach strace to pdnsd).
Time intervals specified in the configuration file can now be expressed in
minutes, hours, days and weeks as well as seconds.
Support for Apple Mac OS X v10.4 Tiger has been improved.
The "<code>pdnsd-ctl&nbsp;status</code>" command now also provides some
information about the status of the running threads.
There are some further improvements in the debugging information provided by pdnsd.<br>
TCP-query support is now compiled in by default (but can still be disabled using
the configure option <code>--disable-tcp-queries</code>).
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2005-07-11</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.3-par has been released.</b>
New feature in this release: the "<code>pdnsd-ctl&nbsp;empty-cache</code>" command can
be provided with an include/exclude list, allowing the user to specify a
selection of names to be removed, instead of emptying the cache completely.<br>
Additional improvements: pdnsd should now remain responsive while executing the
"<code>pdnsd-ctl&nbsp;empty-cache</code>" command.
With the <code>query_method=tcp_udp</code> option pdnsd will now also
try a UDP query after a TCP connection times out, which should allow
pdnsd to resolve the same names with <code>query_method=tcp_udp</code>
as with <code>query_method=udp_only</code>, although perhaps with an
occasional delay.
"<code>pdnsd-ctl&nbsp;config</code>" or "<code>pdnsd-ctl&nbsp;server</code>"
commands should now run without delays, even if pdnsd is performing
<code>ping</code> or <code>query</code> uptests at the time.
Some problems with resolving certain names using root servers have been fixed.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2005-04-03</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.2-par has been released.</b>
The main emphasis of this release is improved portability.
A bug has been fixed that prevented pdnsd from compiling successfully on some
64 bit architectures.
This release has (experimental) support for the Darwin (Apple Mac OS X) platform.
On Linux systems, the configure script will now try to detect automatically whether
the system implements the Native POSIX Thread Library, but the method used may not
necessarily be foolproof.
In addition, the debug features have been improved and should make it easier to find out
why pdnsd considers some queries or replies malformed.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-11-07</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2.1-par has been released.</b>
The main new feature of this release is improved support for non-Linux platforms.<br>
This release has (experimental) support for the Cygwin platform, and should also fix
some compilation glitches that have been reported by FreeBSD users.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-10-10</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.2-par has been released.</b>
pdnsd is new and improved! Most of the changes effect the internal workings
of pdnsd, but there also a number of interesting new features (well, I think they are interesting).<br>
Among the bugs fixed are two rather nasty ones which involve the handling of NXT and NAPTR records
and which can cause pdnsd to crash or abort.<br>
The new features include a new server availability test which can be specified with <code>uptest=query</code>,
support for reading the DNS configuration from resolv.conf files,
a new option for optimizing the use of root servers,
a new option that makes defining local records for reverse resolving easier,
support for defining wildcard records,
a new pdnsd-ctl command for reloading the config file without restarting pdnsd, and
a new pdnsd-ctl command for dumping information about the names stored in the cache.
The documentation has also been updated: there is now a <code>pdnsd.conf</code> man page.<br>
For a more complete list of the changes I'll have to refer you to <a href="../../README.par"><code>README.par</code></a> and the <a
href="../../ChangeLog"><code>ChangeLog</code></a>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-05-22</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.11a-par has been released.</b>
This release contains a fix for FreeBSD users that bypasses a problem
with the macro <code>ENONET</code>, which can cause a compilation failure when it is undefined.
Linux users will notice no difference between 1.1.11a-par and 1.1.11-par.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-05-10</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.11-par has been released.</b>
This version has a rather large number of small changes, which are rather difficult to summarize.
Among the bugs fixed are a race condition in the cache lookup code, a
flaw in the code that caused a busy spin when a remote server answered
with "Not Implemented", and problems with the -4 and -6 command-line
options. Among the improvements are an alternative sorting algorithm
which should allow pdnsd to start up faster when reading a large cache
file from disk, automatic mapping of IPv4 to IPv6 addresses when running
in IPv6 mode, somewhat more efficient memory use, better compression of
the replies and changes in the parallel querying algorithm that should
improve the chances of catching a reply from a remote server.<br>
For a more complete list of the changes I'll have to refer you to <a href="../../README.par"><code>README.par</code></a> and the <a
href="../../ChangeLog"><code>ChangeLog</code></a>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-02-10</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.10-par has been released.</b>
The main new feature of this release is a new parser for configuration
files, completely rewritten from scratch in C. The main advantages are:
(f)lex and yacc/bison are no longer needed to build pdnsd, more
informative error messages instead of merely "<code>parse error</code>",
and string literals no longer need to be enclosed in quotes in most
cases.<br> Furthermore, a bug has been fixed that caused incorrect
IPV6-type PTR records to be generated when sourcing
<code>/etc/hosts</code> like files.<br>
There have been other small changes, more details can be found in the <a
href="../../ChangeLog"><code>ChangeLog</code></a>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2004-01-08</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.9-par has been released.</b>
"maintenance" release by Paul Rombouts.<br>
The change of version number is not very significant; the
difference between 1.1.9-par and the previous 1.1.8b1-par8 is marginal.
However, I felt the need to simplify the numbering, because it was
becoming rather baroque.<br>
I've added some missing pieces to the documentation (the pdnsd <a
href="doc.html">manual</a> and the man page for pdnsd-ctl). BTW, did you
know that it's possible to define aliases for domain names with pdnsd? I
had plans to implement such a feature when I discovered that pdnsd
already supports it. It was just poorly documented. (If want to try this
for your self, look for the new information about CNAME records under
the rr Section in the <a href="doc.html#rrsection">manual</a>.)<br> The
changes to the code consist mostly of optimizations, removal of some
size limits due to fixed-size buffers, and some cleaning up. I've also
tried to make the error responses of <a
href="doc.html#pdnsdctl"><code>pdnsd-ctl</code></a> more helpful.<br>
More details can be found in the <a href="../../ChangeLog"><code>ChangeLog</code></a>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2003-10-10</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.8b1-par8 has been released.</b>
"maintenance" release by Paul Rombouts.<br>
This version introduces a "delegation-only" feature that may be useful
for blocking Verisign's Sitefinder.<br>
The parser for the configuration file now tolerates domain names missing
a dot at the end.<br>
I have provided alternative implementations for some GNU extensions that I
used in an effort to make the code more portable. In particular, the
code should build on FreeBSD again.<br>
More details can be found in the <a href="../../README.par"><code>README.par</code></a> file.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2003-09-19</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.8b1-par7 has been released.</b>
"maintenance" release by Paul Rombouts. Besides fixing a number of bugs I have
reworked some of the code for adding and removing entries in the cache in an
effort to improve efficiency and stability.<br>
More details can be found in the <a href="../../ChangeLog"><code>ChangeLog</code></a>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2003-07-28</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.8b1-par6 has been released.</b>
"maintenance" release by Paul Rombouts. In addition to some further code cleanup,
the documentation has been revised.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2003-07-10</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.8b1-par5 has been released.</b>
A troublesome allocation size error has been discovered in Thomas Moestl's code.
In practice this bug only wastes memory but it could
also potentially lead to memory corruption. Upgrading is recommended.
More details can be found in the <code>ChangeLog</code>.
</td>
</tr>
<tr>
<td bgcolor="#ffccff" width="20%"><b>2003-06-30</b></td>
<td bgcolor="#ccffff" width="80%"><b>Version 1.1.8b1-par4 has been released.</b>
Due to incompatibilities between various implementations of
the pthread library on Linux systems, problems can occur with signal handling in
pdnsd. The usual symptom is failure by pdnsd to save the cache to disk, and
<code>/var/cache/pdnsd/pdnsd.cache</code> remaining empty. If you experience
this kind of trouble, try reconfiguring with different values for the new
<code>--with-thread-lib</code> option. The allowable values are
described in the <a href="doc.html#threadlib">documentation</a>.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF" width="20%"><b>2003-04-07</b></td>
<td bgcolor="#CCFFFF" width="80%"><b>pdnsd is no longer maintained by Thomas Moestl:</b>
I have not had time to maintain pdnsd for quite a while now, and have been very slow to
respond to issues, or did not respond at all. It is time that I officially announce that
pdnsd is no longer actively maintained; I apologize to all those who reported bugs or
asked questions without receiving any reply. However, <b>Paul A. Rombouts</b> has published
a patch set against the last released version at
<a href="http://members.home.nl/p.a.rombouts/pdnsd.html">http://members.home.nl/p.a.rombouts/pdnsd.html</a>,
which cleans up a lot of code fixes many bugs.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF" width="20%"><b>2002-07-19</b></td>
<td bgcolor="#CCFFFF" width="80%"><b>Documentation update.</b>
Please note that pdnsd should <b>never be installed with setuid or setgid attributes</b>,
as it is not always possible to give up all privileges due to operating system restrictions.
While this was never intended and I don't think that anybody would actually do this, the
documentation was updated to explicitely mention this to avoid misunderstandings.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF" width="20%"><b>2002-01-15</b></td>
<td bgcolor="#CCFFFF" width="80%"><b>Version 1.1.7a has been released.</b>
This fixes a reversed test in an assertion that would cause pdnsd to termintate when the ping uptest
was used. No other changes were made.
</td>
</tr>
<tr>
<td bgcolor="#FFCCFF" width="20%"><b>2002-01-15</b></td>
<td bgcolor="#CCFFFF" width="80%"><b>Version 1.1.7 has been released.</b>
This fixes some problems that might be remotely exploitable to gain access as the user pdnsd runs as
(an unprivileged user by default). To do this, an attacker needs to control a name server that is
queried by pdnsd, and send a malicious reply to such a query.<br>
Upgrading is strongly recommended!<br>
There are also minor bug fixes and stability improvements.
</td>
</tr>
</table>
<!--)notext-->
<hr>
<h2><a name="aboutpdnsd">About pdnsd</a></h2>
pdnsd is a proxy DNS server with permanent caching (the cache contents
are written to hard disk on exit) that is designed to cope with unreachable
or down DNS servers (for example in dial-in networking).<br>
Since version 1.1.0, pdnsd supports negative caching.<br>
<br>
It is licensed under the <a HREF="http://www.gnu.org">GNU</a> General Public License (<a HREF="../../COPYING">GPL</A><!--notext(-->,
<a HREF="http://www.gnu.org/copyleft/gpl.html">also available in html</A> and
<a HREF="http://www.gnu.org/copyleft/copyleft.html#translations">translated into various languages</A>.<!--)notext-->).
This, in short, means that the sources are distributed togehter with the program, and
that you are free to modify the sources and redistribute them as long as you
also license them under the GPL. You do not need to pay anything for pdnsd.
It also means that there is <b>ABSOLUTELY NO WARRANTY</b> for pdnsd or any part
of it. For details, please <a href="../../COPYING">read the GPL</a>.
<p>
pdnsd can be used with applications that do DNS lookups, e.g. on startup, and
can't be configured to change that behaviour, to prevent the often minute-long
hangs (or even crashes) that result from stalled DNS queries. Some Netscape Navigator
versions for Unix, for example, expose this behaviour.
</p>
pdnsd is configurable via a file and supports run-time configuration using the program pdnsd-ctl that comes
with pdnsd. This allows you to set the status flags of servers that pdnsd knows (to influence which servers
pdnsd will query), and the addition, deletion and invalidation of DNS records in pdnsd's cache.
<br>
Parallel name server queries are supported. This is a technique that allows
querying several servers at the same time so that very slow or unavailable
servers will not block the answer for one timeout interval.
<br>
Since version 1.0.0, pdnsd has full IPv6 support.
<p>
There is also a limited support for local zone records, intended for defining
1.0.0.127.in-addr.arpa. and localhost. , since some clients request that
information and it must be served even if the cached servers are not available
or do not serve these records. pdnsd may also read your /etc/hosts file
(this file is normally used by your local resolver and usually contains
information for localhost as well as for your machines FQDN) and serve its
contents.
</p> <p>
pdnsd was started on Linux, and has since been ported to FreeBSD (and Cygwin and Darwin).
90% of the source code should be easily portable to POSIX-
and BSD-compatible systems, provided that those systems support the POSIX threads (pthreads).
The rest might need OS-specific rewrites.
</p><p>
Currently, pdnsd is only compileable by gcc. This should be easy to fix, but I just
do not have documentation for other compilers. If you are not able or do not want
to use gcc, I would recommend you just try to do the minor changes.
</p>
<p>
pdnsd must be started as root in some cases (raw sockets are needed for icmp
echoes for the option <code>uptest=ping</code>, and the default port is 53, this must be
&gt;1024 to allow non-root execution). However, pdnsd can be configured to change it's user
and group id to those of a non-privileged user after opening the sockets needed for this.
</p> <p>
The server should support the full standard DNS queries following the rfcs 1034
and 1035. As of version 1.0.0, the rfc compliance has been improved again, and pdnsd is now
believed (or hoped?) to be fully rfc-compatible. It completely follows rfc 2181 (except
for one minor issue in the FreeBSD port, see the <a href="doc.html">documentation</a>).
It does not support the
following features, of which most are marked optional, experimental or obsolete
in these rfcs:
</p>
<ul>
<li> Inverse queries
<li> Status queries
<li> Completion queries
<li> Namespaces other than IN (Internet)
<li> AXFR and IXFR queries (whole zone transfers); since pdnsd does not maintain zones, that should not violate the standard
</ul>
The following record types, that are extensions to the original DNS standard, are supported for caching since version 1.2.9
(if you do not need most of them, you can disable runtime support for the unneeded ones before compiling pdnsd and save a little cache and executable space, see the source file <code>src/rr_types.in</code>):
<ul>
<li> RP (<i>responsible person</i>, RFC 1183)
<li> AFSDB (<i>AFS database location</i>, RFC 1183)
<li> X25 (<i>X25 address</i>, RFC 1183)
<li> ISDN (<i>ISDN number/address</i>, RFC 1183)
<li> RT (<i>route through</i>, RFC 1183)
<li> NSAP (<i>Network Service Access Protocol address </i>, RFC 1348)
<li> PX (<i>X.400/RFC822 mapping information</i>, RFC 1995)
<li> GPOS (<i>geographic position</i>, deprecated)
<li> AAAA (<i>IPv6 address</i>, RFC 1886)
<li> LOC (<i>location</i>, RFC 1876)
<li> EID (<i>Nimrod EID</i>)
<li> NIMLOC (<i>Nimrod locator</i>)
<li> SRV (<i>service record</i>, RFC 2782)
<li> ATMA (<i>ATM address</i>)
<li> NAPTR (<i>URI mapping</i>, RFC 2168)
<li> KX (<i>key exchange</i>, RFC 2230)
<li> CERT (<i>Certificate record</i>, RFC 4398)
<li> DS (<i>Delegation Signer</i>, RFC 4034)
<li> RRSIG (<i>Resource Record Signature</i>, RFC 4034)
<li> NSEC (<i>Next Secure</i>, RFC 4034)
<li> DNSKEY (<i>record containing the public key for a zone</i>, RFC 4034)
<li> NSEC3 (<i>Next Secure version 3</i>, RFC 5155)
<li> NSEC3PARAM (<i>NSEC3 parameters</i>, RFC 5155)
</ul>
<p style="text-indent: 1em;">
<i><b>Note</b>: This list is incomplete. For the complete list see the source file</i> <code>src/rr_types.in</code>.
</p>
There are FreeBSD and OpenBSD ports available for pdnsd (ports/net/pdnsd for both).
Thanks go to Roman Shterenzon for the FreeBSD port Sebastian Stark for the OpenBSD one!
Thanks to Kiyo Kelvin Lee now also runs on the Cygwin platform!
Thanks goes to Rodney Brown for extending portability to the Darwin (Apple Mac OS X) platform!
<p>
If you have questions left, you should take a look into the <a HREF="faq.html">FAQ</a>.
<br>
Bugfixes, patches and compatability fixes for other OSs are very welcome!
</p>
<h2>Features in detail</h2>
<p>
This section describes some of pdnsds features in detail. Most of the options are set
in the config file. For more information on the configuration file, see
<a href="doc.html">the documenation page</a>.
</p><br>
<h3>Uptests</h3>
pdnsd provides several methods to test whether a remote DNS server should be regarded as available
(so that pdnsd can query it), in
addition to the obvious &quot;none&quot; test (the server is always regarded as available,
or availability is set on or off using the <a href="doc.html#pdnsdctl"><code>pdnsd-ctl</code></a> utility).
These tests are:
<ul>
<li><b>ping:</b> a given adress is ping'ed in a given interval. If it there is no response
or the host is unreachable, the server is seen to be not available (for those who don't know:
pinging is sending a certain Internet packet type to a host to which any standard-conformant
host is required to reply).
<li><b>if:</b> a given network interface is tested whether it is existent, up and running. If
it is not, the server is regarded to be not available. This is especially useful for ppp and
similar interfaces. A special case test for Linux isdn (ippp*) interfaces is integrated, so that the uptests
should also work for these.
<li><b>dev:</b> this is a variant of the if uptest for use with Linux dial-on-demand ppp interfaces. In addition
to performing an if-style interface uptest, it also tests whether a specified program (e.g. pppd) owns
a lock to a given (modem-) device.
<li><b>exec:</b> a given shell command line is executed and the exit status of the whole command line (which
is normally the exit status of the last command) is evaluated. If it is not zero, the server is regarded
to be not available. This is a very flexible testing method with which it should be able to perform
virtually any needed test.
<li><b>query:</b> <em>New in version 1.2:</em>
This works like the ping test, except it sends an (empty) DNS query to the remote server.
If the server sends a well-formed response back within the timeout period (except SERVFAIL),
it will be regarded as available.
This test is useful if a remote server does not respond to ICMP_ECHO requests at all,
which unfortunately is quite common these days.
In many cases this test will be a more reliable indicator of availability
than the ones mentioned above.
</ul>
<br>
<h3>Local Records (&quot;Zones&quot;)</h3>
As mentioned above, there are only very basic local record types (ie the record types that you may use in record
declarations in your local configuration for records that pdnsd shall serve in addion to the cached ones).
They are organized roughly in zones but have not complete zone declarations, so I generally do not use the
term &quot;zone&quot; for them, but rather &quot;local records&quot;.
These are the local record types pdnsd can understand:
<ul>
<li> <b>SOA</b> (information about the name server)
<li> <b>A</b> (domain-name-to-address mapping)
<li> <b>PTR</b> (pointer, used normally for address-to-domain-name mapping)
<li> <b>NS</b> (name server, generated automatically by pdnsd for any local record set)
<li> <b>CNAME</b> (canonical host name)
<li> <b>MX</b> (mail exchange for the domain)
<li> <b>TXT</b> (arbitrary text strings, often used for Sender Policy Framework)
</ul>
You can specify these records in the configuration file. <br>
You may &quot;source&quot; a file in a format like that used in the <code>/etc/hosts</code> file, that means
that pdnsd reads this file, extracts addresses and domain names from it and automatically generates
A records for name to address mapping, PTR records for address to name mapping and NS records (name
server specifiation) for each entry in the file.<br>
Records can also be changed dynamically at run time.<br>
A script contributed by Marko Stolle makes pdnsd usable in a DHCP setup using this feature.
<br>
<h1>System requirements</h1>
As mentioned, pdnsd currently runs under Linux, FreeBSD and Cygwin.
Other BSD flavours may or may not work (feedback is very welcome!).
The system and software requirements under Linux are:
<ul>
<li> Kernel version &gt;2.2.0
<li> glibc version &gt;2.0.1 (aka libc6) with LinuxThreads (normally included)
or NPTL (Native Posix Thread Library, recommended).<br>
Due to a bug, pdnsd 0.9.8 does not run with glibc2.1.1. This behaviour was
fixed in pdnsd 0.9.9.
<li> For IPv6: glibc&gt;=2.1
</ul>
The system requirements under FreeBSD are:
<ul>
<li> FreeBSD versions &gt;=2.6 (prior ones may or may not work)
<li> For IPv6: FreeBSD &gt;=4.0 is recommended (no idea if it runs on prior versions)
</ul>
The common software requirements for all supported systems are:
<ul>
<li> GCC, preferably egcs-2.* or 3.* (other compilers are currently not supported; the needed patch for another compiler
should not be difficult, however)
<li> GNU or BSD make
<li> the standard commands install, grep, sed, awk, touch and which (along with the REALLY
standard ones mv, cp, ln, rm, pwd, test, echo, cat, mkdir, chown, chmod, tar). In
any standard Unix installation, this should be no problem.
<li> for hacking and building own packages, you might also need gzip, bzip2, perl and rpmbuild
</ul>
<br>
<h1>Download</h1>
If you want to download pdnsd, please visit the <a href="dl.html">download page</a>.
<br>
<h1><a name="authors">Authors</a></h1>
<p>
pdnsd was originally written by <a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>,
but is no longer maintained by him. <a href="mailto:p.a.rombouts@home.nl">Paul A. Rombouts</a>
has revised large portions of the code and has added a number of new features.
See <a href="../../README.par"><code>README.par</code></a> and the <a href="../../ChangeLog"><code>ChangeLog</code></a>
in the source directory (or <code>/usr/share/doc/pdnsd-&lt;version&gt;</code>
if you have installed a binary package) for more details.
If you have questions about the recent modifications, you can find
<a name="currentmaintainer">the email address of the current maintainer</a>
at the end of <a href="../../README.par"><code>README.par</code></a>.
</p>
<p>
Daniel Smolik has contributed RedHat RPMs (the most recent RPMs are available <a href="dl.html">here</a>).<br>
Torben Janssen contributed start scripts for Red Hat Linux. <br>
Soenke J. Peters contributed patches and suggestions for Red Hat compatability.<br>
Wolfgang Ocker has contributed the code and documentation for the <code>server_ip</code> option.<br>
Markus Mohr contributed a Debian rc script.<br>
Nikita V. Youschenko contributed extensions to the "<code>if</code>" uptest.<br>
Lyonel Vincent extended the serve_aliases option to support an arbitrary number of aliases.<br>
Sourav K. Mandal wrote the autoconf scripts and contributed many fixes and suggestions.<br>
Stephan Boettcher contributed the SCHEME= option.<br>
Ron Yorston contributed the uptest for Linux ppp dial-on-demand devices.<br>
Alexandre Nunes fixed some bugs in the autoconf files.<br>
Sverker Wiberg contributed fixes for IPv6.<br>
Carsten Block contributed <code>configure</code>-able rc scripts.<br>
Olaf Kirch contributed a security fix for the run_as code.<br>
Paul Wagland contributed various patches for bind9-compatability and other issues.<br>
Roman Shterenzon contributed patches and lots of helpful hints for FreeBSD compatability.<br>
Bernd Leibing has contributed spec file fixes.<br>
Michael Wiedmann has contributed the pdnsd-ctl.8 man page.<br>
Marko Stolle has contributed the contrib/pdnsd_update.pl script that makes pdnsd usable in a DHCP setup.<br>
P.J. Bostley has contributed patches to get pdnsd working on alpha properly.<br>
Christian Engstler contributed patches for SuSE compatability.<br>
Bjoern Fischer contributed code to make pdnsd leave the case of names in the cache unchanged.<br>
Marko Stolle contributed the contrib/pdnsd_update.pl script that makes pdnsd usable in a DHCP setup.<br>
Andrew M. Bishop contributed the support for the label server option and the pdnsd-ctl interface for using it.<br>
Frank Elsner contributed rc script fixes. <br>
Andreas Steinmetz contributed the code for <code>query_port_start</code> and <code>query_port_end</code> options.<br>
Mahesh T. Pai contributed the pdnsd.8 man page.<br>
Nikola Kotur contributed the Slackware start-up script.<br>
Kiyo Kelvin Lee contributed a patch for Cygwin support.<br>
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.<br>
Jan-Marek Glogowski contributed a patch implementing the <code>use_nss</code> option.
</p>
<p>
Special thanks to Bert Frederiks for letting me do a late-night debugging run on his machine to
spot obscure bugs!
</p>
<p>
Thanks to the following persons for reporting bugs and being helpful:<br>
David G. Andersen,<br>
Dirk Armbrust,<br>
Daniel Black,<br>
Kevin A. Burton,<br>
Juliusz Chroboczek,<br>
Joachim Dorner,<br>
Stefan Erhardt,<br>
Stefan Förster,<br>
Mike Hammer,<br>
Jonathan Hudson,<br>
Dan Jacobson,<br>
Byrial Jensen,<br>
Patrick Loschmidt,<br>
James MacLean,<br>
Fraser McCrossan,<br>
Michael Müller,<br>
Erich Reitz,<br>
Brian Schroeder,<br>
Milan P. Stanic,<br>
Michael Steiner,<br>
Norbert Steinl,<br>
Markus Storm,<br>
Michael Ströder,<br>
Alan Swanson,<br>
Eelco Vriezekolk.
</p>
<!--nodoc(-->
<h1>Links</h1>
Well, this is the obligatory link section.
<br>
<br>
<table width="100%" cellpadding=7>
<tr>
<td><center>
<a href="http://www.gnu.org">
<img src="gnuhead.png" alt="http://www.gnu.org"><br>
The GNU homepage
</a>
</center></td>
<td><center>
<a href="http://freecode.com">
<img src="fm_logo.png" alt="http://freecode.com"><br>
Freecode (formerly Freshmeat) - large free software index
</a>
</center></td>
</tr>
<tr>
<td><center>
<a href="http://www.freebsd.org">
<img src="freebsd.png" alt="http://www.freebsd.org"><br>
The FreeBSD project
</a>
</center></td>
</tr>
</table>
<!--)nodoc-->
<br>
<hr>
<address><a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>
and <a href="mailto:p.a.rombouts@home.nl">Paul A. Rombouts</a>
</address>
<br>
<p>
<i>Last revised: 17 March 2012 by Paul A. Rombouts</i>
</p>
</body>
</html>

View File

@ -1,161 +0,0 @@
#!/usr/bin/perl -w
#
# A Perl script for converting pdnsd html documentation to a man page.
#
# Written by Paul A. Rombouts
#
# This file Copyright 2004 Paul A. Rombouts
# It may be distributed under the GNU Public License, version 2, or
# any higher version. See section COPYING of the GNU Public license
# for conditions under which this file may be redistributed.
#
use strict;
use POSIX qw(strftime);
while(<>) {
if(/<h[1-4]>[^<]*configuration file/i) {
last;
}
}
exit unless defined($_);
while(<>) {
if(/<h[1-4]>[^<]*layout/i) {
last;
}
}
exit unless defined($_);
(my $myname=$0) =~ s{.*/}{};
print <<ENDOFHEADER;
.\\\" Generated automatically from the html documentation by $myname
.\\\"
.\\\" Manpage for pdnsd.conf (pdnsd configuration file)
.\\\"
.\\\" Copyright (C) 2000, 2001 Thomas Moestl
.\\\" Copyright (C) 2003, 2004, 2005, 2006, 2007 Paul A. Rombouts
.\\\"
.\\\" This manual is a part of the pdnsd package, and may be distributed in
.\\\" original or modified form under terms of the GNU General Public
.\\\" License, as published by the Free Software Foundation; either version
.\\\" 3, or (at your option) any later version.
.\\\" You can find a copy of the GNU GPL in the file COPYING in the source
.\\\" or documentation directory.
.\\\"
ENDOFHEADER
print ".TH PDNSD.CONF 5 \"",strftime("%b %Y",localtime),"\" \"pdnsd \@fullversion\@\"\n";
print <<ENDOFHEADER2;
.SH NAME
pdnsd.conf \\- The configuration file for pdnsd
.hw config
.SH DESCRIPTION
.PP
This manual page describes the layout of the
.BR pdnsd (8)
configuration file and the available configuration options.
The default location of the file is \@sysconfdir\@/pdnsd.conf. This may be changed
with the \\fB-c\\fP command line option.
An example pdnsd.conf comes with the pdnsd distribution in the documentation directory
or in \@sysconfdir\@/pdnsd.conf.sample.
.SH \"FILE FORMAT\"
.PP
ENDOFHEADER2
my $taggedparagraph=0;
my $displayed=0;
while(<>) {
if(/<h[1-4]>.*\bpdnsd-ctl\b/) {
last;
}
s{^\s*((?:<[^<>]+>)*?)<h[1-4]>[\d.]*\s*(.*)</h[1-4]>((?:<[^<>]+>)*?)(?:<br>)?\s*$}{.SS $1$2$3\n}i;
if(s{^\s*<tr>\s*}{.TP\n}i) {$taggedparagraph=1}
if(m{^\s*</tr>}i) {$taggedparagraph=0}
s{^\s*((?:<[^<>]+>)*?)<b>(.*)</b>((?:<[^<>]+>)*?)(?:<br>)?\s*$}{.B $1$2$3\n}i if $taggedparagraph;
s{^\s*((?:<[^<>]+>)*?or(?:<[^<>]+>)*?)(?:<br>)?\s*$}{$1\n.PD 0\n.TP\n.PD\n}i if $taggedparagraph;
if(s{^\s*<pre>}{.DS L\n}i) {$displayed=1}
s{^\t}{ } if $displayed;
if(s{</pre>\s*$}{\n.DE\n\n}i) {$displayed=0}
elsif(!$displayed) {s{^\s*}{}}
s{^\s*<li>}{.IP\n\\(bu }i;
s{<li>}{\n.IP\n\\(bu }i;
s{<ul>}{\n}i;
s{</ul>}{\n}i;
s{<b>}{\\fB}ig;
s{</b>}{\\fP}ig;
s{<(i|em)>}{\\fI}ig;
s{</(i|em)>}{\\fP}ig;
unless(s{^\s*(<[^<>]+>)*(<br>|<p>)(<[^<>]+>)*\s*$}{\n}i) {
s{<p\b[^<>]*>(.*)</p>}{\n$1\n}i;
s{^\s*<br>}{.br\n}i;
s{<br>\s*<br>\s*$}{\n\n}i;
s{<br>\s*$}{\n.br\n}i;
s{<br>}{\n.br\n}i;
s{^\s*(<[^<>]+>)*\s*$}{};
}
s{<[^<>]+>}{}g;
s{&lt;}{<}ig;
s{&gt;}{>}ig;
s{&quot;}{"}ig;
s{&nbsp;}{\\ }ig;
s{/var/cache/pdnsd\b}{\@cachedir\@}g;
s{(?<![-\w\\])-[-\w]*}{(my $s=$&) =~ s{-}{\\-}g;$s}ge;
s{\bpdnsd-ctl\b}{pdnsd\\-ctl}g;
s{\blist-rrtypes\b}{list\\-rrtypes}g;
print;
}
print <<ENDOFTRAILER;
.SH \"VERSION\"
.PP
This man page is correct for version \@fullversion\@ of pdnsd.
.SH \"SEE ALSO\"
.PP
.BR pdnsd (8),
.BR pdnsd\\-ctl (8)
.PP
More documentation is available in the \\fBdoc/\\fP subdirectory of the source,
or in \\fB/usr/share/doc/pdnsd/\\fP if you are using a binary package.
.SH AUTHORS
\\fBpdnsd\\fP was originally written by Thomas Moestl
.UR
<tmoestl\@gmx.net>
.UE
and was extensively revised by Paul A. Rombouts
.UR
<p.a.rombouts\@home.nl>
.UE
(for versions 1.1.8b1\\-par and later).
.PP
Several others have contributed to \\fBpdnsd\\fP; see files in the source or
\\fB/usr/share/doc/pdnsd/\\fP directory.
.PP
This man page was automatically generated from the html documentation for \\fBpdnsd\\fP,
using a customized Perl script written by Paul A. Rombouts.
ENDOFTRAILER
if(defined($_)) {
while(<>) {
if(/last\s+revised/i) {
s{^\s*}{};
s{<[^<>]+>}{}g;
s{&lt;}{<}ig;
s{&gt;}{>}ig;
s{&quot;}{"}ig;
s{&nbsp;}{\\ }ig;
print ".PP\n";
print;
last;
}
}
}
exit;

View File

@ -1,198 +0,0 @@
.\" This manpage has been automatically generated by docbook2man-spec
.\" from a DocBook document. docbook2man-spec can be found at:
.\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.\" This manpage has been edited manually by Paul A. Rombouts.
.TH "PDNSD\-CTL" "8" "Sep 2008" "pdnsd 1.2.9b-par" ""
.SH NAME
\fBpdnsd\-ctl\fP \- controls pdnsd
.SH SYNOPSIS
.sp
\fBpdnsd\-ctl\fP [\fB\-c\fP \fIcachedir\fP] [\fB\-q\fP] \fIcommand\fP [\fIarguments\fP]
.SH "DESCRIPTION"
.PP
\fBpdnsd\-ctl\fP controls \fBpdnsd\fP, a proxy dns server with permanent caching.
Note that the status control socket must be enabled (by specifying an option on
the pdnsd command line or in the configuration file) before you can use
\fBpdnsd\-ctl\fP.
.PP
.TP
\fB\-c\fP \fIcachedir\fP
Set the cache directory to \fIcachedir\fP (must match pdnsd setting).
This is only necessary if the directory differs from the default specified
at compile time.
.TP
\fB\-q\fP
Be quiet unless output is specified by the command or something goes wrong.
.SH "COMMANDS"
.TP
\fBhelp\fP\ \ \ [no arguments]
Print a command summary.
.TP
\fBversion\fP\ [no arguments]
Print version and license info.
.TP
\fBstatus\fP\ [no arguments]
Print a description of pdnsd's cache status, thread status and configuration.
Also shows which remote name servers are assumed to be available.
.TP
\fBserver\fP\ (\fIindex\fP|\fIlabel\fP) (\fBup\fP|\fBdown\fP|\fBretest\fP) [\fIdns1\fP[,\fIdns2\fP[,...]]]
Set the status of the servers with the given index or label to up or down, or
force a retest. The index is assigned in the order of definition in pdnsd.conf
starting with 0. Use the status command to view the indexes. You can specify all
instead of an index to perform the action for all servers registered with pdnsd.
.IP
An optional third argument can be given consisting of a list of IP addresses
separated by commas or white-space characters. This list will replace the
addresses of name servers used by pdnsd for the given server section. This
feature is useful for run-time configuration of pdnsd with dynamic DNS data in
scripts called by ppp or DHCP clients. The last argument may also be an empty
string, which causes existing IP addresses to be removed and the corresponding
server section to become inactive.
.TP
\fBrecord\fP\ \fIname\fP (\fBdelete\fP|\fBinvalidate\fP)
Delete or invalidate the records of the given domain name if it is in the cache.
Invalidation means that the records are marked as timed out, and will be
reloaded if possible. For local records (i.e., records that were given in the
config file using a rr section, records read from a hosts-style file and records
added using pdnsd-ctl), invalidation has no effect. Deletion will work, though.
.TP
\fBsource\fP\ \fIfn\fP \fIowner\fP [\fIttl\fP] [(\fBon\fP|\fBoff\fP)] [\fBnoauth\fP]
Load a hosts-style file. Works like using the pdnsd source configuration section.
Owner and ttl are used as in the source section. ttl has a default
of 900 (it does not need to be specified). The next to last argument corresponds
to the serve_aliases option, and is off by default.
\fBnoauth\fP is used to make the domains non-authoritative
(this is similar to setting authrec=off in the config file,
please consult the
.BR pdnsd.conf (5)
man page for what that means).
fn is the name of the file, which must be readable by pdnsd.
.TP
\fBadd\fP\ \ \ \ \fBa\fP \fIaddr\fP \fIname\fP [\fIttl\fP] [\fBnoauth\fP]
.TP
\fBadd\fP\ \ \ \ \fBaaaa\fP \fIaddr\fP \fIname\fP [\fIttl\fP] [\fBnoauth\fP]
.TP
\fBadd\fP\ \ \ \ \fBptr\fP \fIhost\fP \fIname\fP [\fIttl\fP] [\fBnoauth\fP]
.TP
\fBadd\fP\ \ \ \ \fBcname\fP \fIhost\fP \fIname\fP [\fIttl\fP] [\fBnoauth\fP]
.TP
\fBadd\fP\ \ \ \ \fBmx\fP \fIhost\fP \fIname\fP \fIpref\fP [\fIttl\fP] [\fBnoauth\fP]
Add a record of the given type to the pdnsd cache, replacing existing
records for the same name and type. The 2nd argument corresponds
to the value of the option in the rr section that is named like
the first argument. The addr argument may be a list of IP addresses,
separated by commas or white space.
The ttl is optional, the default is 900 seconds.
\fBnoauth\fP is used to make the domains non-authoritative
(this is similar to setting authrec=off in the config file,
please consult the
.BR pdnsd.conf (5)
man page for what that means).
If you want no other record than the newly added in the cache, do
\fBpdnsd\-ctl\fP\ \fBrecord\fP\ \fIname\fP\ \fBdelete\fP
before adding records.
.TP
\fBneg\fP\ \ \ \ \fIname\fP [\fItype\fP] [\fIttl\fP]
Add a negatively cached record to pdnsd's cache, replacing existing
records for the same name and type. If no type is given, the whole
domain is cached negatively. For negatively cached records, errors are
immediately returned on a query, without querying other servers first.
The ttl is optional, the default is 900 seconds.
.TP
\fBconfig\fP\ \fIfilename\fP
Reload pdnsd's configuration file.
.br
The config file must be owned by the uid that pdnsd had when it was started,
and be readable by pdnsd's run_as uid.
If no file name is specified, the config file used at start-up is reloaded.
Note that some configuration changes, like the port or IP address pdnsd listens on,
cannot be made this way and you will receive an error message.
In these cases, you will have to restart pdnsd instead.
.TP
\fBinclude\fP\ \fIfilename\fP
Parse an include file.
.br
The include file may contain the same
type of sections as a config file, expect for global and server
sections, which are not allowed. This command can be used to add data
to the cache without reconfiguring pdnsd.
.TP
\fBeval\fP\ \ \ \fIstring\fP
Parse a string as if part of an include file.
.br
The string should hold one or more complete configuration sections,
but no global and server sections, which are not allowed.
If multiple strings are given, they will be joined using newline chars
and parsed together.
.TP
\fBempty\-cache\fP\ [[+|-]\fIname\fP ...]
Delete all entries in the cache matching include/exclude rules.
.br
If no arguments are provided, the cache is completely emptied,
freeing all existing entries.
Note that this also removes local records, as defined by the config file.
To restore local records, run "pdnsd-ctl\ config" immediately afterwards.
.br
If one or more arguments are provided, these are interpreted as
include/exclude names. If an argument starts with a '+' the name is to
be included. If an argument starts with a '-' it is to be excluded.
If an argument does not begin with '+' or '-', a '+' is assumed.
If the domain name of a cache entry ends in one of the names in the
list, the first match will determine what happens. If the matching name
is to be included, the cache entry is deleted, otherwise it remains.
If there are no matches, the default action is not to delete.
.TP
\fBdump\fP\ \ \ [\fIname\fP]
Print information stored in the cache about \fIname\fP.
If \fIname\fP begins with a dot and is not the root domain, information
about the names in the cache ending in \fIname\fP (including \fIname\fP without
the leading dot) will be printed.
If \fIname\fP is not specified, information about all the names in the cache
will be printed.
.TP
\fBlist\-rrtypes\fP [no arguments]
List available rr types for the neg command. Note that those are only
used for the neg command, not for add!
.SH "BUGS"
.PP
If you pipe the output of \fBdump\fP command through an application that
reads only part of the output and then blocks (such as more or less),
pdnsd threads trying to add new entries to the cache will be suspended
until the pipe is closed.
It is preferable to capture the output in a file in such a case.
.br
Report any remaining bugs to the authors.
.SH "AUTHORS"
.PP
Thomas Moestl
.UR
<tmoestl@gmx.net>
.UE
.br
Paul A. Rombouts
.UR
<p.a.rombouts@home.nl>
.UE
(for versions 1.1.8b1\-par and later)
.PP
Last revised: 04 Sep 2008 by Paul A. Rombouts.
.SH "SEE ALSO"
.PP
.BR pdnsd (8),
.BR pdnsd.conf (5)

View File

@ -1,326 +0,0 @@
.TH PDNSD 8 "Jul 2007" "pdnsd @fullversion@" "System Administration Commands"
.SH NAME
\fBpdnsd\fP \- dns proxy daemon
.SH SYNOPSIS
\fBpdnsd\fP [\-h] [\-V] [\-s] [\-d] [\-g] [\-t] [\-p \fIfile\fR] [\-v\fIn\fR] [\-m\fIxx\fR] [\-c \fIfile\fR] [\-4] [\-6] [\-a]
.PP
This man page is an extract of the documentation of \fBpdnsd\fP.
For complete, current documentation, refer to the HTML (or plain text)
documentation (which you can find in the \fBdoc/\fP subdirectory of the
source or in a standard documentation directory, typically
\fB/usr/share/doc/pdnsd/\fP if you are using a binary package).
.SH DESCRIPTION
.PP
\fBpdnsd\fP is a IPv6 capable proxy domain name server (DNS) which
saves the contents of its DNS cache to the disk on exit.
.SH OPTIONS
.RS
.TP
.B \-4
enables IPv4 support. IPv6 support is automatically
disabled (should it be available). On by default.
.TP
.B \-6
enables IPv6 support. IPv4 support is automatically
disabled (should it be available). Off by default.
.TP
.B \-a
With this option, pdnsd will try to detect automatically if
the system supports IPv6, and fall back to IPv4 otherwise.
.TP
.BR \-V " or " \-\-version
Print version information and exit.
.TP
\fB\-c\fP \fIFILE\fP or \fB\-\-config\-file=\fP\fIFILE\fP
specifies that configuration is to be read from \fIFILE\fP.
Default is \fB@sysconfdir@/pdnsd.conf\fP.
.TP
.BR \-d " or " \-\-daemon
Start \fBpdnsd\fP in daemon mode (as a background process).
.TP
.BR \-g " or " \-\-debug
Print some debug messages on the console or to the file
\fBpdnsd.debug\fP in your cache directory (in daemon mode).
.TP
.BR \-h " or " \-\-help
Print an option summary and exit.
.TP
\fB\-i\fP \fIPREFIX\fP or \fB\-\-ipv4_6_prefix=\fP\fIPREFIX\fP
specifies the prefix pdnsd uses (when running in IPv6 mode) to map IPv4
addresses in the configuration file to IPv6 addresses. Must be a valid IPv6
address. Default is ::ffff:0.0.0.0
.TP
.B \-p \fIFILE\fP
writes the pid the server runs as to the specified filename. Works
only in daemon mode.
.TP
.B \-\-pdnsd\-user
Print the user \fBpdnsd\fP will run as and exit.
.TP
.BR \-s " or " \-\-status
enables the status control socket. Either this option should be passed
to the command line or \fBstatus_ctl=on;\fP should be specified in the
config file if you want to use
.BR pdnsd\-ctl (8)
to control \fBpdnsd\fP at runtime.
.TP
.BR \-t " or " \-\-tcp
enables the TCP server thread. \fBpdnsd\fP will then serve TCP and UDP
queries.
.TP
.BI \-v n
sets the verbosity of \fBpdnsd\fP. \fIn\fP is a numeric argument
between 0 (normal operation) to 3 (many messages for debugging).
.TP
.BI \-m xx
sets the query method \fBpdnsd\fP
uses. Possible values for \fIxx\fP are:
.IP
.B uo
\- pdnsd will use UDP only. This is the fastest method, and should
be supported by all name servers on the Internet.
.IP
.B to
\- pdnsd will use TCP only. TCP queries usually take more time than
UDP queries, but are more secure against certain attacks, where an
attacker tries to guess your query id and to send forged answers. TCP
queries are not supported by some name servers.
.IP
.B tu
\- pdnsd will try to use TCP, and will fall back to UDP if its
connection is refused or times out.
.IP
.B ut
\- pdnsd will try to use UDP, and will repeat the query using TCP
if the UDP reply was truncated (i.e. the tc bit is set).
This is the behaviour recommended by the DNS standards.
.PP
Additionally, "no" can be prepended to the \-\-status, \-\-daemon, \-\-debug
and \-\-tcp options (e.g. \-\-notcp) to reverse their effect.
.RE
.SH USAGE
.PP
\fBpdnsd\fP is usually run from a startup script. For \fBpdnsd\fP to
work, You need to:-
.IP
1. Tell your system to use \fBpdnsd\fP as the primary DNS server by
modifying \fB/etc/resolv.conf\fP.
.IP
2. Tell \fBpdnsd\fP to use an authentic source for DNS records, by
including the IP addresses of one or more DNS servers, usually your
ISP's DNS servers, in \fB@sysconfdir@/pdnsd.conf\fP.
.PP
For this, put the following line in your \fB/etc/resolv.conf\fP
.PP
.RS
nameserver 127.0.0.X
.RE
.PP
where X can be any number. (I use 3). Comment out all other
entries. You should put the same value in the server_ip= line in
\fBglobal\fP section of \fB@sysconfdir@/pdnsd.conf\fP.
.br
If you want to use \fBpdnsd\fP as the DNS server for a small local network,
you should use the IP address or name of the interface connected to
this network instead of 127.0.0.X.
.RE
.PP
To tell \fBpdnsd\fP where to get DNS information from, add the
following lines in \fB@sysconfdir@/pdnsd.conf\fP:-
.PP
.RS
server {
.br
label= "myisp";
ip=123.456.789.001,123.456.789.002;
proxy_only=on;
timeout=10;
.br
}
.RE
.PP
Note the opening and closing braces. Add more such \fBserver\fP
sections for each set of DNS servers you want \fBpdnsd\fP to query.
Of course the configuration options shown here are just examples.
More examples can be found in \fB@sysconfdir@/pdnsd.conf.sample\fP
or the pdnsd.conf in the documentation directory.
See the
.BR pdnsd.conf (5)
man page for all the possible options and their exact meaning.
.PP
If you use a dial up connection, remember that ppp scripts usually
replace \fB/etc/resolv.conf\fP when connection with the ISP is
established. You need to configure ppp (or whatever you use to
establish a connection) so that \fB/etc/resolv.conf\fP is not replaced
every time a connection is established. Read the documentation for the
scripts run when your network comes up.
.PP
If you use pppconfig, specify `none' in the `nameservers' option in
the `advanced' tab. If you use multiple ISPs, you should do this for
each connection/account.
.PP
If you use multiple ISPs, you should tell \fBpdnsd\fP which DNS servers
have become available by calling \fBpdnsd\-ctl\fP, the \fBpdnsd\fP
control utility, in a script (e.g. \fB/etc/ppp/ip\-up\fP when you use pppd)
that is run when the connection is established.
If the addresses of the DNS servers are obtained through some type of
dynamic configuration protocol (e.g. pppd with the usepeerdns
option or a DHCP client), you can pass the DNS server addresses as an extra
argument to \fBpdnsd\-ctl\fP to configure \fBpdnsd\fP at run time.
See the
.BR pdnsd\-ctl (8)
man page for details.
.SH FILES
\fB@sysconfdir@/pdnsd.conf\fP is the pdnsd configuration file.
The file format and configuration options are described in the
.BR pdnsd.conf (5)
man page. You can find examples of almost all options in
\fB@sysconfdir@/pdnsd.conf.sample\fP.
.PP
\fB@cachedir@/pdnsd.cache\fP
.PP
\fB@cachedir@/pdnsd.status\fP is the status control socket, which must be
enabled before you can use \fBpdnsd\-ctl\fP.
.PP
\fB/etc/init.d/pdnsd\fP (the name and location of the start-up script
may be different depending on your distribution.)
.PP
\fB/etc/resolv.conf\fP
.PP
\fB/etc/defaults/pdnsd\fP contains additional parameters or options
which may be passed to pdnsd at boot time. This saves the hassle of
fiddling with initscripts (not available on all distributions).
.SH BUGS
.PP
The verbosity option
.BI -v n
presently does not seem to have much effect on the amount of debug output.
.br
Report any remaining bugs to the authors.
.SH CONFORMING TO
.PP
\fBpdnsd\fP should comply with RFCs 1034 and 1035. As of version
1.0.0, RFC compliance has been improved and pdnsd is now believed (or
hoped?) to be fully RFC compatible. It completely follows RFC 2181
(except for one minor issue in the FreeBSD port, see the
documentation).
.PP
It does \fINOT\fP support the following features, of which most are
marked optional, experimental or obsolete in these RFCs:
.IP
\(bu Inverse queries
.IP
\(bu Status queries
.IP
\(bu Completion queries
.IP
\(bu Namespaces other than IN (Internet)
.IP
\(bu AXFR and IXFR queries (whole zone transfers); since pdnsd does not maintain zones, that should not violate the standard
.PP
The following record types, that are extensions to the original DNS
standard, are supported if given as options at compile time. (if you
do not need them, you do not need to compile support for them into
pdnsd and save cache and executable space):
.IP
\(bu RP (responsible person, RFC 1183)
.IP
\(bu AFSDB (AFS database location, RFC 1183)
.IP
\(bu X25 (X25 address, RFC 1183)
.IP
\(bu ISDN (ISDN number/address, RFC 1183)
.IP
\(bu RT (route through, RFC 1183)
.IP
\(bu NSAP (Network Service Access Protocol address , RFC 1348)
.IP
\(bu PX (X.400/RFC822 mapping information, RFC 1995)
.IP
\(bu GPOS (geographic position, deprecated)
.IP
\(bu AAAA (IPv6 address, RFC 1886)
.IP
\(bu LOC (location, RFC 1876)
.IP
\(bu EID (Nimrod EID)
.IP
\(bu NIMLOC (Nimrod locator)
.IP
\(bu SRV (service record, RFC 2782)
.IP
\(bu ATMA (ATM address)
.IP
\(bu NAPTR (URI mapping, RFC 2168)
.IP
\(bu KX (key exchange, RFC 2230)
.SH SEE ALSO
.PP
.BR pdnsd\-ctl (8),
.BR pdnsd.conf (5),
.BR pppconfig (8),
.BR resolv.conf (5)
.PP
More documentation is available in the \fBdoc/\fP subdirectory of the source,
or in \fB/usr/share/doc/pdnsd/\fP if you are using a binary package.
.SH AUTHORS
\fBpdnsd\fP was originally written by Thomas Moestl,
.UR
<tmoestl@gmx.net>,
.UE
and was extensively revised by Paul A. Rombouts
.UR
<p.a.rombouts@home.nl>
.UE
(for versions 1.1.8b1\-par and later).
.PP
Several others have contributed to \fBpdnsd\fP; see files in the
source or \fB/usr/share/doc/pdnsd/\fP directory.
.PP
This man page was written by Mahesh T. Pai
.UR
<paivakil@yahoo.co.in>
.UE
using the documents in \fB/usr/share/docs/pdnsd/\fP directory for Debian,
but can be used on other distributions too.
.PP
Last revised: 22 Jul 2007 by Paul A. Rombouts.
.SH COPYRIGHT
.PP
This man page is a part of the pdnsd package, and may be distributed
in original or modified form under terms of the GNU General Public
License, as published by the Free Software Foundation; either version
3, or (at your option) any later version.
.PP
You can find a copy of the GNU GPL in the file \fBCOPYING\fP in the source
or the \fB/usr/share/common\-licenses/\fP directory if you are using a
Debian system.

File diff suppressed because it is too large Load Diff

View File

@ -1,143 +0,0 @@
// Sample pdnsd configuration file. Must be customized to obtain a working pdnsd setup!
// Read the pdnsd.conf(5) manpage for an explanation of the options.
// Add or remove '#' in front of options you want to disable or enable, respectively.
// Remove '/*' and '*/' to enable complete sections.
global {
perm_cache=1024;
cache_dir="@cachedir@";
# pid_file = /var/run/pdnsd.pid;
run_as="@def_id@";
server_ip = 127.0.0.1; # Use eth0 here if you want to allow other
# machines on your network to query pdnsd.
status_ctl = on;
# paranoid=on; # This option reduces the chance of cache poisoning
# but may make pdnsd less efficient, unfortunately.
query_method=udp_tcp;
min_ttl=15m; # Retain cached entries at least 15 minutes.
max_ttl=1w; # One week.
timeout=10; # Global timeout option (10 seconds).
neg_domain_pol=on;
udpbufsize=1024; # Upper limit on the size of UDP messages.
}
# The following section is most appropriate if you have a fixed connection to
# the Internet and an ISP which provides good DNS servers.
server {
label= "myisp";
ip = 192.168.0.1; # Put your ISP's DNS-server address(es) here.
# proxy_only=on; # Do not query any name servers beside your ISP's.
# This may be necessary if you are behind some
# kind of firewall and cannot receive replies
# from outside name servers.
timeout=4; # Server timeout; this may be much shorter
# that the global timeout option.
uptest=if; # Test if the network interface is active.
interface=eth0; # The name of the interface to check.
interval=10m; # Check every 10 minutes.
purge_cache=off; # Keep stale cache entries in case the ISP's
# DNS servers go offline.
edns_query=yes; # Use EDNS for outgoing queries to allow UDP messages
# larger than 512 bytes. May cause trouble with some
# legacy systems.
# exclude=.thepiratebay.org, # If your ISP censors certain names, you may
# .thepiratebay.se, # want to exclude them here, and provide an
# .piratebay.org, # alternative server section below that will
# .piratebay.se; # successfully resolve the names.
}
/*
# The following section is more appropriate for dial-up connections.
# Read about how to use pdnsd-ctl for dynamic configuration in the documentation.
server {
label= "dialup";
file = "/etc/ppp/resolv.conf"; # Preferably do not use /etc/resolv.conf
proxy_only=on;
timeout=4;
uptest=if;
interface = ppp0;
interval=10; # Check the interface every 10 seconds.
purge_cache=off;
preset=off;
}
*/
/*
# The servers provided by OpenDNS are fast, but they do not reply with
# NXDOMAIN for non-existant domains, instead they supply you with an
# address of one of their search engines. They also lie about the addresses of
# of the search engines of google, microsoft and yahoo.
# If you do not like this behaviour the "reject" option may be useful.
server {
label = "opendns";
ip = 208.67.222.222, 208.67.220.220;
reject = 208.69.32.0/24, # You may need to add additional address ranges
208.69.34.0/24, # here if the addresses of their search engines
208.67.219.0/24; # change.
reject_policy = fail; # If you do not provide any alternative server
# sections, like the following root-server
# example, "negate" may be more appropriate here.
timeout = 4;
uptest = ping; # Test availability using ICMP echo requests.
ping_timeout = 100; # ping test will time out after 10 seconds.
interval = 15m; # Test every 15 minutes.
preset = off;
}
*/
/*
# This section is meant for resolving from root servers.
server {
label = "root-servers";
root_server = discover; # Query the name servers listed below
# to obtain a full list of root servers.
randomize_servers = on; # Give every root server an equal chance
# of being queried.
ip = 198.41.0.4, # This list will be expanded to the full
192.228.79.201; # list on start up.
timeout = 5;
uptest = query; # Test availability using empty DNS queries.
# query_test_name = .; # To be used if remote servers ignore empty queries.
interval = 30m; # Test every half hour.
ping_timeout = 300; # Test should time out after 30 seconds.
purge_cache = off;
# edns_query = yes; # Use EDNS for outgoing queries to allow UDP messages
# larger than 512 bytes. May cause trouble with some
# legacy systems.
exclude = .localdomain;
policy = included;
preset = off;
}
*/
source {
owner=localhost;
# serve_aliases=on;
file="/etc/hosts";
}
/*
include {file="/etc/pdnsd.include";} # Read additional definitions from /etc/pdnsd.include.
*/
rr {
name=localhost;
reverse=on;
a=127.0.0.1;
owner=localhost;
soa=localhost,root.localhost,42,86400,900,86400,86400;
}
/*
neg {
name=doubleclick.net;
types=domain; # This will also block xxx.doubleclick.net, etc.
}
*/
/*
neg {
name=bad.server.com; # Badly behaved server you don't want to connect to.
types=A,AAAA;
}
*/

View File

@ -1,21 +0,0 @@
# Makefile for converting pdnsd html documentation to text files.
# This file was based on a Makefile originally written by Thomas Moestl
# and adapted by Paul Rombouts.
HTML2TXT=w3m -dump -cols 80 -T text/html
doc: intro.txt manual.txt faq.txt
.PHONY: doc clean
intro.txt: ../html/index.html
sed -e 's/<!--\(nodoc\|notext\)(-->/<!--/g' -e 's/<!--)\(nodoc\|notext\)-->/-->/g' ../html/index.html | $(HTML2TXT) | sed -e 's/[[:blank:]]\+$$//' > intro.txt
manual.txt: ../html/doc.html
sed -e 's/<!--\(nodoc\|notext\)(-->/<!--/g' -e 's/<!--)\(nodoc\|notext\)-->/-->/g' ../html/doc.html | $(HTML2TXT) | sed -e 's/[[:blank:]]\+$$//' > manual.txt
faq.txt: ../html/faq.html
sed -e 's/<!--\(nodoc\|notext\)(-->/<!--/g' -e 's/<!--)\(nodoc\|notext\)-->/-->/g' ../html/faq.html | $(HTML2TXT) | sed -e 's/[[:blank:]]\+$$//' > faq.txt
clean:
@rm -fv intro.txt manual.txt faq.txt

View File

@ -1,227 +0,0 @@
The pdnsd FAQ
Q: There are complete and well-tested name servers around, such as the BIND.
These do also perform caching. Why should I use pdnsd?
pdnsd does not aim to be a complete name server implementation, such as the
BIND. It is optimized for caching, and you can only specify a small subset
of all dns record types pdnsd knows in your local "zone" definitions. This
of course reduces the code size drastically, and such the memory footprint.
There are some features especially interesting for dialin networks,
ordinary (non-server) internet hosts and computers that are often not
connected to to their network, e.g. notebooks (I originally wrote this
program for use with my notebook). These features are:
A:
* permanent disk cache (useful for frequent power-offs/reboots)
* usually smaller memory footprint (depends on cache size) (see next
question)
* offline-detection prevents hangs (e.g. the typical hang on startup of
some Netscape Navigator versions if not dialled in)
* better control about timeouts (also to prevent hangs)
* better control over the cache
* better run-time control
-------------------------------------------------------------------------------
When I look at the process size with ps, top, gtop, or a similar tool, I
Q: see some processes with a total size well above 3.5 MB. This is much more
than e.g. BIND named (about 1.4 MB). Why?
Really, it is not. pdnsd uses multithreading, not multiprocessing. That
means that the processes share most of their process space. In the
LinuxThreads library or NPTL (Native Posix Thread Libary), which are used
by pdnsd on Linux, in fact the total process address space is shared
A: (although the processes have different stacks, these are in one process
address space). You may check this by looking at the at the process sizes
of the pdnsd threads: all should be the same. The effective size that pdnsd
occupies is thus the size of any of the processes, not the sum of those.
So, pdnsd with empty cache occupies about 800 kB, and the maximum size
should be about the cache size plus this size (in fact, ca 5-10% more).
-------------------------------------------------------------------------------
Q: What do I need the status control (option -s) for?
It enables you to do some things you might or might not need. With it, you
can:
* query pdnsd's settings at runtime to debug configuration files and see
which servers are regarded to be available
A: * mark servers as available or unavailable, or force a status retest -
very handy if you want to control which servers pdnsd queries, e.g for
muliple dial-up accounts
* delete, invalidate or add DNS records - useful e.g. when you want to
build records for dynamically assigned IP addresses or domain names
* reload pdnsd's configuration file without restarting pdnsd
* print information about the contents of pdnsd's cache.
-------------------------------------------------------------------------------
Q: What do I need local records (rr- and source-sections in the config file)
for?
Some resolver programs, e.g. nslookup, want to look up the name of the
server they are using before doing anything else. This option is for
defining a PTR record for your IP such that those programs get an answer
even if the name server you are caching is not available or does not offer
these records. By extension, you may also define A and SOA records. This
allows you to build very small zones without having to use a "big" name
server. It is NOT intended to replace such a complete server in anything
but VERY small networks. Alternatively, you may start a named on another
host or on the same host on another port and cache it with pdnsd in
addition to other (more distant) name servers.
A: The source section allows you to let pdnsd read in your /etc/hosts file on
startup and serve its contents. This file is used by your local resolver
before it even tries the name servers and usually contains fully-qualified
domain names (FQDNs) for all of the internet addresses your host has. If
you source this file, you usually won't need any additional rr sections.
Sourcing it also allows other hosts (eg. in your local network) to access
the names defined in your hosts file. You can of course just add other
hosts in your local network to the servers hosts file, thus making them
known to your server's resolver and pdnsd (if you sourced that file).
If you don't know what this answer was all about, you should just take the
source section in the sample config file that comes with pdnsd, copy it
into your config file and forget about it.
-------------------------------------------------------------------------------
When compiling, I get an error message like
Q: Please define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN
What's up?
Normally, this macros should be defined in your C library's header files.
There are two different methods, most C libraries support both (and pdnsd
honors both): either __BYTE_ORDER is set to __LITTLE_ENDIAN or
__BIG_ENDIAN, or __LITTLE_ENDIAN or __BIG_ENDIAN are directly defined as
macros.
Linux glibc, for example, does set those macros correctly. Never mind. You
just have to know whether your machine is little-endian or big-endian, this
means wheter your machine saves the least significant byte of a word or
double-word first in memory (little-endian) or the most significant first
A: (big-endian). All intel x86 and Alpha machines are little-endian, for
example, while SPARC and PowerPC architectures are big-endian. If your
machine is little-endian, add the following line to your config.h:
#define __BYTE_ORDER __LITTLE_ENDIAN
Likewise, if your machines byte order is big-endian:
#define __BYTE_ORDER __BIG_ENDIAN
Pathological byte orders like pdp-endian are not yet supported really;
However, for the place the endianess is needed, __LITTLE_ENDIAN should do
(it deals only with 16 bits; for all other occurances, ntoh[sl]/hton[sl] is
used).
-------------------------------------------------------------------------------
At startup, I get a warning saying:
Q: Uptest command [...] will implicitly be executed as root
What does that mean?
This warning only occurs if you use the uptest=exec option in your
configuration. It means that the uptest command is run as root because
pdnsd is running as root, and this was not explicitely specified. The idea
is that it may introduce security holes (in the programs being run) when
A: they run as root, and so they shouldn't do that if possible. You can
specify the user that shall run the command by appending its name
comma-separated as string to the uptest_cmd line:
uptest_cmd="<your command>","<user>";
If it is correctly running as root, just append the user string "root" to
the command and the warning will not occur again.
-------------------------------------------------------------------------------
Q: I cannot run my uptest_cmd command as root (it says permission denied),
although the pdnsd executable is setuid root. Why?
pdnsd will drop privileges gained through setuid/setgid before executing
the uptest commands (you shouldn't set the pdnsd executable setuid/setgid
A: anyway). The reason is clear: if you install the pdnsd executable as setuid
root and this wouln't be done, any user could execute shellcode with root
privileges using that option!
-------------------------------------------------------------------------------
At startup, I get an error saying:
Q: Bad config file permissions: the file must be only writeable by the user
Why is that?
pdnsd has an option (uptest=exec) that allows the execution of arbitrary
shell code (for testing whether an interface is up). This must be of course
secured against unauthorized use. One of these protection is the one that
produces the error message: if you routinely run pdnsd, e.g. at system
startup, and your config file is editable for others, someone could change
A: it and insert shell code that is executed in the next pdnsd run -- with
your user privileges! To prevent this, pdnsd will exit if the config file
is writeable by others than the owner. To get rid of this message, just do
chmod go-w <filename>
on your config file (for the default file: chmod go-w /etc/pdnsd.conf). You
should also check that the ownership is set correct.
-------------------------------------------------------------------------------
Q: serve_aliases does not seem to work.
Some resolvers (e.g. of the glibc 2.1) seem sometimes not to look up
unmodified names, but the names with an entry of the search path already
A: appended. Since pdnsd will serve short names with this option anyway, you
can delete the search an domain options from your /etc/resolv.conf. This is
reported to work in some cases.
-------------------------------------------------------------------------------
Q: Some queries for domains that have many records (e.g. www.gmx.de) fail
mysteriously.
pdnsd versions prior to 1.1.0 had the tcp server thread disabled by
default. Most resolvers repeat their query using tcp when they receive a
A: truncated answer (the answer is truncated when it exceeds a length of 512
bytes). You need to recompile pdnsd with the option --enable-tcp-server to
fix this.
-------------------------------------------------------------------------------
I am behind some kind of firewall. In the configuration file I have only
Q: listed addresses of name servers on the local (ISP's) network, but pdnsd is
slow and DNS queries frequently time out.
In some cases pdnsd will not consider the answer of the local name server
authoritative enough, and will try to get answers from the name servers
listed in the authority section of the reply message. If pdnsd is behind a
firewall that blocks the UDP reply packets from remote name servers, pdnsd
will wait in vain for a reply. One solution is to set proxy_only=on in the
A: servers sections of the configuration file. This will prevent pdnsd from
querying name servers that are not listed in the configuration file.
Another solution that can be tried is specifying query_method=tcp_only in
the global section of the configuration file, because a firewall that
blocks UDP packets from outside might still allow outgoing TCP connections
to port 53.
-------------------------------------------------------------------------------
Q: Is pdnsd vulnerable to DNS cache poisoning as described in CERT
vulnerability note VU#800113?
Short answer: Yes.
Somewhat longer answer: The problem is not so much that pdnsd's
implementation is flawed but rather that the DNS protocol currently being
used is fundamentally flawed from a security viewpoint. As long as a more
secure protocol is not in place, all that the developers of pdnsd can do is
to try to tweak the current implementation to make it as difficult as
possible for an attacker to succeed.
From version 1.2.7 onwards, the default for the query_port_start option is
A: 1024, which means that the pdnsd resolver will randomly select source ports
in the range 1024-65535. (In previous versions the default was to let the
kernel select the source ports, which will often result in a more or less
predictable sequence of ports.) It also helps to use a good quality source
of random numbers. On platforms where this is supported, it is preferable
to configure with --with-random-device=/dev/urandom. There is still more
that can be done to make pdnsd less vulnerable, but this remains (as of
this writing) a work in progress.
Please note that pdnsd was designed for small (private) networks, and that
it is generally not recommended to let untrusted users access pdnsd.
-------------------------------------------------------------------------------
Thomas Moestl and Paul Rombouts
Last revised: 18 August 2008 by Paul Rombouts

View File

@ -1,305 +0,0 @@
-------------------------------------------------------------------------------
About pdnsd
pdnsd is a proxy DNS server with permanent caching (the cache contents are
written to hard disk on exit) that is designed to cope with unreachable or down
DNS servers (for example in dial-in networking).
Since version 1.1.0, pdnsd supports negative caching.
It is licensed under the GNU General Public License (GPL). This, in short,
means that the sources are distributed togehter with the program, and that you
are free to modify the sources and redistribute them as long as you also
license them under the GPL. You do not need to pay anything for pdnsd. It also
means that there is ABSOLUTELY NO WARRANTY for pdnsd or any part of it. For
details, please read the GPL.
pdnsd can be used with applications that do DNS lookups, e.g. on startup, and
can't be configured to change that behaviour, to prevent the often minute-long
hangs (or even crashes) that result from stalled DNS queries. Some Netscape
Navigator versions for Unix, for example, expose this behaviour.
pdnsd is configurable via a file and supports run-time configuration using the
program pdnsd-ctl that comes with pdnsd. This allows you to set the status
flags of servers that pdnsd knows (to influence which servers pdnsd will
query), and the addition, deletion and invalidation of DNS records in pdnsd's
cache.
Parallel name server queries are supported. This is a technique that allows
querying several servers at the same time so that very slow or unavailable
servers will not block the answer for one timeout interval.
Since version 1.0.0, pdnsd has full IPv6 support.
There is also a limited support for local zone records, intended for defining
1.0.0.127.in-addr.arpa. and localhost. , since some clients request that
information and it must be served even if the cached servers are not available
or do not serve these records. pdnsd may also read your /etc/hosts file (this
file is normally used by your local resolver and usually contains information
for localhost as well as for your machines FQDN) and serve its contents.
pdnsd was started on Linux, and has since been ported to FreeBSD (and Cygwin
and Darwin). 90% of the source code should be easily portable to POSIX- and
BSD-compatible systems, provided that those systems support the POSIX threads
(pthreads). The rest might need OS-specific rewrites.
Currently, pdnsd is only compileable by gcc. This should be easy to fix, but I
just do not have documentation for other compilers. If you are not able or do
not want to use gcc, I would recommend you just try to do the minor changes.
pdnsd must be started as root in some cases (raw sockets are needed for icmp
echoes for the option uptest=ping, and the default port is 53, this must be >
1024 to allow non-root execution). However, pdnsd can be configured to change
it's user and group id to those of a non-privileged user after opening the
sockets needed for this.
The server should support the full standard DNS queries following the rfcs 1034
and 1035. As of version 1.0.0, the rfc compliance has been improved again, and
pdnsd is now believed (or hoped?) to be fully rfc-compatible. It completely
follows rfc 2181 (except for one minor issue in the FreeBSD port, see the
documentation). It does not support the following features, of which most are
marked optional, experimental or obsolete in these rfcs:
* Inverse queries
* Status queries
* Completion queries
* Namespaces other than IN (Internet)
* AXFR and IXFR queries (whole zone transfers); since pdnsd does not maintain
zones, that should not violate the standard
The following record types, that are extensions to the original DNS standard,
are supported for caching since version 1.2.9 (if you do not need most of them,
you can disable runtime support for the unneeded ones before compiling pdnsd
and save a little cache and executable space, see the source file src/
rr_types.in):
* RP (responsible person, RFC 1183)
* AFSDB (AFS database location, RFC 1183)
* X25 (X25 address, RFC 1183)
* ISDN (ISDN number/address, RFC 1183)
* RT (route through, RFC 1183)
* NSAP (Network Service Access Protocol address , RFC 1348)
* PX (X.400/RFC822 mapping information, RFC 1995)
* GPOS (geographic position, deprecated)
* AAAA (IPv6 address, RFC 1886)
* LOC (location, RFC 1876)
* EID (Nimrod EID)
* NIMLOC (Nimrod locator)
* SRV (service record, RFC 2782)
* ATMA (ATM address)
* NAPTR (URI mapping, RFC 2168)
* KX (key exchange, RFC 2230)
* CERT (Certificate record, RFC 4398)
* DS (Delegation Signer, RFC 4034)
* RRSIG (Resource Record Signature, RFC 4034)
* NSEC (Next Secure, RFC 4034)
* DNSKEY (record containing the public key for a zone, RFC 4034)
* NSEC3 (Next Secure version 3, RFC 5155)
* NSEC3PARAM (NSEC3 parameters, RFC 5155)
Note: This list is incomplete. For the complete list see the source file src/
rr_types.in.
There are FreeBSD and OpenBSD ports available for pdnsd (ports/net/pdnsd for
both). Thanks go to Roman Shterenzon for the FreeBSD port Sebastian Stark for
the OpenBSD one! Thanks to Kiyo Kelvin Lee now also runs on the Cygwin
platform! Thanks goes to Rodney Brown for extending portability to the Darwin
(Apple Mac OS X) platform!
If you have questions left, you should take a look into the FAQ.
Bugfixes, patches and compatability fixes for other OSs are very welcome!
Features in detail
This section describes some of pdnsds features in detail. Most of the options
are set in the config file. For more information on the configuration file, see
the documenation page.
Uptests
pdnsd provides several methods to test whether a remote DNS server should be
regarded as available (so that pdnsd can query it), in addition to the obvious
"none" test (the server is always regarded as available, or availability is set
on or off using the pdnsd-ctl utility). These tests are:
* ping: a given adress is ping'ed in a given interval. If it there is no
response or the host is unreachable, the server is seen to be not available
(for those who don't know: pinging is sending a certain Internet packet
type to a host to which any standard-conformant host is required to reply).
* if: a given network interface is tested whether it is existent, up and
running. If it is not, the server is regarded to be not available. This is
especially useful for ppp and similar interfaces. A special case test for
Linux isdn (ippp*) interfaces is integrated, so that the uptests should
also work for these.
* dev: this is a variant of the if uptest for use with Linux dial-on-demand
ppp interfaces. In addition to performing an if-style interface uptest, it
also tests whether a specified program (e.g. pppd) owns a lock to a given
(modem-) device.
* exec: a given shell command line is executed and the exit status of the
whole command line (which is normally the exit status of the last command)
is evaluated. If it is not zero, the server is regarded to be not
available. This is a very flexible testing method with which it should be
able to perform virtually any needed test.
* query: New in version 1.2: This works like the ping test, except it sends
an (empty) DNS query to the remote server. If the server sends a
well-formed response back within the timeout period (except SERVFAIL), it
will be regarded as available. This test is useful if a remote server does
not respond to ICMP_ECHO requests at all, which unfortunately is quite
common these days. In many cases this test will be a more reliable
indicator of availability than the ones mentioned above.
Local Records ("Zones")
As mentioned above, there are only very basic local record types (ie the record
types that you may use in record declarations in your local configuration for
records that pdnsd shall serve in addion to the cached ones). They are
organized roughly in zones but have not complete zone declarations, so I
generally do not use the term "zone" for them, but rather "local records".
These are the local record types pdnsd can understand:
* SOA (information about the name server)
* A (domain-name-to-address mapping)
* PTR (pointer, used normally for address-to-domain-name mapping)
* NS (name server, generated automatically by pdnsd for any local record set)
* CNAME (canonical host name)
* MX (mail exchange for the domain)
* TXT (arbitrary text strings, often used for Sender Policy Framework)
You can specify these records in the configuration file.
You may "source" a file in a format like that used in the /etc/hosts file, that
means that pdnsd reads this file, extracts addresses and domain names from it
and automatically generates A records for name to address mapping, PTR records
for address to name mapping and NS records (name server specifiation) for each
entry in the file.
Records can also be changed dynamically at run time.
A script contributed by Marko Stolle makes pdnsd usable in a DHCP setup using
this feature.
System requirements
As mentioned, pdnsd currently runs under Linux, FreeBSD and Cygwin. Other BSD
flavours may or may not work (feedback is very welcome!). The system and
software requirements under Linux are:
* Kernel version >2.2.0
* glibc version >2.0.1 (aka libc6) with LinuxThreads (normally included) or
NPTL (Native Posix Thread Library, recommended).
Due to a bug, pdnsd 0.9.8 does not run with glibc2.1.1. This behaviour was
fixed in pdnsd 0.9.9.
* For IPv6: glibc>=2.1
The system requirements under FreeBSD are:
* FreeBSD versions >=2.6 (prior ones may or may not work)
* For IPv6: FreeBSD >=4.0 is recommended (no idea if it runs on prior
versions)
The common software requirements for all supported systems are:
* GCC, preferably egcs-2.* or 3.* (other compilers are currently not
supported; the needed patch for another compiler should not be difficult,
however)
* GNU or BSD make
* the standard commands install, grep, sed, awk, touch and which (along with
the REALLY standard ones mv, cp, ln, rm, pwd, test, echo, cat, mkdir,
chown, chmod, tar). In any standard Unix installation, this should be no
problem.
* for hacking and building own packages, you might also need gzip, bzip2,
perl and rpmbuild
Download
If you want to download pdnsd, please visit the download page.
Authors
pdnsd was originally written by Thomas Moestl, but is no longer maintained by
him. Paul A. Rombouts has revised large portions of the code and has added a
number of new features. See README.par and the ChangeLog in the source
directory (or /usr/share/doc/pdnsd-<version> if you have installed a binary
package) for more details. If you have questions about the recent
modifications, you can find the email address of the current maintainer at the
end of README.par.
Daniel Smolik has contributed RedHat RPMs (the most recent RPMs are available
here).
Torben Janssen contributed start scripts for Red Hat Linux.
Soenke J. Peters contributed patches and suggestions for Red Hat compatability.
Wolfgang Ocker has contributed the code and documentation for the server_ip
option.
Markus Mohr contributed a Debian rc script.
Nikita V. Youschenko contributed extensions to the "if" uptest.
Lyonel Vincent extended the serve_aliases option to support an arbitrary number
of aliases.
Sourav K. Mandal wrote the autoconf scripts and contributed many fixes and
suggestions.
Stephan Boettcher contributed the SCHEME= option.
Ron Yorston contributed the uptest for Linux ppp dial-on-demand devices.
Alexandre Nunes fixed some bugs in the autoconf files.
Sverker Wiberg contributed fixes for IPv6.
Carsten Block contributed configure-able rc scripts.
Olaf Kirch contributed a security fix for the run_as code.
Paul Wagland contributed various patches for bind9-compatability and other
issues.
Roman Shterenzon contributed patches and lots of helpful hints for FreeBSD
compatability.
Bernd Leibing has contributed spec file fixes.
Michael Wiedmann has contributed the pdnsd-ctl.8 man page.
Marko Stolle has contributed the contrib/pdnsd_update.pl script that makes
pdnsd usable in a DHCP setup.
P.J. Bostley has contributed patches to get pdnsd working on alpha properly.
Christian Engstler contributed patches for SuSE compatability.
Bjoern Fischer contributed code to make pdnsd leave the case of names in the
cache unchanged.
Marko Stolle contributed the contrib/pdnsd_update.pl script that makes pdnsd
usable in a DHCP setup.
Andrew M. Bishop contributed the support for the label server option and the
pdnsd-ctl interface for using it.
Frank Elsner contributed rc script fixes.
Andreas Steinmetz contributed the code for query_port_start and query_port_end
options.
Mahesh T. Pai contributed the pdnsd.8 man page.
Nikola Kotur contributed the Slackware start-up script.
Kiyo Kelvin Lee contributed a patch for Cygwin support.
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
Jan-Marek Glogowski contributed a patch implementing the use_nss option.
Special thanks to Bert Frederiks for letting me do a late-night debugging run
on his machine to spot obscure bugs!
Thanks to the following persons for reporting bugs and being helpful:
David G. Andersen,
Dirk Armbrust,
Daniel Black,
Kevin A. Burton,
Juliusz Chroboczek,
Joachim Dorner,
Stefan Erhardt,
Stefan F?rster,
Mike Hammer,
Jonathan Hudson,
Dan Jacobson,
Byrial Jensen,
Patrick Loschmidt,
James MacLean,
Fraser McCrossan,
Michael M?ller,
Erich Reitz,
Brian Schroeder,
Milan P. Stanic,
Michael Steiner,
Norbert Steinl,
Markus Storm,
Michael Str?der,
Alan Swanson,
Eelco Vriezekolk.
-------------------------------------------------------------------------------
Thomas Moestl and Paul A. Rombouts
Last revised: 17 March 2012 by Paul A. Rombouts

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
%defattr(-,root,root)
%doc AUTHORS THANKS COPYING COPYING.BSD ChangeLog ChangeLog.old INSTALL NEWS README README.par README.par.old TODO
%config /etc/pdnsd.conf.sample
%attr(750, @def_id@, @def_id@) %dir @cachedir@
%attr(640, @def_id@, @def_id@) %config @cachedir@/pdnsd.cache

View File

@ -1,323 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,360 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-06-08.21
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,244 +0,0 @@
# rpmbuild spec file for pdnsd.
# with modifications by Paul Rombouts.
# Supported rpmbuild --define and --with options include:
#
# --with isdn Configure with --enable-isdn.
#
# --without poll Configure with --disable-poll
#
# --without nptl Configure with --with-thread-lib=linuxthreads.
#
# --with ipv6 Configure with --enable-ipv6.
#
# --without tcpqueries Configure with --disable-tcp-queries.
#
# --without debug Configure with --with-debug=0.
#
# --define "distro <distro>" Configure with --with-distribution=<distro>.
#
# --define "run_as_user <user>" Configure with --with-default-id=<user>.
# For RPMs the default <user> is "@def_id@".
#
# --define "run_as_uid <uid>" If the user defined by the previous option does not exist
# when the RPM is installed, the pre-install script will try
# to create a new user with numerical id <uid>.
#
# --define "cachedir <dir>" Configure with --with-cachedir=<dir>.
#
%{!?distro: %define distro @distribution@}
# The default run_as ID to use
%{!?run_as_user: %define run_as_user @def_id@}
# By default, if a new run_as_user is to be created, we let
# useradd choose the numerical uid, unless run_as_uid is defined.
#define run_as_uid 96
%{!?cachedir: %define cachedir @cachedir@}
%define conffile %{_sysconfdir}/pdnsd.conf
Summary: A caching dns proxy for small networks or dialin accounts
Name: @PACKAGE@
Version: @VERSION@
Release: @packagerelease@
License: GPLv3
Group: Daemons
Source: http://members.home.nl/p.a.rombouts/pdnsd/releases/%{name}-%{version}-%{release}.tar.gz
URL: http://members.home.nl/p.a.rombouts/pdnsd.html
Vendor: Paul A. Rombouts
Packager: Paul A. Rombouts <p.a.rombouts@home.nl>
Prefix: %{_prefix}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
pdnsd is a proxy DNS daemon with permanent (disk-)cache and the ability
to serve local records. It is designed to detect network outages or hangups
and to prevent DNS-dependent applications like Netscape Navigator from hanging.
The original author of pdnsd is Thomas Moestl, but pdnsd is no longer maintained
by him. This is an extensively revised version by Paul A. Rombouts.
For a description of the changes see http://members.home.nl/p.a.rombouts/pdnsd.html
and the file README.par in %{_docdir}/%{name}-%{version}
%{!?distro:You can specify the target distribution when you build the source RPM. For instance, if you're building for a Red Hat system call rpmbuild with:}
%{!?distro: --define "distro RedHat"}
%{?distro:This package was built for a %{distro} distribution.}
%{!?_with_isdn:It's possible to rebuild the source RPM with isdn support using the rpmbuild option:}
%{!?_with_isdn: --with isdn}
%{?_with_isdn:This package was built with isdn support enabled.}
%{!?_with_ipv6:It's possible to rebuild the source RPM with ipv6 support using the rpmbuild option:}
%{!?_with_ipv6: --with ipv6}
%{?_with_ipv6:This package was built with ipv6 support.}
%{?_without_poll:This package was built with the select(2) function instead of poll(2).}
%prep
%setup
%build
CFLAGS="${CFLAGS:-$RPM_OPT_FLAGS -Wall}" ./configure \
--prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --mandir=%{_mandir} \
--with-cachedir="%{cachedir}" \
%{?distro:--with-distribution=%{distro}} --enable-specbuild \
--with-default-id=%{run_as_user} \
%{?_with_isdn:--enable-isdn} \
%{?_without_poll:--disable-poll} \
%{?_without_nptl:--with-thread-lib=linuxthreads} \
%{?_with_ipv6:--enable-ipv6} \
%{?_without_tcpqueries:--disable-tcp-queries} \
%{?_without_debug:--with-debug=0}
make
%install
%if "%{run_as_user}" != "nobody"
[ "$(id -un)" != root ] ||
id -u %{run_as_user} > /dev/null 2>&1 ||
/usr/sbin/useradd -c "Proxy DNS daemon" %{?run_as_uid:-u %{run_as_uid}} \
-s /sbin/nologin -r -d "%{cachedir}" %{run_as_user} || {
set +x
echo "Cannot create user \"%{run_as_user}\"%{?run_as_uid: with uid=%{run_as_uid}}"
echo "Please select another numerical uid and rebuild with --define \"run_as_uid uid\""
echo "or create a user named \"%{run_as_user}\" by hand and try again."
exit 1
}
%endif
rm -rf "$RPM_BUILD_ROOT"
make DESTDIR="$RPM_BUILD_ROOT" install
cp -f file-list.base file-list
find doc contrib -not -type d -not -iname '*makefile' -not -name '*.am' \
-not -name '*.in' -not -path 'doc/*.pl' |
sed -e 's/^/%doc --parents /' >> file-list
CURDIR=$PWD; cd "$RPM_BUILD_ROOT"
find . -not -type d '(' -not -name 'pdnsd.conf*' -or -name 'pdnsd.conf.[1-9]*' ')' \
-not -path '.%{_docdir}/*' -not -path './var/*' |
sed -e 's/^\.//
\:/man:{
/\.gz$/!s/$/.gz/
}' >> "$CURDIR/file-list"
%clean
rm -rf "$RPM_BUILD_ROOT"
#rm -rf %{_builddir}/%{name}-%{srcver}
%files -f file-list
%pre
# First stop any running pdnsd daemons
%if "%{distro}" == "SuSE"
/sbin/init.d/pdnsd stop >/dev/null 2>&1
%endif
%if "%{distro}" == "RedHat"
if [ -f /var/lock/subsys/pdnsd ]; then
if /sbin/pidof pdnsd > /dev/null; then
/sbin/service pdnsd stop >/dev/null 2>&1
if [ "$1" -ge 2 ]; then touch /var/lock/subsys/pdnsd; fi
else
rm -f /var/lock/subsys/pdnsd
fi
fi
%endif
%if "%{run_as_user}" != "nobody"
# Add the "pdnsd" user
id -u %{run_as_user} > /dev/null 2>&1 ||
/usr/sbin/useradd -c "Proxy DNS daemon" %{?run_as_uid:-u %{run_as_uid}} \
-s /sbin/nologin -r -d "%{cachedir}" %{run_as_user} || {
echo "Cannot create user \"%{run_as_user}\"%{?run_as_uid: with uid=%{run_as_uid}}"
echo "Please create a user named \"%{run_as_user}\" by hand and try again."
exit 1
}
[ "$(id -gn %{run_as_user})" = %{run_as_user} ] || {
echo "user \"%{run_as_user}\" does not have an corresponding group called \"%{run_as_user}\""
echo "Please change the initial group of user \"%{run_as_user}\" to \"%{run_as_user}\" and try again."
exit 1
}
if [ -f "%{conffile}" ] &&
grep -v -e '^[[:blank:]]*\(#\|\/\/\)' "%{conffile}" |
grep -q -e '\<run_as[[:blank:]]*=[[:blank:]]*"\?nobody"\?[[:blank:]]*;'
then
echo "An existing pdnsd configuration file %{conffile} has been detected, containing the run_as user ID \"nobody\""
echo "For security reasons it is recommended that pdnsd run as a seperate user \"%{run_as_user}\""
mv -f "%{conffile}" "%{conffile}.rpmsave" &&
echo "Your original %{conffile} has been saved as %{conffile}.rpmsave" &&
sed -e '/^[[:blank:]]*\(#\|\/\/\)/!s/\(\<run_as[[:blank:]]*=[[:blank:]]*\)"\?nobody"\?[[:blank:]]*;/\1"%{run_as_user}";/g' \
"%{conffile}.rpmsave" > "%{conffile}" &&
echo "In %{conffile} runs_as=\"nobody\" has been replaced by run_as=\"%{run_as_user}\""
fi
%endif
if [ -f "%{cachedir}/pdnsd.cache" ]; then
chown -c %{run_as_user}:%{run_as_user} "%{cachedir}/pdnsd.cache"
fi
%post
%if "%{distro}" == "SuSE"
if [ -w /etc/rc.config ]; then
grep "START_PDNSD" /etc/rc.config > /dev/null
if [ $? -ne 0 ] ; then
echo -e \
"\n\n#\n# Set to yes to start pdnsd at boot time\n#\nSTART_PDNSD=yes" \
>> /etc/rc.config
fi
fi
%endif
%if "%{distro}" == "RedHat"
if [ "$1" = 1 ]; then
/sbin/chkconfig --add pdnsd
fi
%endif
%preun
%if "%{distro}" == "RedHat"
if [ "$1" = 0 ]; then
/sbin/service pdnsd stop >/dev/null 2>&1
/sbin/chkconfig --del pdnsd
fi
%endif
%postun
%if "%{distro}" == "RedHat"
if [ "$1" -ge 1 ]; then
/sbin/service pdnsd condrestart >/dev/null 2>&1
fi
%endif
%changelog
* Tue Jan 31 2012 Paul A. Rombouts <p.a.rombouts@home.nl>
- Prevent makefiles and perl scripts from being installed
in the documentation directory.
* Sat Jan 28 2012 Paul A. Rombouts <p.a.rombouts@home.nl>
- Update the (Source) URLs.
* Sat Aug 4 2007 Paul Rombouts <p.a.rombouts@home.nl>
- License is now GPL version 3
* Fri Mar 24 2006 Paul Rombouts <p.a.rombouts@home.nl>
- Instead of using a fixed default value for run_as_uid,
I let useradd choose the uid if run_as_uid is undefined.
* Thu Dec 29 2005 Paul Rombouts <p.a.rombouts@home.nl>
- TCP-query support is now compiled in by default,
but can be disabled using "--without tcpqueries".
* Sun Jul 20 2003 Paul Rombouts <p.a.rombouts@home.nl>
- Changed default run_as ID from "nobody" to "pdnsd"
* Fri Jun 20 2003 Paul Rombouts <p.a.rombouts@home.nl>
- Added configuration option for NPTL.
* Sat Jun 07 2003 Paul Rombouts <p.a.rombouts@home.nl>
- Added automatic definition of distro using _vendor macro.
* Thu May 22 2003 Paul Rombouts <p.a.rombouts@home.nl>
- Ensured that modification times of acconfig.h and configure.in
are not changed by patching to avoid unwanted reconfigure during make phase.
* Tue May 20 2003 Paul Rombouts <p.a.rombouts@home.nl>
- Applied my customized patch file. See READ.par for details.
* Sun May 16 2001 Thomas Moestl <tmoestl@gmx.net>
- Make use of chkconfig for Red Hat (patch by Christian Engstler)
* Sun Mar 25 2001 Thomas Moestl <tmoestl@gmx.net>
- Merged SuSE fixes by Christian Engstler
* Fri Feb 09 2001 Thomas Moestl <tmoestl@gmx.net>
- Merged in a spec fix for mapage inclusion contributed by Sourav K.
Mandal
* Sun Nov 26 2000 Thomas Moestl <tmoestl@gmx.net>
- Added some patches contributed by Bernd Leibing
* Tue Aug 15 2000 Thomas Moestl <tmoestl@gmx.net>
- Added the distro for configure
* Tue Jul 11 2000 Sourav K. Mandal <smandal@mit.edu>
- autoconf/automake modifications

View File

@ -1,24 +0,0 @@
sbin_PROGRAMS = pdnsd
pdnsd_CFLAGS = -DCONFDIR='"$(sysconfdir)"' $(thread_CFLAGS)
pdnsd_SOURCES = conf-parser.c conff.c consts.c debug.c dns.c dns_answer.c \
dns_query.c error.c helpers.c icmp.c list.c main.c netdev.c rr_types.c \
status.c servers.c thread.c cache.c hash.c conf-parser.h \
conf-keywords.h conff.h consts.h debug.h dns.h dns_answer.h \
dns_query.h error.h helpers.h icmp.h ipvers.h list.h netdev.h \
rr_types.h servers.h status.h thread.h cache.h hash.h pdnsd_assert.h \
freebsd_netinet_ip_icmp.h
EXTRA_DIST = make_rr_types_h.pl rr_types.in
## Try to do this last
SUBDIRS = . pdnsd-ctl rc test
$(pdnsd_OBJECTS): rr_types.h
rr_types.h: make_rr_types_h.pl rr_types.in
perl make_rr_types_h.pl rr_types.in > rr_types.h

View File

@ -1,921 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
sbin_PROGRAMS = pdnsd$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)"
PROGRAMS = $(sbin_PROGRAMS)
am_pdnsd_OBJECTS = pdnsd-conf-parser.$(OBJEXT) pdnsd-conff.$(OBJEXT) \
pdnsd-consts.$(OBJEXT) pdnsd-debug.$(OBJEXT) \
pdnsd-dns.$(OBJEXT) pdnsd-dns_answer.$(OBJEXT) \
pdnsd-dns_query.$(OBJEXT) pdnsd-error.$(OBJEXT) \
pdnsd-helpers.$(OBJEXT) pdnsd-icmp.$(OBJEXT) \
pdnsd-list.$(OBJEXT) pdnsd-main.$(OBJEXT) \
pdnsd-netdev.$(OBJEXT) pdnsd-rr_types.$(OBJEXT) \
pdnsd-status.$(OBJEXT) pdnsd-servers.$(OBJEXT) \
pdnsd-thread.$(OBJEXT) pdnsd-cache.$(OBJEXT) \
pdnsd-hash.$(OBJEXT)
pdnsd_OBJECTS = $(am_pdnsd_OBJECTS)
pdnsd_LDADD = $(LDADD)
pdnsd_LINK = $(CCLD) $(pdnsd_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(pdnsd_SOURCES)
DIST_SOURCES = $(pdnsd_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pdnsd_CFLAGS = -DCONFDIR='"$(sysconfdir)"' $(thread_CFLAGS)
pdnsd_SOURCES = conf-parser.c conff.c consts.c debug.c dns.c dns_answer.c \
dns_query.c error.c helpers.c icmp.c list.c main.c netdev.c rr_types.c \
status.c servers.c thread.c cache.c hash.c conf-parser.h \
conf-keywords.h conff.h consts.h debug.h dns.h dns_answer.h \
dns_query.h error.h helpers.h icmp.h ipvers.h list.h netdev.h \
rr_types.h servers.h status.h thread.h cache.h hash.h pdnsd_assert.h \
freebsd_netinet_ip_icmp.h
EXTRA_DIST = make_rr_types_h.pl rr_types.in
SUBDIRS = . pdnsd-ctl rc test
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
pdnsd$(EXEEXT): $(pdnsd_OBJECTS) $(pdnsd_DEPENDENCIES)
@rm -f pdnsd$(EXEEXT)
$(pdnsd_LINK) $(pdnsd_OBJECTS) $(pdnsd_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-conf-parser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-conff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-consts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-debug.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-dns.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-dns_answer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-dns_query.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-hash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-helpers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-icmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-list.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-netdev.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-rr_types.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-servers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-status.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-thread.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
pdnsd-conf-parser.o: conf-parser.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-conf-parser.o -MD -MP -MF $(DEPDIR)/pdnsd-conf-parser.Tpo -c -o pdnsd-conf-parser.o `test -f 'conf-parser.c' || echo '$(srcdir)/'`conf-parser.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-conf-parser.Tpo $(DEPDIR)/pdnsd-conf-parser.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conf-parser.c' object='pdnsd-conf-parser.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-conf-parser.o `test -f 'conf-parser.c' || echo '$(srcdir)/'`conf-parser.c
pdnsd-conf-parser.obj: conf-parser.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-conf-parser.obj -MD -MP -MF $(DEPDIR)/pdnsd-conf-parser.Tpo -c -o pdnsd-conf-parser.obj `if test -f 'conf-parser.c'; then $(CYGPATH_W) 'conf-parser.c'; else $(CYGPATH_W) '$(srcdir)/conf-parser.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-conf-parser.Tpo $(DEPDIR)/pdnsd-conf-parser.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conf-parser.c' object='pdnsd-conf-parser.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-conf-parser.obj `if test -f 'conf-parser.c'; then $(CYGPATH_W) 'conf-parser.c'; else $(CYGPATH_W) '$(srcdir)/conf-parser.c'; fi`
pdnsd-conff.o: conff.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-conff.o -MD -MP -MF $(DEPDIR)/pdnsd-conff.Tpo -c -o pdnsd-conff.o `test -f 'conff.c' || echo '$(srcdir)/'`conff.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-conff.Tpo $(DEPDIR)/pdnsd-conff.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conff.c' object='pdnsd-conff.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-conff.o `test -f 'conff.c' || echo '$(srcdir)/'`conff.c
pdnsd-conff.obj: conff.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-conff.obj -MD -MP -MF $(DEPDIR)/pdnsd-conff.Tpo -c -o pdnsd-conff.obj `if test -f 'conff.c'; then $(CYGPATH_W) 'conff.c'; else $(CYGPATH_W) '$(srcdir)/conff.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-conff.Tpo $(DEPDIR)/pdnsd-conff.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conff.c' object='pdnsd-conff.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-conff.obj `if test -f 'conff.c'; then $(CYGPATH_W) 'conff.c'; else $(CYGPATH_W) '$(srcdir)/conff.c'; fi`
pdnsd-consts.o: consts.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-consts.o -MD -MP -MF $(DEPDIR)/pdnsd-consts.Tpo -c -o pdnsd-consts.o `test -f 'consts.c' || echo '$(srcdir)/'`consts.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-consts.Tpo $(DEPDIR)/pdnsd-consts.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='consts.c' object='pdnsd-consts.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-consts.o `test -f 'consts.c' || echo '$(srcdir)/'`consts.c
pdnsd-consts.obj: consts.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-consts.obj -MD -MP -MF $(DEPDIR)/pdnsd-consts.Tpo -c -o pdnsd-consts.obj `if test -f 'consts.c'; then $(CYGPATH_W) 'consts.c'; else $(CYGPATH_W) '$(srcdir)/consts.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-consts.Tpo $(DEPDIR)/pdnsd-consts.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='consts.c' object='pdnsd-consts.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-consts.obj `if test -f 'consts.c'; then $(CYGPATH_W) 'consts.c'; else $(CYGPATH_W) '$(srcdir)/consts.c'; fi`
pdnsd-debug.o: debug.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-debug.o -MD -MP -MF $(DEPDIR)/pdnsd-debug.Tpo -c -o pdnsd-debug.o `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-debug.Tpo $(DEPDIR)/pdnsd-debug.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='debug.c' object='pdnsd-debug.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-debug.o `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
pdnsd-debug.obj: debug.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-debug.obj -MD -MP -MF $(DEPDIR)/pdnsd-debug.Tpo -c -o pdnsd-debug.obj `if test -f 'debug.c'; then $(CYGPATH_W) 'debug.c'; else $(CYGPATH_W) '$(srcdir)/debug.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-debug.Tpo $(DEPDIR)/pdnsd-debug.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='debug.c' object='pdnsd-debug.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-debug.obj `if test -f 'debug.c'; then $(CYGPATH_W) 'debug.c'; else $(CYGPATH_W) '$(srcdir)/debug.c'; fi`
pdnsd-dns.o: dns.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns.o -MD -MP -MF $(DEPDIR)/pdnsd-dns.Tpo -c -o pdnsd-dns.o `test -f 'dns.c' || echo '$(srcdir)/'`dns.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns.Tpo $(DEPDIR)/pdnsd-dns.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns.c' object='pdnsd-dns.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns.o `test -f 'dns.c' || echo '$(srcdir)/'`dns.c
pdnsd-dns.obj: dns.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns.obj -MD -MP -MF $(DEPDIR)/pdnsd-dns.Tpo -c -o pdnsd-dns.obj `if test -f 'dns.c'; then $(CYGPATH_W) 'dns.c'; else $(CYGPATH_W) '$(srcdir)/dns.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns.Tpo $(DEPDIR)/pdnsd-dns.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns.c' object='pdnsd-dns.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns.obj `if test -f 'dns.c'; then $(CYGPATH_W) 'dns.c'; else $(CYGPATH_W) '$(srcdir)/dns.c'; fi`
pdnsd-dns_answer.o: dns_answer.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns_answer.o -MD -MP -MF $(DEPDIR)/pdnsd-dns_answer.Tpo -c -o pdnsd-dns_answer.o `test -f 'dns_answer.c' || echo '$(srcdir)/'`dns_answer.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns_answer.Tpo $(DEPDIR)/pdnsd-dns_answer.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns_answer.c' object='pdnsd-dns_answer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns_answer.o `test -f 'dns_answer.c' || echo '$(srcdir)/'`dns_answer.c
pdnsd-dns_answer.obj: dns_answer.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns_answer.obj -MD -MP -MF $(DEPDIR)/pdnsd-dns_answer.Tpo -c -o pdnsd-dns_answer.obj `if test -f 'dns_answer.c'; then $(CYGPATH_W) 'dns_answer.c'; else $(CYGPATH_W) '$(srcdir)/dns_answer.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns_answer.Tpo $(DEPDIR)/pdnsd-dns_answer.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns_answer.c' object='pdnsd-dns_answer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns_answer.obj `if test -f 'dns_answer.c'; then $(CYGPATH_W) 'dns_answer.c'; else $(CYGPATH_W) '$(srcdir)/dns_answer.c'; fi`
pdnsd-dns_query.o: dns_query.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns_query.o -MD -MP -MF $(DEPDIR)/pdnsd-dns_query.Tpo -c -o pdnsd-dns_query.o `test -f 'dns_query.c' || echo '$(srcdir)/'`dns_query.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns_query.Tpo $(DEPDIR)/pdnsd-dns_query.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns_query.c' object='pdnsd-dns_query.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns_query.o `test -f 'dns_query.c' || echo '$(srcdir)/'`dns_query.c
pdnsd-dns_query.obj: dns_query.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-dns_query.obj -MD -MP -MF $(DEPDIR)/pdnsd-dns_query.Tpo -c -o pdnsd-dns_query.obj `if test -f 'dns_query.c'; then $(CYGPATH_W) 'dns_query.c'; else $(CYGPATH_W) '$(srcdir)/dns_query.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-dns_query.Tpo $(DEPDIR)/pdnsd-dns_query.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dns_query.c' object='pdnsd-dns_query.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-dns_query.obj `if test -f 'dns_query.c'; then $(CYGPATH_W) 'dns_query.c'; else $(CYGPATH_W) '$(srcdir)/dns_query.c'; fi`
pdnsd-error.o: error.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-error.o -MD -MP -MF $(DEPDIR)/pdnsd-error.Tpo -c -o pdnsd-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-error.Tpo $(DEPDIR)/pdnsd-error.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='pdnsd-error.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c
pdnsd-error.obj: error.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-error.obj -MD -MP -MF $(DEPDIR)/pdnsd-error.Tpo -c -o pdnsd-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-error.Tpo $(DEPDIR)/pdnsd-error.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='pdnsd-error.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi`
pdnsd-helpers.o: helpers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-helpers.o -MD -MP -MF $(DEPDIR)/pdnsd-helpers.Tpo -c -o pdnsd-helpers.o `test -f 'helpers.c' || echo '$(srcdir)/'`helpers.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-helpers.Tpo $(DEPDIR)/pdnsd-helpers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='helpers.c' object='pdnsd-helpers.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-helpers.o `test -f 'helpers.c' || echo '$(srcdir)/'`helpers.c
pdnsd-helpers.obj: helpers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-helpers.obj -MD -MP -MF $(DEPDIR)/pdnsd-helpers.Tpo -c -o pdnsd-helpers.obj `if test -f 'helpers.c'; then $(CYGPATH_W) 'helpers.c'; else $(CYGPATH_W) '$(srcdir)/helpers.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-helpers.Tpo $(DEPDIR)/pdnsd-helpers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='helpers.c' object='pdnsd-helpers.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-helpers.obj `if test -f 'helpers.c'; then $(CYGPATH_W) 'helpers.c'; else $(CYGPATH_W) '$(srcdir)/helpers.c'; fi`
pdnsd-icmp.o: icmp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-icmp.o -MD -MP -MF $(DEPDIR)/pdnsd-icmp.Tpo -c -o pdnsd-icmp.o `test -f 'icmp.c' || echo '$(srcdir)/'`icmp.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-icmp.Tpo $(DEPDIR)/pdnsd-icmp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='icmp.c' object='pdnsd-icmp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-icmp.o `test -f 'icmp.c' || echo '$(srcdir)/'`icmp.c
pdnsd-icmp.obj: icmp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-icmp.obj -MD -MP -MF $(DEPDIR)/pdnsd-icmp.Tpo -c -o pdnsd-icmp.obj `if test -f 'icmp.c'; then $(CYGPATH_W) 'icmp.c'; else $(CYGPATH_W) '$(srcdir)/icmp.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-icmp.Tpo $(DEPDIR)/pdnsd-icmp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='icmp.c' object='pdnsd-icmp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-icmp.obj `if test -f 'icmp.c'; then $(CYGPATH_W) 'icmp.c'; else $(CYGPATH_W) '$(srcdir)/icmp.c'; fi`
pdnsd-list.o: list.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-list.o -MD -MP -MF $(DEPDIR)/pdnsd-list.Tpo -c -o pdnsd-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-list.Tpo $(DEPDIR)/pdnsd-list.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='list.c' object='pdnsd-list.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c
pdnsd-list.obj: list.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-list.obj -MD -MP -MF $(DEPDIR)/pdnsd-list.Tpo -c -o pdnsd-list.obj `if test -f 'list.c'; then $(CYGPATH_W) 'list.c'; else $(CYGPATH_W) '$(srcdir)/list.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-list.Tpo $(DEPDIR)/pdnsd-list.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='list.c' object='pdnsd-list.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-list.obj `if test -f 'list.c'; then $(CYGPATH_W) 'list.c'; else $(CYGPATH_W) '$(srcdir)/list.c'; fi`
pdnsd-main.o: main.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-main.o -MD -MP -MF $(DEPDIR)/pdnsd-main.Tpo -c -o pdnsd-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-main.Tpo $(DEPDIR)/pdnsd-main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='pdnsd-main.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
pdnsd-main.obj: main.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-main.obj -MD -MP -MF $(DEPDIR)/pdnsd-main.Tpo -c -o pdnsd-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-main.Tpo $(DEPDIR)/pdnsd-main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='pdnsd-main.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
pdnsd-netdev.o: netdev.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-netdev.o -MD -MP -MF $(DEPDIR)/pdnsd-netdev.Tpo -c -o pdnsd-netdev.o `test -f 'netdev.c' || echo '$(srcdir)/'`netdev.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-netdev.Tpo $(DEPDIR)/pdnsd-netdev.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netdev.c' object='pdnsd-netdev.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-netdev.o `test -f 'netdev.c' || echo '$(srcdir)/'`netdev.c
pdnsd-netdev.obj: netdev.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-netdev.obj -MD -MP -MF $(DEPDIR)/pdnsd-netdev.Tpo -c -o pdnsd-netdev.obj `if test -f 'netdev.c'; then $(CYGPATH_W) 'netdev.c'; else $(CYGPATH_W) '$(srcdir)/netdev.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-netdev.Tpo $(DEPDIR)/pdnsd-netdev.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netdev.c' object='pdnsd-netdev.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-netdev.obj `if test -f 'netdev.c'; then $(CYGPATH_W) 'netdev.c'; else $(CYGPATH_W) '$(srcdir)/netdev.c'; fi`
pdnsd-rr_types.o: rr_types.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-rr_types.o -MD -MP -MF $(DEPDIR)/pdnsd-rr_types.Tpo -c -o pdnsd-rr_types.o `test -f 'rr_types.c' || echo '$(srcdir)/'`rr_types.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-rr_types.Tpo $(DEPDIR)/pdnsd-rr_types.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rr_types.c' object='pdnsd-rr_types.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-rr_types.o `test -f 'rr_types.c' || echo '$(srcdir)/'`rr_types.c
pdnsd-rr_types.obj: rr_types.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-rr_types.obj -MD -MP -MF $(DEPDIR)/pdnsd-rr_types.Tpo -c -o pdnsd-rr_types.obj `if test -f 'rr_types.c'; then $(CYGPATH_W) 'rr_types.c'; else $(CYGPATH_W) '$(srcdir)/rr_types.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-rr_types.Tpo $(DEPDIR)/pdnsd-rr_types.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rr_types.c' object='pdnsd-rr_types.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-rr_types.obj `if test -f 'rr_types.c'; then $(CYGPATH_W) 'rr_types.c'; else $(CYGPATH_W) '$(srcdir)/rr_types.c'; fi`
pdnsd-status.o: status.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-status.o -MD -MP -MF $(DEPDIR)/pdnsd-status.Tpo -c -o pdnsd-status.o `test -f 'status.c' || echo '$(srcdir)/'`status.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-status.Tpo $(DEPDIR)/pdnsd-status.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='status.c' object='pdnsd-status.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-status.o `test -f 'status.c' || echo '$(srcdir)/'`status.c
pdnsd-status.obj: status.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-status.obj -MD -MP -MF $(DEPDIR)/pdnsd-status.Tpo -c -o pdnsd-status.obj `if test -f 'status.c'; then $(CYGPATH_W) 'status.c'; else $(CYGPATH_W) '$(srcdir)/status.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-status.Tpo $(DEPDIR)/pdnsd-status.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='status.c' object='pdnsd-status.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-status.obj `if test -f 'status.c'; then $(CYGPATH_W) 'status.c'; else $(CYGPATH_W) '$(srcdir)/status.c'; fi`
pdnsd-servers.o: servers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-servers.o -MD -MP -MF $(DEPDIR)/pdnsd-servers.Tpo -c -o pdnsd-servers.o `test -f 'servers.c' || echo '$(srcdir)/'`servers.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-servers.Tpo $(DEPDIR)/pdnsd-servers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servers.c' object='pdnsd-servers.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-servers.o `test -f 'servers.c' || echo '$(srcdir)/'`servers.c
pdnsd-servers.obj: servers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-servers.obj -MD -MP -MF $(DEPDIR)/pdnsd-servers.Tpo -c -o pdnsd-servers.obj `if test -f 'servers.c'; then $(CYGPATH_W) 'servers.c'; else $(CYGPATH_W) '$(srcdir)/servers.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-servers.Tpo $(DEPDIR)/pdnsd-servers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servers.c' object='pdnsd-servers.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-servers.obj `if test -f 'servers.c'; then $(CYGPATH_W) 'servers.c'; else $(CYGPATH_W) '$(srcdir)/servers.c'; fi`
pdnsd-thread.o: thread.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-thread.o -MD -MP -MF $(DEPDIR)/pdnsd-thread.Tpo -c -o pdnsd-thread.o `test -f 'thread.c' || echo '$(srcdir)/'`thread.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-thread.Tpo $(DEPDIR)/pdnsd-thread.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread.c' object='pdnsd-thread.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-thread.o `test -f 'thread.c' || echo '$(srcdir)/'`thread.c
pdnsd-thread.obj: thread.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-thread.obj -MD -MP -MF $(DEPDIR)/pdnsd-thread.Tpo -c -o pdnsd-thread.obj `if test -f 'thread.c'; then $(CYGPATH_W) 'thread.c'; else $(CYGPATH_W) '$(srcdir)/thread.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-thread.Tpo $(DEPDIR)/pdnsd-thread.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread.c' object='pdnsd-thread.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-thread.obj `if test -f 'thread.c'; then $(CYGPATH_W) 'thread.c'; else $(CYGPATH_W) '$(srcdir)/thread.c'; fi`
pdnsd-cache.o: cache.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-cache.o -MD -MP -MF $(DEPDIR)/pdnsd-cache.Tpo -c -o pdnsd-cache.o `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-cache.Tpo $(DEPDIR)/pdnsd-cache.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache.c' object='pdnsd-cache.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-cache.o `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
pdnsd-cache.obj: cache.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-cache.obj -MD -MP -MF $(DEPDIR)/pdnsd-cache.Tpo -c -o pdnsd-cache.obj `if test -f 'cache.c'; then $(CYGPATH_W) 'cache.c'; else $(CYGPATH_W) '$(srcdir)/cache.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-cache.Tpo $(DEPDIR)/pdnsd-cache.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache.c' object='pdnsd-cache.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-cache.obj `if test -f 'cache.c'; then $(CYGPATH_W) 'cache.c'; else $(CYGPATH_W) '$(srcdir)/cache.c'; fi`
pdnsd-hash.o: hash.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-hash.o -MD -MP -MF $(DEPDIR)/pdnsd-hash.Tpo -c -o pdnsd-hash.o `test -f 'hash.c' || echo '$(srcdir)/'`hash.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-hash.Tpo $(DEPDIR)/pdnsd-hash.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hash.c' object='pdnsd-hash.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-hash.o `test -f 'hash.c' || echo '$(srcdir)/'`hash.c
pdnsd-hash.obj: hash.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -MT pdnsd-hash.obj -MD -MP -MF $(DEPDIR)/pdnsd-hash.Tpo -c -o pdnsd-hash.obj `if test -f 'hash.c'; then $(CYGPATH_W) 'hash.c'; else $(CYGPATH_W) '$(srcdir)/hash.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pdnsd-hash.Tpo $(DEPDIR)/pdnsd-hash.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hash.c' object='pdnsd-hash.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdnsd_CFLAGS) $(CFLAGS) -c -o pdnsd-hash.obj `if test -f 'hash.c'; then $(CYGPATH_W) 'hash.c'; else $(CYGPATH_W) '$(srcdir)/hash.c'; fi`
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(sbindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-sbinPROGRAMS
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-sbinPROGRAMS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags ctags-recursive distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-sbinPROGRAMS
$(pdnsd_OBJECTS): rr_types.h
rr_types.h: make_rr_types_h.pl rr_types.in
perl make_rr_types_h.pl rr_types.in > rr_types.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

File diff suppressed because it is too large Load Diff

View File

@ -1,306 +0,0 @@
/* cache.h - Definitions for the dns cache
Copyright (C) 2000 Thomas Moestl
Copyright (C) 2003, 2004, 2005, 2010, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef _CACHE_H_
#define _CACHE_H_
#include <config.h>
#include "ipvers.h"
#include <stdio.h>
#include "list.h"
#include "dns.h"
#include "conff.h"
struct rr_lent_s;
/*
* These values are converted to host byte order. the data is _not_.
*/
typedef struct rr_b_s {
struct rr_b_s *next; /* this is the next pointer in the dns_cent_t list. */
unsigned rdlen;
#if ALLOW_LOCAL_AAAA || defined(ENABLE_IPV6)
struct in6_addr data[0]; /* dummy for alignment */
#else
struct in_addr data[0];
#endif
} rr_bucket_t;
typedef struct {
struct rr_lent_s *lent; /* this points to the list entry */
time_t ttl;
time_t ts;
unsigned short flags;
rr_bucket_t *rrs;
} rr_set_t;
typedef struct {
unsigned char *qname; /* Name of the domain in length byte - string notation. */
size_t cs; /* Size of the cache entry, including RR sets. */
unsigned short num_rrs; /* The number of RR sets. When this decreases to 0, the cent is deleted. */
unsigned short flags; /* Flags for the whole domain. */
union {
struct { /* Fields used only for negatively cached domains. */
struct rr_lent_s *lent; /* list entry for the whole cent. */
time_t ttl; /* TTL for negative caching. */
time_t ts; /* Timestamp. */
} neg;
struct { /* Fields used only for domains that actually exist. */
rr_set_t *(rrmu[NRRMU]); /* The most used records.
Use the the value obtained from rrlkuptab[] as index. */
rr_set_t **rrext; /* Pointer (may be NULL) to an array of size NNRREXT storing the
less frequently used records. */
} rr;
};
unsigned char c_ns,c_soa; /* Number of trailing name elements in qname to use to find NS or SOA
records to add to the authority section of a response. */
} dns_cent_t;
/* This value is used to represent an undefined c_ns or c_soa field. */
#define cundef 0xff
/*
* the flag values for RR sets in the cache
*/
#define CF_NEGATIVE 1 /* this one is for per-RRset negative caching*/
#define CF_LOCAL 2 /* Local zone entry */
#define CF_AUTH 4 /* authoritative record */
#define CF_NOCACHE 8 /* Only hold for the cache latency time period, then purge.
* Not really written to cache, but used by add_cache. */
#define CF_ADDITIONAL 16 /* This was fetched as an additional or "off-topic" record. */
#define CF_NOPURGE 32 /* Do not purge this record */
#define CF_ROOTSERV 64 /* This record was directly obtained from a root server */
#define CFF_NOINHERIT (CF_LOCAL|CF_AUTH|CF_ADDITIONAL|CF_ROOTSERV) /* not to be inherited on requery */
/*
* the flag values for whole domains in the cache
*/
#define DF_NEGATIVE 1 /* this one is for whole-domain negative caching (created on NXDOMAIN)*/
#define DF_LOCAL 2 /* local record (in conj. with DF_NEGATIVE) */
#define DF_AUTH 4 /* authoritative record */
#define DF_NOCACHE 8 /* Only hold for the cache latency time period, then purge.
* Only used for negatively cached domains.
* Not really written to cache, but used by add_cache. */
#define DF_WILD 16 /* subdomains of this domain have wildcard records */
/* #define DFF_NOINHERIT (DF_NEGATIVE) */ /* not to be inherited on requery */
enum {w_wild=1, w_neg, w_locnerr}; /* Used to distinguish different types of wildcard records. */
#if DEBUG>0
#define NCFLAGS 7
#define NDFLAGS 5
#define CFLAGSTRLEN (NCFLAGS*4)
#define DFLAGSTRLEN (NDFLAGS*4)
extern const char cflgnames[];
extern const char dflgnames[];
char *flags2str(unsigned flags,char *buf,int nflags,const char *flgnames);
#define cflags2str(flags,buf) flags2str(flags,buf,NCFLAGS,cflgnames)
#define dflags2str(flags,buf) flags2str(flags,buf,NDFLAGS,dflgnames)
#endif
/*
* This is the time in secs any record remains at least in the cache before it is purged.
* (exception is that the cache is full)
*/
#define CACHE_LAT 120
#define CLAT_ADJ(ttl) ((ttl)<CACHE_LAT?CACHE_LAT:(ttl))
/* This is used internally to check if a rrset has timed out. */
#define timedout(rrset) ((rrset)->ts+CLAT_ADJ((rrset)->ttl)<time(NULL))
/* This is used internally to check if a negatively cached domain has timed out.
Only use if the DF_NEGATIVE bit is set! */
#define timedout_nxdom(cent) ((cent)->neg.ts+CLAT_ADJ((cent)->neg.ttl)<time(NULL))
extern volatile short int use_cache_lock;
#ifdef ALLOC_DEBUG
#define DBGPARAM ,int dbg
#define DBGARG ,dbg
#define DBG0 ,0
#define DBG1 ,1
#else
#define DBGPARAM
#define DBGARG
#define DBG0
#define DBG1
#endif
/* Initialize the cache. Call only once. */
#define init_cache mk_dns_hash
/* Initialize the cache lock. Call only once. */
inline static void init_cache_lock() __attribute__((always_inline));
inline static void init_cache_lock()
{
use_cache_lock=1;
}
int empty_cache(slist_array sla);
void destroy_cache(void);
void read_disk_cache(void);
void write_disk_cache(void);
int report_cache_stat(int f);
int dump_cache(int fd, const unsigned char *name, int exact);
/*
* add_cache expects the dns_cent_t to be filled.
*/
void add_cache(dns_cent_t *cent);
int add_reverse_cache(dns_cent_t * cent);
void del_cache(const unsigned char *name);
void invalidate_record(const unsigned char *name);
int set_cent_flags(const unsigned char *name, unsigned flags);
unsigned char *getlocalowner(unsigned char *name,int tp);
dns_cent_t *lookup_cache(const unsigned char *name, int *wild);
rr_set_t *lookup_cache_local_rrset(const unsigned char *name, int type);
#if 0
int add_cache_rr_add(const unsigned char *name, int tp, time_t ttl, time_t ts, unsigned flags, unsigned dlen, void *data, unsigned long serial);
#endif
inline static unsigned int mk_flag_val(servparm_t *server)
__attribute__((always_inline));
inline static unsigned int mk_flag_val(servparm_t *server)
{
unsigned int fl=0;
if (!server->purge_cache)
fl|=CF_NOPURGE;
if (server->nocache)
fl|=CF_NOCACHE;
if (server->rootserver)
fl|=CF_ROOTSERV;
return fl;
}
int init_cent(dns_cent_t *cent, const unsigned char *qname, time_t ttl, time_t ts, unsigned flags DBGPARAM);
int add_cent_rrset_by_type(dns_cent_t *cent, int type, time_t ttl, time_t ts, unsigned flags DBGPARAM);
int add_cent_rr(dns_cent_t *cent, int type, time_t ttl, time_t ts, unsigned flags,unsigned dlen, void *data DBGPARAM);
int del_rrset(rr_set_t *rrs DBGPARAM);
void free_cent(dns_cent_t *cent DBGPARAM);
void free_cent0(void *ptr);
void negate_cent(dns_cent_t *cent, time_t ttl, time_t ts);
void del_cent(dns_cent_t *cent);
/* Because this is empty by now, it is defined as an empty macro to save overhead.*/
/*void free_rr(rr_bucket_t cent);*/
#define free_rr(x)
dns_cent_t *copy_cent(dns_cent_t *cent DBGPARAM);
#if 0
unsigned long get_serial(void);
#endif
/* Get pointer to rrset given cache entry and rr type value. */
inline static rr_set_t *getrrset(dns_cent_t *cent, int type)
__attribute__((always_inline));
inline static rr_set_t *getrrset(dns_cent_t *cent, int type)
{
if(!(cent->flags&DF_NEGATIVE)) {
int tpi= type - T_MIN;
if(tpi>=0 && tpi<T_NUM) {
unsigned int idx = rrlkuptab[tpi];
if(idx < NRRMU)
return cent->rr.rrmu[idx];
else {
idx -= NRRMU;
if(idx < NRREXT) {
rr_set_t **rrext= cent->rr.rrext;
if(rrext)
return rrext[idx];
}
}
}
}
return NULL;
}
/* This version of getrrset is slightly more efficient,
but also more dangerous, because it performs less checks.
It is safe to use if T_MIN <= type <= T_MAX and cent
is not negative.
*/
inline static rr_set_t *getrrset_eff(dns_cent_t *cent, int type)
__attribute__((always_inline));
inline static rr_set_t *getrrset_eff(dns_cent_t *cent, int type)
{
unsigned int idx = rrlkuptab[type-T_MIN];
if(idx < NRRMU)
return cent->rr.rrmu[idx];
else {
idx -= NRRMU;
if(idx < NRREXT) {
rr_set_t **rrext= cent->rr.rrext;
if(rrext)
return rrext[idx];
}
}
return NULL;
}
/* have_rr() tests whether a cache entry has at least one record of a given type.
Only use if T_MIN <= type <=T_MAX
*/
inline static int have_rr(dns_cent_t *cent, int type)
__attribute__((always_inline));
inline static int have_rr(dns_cent_t *cent, int type)
{
rr_set_t *rrset;
return !(cent->flags&DF_NEGATIVE) && (rrset=getrrset_eff(cent, type)) && rrset->rrs;
}
/* Some quick and dirty and hopefully fast macros. */
#define PDNSD_NOT_CACHED_TYPE(type) ((type)<T_MIN || (type)>T_MAX || rrlkuptab[(type)-T_MIN]>=NRRTOT)
/* This is useful for iterating over all the RR types in a cache entry in strict ascending order. */
#define NRRITERLIST(cent) ((cent)->flags&DF_NEGATIVE?0:(cent)->rr.rrext?NRRTOT:NRRMU)
#define RRITERLIST(cent) ((cent)->flags&DF_NEGATIVE?NULL:(cent)->rr.rrext?rrcachiterlist:rrmuiterlist)
/* The following macros use array indices as arguments, not RR type values! */
#define GET_RRSMU(cent,i) (!((cent)->flags&DF_NEGATIVE)?(cent)->rr.rrmu[i]:NULL)
#define GET_RRSEXT(cent,i) (!((cent)->flags&DF_NEGATIVE) && (cent)->rr.rrext?(cent)->rr.rrext[i]:NULL)
#define HAVE_RRMU(cent,i) (!((cent)->flags&DF_NEGATIVE) && (cent)->rr.rrmu[i] && (cent)->rr.rrmu[i]->rrs)
#define HAVE_RREXT(cent,i) (!((cent)->flags&DF_NEGATIVE) && (cent)->rr.rrext && (cent)->rr.rrext[i] && (cent)->rr.rrext[i]->rrs)
#define RRARR_LEN(cent) ((cent)->flags&DF_NEGATIVE?0:(cent)->rr.rrext?NRRTOT:NRRMU)
/* This allows us to index the RR-set arrays in a cache entry as if they formed one contiguous array. */
#define RRARR_INDEX_TESTEXT(cent,i) ((cent)->flags&DF_NEGATIVE?NULL:(i)<NRRMU?(cent)->rr.rrmu[i]:(cent)->rr.rrext?(cent)->rr.rrext[(i)-NRRMU]:NULL)
/* This gets the address where the pointer to an RR-set is stored in a cache entry,
given the cache entry and an RR-set index.
Address may be NULL if no storage space for the type has been allocated. */
#define RRARR_INDEX_PA_TESTEXT(cent,i) ((cent)->flags&DF_NEGATIVE?NULL:(i)<NRRMU?&(cent)->rr.rrmu[i]:(cent)->rr.rrext?&(cent)->rr.rrext[(i)-NRRMU]:NULL)
/* The following macros should only be used if 0 <= i < RRARR_LEN(cent) ! */
#define RRARR_INDEX(cent,i) ((i)<NRRMU?(cent)->rr.rrmu[i]:(cent)->rr.rrext[(i)-NRRMU])
#define RRARR_INDEX_PA(cent,i) ((i)<NRRMU?&(cent)->rr.rrmu[i]:&(cent)->rr.rrext[(i)-NRRMU])
#endif

View File

@ -1,238 +0,0 @@
/* conf-keywords.h - Tables used by parser of configuration file.
Based on information previously contained in conf-lex.y and conf-parse.y
Copyright (C) 2004,2005,2006,2007,2008,2009,2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
enum {
ERROR,
GLOBAL,
SERVER,
RR,
NEG,
SOURCE,
INCLUDE_F,
PERM_CACHE,
CACHE_DIR,
SERVER_PORT,
SERVER_IP,
OUTGOING_IP,
SCHEME_FILE,
LINKDOWN_KLUGE,
MAX_TTL,
MIN_TTL,
RUN_AS,
STRICT_SETUID,
USE_NSS,
PARANOID,
IGNORE_CD,
STATUS_CTL,
DAEMON,
C_TCP_SERVER,
PID_FILE,
C_VERBOSITY,
C_QUERY_METHOD,
RUN_IPV4,
IPV4_6_PREFIX,
C_DEBUG,
C_CTL_PERMS,
C_PROC_LIMIT,
C_PROCQ_LIMIT,
TCP_QTIMEOUT,
C_PAR_QUERIES,
C_RAND_RECS,
NEG_TTL,
NEG_RRS_POL,
NEG_DOMAIN_POL,
QUERY_PORT_START,
QUERY_PORT_END,
UDP_BUFSIZE,
DELEGATION_ONLY,
IP,
PORT,
SCHEME,
UPTEST,
TIMEOUT,
PING_TIMEOUT,
PING_IP,
UPTEST_CMD,
QUERY_TEST_NAME,
INTERVAL,
INTERFACE,
DEVICE,
PURGE_CACHE,
CACHING,
LEAN_QUERY,
EDNS_QUERY,
PRESET,
PROXY_ONLY,
ROOT_SERVER,
RANDOMIZE_SERVERS,
INCLUDE,
EXCLUDE,
POLICY,
REJECTLIST,
REJECTPOLICY,
REJECTRECURSIVELY,
LABEL,
A,
PTR,
MX,
SOA,
CNAME,
TXT,
SPF,
NAME,
OWNER,
TTL,
TYPES,
FILET,
SERVE_ALIASES,
AUTHREC,
REVERSE
};
/* Table for looking up section headers. Order alphabetically! */
static const namevalue_t section_headers[]= {
{"global", GLOBAL},
{"include", INCLUDE_F},
{"neg", NEG},
{"rr", RR},
{"server", SERVER},
{"source", SOURCE}
};
/* Table for looking up global options. Order alphabetically! */
static const namevalue_t global_options[]= {
{"cache_dir", CACHE_DIR},
{"ctl_perms", C_CTL_PERMS},
{"daemon", DAEMON},
{"debug", C_DEBUG},
{"delegation_only", DELEGATION_ONLY},
{"ignore_cd", IGNORE_CD},
{"interface", SERVER_IP},
{"ipv4_6_prefix", IPV4_6_PREFIX},
{"linkdown_kluge", LINKDOWN_KLUGE},
{"max_ttl", MAX_TTL},
{"min_ttl", MIN_TTL},
{"neg_domain_pol", NEG_DOMAIN_POL},
{"neg_rrs_pol", NEG_RRS_POL},
{"neg_ttl", NEG_TTL},
{"outgoing_ip", OUTGOING_IP},
{"outside_interface", OUTGOING_IP},
{"par_queries", C_PAR_QUERIES},
{"paranoid", PARANOID},
{"perm_cache", PERM_CACHE},
{"pid_file", PID_FILE},
{"proc_limit", C_PROC_LIMIT},
{"procq_limit", C_PROCQ_LIMIT},
{"query_method", C_QUERY_METHOD},
{"query_port_end", QUERY_PORT_END},
{"query_port_start", QUERY_PORT_START},
{"randomize_recs", C_RAND_RECS},
{"run_as", RUN_AS},
{"run_ipv4", RUN_IPV4},
{"scheme_file", SCHEME_FILE},
{"server_ip", SERVER_IP},
{"server_port", SERVER_PORT},
{"status_ctl", STATUS_CTL},
{"strict_setuid", STRICT_SETUID},
{"tcp_qtimeout", TCP_QTIMEOUT},
{"tcp_server", C_TCP_SERVER},
{"timeout", TIMEOUT},
{"udpbufsize", UDP_BUFSIZE},
{"use_nss", USE_NSS},
{"verbosity", C_VERBOSITY}
};
/* Table for looking up server options. Order alphabetically! */
static const namevalue_t server_options[]= {
{"caching", CACHING},
{"device", DEVICE},
{"edns_query", EDNS_QUERY},
{"exclude", EXCLUDE},
{"file", FILET},
{"include", INCLUDE},
{"interface", INTERFACE},
{"interval", INTERVAL},
{"ip", IP},
{"label", LABEL},
{"lean_query", LEAN_QUERY},
{"ping_ip", PING_IP},
{"ping_timeout", PING_TIMEOUT},
{"policy", POLICY},
{"port", PORT},
{"preset", PRESET},
{"proxy_only", PROXY_ONLY},
{"purge_cache", PURGE_CACHE},
{"query_test_name", QUERY_TEST_NAME},
{"randomize_servers", RANDOMIZE_SERVERS},
{"reject", REJECTLIST},
{"reject_policy", REJECTPOLICY},
{"reject_recursively", REJECTRECURSIVELY},
{"root_server", ROOT_SERVER},
{"scheme", SCHEME},
{"timeout", TIMEOUT},
{"uptest", UPTEST},
{"uptest_cmd", UPTEST_CMD}
};
/* Table for looking up rr options. Order alphabetically! */
static const namevalue_t rr_options[]= {
{"a", A},
{"authrec", AUTHREC},
{"cname", CNAME},
{"mx", MX},
{"name", NAME},
{"ns", OWNER},
{"owner", OWNER},
{"ptr", PTR},
{"reverse", REVERSE},
{"soa", SOA},
{"spf", SPF},
{"ttl", TTL},
{"txt", TXT}
};
/* Table for looking up source options. Order alphabetically! */
static const namevalue_t source_options[]= {
{"authrec", AUTHREC},
{"file", FILET},
{"ns", OWNER},
{"owner", OWNER},
{"serve_aliases", SERVE_ALIASES},
{"ttl", TTL}
};
/* Table for looking up include options. Order alphabetically! */
static const namevalue_t include_options[]= {
{"file", FILET}
};
/* Table for looking up neg options. Order alphabetically! */
static const namevalue_t neg_options[]= {
{"name", NAME},
{"ttl", TTL},
{"types", TYPES}
};

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
/* conf-parser.h - definitions for parser of pdnsd config files.
The parser was rewritten in C from scratch and doesn't require (f)lex
or yacc/bison.
Copyright (C) 2004,2008 Paul A. Rombouts.
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONF_PARSER_H
#define CONF_PARSER_H
int confparse(FILE* in, char *prestr, globparm_t *global, servparm_array *servers, int includedepth, char **errstr);
#endif /* CONF_PARSER_H */

View File

@ -1,544 +0,0 @@
/* conff.c - Maintain configuration information
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>
#include "ipvers.h"
#include "conff.h"
#include "consts.h"
#include "helpers.h"
#include "conf-parser.h"
#include "servers.h"
#include "icmp.h"
globparm_t global={
perm_cache: 2048,
cache_dir: NULL,
pidfile: NULL,
port: 53,
a: PDNSD_A_INITIALIZER,
out_a: PDNSD_A_INITIALIZER,
#ifdef ENABLE_IPV6
ipv4_6_prefix: IN6ADDR_ANY_INIT,
#endif
max_ttl: 604800,
min_ttl: 120,
neg_ttl: 900,
neg_rrs_pol: C_DEFAULT,
neg_domain_pol: C_AUTH,
verbosity: VERBOSITY,
run_as: "",
daemon: 0,
debug: 0,
stat_pipe: 0,
notcp: 0,
strict_suid: 1,
use_nss: 1,
paranoid: 0,
lndown_kluge: 0,
onquery: 0,
rnd_recs: 1,
ctl_perms: 0600,
scheme_file: NULL,
proc_limit: 40,
procq_limit: 60,
tcp_qtimeout: TCP_TIMEOUT,
timeout: 0,
par_queries: PAR_QUERIES,
query_method: M_PRESET,
query_port_start: 1024,
query_port_end: 65535,
udpbufsize: 1024,
deleg_only_zones: NULL
};
servparm_t serv_presets={
port: 53,
uptest: C_NONE,
timeout: 120,
interval: 900,
ping_timeout: 600,
scheme: "",
uptest_cmd: NULL,
uptest_usr: "",
interface: "",
device: "",
query_test_name: NULL,
label: NULL,
purge_cache: 0,
nocache: 0,
lean_query: 1,
edns_query: 0,
is_proxy: 0,
rootserver: 0,
rand_servers: 0,
preset: 1,
rejectrecursively: 0,
rejectpolicy: C_FAIL,
policy: C_INCLUDED,
alist: NULL,
atup_a: NULL,
reject_a4: NULL,
#if ALLOW_LOCAL_AAAA
reject_a6: NULL,
#endif
ping_a: PDNSD_A_INITIALIZER
};
servparm_array servers=NULL;
static void free_zones(zone_array za);
static void free_server_data(servparm_array sa);
static int report_server_stat(int f,int i);
/*
* Read a configuration file, saving the results in a (separate) global section and servers array,
* and the cache.
*
* char *nm should contain the name of the file to read. If it is NULL, the name of the config file
* read during startup is used.
*
* globparm_t *global should point to a struct which will be used to store the data of the
* global section(s). If it is NULL, no global sections are allowed in the
* file.
*
* servparm_array *servers should point to a dynamic array which will be grown to store the data
* of the server sections. If it is NULL, no server sections are allowed
* in the file.
*
* char **errstr is used to return a possible error message.
* In case of failure, *errstr will refer to a newly allocated string.
*
* read_config_file returns 1 on success, 0 on failure.
*/
int read_config_file(const char *nm, globparm_t *global, servparm_array *servers, int includedepth, char **errstr)
{
int retval=0;
const char *conftype= (global?"config":"include");
FILE *in;
if (nm==NULL)
nm=conf_file;
if (!(in=fopen(nm,"r"))) {
if(asprintf(errstr,"Error: Could not open %s file %s: %s",conftype,nm,strerror(errno))<0)
*errstr=NULL;
return 0;
}
retval=confparse(in,NULL,global,servers,includedepth,errstr);
close_file:
if(fclose(in) && retval) {
if(asprintf(errstr,"Error: Could not close %s file %s: %s",
conftype,nm,strerror(errno))<0)
*errstr=NULL;
return 0;
}
if(retval && servers && !DA_NEL(*servers)) {
if(asprintf(errstr,"Error: no server sections defined in config file %s",nm)<0)
*errstr=NULL;
return 0;
}
return retval;
}
/*
* Re-Read the configuration file.
* Return 1 on success, 0 on failure.
* In case of failure, the old configuration will be unchanged (although the cache may not) and
* **errstr will refer to a newly allocated string containing an error message.
*/
int reload_config_file(const char *nm, char **errstr)
{
globparm_t global_new;
servparm_array servers_new;
global_new=global;
global_new.cache_dir=NULL;
global_new.pidfile=NULL;
global_new.scheme_file=NULL;
global_new.deleg_only_zones=NULL;
global_new.onquery=0;
servers_new=NULL;
if(read_config_file(nm,&global_new,&servers_new,0,errstr)) {
if(global_new.cache_dir && strcmp(global_new.cache_dir,global.cache_dir)) {
*errstr=strdup("Cannot reload config file: the specified cache_dir directory has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.pidfile && (!global.pidfile || strcmp(global_new.pidfile,global.pidfile))) {
*errstr=strdup("Cannot reload config file: the specified pid_file has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.scheme_file && strcmp(global_new.scheme_file,global.scheme_file)) {
*errstr=strdup("Cannot reload config file: the specified scheme_file has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.port!=global.port) {
*errstr=strdup("Cannot reload config file: the specified server_port has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(!ADDR_EQUIV(&global_new.a,&global.a)) {
*errstr=strdup("Cannot reload config file: the specified interface address (server_ip) has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
#ifdef ENABLE_IPV6
if(!IN6_ARE_ADDR_EQUAL(&global_new.ipv4_6_prefix,&global.ipv4_6_prefix)) {
*errstr=strdup("Cannot reload config file: the specified ipv4_6_prefix has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
#endif
if(strcmp(global_new.run_as,global.run_as)) {
*errstr=strdup("Cannot reload config file: the specified run_as id has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.daemon!=global.daemon) {
*errstr=strdup("Cannot reload config file: the daemon option has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.debug!=global.debug) {
*errstr=strdup("Cannot reload config file: the debug option has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.stat_pipe!=global.stat_pipe) {
*errstr=strdup("Cannot reload config file: the status_ctl option has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.notcp!=global.notcp) {
*errstr=strdup("Cannot reload config file: the tcp_server option has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.strict_suid!=global.strict_suid) {
*errstr=strdup("Cannot reload config file: the strict_setuid option has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(global_new.ctl_perms!=global.ctl_perms) {
*errstr=strdup("Cannot reload config file: the specified ctl_perms has changed.\n"
"Try restarting pdnsd instead.");
goto cleanup_return;
}
if(ping_isocket==-1
#ifdef ENABLE_IPV6
&& ping6_isocket==-1
#endif
) {
int i,n=DA_NEL(servers_new);
for (i=0;i<n;++i) {
if (DA_INDEX(servers_new,i).uptest==C_PING) {
if(asprintf(errstr,"Cannot reload config file: the ping socket is not initialized"
" and the new config contains uptest=ping in server section %i.\n"
"Try restarting pdnsd instead.",i)<0)
*errstr=NULL;
goto cleanup_return;
}
}
}
/* we need exclusive access to the server data to make the changes */
/* Wait at most 60 seconds to obtain a lock. */
if(!exclusive_lock_server_data(60)) {
*errstr=strdup("Cannot reload config file: Timed out while waiting for access to config data.");
goto cleanup_return;
}
free(global_new.cache_dir); global_new.cache_dir=global.cache_dir;
free(global_new.pidfile); global_new.pidfile=global.pidfile;
free(global_new.scheme_file); global_new.scheme_file=global.scheme_file;
free_zones(global.deleg_only_zones);
global=global_new;
free_server_data(servers);
servers=servers_new;
/* schedule a retest to check which servers are up,
and free the lock. */
exclusive_unlock_server_data(1);
return 1;
}
cleanup_return:
free(global_new.cache_dir);
free(global_new.pidfile);
free(global_new.scheme_file);
free_zones(global_new.deleg_only_zones);
free_server_data(servers_new);
return 0;
}
void free_zone(void *ptr)
{
free(*((unsigned char **)ptr));
}
static void free_zones(zone_array za)
{
int i,n=DA_NEL(za);
for(i=0;i<n;++i)
free(DA_INDEX(za,i));
da_free(za);
}
void free_slist_domain(void *ptr)
{
free(((slist_t *)ptr)->domain);
}
void free_slist_array(slist_array sla)
{
int j,m=DA_NEL(sla);
for(j=0;j<m;++j)
free(DA_INDEX(sla,j).domain);
da_free(sla);
}
void free_servparm(servparm_t *serv)
{
free(serv->uptest_cmd);
free(serv->query_test_name);
free(serv->label);
da_free(serv->atup_a);
free_slist_array(serv->alist);
da_free(serv->reject_a4);
#if ALLOW_LOCAL_AAAA
da_free(serv->reject_a6);
#endif
}
static void free_server_data(servparm_array sa)
{
int i,n=DA_NEL(sa);
for(i=0;i<n;++i)
free_servparm(&DA_INDEX(sa,i));
da_free(sa);
}
/* Report the current configuration to the file descriptor f (for the status fifo, see status.c) */
int report_conf_stat(int f)
{
int i,n,retval=0;
fsprintf_or_return(f,"\nConfiguration:\n==============\nGlobal:\n-------\n");
fsprintf_or_return(f,"\tCache size: %li kB\n",global.perm_cache);
fsprintf_or_return(f,"\tServer directory: %s\n",global.cache_dir);
fsprintf_or_return(f,"\tScheme file (for Linux pcmcia support): %s\n",global.scheme_file);
fsprintf_or_return(f,"\tServer port: %i\n",global.port);
{
char buf[ADDRSTR_MAXLEN];
fsprintf_or_return(f,"\tServer IP (%s=any available one): %s\n", SEL_IPVER("0.0.0.0","::"),
pdnsd_a2str(&global.a,buf,ADDRSTR_MAXLEN));
if(!is_inaddr_any(&global.out_a)) {
fsprintf_or_return(f,"\tIP bound to interface used for querying remote servers: %s\n",
pdnsd_a2str(&global.out_a,buf,ADDRSTR_MAXLEN));
}
}
#ifdef ENABLE_IPV6
if(!run_ipv4) {
char buf[ADDRSTR_MAXLEN];
fsprintf_or_return(f,"\tIPv4 to IPv6 prefix: %s\n",inet_ntop(AF_INET6,&global.ipv4_6_prefix,buf,ADDRSTR_MAXLEN)?:"?.?.?.?");
}
#endif
fsprintf_or_return(f,"\tIgnore cache when link is down: %s\n",global.lndown_kluge?"on":"off");
fsprintf_or_return(f,"\tMaximum ttl: %li\n",(long)global.max_ttl);
fsprintf_or_return(f,"\tMinimum ttl: %li\n",(long)global.min_ttl);
fsprintf_or_return(f,"\tNegative ttl: %li\n",(long)global.neg_ttl);
fsprintf_or_return(f,"\tNegative RRS policy: %s\n",const_name(global.neg_rrs_pol));
fsprintf_or_return(f,"\tNegative domain policy: %s\n",const_name(global.neg_domain_pol));
fsprintf_or_return(f,"\tRun as: %s\n",global.run_as);
fsprintf_or_return(f,"\tStrict run as: %s\n",global.strict_suid?"on":"off");
fsprintf_or_return(f,"\tUse NSS: %s\n",global.use_nss?"on":"off");
fsprintf_or_return(f,"\tParanoid mode (cache pollution prevention): %s\n",global.paranoid?"on":"off");
fsprintf_or_return(f,"\tControl socket permissions (mode): %o\n",global.ctl_perms);
fsprintf_or_return(f,"\tMaximum parallel queries served: %i\n",global.proc_limit);
fsprintf_or_return(f,"\tMaximum queries queued for serving: %i\n",global.procq_limit);
fsprintf_or_return(f,"\tGlobal timeout setting: %li\n",(long)global.timeout);
fsprintf_or_return(f,"\tParallel queries increment: %i\n",global.par_queries);
fsprintf_or_return(f,"\tRandomize records in answer: %s\n",global.rnd_recs?"on":"off");
fsprintf_or_return(f,"\tQuery method: %s\n",const_name(global.query_method));
{
int query_port_start=global.query_port_start;
if(query_port_start==-1) {
fsprintf_or_return(f,"\tQuery port start: (let kernel choose)\n");
}
else {
fsprintf_or_return(f,"\tQuery port start: %i\n",query_port_start);
fsprintf_or_return(f,"\tQuery port end: %i\n",global.query_port_end);
}
}
#ifndef NO_TCP_SERVER
fsprintf_or_return(f,"\tTCP server thread: %s\n",global.notcp?"off":"on");
if(!global.notcp)
{fsprintf_or_return(f,"\tTCP query timeout: %li\n",(long)global.tcp_qtimeout);}
#endif
fsprintf_or_return(f,"\tMaximum udp buffer size: %i\n",global.udpbufsize);
lock_server_data();
{
int rv=fsprintf(f,"\tDelegation-only zones: ");
if(rv<0) {retval=rv; goto unlock_return;}
}
if(global.deleg_only_zones==NULL) {
int rv=fsprintf(f,"(none)\n");
if(rv<0) {retval=rv; goto unlock_return;}
}
else {
int rv;
n=DA_NEL(global.deleg_only_zones);
for(i=0;i<n;++i) {
unsigned char buf[DNSNAMEBUFSIZE];
rv=fsprintf(f,i==0?"%s":", %s",
rhn2str(DA_INDEX(global.deleg_only_zones,i),buf,sizeof(buf)));
if(rv<0) {retval=rv; goto unlock_return;}
}
rv=fsprintf(f,"\n");
if(rv<0) {retval=rv; goto unlock_return;}
}
n=DA_NEL(servers);
for(i=0;i<n;++i) {
int rv=report_server_stat(f,i);
if(rv<0) {retval=rv; goto unlock_return;}
}
unlock_return:
unlock_server_data();
return retval;
}
#if ALLOW_LOCAL_AAAA
#define serv_has_rejectlist(s) ((s)->reject_a4!=NULL || (s)->reject_a6!=NULL)
#else
#define serv_has_rejectlist(s) ((s)->reject_a4!=NULL)
#endif
/* Report the current status of server i to the file descriptor f.
Call with locks applied.
*/
static int report_server_stat(int f,int i)
{
servparm_t *st=&DA_INDEX(servers,i);
int j,m;
fsprintf_or_return(f,"Server %i:\n------\n",i);
fsprintf_or_return(f,"\tlabel: %s\n",st->label?st->label:"(none)");
m=DA_NEL(st->atup_a);
if(st->rootserver>1 && m)
fsprintf_or_return(f,"\tThe following name servers will be used for discovery of rootservers only:\n");
for(j=0;j<m;j++) {
atup_t *at=&DA_INDEX(st->atup_a,j);
{char buf[ADDRSTR_MAXLEN];
fsprintf_or_return(f,"\tip: %s\n",pdnsd_a2str(PDNSD_A2_TO_A(&at->a),buf,ADDRSTR_MAXLEN));}
fsprintf_or_return(f,"\tserver assumed available: %s\n",at->is_up?"yes":"no");
}
fsprintf_or_return(f,"\tport: %hu\n",st->port);
fsprintf_or_return(f,"\tuptest: %s\n",const_name(st->uptest));
fsprintf_or_return(f,"\ttimeout: %li\n",(long)st->timeout);
if(st->interval>0) {
fsprintf_or_return(f,"\tuptest interval: %li\n",(long)st->interval);
} else {
fsprintf_or_return(f,"\tuptest interval: %s\n",
st->interval==-1?"onquery":
st->interval==-2?"ontimeout":
"(never retest)");
}
fsprintf_or_return(f,"\tping timeout: %li\n",(long)st->ping_timeout);
{char buf[ADDRSTR_MAXLEN];
fsprintf_or_return(f,"\tping ip: %s\n",is_inaddr_any(&st->ping_a)?"(using server ip)":pdnsd_a2str(&st->ping_a,buf,ADDRSTR_MAXLEN));}
if(st->interface[0]) {
fsprintf_or_return(f,"\tinterface: %s\n",st->interface);
}
if(st->device[0]) {
fsprintf_or_return(f,"\tdevice (for special Linux ppp device support): %s\n",st->device);
}
if(st->uptest_cmd) {
fsprintf_or_return(f,"\tuptest command: %s\n",st->uptest_cmd);
fsprintf_or_return(f,"\tuptest user: %s\n",st->uptest_usr[0]?st->uptest_usr:"(process owner)");
}
if(st->query_test_name) {
unsigned char nmbuf[DNSNAMEBUFSIZE];
fsprintf_or_return(f,"\tname used in query uptest: %s\n",
rhn2str(st->query_test_name,nmbuf,sizeof(nmbuf)));
}
if (st->scheme[0]) {
fsprintf_or_return(f,"\tscheme: %s\n", st->scheme);
}
fsprintf_or_return(f,"\tforce cache purging: %s\n",st->purge_cache?"on":"off");
fsprintf_or_return(f,"\tserver is cached: %s\n",st->nocache?"off":"on");
fsprintf_or_return(f,"\tlean query: %s\n",st->lean_query?"on":"off");
fsprintf_or_return(f,"\tUse EDNS in outgoing queries: %s\n",st->edns_query?"on":"off");
fsprintf_or_return(f,"\tUse only proxy?: %s\n",st->is_proxy?"on":"off");
fsprintf_or_return(f,"\tAssumed root server: %s\n",st->rootserver?(st->rootserver==1?"yes":"discover"):"no");
fsprintf_or_return(f,"\tRandomize server query order: %s\n",st->rand_servers?"yes":"no");
fsprintf_or_return(f,"\tDefault policy: %s\n",const_name(st->policy));
fsprintf_or_return(f,"\tPolicies:%s\n", st->alist?"":" (none)");
for (j=0;j<DA_NEL(st->alist);++j) {
slist_t *sl=&DA_INDEX(st->alist,j);
unsigned char buf[DNSNAMEBUFSIZE];
fsprintf_or_return(f,"\t\t%s: %s%s\n",
sl->rule==C_INCLUDED?"include":"exclude",
sl->exact?"":".",
rhn2str(sl->domain,buf,sizeof(buf)));
}
if(serv_has_rejectlist(st)) {
fsprintf_or_return(f,"\tAddresses which should be rejected in replies:\n");
m=DA_NEL(st->reject_a4);
for (j=0;j<m;++j) {
addr4maskpair_t *am=&DA_INDEX(st->reject_a4,j);
char abuf[ADDRSTR_MAXLEN],mbuf[ADDRSTR_MAXLEN];
fsprintf_or_return(f,"\t\t%s/%s\n",inet_ntop(AF_INET,&am->a,abuf,sizeof(abuf)),
inet_ntop(AF_INET,&am->mask,mbuf,sizeof(mbuf)));
}
#if ALLOW_LOCAL_AAAA
m=DA_NEL(st->reject_a6);
for (j=0;j<m;++j) {
addr6maskpair_t *am=&DA_INDEX(st->reject_a6,j);
char abuf[INET6_ADDRSTRLEN],mbuf[INET6_ADDRSTRLEN];
fsprintf_or_return(f,"\t\t%s/%s\n",inet_ntop(AF_INET6,&am->a,abuf,sizeof(abuf)),
inet_ntop(AF_INET6,&am->mask,mbuf,sizeof(mbuf)));
}
#endif
fsprintf_or_return(f,"\tReject policy: %s\n",const_name(st->rejectpolicy));
fsprintf_or_return(f,"\tReject recursively: %s\n",st->rejectrecursively?"yes":"no");
}
return 0;
}

View File

@ -1,190 +0,0 @@
/* conff.h - Definitions for configuration management.
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONFF_H
#define CONFF_H
/* XXX should use the system defined ones. */
/* #define MAXPATH 1024 */
/* #define MAXIFNAME 31 */
#include <config.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/socket.h>
#include <net/if.h>
#include "ipvers.h"
#include "list.h"
/* From main.c */
#if DEBUG>0
extern short int debug_p;
#else
#define debug_p 0
#endif
extern short int stat_pipe;
extern pthread_t main_thrid;
extern uid_t init_uid;
extern char *conf_file;
/* ----------- */
typedef DYNAMIC_ARRAY(pdnsd_a) *addr_array;
typedef DYNAMIC_ARRAY(pdnsd_a2) *addr2_array;
typedef struct {
time_t i_ts;
char is_up;
pdnsd_a2 a;
} atup_t;
typedef DYNAMIC_ARRAY(atup_t) *atup_array;
typedef struct {
unsigned char *domain;
short exact;
short rule;
} slist_t;
typedef DYNAMIC_ARRAY(slist_t) *slist_array;
typedef struct {
struct in_addr a,mask;
} addr4maskpair_t;
typedef DYNAMIC_ARRAY(addr4maskpair_t) *a4_array;
#if ALLOW_LOCAL_AAAA
typedef struct {
struct in6_addr a,mask;
} addr6maskpair_t;
typedef DYNAMIC_ARRAY(addr6maskpair_t) *a6_array;
#endif
typedef struct {
unsigned short port;
short uptest;
time_t timeout;
time_t interval;
time_t ping_timeout;
char scheme[32];
char *uptest_cmd;
char uptest_usr[21];
char interface[IFNAMSIZ];
char device[IFNAMSIZ];
unsigned char *query_test_name;
char *label;
char purge_cache;
char nocache;
char lean_query;
char edns_query;
char is_proxy;
char rootserver;
char rand_servers;
char preset;
char rejectrecursively;
short rejectpolicy;
short policy;
slist_array alist;
atup_array atup_a;
a4_array reject_a4;
#if ALLOW_LOCAL_AAAA
a6_array reject_a6;
#endif
pdnsd_a ping_a;
} servparm_t;
typedef DYNAMIC_ARRAY(servparm_t) *servparm_array;
typedef unsigned char *zone_t;
typedef DYNAMIC_ARRAY(zone_t) *zone_array;
typedef struct {
long perm_cache;
char *cache_dir;
char *pidfile;
int port;
pdnsd_a a;
pdnsd_a out_a;
#ifdef ENABLE_IPV6
struct in6_addr ipv4_6_prefix;
#endif
time_t max_ttl;
time_t min_ttl;
time_t neg_ttl;
short neg_rrs_pol;
short neg_domain_pol;
short verbosity;
char run_as[21];
char daemon;
char debug;
char stat_pipe;
char notcp;
char strict_suid;
char use_nss;
char paranoid;
char lndown_kluge;
char onquery;
char rnd_recs;
int ctl_perms;
char *scheme_file;
int proc_limit;
int procq_limit;
time_t tcp_qtimeout;
time_t timeout;
int par_queries;
int query_method;
int query_port_start;
int query_port_end;
int udpbufsize;
zone_array deleg_only_zones;
} globparm_t;
typedef struct {
char
#ifdef ENABLE_IPV6
prefix,
#endif
pidfile,
verbosity,
pdnsduser,
daemon,
debug,
stat_pipe,
notcp,
query_method;
} cmdlineflags_t;
extern globparm_t global;
extern cmdlineflags_t cmdline;
extern servparm_t serv_presets;
extern servparm_array servers;
int read_config_file(const char *nm, globparm_t *global, servparm_array *servers, int includedepth, char **errstr);
int reload_config_file(const char *nm, char **errstr);
void free_zone(void *ptr);
void free_slist_domain(void *ptr);
void free_slist_array(slist_array sla);
void free_servparm(servparm_t *serv);
int report_conf_stat(int f);
#endif

View File

@ -1,133 +0,0 @@
/* consts.c - Common config constants & handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "consts.h"
#include "rr_types.h"
/* Order alphabetically!! */
static const namevalue_t const_dic[]={
{"auth", C_AUTH},
{"default", C_DEFAULT},
{"dev", C_DEV},
{"diald", C_DIALD},
{"discover", C_DISCOVER},
{"domain", C_DOMAIN},
{"excluded", C_EXCLUDED},
{"exec", C_EXEC},
{"fail", C_FAIL},
{"false", C_OFF},
{"fqdn_only", C_FQDN_ONLY},
{"if", C_IF},
{"included", C_INCLUDED},
{"negate", C_NEGATE},
{"no", C_OFF},
{"none", C_NONE},
{"off", C_OFF},
{"on", C_ON},
{"onquery", C_ONQUERY},
{"ontimeout", C_ONTIMEOUT},
{"ping", C_PING},
{"query", C_QUERY},
{"simple_only", C_SIMPLE_ONLY},
{"tcp_only", TCP_ONLY},
{"tcp_udp", TCP_UDP},
{"true", C_ON},
{"udp_only", UDP_ONLY},
{"udp_tcp", UDP_TCP},
{"yes", C_ON}
};
/* Added by Paul Rombouts */
static const char *const const_names[]={
"error",
"on",
"off",
"default",
"discover",
"none",
"if",
"exec",
"ping",
"query",
"onquery",
"ontimeout",
"udp_only",
"tcp_only",
"tcp_udp",
"udp_tcp",
"dev",
"diald",
"included",
"excluded",
"simple_only",
"fqdn_only",
"auth",
"domain",
"fail",
"negate"
};
/* compare two strings.
The first one is given as pointer to a char array of length len (which
should not contain any null chars),
the second one as a pointer to a null terminated char array.
*/
inline static int keyncmp(const char *key1, int len, const char *key2)
{
int cmp=strncmp(key1,key2,len);
if(cmp) return cmp;
return -(int)((unsigned char)(key2[len]));
}
int binsearch_keyword(const char *name, int len, const namevalue_t dic[], int range)
{
int i=0,j=range;
while(i<j) {
int k=(i+j)/2;
int cmp=keyncmp(name,len,dic[k].name);
if(cmp<0)
j=k;
else if(cmp>0)
i=k+1;
else
return dic[k].val;
}
return 0;
}
int lookup_const(const char *name, int len)
{
return binsearch_keyword(name,len,const_dic,sizeof(const_dic)/sizeof(namevalue_t));
}
/* Added by Paul Rombouts */
const char *const_name(int c)
{
return (c>=0 && c<sizeof(const_names)/sizeof(char *))? const_names[c] : "ILLEGAL!";
}

View File

@ -1,69 +0,0 @@
/* consts.h - Common config constants & handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONSTS_H
#define CONSTS_H
#include <config.h>
#define C_RRTOFFS 64
enum {
C_ERR,
C_ON,
C_OFF,
C_DEFAULT,
C_DISCOVER,
C_NONE,
C_IF,
C_EXEC,
C_PING,
C_QUERY,
C_ONQUERY,
C_ONTIMEOUT,
UDP_ONLY,
TCP_ONLY,
TCP_UDP,
UDP_TCP,
C_DEV,
C_DIALD,
C_INCLUDED,
C_EXCLUDED,
C_SIMPLE_ONLY,
C_FQDN_ONLY,
C_AUTH,
C_DOMAIN,
C_FAIL,
C_NEGATE
};
typedef struct {
const char *name;
int val;
} namevalue_t;
int binsearch_keyword(const char *name, int len, const namevalue_t dic[], int range);
int lookup_const(const char *name, int len);
const char *const_name(int c); /* Added by Paul Rombouts */
#endif

View File

@ -1,64 +0,0 @@
/* debug.c - Various debugging facilities
* Copyright (C) 2001 Thomas Moestl
*
* This file is part of the pdnsd package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "helpers.h"
#include "error.h"
/*
* This is indeed very primitive (it does not track allocation failures
* and so on). It should be expanded some time.
*/
#ifdef ALLOC_DEBUG
void *DBGcalloc(size_t n, size_t sz, char *file, int line)
{
DEBUG_MSG("+ calloc, %s:%d\n", file, line);
return calloc(n, sz);
}
void *DBGmalloc(size_t sz, char *file, int line)
{
DEBUG_MSG("+ malloc, %s:%d\n", file, line);
return malloc(sz);
}
void *DBGrealloc(void *ptr, size_t sz, char *file, int line)
{
if (ptr == NULL && sz != 0)
DEBUG_MSG("+ realloc, %s:%d\n", file, line);
if (ptr != NULL && sz == 0)
DEBUG_MSG("- realloc(0), %s:%d\n", file, line);
return realloc(ptr, sz);
}
void DBGfree(void *ptr, char *file, int line)
{
DEBUG_MSG("- free, %s:%d\n", file, line);
free(ptr);
}
#endif

View File

@ -1,52 +0,0 @@
/* debug.h - Various debugging facilities
* Copyright (C) 2001 Thomas Moestl
*
* This file is part of the pdnsd package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DEBUG_H
#define DEBUG_H
/*
* A hand-rolled alloc debug factility, because most available libraries have
* problems with at least one thread implementation.
*/
#ifdef ALLOC_DEBUG
void *DBGcalloc(size_t n, size_t sz, char *file, int line);
void *DBGmalloc(size_t sz, char *file, int line);
void *DBGrealloc(void *ptr, size_t sz, char *file, int line);
void DBGfree(void *ptr, char *file, int line);
#define pdnsd_calloc(n,sz) DBGcalloc(n,sz,__FILE__,__LINE__)
#define pdnsd_malloc(sz) DBGmalloc(sz,__FILE__,__LINE__)
#define pdnsd_realloc(ptr,sz) DBGrealloc(ptr,sz,__FILE__,__LINE__)
#define pdnsd_free(ptr) DBGfree(ptr,__FILE__,__LINE__)
#else
#define pdnsd_calloc calloc
#define pdnsd_malloc malloc
#define pdnsd_realloc realloc
#define pdnsd_free free
#endif
#endif /* def DEBUG_H */

View File

@ -1,617 +0,0 @@
/* dns.c - Declarations for dns handling and generic dns functions
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "error.h"
#include "helpers.h"
#include "dns.h"
/* Decompress a name record, taking the whole message as msg, returning its results in tgt
* (which should be able hold at least DNSNAMEBUFSIZE chars),
* taking sz as the remaining msg size (it is returned decremented by the name length, ready for further use) and
* a source pointer (it is returned pointing to the location after the name). msgsize is the size of the whole message,
* len is the total name length.
* msg and msgsz are needed for decompression (see rfc1035). The returned data is decompressed, but still in the
* rr name form (length byte - string of that length, terminated by a 0 length byte).
*
* Returned is a dns return code, with one exception: RC_TRUNC, as defined in dns.h, indicates that the message is
* truncated at the name (which needs a special return code, as it might or might not be fatal).
*/
int decompress_name(unsigned char *msg, size_t msgsz, unsigned char **src, size_t *sz, unsigned char *tgt, unsigned int *len)
{
unsigned int lb,offs;
unsigned int hops=0,tpos=0;
unsigned char *lptr=*src;
size_t oldsz=*sz;
size_t newsz=oldsz;
if (newsz==0)
goto name_outside_data;
if (lptr-msg>=msgsz)
goto name_outside_msg;
for(;;) {
newsz--;
lb=*lptr++;
if(lb>0x3f) {
if (lb<0xc0) /* The two highest bits must be either 00 or 11 */
goto unsupported_lbl_bits;
if (newsz==0)
goto name_outside_data;
if (lptr-msg>=msgsz)
goto name_outside_msg;
newsz--;
offs=((lb&0x3f)<<8)|(*lptr);
if (offs>=msgsz)
goto offset_outside_msg;
lptr=msg+offs;
goto jumped;
}
tgt[tpos++]=lb;
if (lb==0)
break;
if (newsz<=lb)
goto name_outside_data;
if (lptr+lb-msg>=msgsz)
goto name_outside_msg;
if (tpos+lb>DNSNAMEBUFSIZE-1) /* terminating null byte has to follow */
goto name_buf_full;
newsz -= lb;
do {
/* if (!*lptr || *lptr=='.')
return RC_FORMAT; */
tgt[tpos++]=*lptr++;
} while(--lb);
}
goto return_OK;
jumped:
++hops;
for(;;) {
lb=*lptr++;
while(lb>0x3f) {
if (lb<0xc0) /* The two highest bits must be either 00 or 11 */
goto unsupported_lbl_bits;
if (lptr-msg>=msgsz)
goto name_outside_msg;
if (++hops>255)
goto too_many_hops;
offs=((lb&0x3f)<<8)|(*lptr);
if (offs>=msgsz)
goto offset_outside_msg;
lptr=msg+offs;
lb=*lptr++;
}
tgt[tpos++]=lb;
if (lb==0)
break;
if (lptr+lb-msg>=msgsz)
goto name_outside_msg;
if(tpos+lb>DNSNAMEBUFSIZE-1) /* terminating null byte has to follow */
goto name_buf_full;
do {
/* if (!*lptr || *lptr=='.')
return RC_FORMAT; */
tgt[tpos++]=*lptr++;
} while(--lb);
}
return_OK:
*src += oldsz-newsz;
*sz = newsz;
if(len) *len=tpos;
return RC_OK;
name_outside_data:
DEBUG_MSG("decompress_name: compressed name extends outside data field.\n");
return RC_TRUNC;
name_outside_msg:
DEBUG_MSG("decompress_name: compressed name extends outside message.\n");
return RC_FORMAT;
unsupported_lbl_bits:
DEBUG_MSG(lb==0x41?"decompress_name: Bit-string labels not supported.\n":
"decompress_name: unsupported label type.\n");
return RC_FORMAT;
offset_outside_msg:
DEBUG_MSG("decompress_name: offset points outside message.\n");
return RC_FORMAT;
name_buf_full:
DEBUG_MSG("decompress_name: decompressed name larger than %u bytes.\n", DNSNAMEBUFSIZE);
return RC_FORMAT;
too_many_hops:
DEBUG_MSG("decompress_name: too many offsets in compressed name.\n");
return RC_FORMAT;
}
#if 0
/* Compare two names (ordinary C-strings) back-to-forth and return the longest match.
The comparison is done at name granularity.
The return value is the length of the match in name elements.
*os (*od) is set to the offset in the domain name ms (md) of the match.
*/
int domain_name_match(const unsigned char *ms, const unsigned char *md, int *os, int *od)
{
int i,j,k=0,offs,offd;
offs=i=strlen(ms); offd=j=strlen(md);
if(i && ms[i-1]=='.') --offs;
if(j && md[j-1]=='.') --offd;
if(i==0 || (i==1 && *ms=='.') || j==0 || (j==1 && *md=='.'))
/* Special case: root domain */
;
else {
--i; if(ms[i]=='.') --i;
--j; if(md[j]=='.') --j;
while(tolower(ms[i]) == tolower(md[j])) {
if(ms[i]=='.') {
++k;
offs=i+1; offd=j+1;
}
if(i==0 || j==0) {
if((i==0 || ms[i-1]=='.') && (j==0 || md[j-1]=='.')) {
++k;
offs=i; offd=j;
}
break;
}
--i; --j;
}
}
if(os) *os=offs;
if(od) *od=offd;
return k;
}
#endif
/* Compare the names (in length byte-string notation) back-to-forth and return the longest match.
The comparison is done at name granularity.
The return value is the length of the match in name elements.
*os (*od) is set to the offset in the domain name ms (md) of the match.
*/
unsigned int domain_match(const unsigned char *ms, const unsigned char *md, unsigned int *os, unsigned int *od)
{
unsigned int i,j,k,n,ns=0,nd=0,offs,offd;
unsigned char lb,ls[128],ld[128];
/* first collect all length bytes */
i=0;
while((lb=ms[i])) {
PDNSD_ASSERT(ns<128, "domain_match: too many name segments");
ls[ns++]=lb;
i += ((unsigned)lb)+1;
}
j=0;
while((lb=md[j])) {
PDNSD_ASSERT(nd<128, "domain_match: too many name segments");
ld[nd++]=lb;
j += ((unsigned)lb)+1;
}
n=ns; if(n>nd) n=nd;
for(k=1; offs=i,offd=j,k<=n; ++k) {
lb=ls[ns-k];
if(lb!=ld[nd-k]) goto mismatch;
for(;lb;--lb)
if(tolower(ms[--i]) != tolower(md[--j])) goto mismatch;
--i; --j;
}
mismatch:
if(os) *os=offs;
if(od) *od=offd;
return k-1;
}
/* compress the domain name in in and put the result (of maximum length of rhnlen(in)) and
* fill cb with compression information for further strings.*cb may be NULL initially.
* offs is the offset the generated string will be placed in the packet.
* retval: 0 - error, otherwise length
* When done, just free() cb (if it is NULL, free will behave correctly).
* It is guaranteed (and insured by assertions) that the output is smaller or equal in
* size to the input.
*/
unsigned int compress_name(unsigned char *in, unsigned char *out, unsigned int offs, dlist *cb)
{
compel_t *ci;
unsigned int longest=0,lrem=0,coffs=0;
unsigned int rl=0;
unsigned ilen = rhnlen(in);
unsigned short add=1;
PDNSD_ASSERT(ilen<=DNSNAMEBUFSIZE, "compress_name: name too long");
/* part 1: compression */
for (ci=dlist_first(*cb); ci; ci=dlist_next(ci)) {
unsigned int rv,rem,to;
if ((rv=domain_match(in, ci->s, &rem,&to))>longest) {
/*
* This has some not obvious implications that should be noted: If a
* domain name as saved in the list has been compressed, we only can
* index the non-compressed part. We rely here that the first occurence
* can't be compressed. So we take the first occurence of a given length.
* This works perfectly, but watch it if you change something.
*/
unsigned int newoffs= ci->index + to;
/* Only use if the offset is not too large. */
if(newoffs<=0x3fff) {
longest=rv;
lrem=rem;
coffs= newoffs;
}
}
}
if (longest>0) {
PDNSD_ASSERT(lrem+2 <= ilen, "compress_name: length increased");
memcpy(out, in,lrem);
out[lrem]=0xc0|((coffs&0x3f00)>>8);
out[lrem+1]=coffs&0xff;
rl=lrem+2;
add= lrem!=0;
}
else {
memcpy(out,in,ilen);
rl=ilen;
}
/* part 2: addition to the cache structure */
if (add) {
if (!(*cb=dlist_grow(*cb,sizeof(compel_t)+ilen)))
return 0;
ci=dlist_last(*cb);
ci->index=offs;
memcpy(ci->s,in,ilen);
}
return rl;
}
/* Convert a numeric IP address into a domain name representation
(C string) suitable for PTR records.
buf is assumed to be at least DNSNAMEBUFSIZE bytes in size.
*/
int a2ptrstr(pdnsd_ca *a, int tp, unsigned char *buf)
{
if(tp==T_A) {
unsigned char *p=(unsigned char *)&a->ipv4.s_addr;
int n=snprintf(charp buf,DNSNAMEBUFSIZE,"%u.%u.%u.%u.in-addr.arpa.",p[3],p[2],p[1],p[0]);
if(n<0 || n>=DNSNAMEBUFSIZE)
return 0;
}
else
#if ALLOW_LOCAL_AAAA
if(tp==T_AAAA) {
unsigned char *p=(unsigned char *)&a->ipv6;
int i,offs=0;
for (i=15;i>=0;--i) {
unsigned char bt=p[i];
int n=snprintf(charp(buf+offs), DNSNAMEBUFSIZE-offs,"%x.%x.",bt&0xf,(bt>>4)&0xf);
if(n<0) return 0;
offs+=n;
if(offs>=DNSNAMEBUFSIZE) return 0;
}
if(!strncp(charp(buf+offs),"ip6.arpa.",DNSNAMEBUFSIZE-offs))
return 0;
}
else
#endif
return 0;
return 1;
}
/*
* Add records for a host as read from a hosts-style file.
* Returns 1 on success, 0 in an out of memory condition, and -1 when there was a problem with
* the record data.
*/
static int add_host(unsigned char *pn, unsigned char *rns, pdnsd_ca *a, int tp, int a_sz, time_t ttl, unsigned flags, int reverse)
{
dns_cent_t ce;
if (!init_cent(&ce, pn, 0, 0, flags DBG0))
return 0;
if (!add_cent_rr(&ce,tp,ttl,0,CF_LOCAL,a_sz,a DBG0))
goto free_cent_return0;
if (!add_cent_rr(&ce,T_NS,ttl,0,CF_LOCAL,rhnlen(rns),rns DBG0))
goto free_cent_return0;
add_cache(&ce);
free_cent(&ce DBG0);
if (reverse) {
unsigned char b2[DNSNAMEBUFSIZE],rhn[DNSNAMEBUFSIZE];
if(!a2ptrstr(a,tp,b2))
return -1;
if (!str2rhn(b2,rhn))
return -1;
if (!init_cent(&ce, rhn, 0, 0, flags DBG0))
return 0;
if (!add_cent_rr(&ce,T_PTR,ttl,0,CF_LOCAL,rhnlen(pn),pn DBG0))
goto free_cent_return0;
if (!add_cent_rr(&ce,T_NS,ttl,0,CF_LOCAL,rhnlen(rns),rns DBG0))
goto free_cent_return0;
add_cache(&ce);
free_cent(&ce DBG0);
}
return 1;
free_cent_return0:
free_cent(&ce DBG0);
return 0;
}
/*
* Read a file in /etc/hosts-format and add generate rrs for it.
* Errors are largely ignored so that we can skip entries we do not understand
* (but others possibly do).
*/
int read_hosts(const char *fn, unsigned char *rns, time_t ttl, unsigned flags, int aliases, char **errstr)
{
int rv=0;
FILE *f;
char *buf;
size_t buflen=256;
if (!(f=fopen(fn,"r"))) {
if(asprintf(errstr, "Failed to source %s: %s", fn, strerror(errno))<0) *errstr=NULL;
return 0;
}
buf=malloc(buflen);
if(!buf) {
*errstr=NULL;
goto fclose_return;
}
while(getline(&buf,&buflen,f)>=0) {
unsigned int len;
unsigned char *p,*pn,*pi;
unsigned char rhn[DNSNAMEBUFSIZE];
int tp,sz;
pdnsd_ca a;
p= ucharp strchr(buf,'#');
if(p) *p=0;
p= ucharp buf;
for(;;) {
if(!*p) goto nextline;
if(!isspace(*p)) break;
++p;
}
pi=p;
do {
if(!*++p) goto nextline;
} while(!isspace(*p));
*p=0;
do {
if(!*++p) goto nextline;
} while (isspace(*p));
pn=p;
do {
++p;
} while(*p && !isspace(*p));
len=p-pn;
if (parsestr2rhn(pn,len,rhn)!=NULL)
continue;
if (inet_aton(charp pi,&a.ipv4)) {
tp=T_A;
sz=sizeof(struct in_addr);
} else {
#if ALLOW_LOCAL_AAAA /* We don't read them otherwise, as the C library may not be able to to that.*/
if (inet_pton(AF_INET6,charp pi,&a.ipv6)>0) {
tp=T_AAAA;
sz=sizeof(struct in6_addr);
} else
#endif
continue;
}
{
int res=add_host(rhn, rns, &a, tp,sz, ttl, flags, 1);
if(res==0) {
*errstr= NULL;
goto cleanup_return;
}
else if(res<0)
continue;
}
if(aliases) {
for(;;) {
for(;;) {
if(!*p) goto nextline;
if(!isspace(*p)) break;
++p;
}
pn=p;
do {
++p;
} while(*p && !isspace(*p));
len=p-pn;
if (parsestr2rhn(pn,len,rhn)!=NULL)
break;
if (add_host(rhn, rns, &a, tp,sz, ttl, flags, 0) == 0) {
*errstr= NULL;
goto cleanup_return;
}
}
}
nextline:;
}
if (feof(f))
rv=1;
else if(asprintf(errstr, "Failed to source %s: %s", fn, strerror(errno))<0) *errstr=NULL;
cleanup_return:
free(buf);
fclose_return:
fclose(f);
return rv;
}
/* Get the name of an RR type given its value. */
const char *getrrtpname(int tp)
{
return tp>=T_MIN && tp<=T_MAX? rrnames[tp-T_MIN]: "[unknown]";
}
#if DEBUG>0
/*
* Const decoders for debugging display
*/
static const char *const c_names[C_NUM] = {"IN","CS","CH","HS"};
static const char *const qt_names[QT_NUM]={"IXFR","AXFR","MAILB","MAILA","*"};
const char *get_cname(int id)
{
if (id>=C_MIN && id<=C_MAX)
return c_names[id-C_MIN];
if (id==QC_ALL)
return "*";
return "[unknown]";
}
const char *get_tname(int id)
{
if (id>=T_MIN && id<=T_MAX)
return rrnames[id-T_MIN];
else if (id>=QT_MIN && id<=QT_MAX)
return qt_names[id-QT_MIN];
return "[unknown]";
}
#define NRC 17
static const char *const e_names[NRC]={
"no error",
"query format error",
"server failed",
"non-existent domain",
"not supported",
"query refused",
"name exists when it should not",
"RR set exists when it should not",
"RR set that should exist does not",
"server not authoritative for zone",
"name not contained in zone",
"11",
"12",
"13",
"14",
"15",
"bad OPT version"
};
const char *get_ename(int id)
{
if (id>=0 && id<NRC)
return e_names[id];
return "[unknown]";
}
/* Construct a human-readable string listing the flags that are set
in a dns header. buf must have a size of at least DNSFLAGSMAXSTRSIZE.
Used for debugging purposes only.
*/
char *dnsflags2str(dns_hdr_t *hdr, char *buf)
{
char *p= buf;
if (hdr->aa)
p=mempcpy(p, " AA", 3);
if (hdr->tc)
p=mempcpy(p, " TC", 3);
if (hdr->rd)
p=mempcpy(p, " RD", 3);
if (hdr->ra)
p=mempcpy(p, " RA", 3);
if (hdr->z)
p=mempcpy(p, " Z", 2);
if (hdr->ad)
p=mempcpy(p, " AD", 3);
if (hdr->cd)
p=mempcpy(p, " CD", 3);
*p=0;
return buf;
}
#endif
#if DEBUG>=9
/* Based on debug code contributed by Kiyo Kelvin Lee. */
void debug_dump_dns_msg(void *data, size_t len)
{
unsigned char *udata = (unsigned char *)data;
# define dmpchksz 16
char buf[dmpchksz*4+2];
size_t i, j, k, l;
DEBUG_MSG("pointer=%p len=%lu\n", udata, (unsigned long)len);
for (i = 0; i < len; i += dmpchksz) {
char *cp = buf;
k = l = i + dmpchksz;
if(k > len) k = len;
for (j = i; j < k; ++j) {
int n = sprintf(cp, "%02x ", udata[j]);
cp += n;
}
for (; j < l; ++j) {
*cp++ = ' ';
*cp++ = ' ';
*cp++ = ' ';
}
*cp++ = ' ';
for (j = i; j < k; ++j) {
*cp++ = isprint(udata[j]) ? udata[j] : '.';
}
PDNSD_ASSERT(cp < buf + sizeof(buf), "debug_dump_dns_msg: line buffer overflowed");
*cp = '\0';
DEBUG_MSG("%s\n", buf);
}
if(len >= sizeof(dns_hdr_t)) {
dns_hdr_t *hdr = (dns_hdr_t *)data;
DEBUG_MSG(
"id=%04x qr=%x opcode=%x aa=%x tc=%x rd=%x "
"ra=%x z=%x ad=%x cd=%x rcode=%x\n",
ntohs(hdr->id), hdr->qr, hdr->opcode, hdr->aa, hdr->tc, hdr->rd,
hdr->ra, hdr->z, hdr->ad, hdr->cd, hdr->rcode);
DEBUG_MSG(
"qdcount=%04x ancount=%04x nscount=%04x arcount=%04x\n",
ntohs(hdr->qdcount), ntohs(hdr->ancount), ntohs(hdr->nscount), ntohs(hdr->arcount));
}
}
#endif

View File

@ -1,309 +0,0 @@
/* dns.h - Declarations for dns handling and generic dns functions
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2005, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef DNS_H
#define DNS_H
#include <config.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/types.h>
#include <inttypes.h>
#include "rr_types.h"
#include "list.h"
#include "ipvers.h"
#if (TARGET==TARGET_BSD)
# if !defined(__BIG_ENDIAN)
# if defined(BIG_ENDIAN)
# define __BIG_ENDIAN BIG_ENDIAN
# elif defined(_BIG_ENDIAN)
# define __BIG_ENDIAN _BIG_ENDIAN
# endif
# endif
# if !defined(__LITTLE_ENDIAN)
# if defined(LITTLE_ENDIAN)
# define __LITTLE_ENDIAN LITTLE_ENDIAN
# elif defined(_LITTLE_ENDIAN)
# define __LITTLE_ENDIAN _LITTLE_ENDIAN
# endif
# endif
# if !defined(__BYTE_ORDER)
# if defined(BYTE_ORDER)
# define __BYTE_ORDER BYTE_ORDER
# elif defined(_BYTE_ORDER)
# define __BYTE_ORDER _BYTE_ORDER
# endif
# endif
#endif
/* Deal with byte orders */
#ifndef __BYTE_ORDER
# if defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
# error Fuzzy endianness system! Both __LITTLE_ENDIAN and __BIG_ENDIAN have been defined!
# endif
# if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
# error Strange Endianness-less system! Neither __LITTLE_ENDIAN nor __BIG_ENDIAN has been defined!
# endif
# if defined(__LITTLE_ENDIAN)
# define __BYTE_ORDER __LITTLE_ENDIAN
# elif defined(__BIG_ENDIAN)
# define __BYTE_ORDER __BIG_ENDIAN
# endif
#endif
/* special rr type codes for queries */
#define QT_MIN 251
#define QT_IXFR 251
#define QT_AXFR 252
#define QT_MAILB 253
#define QT_MAILA 254
#define QT_ALL 255
#define QT_MAX 255
#define QT_NUM 5
/* rr classes */
#define C_MIN 1
#define C_IN 1
#define C_CS 2
#define C_CH 3
#define C_HS 4
#define C_MAX 4
#define C_NUM 4
/* special classes for queries */
#define QC_ALL 255
/* status codes */
#define RC_OK 0
#define RC_FORMAT 1
#define RC_SERVFAIL 2
#define RC_NAMEERR 3
#define RC_NOTSUPP 4
#define RC_REFUSED 5
#define RC_BADVERS 16
/*
* special internal retvals
*/
#define RC_NOTCACHED 0xfffa
#define RC_CACHED 0xfffb
#define RC_STALE 0xfffc
#define RC_TCPREFUSED 0xfffd
#define RC_TRUNC 0xfffe
#define RC_FATALERR 0xffff
/* query/response */
#define QR_QUERY 0
#define QR_RESP 1
/*opcodes */
#define OP_QUERY 0
#define OP_IQUERY 1
#define OP_STATUS 2
#if 0
typedef struct {
/* the name is the first field. It has variable length, so it can't be put in the struct */
uint16_t type;
uint16_t class;
uint32_t ttl;
uint16_t rdlength;
/* rdata follows */
} __attribute__((packed)) rr_hdr_t;
#define sizeof_rr_hdr_t (sizeof rr_hdr_t)
#else
/* We will not actually use the rr_hdr_t type, only its size:
sizeof(rr_hdr_t) = 2 + 2 + 4 + 2 */
#define sizeof_rr_hdr_t 10
#endif
#define sizeof_opt_pseudo_rr (1+sizeof_rr_hdr_t)
#if 0
typedef struct {
/* The server name and maintainer mailbox are the first two fields. It has variable length, */
/* so they can't be put in the struct */
uint32_t serial;
uint32_t refresh;
uint32_t retry;
uint32_t expire;
uint32_t minimum;
} __attribute__((packed)) soa_r_t;
typedef struct {
/* char qname[];*/
uint16_t qtype;
uint16_t qclass;
} __attribute__((packed)) std_query_t;
#endif
typedef struct {
uint16_t id;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int rd:1;
unsigned int tc:1;
unsigned int aa:1;
unsigned int opcode:4;
unsigned int qr:1;
unsigned int rcode:4;
unsigned int cd:1;
unsigned int ad:1;
unsigned int z :1;
unsigned int ra:1;
#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned int qr:1;
unsigned int opcode:4;
unsigned int aa:1;
unsigned int tc:1;
unsigned int rd:1;
unsigned int ra:1;
unsigned int z :1;
unsigned int ad:1;
unsigned int cd:1;
unsigned int rcode:4;
#else
# error "Please define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN"
#endif
uint16_t qdcount;
uint16_t ancount;
uint16_t nscount;
uint16_t arcount;
} __attribute__((packed)) dns_hdr_t;
/* A structure that can also be used for DNS messages over TCP. */
typedef struct {
#ifndef NO_TCP_QUERIES
uint16_t len;
#endif
dns_hdr_t hdr;
} __attribute__((packed)) dns_msg_t;
#ifdef NO_TCP_QUERIES
# define dnsmsghdroffset 0
#else
# define dnsmsghdroffset 2
#endif
/* Structure for storing EDNS (Extension mechanisms for DNS) information. */
typedef struct {
unsigned short udpsize;
unsigned short rcode;
unsigned short version;
unsigned char do_flg;
} edns_info_t;
/* Macros to retrieve or store integer data that is not necessarily aligned.
Also takes care of network to host byte order.
The pointer cp is advanced and should be of type void* or char*.
These are actually adapted versions of the NS_GET16 and NS_GET32
macros in the arpa/nameser.h include file in the BIND 9 source.
*/
#define GETINT16(s,cp) do { \
register uint16_t t_s; \
register const unsigned char *t_cp = (const unsigned char *)(cp); \
t_s = (uint16_t)*t_cp++ << 8; \
t_s |= (uint16_t)*t_cp++; \
(s) = t_s; \
(cp) = (void *)t_cp; \
} while (0)
#define GETINT32(l,cp) do { \
register uint32_t t_l; \
register const unsigned char *t_cp = (const unsigned char *)(cp); \
t_l = (uint32_t)*t_cp++ << 24; \
t_l |= (uint32_t)*t_cp++ << 16; \
t_l |= (uint32_t)*t_cp++ << 8; \
t_l |= (uint32_t)*t_cp++; \
(l) = t_l; \
(cp) = (void *)t_cp; \
} while (0)
#define PUTINT16(s,cp) do { \
register uint16_t t_s = (uint16_t)(s); \
register unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp++ = t_s; \
(cp) = (void *)t_cp; \
} while (0)
#define PUTINT32(l,cp) do { \
register uint32_t t_l = (uint32_t)(l); \
register unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp++ = t_l; \
(cp) = (void *)t_cp; \
} while (0)
/* Size (number of bytes) of buffers used to hold domain names. */
#define DNSNAMEBUFSIZE 256
/* Recursion depth. */
#define MAX_HOPS 20
/*
* Types for compression buffers.
*/
typedef struct {
unsigned int index;
unsigned char s[0];
} compel_t;
int decompress_name(unsigned char *msg, size_t msgsz, unsigned char **src, size_t *sz, unsigned char *tgt, unsigned int *len);
/* int domain_name_match(const unsigned char *ms, const unsigned char *md, int *os, int *od); */
unsigned int domain_match(const unsigned char *ms, const unsigned char *md, unsigned int *os, unsigned int *od);
unsigned int compress_name(unsigned char *in, unsigned char *out, unsigned int offs, dlist *cb);
int a2ptrstr(pdnsd_ca *a, int tp, unsigned char *buf);
int read_hosts(const char *fn, unsigned char *rns, time_t ttl, unsigned flags, int aliases, char **errstr);
const char *getrrtpname(int tp);
#if DEBUG>0
const char *get_cname(int id);
const char *get_tname(int id);
const char *get_ename(int id);
#define DNSFLAGSMAXSTRSIZE (7*3+1)
char *dnsflags2str(dns_hdr_t *hdr, char *buf);
#endif
#if DEBUG>=9
void debug_dump_dns_msg(void *data, size_t len);
#define DEBUG_DUMP_DNS_MSG(d,l) {if(debug_p && global.verbosity>=9) debug_dump_dns_msg(d,l);}
#else
#define DEBUG_DUMP_DNS_MSG(d,l)
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
/* dns_answer.h - Receive and process icoming dns queries.
Copyright (C) 2000 Thomas Moestl
Copyright (C) 2005 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef DNS_ANSWER_H
#define DNS_ANSWER_H
#include <config.h>
/* --- from main.c */
extern pthread_t main_thrid,servstat_thrid,statsock_thrid,tcps_thrid,udps_thrid;
extern volatile int tcp_socket;
extern volatile int udp_socket;
/* --- */
int init_udp_socket(void);
int init_tcp_socket(void);
void start_dns_servers(void);
int report_thread_stat(int f);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +0,0 @@
/* dns_query.h - Execute outgoing dns queries and write entries to cache
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2006, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef DNS_QUERY_H
#define DNS_QUERY_H
#include "cache.h"
/* Default UDP buffer size (when EDNS is not used). */
#define UDP_BUFSIZE 512
typedef struct qhintnode_s qhintnode_t;
/* --- parallel query */
int r_dns_cached_resolve(unsigned char *name, int thint, dns_cent_t **cachedp,
int hops, qhintnode_t *qhlist, time_t queryts,
unsigned char *c_soa);
#define dns_cached_resolve(name,thint,cachedp,hops,queryts,c_soa) \
r_dns_cached_resolve(name,thint,cachedp,hops,NULL,queryts,c_soa)
addr2_array dns_rootserver_resolv(atup_array atup_a, int port, char edns_query, time_t timeout);
int query_uptest(pdnsd_a *addr, int port, const unsigned char *name, time_t timeout, int rep);
/* --- from dns_answer.c */
int add_opt_pseudo_rr(dns_msg_t **ans, size_t *sz, size_t *allocsz,
unsigned short udpsize, unsigned short rcode,
unsigned short ednsver, unsigned short Zflags);
size_t remove_opt_pseudo_rr(dns_msg_t *ans, size_t sz);
#endif

View File

@ -1,142 +0,0 @@
/* error.c - Error handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2004, 2005, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
#include <syslog.h>
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include "error.h"
#include "helpers.h"
#include "conff.h"
pthread_mutex_t loglock = PTHREAD_MUTEX_INITIALIZER;
volatile short int use_log_lock=0;
/*
* Initialize a mutex for io-locking in order not to produce gibberish on
* multiple simultaneous errors.
*/
/* This is now defined as an inline function in error.h */
#if 0
void init_log_lock(void)
{
use_log_lock=1;
}
#endif
/* We crashed? Ooops... */
void crash_msg(char *msg)
{
log_error("%s", msg);
log_error("pdnsd probably crashed due to a bug. Please consider sending a bug");
log_error("report to p.a.rombouts@home.nl or tmoestl@gmx.net");
}
/* Log a warning, error or info message.
* If we are a daemon, use the syslog. s is a format string like in printf,
* the optional following arguments are the arguments like in printf */
void log_message(int prior, const char *s, ...)
{
int gotlock=0;
va_list va;
FILE *f;
if (use_log_lock) {
gotlock=softlock_mutex(&loglock);
/* If we failed to get the lock and the type of the
message is "info" or less important, then don't bother. */
if(!gotlock && prior>=LOG_INFO)
return;
}
if (global.daemon) {
openlog("pdnsd",LOG_PID,LOG_DAEMON);
va_start(va,s);
vsyslog(prior,s,va);
va_end(va);
closelog();
}
else {
f=stderr;
#if DEBUG > 0
goto printtofile;
}
if(debug_p) {
f=dbg_file;
printtofile:
#endif
{
char ts[sizeof "* 12/31 23:59:59| "];
time_t tt = time(NULL);
struct tm tm;
if(!localtime_r(&tt, &tm) || strftime(ts, sizeof(ts), "* %m/%d %T| ", &tm) <=0)
ts[0]=0;
fprintf(f,"%spdnsd: %s: ", ts,
prior<=LOG_CRIT?"critical":
prior==LOG_ERR?"error":
prior==LOG_WARNING?"warning":
"info");
}
va_start(va,s);
vfprintf(f,s,va);
va_end(va);
{
const char *p=strchr(s,0);
if(!p || p==s || *(p-1)!='\n')
fputc('\n',f);
}
}
if (gotlock)
pthread_mutex_unlock(&loglock);
}
#if DEBUG > 0
/* XXX: The timestamp generation makes this a little heavy-weight */
void debug_msg(int c, const char *fmt, ...)
{
va_list va;
if (!c) {
char ts[sizeof "12/31 23:59:59"];
time_t tt = time(NULL);
struct tm tm;
unsigned *id;
if(localtime_r(&tt, &tm) && strftime(ts, sizeof(ts), "%m/%d %T", &tm) > 0) {
if((id = (unsigned *)pthread_getspecific(thrid_key)))
fprintf(dbg_file,"%u %s| ", *id, ts);
else
fprintf(dbg_file,"- %s| ", ts);
}
}
va_start(va,fmt);
vfprintf(dbg_file,fmt,va);
va_end(va);
fflush(dbg_file);
}
#endif /* DEBUG */

View File

@ -1,115 +0,0 @@
/* error.h - Error handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2004, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef ERROR_H
#define ERROR_H
#include <config.h>
#include <time.h>
#include <pthread.h>
#include <stdio.h>
#include <signal.h>
#include <syslog.h>
#include "thread.h"
#include "helpers.h"
#include "pdnsd_assert.h"
/* --- from error.c */
extern volatile short int use_log_lock;
/* --- */
void crash_msg(char *msg);
inline static void init_log_lock(void) __attribute__((always_inline));
inline static void init_log_lock(void)
{
use_log_lock=1;
}
void log_message(int prior,const char *s, ...) printfunc(2, 3);
#if !defined(CPP_C99_VARIADIC_MACROS)
/* GNU C Macro Varargs style. */
#define log_error(args...) log_message(LOG_ERR,args)
#define log_warn(args...) log_message(LOG_WARNING,args)
#define log_info(level,args...) {if((level)<=global.verbosity) log_message(LOG_INFO,args);}
#else
/* ANSI C99 style. */
#define log_error(...) log_message(LOG_ERR,__VA_ARGS__)
#define log_warn(...) log_message(LOG_WARNING,__VA_ARGS__)
#define log_info(level,...) {if((level)<=global.verbosity) log_message(LOG_INFO,__VA_ARGS__);}
#endif
/* Following are some ugly macros for debug messages that
* should inhibit any code generation when DEBUG is not defined.
* Of course, those messages could be done in a function, but I
* want to save the overhead when DEBUG is not defined.
* debug_p needs to be defined (by including conff.h), or you
* will get strange errors.
* A macro call expands to a complete statement, so a semicolon after
* the macro call is redundant.
* The arguments are normal printfs, so you know how to use the args
*/
#if DEBUG>0
void debug_msg(int c, const char *fmt, ...) printfunc(2, 3);
/* from main.c */
extern FILE *dbg_file;
#endif
#if !defined(CPP_C99_VARIADIC_MACROS)
/* GNU C Macro Varargs style. */
# if DEBUG > 0
# define DEBUG_MSG(args...) {if (debug_p) debug_msg(0,args);}
# define DEBUG_MSGC(args...) {if (debug_p) debug_msg(1,args);}
# define DEBUG_PDNSDA_MSG(args...) {char _debugsockabuf[ADDRSTR_MAXLEN]; DEBUG_MSG(args);}
# define PDNSDA2STR(a) pdnsd_a2str(a,_debugsockabuf,sizeof(_debugsockabuf))
# define DEBUG_RHN_MSG(args...) {unsigned char _debugstrbuf[DNSNAMEBUFSIZE]; DEBUG_MSG(args);}
# define RHN2STR(a) rhn2str(a,_debugstrbuf,sizeof(_debugstrbuf))
# else
# define DEBUG_MSG(args...)
# define DEBUG_MSGC(args...)
# define DEBUG_PDNSDA_MSG(args...)
# define DEBUG_RHN_MSG(args...)
# endif /* DEBUG > 0 */
#else
/* ANSI C99 style. */
# if DEBUG > 0
/*
* XXX: The ANSI and GCC variadic macros should be merged as far as possible, but that
* might make things even more messy...
*/
# define DEBUG_MSG(...) {if (debug_p) debug_msg(0,__VA_ARGS__);}
# define DEBUG_MSGC(...) {if (debug_p) debug_msg(1,__VA_ARGS__);}
# define DEBUG_PDNSDA_MSG(...) {char _debugsockabuf[ADDRSTR_MAXLEN]; DEBUG_MSG(__VA_ARGS__);}
# define PDNSDA2STR(a) pdnsd_a2str(a,_debugsockabuf,ADDRSTR_MAXLEN)
# define DEBUG_RHN_MSG(...) {unsigned char _debugstrbuf[DNSNAMEBUFSIZE]; DEBUG_MSG(__VA_ARGS__);}
# define RHN2STR(a) rhn2str(a,_debugstrbuf,sizeof(_debugstrbuf))
# else
# define DEBUG_MSG(...)
# define DEBUG_MSGC(...)
# define DEBUG_PDNSDA_MSG(...)
# define DEBUG_RHN_MSG(...)
# endif /* DEBUG > 0 */
#endif
#endif

View File

@ -1,187 +0,0 @@
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.20 2003/03/21 15:28:10 mdodd Exp $
*/
#ifndef _NETINET_IP_ICMP_H_
#define _NETINET_IP_ICMP_H_
/*
* Interface Control Message Protocol Definitions.
* Per RFC 792, September 1981.
*/
/*
* Internal of an ICMP Router Advertisement
*/
struct icmp_ra_addr {
u_int32_t ira_addr;
u_int32_t ira_preference;
};
/*
* Structure of an icmp header.
*/
struct icmp {
u_char icmp_type; /* type of message, see below */
u_char icmp_code; /* type sub code */
u_short icmp_cksum; /* ones complement cksum of struct */
union {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
} ih_idseq;
int ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
n_short ipm_void;
n_short ipm_nextmtu;
} ih_pmtu;
struct ih_rtradv {
u_char irt_num_addrs;
u_char irt_wpa;
u_int16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct id_ts { /* ICMP Timestamp */
n_time its_otime; /* Originate */
n_time its_rtime; /* Receive */
n_time its_ttime; /* Transmit */
} id_ts;
struct id_ip {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
struct icmp_ra_addr id_radv;
u_int32_t id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime
#define icmp_ttime icmp_dun.id_ts.its_ttime
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_radv icmp_dun.id_radv
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
};
/*
* Lower bounds on packet lengths for various types.
* For the error advice packets must first insure that the
* packet is large enough to contain the returned ip header.
* Only then can we do the check to see if 64 bits of packet
* data have been returned, since we need to check the returned
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
/* N.B.: must separately check that ip_hl >= 5 */
/*
* Definition of type and code field values.
*/
#define ICMP_ECHOREPLY 0 /* echo reply */
#define ICMP_UNREACH 3 /* dest unreachable, codes: */
#define ICMP_UNREACH_NET 0 /* bad net */
#define ICMP_UNREACH_HOST 1 /* bad host */
#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
#define ICMP_UNREACH_PORT 3 /* bad port */
#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */
#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */
#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */
#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */
#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
#define ICMP_REDIRECT 5 /* shorter route, codes: */
#define ICMP_REDIRECT_NET 0 /* for network */
#define ICMP_REDIRECT_HOST 1 /* for host */
#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
#define ICMP_ECHO 8 /* echo service */
#define ICMP_ROUTERADVERT 9 /* router advertisement */
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#define ICMP_TIMXCEED 11 /* time exceeded, code: */
#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
#define ICMP_PARAMPROB 12 /* ip header bad */
#define ICMP_PARAMPROB_ERRATPTR 0 /* error at param ptr */
#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
#define ICMP_PARAMPROB_LENGTH 2 /* bad length */
#define ICMP_TSTAMP 13 /* timestamp request */
#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
#define ICMP_IREQ 15 /* information request */
#define ICMP_IREQREPLY 16 /* information reply */
#define ICMP_MASKREQ 17 /* address mask request */
#define ICMP_MASKREPLY 18 /* address mask reply */
#define ICMP_MAXTYPE 18
#define ICMP_INFOTYPE(type) \
((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#ifdef _KERNEL
void icmp_error(struct mbuf *, int, int, n_long, struct ifnet *);
void icmp_input(struct mbuf *, int);
#endif
#endif

View File

@ -1,322 +0,0 @@
/* hash.c - Manage hashes for cached dns records
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2005 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "hash.h"
#include "cache.h"
#include "error.h"
#include "helpers.h"
#include "consts.h"
/* This is not a perfect hash, but I hope it holds. It is designed for 1024 hash
* buckets, and hashes strings with case-insensitivity.
* It is position-aware in a limited way.
* It is exactly seen a two-way hash: because I do not want to exaggerate
* the hash buckets (i do have 1024), but I hash strings and string-comparisons
* are expensive, I save another 32 bit hash in each hash element that is checked
* before the string. The 32 bit hash is also used to order the entries in a hash chain.
* I hope not to have all too much collision concentration.
*
* The ip hash was removed. I don't think it concentrated the collisions too much.
* If it does, the hash algorithm needs to be changed, rather than using another
* hash.
* Some measurements seem to indicate that the hash algorithm is doing reasonable well.
*/
dns_hash_ent_t *hash_buckets[HASH_NUM_BUCKETS];
/*
* Hash a dns name (length-byte string format) to HASH_SZ bit.
* *rhash is set to a long int hash.
*/
static unsigned dns_hash(const unsigned char *str, unsigned long *rhash)
{
unsigned s,i,lb,c;
unsigned long r;
s=0; r=0;
i=0;
while((lb=str[i])) {
s+=lb<<(i%(HASH_SZ-5));
r+=((unsigned long)lb)<<(i%(8*sizeof(unsigned long)-7));
++i;
do {
c=toupper(str[i]);
s+=c<<(i%(HASH_SZ-5));
r+=((unsigned long)c)<<(i%(8*sizeof(unsigned long)-7));
++i;
} while(--lb);
}
s=(s&HASH_BITMASK)+((s&(~HASH_BITMASK))>>HASH_SZ);
s=(s&HASH_BITMASK)+((s&(~HASH_BITMASK))>>HASH_SZ);
s &= HASH_BITMASK;
#ifdef DEBUG_HASH
{
unsigned char buf[DNSNAMEBUFSIZE];
printf("Diagnostic: hashes for %s: %03x,%04lx\n",rhn2str(str,buf,sizeof(buf)),s,r);
}
#endif
if(rhash) *rhash=r;
return s;
}
/*
* Initialize hash to hold a dns hash table
*/
/* This is now defined as an inline function in hash.h */
#if 0
void mk_dns_hash()
{
int i;
for(i=0;i<HASH_NUM_BUCKETS;i++)
hash_buckets[i]=NULL;
}
#endif
/*
Lookup in the hash table for key. If it is found, return the pointer to the cache entry.
If no entry is found, return 0.
If loc is not NULL, it will used to store information about the location within the hash table
This can be used to add an entry with add_dns_hash() or delete the entry with del_dns_hash_ent().
*/
dns_cent_t *dns_lookup(const unsigned char *key, dns_hash_loc_t *loc)
{
dns_cent_t *retval=NULL;
unsigned idx;
unsigned long rh;
dns_hash_ent_t **hep,*he;
idx = dns_hash(key,&rh);
hep = &hash_buckets[idx];
while ((he= *hep) && he->rhash<=rh) {
if (he->rhash==rh && rhnicmp(key,he->data->qname)) {
retval = he->data;
break;
}
hep = &he->next;
}
if(loc) {
loc->pos = hep;
loc->rhash = rh;
}
return retval;
}
/*
Add a cache entry to the hash table.
loc must contain the location where the the new entry should be inserted
(this location can be obtained with dns_lookup).
add_dns_hash returns 1 on success, or 0 if out of memory.
*/
int add_dns_hash(dns_cent_t *data, dns_hash_loc_t *loc)
{
dns_hash_ent_t *he = malloc(sizeof(dns_hash_ent_t));
if(!he)
return 0;
he->next = *(loc->pos);
he->rhash = loc->rhash;
he->data = data;
*(loc->pos) = he;
return 1;
}
/*
Delete the hash entry indentified by the location returned by dns_lookup().
*/
dns_cent_t *del_dns_hash_ent(dns_hash_loc_t *loc)
{
dns_hash_ent_t *he = *(loc->pos);
dns_cent_t *data;
*(loc->pos) = he->next;
data = he->data;
free(he);
return data;
}
/*
* Delete the first entry indexed by key from the hash. Returns the data field or NULL.
* Since two cents are not allowed to be for the same host name, there will be only one.
*/
dns_cent_t *del_dns_hash(const unsigned char *key)
{
unsigned idx;
unsigned long rh;
dns_hash_ent_t **hep,*he;
dns_cent_t *data;
idx = dns_hash(key,&rh);
hep = &hash_buckets[idx];
while ((he= *hep) && he->rhash<=rh) {
if (he->rhash==rh && rhnicmp(key,he->data->qname)) {
*hep = he->next;
data = he->data;
free(he);
return data;
}
hep = &he->next;
}
return NULL; /* not found */
}
/*
* Delete all entries in a hash bucket.
*/
void free_dns_hash_bucket(int i)
{
dns_hash_ent_t *he,*hen;
he=hash_buckets[i];
hash_buckets[i]=NULL;
while (he) {
hen=he->next;
del_cent(he->data);
free(he);
he=hen;
}
}
/*
* Delete all entries in a hash bucket whose names match those in
* an include/exclude list.
*/
void free_dns_hash_selected(int i, slist_array sla)
{
dns_hash_ent_t **hep,*he,*hen;
int j,m=DA_NEL(sla);
hep= &hash_buckets[i];
he= *hep;
while (he) {
unsigned char *name=he->data->qname;
for(j=0;j<m;++j) {
slist_t *sl=&DA_INDEX(sla,j);
unsigned int nrem,lrem;
domain_match(name,sl->domain,&nrem,&lrem);
if(!lrem && (!sl->exact || !nrem)) {
if(sl->rule==C_INCLUDED)
goto delete_entry;
else
break;
}
}
/* default policy is not to delete */
hep= &he->next;
he= *hep;
continue;
delete_entry:
*hep=hen=he->next;;
del_cent(he->data);
free(he);
he=hen;
}
}
/*
* Delete the whole hash table, freeing all memory
*/
void free_dns_hash()
{
int i;
dns_hash_ent_t *he,*hen;
for (i=0;i<HASH_NUM_BUCKETS;i++) {
he=hash_buckets[i];
hash_buckets[i]=NULL;
while (he) {
hen=he->next;
del_cent(he->data);
free(he);
he=hen;
}
}
}
/*
* The following functions are for iterating over the hash.
* fetch_first returns the data field of the first element (or NULL if there is none), and fills pos
* for subsequent calls of fetch_next.
* fetch_next returns the data field of the element after the element that was returned by the last
* call with the same position argument (or NULL if there is none)
*
* Note that these are designed so that you may actually delete the elements you retrieved from the hash.
*/
dns_cent_t *fetch_first(dns_hash_pos_t *pos)
{
int i;
for (i=0;i<HASH_NUM_BUCKETS;i++) {
dns_hash_ent_t *he=hash_buckets[i];
if (he) {
pos->bucket=i;
pos->ent=he->next;
return he->data;
}
}
return NULL;
}
dns_cent_t *fetch_next(dns_hash_pos_t *pos)
{
dns_hash_ent_t *he=pos->ent;
int i;
if (he) {
pos->ent=he->next;
return he->data;
}
for (i=pos->bucket+1;i<HASH_NUM_BUCKETS;i++) {
he=hash_buckets[i];
if (he) {
pos->bucket=i;
pos->ent=he->next;
return he->data;
}
}
return NULL;
}
#ifdef DEBUG_HASH
void dumphash()
{
if(debug_p) {
int i, j;
dns_hash_ent_t *he;
for (i=0; i<HASH_NUM_BUCKETS; i++) {
for (j=0, he=hash_buckets[i]; he; he=he->next, j++) ;
DEBUG_MSG("bucket %d: %d entries\n", i, j);
}
}
}
#endif

View File

@ -1,83 +0,0 @@
/* hash.h - Manage hashes for cached dns records
Copyright (C) 2000 Thomas Moestl
Copyright (C) 2003, 2005 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef _HASH_H_
#define _HASH_H_
#include <config.h>
#include "cache.h"
typedef struct dns_hash_ent_s {
struct dns_hash_ent_s *next;
unsigned long rhash; /* this is a better hash */
dns_cent_t *data;
} dns_hash_ent_t;
/* Redefine this if you want another hash size. Should work ;-).
* The number of hash buckets is computed as power of two;
* so, e.g. HASH_SZ set to 10 yields 1024 hash rows (2^10 or 1<<10).
* Only powers of two are possible conveniently.
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
* you are nuts.) */
/* #define HASH_SZ 10 */ /* Now defined in config.h */
#define HASH_NUM_BUCKETS (1<<HASH_SZ)
#define HASH_BITMASK (HASH_NUM_BUCKETS-1)
extern dns_hash_ent_t *hash_buckets[];
/* A type for remembering the position in the hash table where a new entry can be inserted. */
typedef struct {
dns_hash_ent_t **pos; /* pointer to the location in the hash table */
unsigned long rhash; /* long hash */
} dns_hash_loc_t;
/* A type for position specification for fetch_first and fetch_next */
typedef struct {
int bucket; /* bucket chain we are in */
dns_hash_ent_t *ent; /* entry */
} dns_hash_pos_t;
inline static void mk_dns_hash() __attribute__((always_inline));
inline static void mk_dns_hash()
{
int i;
for(i=0;i<HASH_NUM_BUCKETS;i++)
hash_buckets[i]=NULL;
}
dns_cent_t *dns_lookup(const unsigned char *key, dns_hash_loc_t *loc);
int add_dns_hash(dns_cent_t *data, dns_hash_loc_t *loc);
dns_cent_t *del_dns_hash_ent(dns_hash_loc_t *loc);
dns_cent_t *del_dns_hash(const unsigned char *key);
void free_dns_hash_bucket(int i);
void free_dns_hash_selected(int i, slist_array sla);
void free_dns_hash();
dns_cent_t *fetch_first(dns_hash_pos_t *pos);
dns_cent_t *fetch_next(dns_hash_pos_t *pos);
#ifdef DEBUG_HASH
void dumphash();
#endif
#endif

View File

@ -1,795 +0,0 @@
/* helpers.c - Various helper functions
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2008, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <errno.h>
#include "ipvers.h"
#include "thread.h"
#include "error.h"
#include "helpers.h"
#include "cache.h"
#include "conff.h"
/*
* This is to exit pdnsd from any thread.
*/
void pdnsd_exit()
{
pthread_kill(main_thrid,SIGTERM);
pthread_exit(NULL);
}
/*
* Try to grab a mutex. If we can't, fail. This will loop until we get the
* mutex or fail. This is only used in debugging code or at exit, otherwise
* we might run into lock contention problems.
*/
int softlock_mutex(pthread_mutex_t *mutex)
{
unsigned int tr=0;
while(pthread_mutex_trylock(mutex)) {
if (++tr>=SOFTLOCK_MAXTRIES)
return 0;
usleep_r(10000);
}
return 1;
}
/*
* setuid() and setgid() for a specified user.
*/
int run_as(const char *user)
{
if (user[0]) {
#ifdef HAVE_GETPWNAM_R
struct passwd pwdbuf, *pwd;
size_t buflen;
int err;
for(buflen=128;; buflen*=2) {
char buf[buflen]; /* variable length array */
/* Note that we use getpwnam_r() instead of getpwnam(),
which returns its result in a statically allocated buffer and
cannot be considered thread safe.
Doesn't use NSS! */
err=getpwnam_r(user, &pwdbuf, buf, buflen, &pwd);
if(err==0 && pwd) {
/* setgid first, because we may not be allowed to do it anymore after setuid */
if (setgid(pwd->pw_gid)!=0) {
log_error("Could not change group id to that of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
/* initgroups uses NSS, so we can disable it,
i.e. we might need DNS for LDAP lookups, which times out */
if (global.use_nss && (initgroups(user, pwd->pw_gid)!=0)) {
log_error("Could not initialize the group access list of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
if (setuid(pwd->pw_uid)!=0) {
log_error("Could not change user id to that of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
break;
}
else if(err!=ERANGE) {
if(err)
log_error("run_as user '%s' could not be found: %s",user,strerror(err));
else
log_error("run_as user '%s' could not be found.",user);
return 0;
}
else if(buflen>=16*1024) {
/* If getpwnam_r() seems defective, call it quits rather than
keep on allocating ever larger buffers until we crash. */
log_error("getpwnam_r() requires more than %u bytes of buffer space.",(unsigned)buflen);
return 0;
}
/* Else try again with larger buffer. */
}
#else
/* No getpwnam_r() :-( We'll use getpwnam() and hope for the best. */
struct passwd *pwd;
if (!(pwd=getpwnam(user))) {
log_error("run_as user %s could not be found.",user);
return 0;
}
/* setgid first, because we may not allowed to do it anymore after setuid */
if (setgid(pwd->pw_gid)!=0) {
log_error("Could not change group id to that of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
/* initgroups uses NSS, so we can disable it,
i.e. we might need DNS for LDAP lookups, which times out */
if (global.use_nss && (initgroups(user, pwd->pw_gid)!=0)) {
log_error("Could not initialize the group access list of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
if (setuid(pwd->pw_uid)!=0) {
log_error("Could not change user id to that of run_as user '%s': %s",
user,strerror(errno));
return 0;
}
#endif
}
return 1;
}
/*
* returns whether c is allowed in IN domain names
*/
#if 0
int isdchar (unsigned char c)
{
if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='-'
#ifdef UNDERSCORE
|| c=='_'
#endif
)
return 1;
return 0;
}
#endif
/*
* Convert a string given in dotted notation to the transport format (length byte prepended
* domain name parts, ended by a null length sequence)
* The memory areas referenced by str and rhn may not overlap.
* The buffer rhn points to is assumed to be at least DNSNAMEBUFSIZE bytes in size.
*
* Returns 1 if successful, otherwise 0.
*/
int str2rhn(const unsigned char *str, unsigned char *rhn)
{
unsigned int i,j;
if(*str=='.' && !*(str+1)) {
/* Special case: root domain */
rhn[0]=0;
return 1;
}
for(i=0;;) {
unsigned int jlim= i+63;
if(jlim>DNSNAMEBUFSIZE-2) jlim=DNSNAMEBUFSIZE-2; /* DNSNAMEBUFSIZE-2 because the termination 0 has to follow */
for(j=i; str[j] && str[j]!='.'; ++j) {
if(j>=jlim) return 0;
rhn[j+1]=str[j];
}
if(!str[j])
break;
if(j<=i)
return 0;
rhn[i]=(unsigned char)(j-i);
i = j+1;
}
rhn[i]=0;
if (j>i || i==0)
return 0;
return 1;
}
/*
parsestr2rhn is essentially the same as str2rhn, except that it doesn't look beyond
the first len chars in the input string. It also tolerates strings
not ending in a dot and returns a message in case of an error.
*/
const char *parsestr2rhn(const unsigned char *str, unsigned int len, unsigned char *rhn)
{
unsigned int i,j;
if(len>0 && *str=='.' && (len==1 || !*(str+1))) {
/* Special case: root domain */
rhn[0]=0;
return NULL;
}
i=0;
do {
unsigned int jlim= i+63;
if(jlim>DNSNAMEBUFSIZE-2) jlim=DNSNAMEBUFSIZE-2;
for(j=i; j<len && str[j] && str[j]!='.'; ++j) {
/* if(!isdchar(str[j]))
return "Illegal character in domain name"; */
if(j>=jlim)
return "Domain name element too long";
rhn[j+1]=str[j];
}
if(j<=i) {
if(j<len && str[j])
return "Empty name element in domain name";
else
break;
}
rhn[i]=(unsigned char)(j-i);
i = j+1;
} while(j<len && str[j]);
rhn[i]=0;
if(i==0)
return "Empty domain name not allowed";
return NULL;
}
/*
* Take a host name as used in the dns transfer protocol (a length byte,
* followed by the first part of the name, ..., followed by a 0 length byte),
* and return a string in the usual dotted notation. Length checking is done
* elsewhere (in decompress_name), this takes names from the cache which are
* validated. No more than "size" bytes will be written to the buffer str points to
* (but size must be positive).
* If the labels in rhn contains non-printable characters, these are represented
* in the result by a backslash followed three octal digits. Additionally some
* special characters are preceded by a backslash. Normally the result should
* fit within DNSNAMEBUFSIZE bytes, but if there are many non-printable characters, the
* receiving buffer may not be able to contain the full result. In that case the
* truncation in the result is indicated by series of trailing dots. This
* function is only used for diagnostic purposes, thus a truncated result should
* not be a very serious problem (and should only occur under pathological
* circumstances).
*/
const unsigned char *rhn2str(const unsigned char *rhn, unsigned char *str, unsigned int size)
{
unsigned int i,j,lb;
if(size==0) return NULL;
i=0; j=0;
lb=rhn[i++];
if (!lb) {
if(size>=2)
str[j++]='.';
}
else {
do {
for (;lb;--lb) {
unsigned char c;
if(j+2>=size)
goto overflow;
c=rhn[i++];
if(isgraph(c)) {
if(c=='.' || c=='\\' || c=='"') {
str[j++]='\\';
if(j+2>=size)
goto overflow;
}
str[j++]=c;
}
else {
unsigned int rem=size-1-j;
int n=snprintf(charp &str[j],rem,"\\%03o",c);
if(n<0 || n>=rem) {
str[j++]='.';
goto overflow;
}
j+=n;
}
}
str[j++]='.';
lb=rhn[i++];
} while(lb);
}
str[j]=0;
return str;
overflow:
j=size;
str[--j]=0;
if(j>0) {
str[--j]='.';
if(j>0) {
str[--j]='.';
if(j>0)
str[--j]='.';
}
}
return str;
}
/* Return the length of a domain name in transport format.
The definition has in fact been moved to helpers.h as an inline function.
Note added by Paul Rombouts:
Compared to the definition used by Thomas Moestl (strlen(rhn)+1), the following definition of rhnlen
may yield a different result in certain error situations (when a domain name segment contains null byte).
*/
#if 0
unsigned int rhnlen(const unsigned char *rhn)
{
unsigned int i=0,lb;
while((lb=rhn[i++]))
i+=lb;
return i;
}
#endif
/*
* Non-validating rhn copy (use with checked or generated data only).
* Returns number of characters copied. The buffer dst points to is assumed to be DNSNAMEBUFSIZE (or
* at any rate large enough) bytes in size.
* The answer assembly code uses this; it is guaranteed to not clobber anything
* after the name.
*/
unsigned int rhncpy(unsigned char *dst, const unsigned char *src)
{
unsigned int len = rhnlen(src);
PDNSD_ASSERT(len<=DNSNAMEBUFSIZE,"rhncpy: src too long!");
memcpy(dst,src,len>DNSNAMEBUFSIZE?DNSNAMEBUFSIZE:len);
return len;
}
/* Check whether a name is a normal wire-encoded domain name,
i.e. is not compressed, doesn't use extended labels and is not
too long.
*/
int isnormalencdomname(const unsigned char *rhn, unsigned maxlen)
{
unsigned int i,lb;
if(maxlen>DNSNAMEBUFSIZE)
maxlen=DNSNAMEBUFSIZE;
for(i=0;;) {
if(i>=maxlen) return 0;
lb=rhn[i++];
if(lb==0) break;
if(lb>0x3f) return 0;
i += lb;
}
return 1;
}
int str2pdnsd_a(const char *addr, pdnsd_a *a)
{
#ifdef ENABLE_IPV4
if (run_ipv4) {
return inet_aton(addr,&a->ipv4);
}
#endif
#ifdef ENABLE_IPV6
ELSE_IPV6 {
/* Try to map an IPv4 address to IPv6 */
struct in_addr a4;
if(inet_aton(addr,&a4)) {
a->ipv6=global.ipv4_6_prefix;
((uint32_t *)(&a->ipv6))[3]=a4.s_addr;
return 1;
}
return inet_pton(AF_INET6,addr,&a->ipv6)>0;
}
#endif
/* return 0; */
}
/* definition moved to helpers.h */
#if 0
int is_inaddr_any(pdnsd_a *a)
{
return SEL_IPVER( a->ipv4.s_addr==INADDR_ANY,
IN6_IS_ADDR_UNSPECIFIED(&a->ipv6) );
}
#endif
/*
* This is used for user output only, so it does not matter when an error occurs.
*/
const char *pdnsd_a2str(pdnsd_a *a, char *buf, int maxlen)
{
const char *res= SEL_IPVER( inet_ntop(AF_INET,&a->ipv4,buf,maxlen),
inet_ntop(AF_INET6,&a->ipv6,buf,maxlen) );
if (!res) {
log_error("inet_ntop: %s", strerror(errno));
return "?.?.?.?";
}
return res;
}
/* Appropriately set our random device */
#ifdef R_DEFAULT
# if (TARGET == TARGET_BSD) && !defined(__NetBSD__)
# define R_ARC4RANDOM 1
# else
# define R_RANDOM 1
# endif
#endif
#ifdef RANDOM_DEVICE
FILE *rand_file;
#endif
#ifdef R_RANDOM
void init_crandom()
{
struct timeval tv;
struct timezone tz;
gettimeofday(&tv,&tz);
srandom(tv.tv_sec^tv.tv_usec); /* not as guessable as time() */
}
#endif
/* initialize the PRNG */
int init_rng()
{
#ifdef RANDOM_DEVICE
if (!(rand_file=fopen(RANDOM_DEVICE,"r"))) {
log_error("Could not open %s.",RANDOM_DEVICE);
return 0;
}
#endif
#ifdef R_RANDOM
init_crandom();
#endif
return 1;
}
/* The following function is now actually defined as a macro in helpers.h */
#if 0
void free_rng()
{
#ifdef RANDOM_DEVICE
if (rand_file)
fclose(rand_file);
#endif
}
#endif
/* generate a (more or less) random number 16 bits long. */
unsigned short get_rand16()
{
#ifdef RANDOM_DEVICE
unsigned short rv;
if (rand_file) {
if (fread(&rv,sizeof(rv),1, rand_file)!=1) {
log_error("Error while reading from random device: %s", strerror(errno));
pdnsd_exit();
}
return rv&0xffff;
} else
return random()&0xffff;
#endif
#ifdef R_RANDOM
return random()&0xffff;
#endif
#ifdef R_ARC4RANDOM
return arc4random()&0xffff;
#endif
}
/* fsprintf does formatted output to a file descriptor.
The functionality is similar to fprintf, but note that fd
is of type int instead of FILE*.
This function has been rewritten by Paul Rombouts */
int fsprintf(int fd, const char *format, ...)
{
int n;
va_list va;
{
char buf[256];
va_start(va,format);
n=vsnprintf(buf,sizeof(buf),format,va);
va_end(va);
if(n<(int)sizeof(buf)) {
if(n>0) n=write_all(fd,buf,n);
return n;
}
}
/* retry with a right sized buffer, needs glibc 2.1 or higher to work */
{
unsigned bufsize=n+1;
char buf[bufsize];
va_start(va,format);
n=vsnprintf(buf,bufsize,format,va);
va_end(va);
if(n>0) n=write_all(fd,buf,n);
}
return n;
}
/* Convert data into a hexadecimal representation (for debugging purposes)..
The result is stored in the character array buf.
If buf is not large enough to hold the result, the
truncation is indicated by trailing dots.
*/
void hexdump(const void *data, int dlen, char *buf, int buflen)
{
const unsigned char *p=data;
int i,j=0;
for(i=0;i<dlen;++i) {
int rem=buflen-j;
int n=snprintf(buf+j, rem, i==0?"%02x":" %02x", p[i]);
if(n<0 || n>=rem) goto truncated;
j += n;
}
goto done;
truncated:
if(j>=6) {
j -= 3;
if(j+4>=buflen)
j -= 3;
buf[j++]=' ';
buf[j++]='.';
buf[j++]='.';
buf[j++]='.';
}
else {
int ndots=buflen-1;
if(ndots>3) ndots=3;
j=0;
while(j<ndots) buf[j++]='.';
}
done:
buf[j]=0;
}
/* Copy string "in" to "str" buffer, converting non-printable characters
to escape sequences.
Returns the length of the output string, or -1 if the result does not
fit in the output buffer.
*/
int escapestr(const char *in, int ilen, char *str, int size)
{
int i,j=0;
for(i=0;i<ilen;++i) {
unsigned char c;
if(j+1>=size)
return -1;
c=in[i];
if(!isprint(c)) {
int rem=size-j;
int n=snprintf(&str[j],rem,"\\%03o",c);
if(n<0 || n>=rem) {
return -1;
}
j+=n;
}
else {
if(c=='\\' || c=='"') {
str[j++]='\\';
if(j+1>=size)
return -1;
}
str[j++]=c;
}
}
str[j]=0;
return j;
}
/*
* This is not like strcmp, but will return 1 on match or 0 if the
* strings are different.
*/
/* definition moved to helpers.h as an inline function. */
#if 0
int stricomp(char *a, char *b)
{
int i;
if (strlen(a) != strlen(b))
return 0;
for (i=0;i<strlen(a);i++) {
if (tolower(a[i])!=tolower(b[i]))
return 0;
}
return 1;
}
#endif
/* Bah. I want strlcpy */
/* definition moved to helpers.h */
#if 0
int strncp(char *dst, char *src, int dstsz)
{
char o;
strncpy(dst,src,dstsz);
o=dst[dstsz-1];
dst[dstsz-1]='\0';
if (strlen(dst) >= dstsz-1 && o!='\0')
return 0;
return 1;
}
#endif
#ifndef HAVE_GETLINE
/* Note by Paul Rombouts: I know that getline is a GNU extension and is not really portable,
but the alternative standard functions have some real problems.
The following substitute does not have exactly the same semantics as the GNU getline,
but it should be good enough, as long as the stream doesn't contain any null chars.
This version is actually based on fgets_realloc() that I found in the WWWOFFLE source.
*/
#define BUFSIZE 256
int getline(char **lineptr, size_t *n, FILE *stream)
{
char *line=*lineptr;
size_t sz=*n,i;
if(!line || sz<BUFSIZE) {
sz=BUFSIZE;
line = realloc(line,sz);
if(!line) return -1;
*lineptr=line;
*n=sz;
}
for (i=0;;) {
char *lni;
if(!(lni=fgets(line+i,sz-i,stream))) {
if(i && feof(stream))
break;
else
return -1;
}
i += strlen(lni);
if(i<sz-1 || line[i-1]=='\n')
break;
sz += BUFSIZE;
line = realloc(line,sz);
if(!line) return -1;
*lineptr=line;
*n=sz;
}
return i;
}
#undef BUFSIZE
#endif
#ifndef HAVE_VASPRINTF
/* On systems where the macro va_copy is not available, hopefully simple assignment will work.
Otherwise, I don't see any portable way of defining vasprintf() (without using a completely
different algorithm).
*/
#ifndef va_copy
# ifdef __va_copy
# define va_copy __va_copy
# else
# warning "No va_copy or __va_copy macro found, trying simple assignment."
# define va_copy(dst,src) ((dst)=(src))
# endif
#endif
int vasprintf (char **lineptr, const char *format, va_list va)
{
int sz=128,n;
char *line=malloc(sz);
va_list vasave;
if(!line) return -1;
va_copy(vasave,va);
n=vsnprintf(line,sz,format,va);
if(n>=sz) {
/* retry with a right sized buffer, needs glibc 2.1 or higher to work */
sz=n+1;
{
char *tmp=realloc(line,sz);
if(tmp) {
line=tmp;
n=vsnprintf(line,sz,format,vasave);
}
else
n= -1;
}
}
va_end(vasave);
if(n>=0)
*lineptr=line;
else
free(line);
return n;
}
#endif
#ifndef HAVE_ASPRINTF
int asprintf (char **lineptr, const char *format, ...)
{
int n;
va_list va;
va_start(va,format);
n=vasprintf(lineptr,format,va);
va_end(va);
return n;
}
#endif
#ifndef HAVE_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size)
{
const char *rc = NULL;
if (src != NULL && dst != NULL && size > 0) {
switch (af) {
case AF_INET:
{
const unsigned char *p=src;
int n = snprintf(dst, size, "%u.%u.%u.%u",
p[0],p[1],p[2],p[3]);
if (n >= 0 && n < size) rc = dst;
}
break;
#ifdef AF_INET6
case AF_INET6:
{
const unsigned char *p=src;
unsigned int i,offs=0;
for (i=0;i<16;i+=2) {
int n=snprintf(dst+offs, size-offs,i==0?"%x":":%x", ((unsigned)p[i]<<8)|p[i+1]);
if(n<0) return NULL;
offs+=n;
if(offs>=size) return NULL;
}
rc = dst;
}
break;
#endif
}
}
return rc;
}
#endif

View File

@ -1,319 +0,0 @@
/* helpers.h - Various helper functions
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2007, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef HELPERS_H
#define HELPERS_H
#include <config.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "cache.h"
#include "pdnsd_assert.h"
#define SOFTLOCK_MAXTRIES 1000
int run_as(const char *user);
void pdnsd_exit(void);
int softlock_mutex(pthread_mutex_t *mutex);
#if 0
inline static int isdchar (unsigned char c)
{
return ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='-'
#ifdef UNDERSCORE
|| c=='_'
#endif
);
}
#endif
const unsigned char *rhn2str(const unsigned char *rhn, unsigned char *str, unsigned int size);
int str2rhn(const unsigned char *str, unsigned char *rhn);
const char *parsestr2rhn(const unsigned char *str, unsigned int len, unsigned char *rhn);
/* Note added by Paul Rombouts:
Compared to the definition used by Thomas Moestl (strlen(rhn)+1), the following definition of rhnlen
may yield a different result in certain error situations (when a domain name segment contains a null byte).
*/
inline static unsigned int rhnlen(const unsigned char *rhn)
__attribute__((always_inline));
inline static unsigned int rhnlen(const unsigned char *rhn)
{
unsigned int i=0,lb;
while((lb=rhn[i++]))
i+=lb;
return i;
}
/* Skip k segments in a name in length-byte string notation. */
inline static const unsigned char *skipsegs(const unsigned char *nm, unsigned k)
__attribute__((always_inline));
inline static const unsigned char *skipsegs(const unsigned char *nm, unsigned k)
{
unsigned lb;
for(;k && (lb= *nm); --k) {
nm += lb+1;
}
return nm;
}
/* Skip a name in length-byte string notation and return a pointer to the
position right after the terminating null byte.
*/
inline static unsigned char *skiprhn(unsigned char *rhn)
__attribute__((always_inline));
inline static unsigned char *skiprhn(unsigned char *rhn)
{
unsigned lb;
while((lb= *rhn++))
rhn += lb;
return rhn;
}
/* count the number of name segments of a name in length-byte string notation. */
inline static unsigned int rhnsegcnt(const unsigned char *rhn)
__attribute__((always_inline));
inline static unsigned int rhnsegcnt(const unsigned char *rhn)
{
unsigned int res=0,lb;
while((lb= *rhn)) {
++res;
rhn += lb+1;
}
return res;
}
unsigned int rhncpy(unsigned char *dst, const unsigned char *src);
int isnormalencdomname(const unsigned char *rhn, unsigned maxlen);
inline static int is_inaddr_any(pdnsd_a *a) __attribute__((always_inline));
inline static int is_inaddr_any(pdnsd_a *a)
{
return SEL_IPVER( a->ipv4.s_addr==INADDR_ANY,
IN6_IS_ADDR_UNSPECIFIED(&a->ipv6) );
}
inline static int same_inaddr(pdnsd_a *a, pdnsd_a *b)
__attribute__((always_inline));
inline static int same_inaddr(pdnsd_a *a, pdnsd_a *b)
{
return SEL_IPVER( a->ipv4.s_addr==b->ipv4.s_addr,
IN6_ARE_ADDR_EQUAL(&a->ipv6,&b->ipv6) );
}
/* Compare a pdnsd_a* with a pdnsd_a2*. */
inline static int same_inaddr2(pdnsd_a *a, pdnsd_a2 *b)
__attribute__((always_inline));
inline static int same_inaddr2(pdnsd_a *a, pdnsd_a2 *b)
{
return SEL_IPVER( a->ipv4.s_addr==b->ipv4.s_addr,
IN6_ARE_ADDR_EQUAL(&a->ipv6,&b->ipv6) && b->ipv4.s_addr==INADDR_ANY );
}
inline static int equiv_inaddr2(pdnsd_a *a, pdnsd_a2 *b)
__attribute__((always_inline));
inline static int equiv_inaddr2(pdnsd_a *a, pdnsd_a2 *b)
{
return SEL_IPVER( a->ipv4.s_addr==b->ipv4.s_addr,
IN6_ARE_ADDR_EQUAL(&a->ipv6,&b->ipv6) ||
(b->ipv4.s_addr!=INADDR_ANY && ADDR_EQUIV6_4(&a->ipv6,&b->ipv4)) );
}
int str2pdnsd_a(const char *addr, pdnsd_a *a);
const char *pdnsd_a2str(pdnsd_a *a, char *buf, int maxlen);
int init_rng(void);
#ifdef RANDOM_DEVICE
extern FILE *rand_file;
/* Because this is usually empty, it is now defined as a macro to save overhead.*/
#define free_rng() {if (rand_file) fclose(rand_file);}
#else
#define free_rng()
#endif
unsigned short get_rand16(void);
int fsprintf(int fd, const char *format, ...) printfunc(2, 3);
#if !defined(CPP_C99_VARIADIC_MACROS)
/* GNU C Macro Varargs style. */
# define fsprintf_or_return(args...) {int _retval; if((_retval=fsprintf(args))<0) return _retval;}
#else
/* ANSI C99 style variadic macro. */
# define fsprintf_or_return(...) {int _retval; if((_retval=fsprintf(__VA_ARGS__))<0) return _retval;}
#endif
/* Added by Paul Rombouts */
inline static ssize_t write_all(int fd,const void *data,size_t n)
__attribute__((always_inline));
inline static ssize_t write_all(int fd,const void *data,size_t n)
{
ssize_t written=0;
while(written<n) {
ssize_t m=write(fd,(const void*)(((const char*)data)+written),n-written);
if(m<0)
return m;
written+=m;
}
return written;
}
void hexdump(const void *data, int dlen, char *buf, int buflen);
int escapestr(const char *in, int ilen, char *str, int size);
#if 0
inline static int stricomp(const char *a, const char *b)
{
return !strcasecmp(a,b);
}
#endif
/* compare two names in length byte - string format
rhnicmp returns 1 if the names are the same (ignoring upper/lower case),
0 otherwise.
*/
inline static int rhnicmp(const unsigned char *a, const unsigned char *b)
__attribute__((always_inline));
inline static int rhnicmp(const unsigned char *a, const unsigned char *b)
{
unsigned int i=0;
unsigned char lb;
for(;;) {
lb=a[i];
if(lb!=b[i]) return 0;
if(!lb) break;
++i;
do {
if(tolower(a[i])!=tolower(b[i])) return 0;
++i;
} while(--lb);
}
return 1;
}
/* Bah. I want strlcpy. */
inline static int strncp(char *dst, const char *src, size_t dstsz)
__attribute__((always_inline));
inline static int strncp(char *dst, const char *src, size_t dstsz)
{
#ifdef HAVE_STRLCPY
return (strlcpy(dst,src,dstsz)<dstsz);
#else
#ifdef HAVE_STPNCPY
char *p=stpncpy(dst,src,dstsz);
if(p<dst+dstsz) return 1;
*(p-1)='\0';
return 0;
#else
strncpy(dst,src,dstsz);
if(strlen(src)<dstsz) return 1;
dst[dstsz-1]='\0';
return 0;
#endif
#endif
}
#ifndef HAVE_STRDUP
inline static char *strdup(const char *s)
__attribute__((always_inline));
inline static char *strdup(const char *s)
{
size_t sz=strlen(s)+1;
char *cp=malloc(sz);
if(cp)
memcpy(cp,s,sz);
return cp;
}
#endif
#ifndef HAVE_STRNDUP
/* This version may allocate a buffer that is unnecessarily large,
but I'm always going to use it with n<strlen(s)
*/
inline static char *strndup(const char *s, size_t n)
__attribute__((always_inline));
inline static char *strndup(const char *s, size_t n)
{
char *cp;
cp=malloc(n+1);
if(cp) {
memcpy(cp,s,n);
cp[n]='\0';
}
return cp;
}
#endif
#ifndef HAVE_STPCPY
inline static char *stpcpy (char *dest, const char *src)
__attribute__((always_inline));
inline static char *stpcpy (char *dest, const char *src)
{
register char *d = dest;
register const char *s = src;
while ((*d++ = *s++) != '\0');
return d - 1;
}
#endif
#ifndef HAVE_MEMPCPY
inline static void *mempcpy(void *dest, const void *src, size_t len)
__attribute__((always_inline));
inline static void *mempcpy(void *dest, const void *src, size_t len)
{
memcpy(dest,src,len);
return ((char *)dest)+len;
}
#endif
#ifndef HAVE_GETLINE
int getline(char **lineptr, size_t *n, FILE *stream);
#endif
#ifndef HAVE_ASPRINTF
int asprintf (char **lineptr, const char *format, ...);
#endif
#ifndef HAVE_VASPRINTF
#include <stdarg.h>
int vasprintf (char **lineptr, const char *format, va_list va);
#endif
#ifndef HAVE_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#define strlitlen(strlit) (sizeof(strlit)-1)
#endif /* HELPERS_H */

View File

@ -1,544 +0,0 @@
/* icmp.c - Server response tests using ICMP echo requests
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2005, 2007, 2012 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
/*
* This should now work on both Linux and FreeBSD (and CYGWIN?). If anyone
* with experience in other Unix flavors wants to contribute platform-specific
* code, he is very welcome.
*/
#include <config.h>
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#include <sys/time.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include "ipvers.h"
#if (TARGET==TARGET_LINUX)
# include <netinet/ip.h>
# include <linux/types.h>
# include <linux/icmp.h>
#elif (TARGET==TARGET_BSD)
# include <netinet/in_systm.h>
# include <netinet/ip.h>
# include <netinet/ip_icmp.h>
#elif (TARGET==TARGET_CYGWIN)
# include <netinet/ip.h>
# include <netinet/in_systm.h>
# include <netinet/ip_icmp.h>
# include "freebsd_netinet_ip_icmp.h"
#else
# error Unsupported platform!
#endif
#ifdef ENABLE_IPV6
# include <netinet/ip6.h>
# include <netinet/icmp6.h>
#endif
#include <netdb.h>
#include "icmp.h"
#include "error.h"
#include "helpers.h"
#include "servers.h"
#define ICMP_MAX_ERRS 10
static volatile unsigned long icmp_errs=0; /* This is only here to minimize log output.
Since the consequences of a race is only
one log message more/less (out of
ICMP_MAX_ERRS), no lock is required. */
volatile int ping_isocket=-1;
#ifdef ENABLE_IPV6
volatile int ping6_isocket=-1;
#endif
/* different names, same thing... be careful, as these are macros... */
#if (TARGET==TARGET_LINUX)
# define ip_saddr saddr
# define ip_daddr daddr
# define ip_hl ihl
# define ip_p protocol
#else
# define icmphdr icmp
# define iphdr ip
# define ip_saddr ip_src.s_addr
# define ip_daddr ip_dst.s_addr
#endif
#if (TARGET==TARGET_LINUX)
# define icmp_type type
# define icmp_code code
# define icmp_cksum checksum
# define icmp_id un.echo.id
# define icmp_seq un.echo.sequence
#else
# define ICMP_DEST_UNREACH ICMP_UNREACH
# define ICMP_TIME_EXCEEDED ICMP_TIMXCEED
#endif
#define ICMP_BASEHDR_LEN 8
#define ICMP4_ECHO_LEN ICMP_BASEHDR_LEN
#if (TARGET==TARGET_LINUX) || (TARGET==TARGET_BSD) || (TARGET==TARGET_CYGWIN)
/*
* These are the ping implementations for Linux/FreeBSD in their IPv4/ICMPv4 and IPv6/ICMPv6 versions.
* I know they share some code, but I'd rather keep them separated in some parts, as some
* things might go in different directions there.
*/
/* Initialize the sockets for pinging */
void init_ping_socket()
{
if ((ping_isocket=socket(PF_INET, SOCK_RAW, IPPROTO_ICMP))==-1) {
log_warn("icmp ping: socket() failed: %s",strerror(errno));
}
#ifdef ENABLE_IPV6
if (!run_ipv4) {
/* Failure to initialize the IPv4 ping socket is not
necessarily a problem, as long as the IPv6 version works. */
if ((ping6_isocket=socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6))==-1) {
log_warn("icmpv6 ping: socket() failed: %s",strerror(errno));
}
}
#endif
}
/* Takes a packet as send out and a received ICMP packet and looks whether the ICMP packet is
* an error reply on the sent-out one. packet is only the packet (without IP header).
* errmsg includes an IP header.
* to is the destination address of the original packet (the only thing that is actually
* compared of the IP header). The RFC says that we get at least 8 bytes of the offending packet.
* We do not compare more, as this is all we need.*/
static int icmp4_errcmp(char *packet, int plen, struct in_addr *to, char *errmsg, int elen, int errtype)
{
struct iphdr iph;
struct icmphdr icmph;
struct iphdr eiph;
char *data;
/* XXX: lots of memcpy to avoid unaligned accesses on alpha */
if (elen<sizeof(struct iphdr))
return 0;
memcpy(&iph,errmsg,sizeof(iph));
if (iph.ip_p!=IPPROTO_ICMP || elen<iph.ip_hl*4+ICMP_BASEHDR_LEN+sizeof(eiph))
return 0;
PDNSD_ASSERT(sizeof(icmph) >= ICMP_BASEHDR_LEN, "icmp4_errcmp: ICMP_BASEHDR_LEN botched");
memcpy(&icmph,errmsg+iph.ip_hl*4,ICMP_BASEHDR_LEN);
memcpy(&eiph,errmsg+iph.ip_hl*4+ICMP_BASEHDR_LEN,sizeof(eiph));
if (elen<iph.ip_hl*4+ICMP_BASEHDR_LEN+eiph.ip_hl*4+8)
return 0;
data=errmsg+iph.ip_hl*4+ICMP_BASEHDR_LEN+eiph.ip_hl*4;
return icmph.icmp_type==errtype && memcmp(&to->s_addr, &eiph.ip_daddr, sizeof(to->s_addr))==0 &&
memcmp(data, packet, plen<8?plen:8)==0;
}
/* IPv4/ICMPv4 ping. Called from ping (see below) */
static int ping4(struct in_addr addr, int timeout, int rep)
{
int i;
int isock;
#if (TARGET==TARGET_LINUX)
struct icmp_filter f;
#endif
unsigned short id=(unsigned short)get_rand16(); /* randomize a ping id */
isock=ping_isocket;
#if (TARGET==TARGET_LINUX)
/* Fancy ICMP filering -- only on Linux (as far is I know) */
/* In fact, there should be macros for treating icmp_filter, but I haven't found them in Linux 2.2.15.
* So, set it manually and unportable ;-) */
/* This filter lets ECHO_REPLY (0), DEST_UNREACH(3) and TIME_EXCEEDED(11) pass. */
/* !(0000 1000 0000 1001) = 0xff ff f7 f6 */
f.data=0xfffff7f6;
if (setsockopt(isock,SOL_RAW,ICMP_FILTER,&f,sizeof(f))==-1) {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("icmp ping: setsockopt() failed: %s", strerror(errno));
}
return -1;
}
#endif
for (i=0;i<rep;i++) {
struct sockaddr_in from,to;
struct icmphdr icmpd;
unsigned long sum;
uint16_t *ptr;
long tm,tpassed;
int j;
icmpd.icmp_type=ICMP_ECHO;
icmpd.icmp_code=0;
icmpd.icmp_cksum=0;
icmpd.icmp_id=htons((uint16_t)id);
icmpd.icmp_seq=htons((uint16_t)i);
/* Checksumming - Algorithm taken from nmap. Thanks... */
ptr=(uint16_t *)&icmpd;
sum=0;
for (j=0;j<4;j++) {
sum+=*ptr++;
}
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
icmpd.icmp_cksum=~sum;
memset(&to,0,sizeof(to));
to.sin_family=AF_INET;
to.sin_port=0;
to.sin_addr=addr;
SET_SOCKA_LEN4(to);
if (sendto(isock,&icmpd,ICMP4_ECHO_LEN,0,(struct sockaddr *)&to,sizeof(to))==-1) {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("icmp ping: sendto() failed: %s.",strerror(errno));
}
return -1;
}
/* listen for reply. */
tm=time(NULL); tpassed=0;
do {
int psres;
#ifdef NO_POLL
fd_set fds,fdse;
struct timeval tv;
FD_ZERO(&fds);
PDNSD_ASSERT(isock<FD_SETSIZE,"socket file descriptor exceeds FD_SETSIZE.");
FD_SET(isock, &fds);
fdse=fds;
tv.tv_usec=0;
tv.tv_sec=timeout>tpassed?timeout-tpassed:0;
/* There is a possible race condition with the arrival of a signal here,
but it is so unlikely to be a problem in practice that the effort
to do this properly is not worth the trouble.
*/
if(is_interrupted_servstat_thread()) {
DEBUG_MSG("server status thread interrupted.\n");
return -1;
}
psres=select(isock+1,&fds,NULL,&fdse,&tv);
#else
struct pollfd pfd;
pfd.fd=isock;
pfd.events=POLLIN;
/* There is a possible race condition with the arrival of a signal here,
but it is so unlikely to be a problem in practice that the effort
to do this properly is not worth the trouble.
*/
if(is_interrupted_servstat_thread()) {
DEBUG_MSG("server status thread interrupted.\n");
return -1;
}
psres=poll(&pfd,1,timeout>tpassed?(timeout-tpassed)*1000:0);
#endif
if (psres<0) {
if(errno==EINTR && is_interrupted_servstat_thread()) {
DEBUG_MSG("poll/select interrupted in server status thread.\n");
}
else if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("poll/select failed: %s",strerror(errno));
}
return -1;
}
if (psres==0) /* timed out */
break;
#ifdef NO_POLL
if (FD_ISSET(isock,&fds) || FD_ISSET(isock,&fdse))
#else
if (pfd.revents&(POLLIN|POLLERR))
#endif
{
char buf[1024];
socklen_t sl=sizeof(from);
int len;
if ((len=recvfrom(isock,&buf,sizeof(buf),0,(struct sockaddr *)&from,&sl))!=-1) {
if (len>sizeof(struct iphdr)) {
struct iphdr iph;
memcpy(&iph, buf, sizeof(iph));
if (len-iph.ip_hl*4>=ICMP_BASEHDR_LEN) {
struct icmphdr icmpp;
memcpy(&icmpp, ((uint32_t *)buf)+iph.ip_hl, sizeof(icmpp));
if (iph.ip_saddr==addr.s_addr && icmpp.icmp_type==ICMP_ECHOREPLY &&
ntohs(icmpp.icmp_id)==id && ntohs(icmpp.icmp_seq)<=i) {
return (i-ntohs(icmpp.icmp_seq))*timeout+(time(NULL)-tm); /* return the number of ticks */
} else {
/* No regular echo reply. Maybe an error? */
if (icmp4_errcmp((char *)&icmpd, ICMP4_ECHO_LEN, &to.sin_addr, buf, len, ICMP_DEST_UNREACH) ||
icmp4_errcmp((char *)&icmpd, ICMP4_ECHO_LEN, &to.sin_addr, buf, len, ICMP_TIME_EXCEEDED)) {
return -1;
}
}
}
}
} else {
return -1; /* error */
}
}
else {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_error("Unhandled poll/select event in ping4() at %s, line %d.",__FILE__,__LINE__);
}
return -1;
}
tpassed=time(NULL)-tm;
} while (tpassed<timeout);
}
return -1; /* no answer */
}
#ifdef ENABLE_IPV6
/* Takes a packet as send out and a received ICMPv6 packet and looks whether the ICMPv6 packet is
* an error reply on the sent-out one. packet is only the packet (without IPv6 header).
* errmsg does not include an IPv6 header. to is the address the sent packet went to.
* This is specialized for icmpv6: It zeros out the checksum field, which is filled in
* by the kernel, and expects that the checksum field in the sent-out packet is zeroed out too
* We need a little magic to parse the answer, as there could be extension headers present, end
* we don't know their length a priori.*/
static int icmp6_errcmp(char *packet, int plen, struct in6_addr *to, char *errmsg, int elen, int errtype)
{
struct icmp6_hdr icmph;
struct ip6_hdr eiph;
struct ip6_hbh hbh;
char *data;
int rlen,nxt;
/* XXX: lots of memcpy here to avoid unaligned access faults on alpha */
if (elen<sizeof(icmph)+sizeof(eiph))
return 0;
memcpy(&icmph,errmsg,sizeof(icmph));
memcpy(&eiph,errmsg+sizeof(icmph),sizeof(eiph));
if (!IN6_ARE_ADDR_EQUAL(&eiph.ip6_dst, to))
return 0;
rlen=elen-sizeof(icmph)-sizeof(eiph);
data=errmsg+sizeof(icmph)+sizeof(eiph);
nxt=eiph.ip6_nxt;
/* Now, jump over any known option header that might be present, and then
* try to compare the packets. */
while (nxt!=IPPROTO_ICMPV6) {
/* Those are the headers we understand. */
if (nxt!=IPPROTO_HOPOPTS && nxt!=IPPROTO_ROUTING && nxt!=IPPROTO_DSTOPTS)
return 0;
if (rlen<sizeof(hbh))
return 0;
memcpy(&hbh,data,sizeof(hbh));
if (rlen<hbh.ip6h_len)
return 0;
rlen-=hbh.ip6h_len;
nxt=hbh.ip6h_nxt;
data+=hbh.ip6h_len;
}
if (rlen<sizeof(struct icmp6_hdr))
return 0;
/* Zero out the checksum of the enclosed ICMPv6 header, it is kernel-filled in the original data */
memset(((char *)data)+offsetof(struct icmp6_hdr,icmp6_cksum),0,sizeof(icmph.icmp6_cksum));
return icmph.icmp6_type==errtype && memcmp(data, packet, plen<rlen?plen:rlen)==0;
}
/* IPv6/ICMPv6 ping. Called from ping (see below) */
static int ping6(struct in6_addr a, int timeout, int rep)
{
int i;
/* int ck_offs=2;*/
int isock;
struct icmp6_filter f;
unsigned short id=(unsigned short)(rand()&0xffff); /* randomize a ping id */
isock=ping6_isocket;
ICMP6_FILTER_SETBLOCKALL(&f);
ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY,&f);
ICMP6_FILTER_SETPASS(ICMP6_DST_UNREACH,&f);
ICMP6_FILTER_SETPASS(ICMP6_TIME_EXCEEDED,&f);
if (setsockopt(isock,IPPROTO_ICMPV6,ICMP6_FILTER,&f,sizeof(f))==-1) {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("icmpv6 ping: setsockopt() failed: %s", strerror(errno));
}
return -1;
}
for (i=0;i<rep;i++) {
struct sockaddr_in6 from;
struct icmp6_hdr icmpd;
long tm,tpassed;
icmpd.icmp6_type=ICMP6_ECHO_REQUEST;
icmpd.icmp6_code=0;
icmpd.icmp6_cksum=0; /* The friendly kernel does fill that in for us. */
icmpd.icmp6_id=htons((uint16_t)id);
icmpd.icmp6_seq=htons((uint16_t)i);
memset(&from,0,sizeof(from));
from.sin6_family=AF_INET6;
from.sin6_flowinfo=IPV6_FLOWINFO;
from.sin6_port=0;
from.sin6_addr=a;
SET_SOCKA_LEN6(from);
if (sendto(isock,&icmpd,sizeof(icmpd),0,(struct sockaddr *)&from,sizeof(from))==-1) {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("icmpv6 ping: sendto() failed: %s.",strerror(errno));
}
return -1;
}
/* listen for reply. */
tm=time(NULL); tpassed=0;
do {
int psres;
#ifdef NO_POLL
fd_set fds,fdse;
struct timeval tv;
FD_ZERO(&fds);
PDNSD_ASSERT(isock<FD_SETSIZE,"socket file descriptor exceeds FD_SETSIZE.");
FD_SET(isock, &fds);
fdse=fds;
tv.tv_usec=0;
tv.tv_sec=timeout>tpassed?timeout-tpassed:0;
/* There is a possible race condition with the arrival of a signal here,
but it is so unlikely to be a problem in practice that the effort
to do this properly is not worth the trouble.
*/
if(is_interrupted_servstat_thread()) {
DEBUG_MSG("server status thread interrupted.\n");
return -1;
}
psres=select(isock+1,&fds,NULL,&fdse,&tv);
#else
struct pollfd pfd;
pfd.fd=isock;
pfd.events=POLLIN;
/* There is a possible race condition with the arrival of a signal here,
but it is so unlikely to be a problem in practice that the effort
to do this properly is not worth the trouble.
*/
if(is_interrupted_servstat_thread()) {
DEBUG_MSG("server status thread interrupted.\n");
return -1;
}
psres=poll(&pfd,1,timeout>tpassed?(timeout-tpassed)*1000:0);
#endif
if (psres<0) {
if(errno==EINTR && is_interrupted_servstat_thread()) {
DEBUG_MSG("poll/select interrupted in server status thread.\n");
}
else if (++icmp_errs<=ICMP_MAX_ERRS) {
log_warn("poll/select failed: %s",strerror(errno));
}
return -1;
}
if (psres==0) /* timed out */
break;
#ifdef NO_POLL
if (FD_ISSET(isock,&fds) || FD_ISSET(isock,&fdse))
#else
if (pfd.revents&(POLLIN|POLLERR))
#endif
{
char buf[1024];
socklen_t sl=sizeof(from);
int len;
if ((len=recvfrom(isock,&buf,sizeof(buf),0,(struct sockaddr *)&from,&sl))!=-1) {
if (len>=sizeof(struct icmp6_hdr)) {
/* we get packets without IPv6 header, luckily */
struct icmp6_hdr icmpp;
memcpy(&icmpp, buf, sizeof(icmpp));
if (IN6_ARE_ADDR_EQUAL(&from.sin6_addr,&a) &&
ntohs(icmpp.icmp6_id)==id && ntohs(icmpp.icmp6_seq)<=i) {
return (i-ntohs(icmpp.icmp6_seq))*timeout+(time(NULL)-tm); /* return the number of ticks */
} else {
/* No regular echo reply. Maybe an error? */
if (icmp6_errcmp((char *)&icmpd, sizeof(icmpd), &from.sin6_addr, buf, len, ICMP6_DST_UNREACH) ||
icmp6_errcmp((char *)&icmpd, sizeof(icmpd), &from.sin6_addr, buf, len, ICMP6_TIME_EXCEEDED)) {
return -1;
}
}
}
} else {
return -1; /* error */
}
}
else {
if (++icmp_errs<=ICMP_MAX_ERRS) {
log_error("Unhandled poll/select event in ping6() at %s, line %d.",__FILE__,__LINE__);
}
return -1;
}
tpassed=time(NULL)-tm;
} while (tpassed<timeout);
}
return -1; /* no answer */
}
#endif /* ENABLE_IPV6*/
/* Perform an icmp ping on a host, returning -1 on timeout or
* "host unreachable" or the ping time in 10ths of secs
* (but actually, we are not that accurate any more).
* timeout in 10ths of seconds, rep is the repetition count
*/
int ping(pdnsd_a *addr, int timeout, int rep)
{
if (SEL_IPVER(ping_isocket,ping6_isocket) == -1)
return -1;
/* We were given a timeout in 10ths of seconds,
but ping4 and ping6 want a timeout in seconds. */
timeout /= 10;
#ifdef ENABLE_IPV4
if (run_ipv4)
return ping4(addr->ipv4,timeout,rep);
#endif
#ifdef ENABLE_IPV6
ELSE_IPV6 {
/* If it is a IPv4 mapped IPv6 address, we prefer ICMPv4. */
if (ping_isocket!=-1 && IN6_IS_ADDR_V4MAPPED(&addr->ipv6)) {
struct in_addr v4;
v4.s_addr=((uint32_t *)&addr->ipv6)[3];
return ping4(v4,timeout,rep);
} else
return ping6(addr->ipv6,timeout,rep);
}
#endif
return -1;
}
#else
# error "Huh! No OS macro defined!"
#endif /*(TARGET==TARGET_LINUX) || (TARGET==TARGET_BSD) || (TARGET==TARGET_CYGWIN)*/

View File

@ -1,43 +0,0 @@
/* icmp.h - Server response tests using ICMP echo requests
Copyright (C) 2000 Thomas Moestl
Copyright (C) 2007 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef ICMP_H
#define ICMP_H
#include <config.h>
#include "ipvers.h"
volatile extern int ping_isocket;
volatile extern int ping6_isocket;
/* initialize a socket for pinging */
void init_ping_socket(void);
/*
* This is a classical ping routine.
* timeout in 10ths of seconds, rep is the repetition count.
*/
int ping(pdnsd_a *addr, int timeout, int rep);
#endif

View File

@ -1,297 +0,0 @@
/* ipvers.h - definitions for IPv4 and IPv6
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2007, 2009 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef IPVERS_H
#define IPVERS_H
#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "rr_types.h"
#if defined(ENABLE_IPV4) && !defined(ENABLE_IPV6)
# ifdef DEFAULT_IPV4
# undef DEFAULT_IPV4
# endif
# define DEFAULT_IPV4 1
#endif
#if !defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
# ifdef DEFAULT_IPV4
# undef DEFAULT_IPV4
# endif
# define DEFAULT_IPV4 0
#endif
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
# define ELSE_IPV6 else
#else
# define ELSE_IPV6
#endif
/* From main.c */
#ifdef ENABLE_IPV4
# ifdef ENABLE_IPV6
extern short int run_ipv4;
extern short int cmdlineipv;
# define SEL_IPVER(a4,a6) (run_ipv4? a4: a6)
# else
# define run_ipv4 1
# define SEL_IPVER(a4,a6) (a4)
# endif
#else
# define run_ipv4 0
# define SEL_IPVER(a4,a6) (a6)
#endif
#ifdef ENABLE_IPV6
#define DEFAULT_IPV4_6_PREFIX "::ffff:0.0.0.0"
/* extern short int cmdlineprefix; */
#endif
#if (TARGET==TARGET_LINUX) && !defined(HAVE_STRUCT_IN_PKTINFO)
struct in_pktinfo
{
int ipi_ifindex;
struct in_addr ipi_spec_dst;
struct in_addr ipi_addr;
};
#endif
#if (TARGET==TARGET_LINUX)
/* some older glibc versions seem to lack this. */
# ifndef IP_PKTINFO
# define IP_PKTINFO 8
# endif
# ifndef CMSG_LEN
/* ---- from glibc 2.1.2 */
/* Ancillary data object manipulation macros. */
# if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
# else
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
# endif
# define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
# define CMSG_FIRSTHDR(mhdr) \
((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
# define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
& ~(sizeof (size_t) - 1))
# define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ CMSG_ALIGN (sizeof (struct cmsghdr)))
# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
struct cmsghdr *__cmsg));
# ifdef __USE_EXTERN_INLINES
# ifndef _EXTERN_INLINE
# define _EXTERN_INLINE extern __inline
# endif
_EXTERN_INLINE struct cmsghdr *
__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
{
if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
return 0;
__cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ CMSG_ALIGN (__cmsg->cmsg_len));
if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+ __mhdr->msg_controllen)
|| ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
>= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
/* No more entries. */
return 0;
return __cmsg;
}
# endif /* Use `extern inline'. */
/* ---- */
# endif
#endif
#if defined(ENABLE_IPV4) && !defined(SIN_LEN) && (TARGET==TARGET_BSD)
# define SIN_LEN
#endif
#if defined(ENABLE_IPV6) && (TARGET==TARGET_LINUX)
/* Some glibc versions (I know of 2.1.2) get this wrong, so we define our own. To be exact, this is fixed
* glibc code. */
#ifdef IN6_ARE_ADDR_EQUAL
# undef IN6_ARE_ADDR_EQUAL
#endif
#define IN6_ARE_ADDR_EQUAL(a,b) \
((((uint32_t *) (a))[0] == ((uint32_t *) (b))[0]) && \
(((uint32_t *) (a))[1] == ((uint32_t *) (b))[1]) && \
(((uint32_t *) (a))[2] == ((uint32_t *) (b))[2]) && \
(((uint32_t *) (a))[3] == ((uint32_t *) (b))[3]))
#endif
/* This is the IPv6 flowid that we pass on to the IPv6 protocol stack. This value was not currently defined
* at the time of writing. Should this change, define a appropriate flowinfo here. */
#ifndef IPV6_FLOWINFO
#define IPV6_FLOWINFO 0
#endif
/* There does not seem to be a function/macro to generate IPv6-mapped IPv4-Adresses. So here comes mine.
* Pass an in_addr* and an in6_addr* */
#define IPV6_MAPIPV4(a,b) {((uint32_t *)(b))[3]=(a)->s_addr; \
((uint32_t *)(b))[2]=htonl(0xffff); \
((uint32_t *)(b))[1]=((uint32_t *)(b))[0]=0; }
/* A macro to extract the pointer to the address of a struct sockaddr (_in or _in6) */
#define SOCKA_A4(a) ((pdnsd_a *)&((struct sockaddr_in *)(a))->sin_addr)
#define SOCKA_A6(a) ((pdnsd_a *)&((struct sockaddr_in6 *)(a))->sin6_addr)
#define SOCKA_A(a) SEL_IPVER(SOCKA_A4(a),SOCKA_A6(a))
#define PDNSD_PF_INET SEL_IPVER(PF_INET,PF_INET6)
#define PDNSD_AF_INET SEL_IPVER(AF_INET,AF_INET6)
/* This is to compare two addresses. This is a macro because it may change due to the more complex IPv6 adressing architecture
* (there are, for example, two equivalent addresses of the loopback device)
* Pass this two addresses as in_addr or in6_addr. pdnsd_a is ok (it is a union) */
#define ADDR_EQUIV4(a,b) (((struct in_addr *)(a))->s_addr==((struct in_addr *)(b))->s_addr)
#define ADDR_EQUIV6(a,b) IN6_ARE_ADDR_EQUAL(((struct in6_addr *)(a)),((struct in6_addr *)(b)))
#define ADDR_EQUIV(a,b) SEL_IPVER(ADDR_EQUIV4(a,b), ADDR_EQUIV6(a,b))
/* Compare an IPv6 adress with an IPv4 one. b should have type struct in_addr*.
Note the similarity with the IPV6_MAPIPV4 macro. */
#define ADDR_EQUIV6_4(a,b) (((uint32_t *)(a))[3]==(b)->s_addr && \
((uint32_t *)(a))[2]==htonl(0xffff) && \
((uint32_t *)(a))[1]==0 && \
((uint32_t *)(a))[0]==0)
/* Compare two address a and b in combination with a netmask m.
Only the bits coresponding to those set in the netmask are matched, the rest are ignored.
Pass in_addr* or in6_addr* arguments, respectively. */
#define ADDR4MASK_EQUIV(a,b,m) ((((a)->s_addr^(b)->s_addr)&(m)->s_addr)==0)
#define ADDR6MASK_EQUIV(a,b,m) (((((uint32_t *)(a))[0]^((uint32_t *)(b))[0])&((uint32_t *)(m))[0])==0 && \
((((uint32_t *)(a))[1]^((uint32_t *)(b))[1])&((uint32_t *)(m))[1])==0 && \
((((uint32_t *)(a))[2]^((uint32_t *)(b))[2])&((uint32_t *)(m))[2])==0 && \
((((uint32_t *)(a))[3]^((uint32_t *)(b))[3])&((uint32_t *)(m))[3])==0)
/* See if we need 4.4BSD style sockaddr_* structures and define some macros that set the length field.
* The non-4.4BSD behaviour is the only one that is POSIX-conformant.*/
#if defined(SIN6_LEN) || defined(SIN_LEN)
# define BSD44_SOCKA
# define SET_SOCKA_LEN4(socka) (socka.sin_len=sizeof(struct sockaddr_in))
# define SET_SOCKA_LEN6(socka) (socka.sin6_len=sizeof(struct sockaddr_in6))
#else
# define SET_SOCKA_LEN4(socka)
# define SET_SOCKA_LEN6(socka)
#endif
#ifdef ENABLE_IPV6
# define ADDRSTR_MAXLEN INET6_ADDRSTRLEN
#else
# ifdef INET_ADDRSTRLEN
# define ADDRSTR_MAXLEN INET_ADDRSTRLEN
# else
# define ADDRSTR_MAXLEN 16
# endif
#endif
#if (TARGET==TARGET_BSD) || (TARGET==TARGET_CYGWIN)
# define SOL_IPV6 IPPROTO_IPV6
#endif
#ifdef ENABLE_IPV6
# ifndef IPV6_RECVPKTINFO
/* This appears to be needed e.g. on Darwin (Mac OS X). */
# define IPV6_RECVPKTINFO IPV6_PKTINFO
# endif
#endif
typedef union {
#ifdef ENABLE_IPV4
struct in_addr ipv4;
#endif
#ifdef ENABLE_IPV6
struct in6_addr ipv6;
#endif
} pdnsd_a;
#ifdef ENABLE_IPV4
#define PDNSD_A_INITIALIZER {{INADDR_ANY}}
#else
#define PDNSD_A_INITIALIZER {IN6ADDR_ANY_INIT}
#endif
/* The pdnsd_a2 type is very similar to pdnsd_a, but can hold
both an IPv4 and an IPv6 address at the same time,
i.e. a struct instead of a union.
*/
typedef struct {
#ifdef ENABLE_IPV6
struct in6_addr ipv6;
#endif
struct in_addr ipv4;
} pdnsd_a2;
/* Macros/functions for assigning/converting a pdnsd_a* to a pdnsd_a2* type,
and vice versa.
*/
#ifdef ENABLE_IPV6
inline static void SET_PDNSD_A2(pdnsd_a2 *a2, pdnsd_a *a) __attribute__((always_inline));
inline static void SET_PDNSD_A2(pdnsd_a2 *a2, pdnsd_a *a)
{
#ifdef ENABLE_IPV4
if(run_ipv4)
a2->ipv4=a->ipv4;
else
#endif
{
a2->ipv6=a->ipv6;
a2->ipv4.s_addr=INADDR_ANY;
}
}
#else
# define SET_PDNSD_A2(a2,a) ((a2)->ipv4=(a)->ipv4)
#endif
#define PDNSD_A2_TO_A(a2) SEL_IPVER(((pdnsd_a *)&(a2)->ipv4),((pdnsd_a *)&(a2)->ipv6))
/* Do we have sufficient support in the C libraries to allow local AAAA records
to be defined? */
#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_PTON)
# define ALLOW_LOCAL_AAAA IS_CACHED_AAAA
#else
# define ALLOW_LOCAL_AAAA 0
#endif
/* Used to enter local records */
typedef union {
struct in_addr ipv4;
#if ALLOW_LOCAL_AAAA
struct in6_addr ipv6;
#endif
} pdnsd_ca;
#endif

View File

@ -1,171 +0,0 @@
/* list.c - Dynamic array and list handling
Copyright (C) 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2007, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "helpers.h"
#include "error.h"
#include "list.h"
/* Grow a dynamic array to hold one extra element.
This could be done using da_resize(), but this is such a common operation
it is has been given its own optimized implementation.
da_grow1() returns a pointer to the new (possibly reallocated) array if
successful, otherwise it frees the old array (after freeing all the array
elements if a clean-up routine is supplied) and returns NULL.
*/
darray da_grow1(darray a, size_t headsz, size_t elemsz, void (*cleanuproutine) (void *))
{
size_t k = (a?a->nel:0);
if(!a || (k!=0 && (k&7)==0)) {
darray tmp=(darray)realloc(a, headsz+elemsz*(k+8));
if (!tmp && a) {
if(cleanuproutine) {
size_t i;
for(i=0;i<k;++i)
cleanuproutine(((char *)a)+headsz+elemsz*i);
}
free(a);
}
a=tmp;
}
if(a) a->nel=k+1;
return a;
}
inline static size_t alloc_nel(size_t n)
{
return n==0 ? 8 : (n+7)&(~7);
}
/* da_resize() allows you to grow (or shrink) a dynamic array to an arbitrary length n,
but is otherwise similar to da_grow1().
*/
darray da_resize(darray a, size_t headsz, size_t elemsz, size_t n, void (*cleanuproutine) (void *))
{
size_t ael = (a?alloc_nel(a->nel):0);
size_t new_ael = alloc_nel(n);
if(new_ael != ael) {
/* adjust alloced space. */
darray tmp=(darray)realloc(a, headsz+elemsz*new_ael);
if (!tmp && a) {
if(cleanuproutine) {
size_t i,k=a->nel;
for(i=0;i<k;++i)
cleanuproutine(((char *)a)+headsz+elemsz*i);
}
free(a);
}
a=tmp;
}
if(a) a->nel=n;
return a;
}
#ifdef ALLOC_DEBUG
void DBGda_free(darray a, size_t headsz, size_t elemsz, char *file, int line)
{
if (a==NULL)
{DEBUG_MSG("- da_free, %s:%d, not initialized\n", file, line);}
else
{DEBUG_MSG("- da_free, %s:%d, %lu bytes\n", file, line,
(unsigned long)(headsz+elemsz*alloc_nel(a->nel)));}
free(a);
}
#endif
#define DLISTALIGN(len) (((len) + (sizeof(size_t)-1)) & ~(sizeof(size_t)-1))
/* This mask corresponds to a chunk size of 1024. */
#define DLISTCHUNKSIZEMASK ((size_t)0x3ff)
/* Add space for a new item of size len to the list a.
dlist_grow() returns a pointer to the new (possibly reallocated) list structure if
successful, otherwise it frees the old list and returns NULL.
*/
dlist dlist_grow(dlist a, size_t len)
{
size_t sz=0, allocsz=0, szincr, newsz;
if(a) {
sz=a->last+a->lastsz;
allocsz = (sz+DLISTCHUNKSIZEMASK)&(~DLISTCHUNKSIZEMASK);
*((size_t *)&a->data[a->last])=a->lastsz;
}
szincr=DLISTALIGN(len+sizeof(size_t));
newsz=sz+szincr;
if(newsz>allocsz) {
dlist tmp;
allocsz = (newsz+DLISTCHUNKSIZEMASK)&(~DLISTCHUNKSIZEMASK);
tmp=realloc(a, sizeof(struct _dynamic_list_head)+allocsz);
if (!tmp)
free(a);
a=tmp;
}
if(a) {
a->last=sz;
a->lastsz=szincr;
*((size_t *)&a->data[sz])=0;
}
return a;
}
/* Add a new node, capable of holding data of size len, at the end of a linked list.
llist_grow() returns 1 if successful, otherwise it frees the entire linked list
and returns 0.
*/
int llist_grow(llist *a, size_t len)
{
struct llistnode_s *new= (struct llistnode_s *)malloc(sizeof(struct llistnode_s)+len);
if(!new) {
llist_free(a);
return 0;
}
new->next=NULL;
if(!a->first)
a->first=new;
else
a->last->next=new;
a->last=new;
return 1;
}
void llist_free(llist *a)
{
struct llistnode_s *p= a->first;
while(p) {
struct llistnode_s *next= p->next;
free(p);
p=next;
}
a->first=NULL;
a->last= NULL;
}

View File

@ -1,170 +0,0 @@
/* list.h - Dynamic array and list handling
Copyright (C) 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2007, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef LIST_H
#define LIST_H
#include <stdlib.h>
#include <string.h>
#include "pdnsd_assert.h"
typedef struct {size_t nel;} *darray;
/* used in type declarations */
#define DYNAMIC_ARRAY(typ) struct {size_t nel; typ elem[0];}
#define DA_TYP_OFFSET(atyp) ((size_t)((atyp)0)->elem)
#define DA_OFFSET(a) DA_TYP_OFFSET(typeof (a))
#define DA_CREATE(atyp,n) ((atyp)da_resize(NULL,DA_TYP_OFFSET(atyp),sizeof(((atyp)0)->elem[0]),n,NULL))
#define DA_INDEX(a,i) ((a)->elem[i])
/* Used often, so make special-case macro here */
#define DA_LAST(a) ((a)->elem[(a)->nel-1])
#define DA_GROW1(a) ((typeof (a))da_grow1((darray)(a),DA_OFFSET(a),sizeof((a)->elem[0]),NULL))
#define DA_GROW1_F(a,cleanup) ((typeof (a))da_grow1((darray)(a),DA_OFFSET(a),sizeof((a)->elem[0]),cleanup))
#define DA_RESIZE(a,n) ((typeof (a))da_resize((darray)(a),DA_OFFSET(a),sizeof((a)->elem[0]),n,NULL))
#define DA_NEL(a) da_nel((darray)(a))
/*
* Some or all of these should be inline.
* They aren't macros for type safety.
*/
darray da_grow1(darray a, size_t headsz, size_t elemsz, void (*cleanuproutine) (void *));
darray da_resize(darray a, size_t headsz, size_t elemsz, size_t n, void (*cleanuproutine) (void *));
inline static unsigned int da_nel(darray a)
__attribute__((always_inline));
inline static unsigned int da_nel(darray a)
{
if (a==NULL)
return 0;
return a->nel;
}
/* alloc/free debug code.*/
#ifdef ALLOC_DEBUG
void DBGda_free(darray a, size_t headsz, size_t elemsz, char *file, int line);
#define da_free(a) DBGda_free((darray)(a),DA_OFFSET(a),sizeof((a)->elem[0]), __FILE__, __LINE__)
#else
#define da_free free
#endif
/* This dynamic "list" structure is useful if the items are not all the same size.
The elements can only be read back in sequential order, not indexed as with the dynamic arrays.
*/
struct _dynamic_list_head {
size_t last,lastsz;
char data[0];
};
typedef struct _dynamic_list_head *dlist;
inline static void *dlist_first(dlist a)
__attribute__((always_inline));
inline static void *dlist_first(dlist a)
{
return a?&a->data[sizeof(size_t)]:NULL;
}
/* dlist_next() returns a reference to the next item in the list, or NULL is there is no next item.
ref should be properly aligned.
If the dlist was grown with dlist_grow(), this should be OK.
*/
inline static void *dlist_next(void *ref)
__attribute__((always_inline));
inline static void *dlist_next(void *ref)
{
size_t incr= *(((size_t *)ref)-1);
return incr?((char *)ref)+incr:NULL;
}
/* dlist_last() returns a reference to the last item. */
inline static void *dlist_last(dlist a)
__attribute__((always_inline));
inline static void *dlist_last(dlist a)
{
return a?&a->data[a->last+sizeof(size_t)]:NULL;
}
dlist dlist_grow(dlist a, size_t len);
#define dlist_free free
/* linked list data type. */
struct llistnode_s {
struct llistnode_s *next;
char *data[0];
};
typedef struct {
struct llistnode_s *first, *last;
}
llist;
inline static void llist_init(llist *a)
__attribute__((always_inline));
inline static void llist_init(llist *a)
{
a->first=NULL;
a->last= NULL;
}
inline static int llist_isempty(llist *a)
__attribute__((always_inline));
inline static int llist_isempty(llist *a)
{
return a->first==NULL;
}
inline static void *llist_first(llist *a)
__attribute__((always_inline));
inline static void *llist_first(llist *a)
{
struct llistnode_s *p= a->first;
return p?p->data:NULL;
}
inline static void *llist_next(void *ref)
__attribute__((always_inline));
inline static void *llist_next(void *ref)
{
struct llistnode_s *next= *(((struct llistnode_s **)ref)-1);
return next?next->data:NULL;
}
inline static void *llist_last(llist *a)
__attribute__((always_inline));
inline static void *llist_last(llist *a)
{
struct llistnode_s *p= a->last;
return p?p->data:NULL;
}
int llist_grow(llist *a, size_t len);
void llist_free(llist *a);
#endif /* def LIST_H */

View File

@ -1,710 +0,0 @@
/* main.c - Command line parsing, intialisation and server start
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
/* in order to use O_NOFOLLOW on Linux: */
/* #define _GNU_SOURCE */
#include <config.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <syslog.h>
#include <pwd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include "consts.h"
#include "cache.h"
#include "status.h"
#include "servers.h"
#include "dns_answer.h"
#include "dns_query.h"
#include "error.h"
#include "helpers.h"
#include "icmp.h"
#include "hash.h"
#if DEBUG>0
short int debug_p=0;
#endif
short int stat_pipe=0;
/* int sigr=0; */
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
short int run_ipv4=DEFAULT_IPV4;
short int cmdlineipv=0;
#endif
cmdlineflags_t cmdline={0};
pthread_t main_thrid,servstat_thrid,statsock_thrid,tcps_thrid,udps_thrid;
uid_t init_uid;
#if DEBUG>0
FILE *dbg_file=NULL;
#endif
volatile int tcp_socket=-1;
volatile int udp_socket=-1;
sigset_t sigs_msk;
char *conf_file=CONFDIR"/pdnsd.conf";
/* version and licensing information */
static const char info_message[] =
"pdnsd - dns proxy daemon, version " VERSION "\n\n"
"Copyright (C) 2000, 2001 Thomas Moestl\n"
"Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Paul A. Rombouts\n\n"
"pdnsd is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 3 of the License, or\n"
"(at your option) any later version.\n\n"
"pdnsd is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n"
"You should have received a copy of the GNU General Public License\n"
"along with pdsnd; see the file COPYING. If not, see\n"
"<http://www.gnu.org/licenses/>.\n";
/* the help page */
static const char help_message[] =
"\n\nUsage: pdnsd [-h] [-V] [-s] [-d] [-g] [-t] [-p file] [-vn] [-mxx] [-c file]"
#ifdef ENABLE_IPV4
" [-4]"
#endif
#ifdef ENABLE_IPV6
" [-6] [-i prefix]"
#endif
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
" [-a]"
#endif
"\n\n"
"Options:\n"
"-h\t\t--or--\n"
"--help\t\tprint this help page and exit.\n"
"-V\t\t--or--\n"
"--version\tprint version and license information and exit.\n"
"--pdnsd-user\tprint the user pdnsd will run as and exit.\n"
"-s\t\t--or--\n"
"--status\tEnable status control socket in the cache directory.\n"
"-d\t\t--or--\n"
"--daemon\tStart pdnsd in daemon mode (as background process.)\n"
"-g\t\t--or--\n"
"--debug\t\tPrint some debug messages on the console or to the\n"
"\t\tfile pdnsd.debug in your cache directory (in daemon mode).\n"
"-t\t\t--or--\n"
"--tcp\t\tEnables the TCP server thread. pdnsd will then serve\n"
"\t\tTCP and UDP queries.\n"
"-p\t\tWrites the pid the server runs as to a specified filename.\n"
"\t\tWorks only in daemon mode.\n"
"-vn\t\tsets the verbosity of pdnsd. n is a numeric argument from 0\n"
"\t\t(normal operation) to 9 (many messages for debugging).\n"
"\t\tUse like -v2\n"
"-mxx\t\tsets the query method pdnsd uses. Possible values for xx are:\n"
"\t\tuo (UDP only), to (TCP only), tu (TCP or, if the server\n"
"\t\tdoes not support this, UDP) and ut (UDP and, if the reply was\n"
"\t\ttruncated, TCP). Use like -muo. Preset: "
#if M_PRESET==UDP_ONLY
"-muo"
#elif M_PRESET==TCP_ONLY
"-mto"
#elif M_PRESET==TCP_UDP
"-mtu"
#else
"-mut"
#endif
"\n"
"-c\t\t--or--\n"
"--config-file\tspecifies the file the configuration is read from.\n"
"\t\tDefault is " CONFDIR "/pdnsd.conf\n"
#ifdef ENABLE_IPV4
"-4\t\tswitches to IPv4 mode.\n"
"\t\t"
# if DEFAULT_IPV4
"On"
# else
"Off"
# endif
" by default.\n"
#endif
#ifdef ENABLE_IPV6
"-6\t\tswitches to IPv6 mode.\n"
"\t\t"
# if DEFAULT_IPV4
"Off"
# else
"On"
# endif
" by default.\n"
"-i\t\t--or--\n"
"--ipv4_6_prefix\tspecifies the prefix pdnsd uses to map IPv4 to IPv6\n"
"\t\taddresses. Must be a valid IPv6 address.\n"
"\t\tDefault is " DEFAULT_IPV4_6_PREFIX "\n"
#endif
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
"-a\t\tWith this option, pdnsd will try to detect automatically if\n"
"\t\tthe system supports IPv6, and revert to IPv4 otherwise.\n"
#endif
"\n\n\"no\" can be prepended to the --status, --daemon, --debug and --tcp\n"
"options (e.g. --notcp) to reverse their effect.\n";
/* These are some init steps we have to call before we get daemon on linux, but need
* to call after daemonizing on other OSes.
* Theay are also the last steps before we drop privileges. */
int final_init()
{
#ifndef NO_TCP_SERVER
if (!global.notcp)
tcp_socket=init_tcp_socket();
#endif
udp_socket=init_udp_socket();
if (tcp_socket==-1 && udp_socket==-1) {
log_error("tcp and udp initialization failed. Exiting.");
return 0;
}
if (global.strict_suid) {
if (!run_as(global.run_as)) {
return 0;
}
}
return 1;
}
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
/* Check if IPv6 is available.
* With thanks to Juliusz Chroboczek.
*/
static int check_ipv6()
{
int fd;
fd = socket(PF_INET6, SOCK_STREAM, 0);
if(fd < 0) {
if(errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL)
return 0;
return -1;
}
close(fd);
return 1;
}
#endif
/*
* Argument parsing, init, server startup
*/
int main(int argc,char *argv[])
{
int i,sig,pfd=-1; /* Initialized to inhibit compiler warning */
main_thrid=pthread_self();
servstat_thrid=main_thrid;
statsock_thrid=main_thrid;
tcps_thrid=main_thrid;
udps_thrid=main_thrid;
init_uid=getuid();
#ifdef ENABLE_IPV6
{
int err;
if((err=inet_pton(AF_INET6,DEFAULT_IPV4_6_PREFIX,&global.ipv4_6_prefix))<=0) {
fprintf(stderr,"Error: inet_pton() wont accept default prefix %s in %s, line %d\n",
DEFAULT_IPV4_6_PREFIX,__FILE__,__LINE__);
if(err)
perror("inet_pton");
exit(1);
}
}
#endif
/* Parse the command line.
Remember which options were specified here, because the command-line options
shall override the ones given in the config file */
for (i=1;i<argc;i++) {
char *arg=argv[i];
if (strcmp(arg,"-h")==0 || strcmp(arg,"--help")==0) {
fputs(info_message,stdout);
fputs(help_message,stdout);
exit(1);
} else if (strcmp(arg,"-V")==0 || strcmp(arg,"--version")==0) {
fputs(info_message,stdout);
exit(1);
} else if (strcmp(arg,"-c")==0 || strcmp(arg,"--config-file")==0) {
if (++i<argc) {
conf_file=argv[i];
} else {
fprintf(stderr,"Error: file name expected after %s option.\n",arg);
exit(1);
}
} else if (strcmp(arg,"-4")==0) {
#ifdef ENABLE_IPV4
# ifdef ENABLE_IPV6
run_ipv4=1; cmdlineipv=1;
# endif
#else
fprintf(stderr,"Error: -4: pdnsd was compiled without IPv4 support.\n");
exit(1);
#endif
} else if (strcmp(arg,"-6")==0) {
#ifdef ENABLE_IPV6
# ifdef ENABLE_IPV4
run_ipv4=0; cmdlineipv=1;
# endif
#else
fprintf(stderr,"Error: -6: pdnsd was compiled without IPv6 support.\n");
exit(1);
#endif
} else if (strcmp(arg,"-a")==0) {
#if defined(ENABLE_IPV4) && defined(ENABLE_IPV6)
int rv=check_ipv6();
if(rv<0) {
fprintf(stderr,"Error: -a: can't check availability of IPv6: %s\n"
"Try using -4 or -6 option instead.\n",strerror(errno));
exit(1);
}
if((run_ipv4= !rv))
fprintf(stderr,"Switching to IPv4 mode.\n");
cmdlineipv=1;
#else
fprintf(stderr,"Warning: -a option does nothing unless pdnsd is compiled with both IPv4 AND IPv6 support.\n");
#endif
} else if(strcmp(arg,"-i")==0 || strcmp(arg,"--ipv4_6_prefix")==0) {
if (++i<argc) {
#ifdef ENABLE_IPV6
if(inet_pton(AF_INET6,argv[i],&global.ipv4_6_prefix)<=0) {
fprintf(stderr,"Error: %s: argument not a valid IPv6 address.\n",arg);
exit(1);
}
cmdline.prefix=1;
#else
fprintf(stderr,"pdnsd was compiled without IPv6 support. %s will be ignored.\n",arg);
#endif
} else {
fprintf(stderr,"Error: IPv6 address expected after %s option.\n",arg);
exit(1);
}
} else if (strcmp(arg,"-s")==0 || strcmp(arg,"--status")==0) {
global.stat_pipe=1; cmdline.stat_pipe=1;
} else if (strcmp(arg,"--nostatus")==0) {
global.stat_pipe=0; cmdline.stat_pipe=1;
} else if (strcmp(arg,"-d")==0 || strcmp(arg,"--daemon")==0) {
global.daemon=1; cmdline.daemon=1;
} else if (strcmp(arg,"--nodaemon")==0) {
global.daemon=0; cmdline.daemon=1;
} else if (strcmp(arg,"-t")==0 || strcmp(arg,"--tcp")==0) {
global.notcp=0; cmdline.notcp=1;
#ifdef NO_TCP_SERVER
fprintf(stderr,"pdnsd was compiled without tcp server support. -t has no effect.\n");
#endif
} else if (strcmp(arg,"--notcp")==0) {
global.notcp=1; cmdline.notcp=1;
} else if (strcmp(arg,"-p")==0) {
if (++i<argc) {
global.pidfile=argv[i]; cmdline.pidfile=1;
} else {
fprintf(stderr,"Error: file name expected after -p option.\n");
exit(1);
}
} else if (strncmp(arg,"-v",2)==0) {
if (strlen(arg)!=3 || !isdigit(arg[2])) {
fprintf(stderr,"Error: one digit expected after -v option (like -v2).\n");
exit(1);
}
global.verbosity=arg[2]-'0'; cmdline.verbosity=1;
} else if (strncmp(arg,"-m",2)==0) {
if (strlen(arg)!=4) {
fprintf(stderr,"Error: uo, to or tu expected after the -m option (like -muo).\n");
exit(1);
}
if (strcmp(&arg[2],"uo")==0) {
#ifdef NO_UDP_QUERIES
fprintf(stderr,"Error: pdnsd was compiled without UDP support.\n");
exit(1);
#else
global.query_method=UDP_ONLY;
#endif
} else if (strcmp(&arg[2],"to")==0) {
#ifdef NO_TCP_QUERIES
fprintf(stderr,"Error: pdnsd was compiled without TCP support.\n");
exit(1);
#else
global.query_method=TCP_ONLY;
#endif
} else if (strcmp(&arg[2],"tu")==0) {
#if defined(NO_UDP_QUERIES) || defined(NO_TCP_QUERIES)
fprintf(stderr,"Error: pdnsd was not compiled with UDP and TCP support.\n");
exit(1);
#else
global.query_method=TCP_UDP;
#endif
} else if (strcmp(&arg[2],"ut")==0) {
#if defined(NO_UDP_QUERIES) || defined(NO_TCP_QUERIES)
fprintf(stderr,"Error: pdnsd was not compiled with UDP and TCP support.\n");
exit(1);
#else
global.query_method=UDP_TCP;
#endif
} else {
fprintf(stderr,"Error: uo, to, tu or ut expected after the -m option (like -muo).\n");
exit(1);
}
cmdline.query_method=1;
} else if (strcmp(arg,"-g")==0 || strcmp(arg,"--debug")==0) {
global.debug=1; cmdline.debug=1;
#if !DEBUG
fprintf(stderr,"pdnsd was compiled without debugging support. -g has no effect.\n");
#endif
} else if (strcmp(arg,"--nodebug")==0) {
global.debug=0; cmdline.debug=1;
} else if (strcmp(arg,"--pdnsd-user")==0) {
cmdline.pdnsduser=1;
} else {
char *equ=strchr(arg,'=');
if(equ) {
int plen=equ-arg;
char *valstr=equ+1;
# define arg_isparam(strlit) (!strncmp(arg,strlit,strlitlen(strlit)) && plen==strlitlen(strlit))
if(arg_isparam("--config-file")) {
conf_file=valstr;
}
else if(arg_isparam("--ipv4_6_prefix")) {
#ifdef ENABLE_IPV6
if(inet_pton(AF_INET6,valstr,&global.ipv4_6_prefix)<=0) {
fprintf(stderr,"Error: --ipv4_6_prefix: argument not a valid IPv6 address.\n");
exit(1);
}
cmdline.prefix=1;
#else
fprintf(stderr,"pdnsd was compiled without IPv6 support. --ipv4_6_prefix will be ignored.\n");
#endif
}
else {
fprintf(stderr,"Error: unknown option: %.*s\n",plen,arg);
exit(1);
}
} else {
fprintf(stderr,"Error: unknown option: %s\n",arg);
exit(1);
}
}
}
init_cache();
{
char *errmsg;
if(!read_config_file(conf_file,&global,&servers,0,&errmsg)) {
fputs(errmsg?:"Out of memory.",stderr);
fputc('\n',stderr);
exit(3);
}
}
if(cmdline.pdnsduser) {
if (global.run_as[0]) {
printf("%s\n",global.run_as);
} else {
uid_t uid=getuid();
struct passwd *pws=getpwuid(uid);
if (pws)
printf("%s\n",pws->pw_name);
else
printf("%i\n",uid);
}
exit(0);
}
if(!global.cache_dir) global.cache_dir = CACHEDIR;
if(!global.scheme_file) global.scheme_file = "/var/lib/pcmcia/scheme";
stat_pipe=global.stat_pipe;
if (!(global.run_as[0] && global.strict_suid)) {
for (i=0; i<DA_NEL(servers); i++) {
servparm_t *sp=&DA_INDEX(servers,i);
if (sp->uptest==C_EXEC && sp->uptest_usr[0]=='\0') {
uid_t uid=getuid();
struct passwd *pws=getpwuid(uid);
/* No explicit uptest user given. If we run_as and strict_suid, we assume that
* this is safe. If not - warn. */
fprintf(stderr,"Warning: uptest command \"%s\" will implicitly be executed as user ", sp->uptest_cmd);
if (pws)
fprintf(stderr,"%s\n",pws->pw_name);
else
fprintf(stderr,"%i\n",uid);
}
}
}
if (global.daemon && global.pidfile) {
if (unlink(global.pidfile)!=0 && errno!=ENOENT) {
log_error("Error: could not unlink pid file %s: %s",global.pidfile, strerror(errno));
exit(1);
}
if ((pfd=open(global.pidfile,O_WRONLY|O_CREAT|O_EXCL
#ifdef O_NOFOLLOW
|O_NOFOLLOW
#else
/*
* No O_NOFOLLOW. Nevertheless, this not a hole, since the
* directory for pidfiles should not be world writeable.
* OS's that do not support O_NOFOLLOW are currently not
* supported, this is just-in-case code.
*/
#endif
, 0600))==-1)
{
log_error("Error: could not open pid file %s: %s",global.pidfile, strerror(errno));
exit(1);
}
}
for (i=0;i<DA_NEL(servers);i++) {
if (DA_INDEX(servers,i).uptest==C_PING) {
init_ping_socket();
break;
}
}
if (!init_rng())
exit(1);
#if (TARGET==TARGET_LINUX)
if (!final_init())
exit(1);
#endif
{
struct sigaction action;
action.sa_handler = SIG_IGN;
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
if(sigaction(SIGPIPE, &action, NULL) != 0)
log_error("Could not call sigaction to ignore SIGPIPE: %s",strerror(errno));
}
umask(0077); /* for security reasons */
if (global.daemon) {
pid_t pid;
int fd;
/* become a daemon */
pid=fork();
if (pid==-1) {
log_error("Could not become a daemon: fork #1 failed: %s",strerror(errno));
exit(1);
}
if (pid!=0) {
/* This is the parent.
The child is going to do another fork() and will exit quickly.
Perhaps we should wait for the child and return
its exit status? */
exit(0); /* exit parent */
}
/* dissociate from controlling terminal */
if (setsid()==-1) {
log_error("Could not become a daemon: setsid failed: %s",strerror(errno));
_exit(1);
}
pid=fork();
if (pid==-1) {
log_error("Could not become a daemon: fork #2 failed: %s",strerror(errno));
_exit(1);
}
if (pid!=0) {
int exitval=0;
if (global.pidfile) {
if(fsprintf(pfd,"%i\n",(int)pid)<0) {
log_error("Error: could not write to pid file %s: %s",
global.pidfile, strerror(errno));
exitval=1;
}
if(close(pfd)<0) {
log_error("Error: could not close pid file %s: %s",
global.pidfile, strerror(errno));
exitval=1;
}
}
_exit(exitval); /* exit parent, so we are no session group leader */
}
if (global.pidfile) close(pfd);
if(chdir("/"))
log_warn("Cannot chdir to root directory: %s",strerror(errno));
if ((fd=open("/dev/null",O_RDONLY))==-1) {
log_error("Could not become a daemon: open for /dev/null failed: %s",strerror(errno));
_exit(1);
}
dup2(fd,0);
close(fd);
if ((fd=open("/dev/null",O_WRONLY))==-1) {
log_error("Could not become a daemon: open for /dev/null failed: %s",strerror(errno));
_exit(1);
}
dup2(fd,1);
dup2(fd,2);
close(fd);
#if DEBUG>0
if (global.debug) {
char dbgpath[strlen(global.cache_dir)+sizeof("/pdnsd.debug")];
stpcpy(stpcpy(dbgpath,global.cache_dir),"/pdnsd.debug");
if (!(dbg_file=fopen(dbgpath,"w")))
log_warn("Warning: could not open debug file %s: %s",dbgpath, strerror(errno));
}
#endif
} else {
#if DEBUG>0
dbg_file=stdout;
#endif
}
#if DEBUG>0
debug_p= (global.debug && dbg_file);
#endif
log_info(0,"pdnsd-%s starting.\n",VERSION);
DEBUG_MSG("Debug messages activated\n");
#if (TARGET!=TARGET_LINUX)
if (!final_init())
_exit(1);
#endif
DEBUG_MSG(SEL_IPVER("Using IPv4.\n", "Using IPv6.\n"));
/* initialize attribute for creating detached threads */
pthread_attr_init(&attr_detached);
pthread_attr_setdetachstate(&attr_detached,PTHREAD_CREATE_DETACHED);
read_disk_cache();
/* This must be done before any other thread is started to avoid races. */
if (stat_pipe)
init_stat_sock();
/* Before this point, logging and cache accesses are not locked because we are single-threaded. */
init_log_lock();
init_cache_lock();
sigemptyset(&sigs_msk);
sigaddset(&sigs_msk,SIGHUP);
sigaddset(&sigs_msk,SIGINT);
#ifndef THREADLIB_NPTL
sigaddset(&sigs_msk,SIGILL);
#endif
sigaddset(&sigs_msk,SIGABRT);
sigaddset(&sigs_msk,SIGFPE);
#ifndef THREADLIB_NPTL
sigaddset(&sigs_msk,SIGSEGV);
#endif
sigaddset(&sigs_msk,SIGTERM);
/* if (!daemon_p) {
sigaddset(&sigs_msk,SIGQUIT);
} */
#if (TARGET==TARGET_LINUX)
pthread_sigmask(SIG_BLOCK,&sigs_msk,NULL);
#endif
#if DEBUG>0
{
int err;
/* Generate a key for storing our thread id's */
if ((err=pthread_key_create(&thrid_key, NULL)) != 0) {
log_error("pthread_key_create failed: %s",strerror(err));
_exit(1);
}
}
#endif
{
#if DEBUG>0
int thrdsucc=1;
# define thrdfail (thrdsucc=0)
#else
# define thrdfail
#endif
if(start_servstat_thread()) thrdfail;
#if (TARGET==TARGET_LINUX)
if (!global.strict_suid) {
if (!run_as(global.run_as)) {
_exit(1);
}
}
#endif
if (stat_pipe)
if(start_stat_sock()) thrdfail;
start_dns_servers();
#if DEBUG>0
if(thrdsucc) {
DEBUG_MSG("All threads started successfully.\n");
}
#endif
#undef thrdfail
}
#if (TARGET==TARGET_LINUX) && !defined(THREADLIB_NPTL)
pthread_sigmask(SIG_BLOCK,&sigs_msk,NULL);
waiting=1;
#endif
{
int err;
while ((err=sigwait(&sigs_msk,&sig))) {
if (err!=EINTR) {
log_error("sigwait failed: %s",strerror(err));
sig=0;
break;
}
}
}
if(sig) DEBUG_MSG("Signal %i caught.\n",sig);
write_disk_cache();
destroy_cache();
if(sig) log_warn("Caught signal %i. Exiting.",sig);
if (sig==SIGSEGV || sig==SIGILL || sig==SIGBUS)
crash_msg("This is a fatal signal probably triggered by a bug.");
if (ping_isocket!=-1)
close(ping_isocket);
#ifdef ENABLE_IPV6
if (ping6_isocket!=-1)
close(ping6_isocket);
#endif
/* Close and delete the status socket */
if(stat_pipe) close(stat_sock);
if (sock_path && unlink(sock_path))
log_warn("Failed to unlink %s: %s",sock_path, strerror(errno));
free_rng();
#if DEBUG>0
if (debug_p && global.daemon)
if(fclose(dbg_file)<0) {
log_warn("Could not close debug file: %s", strerror(errno));
}
#endif
_exit(0);
}

View File

@ -1,309 +0,0 @@
#!/usr/bin/perl -w
# This Perl script is used to generate rr_types.h, using rr_types.in as input.
#
# Copyright (C) 2010, 2011 Paul A. Rombouts
#
# This file is part of the pdnsd package.
#
use strict;
use integer;
print << "END-OF-TEXT";
/* This file was generated by running '$0 @ARGV'.
Modifications to this file may be lost the next time it is automatically
regenerated.
*/
END-OF-TEXT
my %valdic;
my %namedic;
my %classdic;
my %muset;
my $nrr=0;
my $nmu=0;
my $minval;
my $maxval;
#my $maxmuval;
while(<>) {
if(/\S/ && !/^\s*\#/) {
if(/^\s*(?:([*+-])\s*)?([\w-]+)\s+(\d+)\s+(?:\((\w+)\))?/) {
my $mu = $1; my $name=$2; my $val=$3+0; my $class=$4;
$name =~ s/-/_/g;
if(defined($valdic{$name})) {warn "The name \"$name\" does not have a unique value.\n"}
if(defined($namedic{$val})) {warn "The value \"$val\" does not have a unique name.\n"}
$valdic{$name}=$val; $namedic{$val}=$name; $classdic{$val}=$class if defined($class);
if(defined($mu)) {
if($mu eq '-') {next}
$muset{$val}= 1;
++$nmu;
#if(!defined($maxmuval) || $val>$maxmuval) {$maxmuval=$val}
}
else {$muset{$val}= 0}
++$nrr;
if(!defined($minval) || $val<$minval) {$minval=$val}
if(!defined($maxval) || $val>$maxval) {$maxval=$val}
}
else {die "Can't find name-value pair in following line:\n$_\n"}
}
}
defined($minval) or die "No values defined.\n";
if($nrr>255) {warn "Warning: total number of cache-able RR types is greater than 255.\n"}
print << 'END-OF-TEXT';
/* rr_types.h - A header file with names & descriptions of
all rr types known to pdnsd
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2007, 2010, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef _RR_TYPES_H_
#define _RR_TYPES_H_
#include <config.h>
END-OF-TEXT
print "#define T_MIN $minval\n";
foreach my $name (sort {$valdic{$a} <=> $valdic{$b} } (keys %valdic)) {
printf("#define %-12s %2d\n", "T_$name", $valdic{$name});
}
print "#define T_MAX $maxval\n";
print("\n/* T_MAX - T_MIN + 1 */\n","#define T_NUM ",$maxval+1-$minval,"\n");
#print("\n/* Largest most frequently used type value. */\n","#define T_MAXMU $maxmuval\n");
print("\n/* Number of most frequently used rr types. */\n","#define NRRMU $nmu\n");
print("\n/* Number of remaining rr types. */\n","#define NRREXT ",$nrr-$nmu,"\n");
print("\n/* NRRMU + NRREXT */\n","#define NRRTOT $nrr\n");
print << 'END-OF-TEXT';
/* Lookup table for converting rr type values to internally used indices. */
extern const unsigned short int rrlkuptab[T_NUM];
#if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY)
const unsigned short int rrlkuptab[T_NUM] = {
END-OF-TEXT
my @rrtpval=();
for(my $val=$minval, my $i=0, my $j=$nmu, my $k=$nrr; $val<=$maxval; ++$val) {
my $idx;
if(defined($muset{$val})) {
if($muset{$val}) {
$idx = $i++;
}
else {
$idx = $j++;
}
$rrtpval[$idx]=$val;
}
else {
$idx = $k++;
}
printf('%4d', $idx);
if(defined($namedic{$val})) {
print " /* $namedic{$val} */";
}
print ',' if $val<$maxval;
print "\n";
}
#print << 'END-OF-TEXT';
#};
##endif
#
#/* Table for converting internally used indices to rr type values.
# This is more or less the inverse of the rrlkuptab[] mapping. */
#extern const unsigned short int rrtpval[NRRTOT];
##if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY)
#const unsigned short int rrtpval[NRRTOT] = {
#END-OF-TEXT
#for(my $i=0; $i<$nrr; ++$i) {
# if($i ==0) {
# print " /* Most frequently used types. */\n";
# }
# else {
# print ",\n";
# }
# print " /* Remaining (less frequently used) types. */\n"
# if $i == $nmu;
# my $val= $rrtpval[$i];
# print(" ",defined($namedic{$val})? "T_$namedic{$val}": $val);
#}
print << 'END-OF-TEXT';
};
#endif
/* List of most frequently used RR types in ascending order. */
extern const unsigned short int rrmuiterlist[NRRMU];
#if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY)
const unsigned short int rrmuiterlist[NRRMU] = {
END-OF-TEXT
for(my $val=$minval, my $i=0; $val<=$maxval; ++$val) {
if(defined($muset{$val}) && $muset{$val}) {
print ",\n" if $i++;
print(" ",defined($namedic{$val})? "T_$namedic{$val}": $val);
}
}
print << 'END-OF-TEXT';
};
#endif
/* List of the cache-able RR types in ascending order. */
extern const unsigned short int rrcachiterlist[NRRTOT];
#if DEFINE_RR_TYPE_ARRAYS
const unsigned short int rrcachiterlist[NRRTOT] = {
END-OF-TEXT
for(my $val=$minval, my $i=0; $val<=$maxval; ++$val) {
if(defined($muset{$val})) {
print ",\n" if $i++;
print(" ",defined($namedic{$val})? "T_$namedic{$val}": $val);
}
}
print << 'END-OF-TEXT';
};
#endif
/* Optimized getrrset macros for fixed rr types. */
END-OF-TEXT
for(my $val=$minval, my $i=0, my $j=0; $val<=$maxval; ++$val) {
if(defined($muset{$val})) {
my $name = $namedic{$val};
my $mdef;
if($muset{$val}) {
$mdef= "GET_RRSMU(cent,$i)";
++$i;
}
else {
$mdef= "GET_RRSEXT(cent,$j)";
++$j;
}
printf("#define %-25s %s\n", "getrrset_$name(cent)", $mdef)
if defined($name);
}
}
print << 'END-OF-TEXT';
/* have_rr macros for fixed rr types. */
END-OF-TEXT
for(my $val=$minval, my $i=0, my $j=0; $val<=$maxval; ++$val) {
my $name = $namedic{$val};
my $mdef = '0';
if(defined($muset{$val})) {
if($muset{$val}) {
$mdef= "HAVE_RRMU(cent,$i)";
++$i;
}
else {
$mdef= "HAVE_RREXT(cent,$j)";
++$j;
}
}
printf("#define %-25s %s\n", "have_rr_$name(cent)", $mdef)
if defined($name);
}
print << 'END-OF-TEXT';
/* These macros specify which RR types are cached by pdnsd. */
END-OF-TEXT
for(my $val=$minval; $val<=$maxval; ++$val) {
if(defined($muset{$val})) {
my $name = $namedic{$val};
printf("#define IS_CACHED_%-10s 1\n", defined($name)? $name: "TYPE$val")
}
}
print << 'END-OF-TEXT';
/* Array indices for most frequently used rr types. */
END-OF-TEXT
for(my $val=$minval, my $i=0; $val<=$maxval; ++$val) {
if(defined($muset{$val}) && $muset{$val}) {
printf("#define %-18s %2d\n", "RRMUINDEX_$namedic{$val}", $i)
if defined($namedic{$val});
++$i;
}
}
print << 'END-OF-TEXT';
/* Table of rr names. */
extern const char *const rrnames[T_NUM];
#if DEFINE_RR_TYPE_ARRAYS
const char *const rrnames[T_NUM] = {
END-OF-TEXT
for(my $val=$minval; $val<=$maxval; ++$val) {
my $name = $namedic{$val};
print(' "', defined($name)? $name: "TYPE$val", '"');
print ',' if $val<$maxval;
print "\n";
}
print << 'END-OF-TEXT';
};
#endif
/* Structure for rr information */
struct rr_infos {
unsigned short class; /* class (values see below) */
unsigned short excludes; /* relations to other classes.
Mutual exclusion is marked by or'ing the
respective RRCL value in this field.
Exclusions should be symmetric. */
};
/* Class values */
#define RRCL_ALIAS 1 /* for CNAMES, conflicts with RRCL_RECORD */
#define RRCL_RECORD 2 /* normal direct record */
#define RRCL_IDEM 4 /* types that conflict with no others (MX, CNAME, ...) */
#define RRCL_PTR 8 /* PTR */
/* Standard excludes for the classes */
#define RRX_ALIAS (RRCL_RECORD|RRCL_PTR)
#define RRX_RECORD (RRCL_ALIAS|RRCL_PTR)
#define RRX_IDEM 0
#define RRX_PTR (RRCL_ALIAS|RRCL_RECORD)
/* There could be a separate table detailing the relationship of types, but this
* is slightly more flexible, as it allows a finer granularity of exclusion. Also,
* Membership in multiple classes could be added.
* Index by internally used RR-set indices, not RR type values!
*/
extern const struct rr_infos rr_info[NRRTOT];
#if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY)
const struct rr_infos rr_info[NRRTOT] = {
END-OF-TEXT
for(my $i=0; $i<$nrr; ++$i) {
print ",\n" if $i;
my $val=$rrtpval[$i];
my $class = (defined($classdic{$val})? $classdic{$val}: 'IDEM');
printf(' %-16s %-15s %s',"{RRCL_$class,", "RRX_$class}", defined($namedic{$val})?"/* $namedic{$val} */":"");
}
print << 'END-OF-TEXT';
};
#endif
int rr_tp_byname(char *name);
const char *loc2str(const void *binary, char *ascii, size_t asclen);
#endif
END-OF-TEXT
exit

View File

@ -1,363 +0,0 @@
/* netdev.c - Test network devices for existence and status
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
/*
* Portions are under the following copyright and taken from FreeBSD
* (clause 3 deleted as it no longer applies):
*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if.h,v 1.58.2.1 2000/05/05 13:37:04 jlemon Exp $
*/
#include <config.h>
#include "ipvers.h"
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include "helpers.h"
#include "netdev.h"
#include "error.h"
#if (TARGET==TARGET_BSD)
/* Taken from FreeBSD net/if.h rev. 1.58.2.1 */
#define SIZEOF_ADDR_IFREQ(ifr) \
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
#elif (TARGET==TARGET_CYGWIN)
#define SIZEOF_ADDR_IFREQ(ifr) (sizeof(struct sockaddr))
#endif
#define MAX_SOCKETOPEN_ERRS 10
static volatile unsigned long socketopen_errs=0;
/*
* Portions of the following code are Linux/FreeBSD specific.
* Please write interface-detection routines for other flavours of Unix if you can and want.
*/
#if (TARGET==TARGET_LINUX) || (TARGET==TARGET_BSD) || (TARGET==TARGET_CYGWIN)
# if (TARGET==TARGET_LINUX)
static volatile unsigned long isdn_errs=0;
# ifdef ISDN_SUPPORT
/*
* Test the status of an ippp interface. Taken from the isdn4k-utils (thanks!) and adapted
* by me (I love free software!)
* This will not work with older kernels.
* If your kernel is too old or too new, just try to get the status as uptest=exec command
* This will work, although slower.
*/
# include <linux/isdn.h>
int statusif(char *name)
{
isdn_net_ioctl_phone phone;
int isdninfo,rc=0;
if ((isdninfo = open("/dev/isdninfo", O_RDONLY))<0) {
if (++isdn_errs<=2) {
log_warn("Could not open /dev/isdninfo for uptest: %s",strerror(errno));
}
return 0;
}
strncp(phone.name, name, sizeof(phone.name));
if (ioctl(isdninfo, IIOCNETGPN, &phone)==0)
rc=1;
close(isdninfo);
return rc;
}
# endif
/*
* Test whether the network interface specified in ifname and its
* associated device specified in devname have locks owned by the
* same process.
*/
int dev_up(char *ifname, char *devname)
{
FILE *fd;
int pidi, pidd, rv;
{
char path[sizeof("/var/run/.pid")+strlen(ifname)];
stpcpy(stpcpy(stpcpy(path,"/var/run/"),ifname),".pid");
if ((fd=fopen(path, "r")) == NULL )
return 0;
if (fscanf(fd, "%d", &pidi) != 1 ) {
fclose(fd) ;
return 0;
}
fclose(fd);
}
{
char path[sizeof("/var/lock/LCK..")+strlen(devname)];
stpcpy(stpcpy(path,"/var/lock/LCK.."),devname);
if ((fd=fopen(path, "r")) == NULL)
return 0;
if (fscanf(fd, "%d", &pidd) != 1) {
fclose(fd);
return 0;
}
fclose(fd);
}
if (pidi != pidd)
return 0;
/* Test whether pppd is still alive */
rv=kill(pidi,0);
return (rv==0 || (rv==-1 && errno!=ESRCH));
}
# endif /*(TARGET==TARGET_LINUX)*/
/*
* Test whether the network device specified in devname is up and
* running (returns -1) or non-existent, down or not-running (returns 0)
*
* Note on IPv6-Comptability: rfc2133 requires all IPv6 implementation
* to be backwards-compatible to IPv4 in means of permitting socket(PF_INET,...)
* and similar. So, I don't put code here for both IPv4 and IPv6, since
* I use that socket only for ioctls. If somebody notices incompatabilities,
* please notify me.
*/
int if_up(char *devname)
{
int sock;
struct ifreq ifr;
# if (TARGET==TARGET_LINUX)
unsigned int devnamelen=strlen(devname);
if (devnamelen>4 && devnamelen<=6 && strncmp(devname,"ippp",4)==0) {
/* This function didn't manage the interface uptest correctly. Thanks to
* Joachim Dorner for pointing out.
* The new code (statusif()) was shamelessly stolen from isdnctrl.c of the
* isdn4k-utils. */
# ifdef ISDN_SUPPORT
return statusif(devname);
# else
if (isdn_errs++==0) {
log_warn("An ippp? device was specified for uptest, but pdnsd was compiled without ISDN support.");
log_warn("The uptest result will be wrong.");
}
# endif
/* If it doesn't match our rules for isdn devices, treat as normal if */
}
# endif
if ((sock=socket(PF_INET,SOCK_DGRAM, IPPROTO_UDP))==-1) {
if(++socketopen_errs<=MAX_SOCKETOPEN_ERRS) {
log_warn("Could not open socket in if_up(): %s",strerror(errno));
}
return 0;
}
strncp(ifr.ifr_name,devname,IFNAMSIZ);
if (ioctl(sock,SIOCGIFFLAGS,&ifr)==-1) {
close(sock);
return 0;
}
close(sock);
return (ifr.ifr_flags&IFF_UP) && (ifr.ifr_flags&IFF_RUNNING);
}
# if (TARGET==TARGET_LINUX)
# ifdef ENABLE_IPV6
#define MAX_IF_INET6_OPEN_ERRS 10
static volatile unsigned long if_inet6_open_errs=0;
# endif
int is_local_addr(pdnsd_a *a)
{
int res=0;
# ifdef ENABLE_IPV4
if (run_ipv4) {
int i,sock;
struct ifreq ifr;
if ((sock=socket(PF_INET,SOCK_DGRAM, IPPROTO_UDP))==-1) {
if(++socketopen_errs<=MAX_SOCKETOPEN_ERRS) {
log_warn("Could not open socket in is_local_addr(): %s",strerror(errno));
}
return 0;
}
for (i=1;i<255;i++) {
ifr.ifr_ifindex=i;
if (ioctl(sock,SIOCGIFNAME,&ifr)==-1) {
/* There may be gaps in the interface enumeration, so just continue */
continue;
}
if (ioctl(sock,SIOCGIFADDR, &ifr)==-1) {
continue;
}
if (((struct sockaddr_in *)(&ifr.ifr_addr))->sin_addr.s_addr==a->ipv4.s_addr) {
res=1;
break;
}
}
close(sock);
}
# endif
# ifdef ENABLE_IPV6
ELSE_IPV6 {
char buf[40];
FILE *f;
struct in6_addr b;
/* the interface configuration and information retrieval is obiously currently done via
* rt-netlink sockets. I think it is relatively likely to change in an incompatible way the
* Linux kernel (there seem to be some major changes for 2.4).
* Right now, I just analyze the /proc/net/if_inet6 entry. This may not be the fastest, but
* should work and is easy to adapt should the format change. */
if (!(f=fopen("/proc/net/if_inet6","r"))) {
if(++if_inet6_open_errs<=MAX_IF_INET6_OPEN_ERRS) {
log_warn("Could not open /proc/net/if_inet6 in is_local_addr(): %s",strerror(errno));
}
return 0;
}
/* The address is at the start of the line. We just read 32 characters and insert a ':' 7
* times. Such, we can use inet_pton conveniently. More portable, that. */
for(;;) {
int i,ch; char *p=buf;
for (i=0;i<32;i++) {
if(i && i%4==0) *p++ = ':';
if ((ch=fgetc(f))==EOF)
goto fclose_return; /* we are at the end of the file and haven't found anything.*/
if(ch=='\n') goto nextline;
*p++ = ch;
}
*p=0;
if (inet_pton(AF_INET6,buf,&b) >0) {
if (IN6_ARE_ADDR_EQUAL(&b,&a->ipv6)) {
res=1;
goto fclose_return;
}
}
do {
if ((ch=fgetc(f))==EOF) goto fclose_return;
} while(ch!='\n');
nextline:;
}
fclose_return:
fclose(f);
}
# endif
return res;
}
# else /*(TARGET==TARGET_BSD) || (TARGET==TARGET_CYGWIN)*/
#define MAX_SIOCGIFCONF_ERRS 4
static volatile unsigned long siocgifconf_errs=0;
int is_local_addr(pdnsd_a *a)
{
int retval=0, sock, cnt;
struct ifconf ifc;
char buf[2048];
if ((sock=socket(PF_INET,SOCK_DGRAM, IPPROTO_UDP))==-1) {
if(++socketopen_errs<=MAX_SOCKETOPEN_ERRS) {
log_warn("Could not open socket in is_local_addr(): %s",strerror(errno));
}
return 0;
}
ifc.ifc_len=sizeof(buf);
ifc.ifc_buf=buf;
if (ioctl(sock,SIOCGIFCONF,&ifc)==-1) {
if(++siocgifconf_errs<=MAX_SIOCGIFCONF_ERRS) {
log_warn("ioctl() call with request SIOCGIFCONF failed in is_local_addr(): %s",strerror(errno));
}
goto close_sock_return;
}
cnt=0;
while(cnt+sizeof(struct ifreq)<=ifc.ifc_len) {
struct ifreq *ir= (struct ifreq *)(buf+cnt);
cnt += SIZEOF_ADDR_IFREQ(*ir);
if (cnt>ifc.ifc_len)
break;
if (SEL_IPVER(ir->ifr_addr.sa_family==AF_INET &&
((struct sockaddr_in *)&ir->ifr_addr)->sin_addr.s_addr==a->ipv4.s_addr,
ir->ifr_addr.sa_family==AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)&ir->ifr_addr)->sin6_addr,
&a->ipv6)))
{
retval=1;
break;
}
}
close_sock_return:
close(sock);
return retval;
}
# endif
#else
# error "Huh. No OS macro defined."
#endif

View File

@ -1,32 +0,0 @@
/* netdev.h - Test network devices for existence and status
Copyright (C) 2000 Thomas Moestl
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef _NETDEV_H_
#define _NETDEV_H_
#include <config.h>
#include "ipvers.h"
int if_up(char *devname);
int dev_up(char *ifname, char *devname);
int is_local_addr(pdnsd_a *a);
#endif

View File

@ -1,18 +0,0 @@
sbin_PROGRAMS = pdnsd-ctl
pdnsd_ctl_SOURCES = pdnsd-ctl.c
pdnsd_ctl_LDADD = rr_types.o
pdnsd_ctl_DEPENDENCIES = rr_types.o
# These are Symlinks we want to have in the package
#EXTRA_DIST = rr_types.h
pdnsd-ctl.o rr_types.o: ../rr_types.h
../rr_types.h: ../make_rr_types_h.pl ../rr_types.in
perl ../make_rr_types_h.pl ../rr_types.in > ../rr_types.h
rr_types.o: %.o: ../%.c
$(COMPILE) -DCLIENT_ONLY -c $<

View File

@ -1,470 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
sbin_PROGRAMS = pdnsd-ctl$(EXEEXT)
subdir = src/pdnsd-ctl
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)"
PROGRAMS = $(sbin_PROGRAMS)
am_pdnsd_ctl_OBJECTS = pdnsd-ctl.$(OBJEXT)
pdnsd_ctl_OBJECTS = $(am_pdnsd_ctl_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(pdnsd_ctl_SOURCES)
DIST_SOURCES = $(pdnsd_ctl_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pdnsd_ctl_SOURCES = pdnsd-ctl.c
pdnsd_ctl_LDADD = rr_types.o
pdnsd_ctl_DEPENDENCIES = rr_types.o
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/pdnsd-ctl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/pdnsd-ctl/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
pdnsd-ctl$(EXEEXT): $(pdnsd_ctl_OBJECTS) $(pdnsd_ctl_DEPENDENCIES)
@rm -f pdnsd-ctl$(EXEEXT)
$(LINK) $(pdnsd_ctl_OBJECTS) $(pdnsd_ctl_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdnsd-ctl.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(sbindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-sbinPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-sbinPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-sbinPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-sbinPROGRAMS
# These are Symlinks we want to have in the package
#EXTRA_DIST = rr_types.h
pdnsd-ctl.o rr_types.o: ../rr_types.h
../rr_types.h: ../make_rr_types_h.pl ../rr_types.in
perl ../make_rr_types_h.pl ../rr_types.in > ../rr_types.h
rr_types.o: %.o: ../%.c
$(COMPILE) -DCLIENT_ONLY -c $<
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,799 +0,0 @@
/* pdnsd-ctl.c - Control pdnsd through a pipe
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <ctype.h>
#include <stddef.h> /* for offsetof */
#include "../helpers.h"
#include "../status.h"
#include "../conff.h"
#include "../list.h"
#include "../dns.h"
#include "../rr_types.h"
#include "../cache.h"
#if !defined(HAVE_ALLOCA) && !defined(alloca)
#define alloca malloc
#endif
#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_PTON)
# define ALLOW_AAAA IS_CACHED_AAAA
#else
# define ALLOW_AAAA 0
#endif
static short int verbose=1;
typedef struct {
char *name;
int val;
} cmd_s;
#define CMD_LIST_RRTYPES (CTL_MAX+1)
#define CMD_HELP (CTL_MAX+2)
#define CMD_VERSION (CTL_MAX+3)
static const cmd_s top_cmds[]={
{"help",CMD_HELP},{"version",CMD_VERSION},{"list-rrtypes",CMD_LIST_RRTYPES},
{"status",CTL_STATS},{"server",CTL_SERVER},{"record",CTL_RECORD},
{"source",CTL_SOURCE},{"add",CTL_ADD},{"neg",CTL_NEG},
{"config",CTL_CONFIG},{"include",CTL_INCLUDE},{"eval",CTL_EVAL},
{"empty-cache",CTL_EMPTY}, {"dump",CTL_DUMP},
{NULL,0}
};
static const cmd_s server_cmds[]= {{"up",CTL_S_UP},{"down",CTL_S_DOWN},{"retest",CTL_S_RETEST},{NULL,0}};
static const cmd_s record_cmds[]= {{"delete",CTL_R_DELETE},{"invalidate",CTL_R_INVAL},{NULL,0}};
static const cmd_s onoff_cmds[]= {{"off",0},{"on",1},{NULL,0}};
static const cmd_s rectype_cmds[]= {{"a",T_A},
#if ALLOW_AAAA
{"aaaa",T_AAAA},
#endif
{"ptr",T_PTR},{"cname",T_CNAME},{"mx",T_MX},{"ns",T_NS},{NULL,0}};
static const char version_message[] =
"pdnsd-ctl, version pdnsd-" VERSION "\n\n";
static const char license_statement[] =
"Copyright (C) 2000, 2001 Thomas Moestl\n"
"Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Paul A. Rombouts\n\n"
"This program is part of the pdnsd package.\n\n"
"pdnsd is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 3 of the License, or\n"
"(at your option) any later version.\n\n"
"pdnsd is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n"
"You should have received a copy of the GNU General Public License\n"
"along with pdsnd; see the file COPYING. If not, see\n"
"<http://www.gnu.org/licenses/>.\n";
static const char *const help_messages[] =
{
"Usage: pdnsd-ctl [-c cachedir] [-q] <command> [arguments]\n\n"
"Command-line options:\n"
"-c\tcachedir\n\tSet the cache directory to cachedir (must match pdnsd setting).\n"
"\tThe default is '" CACHEDIR "'.\n"
"-q\n\tBe quiet unless output is specified by command or something goes wrong.\n\n"
"Commands and needed arguments are:\n"
"help\t[no arguments]\n\tPrint this help.\n"
"version\t[no arguments]\n\tPrint version and license info.\n",
"status\t[no arguments]\n\tPrint pdnsd's status.\n",
"server\t(index|label)\t(up|down|retest)\t[dns1[,dns2[,...]]]\n"
"\tSet the status of the server with the given index to up or down, or\n"
"\tforce a retest. The index is assigned in the order of definition in\n"
"\tpdnsd.conf starting with 0. Use the status command to see the indexes.\n"
"\tYou can specify the label of a server (that matches the label option)\n"
"\tinstead of an index to make this easier.\n"
"\tYou can specify all instead of an index to perform the action for all\n"
"\tservers registered with pdnsd.\n"
"\tAn optional third argument can be given consisting of a list of IP\n"
"\taddresses separated by commas or spaces. This list will replace the\n"
"\taddresses of name servers used by pdnsd for the given server section.\n"
"\tThis feature is useful for run-time configuration of pdnsd with dynamic\n"
"\tDNS data in scripts called by ppp or DHCP clients. The last argument\n"
"\tmay also be an empty string, which causes existing IP addresses to be\n"
"\tremoved and the corresponding server section to become inactive.\n",
"record\tname\t(delete|invalidate)\n"
"\tDelete or invalidate the record of the given domain if it is in the\n"
"\tcache.\n",
"source\tfn\towner\t[ttl]\t[(on|off)]\t[noauth]\n"
"\tLoad a hosts-style file. Works like using the pdnsd source\n"
"\tconfiguration section.\n"
"\tOwner and ttl are used as in the source section. ttl has a default\n"
"\tof 900 (it does not need to be specified). The next to last argument\n"
"\tcorresponds to the serve_aliases option, and is off by default.\n"
"\tnoauth is used to make the domains non-authoritative (please\n"
"\tconsult the pdnsd manual for what that means).\n"
"\tfn is the name of the file, which must be readable by pdnsd.\n",
"add\ta\taddr\tname\t[ttl]\t[noauth]\n"
#if ALLOW_AAAA
"add\taaaa\taddr\tname\t[ttl]\t[noauth]\n"
#endif
"add\tptr\thost\tname\t[ttl]\t[noauth]\n"
"add\tcname\thost\tname\t[ttl]\t[noauth]\n"
"add\tmx\thost\tname\tpref\t[ttl]\t[noauth]\n"
"add\tns\thost\tname\t[ttl]\t[noauth]\n"
"\tAdd a record of the given type to the pdnsd cache, replacing existing\n"
"\trecords for the same name and type. The 2nd argument corresponds\n"
"\tto the value of the option in the rr section that is named like\n"
"\tthe first argument. The addr argument may be a list of IP addresses,\n"
"\tseparated by commas or white space. The ttl is optional, the default is\n"
"\t900 seconds. noauth is used to make the domains non-authoritative.\n"
"\tIf you want no other record than the newly added in the cache, do\n"
"\tpdnsdctl record <name> delete\n"
"\tbefore adding records.\n",
"neg\tname\t[type]\t[ttl]\n"
"\tAdd a negatively cached record to pdnsd's cache, replacing existing\n"
"\trecords for the same name and type. If no type is given, the whole\n"
"\tdomain is cached negatively. For negatively cached records, errors are\n"
"\timmediately returned on a query, without querying other servers first.\n"
"\tThe ttl is optional, the default is 900 seconds.\n",
"config\t[filename]\n"
"\tReload pdnsd's configuration file.\n"
"\tThe config file must be owned by the uid that pdnsd had when it was\n"
"\tstarted, and be readable by pdnsd's run_as uid. If no file name is\n"
"\tspecified, the config file used at start up is reloaded.\n",
"include\tfilename\n"
"\tParse the given file as an include file, which may contain the same\n"
"\ttype of sections as a config file, expect for global and server\n"
"\tsections, which are not allowed. This command can be used to add data\n"
"\tto the cache without reconfiguring pdnsd.\n",
"eval\tstring\n"
"\tParse string as if it were part of pdnsd's configuration file.\n"
"\tThe string should hold one or more complete configuration sections,\n"
"\tbut no global and server sections, which are not allowed.\n"
"\tIf multiple strings are given, they will be joined using newline chars\n"
"\tand parsed together.\n",
"empty-cache\t[[+|-]name ...]\n"
"\tDelete all entries in the cache matching include/exclude rules.\n"
"\tIf no arguments are provided, the cache is completely emptied,\n"
"\tfreeing all existing entries. This also removes \"local\" records,\n"
"\tas defined by the config file. To restore local records, run\n"
"\t\"pdnsd-ctl config\" or \"pdnsd-ctl include filename\" immediately\n"
"\tafterwards.\n"
"\tIf one or more arguments are provided, these are interpreted as \n"
"\tinclude/exclude names. If an argument starts with a '+' the name is to\n"
"\tbe included. If an argument starts with a '-' it is to be excluded.\n"
"\tIf an argument does not begin with '+' or '-', a '+' is assumed.\n"
"\tIf the domain name of a cache entry ends in one of the names in the\n"
"\tlist, the first match will determine what happens. If the matching name\n"
"\tis to be included, the cache entry is deleted, otherwise it remains.\n"
"\tIf there are no matches, the default action is not to delete.\n",
"dump\t[name]\n"
"\tPrint information stored in the cache about name.\n"
"\tIf name begins with a dot and is not the root domain, information\n"
"\tabout the names in the cache ending in name (including name without\n"
"\tthe leading dot) will be printed. If name is missing, information about\n"
"\tall the names in the cache will be printed.\n",
"list-rrtypes\t[no arguments]\n"
"\tList available rr types for the neg command. Note that those are only\n"
"\tused for the neg command, not for add!\n"
};
#define NUM_HELP_MESSAGES (sizeof(help_messages)/sizeof(char*))
/* Open connection to control socket and send command code.
If successful, open_sock returns a file descriptor for the new socket,
otherwise the program is aborted.
*/
static int open_sock(const char *cache_dir, uint16_t cmd)
{
struct sockaddr_un *sa;
unsigned int sa_len;
int sock;
uint16_t nc;
if ((sock=socket(PF_UNIX,SOCK_STREAM,0))==-1) {
perror("Error: could not open socket");
exit(2);
}
sa_len = (offsetof(struct sockaddr_un, sun_path) + strlitlen("/pdnsd.status") + strlen(cache_dir));
sa=(struct sockaddr_un *)alloca(sa_len+1);
sa->sun_family=AF_UNIX;
stpcpy(stpcpy(sa->sun_path,cache_dir),"/pdnsd.status");
if (connect(sock,(struct sockaddr *)sa,sa_len)==-1) {
fprintf(stderr,"Error: could not open socket %s: %s\n",sa->sun_path,strerror(errno));
close(sock);
exit(2);
}
if(verbose) printf("Opening socket %s\n",sa->sun_path);
/* Send command code */
nc=htons(cmd|CTL_CMDVERNR); /* Add magic number, convert to network byte order. */
if (write(sock,&nc,sizeof(nc))!=sizeof(nc)) {
perror("Error: could not write command code");
close(sock);
exit(2);
}
return sock;
}
static void send_long(int fd,uint32_t cmd)
{
uint32_t nc=htonl(cmd);
if (write(fd,&nc,sizeof(nc))!=sizeof(nc)) {
perror("Error: could not write long");
close(fd);
exit(2);
}
}
static void send_short(int fd,uint16_t cmd)
{
uint16_t nc=htons(cmd);
if (write(fd,&nc,sizeof(nc))!=sizeof(nc)) {
perror("Error: could not write short");
close(fd);
exit(2);
}
}
#define MAXSENDSTRLEN 0xfffe
static void send_string(int fd, const char *s)
{
if(s) {
size_t len=strlen(s);
if(len>MAXSENDSTRLEN) {
fprintf(stderr,"Error: send_string: string length (%lu) exceeds maximum (%u).\n",
(unsigned long)len, MAXSENDSTRLEN);
close(fd);
exit(2);
}
send_short(fd,len);
if (write_all(fd,s,len)!=len) {
perror("Error: could not write string");
close(fd);
exit(2);
}
}
else
send_short(fd, ~0);
}
static uint16_t read_short(int fd)
{
ssize_t err;
uint16_t nc;
if ((err=read(fd,&nc,sizeof(nc)))!=sizeof(nc)) {
fprintf(stderr,"Error: could not read short: %s\n",err<0?strerror(errno):"unexpected EOF");
close(fd);
exit(2);
}
return ntohs(nc);
}
/* copy data from file descriptor fd to file stream out until EOF
or error is encountered.
*/
static ssize_t copymsgtofile(int fd, FILE* out)
{
ssize_t n,ntot=0;
char buf[1024];
while ((n=read(fd,buf,sizeof(buf)))>0)
ntot+=fwrite(buf,1,n,out);
if(n<0)
return n;
return ntot;
}
static int match_cmd(const char *cmd, const cmd_s cmds[])
{
int i;
for(i=0; cmds[i].name; ++i) {
if (strcasecmp(cmd,cmds[i].name)==0)
return cmds[i].val;
}
return -1;
}
int main(int argc, char *argv[])
{
char *cache_dir= CACHEDIR;
int rv=0;
{
int i;
char *arg;
for(i=1; i<argc && (arg=argv[i]) && *arg=='-'; ++i) {
if(!strcmp(arg,"-c")) {
if(++i<argc) {
cache_dir= argv[i];
}
else {
fprintf(stderr,"file name expected after -c option.\n");
goto print_try_pdnsd_ctl_help;
}
}
else if(!strcmp(arg,"-q")) {
verbose=0;
}
else {
fprintf(stderr,"Unknown option: %s\n",arg);
goto print_try_pdnsd_ctl_help;
}
}
argc -= i;
argv += i;
}
if (argc<1) {
fprintf(stderr,"No command specified.\n");
print_try_pdnsd_ctl_help:
fprintf(stderr,"Try 'pdnsd-ctl help' for available commands and options.\n");
exit(2);
} else {
int pf,acnt=0,cmd;
cmd=match_cmd(argv[0],top_cmds);
if(cmd==-1) {
fprintf(stderr,"Command not recognized: %s\n",argv[0]);
goto print_try_pdnsd_ctl_help;
}
switch (cmd) {
case CMD_HELP: {
int i;
fputs(version_message,stdout);
for(i=0; i<NUM_HELP_MESSAGES; ++i)
fputs(help_messages[i],stdout);
}
break;
case CMD_VERSION:
fputs(version_message,stdout);
fputs(license_statement,stdout);
break;
case CMD_LIST_RRTYPES: {
int i;
if (argc!=1)
goto wrong_args;
printf("Available RR types for the neg command:\n");
for (i=0; i<NRRTOT; ++i)
printf("%s\n",rrnames[rrcachiterlist[i]-T_MIN]);
}
break;
case CTL_STATS:
if (argc!=1)
goto wrong_args;
pf=open_sock(cache_dir, cmd);
goto copy_pf;
case CTL_SERVER: {
int server_cmd;
if (argc<3 || argc>4)
goto wrong_args;
acnt=2;
server_cmd=match_cmd(argv[2],server_cmds);
if(server_cmd==-1) goto bad_arg;
pf=open_sock(cache_dir, cmd);
send_string(pf,argv[1]);
send_short(pf,server_cmd);
send_string(pf,argc<4?NULL:argv[3]);
}
goto read_retval;
case CTL_RECORD: {
int record_cmd;
if (argc!=3)
goto wrong_args;
acnt=2;
record_cmd=match_cmd(argv[2],record_cmds);
if(record_cmd==-1) goto bad_arg;
pf=open_sock(cache_dir, cmd);
send_short(pf,record_cmd);
send_string(pf,argv[1]);
}
goto read_retval;
case CTL_SOURCE: {
long ttl;
int servaliases,flags;
if (argc<3 || argc>6)
goto wrong_args;
ttl=900;
flags=DF_LOCAL;
acnt=3;
if (argc==6 || (argc>=4 && isdigit(argv[3][0]))) {
char *endptr;
ttl=strtol(argv[3],&endptr,0);
if (*endptr)
goto bad_arg;
acnt++;
}
servaliases=0;
if (acnt<argc && (argc==6 || strcasecmp(argv[acnt], "noauth"))) {
servaliases=match_cmd(argv[acnt],onoff_cmds);
if(servaliases==-1) goto bad_arg;
acnt++;
}
if (acnt<argc) {
if (!strcasecmp(argv[acnt], "noauth"))
flags=0;
else
goto bad_arg;
}
pf=open_sock(cache_dir, cmd);
send_string(pf,argv[1]);
send_string(pf,argv[2]);
send_long(pf,ttl);
send_short(pf,servaliases);
send_short(pf,flags);
}
goto read_retval;
case CTL_ADD: {
long ttl;
int tp,flags,pref;
unsigned int nadr;
size_t adrsz, adrbufsz;
char *q;
if (argc<2) goto wrong_args;
acnt=1;
tp=match_cmd(argv[1],rectype_cmds);
if(tp==-1) goto bad_arg;
acnt=((tp==T_MX)?5:4);
if (argc<acnt || argc>acnt+2)
goto wrong_args;
ttl=900;
flags=DF_LOCAL;
pref=0;
if(tp==T_MX) {
char *endptr;
pref=strtol(argv[4],&endptr,0);
if (*endptr) {
acnt=4;
goto bad_arg;
}
}
if (acnt<argc && strcasecmp(argv[acnt],"noauth")) {
char *endptr;
ttl=strtol(argv[acnt],&endptr,0);
if (*endptr)
goto bad_arg;
acnt++;
}
if (acnt<argc && !strcasecmp(argv[acnt],"noauth")) {
flags=0;
acnt++;
}
if (acnt<argc)
goto bad_arg;
nadr=0; adrsz=0;
switch (tp) {
case T_A:
adrsz= sizeof(struct in_addr);
#if ALLOW_AAAA
goto count_addresses;
case T_AAAA:
adrsz= sizeof(struct in6_addr);
count_addresses:
#endif
/* first count the number of comma- or space-delimited address strings,
ignoring blank strings. */
for(q=argv[2];;) {
for(;;++q) {
if(!*q) goto finished_counting_addresses;
if(*q!=',' && !isspace(*q)) break;
}
do {
++q;
} while(*q && *q!=',' && !isspace(*q));
++nadr;
}
finished_counting_addresses:
if (!nadr) {
fprintf(stderr,"Empty IP list for 'add %s' command.\n", argv[1]);
exit(2);
}
break;
}
adrbufsz = nadr*adrsz;
{
/* Variable-size array for storing IP addresses. */
unsigned char adrbuf[adrbufsz] __attribute__((aligned));
switch (tp) {
case T_A:
#if ALLOW_AAAA
case T_AAAA:
#endif
{
/* Convert the address strings into binary addresses and
store them in adrbuf. */
unsigned char *adrp = adrbuf;
for(q=argv[2];;) {
char *p; size_t len;
for(;;++q) {
if(!*q) goto finished_converting_addresses;
if(*q!=',' && !isspace(*q)) break;
}
p=q;
do {
++q;
} while(*q && *q!=',' && !isspace(*q));
len = q-p;
{
char tmpbuf[len+1];
memcpy(tmpbuf,p,len);
tmpbuf[len]=0;
if(
#if ALLOW_AAAA
tp==T_AAAA? inet_pton(AF_INET6,tmpbuf,adrp)<=0:
#endif
!inet_aton(tmpbuf,(struct in_addr *)adrp))
{
fprintf(stderr,"Bad IP for 'add %s' command: %s\n",
argv[1],tmpbuf);
exit(2);
}
}
adrp += adrsz;
}
}
finished_converting_addresses:
break;
}
pf=open_sock(cache_dir, cmd);
send_short(pf,tp);
send_string(pf,argv[3]);
send_long(pf,ttl);
send_short(pf,flags);
switch (tp) {
case T_A:
#if ALLOW_AAAA
case T_AAAA:
#endif
send_short(pf,nadr);
if(write_all(pf,adrbuf,adrbufsz)!=adrbufsz) {
perror("Error: could not send IP address(es)");
close(pf);
exit(2);
}
break;
case T_MX:
send_short(pf,pref);
/* fall through */
case T_PTR:
case T_CNAME:
case T_NS:
send_string(pf,argv[2]);
break;
}
}
}
goto read_retval;
case CTL_NEG: {
long ttl;
int tp;
if (argc<2 || argc>4)
goto wrong_args;
tp=255;
ttl=900;
acnt=2;
if (argc==3) {
if (isdigit(argv[2][0])) {
char *endptr;
ttl=strtol(argv[2],&endptr,0);
if (*endptr)
goto bad_arg;
} else if ((tp=rr_tp_byname(argv[2]))==-1) {
goto bad_type;
}
} else if (argc==4) {
char *endptr;
if ((tp=rr_tp_byname(argv[2]))==-1)
goto bad_type;
ttl=strtol(argv[3],&endptr,0);
if (*endptr) {
acnt=3;
goto bad_arg;
}
}
pf=open_sock(cache_dir, cmd);
send_string(pf,argv[1]);
send_short(pf,tp);
send_long(pf,ttl);
}
goto read_retval;
case CTL_CONFIG:
if (argc>2)
goto wrong_args;
pf=open_sock(cache_dir, cmd);
send_string(pf,argc<2?NULL:argv[1]);
goto read_retval;
case CTL_INCLUDE:
if (argc!=2)
goto wrong_args;
pf=open_sock(cache_dir, cmd);
send_string(pf,argv[1]);
goto read_retval;
case CTL_EVAL: {
int i; size_t bufsz;
if (argc<2)
goto wrong_args;
bufsz=0;
for(i=1; i<argc; ++i)
bufsz += strlen(argv[i])+1;
if(bufsz>MAXSENDSTRLEN) {
fprintf(stderr,"Cannot send 'eval' command: "
"string length (%lu) exceeds maximum (%u).\n",
(unsigned long)bufsz, MAXSENDSTRLEN);
exit(2);
}
pf=open_sock(cache_dir, cmd);
send_short(pf,bufsz);
{
/* Variable-size array for storing the joined strings. */
char buf[bufsz];
char *p=buf;
for(i=1; i<argc; ++i) {
p=stpcpy(p,argv[i]);
*p++ = '\n';
}
if(write_all(pf,buf,bufsz)!=bufsz) {
perror("Error: could not write string");
close(pf);
exit(2);
}
}
}
goto read_retval;
case CTL_EMPTY: {
int i; size_t totsz=0;
for(i=1; i<argc; ++i)
totsz += strlen(argv[i])+1;
if(totsz>MAXSENDSTRLEN) {
fprintf(stderr,"Cannot send 'empty' command: "
"string length (%lu) exceeds maximum (%u).\n",
(unsigned long)totsz, MAXSENDSTRLEN);
exit(2);
}
pf=open_sock(cache_dir, cmd);
if(argc>1) {
send_short(pf,totsz);
for(i=1; i<argc; ++i) {
size_t sz=strlen(argv[i])+1;
if(write_all(pf,argv[i],sz)!=sz) {
perror("Error: could not write string");
close(pf);
exit(2);
}
}
}
else
send_short(pf,~0);
}
goto read_retval;
case CTL_DUMP:
if (argc>2)
goto wrong_args;
pf=open_sock(cache_dir, cmd);
send_string(pf,argc<2?NULL:argv[1]);
copy_pf:
if((rv=read_short(pf)))
goto retval_failed;
if(copymsgtofile(pf,stdout)<0) {
perror("Error while reading from socket");
close(pf);
exit(2);
}
goto close_pf;
read_retval:
if((rv=read_short(pf))) {
retval_failed:
fprintf(stderr,"Failed: ");
if(copymsgtofile(pf,stderr)<0)
fprintf(stderr,"(could not read error message from socket: %s)",strerror(errno));
fputc('\n',stderr);
}
close_pf:
if(close(pf)==-1)
perror("Couldn't close socket");
else if (rv==0 && verbose)
printf("Succeeded\n");
break;
wrong_args:
fprintf(stderr,"Wrong number of arguments for '%s' command.\n",argv[0]);
goto print_cmd_usage;
bad_arg:
fprintf(stderr,"Bad argument for '%s' command: %s\n",argv[0],argv[acnt]);
print_cmd_usage:
fprintf(stderr,"Usage:\n\n%s\n"
"Try 'pdnsd-ctl help' for a description of all available commands and options.\n",
help_messages[cmd]);
exit(2);
bad_type:
fprintf(stderr,"Bad (type) argument for '%s' command: %s\n"
"Run 'pdnsd-ctl list-rrtypes' for a list of available rr types.\n",
argv[0],argv[acnt]);
exit(2);
}
}
return rv;
}

Some files were not shown because too many files have changed in this diff Show More