Compare commits

..
Author SHA1 Message Date
Wilko Bulte 8127c559e6 We ran out of floppy space again. Remove atapifd and TurboLaser
support from the bootfloppy.

Approved by: re
2003-04-03 18:49:22 +00:00
Murray Stokely 9d13ea80f2 Remove dokern.sh from the boot floppies once again. There is no
associated module so the removal goes here, rather than in
drivers.conf(5).

Submitted by:	bmah
Approved by:	re@ cabal
2003-04-03 04:38:14 +00:00
Murray Stokely a2cf25cf34 4.8 should look for packages in the packages-4.8-release directory.
Approved by:	re
2003-03-30 20:45:02 +00:00
Murray Stokely ddae6d9c68 Add entry for FreeBSD 4.8. 2003-03-30 20:39:52 +00:00
Murray Stokely 326e9c2d28 Bump __FreeBSD_version for 4.8. 2003-03-30 20:36:05 +00:00
Murray Stokely 3d1163642e Identify as 4.8-RELEASE.
Approved by:	re
2003-03-30 19:55:36 +00:00
Bruce A. Mah dc7b372759 MFS: Synchronize RELENG_4_8 de_DE release documentation with
RELENG_4 de_DE release documentation.

	errata/article.sgml			1.1.2.11->1.1.2.12
	hardware/alpha/proc.sgml		1.1.2.10->1.1.2.11
	hardware/common/dev.sgml		1.1.2.10->1.1.2.12
	installation/common/install.sgml	1.1.2.5->1.1.2.6
	relnotes/common/new.sgml		1.1.2.19->1.1.2.21

Approved by:	re, alex
2003-03-30 05:41:30 +00:00
Gregory Neil Shapiro bd0ff46f65 sendmail parsing buffer overflow fix
Approved by:	re (bmah)
2003-03-29 20:04:46 +00:00
Bruce A. Mah 4c9a76b0e8 Use 4.8-RELEASE manpages for manpage hyperlinks.
Approved by:	re (murray)
2003-03-28 23:19:50 +00:00
Scott Long 4865310155 Revert the removal of AAC_COMPAT_LINUX. Keeping it in doesn't hurt anything
and preserves canned configurations that people might have.

Requested by:   alfred
Approved by:    re (murray)
2003-03-28 21:26:40 +00:00
Sam Leffler 8a6b6a9b23 MFS: add missing copyright notices
Noticed by:
Approved by:	re (murray)
2003-03-28 20:34:18 +00:00
Scott Long 69fa854580 Move aac back onto the MFSROOT floppy and but amr and mly back into the kernel
so that CAM will probe them correctly.

Approved by: re (murray)
2003-03-28 20:19:59 +00:00
Scott Long 49700cc896 Late MFC: Remove AAC_COMPAT_LINUX and replace it with a separate aac_linux
module.

Approved by: re(murray)
2003-03-28 20:05:39 +00:00
Matthew N. Dodd 2bebbc513d - Back out COMPAT_ISA_DRIVER(). 2003-03-27 21:02:31 +00:00
Matthew N. Dodd 1b8a115dcd - Add missing COMPAT_ISA_DRIVER.
- Set ifq_maxlen.

Reviewed by:	 re (murray)
2003-03-27 20:48:22 +00:00
Murray Stokely ee553c69b6 MFC: Offer GNOME2 instead of GNOME 1 from the desktop configuration
menu.

Approved by:	re, portmgr, gnome
2003-03-27 18:15:23 +00:00
Murray Stokely 34ae96a42c MFC: Offer GNOME2 as a desktop environment rather than gnome 1, which
is rapidly approaching obsolescence.

Approved by:	re, portmgr, gnome
2003-03-27 18:13:04 +00:00
John Baldwin f50623b064 MFS: Add a commented out HTT kernel option for 4.8.
Approved by:	re (murray)
2003-03-25 23:35:15 +00:00
Scott Long d8abef3b68 aic79xx.reg:
Correct default precompensation value for RevA hardware.

Approved by:    re (murray)
2003-03-25 22:17:19 +00:00
Matthew N. Dodd a3feb3e8f5 Mark ISA network drivers with destructive probes disabled; they can
be enabled by the user should they be needed.

Approved by:	 re (murray)
2003-03-25 19:45:14 +00:00
Hidetoshi Shimokawa 1e31f52b04 Safe PCI configuration.
- Clear PCIM_CMD_MWRICEN:
	some chips seem to have problem with write invalidate.
	clearing this bit fixes SBP timeout problem.
Tested by: Michael Reifenberger <[email protected]>

- Moderate value for latency timer.

Approved by: re (jhb)
2003-03-25 10:48:38 +00:00
Murray Stokely 84b62d8b0b MFS: r1.5.2.2 - permit use of sched_getscheduler and sched_getparam by
non-root users in some instances.

Approved by:  re
2003-03-25 10:43:06 +00:00
Murray Stokely c5f3dba8c1 "make update" on a release branch should update to that release branch
(RELENG_4_8 here).

Approved by:	re
2003-03-25 10:36:18 +00:00
Murray Stokely 48cbd78c0b Update BASE on release branch. 2003-03-25 10:28:41 +00:00
Murray Stokely 2663e1856b This file tracks RELENG_4_8 rather than RELENG_4 by default. 2003-03-25 10:22:38 +00:00
Murray Stokely 5474495c2c This is FreeBSD 4.8. 2003-03-25 10:18:00 +00:00
Sam Leffler 0f2dc80030 Synchronize access to the zones from which crypto requests are allocated.
This corrects problems encountered when FAST_IPSEC is used together
/dev/crypto.

Approved by:	re (murray, jb)
2003-03-25 03:44:30 +00:00
Bruce A. Mah e0791d30a6 Release documentation version number bumps for the upcoming 4.8-RELEASE.
Approved by:	re (implicitly)
2003-03-24 17:42:11 +00:00
Martin Blapp 774b865493 MFC rev. 1.25
We don't have cat(1) and kill(1) on the miniroot disks.

This fix will be committed to the ISC repo later, but for now
take this file out of the vendor tree.

Reviewed by:	phk
Approved by:	re (murray)
2003-03-23 23:33:59 +00:00
cvs2svn 153b9cb02b This commit was manufactured by cvs2svn to create branch 'RELENG_4_8'. 2003-03-22 23:03:23 +00:00
cvs2svn 79e48d0205 This commit was manufactured by cvs2svn to create branch 'RELENG_4_8'. 2003-03-02 16:42:41 +00:00
4241 changed files with 141988 additions and 569713 deletions

No files matched your search

-26
View File
@@ -1,32 +1,6 @@
# $FreeBSD$
# @(#)COPYRIGHT 8.2 (Berkeley) 3/21/94
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (C) 1992-2007 The FreeBSD Project. 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.
THIS SOFTWARE IS PROVIDED BY AUTHOR 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 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.
All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
Releases is copyrighted by The Regents of the University of California.
-1
View File
@@ -107,7 +107,6 @@ BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
.ORDER: buildworld installworld
.ORDER: buildworld distributeworld
.ORDER: buildworld buildkernel
.ORDER: buildkernel installkernel
.ORDER: buildkernel reinstallkernel
+18 -41
View File
@@ -9,6 +9,7 @@
# -DNOCRYPT will prevent building of crypt versions
# -DNOMAN do not build the manual pages
# -DNOPROFILE do not build profiled libraries
# -DNOSECURE do not go into secure subdir
# -DNOGAMES do not go into games subdir
# -DNOSHARE do not go into share subdir
# -DNOINFO do not make or install info files
@@ -76,7 +77,7 @@ SUBDIR+= libexec
.if exists(${.CURDIR}/sbin)
SUBDIR+= sbin
.endif
.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
SUBDIR+= secure
.endif
.if exists(${.CURDIR}/share) && !defined(NOSHARE)
@@ -177,14 +178,11 @@ CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
MACHINE_ARCH=${TARGET_ARCH} \
MACHINE=${TARGET} \
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
.if !defined(NOPERL)
CROSSENV+= PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503
.endif
# bootstrap-tool stage
BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
DESTDIR= \
@@ -341,25 +339,17 @@ buildworld: ${WMAKE_TGTS}
#
# Checks to be sure system is ready for installworld
#
CHECK_UIDS=
CHECK_GIDS=
.if !defined(NO_SENDMAIL)
CHECK_UIDS+= smmsp
CHECK_GIDS+= smmsp
.endif
installcheck:
.for uid in ${CHECK_UIDS}
@if ! `id -u ${uid} >/dev/null 2>&1`; then \
echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
.if !defined(NO_SENDMAIL)
@if ! `grep -q '^smmsp:' /etc/passwd`; then \
echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
false; \
fi
.endfor
.for gid in ${CHECK_GIDS}
@if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
@if ! `grep -q '^smmsp:' /etc/group`; then \
echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
false; \
fi
.endfor
.endif
#
# distributeworld
@@ -374,7 +364,7 @@ distributeworld installworld: installcheck
mkdir -p ${INSTALLTMP}
for prog in [ awk cap_mkdb cat chflags chmod chown \
date echo egrep find grep \
ln make makewhatis mkdir mtree mv pwd_mkdb rm sed sh sysctl \
ln make makewhatis mtree mv perl pwd_mkdb rm sed sh sysctl \
test true uname wc zic; do \
cp `which $$prog` ${INSTALLTMP}; \
done
@@ -507,21 +497,8 @@ buildkernel:
# Install the kernel defined by INSTALLKERNEL
#
installkernel reinstallkernel:
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Making hierarchy"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; \
${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
.endif
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Installing kernel"
@echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
${CROSSENV} PATH=${TMPPATH} \
${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
#
# update
@@ -554,7 +531,7 @@ update:
@echo "--------------------------------------------------------------"
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; cvs -R -q update -rRELENG_4 -P -d
cd ${.CURDIR}; cvs -q update -rRELENG_4_8 -P -d
.endif
#
@@ -604,7 +581,7 @@ _strfile= games/fortune/strfile
bootstrap-tools:
.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
usr.bin/makewhatis usr.bin/uudecode usr.bin/xinstall \
usr.bin/uudecode usr.bin/xinstall \
usr.sbin/config \
gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
${ECHODIR} "===> ${_tool}"; \
@@ -635,12 +612,12 @@ _perl= gnu/usr.bin/perl/miniperl
.endif
.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
!defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
!defined(NOCRYPT) && defined(MAKE_KERBEROS4)
_libroken4= kerberosIV/lib/libroken
.endif
.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
!defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
!defined(NOCRYPT) && defined(MAKE_KERBEROS5)
_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
.endif
@@ -721,7 +698,7 @@ _generic_libs= gnu/lib
_generic_libs+= gnu/usr.bin/perl/libperl
.endif
.if !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
_prebuild_libs+= kerberos5/lib/libasn1
_prebuild_libs+= kerberos5/lib/libgssapi
_prebuild_libs+= kerberos5/lib/libkrb5
@@ -729,7 +706,7 @@ _prebuild_libs+= kerberos5/lib/libroken
_generic_libs+= kerberos5/lib
.endif
.if !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
_prebuild_libs+= kerberosIV/lib/libkrb
kerberosIV/lib/libkrb__L: lib/libcrypt__L
_generic_libs+= kerberosIV/lib
@@ -745,7 +722,7 @@ lib/libskey__L: lib/libcrypt__L lib/libmd__L
_generic_libs+= lib
.if !defined(NOCRYPT)
.if !defined(NOCRYPT) && !defined(NOSECURE)
.if !defined(NO_OPENSSL)
_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
.if !defined(NO_OPENSSH)
+2 -61
View File
@@ -8,67 +8,8 @@ A reverse chronology since 4.0 was released is included, followed by
the common items quick how-tos, followed by entries for versions of
-current prior to 4.0 Release.
20070426:
The ABI breakage in sendmail(8)'s libmilter has been repaired
so it is no longer necessary to recompile mail filters (aka,
milters). If you recompiled mail filters after the 20070411
note, it is not necessary to recompile them again.
20070411:
sendmail(8) has been updated to version 8.14.1. Mail filters
(aka, milters) compiled against the libmilter included in the
base operating system should be recompiled.
20050513:
Intel Hyper-Threading is now disabled by default due to a
security issue, but can be re-enabled by setting the
machdep.hyperthreading_allowed tunable in /boot/loader.conf.
20050124:
FreeBSD 4.11-RELEASE.
20040527:
FreeBSD 4.10-RELEASE.
20031028:
FreeBSD 4.9-RELEASE.
20031022:
Support for HyperThread logical CPUs has now been enabled by
default. As a result, the HTT kernel option no longer exists.
Instead, the logical CPUs are always started so that they can
handle interrupts. However, the extra logical CPUs are prevented
from executing user processes by default. To enable the logical
CPUs, change the value of the machdep.hlt_logical_cpus from 1 to
0. This value can also be set from the loader as a tunable of
the same name.
20030923:
Fix a bug in arplookup(), whereby a hostile party on a locally
attached network could exhaust kernel memory, and cause a system
panic, by sending a flood of spoofed ARP requests. See
FreeBSD-SA-03:14.arp.
20030904:
If you get errors regarding sendmail.cf files while trying
to run mergemaster, you should either install the new version,
or run /usr/src/usr.sbin/mergemaster/mergemaster.sh. This is
a one-time issue to fix a Makefile compatibility problem.
20030904:
Between August 9th and August 30th, a bug existed in the i386
virtual memory system which could cause panics under load.
Anyone running a kernel built between those dates is advised
to update at the earliest possible convenience.
20030806:
All current USB quirks in da(4) have been deprecated and will be
removed for 4.9. If this causes failure for your umass(4) devices,
enable "options DA_OLD_QUIRKS" in your kernel and send the output of
"camcontrol inquiry da0" to [email protected] so the quirk can be
re-enabled.
20030403:
20030331:
FreeBSD 4.8-RELEASE.
20030214:
@@ -870,7 +811,7 @@ versions of -stable/-current.
Changes to the pccardd kernel interface require that you recompile
pccardd for new kernel.
19990725:
19980725:
The ipfw interface to the kernel has changed. You will need to
recompile ipfw programs for the new kernel.
+2 -3
View File
@@ -47,10 +47,9 @@
.Ar arg2
.Op Ar arg3 Op ...
.Sh DESCRIPTION
The
.Nm
utility is used to control the operation of medium changers, such as those
found in tape and optical disk jukeboxes.
is used to control the operation of medium changers, such as those found
in tape and optical disk jukeboxes.
.Pp
The options are as follows:
.Bl -tag -width indent
+21 -4
View File
@@ -68,13 +68,16 @@ main(argc, argv)
FTS *ftsp;
FTSENT *p;
mode_t *set;
long val;
int oct, omode;
int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval;
int vflag;
char *mode;
char *ep, *mode;
int newmode;
int (*change_mode) __P((const char *, mode_t));
set = NULL;
omode = 0;
Hflag = Lflag = Pflag = Rflag = fflag = hflag = vflag = 0;
while ((ch = getopt(argc, argv, "HLPRXfghorstuvwx")) != -1)
switch (ch) {
@@ -152,8 +155,22 @@ done: argv += optind;
change_mode = chmod;
mode = *argv;
if ((set = setmode(mode)) == NULL)
errx(1, "invalid file mode: %s", mode);
if (*mode >= '0' && *mode <= '7') {
errno = 0;
val = strtol(mode, &ep, 8);
if (val > INT_MAX || val < 0)
errno = ERANGE;
if (errno)
err(1, "invalid file mode: %s", mode);
if (*ep)
errx(1, "invalid file mode: %s", mode);
omode = val;
oct = 1;
} else {
if ((set = setmode(mode)) == NULL)
errx(1, "invalid file mode: %s", mode);
oct = 0;
}
if ((ftsp = fts_open(++argv, fts_options, 0)) == NULL)
err(1, NULL);
@@ -186,7 +203,7 @@ done: argv += optind;
default:
break;
}
newmode = getmode(set, p->fts_statp->st_mode);
newmode = oct ? omode : getmode(set, p->fts_statp->st_mode);
if ((newmode & ALLPERMS) == (p->fts_statp->st_mode & ALLPERMS))
continue;
if ((*change_mode)(p->fts_accpath, newmode) && !fflag) {
+1 -1
View File
@@ -351,7 +351,7 @@ copy(argv, type, fts_options)
* normally want to preserve them on directories.
*/
if (pflag) {
if (setfile(curr->fts_statp, -1))
if (setfile(curr->fts_statp, 0))
rval = 1;
} else {
mode = curr->fts_statp->st_mode;
+14 -22
View File
@@ -132,8 +132,7 @@ copy_file(entp, dne)
* wins some CPU back.
*/
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
if (S_ISREG(fs->st_mode) && fs->st_size > 0 &&
fs->st_size <= 8 * 1048576) {
if (S_ISREG(fs->st_mode) && fs->st_size <= 8 * 1048576) {
if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) {
warn("%s", entp->fts_path);
@@ -215,7 +214,7 @@ copy_link(p, exists)
warn("symlink: %s", link);
return (1);
}
return (pflag ? setfile(p->fts_statp, -1) : 0);
return (0);
}
int
@@ -231,7 +230,7 @@ copy_fifo(from_stat, exists)
warn("mkfifo: %s", to.p_path);
return (1);
}
return (pflag ? setfile(from_stat, -1) : 0);
return (pflag ? setfile(from_stat, 0) : 0);
}
int
@@ -247,7 +246,7 @@ copy_special(from_stat, exists)
warn("mknod: %s", to.p_path);
return (1);
}
return (pflag ? setfile(from_stat, -1) : 0);
return (pflag ? setfile(from_stat, 0) : 0);
}
#define RETAINBITS \
@@ -260,22 +259,20 @@ setfile(fs, fd)
{
static struct timeval tv[2];
struct stat ts;
int rval, gotstat, islink, fdval;
int rval;
int gotstat;
rval = 0;
fdval = fd != -1;
islink = !fdval && S_ISLNK(fs->st_mode);
fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX |
S_IRWXU | S_IRWXG | S_IRWXO;
TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
if (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv)) {
warn("%sutimes: %s", islink ? "l" : "", to.p_path);
if (utimes(to.p_path, tv)) {
warn("utimes: %s", to.p_path);
rval = 1;
}
if (fdval ? fstat(fd, &ts) :
(islink ? lstat(to.p_path, &ts) : stat(to.p_path, &ts)))
if (fd ? fstat(fd, &ts) : stat(to.p_path, &ts))
gotstat = 0;
else {
gotstat = 1;
@@ -289,9 +286,8 @@ setfile(fs, fd)
* chown. If chown fails, lose setuid/setgid bits.
*/
if (!gotstat || fs->st_uid != ts.st_uid || fs->st_gid != ts.st_gid)
if (fdval ? fchown(fd, fs->st_uid, fs->st_gid) :
(islink ? lchown(to.p_path, fs->st_uid, fs->st_gid) :
chown(to.p_path, fs->st_uid, fs->st_gid))) {
if (fd ? fchown(fd, fs->st_uid, fs->st_gid) :
chown(to.p_path, fs->st_uid, fs->st_gid)) {
if (errno != EPERM) {
warn("chown: %s", to.p_path);
rval = 1;
@@ -300,18 +296,14 @@ setfile(fs, fd)
}
if (!gotstat || fs->st_mode != ts.st_mode)
if (fdval ? fchmod(fd, fs->st_mode) :
(islink ? lchmod(to.p_path, fs->st_mode) :
chmod(to.p_path, fs->st_mode))) {
if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
warn("chmod: %s", to.p_path);
rval = 1;
}
if (!gotstat || fs->st_flags != ts.st_flags)
if (fdval ?
fchflags(fd, fs->st_flags) :
(islink ? (errno = ENOSYS) :
chflags(to.p_path, fs->st_flags))) {
if (fd ?
fchflags(fd, fs->st_flags) : chflags(to.p_path, fs->st_flags)) {
warn("chflags: %s", to.p_path);
rval = 1;
}
-2
View File
@@ -130,8 +130,6 @@
/* we want to use the system malloc when we install as /bin/csh */
#define SYSMALLOC
#define BSD_STYLE_COLORLS
/* Use LC_MESSAGES locale category to open the message catalog */
#define MCLoadBySet NL_CAT_LOCALE
#endif
#if defined(__bsdi__)
+1 -23
View File
@@ -35,7 +35,7 @@
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
.Dd August 9, 2004
.Dd November 17, 1993
.Dt DATE 1
.Os
.Sh NAME
@@ -219,22 +219,6 @@ When the date is adjusted to a specific value that occurs twice
the resulting timezone will be set so that the date matches the earlier of
the two times.
.Pp
Adjusting the date by months is inherently ambiguous because
a month is a unit of variable length depending on the current date.
This kind of date adjustment is applied in the most intuitive way.
First of all,
.Nm
tries to preserve the day of the month.
If it is impossible because the target month is shorter than the present one,
the last day of the target month will be the result.
For example, using
.Fl v No +1m
on May 31 will adjust the date to June 30, while using the same option
on January 30 will result in the date adjusted to the last day of February.
This approach is also believed to make the most sense for shell scripting.
Nevertheless, be aware that going forth and back by the same number of
months may take you to a different date.
.Pp
Refer to the examples below for further details.
.El
.Pp
@@ -311,12 +295,6 @@ will display the last day of February in the year 2000:
.Pp
.Dl "Tue Feb 29 03:18:00 GMT 2000"
.Pp
So will do the command:
.Pp
.Dl "date -v30d -v3m -v0y -v-1m"
.Pp
because there is no such date as the 30th of February.
.Pp
The command:
.Pp
.Dl "date -v1d -v+1m -v-1d -v-fri"
-7
View File
@@ -150,8 +150,6 @@ adjyear(struct tm *t, char type, int val, int mk)
static int
adjmon(struct tm *t, char type, int val, int istext, int mk)
{
int lmdays;
if (val < 0)
return 0;
@@ -199,11 +197,6 @@ adjmon(struct tm *t, char type, int val, int istext, int mk)
t->tm_mon = --val;
}
/* e.g., -v-1m on March, 31 is the last day of February in common sense */
lmdays = daysinmonth(t);
if (t->tm_mday > lmdays)
t->tm_mday = lmdays;
return !mk || domktime(t, type) != -1;
}
+3 -3
View File
@@ -41,7 +41,7 @@
.Sh SYNOPSIS
.Nm
.Oo
.Fl b | g | h | H | k |
.Fl b | h | H | k |
.Fl m | P
.Oc
.Op Fl ailn
@@ -81,11 +81,11 @@ specification from the environment.
.It Fl H
"Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte and Petabyte in order to reduce the number of
digits to four or fewer using base 10 for sizes.
digits to three or less using base 10 for sizes.
.It Fl h
"Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte and Petabyte in order to reduce the number of
digits to four or fewer using base 2 for sizes.
digits to three or less using base 2 for sizes.
.It Fl i
Include statistics on the number of free inodes.
.It Fl k
+16 -23
View File
@@ -112,7 +112,7 @@ unit_t unitp [] = { NONE, KILO, MEGA, GIGA, TERA, PETA };
int bread(off_t, void *, int);
int checkvfsname(const char *, char **);
char *getmntpt(char *);
int int64width(int64_t);
int longwidth(long);
char *makenetvfslist(void);
char **makevfslist(char *);
void prthuman(struct statfs *, long);
@@ -376,15 +376,9 @@ prthumanval(double bytes)
* Convert statfs returned filesystem size into BLOCKSIZE units.
* Attempts to avoid overflow for large filesystems.
*/
static int64_t
fsbtoblk(int64_t num, uint64_t fsbs, u_long bs)
{
if (fsbs != 0 && fsbs < bs)
return (num / (int64_t)(bs / fsbs));
else
return (num * (int64_t)(fsbs / bs));
}
#define fsbtoblk(num, fsbs, bs) \
(((fsbs) != 0 && (fsbs) < (bs)) ? \
(num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs)))
/*
* Print out status about a filesystem.
@@ -426,12 +420,11 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
if (hflag) {
prthuman(sfsp, used);
} else {
(void)printf(" %*lld %*lld %*lld", mwp->total,
(long long)fsbtoblk(sfsp->f_blocks, sfsp->f_bsize,
blocksize), mwp->used,
(long long)fsbtoblk(used, sfsp->f_bsize, blocksize),
mwp->avail, (long long)fsbtoblk(sfsp->f_bavail,
sfsp->f_bsize, blocksize));
(void)printf(" %*ld %*ld %*ld", mwp->total,
fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
mwp->avail, fsbtoblk(sfsp->f_bavail, sfsp->f_bsize,
blocksize));
}
(void)printf(" %5.0f%%",
availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
@@ -460,20 +453,20 @@ update_maxwidths(struct maxwidths *mwp, struct statfs *sfsp)
getbsize(&dummy, &blocksize);
mwp->mntfrom = imax(mwp->mntfrom, strlen(sfsp->f_mntfromname));
mwp->total = imax(mwp->total, int64width(fsbtoblk(sfsp->f_blocks,
mwp->total = imax(mwp->total, longwidth(fsbtoblk(sfsp->f_blocks,
sfsp->f_bsize, blocksize)));
mwp->used = imax(mwp->used, int64width(fsbtoblk(sfsp->f_blocks -
mwp->used = imax(mwp->used, longwidth(fsbtoblk(sfsp->f_blocks -
sfsp->f_bfree, sfsp->f_bsize, blocksize)));
mwp->avail = imax(mwp->avail, int64width(fsbtoblk(sfsp->f_bavail,
mwp->avail = imax(mwp->avail, longwidth(fsbtoblk(sfsp->f_bavail,
sfsp->f_bsize, blocksize)));
mwp->iused = imax(mwp->iused, int64width(sfsp->f_files -
mwp->iused = imax(mwp->iused, longwidth(sfsp->f_files -
sfsp->f_ffree));
mwp->ifree = imax(mwp->ifree, int64width(sfsp->f_ffree));
mwp->ifree = imax(mwp->ifree, longwidth(sfsp->f_ffree));
}
/* Return the width in characters of the specified long. */
int
int64width(int64_t val)
longwidth(long val)
{
int len;
@@ -567,7 +560,7 @@ usage(void)
{
(void)fprintf(stderr,
"usage: df [-b | -g | -H | -h | -k | -m | -P] [-ailn] [-t type] [file | filesystem ...]\n");
"usage: df [-b | -H | -h | -k | -m | -P] [-ailn] [-t type] [file | filesystem ...]\n");
exit(EX_USAGE);
}
+6 -15
View File
@@ -35,7 +35,7 @@
.\" @(#)echo.1 8.1 (Berkeley) 7/22/93
.\" $FreeBSD$
.\"
.Dd April 12, 2003
.Dd July 22, 1993
.Dt ECHO 1
.Os
.Sh NAME
@@ -58,20 +58,11 @@ output.
The following option is available:
.Bl -tag -width flag
.It Fl n
Do not print the trailing newline character.
This may also be achieved by appending
Do not print the trailing newline character. This may also be
achieved by appending
.Ql \ec
to the end of the string, as is done
by iBCS2 compatible systems.
Note that this option as well as the effect of
.Ql \ec
are implementation-defined in
.St -p1003.1-2001
as amended by Cor. 1-2002.
Applications aiming for maximum
portability are strongly encouraged to use
.Xr printf 1
to suppress the newline character.
.El
.Pp
Some shells may provide a builtin
@@ -90,6 +81,6 @@ manual page.
.Sh STANDARDS
The
.Nm
utility conforms to
.St -p1003.1-2001
as amended by Cor. 1-2002.
utility is expected to be
.St -p1003.2
compatible.
+1 -1
View File
@@ -5,7 +5,7 @@ SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
LINKS= ${BINDIR}/ed ${BINDIR}/red
MLINKS= ed.1 red.1
.if exists(${.CURDIR}/../../secure) && !defined(NOCRYPT)
.if exists(${.CURDIR}/../../secure) && !defined(NOCRYPT) && !defined(NOSECURE)
DISTRIBUTION=crypto
CFLAGS+=-DDES
DPADD= ${LIBCIPHER}
+2 -3
View File
@@ -394,12 +394,11 @@ where
.Ar col-elm
is a
.Em collating element
are interpreted according to the current locale settings
are interpreted according to
.Xr locale 5
(not currently supported).
See
.Xr regex 3
and
.Xr re_format 7
for an explanation of these constructs.
.It Op ^char-class
Match any single character, other than newline, not in
+6 -9
View File
@@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 10, 2002
.Dd July 3, 1993
.Dt EXPR 1
.Os
.Sh NAME
@@ -46,15 +46,12 @@ utility evaluates
.Ar expression
and writes the result on standard output.
.Pp
All operators and operands must be passed as separate arguments.
Several of the operators have special meaning to command interpreters
and must therefore be quoted appropriately.
All integer operands are interpreted in base 10.
All operators are separate arguments to the
.Nm
utility.
Characters special to the command interpreter must be escaped.
.Pp
Arithmetic operations are performed using signed integer math.
.Pp
Operators are listed below in order of increasing precedence; all
are left-associative.
Operators are listed below in order of increasing precedence.
Operators with equal precedence are grouped within { } symbols.
.Bl -tag -width indent
.It Ar expr1 Li | Ar expr2
+13 -16
View File
@@ -106,13 +106,11 @@ the system call
would return a file descriptor to the file
.Dq afile .
.Pp
There are eight system calls that do not follow links, and which operate
There are six system calls that do not follow links, and which operate
on the symbolic link itself.
They are:
.Xr lchmod 2 ,
.Xr lchown 2 ,
.Xr lstat 2 ,
.Xr lutimes 2 ,
.Xr readlink 2 ,
.Xr rename 2 ,
.Xr rmdir 2 ,
@@ -132,16 +130,8 @@ The owner and group of an existing symbolic link can be changed by
means of the
.Xr lchown 2
system call.
The access permissions, owner/group and modification time of
an existing symbolic link can be changed by means of the
.Xr lchmod 2 ,
.Xr lchown 2 ,
and
.Xr lutimes 2
system calls, respectively.
The flags cannot be changed.
Of these, only the flags are used by the system;
the access permissions and ownership are ignored.
The other file attributes, such as the modification time and access
permissions, are not used by the system and cannot be changed.
.Pp
The
.Bx 4.4
@@ -281,6 +271,13 @@ not of type directory.
Operations that apply to symbolic links are performed on the links
themselves, but otherwise the links are ignored.
.Pp
For example, the command
.Dq Li "chown -R user slink directory"
will ignore
.Dq Li slink ,
because symbolic links in this system do not have owners.
Any symbolic links encountered during the tree traversal will also be
ignored.
The command
.Dq Li "rm -r slink directory"
will remove
@@ -288,7 +285,9 @@ will remove
as well as any symbolic links encountered in the tree traversal of
.Dq Li directory ,
because symbolic links may be removed.
In no case will
In no case will either
.Nm chown
or
.Nm rm
affect the file which
.Dq Li slink
@@ -442,10 +441,8 @@ whether specified on the command line or encountered in the tree walk.
.Xr pax 1 ,
.Xr rm 1 ,
.Xr tar 1 ,
.Xr lchmod 2 ,
.Xr lchown 2 ,
.Xr lstat 2 ,
.Xr lutimes 2 ,
.Xr readlink 2 ,
.Xr rename 2 ,
.Xr symlink 2 ,
+10 -50
View File
@@ -13,6 +13,10 @@
* 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.
@@ -51,91 +55,47 @@ __FBSDID("$FreeBSD$");
int
namecmp(const FTSENT *a, const FTSENT *b)
{
return (strcoll(a->fts_name, b->fts_name));
}
int
revnamecmp(const FTSENT *a, const FTSENT *b)
{
return (strcoll(b->fts_name, a->fts_name));
}
int
modcmp(const FTSENT *a, const FTSENT *b)
{
if (b->fts_statp->st_mtimespec.tv_sec >
a->fts_statp->st_mtimespec.tv_sec)
return (1);
if (b->fts_statp->st_mtimespec.tv_sec <
a->fts_statp->st_mtimespec.tv_sec)
return (-1);
if (b->fts_statp->st_mtimespec.tv_nsec >
a->fts_statp->st_mtimespec.tv_nsec)
return (1);
if (b->fts_statp->st_mtimespec.tv_nsec <
a->fts_statp->st_mtimespec.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
return (b->fts_statp->st_mtime - a->fts_statp->st_mtime);
}
int
revmodcmp(const FTSENT *a, const FTSENT *b)
{
return (modcmp(b, a));
return (a->fts_statp->st_mtime - b->fts_statp->st_mtime);
}
int
acccmp(const FTSENT *a, const FTSENT *b)
{
if (b->fts_statp->st_atimespec.tv_sec >
a->fts_statp->st_atimespec.tv_sec)
return (1);
if (b->fts_statp->st_atimespec.tv_sec <
a->fts_statp->st_atimespec.tv_sec)
return (-1);
if (b->fts_statp->st_atimespec.tv_nsec >
a->fts_statp->st_atimespec.tv_nsec)
return (1);
if (b->fts_statp->st_atimespec.tv_nsec <
a->fts_statp->st_atimespec.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
return (b->fts_statp->st_atime - a->fts_statp->st_atime);
}
int
revacccmp(const FTSENT *a, const FTSENT *b)
{
return (acccmp(b, a));
return (a->fts_statp->st_atime - b->fts_statp->st_atime);
}
int
statcmp(const FTSENT *a, const FTSENT *b)
{
if (b->fts_statp->st_ctimespec.tv_sec >
a->fts_statp->st_ctimespec.tv_sec)
return (1);
if (b->fts_statp->st_ctimespec.tv_sec <
a->fts_statp->st_ctimespec.tv_sec)
return (-1);
if (b->fts_statp->st_ctimespec.tv_nsec >
a->fts_statp->st_ctimespec.tv_nsec)
return (1);
if (b->fts_statp->st_ctimespec.tv_nsec <
a->fts_statp->st_ctimespec.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
return (b->fts_statp->st_ctime - a->fts_statp->st_ctime);
}
int
revstatcmp(const FTSENT *a, const FTSENT *b)
{
return (statcmp(b, a));
return (a->fts_statp->st_ctime - b->fts_statp->st_ctime);
}
+6 -13
View File
@@ -35,7 +35,7 @@
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $FreeBSD$
.\"
.Dd January 11, 2005
.Dd July 8, 2002
.Dt LS 1
.Os
.Sh NAME
@@ -172,7 +172,7 @@ format output.
When used with the
.Fl l
option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte
and Petabyte in order to reduce the number of digits to four or fewer
and Petabyte in order to reduce the number of digits to three or less
using base 2 for sizes.
.It Fl i
For each file, print the file's file serial number (inode number).
@@ -188,9 +188,7 @@ This option overrides the environment variable
.Dq ell . )
List in long format.
(See below.)
A total sum (in blocks, see the
.Fl s
option for the block size unit) for all the file
If the output is to a terminal, a total sum for all the file
sizes is output on a line before the long listing.
.It Fl m
Stream output format; list files across the page, separated by commas.
@@ -218,7 +216,7 @@ lexicographical order or the oldest entries first.
.It Fl s
Display the number of file system blocks actually used by each file, in units
of 512 bytes, where partial units are rounded up to the next integer value.
A total sum for all the file
If the output is to a terminal, a total sum for all the file
sizes is output on a line before the listing.
The environment variable
.Ev BLOCKSIZE
@@ -332,7 +330,7 @@ linked-to file is preceded by
The file mode printed under the
.Fl l
option consists of the
entry type and the permissions.
entry type, owner permissions, and group permissions.
The entry type character describes the type of file, as
follows:
.Pp
@@ -626,12 +624,7 @@ specification.
.Xr symlink 7 ,
.Xr sticky 8
.Sh STANDARDS
With the exception of options
.Fl g ,
.Fl n
and
.Fl o ,
the
The
.Nm
utility conforms to
.St -p1003.1-2001 .
-1
View File
@@ -597,7 +597,6 @@ display(FTSENT *p, FTSENT *list)
maxblock = makenines(maxblock);
maxnlink = makenines(maxnlink);
maxsize = makenines(maxsize);
free(jinitmax);
}
bcfile = 0;
flags = NULL;
+2 -2
View File
@@ -156,9 +156,9 @@ usage(void)
{
(void)fprintf(stderr,
#ifdef COLORLS
"usage: ls [-ABCFGHLPRTWabcdfghiklmnoqrstuwx1]"
"usage: ls [-ABCFGHLPRTWabcdfghiklnoqrstu1]"
#else
"usage: ls [-ABCFHLPRTWabcdfghiklmnoqrstuwx1]"
"usage: ls [-ABCFHLPRTWabcdfghiklnoqrstu1]"
#endif
" [file ...]\n");
exit(1);
+6 -17
View File
@@ -212,25 +212,14 @@ do_move(from, to)
struct statfs sfs;
char path[PATH_MAX];
/*
* If the source is a symbolic link and is on another
* filesystem, it can be recreated at the destination.
*/
if (lstat(from, &sb) == -1) {
warn("%s", from);
/* Can't mv(1) a mount point. */
if (realpath(from, path) == NULL) {
warnx("cannot resolve %s: %s", from, path);
return (1);
}
if (!S_ISLNK(sb.st_mode)) {
/* Can't mv(1) a mount point. */
if (realpath(from, path) == NULL) {
warnx("cannot resolve %s: %s", from, path);
return (1);
}
if (!statfs(path, &sfs) &&
!strcmp(path, sfs.f_mntonname)) {
warnx("cannot rename a mount point");
return (1);
}
if (!statfs(path, &sfs) && !strcmp(path, sfs.f_mntonname)) {
warnx("cannot rename a mount point");
return (1);
}
} else {
warn("rename %s to %s", from, to);
+2 -2
View File
@@ -230,7 +230,7 @@ name_uid(uid, frc)
++pwopn;
}
if (ptr == NULL)
ptr = uidtb[uid % UID_SZ] = (UIDC *)malloc(sizeof(UIDC));
ptr = (UIDC *)malloc(sizeof(UIDC));
if ((pw = getpwuid(uid)) == NULL) {
/*
@@ -308,7 +308,7 @@ name_gid(gid, frc)
++gropn;
}
if (ptr == NULL)
ptr = gidtb[gid % GID_SZ] = (GIDC *)malloc(sizeof(GIDC));
ptr = (GIDC *)malloc(sizeof(GIDC));
if ((gr = getgrgid(gid)) == NULL) {
/*
+18 -30
View File
@@ -453,13 +453,7 @@ tar_rd(arcn, buf)
* copy out the name and values in the stat buffer
*/
hd = (HD_TAR *)buf;
/*
* old tar format specifies the name always be null-terminated,
* but let's be robust to broken archives.
* the same applies to handling links below.
*/
arcn->nlen = l_strncpy(arcn->name, hd->name,
MIN(sizeof(hd->name), sizeof(arcn->name)) - 1);
arcn->nlen = l_strncpy(arcn->name, hd->name, sizeof(arcn->name) - 1);
arcn->name[arcn->nlen] = '\0';
arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode,sizeof(hd->mode),OCT) &
0xfff);
@@ -488,7 +482,7 @@ tar_rd(arcn, buf)
*/
arcn->type = PAX_SLK;
arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
sizeof(arcn->ln_name) - 1);
arcn->ln_name[arcn->ln_nlen] = '\0';
arcn->sb.st_mode |= S_IFLNK;
break;
@@ -500,7 +494,7 @@ tar_rd(arcn, buf)
arcn->type = PAX_HLK;
arcn->sb.st_nlink = 2;
arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
sizeof(arcn->ln_name) - 1);
arcn->ln_name[arcn->ln_nlen] = '\0';
/*
@@ -610,7 +604,7 @@ tar_wr(arcn)
case PAX_SLK:
case PAX_HLK:
case PAX_HRG:
if (arcn->ln_nlen >= sizeof(hd->linkname)) {
if (arcn->ln_nlen > sizeof(hd->linkname)) {
paxwarn(1,"Link name too long for tar %s", arcn->ln_name);
return(1);
}
@@ -850,19 +844,12 @@ ustar_rd(arcn, buf)
*/
dest = arcn->name;
if (*(hd->prefix) != '\0') {
cnt = l_strncpy(dest, hd->prefix,
MIN(sizeof(hd->prefix), sizeof(arcn->name) - 2));
cnt = l_strncpy(dest, hd->prefix, sizeof(arcn->name) - 2);
dest += cnt;
*dest++ = '/';
cnt++;
}
/*
* ustar format specifies the name may be unterminated
* if it fills the entire field. this also applies to
* the prefix and the linkname.
*/
arcn->nlen = cnt + l_strncpy(dest, hd->name,
MIN(sizeof(hd->name), sizeof(arcn->name) - cnt - 1));
arcn->nlen = cnt + l_strncpy(dest, hd->name, sizeof(arcn->name) - cnt);
arcn->name[arcn->nlen] = '\0';
/*
@@ -955,7 +942,7 @@ ustar_rd(arcn, buf)
* copy the link name
*/
arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
MIN(sizeof(hd->linkname), sizeof(arcn->ln_name) - 1));
sizeof(arcn->ln_name) - 1);
arcn->ln_name[arcn->ln_nlen] = '\0';
break;
case CONTTYPE:
@@ -1012,7 +999,7 @@ ustar_wr(arcn)
* check the length of the linkname
*/
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
(arcn->type == PAX_HRG)) && (arcn->ln_nlen > sizeof(hd->linkname))){
(arcn->type == PAX_HRG)) && (arcn->ln_nlen >= sizeof(hd->linkname))){
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
return(1);
}
@@ -1037,16 +1024,17 @@ ustar_wr(arcn)
* occur, we remove the / and copy the first part to the prefix
*/
*pt = '\0';
l_strncpy(hd->prefix, arcn->name, sizeof(hd->prefix));
l_strncpy(hd->prefix, arcn->name, sizeof(hd->prefix) - 1);
*pt++ = '/';
} else
memset(hd->prefix, 0, sizeof(hd->prefix));
/*
* copy the name part. this may be the whole path or the part after
* the prefix. both the name and prefix may fill the entire field.
* the prefix
*/
l_strncpy(hd->name, pt, sizeof(hd->name));
l_strncpy(hd->name, pt, sizeof(hd->name) - 1);
hd->name[sizeof(hd->name) - 1] = '\0';
/*
* set the fields in the header that are type dependent
@@ -1089,8 +1077,8 @@ ustar_wr(arcn)
hd->typeflag = SYMTYPE;
else
hd->typeflag = LNKTYPE;
/* the link name may occupy the entire field in ustar */
l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
hd->linkname[sizeof(hd->linkname) - 1] = '\0';
memset(hd->devmajor, 0, sizeof(hd->devmajor));
memset(hd->devminor, 0, sizeof(hd->devminor));
if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
@@ -1190,9 +1178,9 @@ name_split(name, len)
* check to see if the file name is small enough to fit in the name
* field. if so just return a pointer to the name.
*/
if (len <= TNMSZ)
if (len < TNMSZ)
return(name);
if (len > (TPFSZ + TNMSZ + 1))
if (len > (TPFSZ + TNMSZ))
return(NULL);
/*
@@ -1201,7 +1189,7 @@ name_split(name, len)
* to find the biggest piece to fit in the name field (or the smallest
* prefix we can find)
*/
start = name + len - TNMSZ - 1;
start = name + len - TNMSZ;
while ((*start != '\0') && (*start != '/'))
++start;
@@ -1219,7 +1207,7 @@ name_split(name, len)
* the file would then expand on extract to //str. The len == 0 below
* makes this special case follow the spec to the letter.
*/
if ((len > TPFSZ) || (len == 0))
if ((len >= TPFSZ) || (len == 0))
return(NULL);
/*
+38 -38
View File
@@ -41,46 +41,46 @@ struct varent;
extern fixpt_t ccpu;
extern int eval, fscale, mempages, nlistread, rawcpu, cflag;
extern time_t now;
extern int sumrusage, termwidth, totwidth;
extern VAR var[];
extern VARENT *vhead;
__BEGIN_DECLS
void command(KINFO *, VARENT *);
void cputime(KINFO *, VARENT *);
int donlist(void);
void evar(KINFO *, VARENT *);
VARENT *find_varentry(VAR *);
const char *fmt_argv(char **, char *, size_t);
double getpcpu(const KINFO *);
void logname(KINFO *, VARENT *);
void longtname(KINFO *, VARENT *);
void lstarted(KINFO *, VARENT *);
void maxrss(KINFO *, VARENT *);
void nlisterr(struct nlist *);
void p_rssize(KINFO *, VARENT *);
void pagein(KINFO *, VARENT *);
void parsefmt(const char *, int);
void pcpu(KINFO *, VARENT *);
void pmem(KINFO *, VARENT *);
void pri(KINFO *, VARENT *);
void rtprior(KINFO *, VARENT *);
void printheader(void);
void pvar(KINFO *, VARENT *);
void rssize(KINFO *, VARENT *);
void runame(KINFO *, VARENT *);
void rvar(KINFO *, VARENT *);
int s_runame(KINFO *);
int s_uname(KINFO *);
void showkey(void);
void started(KINFO *, VARENT *);
void state(KINFO *, VARENT *);
void tdev(KINFO *, VARENT *);
void tname(KINFO *, VARENT *);
void tsize(KINFO *, VARENT *);
void ucomm(KINFO *, VARENT *);
void uname(KINFO *, VARENT *);
void uvar(KINFO *, VARENT *);
void vsize(KINFO *, VARENT *);
void wchan(KINFO *, VARENT *);
void command __P((KINFO *, VARENT *));
void cputime __P((KINFO *, VARENT *));
int donlist __P((void));
void evar __P((KINFO *, VARENT *));
char *fmt_argv __P((char **, char *, int));
double getpcpu __P((KINFO *));
double getpmem __P((KINFO *));
void logname __P((KINFO *, VARENT *));
void longtname __P((KINFO *, VARENT *));
void lstarted __P((KINFO *, VARENT *));
void maxrss __P((KINFO *, VARENT *));
void nlisterr __P((struct nlist *));
void p_rssize __P((KINFO *, VARENT *));
void pagein __P((KINFO *, VARENT *));
void parsefmt __P((char *));
void pcpu __P((KINFO *, VARENT *));
void pmem __P((KINFO *, VARENT *));
void pri __P((KINFO *, VARENT *));
void rtprior __P((KINFO *, VARENT *));
void printheader __P((void));
void pvar __P((KINFO *, VARENT *));
void rssize __P((KINFO *, VARENT *));
void runame __P((KINFO *, VARENT *));
int s_runame __P((KINFO *));
void rvar __P((KINFO *, VARENT *));
void showkey __P((void));
void started __P((KINFO *, VARENT *));
void state __P((KINFO *, VARENT *));
void tdev __P((KINFO *, VARENT *));
void tname __P((KINFO *, VARENT *));
void tsize __P((KINFO *, VARENT *));
void ucomm __P((KINFO *, VARENT *));
void uname __P((KINFO *, VARENT *));
int s_uname __P((KINFO *));
void uvar __P((KINFO *, VARENT *));
void vsize __P((KINFO *, VARENT *));
void wchan __P((KINFO *, VARENT *));
__END_DECLS
+27 -26
View File
@@ -31,40 +31,38 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
#if 0
static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
#endif
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vis.h>
#include "ps.h"
static char *cmdpart(char *);
static char *shquote(char **);
static char *cmdpart __P((char *));
static char *shquote __P((char **));
/*
* XXX
* This is a stub until marc does the real one.
*/
static char *
shquote(char **argv)
shquote(argv)
char **argv;
{
static long arg_max = -1;
size_t len;
long len;
char **p, *dst, *src;
static char *buf = NULL;
@@ -75,18 +73,18 @@ shquote(char **argv)
errx(1, "malloc failed");
}
if (*argv == NULL) {
buf[0] = '\0';
if (*argv == 0) {
buf[0] = 0;
return (buf);
}
dst = buf;
for (p = argv; (src = *p++) != NULL; ) {
if (*src == '\0')
for (p = argv; (src = *p++) != 0; ) {
if (*src == 0)
continue;
len = (4 * arg_max - (dst - buf)) / 4;
strvisx(dst, src, strlen(src) < len ? strlen(src) : len,
VIS_NL | VIS_CSTYLE);
while (*dst != '\0')
while (*dst)
dst++;
if ((4 * arg_max - (dst - buf)) / 4 > 0)
*dst++ = ' ';
@@ -99,20 +97,24 @@ shquote(char **argv)
}
static char *
cmdpart(char *arg0)
cmdpart(arg0)
char *arg0;
{
char *cp;
return ((cp = strrchr(arg0, '/')) != NULL ? cp + 1 : arg0);
}
const char *
fmt_argv(char **argv, char *cmd, size_t maxlen)
char *
fmt_argv(argv, cmd, maxlen)
char **argv;
char *cmd;
int maxlen;
{
size_t len;
int len;
char *ap, *cp;
if (argv == NULL || argv[0] == NULL) {
if (argv == 0 || argv[0] == 0) {
if (cmd == NULL)
return ("");
ap = NULL;
@@ -121,13 +123,12 @@ fmt_argv(char **argv, char *cmd, size_t maxlen)
ap = shquote(argv);
len = strlen(ap) + maxlen + 4;
}
cp = malloc(len);
if (cp == NULL)
errx(1, "malloc failed");
if ((cp = malloc(len)) == NULL)
return (NULL);
if (ap == NULL)
sprintf(cp, " (%.*s)", (int)maxlen, cmd);
sprintf(cp, " (%.*s)", maxlen, cmd);
else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)
sprintf(cp, "%s (%.*s)", ap, (int)maxlen, cmd);
sprintf(cp, "%s (%.*s)", ap, maxlen, cmd);
else
(void) strcpy(cp, ap);
return (cp);
+29 -46
View File
@@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#endif /* not lint */
#else
static const char rcsid[] =
"$FreeBSD$";
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#endif /* not lint */
#include <sys/param.h>
#include <sys/time.h>
@@ -48,15 +49,17 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <err.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utmp.h>
#include "ps.h"
static VAR *findvar(char *, int, char **header);
static int vcmp(const void *, const void *);
static VAR *findvar __P((char *));
static int vcmp __P((const void *, const void *));
#ifdef NOTINUSE
int utime(), stime(), ixrss(), idrss(), isrss();
@@ -77,9 +80,9 @@ int utime(), stime(), ixrss(), idrss(), isrss();
#define UIDLEN 5
#define PIDFMT "d"
#define PIDLEN 5
#define USERLEN (MAXLOGNAME - 1)
#define USERLEN UT_NAMESIZE
static VAR var[] = {
VAR var[] = {
{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 4},
{"%mem", "%MEM", NULL, 0, pmem, NULL, 4},
{"acflag", "ACFLG",
@@ -190,11 +193,11 @@ static VAR var[] = {
};
void
showkey(void)
showkey()
{
VAR *v;
int i;
const char *p, *sep;
char *p, *sep;
i = 0;
sep = "";
@@ -211,45 +214,23 @@ showkey(void)
}
void
parsefmt(const char *p, int user)
parsefmt(p)
char *p;
{
static struct varent *vtail;
char *tempstr, *tempstr1;
#define SKIP_5x_USERCHGS 1
#if SKIP_5x_USERCHGS
/*
* XXX - For now in 4.x-stable, always act as if the user
* explicitly requested this format string. This is
* done to reduce the code-differences with 5.x,
* without making any user-visible changes.
*/
user = 1;
#endif
#define FMTSEP " \t,\n"
tempstr1 = tempstr = strdup(p);
while (tempstr && *tempstr) {
char *cp, *hp;
#define FMTSEP " \t,\n"
while (p && *p) {
char *cp;
VAR *v;
struct varent *vent;
while ((cp = strsep(&tempstr, FMTSEP)) != NULL && *cp == '\0')
while ((cp = strsep(&p, FMTSEP)) != NULL && *cp == '\0')
/* void */;
if (cp == NULL || !(v = findvar(cp, user, &hp)))
if (cp == NULL || !(v = findvar(cp)))
continue;
if (!user) {
/*
* If the user is NOT adding this field manually,
* get on with our lives if this VAR is already
* represented in the list.
*/
vent = find_varentry(v);
if (vent != NULL)
continue;
}
if ((vent = malloc(sizeof(struct varent))) == NULL)
errx(1, "malloc failed");
err(1, NULL);
vent->var = v;
vent->next = NULL;
if (vhead == NULL)
@@ -259,7 +240,6 @@ parsefmt(const char *p, int user)
vtail = vent;
}
}
free(tempstr1);
if (!vhead) {
warnx("no valid keywords; valid keywords:");
showkey();
@@ -268,10 +248,12 @@ parsefmt(const char *p, int user)
}
static VAR *
findvar(char *p, int user, char **header __unused)
findvar(p)
char *p;
{
VAR *v, key;
char *hp;
int vcmp();
hp = strchr(p, '=');
if (hp)
@@ -285,19 +267,20 @@ findvar(char *p, int user, char **header __unused)
warnx("%s: illegal keyword specification", p);
eval = 1;
}
parsefmt(v->alias, user);
parsefmt(v->alias);
return ((VAR *)NULL);
}
if (!v) {
warnx("%s: keyword not found", p);
eval = 1;
} else if (hp)
v->header = strdup(hp);
v->header = hp;
return (v);
}
static int
vcmp(const void *a, const void *b)
vcmp(a, b)
const void *a, *b;
{
return (strcmp(((const VAR *)a)->name, ((const VAR *)b)->name));
return (strcmp(((VAR *)a)->name, ((VAR *)b)->name));
}
+5 -8
View File
@@ -31,29 +31,26 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
#if 0
static char sccsid[] = "@(#)nlist.c 8.4 (Berkeley) 4/2/94";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/sysctl.h>
#include <stddef.h>
int donlist(void); /* should come from extern.h via ps.h */
fixpt_t ccpu; /* kernel _ccpu variable */
int nlistread; /* if nlist already read. */
int mempages; /* number of pages of phys. memory */
int fscale; /* kernel _fscale variable */
int
donlist(void)
donlist()
{
size_t oldlen;
+28 -18
View File
@@ -31,14 +31,13 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/param.h>
#include <sys/time.h>
@@ -59,8 +58,8 @@ __FBSDID("$FreeBSD$");
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <vis.h>
#include "ps.h"
@@ -349,29 +348,36 @@ longtname(k, ve)
}
void
started(KINFO *k, VARENT *ve)
started(k, ve)
KINFO *k;
VARENT *ve;
{
VAR *v;
static time_t now;
time_t then;
struct tm *tp;
static int use_ampm = -1;
char buf[100];
static int use_ampm = -1;
v = ve->var;
if (!k->ki_u.u_valid) {
(void)printf("%-*s", v->width, "-");
return;
}
if (use_ampm < 0)
use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
then = k->ki_u.u_start.tv_sec;
tp = localtime(&then);
if (!now)
(void)time(&now);
if (now - k->ki_u.u_start.tv_sec < 24 * 3600) {
(void)strftime(buf, sizeof(buf) - 1,
use_ampm ? "%l:%M%p" : "%k:%M ", tp);
use_ampm ? "%l:%M%p" : "%k:%M ", tp);
} else if (now - k->ki_u.u_start.tv_sec < 7 * 86400) {
(void)strftime(buf, sizeof(buf) - 1,
use_ampm ? "%a%I%p" : "%a%H ", tp);
use_ampm ? "%a%I%p" : "%a%H ", tp);
} else
(void)strftime(buf, sizeof(buf) - 1, "%e%b%y", tp);
(void)printf("%-*s", v->width, buf);
@@ -499,7 +505,8 @@ cputime(k, ve)
}
double
getpcpu(const KINFO *k)
getpcpu(k)
KINFO *k;
{
struct proc *p;
static int failure;
@@ -532,8 +539,9 @@ pcpu(k, ve)
(void)printf("%*.1f", v->width, getpcpu(k));
}
static double
getpmem(KINFO *k)
double
getpmem(k)
KINFO *k;
{
static int failure;
struct proc *p;
@@ -580,9 +588,10 @@ pagein(k, ve)
k->ki_u.u_valid ? k->ki_u.u_ru.ru_majflt : 0);
}
/* ARGSUSED */
void
maxrss(KINFO *k __unused, VARENT *ve)
maxrss(k, ve)
KINFO *k;
VARENT *ve;
{
VAR *v;
@@ -639,11 +648,12 @@ rtprior(k, ve)
* structures.
*/
static void
printval(void *bp, VAR *v)
printval(bp, v)
char *bp;
VAR *v;
{
static char ofmt[32] = "%";
const char *fcp;
char *cp;
char *fcp, *cp;
cp = ofmt + 1;
fcp = v->fmt;
+50 -121
View File
@@ -32,7 +32,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd March 27, 2004
.Dd April 18, 1994
.Dt PS 1
.Os
.Sh NAME
@@ -40,64 +40,26 @@
.Nd process status
.Sh SYNOPSIS
.Nm
.Op Fl aCcefhjlmrSTuvwXx
.Oo Fl G Ar gid Ns Xo
.Op , Ns Ar gid Ns No ...
.Xc
.Oc
.Op Fl aCcefhjlmrSTuvwx
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl O Ar fmt
.Op Fl o Ar fmt
.Oo Fl p Ar pid Ns Xo
.Op , Ns Ar pid Ns No ...
.Xc
.Oc
.Oo Fl t Ar tty Ns Xo
.Op , Ns Ar tty Ns No ...
.Xc
.Oc
.Oo Fl U Ar username Ns Xo
.Op , Ns Ar username Ns No ...
.Xc
.Oc
.Op Fl p Ar pid
.Op Fl t Ar tty
.Op Fl U Ar username
.Nm
.Op Fl L
.Sh DESCRIPTION
The
.Nm
utility
displays a header line, followed by lines containing information about
all of your
displays a header line followed by lines containing information about your
processes that have controlling terminals.
.Pp
A different set of processes can be selected for display by using any
combination of the
.Fl a , G , p , T , t
and
.Fl U
options.
If more than one of these options are given, then
.Nm
will select all processes which are matched by at least one of the
given options.
.Pp
For the processes which have been selected for display,
.Nm
will display one line per process.
By default all of these output lines are sorted first by controlling
terminal, then by process
This information is sorted by controlling terminal, then by process
.Tn ID .
The
.Fl m , r , u ,
and
.Fl v
options will change the sort order.
If more than one sorting option was given, then the selected processes
will be sorted by the last sorting option which was specified.
.Pp
For the processes which have been selected for display, the information
to display is selected based on a set of keywords (see the
The information displayed is selected based on a set of keywords (see the
.Fl L
.Fl O
and
@@ -118,10 +80,6 @@ The options are as follows:
.Bl -tag -width indent
.It Fl a
Display information about other users' processes as well as your own.
This will skip any processes which do not have a controlling teminal,
unless the
.Fl x
option is also specified.
This can be disabled by setting the
.Va kern.ps_showallprocs
sysctl to zero.
@@ -137,10 +95,6 @@ Display the environment as well.
.It Fl f
Show commandline and environment information about swapped out processes.
This option is honored only if the uid of the user is 0.
.It Fl G
Display information about processes which are running with the specified
real group
.Tn ID(s) .
.It Fl h
Repeat the information header as often as necessary to guarantee one
header per page of information.
@@ -148,21 +102,17 @@ header per page of information.
Print information associated with the following keywords:
user, pid, ppid, pgid, sess, jobc, state, tt, time and command.
.It Fl L
List the set of keywords available for the
.Fl O
and
.Fl o
options.
List the set of available keywords.
.It Fl l
Display information associated with the following keywords:
uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time
and command.
.It Fl M
Extract values associated with the name list from the specified core
instead of the currently running system.
instead of the default
.Pa /dev/kmem .
.It Fl m
Sort by memory usage, instead of the combination of controlling
terminal and process
Sort by memory usage, instead of by process
.Tn ID .
.It Fl N
Extract the name list from the specified system instead of the default
@@ -177,20 +127,16 @@ Keywords may be appended with an equals (``='') sign and a string.
This causes the printed header to use the specified string instead of
the standard header.
.It Fl o
Display information associated with the space or comma separated
list of keywords specified.
Multiple keywords may also be given in the form of more than one
.Fl o
option.
Display information associated with the space or comma separated list
of keywords specified.
Keywords may be appended with an equals (``='') sign and a string.
This causes the printed header to use the specified string instead of
the standard header.
.It Fl p
Display information about processes which match the specified process
.Tn ID(s) .
Display information associated with the specified process
.Tn ID .
.It Fl r
Sort by current cpu usage, instead of the combination of controlling
terminal and process
Sort by current cpu usage, instead of by process
.Tn ID .
.It Fl S
Change the way the process time is calculated by summing all exited
@@ -200,10 +146,10 @@ Display information about processes attached to the device associated
with the standard input.
.It Fl t
Display information about processes attached to the specified terminal
device(s).
device.
.It Fl U
Display the processes belonging to the specified
.Ar username Ns (s) .
.Ar username .
.It Fl u
Display information associated with the following keywords:
user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command.
@@ -229,22 +175,8 @@ If the
option is specified more than once,
.Nm
will use as many columns as necessary without regard for your window size.
.It Fl X
When displaying processes matched by other options, skip any processes
which do not have a controlling terminal.
.It Fl x
When displaying processes matched by other options, include processes
which do not have a controlling terminal.
This is the opposite of the
.Fl X
option.
If both
.Fl X
and
.Fl x
are specified in the same command, then
.Nm
will use the one which was specified last.
Display information about processes without controlling terminals.
.El
.Pp
A complete list of the available keywords are listed below.
@@ -267,6 +199,7 @@ the include file
.It Dv "P_ADVLOCK" Ta No "0x00001 Process may hold a POSIX advisory lock"
.It Dv "P_CONTROLT" Ta No "0x00002 Has a controlling terminal"
.It Dv "P_INMEM" Ta No "0x00004 Loaded into memory"
.It Dv "P_NOCLDSTOP" Ta No "0x00008 No SIGCHLD when children stop"
.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit"
.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling"
.It Dv "P_SELECT" Ta No "0x00040 Selecting; wakeup/waiting danger"
@@ -280,13 +213,6 @@ the include file
.It Dv "P_EXEC" Ta No "0x04000 Process called exec"
.It Dv "P_OWEUPC" Ta No "0x20000 Owe process an addupc() call at next ast"
.It Dv "P_SWAPPING" Ta No "0x40000 Process is being swapped"
.It Dv "P_SWAPINREQ" Ta No "0x80000 Swapin request due to wakeup"
.It Dv "P_KTHREADP" Ta No "0x200000 Process is really a kernel thread"
.It Dv "P_DEADLKTREAT" Ta No "0x800000 Lock acquisition - deadlock treatment"
.It Dv "P_JAILED" Ta No "0x1000000 Process is in jail"
.It Dv "P_OLDMASK" Ta No "0x2000000 Need to restore mask before pause"
.It Dv "P_ALTSTACK" Ta No "0x4000000 Have alternate signal stack"
.It Dv "P_INEXEC" Ta No "0x8000000 Process is in execve()"
.El
.It lim
The soft limit on memory used, specified via a call to
@@ -308,15 +234,20 @@ If the command started less than 7 days ago, the start time is
displayed using the ``%a6.15p'' format.
Otherwise, the start time is displayed using the ``%e%b%y'' format.
.It state
The state is given by a sequence of characters, for example,
The state is given by a sequence of letters, for example,
.Dq Tn RWNA .
The first character indicates the run state of the process:
The first letter indicates the run state of the process:
.Pp
.Bl -tag -width indent -compact
.It D
Marks a process in disk (or other short term, uninterruptible) wait.
.It I
Marks a process that is idle (sleeping for longer than about 20 seconds).
.It J
Marks a process which is in
.Xr jail 2 .
The hostname of the prison can be found in
.Ql Li /proc/<pid>/status .
.It R
Marks a runnable process.
.It S
@@ -337,13 +268,20 @@ The process is in the foreground process group of its control terminal.
The process has raised
.Tn CPU
scheduling priority.
.It >
The process has specified a soft limit on memory requirements and is
currently exceeding that limit; such a process is (necessarily) not
swapped.
.It A
the process has asked for random page replacement
.Pf ( Dv MADV_RANDOM ,
from
.Xr madvise 2 ,
for example,
.Xr lisp 1
in a garbage collect).
.It E
The process is trying to exit.
.It J
Marks a process which is in
.Xr jail 2 .
The hostname of the prison can be found in
.Ql Li /proc/<pid>/status .
.It L
The process has pages locked in core (for example, for raw
.Tn I/O ) .
@@ -352,11 +290,20 @@ The process has reduced
.Tn CPU
scheduling priority (see
.Xr setpriority 2 ) .
.It S
The process has asked for
.Tn FIFO
page replacement
.Pf ( Dv MADV_SEQUENTIAL ,
from
.Xr madvise 2 ,
for example, a large image processing program using virtual memory to
sequentially address voluminous data).
.It s
The process is a session leader.
.It V
The process is suspended during a
.Xr vfork 2 .
.Xr vfork .
.It W
The process is swapped out.
.It X
@@ -556,26 +503,8 @@ the mount point of
.Xr procfs 5 ,
.Xr pstat 8 ,
.Xr sysctl 8
.Sh STANDARDS
For historical reasons,
.Nm
utility under
.Fx
supports a different set of options from what is described by
.St -p1003.2 ,
and what is supported on non-BSD operating systems.
.Sh HISTORY
The
.Nm
command appeared in
.At v4 .
.Sh BUGS
Since
.Nm
cannot run faster than the system and is run as any other scheduled
process, the information it displays can never be exact.
.Pp
The
.Nm
utility does not correctly display argument lists containing multibyte
characters.
+263 -768
View File
File diff suppressed because it is too large. Load diff
+7 -11
View File
@@ -48,10 +48,6 @@ struct usave {
#define KI_PROC(ki) (&(ki)->ki_p->kp_proc)
#define KI_EPROC(ki) (&(ki)->ki_p->kp_eproc)
/* These two make it easier to MFC some changes from 5.x. */
#define KI_PROC2(ki) (&(ki)->kp_proc)
#define KI_EPROC2(ki) (&(ki)->kp_eproc)
typedef struct kinfo {
struct kinfo_proc *ki_p; /* proc structure */
struct usave ki_u; /* interesting parts of user */
@@ -66,27 +62,27 @@ typedef struct varent {
} VARENT;
typedef struct var {
const char *name; /* name(s) of variable */
const char *header; /* default header */
const char *alias; /* aliases */
char *name; /* name(s) of variable */
char *header; /* default header */
char *alias; /* aliases */
#define COMM 0x01 /* needs exec arguments and environment (XXX) */
#define LJUST 0x02 /* left adjust on output (trailing blanks) */
#define USER 0x04 /* needs user structure */
#define DSIZ 0x08 /* field size is dynamic*/
u_int flag;
/* output routine */
void (*oproc)(struct kinfo *, struct varent *);
void (*oproc) __P((struct kinfo *, struct varent *));
/* sizing routine*/
int (*sproc)(struct kinfo *);
int (*sproc) __P((struct kinfo *));
short width; /* printing width */
/*
* The following (optional) elements are hooks for passing information
* to the generic output routines: pvar, evar, uvar (those which print
* simple elements from well known structures: proc, eproc, usave)
*/
size_t off; /* offset in structure */
int off; /* offset in structure */
enum type type; /* type of element */
const char *fmt; /* printf format */
char *fmt; /* printf format */
char *time; /* time format */
short dwidth; /* dynamic printing width */
/*
+16 -11
View File
@@ -44,12 +44,11 @@ static char const copyright[] =
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#if 0
#ifndef lint
#if 0
static char sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94";
#endif /* not lint */
#endif
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -590,7 +589,7 @@ sink(int argc, char *argv[])
off_t i, j, size;
int amt, count, exists, first, mask, mode, ofd, omode;
int setimes, targisdir, wrerrno = 0;
char ch, *cp, *np, *targ, *why, *vect[1], buf[BUFSIZ], path[PATH_MAX];
char ch, *cp, *np, *targ, *why, *vect[1], buf[BUFSIZ];
#define atime tv[0]
#define mtime tv[1]
@@ -687,15 +686,21 @@ sink(int argc, char *argv[])
if (*cp++ != ' ')
SCREWUP("size not delimited");
if (targisdir) {
if (strlen(targ) + (*targ ? 1 : 0) + strlen(cp)
>= sizeof(path)) {
run_err("%s%s%s: name too long", targ,
*targ ? "/" : "", cp);
exit(1);
static char *namebuf = NULL;
static size_t cursize;
size_t need;
need = strlen(targ) + strlen(cp) + 250;
if (need > cursize) {
if (namebuf != NULL)
free(namebuf);
if (!(namebuf = malloc(need)))
run_err("%s", strerror(errno));
cursize = need;
}
(void)snprintf(path, sizeof(path), "%s%s%s", targ,
(void)snprintf(namebuf, need, "%s%s%s", targ,
*targ ? "/" : "", cp);
np = path;
np = namebuf;
} else
np = targ;
exists = stat(np, &stb) == 0;
+2
View File
@@ -2,6 +2,8 @@
# $FreeBSD$
PROG= rm
WARNS?= 2
SRCS= rm.c
LINKS= ${BINDIR}/rm ${BINDIR}/unlink
MLINKS= rm.1 unlink.1
+26 -37
View File
@@ -1,4 +1,3 @@
.\"-
.\" Copyright (c) 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -13,6 +12,10 @@
.\" 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.
@@ -32,7 +35,7 @@
.\" @(#)rm.1 8.5 (Berkeley) 12/5/94
.\" $FreeBSD$
.\"
.Dd September 29, 2005
.Dd January 28, 1999
.Dt RM 1
.Os
.Sh NAME
@@ -41,8 +44,7 @@
.Nd remove directory entries
.Sh SYNOPSIS
.Nm
.Op Fl f | i
.Op Fl dIPRrvW
.Op Fl dfiPRrvW
.Ar
.Nm unlink
.Ar file
@@ -78,20 +80,10 @@ The
option overrides any previous
.Fl f
options.
.It Fl I
Request confirmation once if more than three files are being removed or if a
directory is being recursively removed.
This is a far less intrusive option than
.Fl i
yet provides almost the same level of protection against mistakes.
.It Fl P
Overwrite regular files before deleting them.
Files are overwritten three times, first with the byte pattern 0xff,
then 0x00, and then 0xff again, before they are deleted.
Specifying this flag for a read only file will cause
.Nm
to generate an error message and exit.
The file wil not be removed or overwritten.
.It Fl R
Attempt to remove the file hierarchy rooted in each file argument.
The
@@ -123,10 +115,9 @@ The
utility removes symbolic links, not the files referenced by the links.
.Pp
It is an error to attempt to remove the files
.Pa / ,
.Pa .\&
.Dq .\&
or
.Pa .. .
.Dq .. .
.Pp
When the utility is called as
.Nm unlink ,
@@ -157,17 +148,31 @@ to parse its arguments, which allows it to accept
the
.Sq Li --
option which will cause it to stop processing flag options at that
point.
This will allow the removal of file names that begin
point. This will allow the removal of file names that begin
with a dash
.Pq Sq - .
For example:
.Dl rm -- -filename
The same behavior can be obtained by using an absolute or relative
path reference.
For example:
path reference. For example:
.Dl rm /home/user/-filename
.Dl rm ./-filename
.Sh SEE ALSO
.Xr chflags 1 ,
.Xr rmdir 1 ,
.Xr undelete 2 ,
.Xr unlink 2 ,
.Xr fts 3 ,
.Xr getopt 3 ,
.Xr symlink 7
.Sh BUGS
The
.Fl P
option assumes that the underlying file system is a fixed-block file
system.
UFS is a fixed-block file system, LFS is not.
In addition, only regular files are overwritten, other types of files
are not.
.Sh COMPATIBILITY
The
.Nm
@@ -183,14 +188,6 @@ Also, historical
.Bx
implementations prompted on the standard output,
not the standard error output.
.Sh SEE ALSO
.Xr chflags 1 ,
.Xr rmdir 1 ,
.Xr undelete 2 ,
.Xr unlink 2 ,
.Xr fts 3 ,
.Xr getopt 3 ,
.Xr symlink 7
.Sh STANDARDS
The
.Nm
@@ -206,11 +203,3 @@ A
.Nm
command appeared in
.At v1 .
.Sh BUGS
The
.Fl P
option assumes that the underlying file system is a fixed-block file
system.
UFS is a fixed-block file system, LFS is not.
In addition, only regular files are overwritten, other types of files
are not.
+28 -129
View File
@@ -10,6 +10,10 @@
* 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.
@@ -27,7 +31,6 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
static const char copyright[] =
"@(#) Copyright (c) 1990, 1993, 1994\n\
@@ -35,9 +38,10 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94";
#endif /* not lint */
#endif
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -49,8 +53,6 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fcntl.h>
#include <fts.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -58,29 +60,26 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
int rflag, Iflag;
uid_t uid;
int check(char *, char *, struct stat *);
int check2(char **);
void checkdot(char **);
void checkslash(char **);
void rm_file(char **);
int rm_overwrite(char *, struct stat *);
void rm_overwrite(char *, struct stat *);
void rm_tree(char **);
void usage(void);
/*
* rm --
* This rm is different from historic rm's, but is expected to match
* POSIX 1003.2 behavior. The most visible difference is that -f
* POSIX 1003.2 behavior. The most visible difference is that -f
* has two specific effects now, ignore non-existent files and force
* file removal.
* file removal.
*/
int
main(int argc, char *argv[])
{
int ch;
int ch, rflag;
char *p;
/*
@@ -104,7 +103,7 @@ main(int argc, char *argv[])
}
Pflag = rflag = 0;
while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1)
while ((ch = getopt(argc, argv, "dfiPRrvW")) != -1)
switch(ch) {
case 'd':
dflag = 1;
@@ -117,9 +116,6 @@ main(int argc, char *argv[])
fflag = 0;
iflag = 1;
break;
case 'I':
Iflag = 1;
break;
case 'P':
Pflag = 1;
break;
@@ -141,22 +137,16 @@ main(int argc, char *argv[])
if (argc < 1) {
if (fflag)
return (0);
return 0;
usage();
}
checkdot(argv);
if (getenv("POSIXLY_CORRECT") == NULL)
checkslash(argv);
uid = geteuid();
if (*argv) {
stdin_ok = isatty(STDIN_FILENO);
if (Iflag) {
if (check2(argv) == 0)
exit (1);
}
if (rflag)
rm_tree(argv);
else
@@ -192,11 +182,8 @@ rm_tree(char **argv)
flags |= FTS_NOSTAT;
if (Wflag)
flags |= FTS_WHITEOUT;
if (!(fts = fts_open(argv, flags, NULL))) {
if (fflag && errno == ENOENT)
return;
err(1, "fts_open");
}
if (!(fts = fts_open(argv, flags, NULL)))
err(1, NULL);
while ((p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
@@ -210,8 +197,8 @@ rm_tree(char **argv)
errx(1, "%s: %s", p->fts_path, strerror(p->fts_errno));
case FTS_NS:
/*
* Assume that since fts_read() couldn't stat the
* file, it can't be unlinked.
* FTS_NS: assume that if can't stat the file, it
* can't be unlinked.
*/
if (!needstat)
break;
@@ -280,18 +267,9 @@ rm_tree(char **argv)
}
break;
case FTS_NS:
/*
* Assume that since fts_read() couldn't stat
* the file, it can't be unlinked.
*/
if (fflag)
continue;
/* FALLTHROUGH */
default:
if (Pflag)
if (!rm_overwrite(p->fts_accpath, NULL))
continue;
rm_overwrite(p->fts_accpath, NULL);
rval = unlink(p->fts_accpath);
if (rval == 0 || (fflag && errno == ENOENT)) {
if (rval == 0 && vflag)
@@ -357,8 +335,7 @@ rm_file(char **argv)
rval = rmdir(f);
else {
if (Pflag)
if (!rm_overwrite(f, &sb))
continue;
rm_overwrite(f, &sb);
rval = unlink(f);
}
}
@@ -378,11 +355,11 @@ rm_file(char **argv)
* XXX
* This is a cheap way to *really* delete files. Note that only regular
* files are deleted, directories (and therefore names) will remain.
* Also, this assumes a fixed-block file system (like FFS, or a V7 or a
* System V file system). In a logging file system, you'll have to have
* Also, this assumes a fixed-block filesystem (like FFS, or a V7 or a
* System V filesystem). In a logging filesystem, you'll have to have
* kernel support.
*/
int
void
rm_overwrite(char *file, struct stat *sbp)
{
struct stat sb;
@@ -398,14 +375,14 @@ rm_overwrite(char *file, struct stat *sbp)
sbp = &sb;
}
if (!S_ISREG(sbp->st_mode))
return (1);
return;
if ((fd = open(file, O_WRONLY, 0)) == -1)
goto err;
if (fstatfs(fd, &fsb) == -1)
goto err;
bsize = MAX(fsb.f_iosize, 1024);
if ((buf = malloc(bsize)) == NULL)
err(1, "%s: malloc", file);
err(1, "malloc");
#define PASS(byte) { \
memset(buf, byte, bsize); \
@@ -424,16 +401,13 @@ rm_overwrite(char *file, struct stat *sbp)
PASS(0xff);
if (!fsync(fd) && !close(fd)) {
free(buf);
return (1);
return;
}
err: eval = 1;
if (buf)
free(buf);
if (fd != -1)
close(fd);
warn("%s", file);
return (0);
}
@@ -449,7 +423,7 @@ check(char *path, char *name, struct stat *sp)
else {
/*
* If it's not a symbolic link and it's unwritable and we're
* talking to a terminal, ask. Symbolic links are excluded
* talking to a terminal, ask. Symbolic links are excluded
* because their permissions are meaningless. Check stdin_ok
* first because we may not have stat'ed the file.
*/
@@ -460,16 +434,12 @@ check(char *path, char *name, struct stat *sp)
return (1);
strmode(sp->st_mode, modep);
if ((flagsp = fflagstostr(sp->st_flags)) == NULL)
err(1, "fflagstostr");
if (Pflag)
errx(1,
"%s: -P was specified, but file is not writable",
path);
err(1, NULL);
(void)fprintf(stderr, "override %s%s%s/%s %s%sfor %s? ",
modep + 1, modep[9] == ' ' ? "" : " ",
user_from_uid(sp->st_uid, 0),
group_from_gid(sp->st_gid, 0),
*flagsp ? flagsp : "", *flagsp ? " " : "",
*flagsp ? flagsp : "", *flagsp ? " " : "",
path);
free(flagsp);
}
@@ -481,77 +451,6 @@ check(char *path, char *name, struct stat *sp)
return (first == 'y' || first == 'Y');
}
#define ISSLASH(a) ((a)[0] == '/' && (a)[1] == '\0')
void
checkslash(char **argv)
{
char **t, **u;
int complained;
complained = 0;
for (t = argv; *t;) {
if (ISSLASH(*t)) {
if (!complained++)
warnx("\"/\" may not be removed");
eval = 1;
for (u = t; u[0] != NULL; ++u)
u[0] = u[1];
} else {
++t;
}
}
}
int
check2(char **argv)
{
struct stat st;
int first;
int ch;
int fcount = 0;
int dcount = 0;
int i;
const char *dname = NULL;
for (i = 0; argv[i]; ++i) {
if (lstat(argv[i], &st) == 0) {
if (S_ISDIR(st.st_mode)) {
++dcount;
dname = argv[i]; /* only used if 1 dir */
} else {
++fcount;
}
}
}
first = 0;
while (first != 'n' && first != 'N' && first != 'y' && first != 'Y') {
if (dcount && rflag) {
fprintf(stderr, "recursively remove");
if (dcount == 1)
fprintf(stderr, " %s", dname);
else
fprintf(stderr, " %d dirs", dcount);
if (fcount == 1)
fprintf(stderr, " and 1 file");
else if (fcount > 1)
fprintf(stderr, " and %d files", fcount);
} else if (dcount + fcount > 3) {
fprintf(stderr, "remove %d files", dcount + fcount);
} else {
return(1);
}
fprintf(stderr, "? ");
fflush(stderr);
first = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar();
if (ch == EOF)
break;
}
return (first == 'y' || first == 'Y');
}
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
void
checkdot(char **argv)
@@ -582,7 +481,7 @@ usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: rm [-f | -i] [-dIPRrvW] file ...",
"usage: rm [-f | -i] [-dPRrvW] file ...",
" unlink file");
exit(EX_USAGE);
}
-1
View File
@@ -2,7 +2,6 @@
# $FreeBSD$
PROG= sh
INSTALLFLAGS= -S
SHSRCS= alias.c arith.y arith_lex.l cd.c echo.c error.c eval.c exec.c expand.c \
histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
mystring.c options.c output.c parser.c printf.c redir.c show.c \
+1 -1
View File
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#define ATABSIZE 39
STATIC struct alias *atab[ATABSIZE];
struct alias *atab[ATABSIZE];
STATIC void setalias(char *, char *);
STATIC int unalias(char *);
+2 -2
View File
@@ -74,8 +74,8 @@ STATIC int docd(char *, int, int);
STATIC char *getcomponent(void);
STATIC int updatepwd(char *);
STATIC char *curdir = NULL; /* current working directory */
STATIC char *prevdir; /* previous working directory */
char *curdir = NULL; /* current working directory */
char *prevdir; /* previous working directory */
STATIC char *cdcomppath;
int
+1 -1
View File
@@ -710,7 +710,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
* the command runs. Partly deleting like
* changepatch() does doesn't seem worth the
* bookinging effort, since most such runs add
* directories in front of the new PATH.
* diretories in front of the new PATH.
*/
clearcmdentry(0);
do_clearcmdentry = 1;
+2 -2
View File
@@ -593,7 +593,7 @@ deletefuncs(void)
* entry.
*/
STATIC struct tblentry **lastcmdentry;
struct tblentry **lastcmdentry;
STATIC struct tblentry *
@@ -699,7 +699,7 @@ unsetfunc(char *name)
delete_cmd_entry();
return (0);
}
return (0);
return (1);
}
/*
+1
View File
@@ -64,6 +64,7 @@ int find_builtin(char *);
void hashcd(void);
void changepath(const char *);
void deletefuncs(void);
void getcmdentry(char *, struct cmdentry *);
void addcmdentry(char *, struct cmdentry *);
void defun(char *, union node *);
int unsetfunc(char *);
+7 -7
View File
@@ -89,11 +89,11 @@ struct ifsregion {
};
STATIC char *expdest; /* output of current string */
STATIC struct nodelist *argbackq; /* list of back quote expressions */
STATIC struct ifsregion ifsfirst; /* first struct in list of ifs regions */
STATIC struct ifsregion *ifslastp; /* last struct in list */
STATIC struct arglist exparg; /* holds expanded arg list */
char *expdest; /* output of current string */
struct nodelist *argbackq; /* list of back quote expressions */
struct ifsregion ifsfirst; /* first struct in list of ifs regions */
struct ifsregion *ifslastp; /* last struct in list */
struct arglist exparg; /* holds expanded arg list */
STATIC void argstr(char *, int);
STATIC char *exptilde(char *, int);
@@ -1046,7 +1046,7 @@ ifsbreakup(char *string, struct arglist *arglist)
* should be escapes. The results are stored in the list exparg.
*/
STATIC char *expdir;
char *expdir;
STATIC void
@@ -1164,7 +1164,7 @@ expmeta(char *enddir, char *name)
if (*p == '\0')
break;
}
if (metaflag == 0 || lstat(expdir, &statb) >= 0)
if (metaflag == 0 || stat(expdir, &statb) >= 0)
addfname(expdir);
return;
}
+1 -1
View File
@@ -102,7 +102,7 @@ MKINIT int parselleft; /* copy of parsefile->lleft */
char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
char basebuf[BUFSIZ]; /* buffer for top level input file */
STATIC struct parsefile *parsefile = &basepf; /* current input file */
struct parsefile *parsefile = &basepf; /* current input file */
int init_editline = 0; /* editline library initialized? */
int whichprompt; /* 1 == PS1, 2 == PS2 */
+5 -7
View File
@@ -76,12 +76,12 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
STATIC struct job *jobtab; /* array of jobs */
STATIC int njobs; /* size of array */
struct job *jobtab; /* array of jobs */
int njobs; /* size of array */
MKINIT pid_t backgndpid = -1; /* pid of last background process */
#if JOBS
STATIC struct job *jobmru; /* most recently used job list */
STATIC pid_t initialpgrp; /* pgrp of shell on invocation */
struct job *jobmru; /* most recently used job list */
pid_t initialpgrp; /* pgrp of shell on invocation */
#endif
int in_waitcmd = 0; /* are we in waitcmd()? */
int in_dowait = 0; /* are we in dowait()? */
@@ -740,7 +740,6 @@ forkshell(struct job *jp, union node *n, int mode)
TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n,
mode));
INTOFF;
flushall();
pid = fork();
if (pid == -1) {
TRACE(("Fork failed, errno=%d\n", errno));
@@ -930,8 +929,7 @@ dowait(int block, struct job *job)
in_dowait--;
if (breakwaitcmd != 0) {
breakwaitcmd = 0;
if (pid <= 0)
return -1;
return -1;
}
if (pid <= 0)
return pid;
+3 -3
View File
@@ -112,9 +112,9 @@ struct stack_block {
char space[MINSIZE];
};
STATIC struct stack_block stackbase;
STATIC struct stack_block *stackp = &stackbase;
STATIC struct stackmark *markp;
struct stack_block stackbase;
struct stack_block *stackp = &stackbase;
struct stackmark *markp;
char *stacknxt = stackbase.space;
int stacknleft = MINSIZE;
int sstrnleft;
+4 -4
View File
@@ -49,10 +49,10 @@
#include "mystring.h"
STATIC int funcblocksize; /* size of structures in function */
STATIC int funcstringsize; /* size of strings in node */
STATIC pointer funcblock; /* block to allocate function from */
STATIC char *funcstring; /* block to allocate strings from */
int funcblocksize; /* size of structures in function */
int funcstringsize; /* size of strings in node */
pointer funcblock; /* block to allocate function from */
char *funcstring; /* block to allocate strings from */
%SIZES
+1 -1
View File
@@ -164,7 +164,7 @@ outqstr(const char *p, struct output *file)
out1c('\'');
}
STATIC char out_junk[16];
char out_junk[16];
void
emptyoutbuf(struct output *dest)
+11 -12
View File
@@ -84,19 +84,19 @@ struct heredoc {
STATIC struct heredoc *heredoclist; /* list of here documents to read */
STATIC int parsebackquote; /* nonzero if we are inside backquotes */
STATIC int doprompt; /* if set, prompt the user */
STATIC int needprompt; /* true if interactive and at start of line */
STATIC int lasttoken; /* last token read */
struct heredoc *heredoclist; /* list of here documents to read */
int parsebackquote; /* nonzero if we are inside backquotes */
int doprompt; /* if set, prompt the user */
int needprompt; /* true if interactive and at start of line */
int lasttoken; /* last token read */
MKINIT int tokpushback; /* last token pushed back */
STATIC char *wordtext; /* text of last word returned by readtoken */
char *wordtext; /* text of last word returned by readtoken */
MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */
STATIC struct nodelist *backquotelist;
STATIC union node *redirnode;
STATIC struct heredoc *heredoc;
STATIC int quoteflag; /* set if (part of) last token was quoted */
STATIC int startlinno; /* line # where last token started */
struct nodelist *backquotelist;
union node *redirnode;
struct heredoc *heredoc;
int quoteflag; /* set if (part of) last token was quoted */
int startlinno; /* line # where last token started */
/* XXX When 'noaliases' is set to one, no alias expansion takes place. */
static int noaliases = 0;
@@ -969,7 +969,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
USTPUTC('\\', out);
pungetc();
} else if (c == '\n') {
plinno++;
if (doprompt)
setprompt(2);
else
+1 -1
View File
@@ -84,7 +84,7 @@ MKINIT struct redirtab *redirlist;
* background commands, where we want to redirect fd0 to /dev/null only
* if it hasn't already been redirected.
*/
STATIC int fd0_redirected = 0;
int fd0_redirected = 0;
STATIC void openredirect(union node *, char[10 ]);
STATIC int openhere(union node *);
+1 -1
View File
@@ -262,7 +262,7 @@ When waiting for a child, execute traps immediately.
If this option is not set,
traps are executed after the child exits,
as specified in
.St -p1003.2 .
.St -p1003.2
This nonstandard option is useful for putting guarding shells around
children that block signals. The surrounding shell may kill the child
or it may just return control to the tty and leave the child alone,
+5 -5
View File
@@ -96,11 +96,11 @@ struct var vps1;
struct var vps2;
struct var vvers;
#if ATTY
STATIC struct var vterm;
struct var vterm;
#endif
STATIC struct var voptind;
struct var voptind;
STATIC const struct varinit varinit[] = {
const struct varinit varinit[] = {
#if ATTY
{ &vatty, VSTRFIXED|VTEXTFIXED|VUNSET, "ATTY=",
NULL },
@@ -134,7 +134,7 @@ STATIC const struct varinit varinit[] = {
NULL }
};
STATIC struct var *vartab[VTABSIZE];
struct var *vartab[VTABSIZE];
STATIC struct var **hashvar(char *);
STATIC int varequal(char *, char *);
@@ -778,7 +778,7 @@ unsetvar(char *s)
}
}
return (0);
return (1);
}
+6 -13
View File
@@ -214,6 +214,11 @@ True if string
comes after
.Ar \&s\&2
based on the ASCII value of their characters.
.It Ar \&s\&1
True if
.Ar \&s\&1
is not the null
string.
.It Ar \&n\&1 Fl \&eq Ar \&n\&2
True if the integers
.Ar \&n\&1
@@ -254,17 +259,6 @@ than or equal to the integer
.Ar \&n\&2 .
.El
.Pp
If
.Ar file
is a symbolic link,
.Nm
will fully dereference it and then evaluate the expression
against the file referenced, except for the
.Fl h
and
.Fl L
primaries.
.Pp
These primaries can be combined with the following operators:
.Bl -tag -width Ar
.It Cm \&! Ar expression
@@ -325,8 +319,7 @@ An error occurred.
.Sh SEE ALSO
.Xr builtin 1 ,
.Xr expr 1 ,
.Xr sh 1 ,
.Xr symlink 7
.Xr sh 1
.Sh STANDARDS
The
.Nm
+268 -521
View File
File diff suppressed because it is too large. Load diff
-9
View File
@@ -10,15 +10,6 @@ artifacts including BIND, INN, and DHCP.
Note that BIND 8 is in "end-of-life", having been replaced by BIND 9. See
http://www.isc.org/ for more details.
BIND 8.3.7 Highlights
Security release.
BIND 8.3.6 Highlights
Maintenance release.
BIND 8.3.5 Highlights
Maintenance release.
BIND 8.3.4 Highlights
Security Fix DoS and buffer overrun.
+1 -1
View File
@@ -1 +1 @@
8.3.7-REL
8.3.4-REL
+62 -46
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: dig.c,v 8.62.6.3 2003/06/02 10:06:30 marka Exp $";
static const char rcsid[] = "$Id: dig.c,v 8.57 2002/06/18 02:26:49 marka Exp $";
#endif
/*
@@ -177,7 +177,6 @@ static const char rcsid[] = "$Id: dig.c,v 8.62.6.3 2003/06/02 10:06:30 marka Exp
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h> /* time(2), ctime(3) */
#include "port_after.h"
@@ -207,23 +206,15 @@ static const char rcsid[] = "$Id: dig.c,v 8.62.6.3 2003/06/02 10:06:30 marka Exp
#define SAVEENV "DiG.env"
#define DIG_MAXARGS 30
#ifndef DIG_PING
#define DIG_PING "ping"
#endif
#ifndef DIG_TAIL
#define DIG_TAIL "tail"
#endif
#ifndef DIG_PINGFMT
#define DIG_PINGFMT "%s -s %s 56 3 | %s -3"
#endif
static int eecode = 0;
static FILE * qfp;
static char *defsrv, *srvmsg;
static char defbuf[40] = "default -- ";
static char srvbuf[1024];
static char myhostname[MAXHOSTNAMELEN];
static struct sockaddr_in myaddress;
static struct sockaddr_in6 myaddress6;
static u_int32_t ixfr_serial;
static char ubuf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:123.123.123.123")];
/* stuff for nslookup modules */
struct __res_state res;
@@ -269,7 +260,7 @@ main(int argc, char **argv) {
} packet_;
#define header (packet_.header_)
#define packet (packet_.packet_)
u_char answer[NS_MAXMSG];
u_char answer[64*1024];
int n;
char doping[90];
char pingstr[50];
@@ -304,7 +295,6 @@ main(int argc, char **argv) {
ns_tsig_key key;
char *keyfile = NULL, *keyname = NULL;
const char *pingfmt = NULL;
res_ninit(&res);
res.pfcode = PRF_DEF;
@@ -325,6 +315,7 @@ main(int argc, char **argv) {
myaddress6.sin6_addr = in6addr_any;
myaddress6.sin6_port = 0; /*INPORT_ANY*/;
defsrv = strcat(defbuf, inet_ntoa(res.nsaddr.sin_addr));
res_x = res;
/*
@@ -372,6 +363,7 @@ main(int argc, char **argv) {
vtmp++;
}
res.id = 1;
gettimeofday(&tv1, NULL);
/*
@@ -416,11 +408,6 @@ main(int argc, char **argv) {
* deal with ....
*/
while (*(++argv) != NULL && **argv != '\0') {
if (strlen(cmd) + strlen(*argv) + 2 > sizeof (cmd)) {
fprintf(stderr,
"Argument too large for input buffer\n");
exit(1);
}
strcat(cmd, *argv);
strcat(cmd, " ");
if (**argv == '@') {
@@ -536,14 +523,10 @@ main(int argc, char **argv) {
port = htons(atoi(*argv));
break;
case 'P':
if (argv[0][2] != '\0') {
if (argv[0][2] != '\0')
strcpy(pingstr, argv[0]+2);
pingfmt =
"%s %s 56 3 | %s -3";
} else {
strcpy(pingstr, DIG_PING);
pingfmt = DIG_PINGFMT;
}
else
strcpy(pingstr, "ping -s");
break;
case 'n':
if (argv[0][2] != '\0')
@@ -786,6 +769,8 @@ main(int argc, char **argv) {
* able to "put the resolver to work".
*/
srvbuf[0] = 0;
srvmsg = defsrv;
if (srv != NULL) {
int nscount = 0;
union res_sockaddr_union u[MAXNS];
@@ -818,13 +803,31 @@ main(int argc, char **argv) {
case AF_INET:
u[nscount].sin =
*(struct sockaddr_in*)cur->ai_addr;
u[nscount++].sin.sin_port =
u[nscount++].sin6.sin6_port =
port;
break;
}
}
if (nscount != 0)
if (nscount != 0) {
char buf[80];
res_setservers(&res, u, nscount);
srvmsg = strcat(srvbuf, srv);
strcat(srvbuf, " ");
buf[0] = '\0';
switch (u[0].sin.sin_family) {
case AF_INET:
inet_ntop(AF_INET,
&u[0].sin.sin_addr,
buf, sizeof(buf));
break;
case AF_INET6:
inet_ntop(AF_INET6,
&u[0].sin6.sin6_addr,
buf, sizeof(buf));
break;
}
strcat(srvbuf, buf);
}
freeaddrinfo(answer);
} else {
res = res_t;
@@ -833,6 +836,7 @@ main(int argc, char **argv) {
"; Bad server: %s -- using default server and timer opts\n",
srv);
fflush(stderr);
srvmsg = defsrv;
srv = NULL;
}
printf("; (%d server%s found)\n",
@@ -845,7 +849,7 @@ main(int argc, char **argv) {
int nscount;
union res_sockaddr_union u[MAXNS];
nscount = res_getservers(&res, u, MAXNS);
for (i = 0; i < nscount; i++) {
for (i = 0; i < res.nscount; i++) {
int x;
if (keyfile)
@@ -857,11 +861,24 @@ main(int argc, char **argv) {
&u[i].sin,
NULL);
if (res.pfcode & RES_PRF_STATS) {
char buf[80];
exectime = time(NULL);
buf[0] = '\0';
switch (u[i].sin.sin_family) {
case AF_INET:
inet_ntop(AF_INET,
&u[i].sin.sin_addr,
buf, sizeof(buf));
break;
case AF_INET6:
inet_ntop(AF_INET6,
&u[i].sin6.sin6_addr,
buf, sizeof(buf));
break;
}
printf(";; FROM: %s to SERVER: %s\n",
myhostname,
p_sockun(u[RES_GETLAST(res)],
ubuf, sizeof(ubuf)));
buf);
printf(";; WHEN: %s", ctime(&exectime));
}
if (!x)
@@ -927,10 +944,12 @@ main(int argc, char **argv) {
if ((bytes_in = n) < 0) {
fflush(stdout);
n = 0 - n;
msg[0]=0;
if (keyfile)
strcpy(msg, ";; res_nsendsigned");
strcat(msg,";; res_nsendsigned to server ");
else
strcat(msg, ";; res_nsend");
strcat(msg,";; res_nsend to server ");
strcat(msg,srvmsg);
perror(msg);
fflush(stderr);
@@ -944,17 +963,13 @@ main(int argc, char **argv) {
(void) gettimeofday(&end_time, NULL);
if (res.pfcode & RES_PRF_STATS) {
union res_sockaddr_union u[MAXNS];
(void) res_getservers(&res, u, MAXNS);
query_time = difftv(start_time, end_time);
printf(";; Total query time: ");
prnttime(query_time);
putchar('\n');
exectime = time(NULL);
printf(";; FROM: %s to SERVER: %s\n", myhostname,
p_sockun(u[RES_GETLAST(res)],
ubuf, sizeof(ubuf)));
printf(";; FROM: %s to SERVER: %s\n",
myhostname, srvmsg);
printf(";; WHEN: %s", ctime(&exectime));
printf(";; MSG SIZE sent: %d rcvd: %d\n",
bytes_out, bytes_in);
@@ -965,8 +980,9 @@ main(int argc, char **argv) {
* Argh ... not particularly elegant. Should put in *real* ping code.
* Would necessitate root priviledges for icmp port though!
*/
if (*pingstr && srv != NULL) {
sprintf(doping, pingfmt, pingstr, srv, DIG_TAIL);
if (*pingstr) {
sprintf(doping,"%s %s 56 3 | tail -3",pingstr,
(srv==NULL)?(defsrv+10):srv);
system(doping);
}
putchar('\n');
@@ -1022,7 +1038,7 @@ where: server,\n\
fputs("\
notes: defname and search don't work; use fully-qualified names.\n\
this is DiG version " VSTRING "\n\
$Id: dig.c,v 8.62.6.3 2003/06/02 10:06:30 marka Exp $\n\
$Id: dig.c,v 8.57 2002/06/18 02:26:49 marka Exp $\n\
", stderr);
}
@@ -1367,7 +1383,7 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
sizeof myaddress) < 0){
int e = errno;
fprintf(stderr, ";; bind(%s port %u): %s\n",
fprintf(stderr, ";; bind(%s:%u): %s\n",
inet_ntoa(myaddress.sin_addr),
ntohs(myaddress.sin_port),
strerror(e));
@@ -1391,7 +1407,7 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
int e = errno;
char buf[80];
fprintf(stderr, ";; bind(%s port %u): %s\n",
fprintf(stderr, ";; bind(%s:%u): %s\n",
inet_ntop(AF_INET6, &myaddress6.sin6_addr,
buf, sizeof(buf)),
ntohs(myaddress6.sin6_port),
@@ -1783,7 +1799,7 @@ reverse6(char *domain, struct in6_addr *in6) {
in6->s6_addr[6] & 0x0f, (in6->s6_addr[6] >> 4) & 0x0f,
in6->s6_addr[5] & 0x0f, (in6->s6_addr[5] >> 4) & 0x0f,
in6->s6_addr[4] & 0x0f, (in6->s6_addr[4] >> 4) & 0x0f,
in6->s6_addr[3] & 0x0f, (in6->s6_addr[3] >> 4) & 0x0f,
in6->s6_addr[6] & 0x0f, (in6->s6_addr[3] >> 4) & 0x0f,
in6->s6_addr[2] & 0x0f, (in6->s6_addr[2] >> 4) & 0x0f,
in6->s6_addr[1] & 0x0f, (in6->s6_addr[1] >> 4) & 0x0f,
in6->s6_addr[0] & 0x0f, (in6->s6_addr[0] >> 4) & 0x0f);
+2 -2
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: dnsquery.c,v 8.19.10.1 2003/06/02 09:15:45 marka Exp $";
static const char rcsid[] = "$Id: dnsquery.c,v 8.19 2002/04/12 03:03:48 marka Exp $";
#endif /* not lint */
/*
@@ -85,7 +85,7 @@ main(int argc, char *argv[]) {
int c, n;
int nameservers = 0, class, type, len;
union res_sockaddr_union q_nsaddr[MAXNS];
extern int optind;
extern int optind, opterr;
extern char *optarg;
int stream = 0, debug = 0;
+28 -24
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: host.c,v 8.55.8.1 2003/06/02 09:24:38 marka Exp $";
static const char rcsid[] = "$Id: host.c,v 8.53 2002/06/18 02:34:02 marka Exp $";
#endif /* not lint */
/*
@@ -136,7 +136,7 @@ static const char copyright[] =
#define ERROR -3
#define NONAUTH -4
#define MY_PACKETSZ NS_MAXMSG
#define MY_PACKETSZ 64*1024 /* need this to hold tcp answers */
typedef union {
HEADER qb1;
@@ -226,7 +226,7 @@ Usage: %s [-adlrwv] [-t querytype] [-c class] host [server]\n\
int
main(int argc, char **argv) {
struct sockaddr_storage addr;
int ok = 0;
struct hostent *hp;
char *s;
int waitmode = 0;
int ncnames, ch;
@@ -383,6 +383,7 @@ main(int argc, char **argv) {
}
freeaddrinfo(answer);
}
hp = NULL;
res.res_h_errno = TRY_AGAIN;
/*
* We handle default domains ourselves, thank you.
@@ -392,10 +393,10 @@ main(int argc, char **argv) {
if (list)
exit(ListHosts(getdomain, querytype ? querytype : ns_t_a));
ncnames = 5; nkeychains = 18;
while (ok == 0 && res.res_h_errno == TRY_AGAIN) {
while (hp == NULL && res.res_h_errno == TRY_AGAIN) {
if (!ip) {
cname = NULL;
ok = gethostinfo(getdomain);
hp = (struct hostent *)gethostinfo(getdomain);
getdomain[0] = 0; /* clear this query */
if (sigchase && (chase_step & SD_RR)) {
if (nkeychains-- == 0) {
@@ -412,7 +413,7 @@ main(int argc, char **argv) {
strcpy (getdomain, chase_domain);
strcat (getdomain, ".");
querytype = ns_t_sig;
} else if (ok != 0 && !(chase_step & SD_SIG) &&
} else if (hp && !(chase_step & SD_SIG) &&
(chase_step & SD_BADSIG)) {
printf ("%s for %s not found, last verified key %s\n",
chase_step & SD_SIG ? "Key" : "Signature",
@@ -436,17 +437,21 @@ main(int argc, char **argv) {
sym_ntos(__p_type_syms, chase_type, NULL),
getdomain);
}
ok = 0;
hp = NULL;
res.res_h_errno = TRY_AGAIN;
continue;
}
} else
ok = addrinfo(&addr);
} else {
if (addrinfo(&addr) == 0)
hp = NULL;
else
hp = (struct hostent *)1; /* XXX */
}
if (!waitmode)
break;
}
if (ok == 0) {
if (hp == NULL) {
hperror(res.res_h_errno);
exit(1);
}
@@ -744,14 +749,14 @@ printinfo(const querybuf *answer, const u_char *eom, int filter, int isls,
case SERVFAIL:
res.res_h_errno = TRY_AGAIN;
return (0);
case NOERROR:
res.res_h_errno = NO_DATA;
return (0);
case FORMERR:
case NOTIMP:
case REFUSED:
res.res_h_errno = NO_RECOVERY;
return (0);
case NOERROR:
res.res_h_errno = NO_DATA;
return (0);
case FORMERR:
case NOTIMP:
case REFUSED:
res.res_h_errno = NO_RECOVERY;
return (0);
}
return (0);
}
@@ -1048,7 +1053,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
}
if (doprint)
fprintf(file, " (\n\t\t\t%lu\t;serial (version)",
fprintf(file, "(\n\t\t\t%lu\t;serial (version)",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
@@ -1316,15 +1321,15 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
/* original ttl */
origttl = cp;
if (doprint && verbose)
fprintf(file, " %lu", ns_get32(cp));
fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* signature expiration */
if (doprint && verbose)
fprintf(file, " %lu", ns_get32(cp));
fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* time signed */
if (doprint && verbose)
fprintf(file, " %lu", ns_get32(cp));
fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* key footprint */
if (doprint && verbose)
@@ -1410,8 +1415,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
}
default:
if (doprint && verbose)
fprintf (stderr, "Unknown algorithm %d\n", n);
fprintf (stderr, "Unknown algorithm %d\n", n);
cp = cp1 + dlen;
break;
}
+41 -44
View File
@@ -131,7 +131,7 @@ char copyright[] =
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91";
static const char rcsid[] = "$Id: named-xfer.c,v 8.122.8.2 2003/06/02 05:59:56 marka Exp $";
static const char rcsid[] = "$Id: named-xfer.c,v 8.121 2002/06/26 03:27:22 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -243,9 +243,8 @@ LIST(tsig_node) tsig_list;
/*
* Debugging printf.
*/
static void lprintf(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
static void
lprintf(int level, const char *format, ...) {
void
dprintf(int level, const char *format, ...) {
va_list ap;
va_start(ap, format);
@@ -598,15 +597,15 @@ main(int argc, char *argv[]) {
#endif /* SIGUSR1&&SIGUSR2 */
if (dbfile)
lprintf(1, "domain `%s'; file `%s'; serial %u\n",
dprintf(1, "domain `%s'; file `%s'; serial %u\n",
domain, dbfile, serial_no);
if (ixfrfile)
lprintf(1, "domain `%s'; ixfrfile `%s'; serial %u\n",
dprintf(1, "domain `%s'; ixfrfile `%s'; serial %u\n",
domain, ixfrfile, serial_no);
if (tsigfile)
lprintf(1, "tsigfile `%s'\n", tsigfile);
dprintf(1, "tsigfile `%s'\n", tsigfile);
buildservicelist();
buildprotolist();
@@ -628,7 +627,7 @@ main(int argc, char *argv[]) {
zp->z_source = dbfile;
zp->z_axfr_src = axfr_src;
zp->z_addrcnt = 0;
lprintf(1, "zone found (%d): \"%s\", source = %s\n",
dprintf(1, "zone found (%d): \"%s\", source = %s\n",
zp->z_type,
(zp->z_origin[0] == '\0') ? "." : zp->z_origin,
zp->z_source);
@@ -672,15 +671,15 @@ main(int argc, char *argv[]) {
memcpy(&zp->z_addr[zp->z_addrcnt],
hp->h_addr,
INADDRSZ);
lprintf(1, "Arg: \"%s\" %s\n", tm,((tmpsupportixfr) ? "IXFR":"AXFR"));
dprintf(1, "Arg: \"%s\" %s\n", tm,((tmpsupportixfr) ? "IXFR":"AXFR"));
}
if (++zp->z_addrcnt >= NSMAX) {
zp->z_addrcnt = NSMAX;
lprintf(1, "NSMAX reached\n");
dprintf(1, "NSMAX reached\n");
break;
}
}
lprintf(1, "addrcnt = %d\n", zp->z_addrcnt);
dprintf(1, "addrcnt = %d\n", zp->z_addrcnt);
res_ninit(&res);
res.options &= ~(RES_DEFNAMES | RES_DNSRCH | RES_RECURSE);
@@ -892,7 +891,7 @@ make_query(int fd, struct zoneinfo *zp, int type, u_int32_t serial_no,
if (type == T_IXFR) {
hp = (HEADER *) buf;
cp = buf;
lprintf(1, "len = %d\n", n);
dprintf(1, "len = %d\n", n);
hp->nscount = htons(1+ntohs(hp->nscount));
cp += n;
n = dn_comp(zp->z_origin, cp, bufsize - (cp - buf), NULL, NULL);
@@ -913,7 +912,7 @@ make_query(int fd, struct zoneinfo *zp, int type, u_int32_t serial_no,
PUTLONG(0xABCD, cp); /* Expire */
PUTLONG(0x1776, cp); /* Min TTL */
n = cp - buf;
lprintf(1, "len = %d\n", cp-buf);
dprintf(1, "len = %d\n", cp-buf);
}
tsig_signed = 0;
@@ -1118,7 +1117,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
for (cnt = 0; cnt < zp->z_addrcnt; cnt++) {
methode = servermethode[cnt];
sin.sin_addr = zp->z_addr[cnt];
lprintf(3, "address [%s] %s\n",
dprintf(3, "address [%s] %s\n",
inet_ntoa(sin.sin_addr),
(methode == ISIXFR) ? "IXFR":"AXFR");
}
@@ -1158,7 +1157,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
sin.sin_family = AF_INET;
sin.sin_port = 0; /* "ANY" */
sin.sin_addr = z_axfr_src;
lprintf(2, "binding to address [%s]\n",
dprintf(2, "binding to address [%s]\n",
inet_ntoa(sin.sin_addr));
if (bind(s, (struct sockaddr *)&sin, sizeof sin) < 0)
syslog(LOG_INFO, "warning: bind(%s) failed",
@@ -1168,11 +1167,11 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
sin.sin_family = AF_INET;
sin.sin_port = port;
sin.sin_addr = zp->z_addr[cnt];
lprintf(2, "connecting to server #%d [%s].%d\n",
dprintf(2, "connecting to server #%d [%s].%d\n",
cnt + 1, inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
if (z_axfr_src.s_addr != 0) {
lprintf(2, "connect failed, trying w/o -x");
dprintf(2, "connect failed, trying w/o -x");
z_axfr_src.s_addr = 0;
(void) my_close(s);
goto try_again;
@@ -1371,7 +1370,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
}
}
if ((loop_cnt >= 1) && (soa_cnt < 2)) {
lprintf(1,
dprintf(1,
"server %s %d rejected IXFR and responded with AXFR\n",
inet_ntoa(sin.sin_addr), soa_cnt);
methode = ISNOTIXFR;
@@ -1381,7 +1380,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
break;
}
/* Skip to next record, if any. */
lprintf(1, "skipping %s %s RR in response\n",
dprintf(1, "skipping %s %s RR in response\n",
name2, p_type(type));
tmp = cp4 + dlen;
loop_cnt++;
@@ -1393,7 +1392,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
if (check_serial &&
!SEQ_GT(zp_start.z_serial, query_serial)) {
(void) my_close(s);
lprintf(1,
dprintf(1,
"zone up-to-date, serial %u\n",
zp_start.z_serial);
if (ixfp) {
@@ -1542,7 +1541,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
soa_cnt = 0;
goto axfr_response;
}
lprintf(1, "need update, serial %u\n",
dprintf(1, "need update, serial %u\n",
zp_start.z_serial);
soa_cnt = 0;
hp = (HEADER *) buf;
@@ -1566,16 +1565,14 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) {
serial_no, tsig_key,
buf, bufsize);
syslog(LOG_INFO,
"send %s query %d to %s for %s",
p_type(query_type),
cnt, inet_ntoa(sin.sin_addr),
(*zp->z_origin != '\0') ?
zp->z_origin : ".");
lprintf(1,
"send %s query %d to %s",
p_type(query_type),
cnt, inet_ntoa(sin.sin_addr));
dprintf(1,
"send %s query to %s\n",
p_type(query_type),
inet_ntoa(sin.sin_addr));
lprintf(1,"bufsize = %d\n", bufsize);
dprintf(1,"bufsize = %d\n", bufsize);
if (n < 0) {
if (!quiet) {
if (zp->z_type == Z_STUB)
@@ -1649,7 +1646,7 @@ receive:
axfr_response:
if (query_type == T_IXFR)
if (hp->rcode != NOERROR) {
lprintf(1,
dprintf(1,
"server %s did not support IXFR\n",
inet_ntoa(sin.sin_addr));
methode = ISNOTIXFR;
@@ -1659,7 +1656,7 @@ axfr_response:
if (ntohs(hp->qdcount) == 1) {
if ((query_type == T_IXFR) &&
(methode == ISIXFR)) {
lprintf(1,
dprintf(1,
"server %s rejected IXFR and responded with AXFR\n",
inet_ntoa(sin.sin_addr));
methode = ISNOTIXFR;
@@ -1809,10 +1806,10 @@ axfr_response:
(void) fclose(ixfp);
ixfp = NULL;
}
lprintf(2, "error receiving zone transfer\n");
dprintf(2, "error receiving zone transfer\n");
} else if (zp_start.z_serial == serial_no) {
(void) my_close(s);
lprintf(1, "zone up-to-date, serial %u\n",
dprintf(1, "zone up-to-date, serial %u\n",
zp_start.z_serial);
if (ixfp) {
(void) fclose(ixfp);
@@ -1832,7 +1829,7 @@ axfr_response:
} else {
if (zp_finish.z_serial == query_serial) {
(void) my_close(s);
lprintf(1, "zone up-to-date, serial %u\n",
dprintf(1, "zone up-to-date, serial %u\n",
zp_start.z_serial);
if (ixfp) {
(void) fclose(ixfp);
@@ -1847,7 +1844,7 @@ axfr_response:
"serial from [%s], zone %s: %u lower than current: %u\n",
inet_ntoa(sin.sin_addr), zp->z_origin,
zp_finish.z_serial, query_serial);
lprintf(1,
dprintf(1,
"serial from [%s], zone %s: %u lower than current: %u\n",
inet_ntoa(sin.sin_addr), zp->z_origin,
zp_finish.z_serial, query_serial);
@@ -1887,7 +1884,7 @@ axfr_response:
soa_cnt = 0;
goto axfr_response;
}
lprintf(1, "We have an IXFR\n");
dprintf(1, "We have an IXFR\n");
loop_cnt = 0;
while (SEQ_GT(zp_finish.z_serial, serial_no)) {
/*
@@ -2059,7 +2056,7 @@ writemsg(int rfd, const u_char *msg, int msglen) {
u_char len[INT16SZ];
int ret;
ns_put16(msglen, len);
__putshort(msglen, len);
iov[0].iov_base = (char *)len;
iov[0].iov_len = INT16SZ;
DE_CONST(msg, iov[1].iov_base);
@@ -2175,7 +2172,7 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg,
}
escaped = (*origin++ == '\\') && !escaped;
}
lprintf(3, "print_output: dname %s type %d class %d ttl %u\n",
dprintf(3, "print_output: dname %s type %d class %d ttl %u\n",
dname, type, class, ttl);
/*
* Convert the resource record data into the internal database format.
@@ -2434,13 +2431,13 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg,
}
if (n > MAXDATA) {
lprintf(1, "update type %d: %d bytes is too much data\n",
dprintf(1, "update type %d: %d bytes is too much data\n",
type, n);
hp->rcode = FORMERR;
return (-1);
}
if (cp != rdatap + dlen) {
lprintf(1,
dprintf(1,
"encoded rdata length is %u, but actual length was %u\n",
dlen, (u_int)(cp - rdatap));
hp->rcode = FORMERR;
@@ -2521,10 +2518,10 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg,
} else
soa_cnt++;
} else {
lprintf(2, "SOA, serial %u\n",
dprintf(2, "SOA, serial %u\n",
zp_finish.z_serial);
if (zp_start.z_serial != zp_finish.z_serial) {
lprintf(1, "serial changed, restart\n");
dprintf(1, "serial changed, restart\n");
restarts++;
if (restarts > MAX_XFER_RESTARTS) {
syslog(LOG_INFO,
@@ -3194,13 +3191,13 @@ ixfr_log(const u_char *msg, int len, int *delete, FILE *file,
ns_rr rr;
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
lprintf(1, "ixfr_log() failed\n");
dprintf(1, "ixfr_log() failed\n");
return (-1);
}
if (ns_initparse(msg, len, &handle) < 0) {
fprintf(file, ";; ns_initparse: %s\n", strerror(errno));
lprintf(1, "ixfr_log() failed\n");
dprintf(1, "ixfr_log() failed\n");
return (-1);
}
opcode = (ns_opcode) ns_msg_getflag(handle, ns_f_opcode);
@@ -3211,7 +3208,7 @@ ixfr_log(const u_char *msg, int len, int *delete, FILE *file,
{
(void) fprintf(file,"ns_parserr() failed");
lprintf(1, "ixfr_log() failed\n");
dprintf(1, "ixfr_log() failed\n");
return (-1);
}
type = (ns_type)rr.type;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_defs.h,v 8.48 2002/11/17 14:51:50 marka Exp $
* $Id: db_defs.h,v 8.47.4.1 2002/11/14 13:22:24 marka Exp $
*/
/*
+3 -4
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: db_ixfr.c,v 8.32 2002/07/08 06:26:04 marka Exp $";
static char rcsid[] = "$Id: db_ixfr.c,v 8.31 2002/01/02 04:47:10 marka Exp $";
#endif
/*
@@ -857,9 +857,8 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
err++;
break;
}
errno = 0;
n = strtoul(buf, &cp, 10);
if (errno != 0 || n > 0xffff || *cp != '\0') {
n = strtoul(buf, &cp, 10);
if (n > 0xffff || *cp != '\0') {
err++;
break;
}
+8 -6
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_load.c 4.38 (Berkeley) 3/2/91";
static const char rcsid[] = "$Id: db_load.c,v 8.123 2002/08/20 04:27:23 marka Exp $";
static const char rcsid[] = "$Id: db_load.c,v 8.121 2001/11/12 21:22:22 marka Exp $";
#endif /* not lint */
/*
@@ -1097,9 +1097,8 @@ db_load(const char *filename, const char *in_origin,
if (!getword(buf, sizeof buf, fp, 0) ||
!isdigit((unsigned char)buf[0]))
ERRTO("opaque length");
errno = 0;
n = strtoul(buf, &cp, 10);
if (errno != 0 || n > 0xffff || *cp != '\0')
if (n > 0xffff || *cp != '\0')
ERRTO("opaque length");
multiline = 0;
i = isc_gethexstring(data, sizeof(data), n, fp,
@@ -1191,8 +1190,10 @@ db_load(const char *filename, const char *in_origin,
zp->z_origin, filename, msg);
}
}
errs += purge_nonglue(zp, (dataflags & DB_F_HINT) ? fcachetab :
hashtab, zp->z_type == z_master);
errs += purge_nonglue(zp->z_origin,
(dataflags & DB_F_HINT) ? fcachetab :
hashtab, zp->z_class,
zp->z_type == z_master);
cleanup:
while (filenames) {
fn = filenames;
@@ -1209,7 +1210,8 @@ db_load(const char *filename, const char *in_origin,
p_class(zp->z_class), zp->z_serial);
if ((zp->z_flags & Z_NOTIFY) != 0)
ns_stopnotify(zp->z_origin, zp->z_class);
do_reload(zp, loading);
do_reload(zp->z_origin, zp->z_type, zp->z_class,
loading);
} else
ns_info(ns_log_load,
"%s zone \"%s\" (%s) loaded (serial %u)",
+1 -1
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: db_sec.c,v 8.36 2002/11/17 14:51:50 marka Exp $";
static const char rcsid[] = "$Id: db_sec.c,v 8.35.4.2 2002/11/14 13:24:44 marka Exp $";
#endif /* not lint */
/*
+4 -4
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_config.c,v 8.136.8.1 2003/06/02 09:56:34 marka Exp $";
static const char rcsid[] = "$Id: ns_config.c,v 8.135 2002/05/24 03:04:59 marka Exp $";
#endif /* not lint */
/*
@@ -562,7 +562,7 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) {
if (zp->z_source) {
zp->z_source = freestr(zp->z_source);
ns_stopxfrs(zp);
purge_zone(zp, fcachetab);
purge_zone(zp->z_origin, fcachetab, zp->z_class);
}
zp->z_source = new_zp->z_source;
new_zp->z_source = NULL;
@@ -669,7 +669,8 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) {
* reloading so that NS records are present
* during the zone transfer.
*/
do_reload(zp, 1);
do_reload(zp->z_origin, zp->z_type,
zp->z_class, 1);
}
}
if (zp->z_source == NULL) {
@@ -1149,7 +1150,6 @@ new_options() {
#ifdef BIND_NOTIFY
op->notify = notify_yes;
#endif
op->edns_udp_size = EDNS_MESSAGE_SZ;
return (op);
}
+2 -2
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ctl.c,v 8.48 2002/07/29 02:06:56 marka Exp $";
static const char rcsid[] = "$Id: ns_ctl.c,v 8.47 2002/06/24 07:11:07 marka Exp $";
#endif /* not lint */
/*
@@ -1126,7 +1126,7 @@ verb_args(struct ctl_sctx *ctl, struct ctl_sess *sess,
*/
cp = saved_argv[pvt->argc++];
tp = pvt->text;
while (cp && *cp != '\0')
while (cp && *cp != NULL)
if (*cp == '%' || *cp == ' ' ||
!isprint((unsigned char)*cp)) {
if (tp >= pvt->text + sizeof(pvt->text) - 4)
+2 -5
View File
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_defs.h,v 8.124.6.1 2003/06/02 09:56:34 marka Exp $
* $Id: ns_defs.h,v 8.121.2.1 2002/11/14 13:28:12 marka Exp $
*/
/*
@@ -450,8 +450,7 @@ struct qserv {
struct timeval stime; /* time first query started */
unsigned int forwarder:1; /* this entry is for a forwarder */
unsigned int noedns:1; /* don't try edns */
unsigned int lame:1; /* this server was lame, try it last */
unsigned int nretry:29; /* # of times addr retried */
unsigned int nretry:30; /* # of times addr retried */
u_int32_t serial; /* valid if Q_ZSERIAL */
};
@@ -794,7 +793,6 @@ typedef struct options {
u_int lame_ttl;
int minroots;
u_int16_t preferred_glue;
u_int16_t edns_udp_size;
enum notify notify;
} *options;
@@ -888,7 +886,6 @@ typedef enum ns_logging_categories {
ns_log_load,
ns_log_resp_checks,
ns_log_control,
ns_log_update_security,
ns_log_max_category
} ns_logging_categories;
+20 -37
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_forw.c 4.32 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: ns_forw.c,v 8.92.6.1 2003/06/02 09:56:34 marka Exp $";
static const char rcsid[] = "$Id: ns_forw.c,v 8.91 2002/05/24 03:04:57 marka Exp $";
#endif /* not lint */
/*
@@ -240,8 +240,7 @@ ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
if (!qp->q_addr[0].noedns)
smsglen += ns_add_opt(smsg, smsg + smsglen, smsgsize, 0, 0,
server_options->edns_udp_size,
0, NULL, 0);
EDNS_MESSAGE_SZ, 0, NULL, 0);
if (key != NULL) {
n = ns_sign(smsg, &smsglen, smsgsize, NOERROR, key, NULL, 0,
@@ -466,14 +465,14 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
struct hashbuf *tmphtp;
char *dname;
const char *fname;
int oldn, naddr, class, found_arr, potential_ns;
int oldn, naddr, class, found_arr, potential_ns, lame_ns;
time_t curtime;
int found_auth6;
ns_debug(ns_log_default, 3, "nslookup(nsp=%p, qp=%p, \"%s\", d=%d)",
nsp, qp, syslogdname, qp->q_distance);
potential_ns = 0;
lame_ns = potential_ns = 0;
naddr = n = qp->q_naddr;
curtime = (u_long) tt.tv_sec;
while ((nsdp = *nsp++) != NULL && n < NSMAX) {
@@ -493,6 +492,18 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
}
}
/* skip lame servers */
if ((nsdp->d_flags & DB_F_LAME) != 0) {
time_t when;
when = db_lame_find(qp->q_domain, nsdp);
if (when != 0 && when > tt.tv_sec) {
ns_debug(ns_log_default, 3,
"skipping lame NS");
lame_ns++;
goto skipserver;
}
}
found_arr = 0;
found_auth6 = 0;
tmphtp = ((nsdp->d_flags & DB_F_HINT) ?fcachetab :hashtab);
@@ -606,13 +617,6 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
if (si && (si->flags & SERVER_INFO_EDNS) == 0)
qs->noedns = 1;
}
qs->lame = 0;
if ((nsdp->d_flags & DB_F_LAME) != 0) {
time_t when;
when = db_lame_find(qp->q_domain, nsdp);
if (when != 0 && when > tt.tv_sec)
qs->lame = 1;
}
qs->nretry = 0;
/*
* If this A RR has no RTT, initialize its RTT to a
@@ -704,13 +708,15 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
qp->q_naddr = n;
if (n == 0 && potential_ns == 0 && !NS_ZFWDTAB(qp->q_fzone)) {
static const char *complaint = "No possible A RRs";
if (lame_ns != 0)
complaint = "All possible A RR's lame";
if (sysloginfo && syslogdname &&
!haveComplained((u_long)syslogdname, (u_long)complaint))
{
ns_info(ns_log_default, "%s: query(%s) %s",
sysloginfo, syslogdname, complaint);
}
return (-1);
return ((lame_ns == 0) ? -1 : -2);
}
/* Update the refcounts before the sort. */
for (i = naddr; i < (u_int)n; i++) {
@@ -786,11 +792,6 @@ int
qcomp(struct qserv *qs1, struct qserv *qs2) {
u_int rtt1, rtt2, rttr1, rttr2;
/* sort lame servers to last */
if (qs1->lame != qs2->lame)
return (qs1->lame - qs2->lame);
/* sort by rtt */
if (qs1->nsdata == NULL) {
rtt1 = 0;
rttr1 = 0;
@@ -967,23 +968,6 @@ retry(struct qinfo *qp, int samehost) {
if (qp->q_naddr > 0) {
qp->q_addr[n].noedns = 1;
++qp->q_addr[n].nretry;
/*
* Look for a non-lame server.
*/
do {
if (++n >= (int)qp->q_naddr)
n = 0;
if ((qp->q_flags & Q_ZSERIAL) != 0 &&
qp->q_addr[n].serial != 0)
continue;
if (qp->q_addr[n].lame)
continue;
if (qp->q_addr[n].nretry < MAXRETRY)
goto found;
} while (n != qp->q_curaddr);
/*
* Look for any server including lame servers.
*/
do {
if (++n >= (int)qp->q_naddr)
n = 0;
@@ -1087,8 +1071,7 @@ retry(struct qinfo *qp, int samehost) {
if (!qp->q_addr[n].noedns)
smsglen += ns_add_opt(smsg, smsg + smsglen, smsgsize, 0, 0,
server_options->edns_udp_size,
0, NULL, 0);
EDNS_MESSAGE_SZ, 0, NULL, 0);
if (key != NULL) {
n = ns_sign(smsg, &smsglen, smsgsize, NOERROR, key, NULL, 0,
+8 -6
View File
@@ -90,7 +90,7 @@
/* ns_func.h - declarations for ns_*.c's externally visible functions
*
* $Id: ns_func.h,v 8.120.8.1 2003/06/02 05:19:56 marka Exp $
* $Id: ns_func.h,v 8.117 2002/04/25 05:27:07 marka Exp $
*/
/* ++from ns_glue.c++ */
@@ -122,6 +122,7 @@ char * __newstr_record(size_t, int, const char *, int);
char * __savestr_record(const char *, int, const char *, int);
u_char * ina_put(struct in_addr ina, u_char *data);
u_char * savebuf(const u_char *, size_t, int);
void dprintf(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
#ifdef DEBUG_STRINGS
char * debug_newstr(size_t, int, const char *, int);
char * debug_savestr(const char *, int, const char *, int);
@@ -166,7 +167,7 @@ int send_msg(u_char *, int, struct qinfo *);
int findns(struct namebuf **, int,
struct databuf **, int *, int);
int finddata(struct namebuf *, int, int, HEADER *,
char **, int *, int *, int, int);
char **, int *, int *);
int add_data(struct namebuf *,
struct databuf **,
u_char *, int, int *);
@@ -303,7 +304,7 @@ void ns_cleancache(evContext ctx, void *uap,
struct timespec inter);
void clean_cache_from(char *dname, struct hashbuf *htp);
void remove_zone(struct zoneinfo *, const char *);
void purge_zone(struct zoneinfo *, struct hashbuf *);
void purge_zone(const char *, struct hashbuf *, int);
void loadxfer(void);
void qserial_retrytime(struct zoneinfo *, time_t);
void qserial_query(struct zoneinfo *);
@@ -333,8 +334,8 @@ void ns_heartbeat(evContext ctx, void *uap,
void make_new_zones(void);
void free_zone(struct zoneinfo *);
struct zoneinfo * find_auth_zone(const char *, ns_class);
int purge_nonglue(struct zoneinfo *, struct hashbuf *htp,
int log);
int purge_nonglue(const char *dname, struct hashbuf *htp,
int class, int log);
/* --from ns_maint.c-- */
/* ++from ns_sort.c++ */
@@ -346,6 +347,7 @@ void sort_response(u_char *, u_char *, int,
void ns_refreshtime(struct zoneinfo *, time_t);
void ns_retrytime(struct zoneinfo *, time_t);
time_t ns_init(const char *);
void purgeandload(struct zoneinfo *zp);
enum context ns_ptrcontext(const char *owner);
enum context ns_ownercontext(int type, enum transport);
int ns_nameok(const struct qinfo *qry, const char *name,
@@ -355,7 +357,7 @@ int ns_nameok(const struct qinfo *qry, const char *name,
struct in_addr source);
int ns_wildcard(const char *name);
void zoneinit(struct zoneinfo *);
void do_reload(struct zoneinfo *, int);
void do_reload(const char *, int, int, int);
void ns_shutdown(void);
/* --from ns_init.c-- */
+1 -2
View File
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_glob.h,v 8.59 2002/07/19 22:44:08 marka Exp $
* $Id: ns_glob.h,v 8.58 2002/06/05 04:53:50 marka Exp $
*/
/*
@@ -309,7 +309,6 @@ DECL const struct ns_sym category_constants[]
{ ns_log_load, "load" },
{ ns_log_resp_checks, "response-checks" },
{ ns_log_control, "control" },
{ ns_log_update_security, "update-security" },
{ 0, NULL }
}
#endif
+12 -15
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_init.c 4.38 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: ns_init.c,v 8.77.8.2 2003/09/04 04:09:09 marka Exp $";
static const char rcsid[] = "$Id: ns_init.c,v 8.76 2001/12/19 01:41:51 marka Exp $";
#endif /* not lint */
/*
@@ -107,7 +107,6 @@ static const char rcsid[] = "$Id: ns_init.c,v 8.77.8.2 2003/09/04 04:09:09 marka
#ifdef DEBUG
static void content_zone(int, int);
#endif
static void purgeandload(struct zoneinfo *zp);
/*
* Set new refresh time for zone. Use a random number in the last half of
@@ -238,7 +237,7 @@ zoneinit(struct zoneinfo *zp) {
result = stat(zp->z_source, &sb);
if (result != -1) {
ns_stopxfrs(zp);
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
}
if (result == -1 ||
db_load(zp->z_source, zp->z_origin, zp, NULL, ISNOTIXFR))
@@ -266,11 +265,8 @@ zoneinit(struct zoneinfo *zp) {
* delegation to that child when it was first loaded.
*/
void
do_reload(struct zoneinfo *ozp, int mark) {
do_reload(const char *domain, int type, int class, int mark) {
struct zoneinfo *zp;
const char *domain = ozp->z_origin;
int type = ozp->z_type;
int class = ozp->z_class;
ns_debug(ns_log_config, 1, "do_reload: %s %d %d %d",
*domain ? domain : ".", type, class, mark);
@@ -299,9 +295,9 @@ do_reload(struct zoneinfo *ozp, int mark) {
*/
ns_stopxfrs(zp);
if (type == z_hint || (type == z_stub && *domain == 0))
purge_zone(ozp, fcachetab);
purge_zone(domain, fcachetab, class);
else
purge_zone(ozp, hashtab);
purge_zone(domain, hashtab, class);
/*
* Reload
@@ -330,7 +326,7 @@ do_reload(struct zoneinfo *ozp, int mark) {
domain = ""; /* root zone */
zp = find_zone(domain, class);
if (zp != NULL && zp->z_type != Z_HINT) {
if (zp != NULL) {
ns_debug(ns_log_config, 1, "do_reload: matched %s",
*domain ? domain : ".");
if (mark)
@@ -342,7 +338,7 @@ do_reload(struct zoneinfo *ozp, int mark) {
}
}
static void
void
purgeandload(struct zoneinfo *zp) {
#ifdef BIND_UPDATE
@@ -359,9 +355,9 @@ purgeandload(struct zoneinfo *zp) {
ns_stopxfrs(zp);
if (zp->z_type == Z_HINT)
purge_zone(zp, fcachetab);
purge_zone(zp->z_origin, fcachetab, zp->z_class);
else
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
zp->z_flags &= ~Z_AUTH;
@@ -567,9 +563,10 @@ ns_shutdown() {
if (zp->z_type) {
if (zp->z_type != z_hint && zp->z_type != z_cache) {
ns_stopxfrs(zp);
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
} else if (zp->z_type == z_hint)
purge_zone(zp, fcachetab);
purge_zone(zp->z_origin, fcachetab,
zp->z_class);
free_zone_contents(zp, 1);
}
}
+15 -9
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ixfr.c,v 8.33 2003/02/24 23:36:01 marka Exp $";
static const char rcsid[] = "$Id: ns_ixfr.c,v 8.32 2002/05/18 01:02:57 marka Exp $";
#endif /* not lint */
/*
@@ -408,7 +408,6 @@ ixfr_log_maint(struct zoneinfo *zp) {
int len;
struct stat db_sb;
struct stat sb;
size_t check_size;
static char buf[MAXBSIZE];
ns_debug(ns_log_default, 3, "ixfr_log_maint(%s)", zp->z_origin);
@@ -444,13 +443,20 @@ ixfr_log_maint(struct zoneinfo *zp) {
}
ns_debug(ns_log_default, 3, "%s, size %ld max %ld\n", zp->z_ixfr_base,
(long)sb.st_size, (long)zp->z_max_log_size_ixfr);
check_size = zp->z_max_log_size_ixfr;
if (!check_size)
check_size = db_sb.st_size / 2;
if (sb.st_size > check_size)
seek = (sb.st_size - check_size) + (check_size / 10);
else
seek = 0;
if (zp->z_max_log_size_ixfr) {
if (sb.st_size > zp->z_max_log_size_ixfr)
seek = sb.st_size -
(size_t)(zp->z_max_log_size_ixfr +
(zp->z_max_log_size_ixfr * 0.10) );
else
seek = 0;
} else {
if (sb.st_size > (db_sb.st_size * 0.50))
seek = sb.st_size - (size_t)((db_sb.st_size * 0.50)
+ ((db_sb.st_size * zp->z_max_log_size_ixfr) * 0.10));
else
seek = 0;
}
ns_debug(ns_log_default, 3, "seek: %ld", (long)seek);
if (seek < 1) {
ns_debug(ns_log_default, 3, "%s does not need to be reduced",
+1 -2
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_lexer.c,v 8.31.10.1 2003/06/02 09:56:35 marka Exp $";
static const char rcsid[] = "$Id: ns_lexer.c,v 8.31 2002/05/24 03:05:03 marka Exp $";
#endif /* not lint */
/*
@@ -252,7 +252,6 @@ static struct keyword keywords[] = {
{"dump-file", T_DUMP_FILE},
{"dynamic", T_DYNAMIC},
{"edns", T_EDNS},
{"edns-udp-size", T_EDNS_UDP_SIZE},
{"explicit", T_EXPLICIT},
{"fail", T_FAIL},
{"fake-iquery", T_FAKE_IQUERY},
+20 -73
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
static const char rcsid[] = "$Id: ns_main.c,v 8.162.6.2 2003/06/08 22:08:02 marka Exp $";
static const char rcsid[] = "$Id: ns_main.c,v 8.160 2002/06/24 07:06:55 marka Exp $";
#endif /* not lint */
/*
@@ -141,10 +141,6 @@ char copyright[] =
#include "named.h"
#undef MAIN_PROGRAM
#ifdef TRUCLUSTER5
# include <clua/clua.h>
#endif
typedef void (*handler)(void);
typedef struct _savedg {
@@ -197,8 +193,7 @@ static int sq_dowrite(struct qstream *);
static void use_desired_debug(void);
static void stream_write(evContext, void *, int, int);
static interface * if_find(struct in_addr, u_int16_t port,
int anyport);
static interface * if_find(struct in_addr, u_int16_t port);
static void deallocate_everything(void),
stream_accept(evContext, void *, int,
@@ -830,12 +825,8 @@ stream_accept(evContext lev, void *uap, int rfd,
sp->s_ifp = ifp;
INSIST(sizeof sp->s_temp >= INT16SZ);
iov = evConsIovec(sp->s_temp, INT16SZ);
if (evRead(lev, rfd, &iov, 1, stream_getlen, sp, &sp->evID_r) == -1) {
ns_error(ns_log_default, "evRead(fd %d): %s",
rfd, strerror(errno));
sq_remove(sp);
return;
}
INSIST_ERR(evRead(lev, rfd, &iov, 1, stream_getlen, sp, &sp->evID_r)
!= -1);
sp->flags |= STREAM_READ_EV;
ns_debug(ns_log_default, 1, "IP/TCP connection from %s (fd %d)",
sin_ntoa(sp->s_from), rfd);
@@ -977,12 +968,8 @@ stream_write(evContext ctx, void *uap, int fd, int evmask) {
sp->flags &= ~STREAM_WRITE_EV;
sp->s_refcnt = 0;
iov = evConsIovec(sp->s_temp, INT16SZ);
if (evRead(ctx, fd, &iov, 1, stream_getlen, sp, &sp->evID_r) == -1) {
ns_error(ns_log_default, "evRead(fd %d): %s",
fd, strerror(errno));
sq_remove(sp);
return;
}
INSIST_ERR(evRead(ctx, fd, &iov, 1, stream_getlen, sp, &sp->evID_r) !=
-1);
sp->flags |= STREAM_READ_EV;
}
@@ -1047,12 +1034,9 @@ stream_getlen(evContext lev, void *uap, int fd, int bytes) {
iov = evConsIovec(sp->s_buf, (sp->s_size <= sp->s_bufsize) ?
sp->s_size : sp->s_bufsize);
if (evRead(lev, sp->s_rfd, &iov, 1, stream_getmsg, sp, &sp->evID_r)
== -1) {
ns_error(ns_log_default, "evRead(fd %d): %s",
== -1)
ns_panic(ns_log_default, 1, "evRead(fd %d): %s",
sp->s_rfd, strerror(errno));
sq_remove(sp);
return;
}
sp->flags |= STREAM_READ_EV;
}
@@ -1274,11 +1258,6 @@ getnetconf(int periodic_scan) {
ip_match_element ime;
u_char *mask_ptr;
struct in_addr mask;
#ifdef TRUCLUSTER5
struct sockaddr clua_addr;
int clua_cnt, clua_tot;
#endif
int clua_buf;
if (iflist_initialized) {
if (iflist_dont_rescan)
@@ -1308,19 +1287,8 @@ getnetconf(int periodic_scan) {
free_ip_match_list(local_networks);
local_networks = new_ip_match_list();
#ifdef TRUCLUSTER5
/* Find out how many cluster aliases there are */
clua_cnt = 0;
clua_tot = 0;
while (clua_getaliasaddress(&clua_addr, &clua_cnt) == CLUA_SUCCESS)
clua_tot ++;
clua_buf = clua_tot * sizeof(ifreq);
#else
clua_buf = 0;
#endif
for (;;) {
buf = memget(bufsiz + clua_buf);
buf = memget(bufsiz);
if (!buf)
ns_panic(ns_log_default, 1, "memget(interface)");
ifc.ifc_len = bufsiz;
@@ -1355,29 +1323,10 @@ getnetconf(int periodic_scan) {
if (bufsiz > 1000000)
ns_panic(ns_log_default, 1,
"get interface configuration: maximum buffer size exceeded");
memput(buf, bufsiz + clua_buf);
memput(buf, bufsiz);
bufsiz += 4096;
}
#ifdef TRUCLUSTER5
/* Get the cluster aliases and create interface entries for them */
clua_cnt = 0;
while (clua_tot--) {
memset(&ifreq, 0, sizeof (ifreq));
if (clua_getaliasaddress(&ifreq.ifr_addr, &clua_cnt) !=
CLUA_SUCCESS)
/*
* It is possible the count of aliases has changed; if
* it has increased, they won't be found this pass.
* If has decreased, stop the loop early. */
break;
strcpy(ifreq.ifr_name, "lo0");
memcpy(ifc.ifc_buf + ifc.ifc_len, &ifreq, sizeof (ifreq));
ifc.ifc_len += sizeof (ifreq);
bufsiz += sizeof (ifreq);
}
#endif
ns_debug(ns_log_default, 2, "getnetconf: SIOCGIFCONF: ifc_len = %d",
ifc.ifc_len);
@@ -1449,7 +1398,7 @@ getnetconf(int periodic_scan) {
* point interfaces, then the local address
* may appear more than once.
*/
ifp = if_find(ina, li->port, 0);
ifp = if_find(ina, li->port);
if (ifp != NULL) {
ns_debug(ns_log_default, 1,
"dup interface addr [%s].%u (%s)",
@@ -1886,7 +1835,7 @@ opensocket_f() {
* we'll notice we're in trouble if it goes away.
*/
ifp = if_find(server_options->query_source.sin_addr,
server_options->query_source.sin_port, 0);
server_options->query_source.sin_port);
if (ifp != NULL) {
ifp->flags |= INTERFACE_FORWARDING;
prev_ifp = ifp;
@@ -2206,7 +2155,7 @@ sq_write(struct qstream *qs, const u_char *buf, int len) {
return (-1);
}
}
ns_put16(len, qs->s_wbuf_free);
__putshort(len, qs->s_wbuf_free);
qs->s_wbuf_free += NS_INT16SZ;
memcpy(qs->s_wbuf_free, buf, len);
qs->s_wbuf_free += len;
@@ -2247,12 +2196,9 @@ sq_done(struct qstream *sp) {
}
iov = evConsIovec(sp->s_temp, INT16SZ);
if (evRead(ev, sp->s_rfd, &iov, 1, stream_getlen, sp, &sp->evID_r) ==
-1) {
ns_error(ns_log_default, "evRead(fd %d): %s",
-1)
ns_panic(ns_log_default, 1, "evRead(fd %d): %s",
sp->s_rfd, strerror(errno));
sq_remove(sp);
return;
}
sp->flags |= STREAM_READ_EV;
}
@@ -2356,25 +2302,26 @@ net_mask(struct in_addr ina) {
int
aIsUs(struct in_addr addr) {
if (ina_hlong(addr) == INADDR_ANY || if_find(addr, 0, 1) != NULL)
if (ina_hlong(addr) == INADDR_ANY || if_find(addr, 0) != NULL)
return (1);
return (0);
}
/* interface *
* if_find(addr, port, anyport)
* if_find(addr, port)
* scan our list of interface addresses for "addr" and port.
* port == 0 means match any port
* returns:
* pointer to interface with this address/port, or NULL if there isn't
* one.
*/
static interface *
if_find(struct in_addr addr, u_int16_t port, int anyport) {
if_find(struct in_addr addr, u_int16_t port) {
interface *ifp;
for (ifp = HEAD(iflist); ifp != NULL; ifp = NEXT(ifp, link))
if (ina_equal(addr, ifp->addr))
if (anyport || ifp->port == port)
if (port == 0 || ifp->port == port)
break;
return (ifp);
}
+46 -65
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
static const char rcsid[] = "$Id: ns_maint.c,v 8.137.8.1 2003/06/02 05:34:25 marka Exp $";
static const char rcsid[] = "$Id: ns_maint.c,v 8.136 2002/06/26 03:27:20 marka Exp $";
#endif /* not lint */
/*
@@ -134,7 +134,7 @@ static void startxfer(struct zoneinfo *),
abortxfer(struct zoneinfo *),
purge_z_2(struct hashbuf *, int);
static int purge_nonglue_2(const char *, struct hashbuf *,
int, int, int, int);
int, int, int);
#ifndef HAVE_SPAWNXFER
static pid_t spawnxfer(char **, struct zoneinfo *);
@@ -181,7 +181,7 @@ zone_maint(struct zoneinfo *zp) {
if ((zp->z_flags & Z_NOTIFY) != 0)
ns_stopnotify(zp->z_origin, zp->z_class);
/* calls purge_zone */
do_reload(zp, 0);
do_reload(zp->z_origin, zp->z_type, zp->z_class, 0);
/* reset zone state */
if (!haveComplained((u_long)zp, (u_long)stale)) {
ns_notice(ns_log_default,
@@ -906,7 +906,7 @@ startxfer(struct zoneinfo *zp) {
last = &buffer[sizeof buffer - 1]; /* leave room for \0 */
for (i = 0; i < argc; i++) {
len = strlen(argv[i]);
if (len + 1 >= last - curr) {
if (curr + len + 1 >= last) {
ns_debug(ns_log_xfer_in, 1,
"xfer args debug printout truncated");
break;
@@ -1215,7 +1215,7 @@ remove_zone(struct zoneinfo *zp, const char *verb) {
zp->z_xferpid = 0;
ns_need(main_need_tryxfer);
}
do_reload(zp, 1);
do_reload(zp->z_origin, zp->z_type, zp->z_class, 1);
ns_notice(ns_log_config, "%s zone \"%s\" (%s) %s",
zoneTypeString(zp->z_type), zp->z_origin,
p_class(zp->z_class), verb);
@@ -1228,30 +1228,17 @@ remove_zone(struct zoneinfo *zp, const char *verb) {
}
int
purge_nonglue(struct zoneinfo *zp, struct hashbuf *htp, int log) {
const char *dname = zp->z_origin;
purge_nonglue(const char *dname, struct hashbuf *htp, int class, int log) {
const char *fname;
struct namebuf *np;
struct hashbuf *phtp = htp;
int root_zone = 0;
int errs = 0;
int zone = zp - zones;
struct databuf *pdp, *dp;
int class = zp->z_class;
ns_debug(ns_log_default, 1, "purge_nonglue(%s/%d)", dname, class);
ns_debug(ns_log_default, 1, "purge_zone(%s,%d)", dname, class);
if ((np = nlookup(dname, &phtp, &fname, 0)) && dname == fname &&
!ns_wildcard(NAME(*np))) {
for (pdp = NULL, dp = np->n_data; dp != NULL; (void)NULL) {
if (dp->d_class == class && dp->d_zone != zone)
dp = rm_datum(dp, np, pdp, NULL);
else {
pdp = dp;
dp = dp->d_next;
}
}
if (*dname == '\0')
root_zone = 1;
@@ -1262,7 +1249,7 @@ purge_nonglue(struct zoneinfo *zp, struct hashbuf *htp, int log) {
h = htp;
else
h = np->n_hash;
errs += purge_nonglue_2(dname, h, class, 0, log, zone);
errs += purge_nonglue_2(dname, h, class, 0, log);
if (h->h_cnt == 0 && !root_zone) {
rm_hash(np->n_hash);
np->n_hash = NULL;
@@ -1303,7 +1290,7 @@ valid_glue(struct databuf *dp, char *name, int belowcut) {
static int
purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
int belowcut, int log, int zone)
int belowcut, int log)
{
struct databuf *dp, *pdp;
struct namebuf *np, *pnp, *npn;
@@ -1328,16 +1315,10 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
for (pdp = NULL, dp = np->n_data;
dp != NULL;
(void)NULL) {
int delete = 0;
if (!zonecut &&
dp->d_class == class &&
dp->d_zone != zone)
delete = 1;
if (zonecut &&
dp->d_class == class &&
if (dp->d_class == class &&
zonecut &&
!valid_glue(dp, name, belowcut)) {
if (log &&
dp->d_zone == zone) {
if (log)
ns_error(ns_log_load,
"zone: %s/%s: non-glue record %s bottom of zone: %s/%s",
*dname ? dname : ".",
@@ -1346,14 +1327,11 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
"at",
*name ? name : ".",
p_type(dp->d_type));
errs++;
}
delete = 1;
}
if (delete)
dp = rm_datum(dp, np, pdp,
NULL);
else {
if (log)
errs++;
} else {
pdp = dp;
dp = dp->d_next;
}
@@ -1368,7 +1346,7 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
class,
zonecut ||
belowcut,
log, zone);
log);
/* if now empty, free it */
if (np->n_hash->h_cnt == 0) {
@@ -1391,20 +1369,18 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
}
void
purge_zone(struct zoneinfo *zp, struct hashbuf *htp) {
purge_zone(const char *dname, struct hashbuf *htp, int class) {
const char *fname;
struct databuf *dp, *pdp;
struct namebuf *np;
struct hashbuf *phtp = htp;
int root_zone = 0;
int zone = zp - zones;
char *dname = zp->z_origin;
ns_debug(ns_log_default, 1, "purge_zone(%s)", dname);
ns_debug(ns_log_default, 1, "purge_zone(%s,%d)", dname, class);
if ((np = nlookup(dname, &phtp, &fname, 0)) && dname == fname &&
!ns_wildcard(NAME(*np))) {
for (pdp = NULL, dp = np->n_data; dp != NULL; (void)NULL) {
if (dp->d_zone == zone)
if (dp->d_class == class)
dp = rm_datum(dp, np, pdp, NULL);
else {
pdp = dp;
@@ -1422,7 +1398,7 @@ purge_zone(struct zoneinfo *zp, struct hashbuf *htp) {
h = htp;
else
h = np->n_hash;
purge_z_2(h, zone);
purge_z_2(h, class);
if (h->h_cnt == 0 && !root_zone) {
rm_hash(np->n_hash);
np->n_hash = NULL;
@@ -1435,7 +1411,10 @@ purge_zone(struct zoneinfo *zp, struct hashbuf *htp) {
}
static void
purge_z_2(struct hashbuf *htp, int zone) {
purge_z_2(htp, class)
struct hashbuf *htp;
int class;
{
struct databuf *dp, *pdp;
struct namebuf *np, *pnp, *npn;
struct namebuf **npp, **nppend;
@@ -1443,25 +1422,27 @@ purge_z_2(struct hashbuf *htp, int zone) {
nppend = htp->h_tab + htp->h_size;
for (npp = htp->h_tab; npp < nppend; npp++) {
for (pnp = NULL, np = *npp; np != NULL; np = npn) {
for (pdp = NULL, dp = np->n_data;
dp != NULL;
(void)NULL) {
if (dp->d_zone == zone)
dp = rm_datum(dp, np, pdp,
NULL);
else {
pdp = dp;
dp = dp->d_next;
if (!bottom_of_zone(np->n_data, class)) {
for (pdp = NULL, dp = np->n_data;
dp != NULL;
(void)NULL) {
if (dp->d_class == class)
dp = rm_datum(dp, np, pdp,
NULL);
else {
pdp = dp;
dp = dp->d_next;
}
}
}
if (np->n_hash) {
/* call recursively to rm subdomains */
purge_z_2(np->n_hash, zone);
if (np->n_hash) {
/* call recursively to rm subdomains */
purge_z_2(np->n_hash, class);
/* if now empty, free it */
if (np->n_hash->h_cnt == 0) {
rm_hash(np->n_hash);
np->n_hash = NULL;
/* if now empty, free it */
if (np->n_hash->h_cnt == 0) {
rm_hash(np->n_hash);
np->n_hash = NULL;
}
}
}
@@ -1823,12 +1804,12 @@ loadxfer(void) {
isixfr = ISIXFR;
} else {
tmpnom = zp->z_source;
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
isixfr = ISNOTIXFR;
}
if (zp->z_xferpid == XFER_ISAXFRIXFR) {
tmpnom= zp->z_source;
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
isixfr = ISNOTIXFR;
}
@@ -1911,7 +1892,7 @@ reload_master(struct zoneinfo *zp) {
(zp->z_flags & Z_NEED_DUMP) != 0))
(void) zonedump(zp, ISNOTIXFR);
#endif
purge_zone(zp, hashtab);
purge_zone(zp->z_origin, hashtab, zp->z_class);
ns_debug(ns_log_config, 1, "reloading zone");
#ifdef BIND_UPDATE
if ((zp->z_flags & Z_DYNAMIC) != 0) {
+1 -1
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ncache.c,v 8.30 2002/11/17 14:51:51 marka Exp $";
static const char rcsid[] = "$Id: ns_ncache.c,v 8.29.4.1 2002/11/14 13:41:31 marka Exp $";
#endif /* not lint */
/*
+4 -16
View File
@@ -1,6 +1,6 @@
%{
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: ns_parser.y,v 8.81.8.1 2003/06/02 09:56:35 marka Exp $";
static char rcsid[] = "$Id: ns_parser.y,v 8.80 2002/05/24 03:05:01 marka Exp $";
#endif /* not lint */
/*
@@ -158,7 +158,6 @@ int yyparse();
%token T_MAX_NCACHE_TTL T_HAS_OLD_CLIENTS T_RFC2308_TYPE1
%token T_LAME_TTL T_MIN_ROOTS
%token T_TREAT_CR_AS_SPACE
%token T_EDNS_UDP_SIZE
/* Items used for the "logging" statement: */
%token T_LOGGING T_CATEGORY T_CHANNEL T_SEVERITY T_DYNAMIC
@@ -610,16 +609,6 @@ option: /* Empty */
if ($2 >= 1)
current_options->minroots = $2;
}
|
| T_EDNS_UDP_SIZE L_NUMBER
{
if ($2 < 512)
current_options->edns_udp_size = 512;
else if ($2 > EDNS_MESSAGE_SZ)
current_options->edns_udp_size = EDNS_MESSAGE_SZ;
else
current_options->edns_udp_size = $2;
}
| error
;
@@ -722,7 +711,6 @@ ordering_type: /* nothing */
}
(void)freestr($2);
}
;
ordering_name: /* nothing */
{
@@ -738,7 +726,7 @@ ordering_name: /* nothing */
}
/* XXX Should do any more name validation here? */
}
;
rrset_ordering_element: ordering_class ordering_type ordering_name T_ORDER L_STRING
{
@@ -761,7 +749,7 @@ rrset_ordering_element: ordering_class ordering_type ordering_name T_ORDER L_STR
$$ = new_rrset_order_element($1, $2, $3, o);
}
}
;
transfer_format: T_ONE_ANSWER
{
@@ -1446,7 +1434,7 @@ key_list: key_list_element L_EOS
| error
;
dummy_key_list_element: key_ref { /* empty */ } ;
dummy_key_list_element: key_ref;
dummy_key_list: dummy_key_list_element L_EOS
| dummy_key_list dummy_key_list_element L_EOS
+29 -44
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91";
static const char rcsid[] = "$Id: ns_req.c,v 8.175.6.2 2003/06/02 09:56:35 marka Exp $";
static const char rcsid[] = "$Id: ns_req.c,v 8.169.2.1 2002/11/14 13:02:48 marka Exp $";
#endif /* not lint */
/*
@@ -563,9 +563,8 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
ns_name_rollback(cp, (const u_char **)dnptrs,
(const u_char **)dnptrs_end);
if (opt > 0) {
n = ns_add_opt(msg, cp, buflen_orig, 0, rcode,
server_options->edns_udp_size,
0, NULL, 0);
n = ns_add_opt(msg, cp, buflen_orig, 0,
rcode, EDNS_MESSAGE_SZ, 0, NULL, 0);
if (n < 0) {
hp->qdcount = htons(0);
goto sign_again;
@@ -605,9 +604,8 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
msglen += n;
if (opt > 0) {
buflen += opt_size;
n = ns_add_opt(msg, cp, msglen + buflen, 0, rcode,
server_options->edns_udp_size,
0, NULL, 0);
n = ns_add_opt(msg, cp, msglen + buflen, 0,
rcode, EDNS_MESSAGE_SZ, 0, NULL, 0);
INSIST(n > 0);
cp += n;
buflen -= n;
@@ -858,9 +856,6 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
DST_KEY *in_key = (in_tsig != NULL) ? in_tsig->key : NULL;
int access_class;
int adjustlen = 0;
int pass = 0;
char tsig_keyname_mesg[15+MAXDNAME] = "";
int glueok;
nameserIncr(from.sin_addr, nssRcvdQ);
@@ -905,6 +900,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
return (Finish);
}
*cpp += n;
answers = *cpp;
if (*cpp + 2 * INT16SZ > eom) {
ns_debug(ns_log_default, 1,
"FORMERR Query message length short");
@@ -1021,7 +1017,6 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
#endif /*QRYLOG*/
try_again:
pass++;
foundname = 0;
ns_debug(ns_log_default, 1, "req: nlookup(%s) id %d type=%d class=%d",
dname, ntohs(hp->id), type, class);
@@ -1308,19 +1303,13 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
return (Refuse);
}
if (in_key != NULL)
sprintf(tsig_keyname_mesg, " (TSIG key \"%s\")",
in_key->dk_key_name);
if (type == ns_t_ixfr)
ns_info(ns_log_security, "approved %s from %s for \"%s\"%s",
(ixfr_found) ? p_type(type) : "IXFR/AXFR",
sin_ntoa(from), *dname ? dname : ".",
tsig_keyname_mesg);
else
ns_info(ns_log_security, "approved %s from %s for \"%s\"%s",
p_type(type), sin_ntoa(from), *dname ? dname : ".",
tsig_keyname_mesg);
if (type == ns_t_ixfr) {
ns_info(ns_log_security, "approved %s from %s for \"%s\"",
(ixfr_found) ? p_type(type) : "IXFR/AXFR",
sin_ntoa(from), *dname ? dname : ".");
} else
ns_info(ns_log_security, "approved %s from %s for \"%s\"",
p_type(type), sin_ntoa(from), *dname ? dname : ".");
}
/*
@@ -1365,7 +1354,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
(dp->d_class == class)) {
#ifdef RETURNSOA
n = finddata(np, class, T_SOA, hp, &dname,
buflenp, &count, pass, 1);
buflenp, &count);
if (n != 0) {
if (count) {
*cpp += n;
@@ -1403,9 +1392,8 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
* If not NXDOMAIN, the NOERROR_NODATA record might be
* anywhere in the chain. Have to go through the grind.
*/
glueok = !NS_OPTION_P(OPTION_NORECURSE);
n = finddata(np, class, type, hp, &dname, buflenp, &count, pass,
glueok);
n = finddata(np, class, type, hp, &dname, buflenp, &count);
if (n == 0) {
/*
* NO data available. Refuse transfer requests, or
@@ -1521,8 +1509,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
ns_debug(ns_log_default, 3, "req: leaving (%s, rcode %d)",
dname, hp->rcode);
if (class != C_ANY) {
if (!cname)
hp->aa = 1;
hp->aa = 1;
if (np && (!foundname || !founddata)) {
n = doaddauth(hp, *cpp, *buflenp, np, nsp[0]);
*cpp += n;
@@ -2336,9 +2323,9 @@ doaddinfo(HEADER *hp, u_char *msg, int msglen) {
loop:
for (ap = addinfo, i = 0; i < addcount; ap++, i++) {
int auth = 0,
drop = 0,
founda = 0,
foundaaaa = 0,
founda6 = 0,
foundcname = 0,
save_count = count,
save_msglen = msglen;
@@ -2366,11 +2353,12 @@ loop:
if (dp->d_class != ap->a_class)
continue;
if (dp->d_rcode == NXDOMAIN) {
founda = foundaaaa = 1;
founda = founda6 = foundaaaa = 1;
continue;
}
switch (dp->d_type) {
case ns_t_a: founda = 1; break;
case ns_t_a6: founda6 = 1; break;
case ns_t_aaaa: foundaaaa = 1; break;
}
if (!dp->d_rcode && dp->d_type == T_CNAME) {
@@ -2378,7 +2366,8 @@ loop:
break;
}
if (auth == 0 && ap->a_type == T_A &&
(dp->d_type == ns_t_a || dp->d_type == ns_t_aaaa) &&
(dp->d_type == ns_t_a || dp->d_type == ns_t_a6 ||
dp->d_type == ns_t_aaaa) &&
(zones[dp->d_zone].z_type == z_master ||
zones[dp->d_zone].z_type == z_slave))
auth = 1;
@@ -2396,7 +2385,8 @@ loop:
}
if (ap->a_type == T_A &&
!match(dp, (int)ap->a_class, T_A) &&
!match(dp, (int)ap->a_class, T_AAAA)) {
!match(dp, (int)ap->a_class, T_AAAA) &&
!match(dp, (int)ap->a_class, ns_t_a6)) {
continue;
}
if (ap->a_type == T_KEY &&
@@ -2407,8 +2397,6 @@ loop:
continue;
if (dp->d_rcode)
continue;
if (drop)
continue;
/*
* Should be smart and eliminate duplicate
* data here. XXX
@@ -2438,14 +2426,7 @@ loop:
cp = save_cp;
msglen = save_msglen;
count = save_count;
/*
* Continue processing list to prevent
* unnecessary fetches for glue.
* Prevent partial RRsets being sent by
* setting drop.
*/
drop = 1;
continue;
break;
}
ns_debug(ns_log_default, 5,
"addinfo: adding address data n = %d", n);
@@ -2465,6 +2446,10 @@ loop:
(void) sysquery(ap->a_dname, (int)ap->a_class,
ns_t_aaaa, NULL, NULL, 0,
ns_port, QUERY, 0);
if (!founda6 && !auth)
(void) sysquery(ap->a_dname, (int)ap->a_class,
ns_t_a6, NULL, NULL, 0, ns_port,
QUERY, 0);
}
if (foundcname) {
if (!haveComplained(nhash(ap->a_dname),
+64 -69
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: ns_resp.c,v 8.186.6.5 2003/09/04 03:03:18 marka Exp $";
static const char rcsid[] = "$Id: ns_resp.c,v 8.178.2.2 2002/11/14 13:39:13 marka Exp $";
#endif /* not lint */
/*
@@ -270,8 +270,9 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
int i, c, n, qdcount, ancount, aucount, nscount, arcount, arfirst;
int soacount;
u_int qtype, qclass;
int restart; /* flag for processing cname response */
int validanswer, dbflags;
int cname, lastwascname, externalcname, cachenegative;
int cname, lastwascname, externalcname;
int count, founddata, foundname;
int buflen;
int newmsglen;
@@ -280,7 +281,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
char *dname, tmpdomain[MAXDNAME];
const char *fname;
const char *formerrmsg = "brain damage";
u_char newmsg[NS_MAXMSG];
u_char newmsg[EDNS_MESSAGE_SZ];
u_char **dpp, *tp;
time_t rtrip;
struct hashbuf *htp;
@@ -297,7 +298,6 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
time_t tsig_time;
DST_KEY *key;
int expect_cname;
int pass = 0;
nameserIncr(from.sin_addr, nssRcvdR);
nsp[0] = NULL;
@@ -905,13 +905,13 @@ tcp_retry:
tp = cp;
restart = 0;
validanswer = -1;
nscount = 0;
soacount = 0;
cname = 0;
lastwascname = 0;
externalcname = 0;
cachenegative = 1;
strcpy(aname, qname);
if (count) {
@@ -981,7 +981,6 @@ tcp_retry:
name);
db_detach(&dp);
validanswer = 0;
cachenegative = 0;
continue;
}
if (type == T_CNAME &&
@@ -1002,10 +1001,6 @@ tcp_retry:
tname = NULL;
}
/* Cache for current tick. */
if (type == T_SOA)
dp->d_ttl = tt.tv_sec;
dp->d_cred = (hp->aa && ns_samename(name, qname) == 1)
? DB_C_AUTH
: DB_C_ANSWER;
@@ -1016,7 +1011,6 @@ tcp_retry:
"last was cname, ignoring auth. and add.");
db_detach(&dp);
validanswer = 0;
cachenegative = 0;
break;
}
if (i < arfirst) {
@@ -1032,7 +1026,6 @@ tcp_retry:
sin_ntoa(from));
db_detach(&dp);
validanswer = 0;
cachenegative = 0;
continue;
} else if (!ns_samedomain(name,
qp->q_domain)) {
@@ -1046,7 +1039,6 @@ tcp_retry:
sin_ntoa(from));
db_detach(&dp);
validanswer = 0;
cachenegative = 0;
continue;
}
if (type == T_NS) {
@@ -1056,9 +1048,6 @@ tcp_retry:
}
if (type == T_SOA) {
soacount++;
/* -ve caching only. */
db_detach(&dp);
continue;
}
break;
case T_NXT:
@@ -1193,6 +1182,38 @@ tcp_retry:
return;
}
if (ancount && count && validanswer != 1) {
/*
* Everything passed validation but we didn't get the
* final answer. The response must have contained
* a dangling CNAME. Force a restart of the query.
*
* Don't set restart if count==0, since this means
* the response was truncated in the answer section,
* causing us to set count to 0 which will cause
* validanswer to be 0 as well even though the answer
* section probably contained valid RRs (just not
* a complete set).
* XXX - this works right if we can just forward this
* response to the client, but not if we found a CNAME
* in a prior response and restarted the query.
*/
restart = 1;
}
if (!restart && !qp->q_cmsglen && ancount > 1 && qtype == T_A)
sort_response(tp, eom, ancount, &qp->q_from);
/*
* An answer to a T_ANY query or a successful answer to a
* regular query with no indirection, then just return answer.
*/
if (!restart && ancount && (qtype == T_ANY || !qp->q_cmsglen)) {
ns_debug(ns_log_default, 3,
"resp: got as much answer as there is");
goto return_msg;
}
/*
* We might want to cache this negative answer.
*
@@ -1210,9 +1231,8 @@ tcp_retry:
)
)
{
if (cachenegative)
cache_n_resp(msg, msglen, from, qp->q_name,
qp->q_class, qp->q_type);
cache_n_resp(msg, msglen, from, qp->q_name,
qp->q_class, qp->q_type);
if (!qp->q_cmsglen && validanswer) {
ns_debug(ns_log_default, 3,
@@ -1269,20 +1289,11 @@ tcp_retry:
goto servfail;
}
cp += n + QFIXEDSZ;
buflen = (qp->q_stream != NULL) ? NS_MAXMSG :
MIN(EDNS_MESSAGE_SZ, qp->q_udpsize);
buflen -= (cp - newmsg);
/*
* Reserve space for TSIG / EDNS
*/
if (qp->q_tsig != NULL)
buflen -= qp->q_tsig->tsig_size;
if ((qp->q_flags & Q_EDNS) != 0)
buflen -= 11;
buflen = sizeof(newmsg) - (cp - newmsg);
cname = 0;
try_again:
pass++;
ns_debug(ns_log_default, 1, "resp: nlookup(%s) qtype=%d", dname,
qtype);
foundname = 0;
@@ -1305,7 +1316,7 @@ tcp_retry:
(dp->d_class == (int)qclass)) {
#ifdef RETURNSOA
n = finddata(np, qclass, T_SOA, hp, &dname,
&buflen, &count, pass, 1);
&buflen, &count);
if ( n != 0) {
if (count) {
cp += n;
@@ -1337,7 +1348,7 @@ tcp_retry:
goto fetch_ns;
}
}
n = finddata(np, qclass, qtype, hp, &dname, &buflen, &count, pass, 1);
n = finddata(np, qclass, qtype, hp, &dname, &buflen, &count);
if (n == 0)
goto fetch_ns; /* NO data available */
if (hp->rcode) {
@@ -1388,8 +1399,7 @@ tcp_retry:
if (!foundname)
hp->rcode = NXDOMAIN;
if (qclass != C_ANY) {
if (!cname)
hp->aa = 1;
hp->aa = 1;
if (np && (!foundname || !founddata)) {
n = doaddauth(hp, cp, buflen, np, nsp[0]);
cp += n;
@@ -1543,8 +1553,7 @@ tcp_retry:
if (!qp->q_addr[0].noedns)
smsglen += ns_add_opt(smsg, smsg + smsglen, smsgsize, 0, 0,
server_options->edns_udp_size,
0, NULL, 0);
EDNS_MESSAGE_SZ, 0, NULL, 0);
if (key != NULL) {
n = ns_sign(smsg, &smsglen, smsgsize, NOERROR, key, NULL, 0,
sig, &siglen, 0);
@@ -2230,7 +2239,7 @@ send_msg(u_char *msg, int msglen, struct qinfo *qp) {
if (qp->q_flags & Q_SYSTEM)
return (1);
trunc = (qp->q_stream != NULL) ? NS_MAXMSG : qp->q_udpsize;
trunc = (qp->q_stream != NULL) ? 65535 : qp->q_udpsize;
if (qp->q_tsig != NULL)
adjust += qp->q_tsig->tsig_size;
if ((qp->q_flags & Q_EDNS) != 0)
@@ -2274,9 +2283,8 @@ send_msg(u_char *msg, int msglen, struct qinfo *qp) {
msgsize = msglen; /* silence compiler */
if ((qp->q_flags & Q_EDNS) != 0)
msglen += ns_add_opt(msg, msg + msglen, msgsize, 0, hp->rcode,
server_options->edns_udp_size,
0, NULL, 0);
msglen += ns_add_opt(msg, msg + msglen, msgsize, 0,
hp->rcode, EDNS_MESSAGE_SZ, 0, NULL, 0);
if (qp->q_tsig != NULL) {
u_char sig[TSIG_SIG_SIZE];
@@ -2484,7 +2492,6 @@ sysquery(const char *dname, int class, int type,
qs->stime = tt;
qs->forwarder = 0;
qs->noedns = 1; /* XXXMPA */
qs->lame = 0;
qs->nretry = 0;
}
qp->q_naddr = nsc;
@@ -2574,8 +2581,7 @@ sysquery(const char *dname, int class, int type,
if (!qp->q_addr[0].noedns)
smsglen += ns_add_opt(smsg, smsg + smsglen, smsgsize, 0, 0,
server_options->edns_udp_size,
0, NULL, 0);
EDNS_MESSAGE_SZ, 0, NULL, 0);
if (key != NULL) {
n = ns_sign(smsg, &smsglen, smsgsize, NOERROR, key, NULL, 0,
@@ -2902,8 +2908,7 @@ findns(struct namebuf **npp, int class,
}
ns_debug(ns_log_default, 1,
"findns: No root nameservers for class %s?", p_class(class));
if (!NS_OPTION_P(OPTION_FORWARD_ONLY) &&
(unsigned)class < MAXCLASS && norootlogged[class] == 0) {
if ((unsigned)class < MAXCLASS && norootlogged[class] == 0) {
norootlogged[class] = 1;
ns_info(ns_log_default, "No root nameservers for class %s",
p_class(class));
@@ -2919,8 +2924,7 @@ findns(struct namebuf **npp, int class,
*/
int
finddata(struct namebuf *np, int class, int type,
HEADER *hp, char **dnamep, int *lenp, int *countp, int pass,
int glueok)
HEADER *hp, char **dnamep, int *lenp, int *countp)
{
struct databuf *dp;
char *cp;
@@ -2958,8 +2962,18 @@ finddata(struct namebuf *np, int class, int type,
cp = ((char *)hp) + *countp;
foundcname = 0;
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if (!wanted(dp, class, type))
if (!wanted(dp, class, type)) {
if (type == T_CNAME && class == dp->d_class) {
/* any data means no CNAME exists */
if (dp->d_type != T_NXT &&
dp->d_type != T_KEY &&
dp->d_type != T_SIG) {
ret = 0;
goto done;
}
}
continue;
}
if (dp->d_cred == DB_C_ADDITIONAL) {
#ifdef NOADDITIONAL
continue;
@@ -2989,7 +3003,7 @@ finddata(struct namebuf *np, int class, int type,
*dnamep, type, class);
continue;
}
if (type == T_ANY && dp->d_type != T_ANY)
if (type == T_ANY)
continue;
hp->rcode = NOERROR_NODATA;
if (dp->d_size == 0) { /* !RETURNSOA */
@@ -3024,10 +3038,6 @@ finddata(struct namebuf *np, int class, int type,
(!((dp->d_type == T_SIG) || (dp->d_type == T_KEY))) )
continue;
/* Don't return glue (NS/A/AAAA) */
if (!glueok && findMyZone(np, class) == DB_Z_CACHE)
continue;
if (!defer) {
if (foundcname != 0 && dp->d_type == T_CNAME)
continue;
@@ -3046,16 +3056,6 @@ finddata(struct namebuf *np, int class, int type,
if (dp->d_type == T_CNAME) {
foundcname = 1;
#define SETAA(pass, class, dp) \
(pass == 1 && class != C_ANY && dp->d_zone != DB_Z_CACHE && \
(zones[dp->d_zone].z_type == z_master || \
zones[dp->d_zone].z_type == z_slave) && \
(zones[dp->d_zone].z_flags & Z_AUTH) != 0)
if (SETAA(pass, class, dp))
hp->aa = 1;
#define FOLLOWCNAME(type) \
(type != T_KEY) && (type != T_SIG) && (type != T_NXT) && (type != T_ANY)
/* don't alias if querying for key, sig, nxt, or any */
@@ -3064,13 +3064,8 @@ finddata(struct namebuf *np, int class, int type,
new_dnamep = (char *)dp->d_data;
}
} else {
if (dp->d_type == T_CNAME) {
if (dp->d_type == T_CNAME)
foundcname = 1;
if (SETAA(pass, class, dp))
hp->aa = 1;
}
found[found_count++] = dp;
}
}
+3 -5
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_update.c,v 8.106 2002/07/19 22:44:07 marka Exp $";
static const char rcsid[] = "$Id: ns_update.c,v 8.104 2002/05/18 01:02:59 marka Exp $";
#endif /* not lint */
/*
@@ -1211,7 +1211,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
*/
if (!ip_addr_or_key_allowed(zp->z_update_acl, from.sin_addr, in_key)) {
ns_notice(ns_log_update_security,
ns_notice(ns_log_security,
"denied update from %s for \"%s\" %s",
sin_ntoa(from), *dname ? dname : ".", p_class(class));
nameserIncr(from.sin_addr, nssRcvdUUpd);
@@ -2638,10 +2638,8 @@ merge_logs(struct zoneinfo *zp, char *logname) {
err++;
break;
}
errno = 0;
n = strtoul(buf, &cp, 10);
if (errno != 0 || n > 0xffff ||
*cp != '\0') {
if (n > 0xffff || *cp != '\0') {
err++;
break;
}
+5 -8
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ndc.c,v 1.25 2003/04/03 05:42:10 marka Exp $";
static const char rcsid[] = "$Id: ndc.c,v 1.22 2002/06/24 07:28:55 marka Exp $";
#endif /* not lint */
/*
@@ -88,7 +88,7 @@ static void start_named(const char *, int);
static int fgetpid(const char *, pid_t *);
static int get_sockaddr(const char *, sockaddr_t *);
static size_t impute_addrlen(const struct sockaddr *);
static void vtrace(const char *, va_list) ISC_FORMAT_PRINTF(1, 0);
static void vtrace(const char *, va_list);
static void trace(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
static void result(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
static void fatal(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
@@ -283,7 +283,7 @@ getargs_closure(void *arg, const char *msg, int flags) {
}
len = 0;
cp = msg + 4;
while (*cp != '\0') {
while (*cp != NULL) {
c = *cp;
if (c == '%') {
cp2 = strchr(hexdigits, cp[1]);
@@ -325,7 +325,7 @@ getargs_closure(void *arg, const char *msg, int flags) {
}
cp = msg + 4;
tp = argv->argv[i];
while (*cp != '\0') {
while (*cp != NULL) {
c = *cp;
if (c == '%') {
cp2 = strchr(hexdigits, cp[1]);
@@ -374,8 +374,6 @@ get_args(char **restp) {
len = 0;
for (i = 1 ; i < argv.argc && argv.argv[i] != NULL; i++)
len += strlen(argv.argv[i]) + 1;
if (len == 0)
len = 1;
rest = malloc(len);
if (rest == NULL) {
result = 0;
@@ -388,8 +386,7 @@ get_args(char **restp) {
*p++ = ' ';
}
if (p != rest)
p--;
p[0] = '\0';
p[-1] = '\0';
*restp = rest;
err:
+2
View File
@@ -77,6 +77,7 @@ static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90";
* exit - exit the program
* root - set default server to the root
* ls NAME - list the domain NAME
* view FILE - sorts and view the file with more
* set OPTION - set an option
* help - print help information
* ? - print help information
@@ -102,6 +103,7 @@ static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90";
extern char rootServerName[];
extern void PrintHelp();
extern void ViewList(char *);
#define YY_INPUT(buf, result, max_size) \
{ \
+17 -16
View File
@@ -54,7 +54,7 @@
#ifndef lint
static const char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: getinfo.c,v 8.29.8.2 2003/06/02 09:24:39 marka Exp $";
static const char rcsid[] = "$Id: getinfo.c,v 8.27 2002/05/22 04:06:57 marka Exp $";
#endif /* not lint */
/*
@@ -112,7 +112,7 @@ ServerTable server[MAXSERVERS];
typedef union {
HEADER qb1;
u_char qb2[NS_MAXMSG];
u_char qb2[64*1024];
} querybuf;
typedef union {
@@ -150,14 +150,14 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
register const u_char *cp;
querybuf answer;
char **aliasPtr;
u_char *eom, *bp, *ep;
u_char *eom, *bp;
char **addrPtr;
int *lenPtr;
int *typePtr;
char *namePtr;
char *dnamePtr;
int type, class;
int qdcount, ancount, arcount, nscount;
int qdcount, ancount, arcount, nscount, buflen;
int origClass = 0;
int numAliases = 0;
int numAddresses = 0;
@@ -212,9 +212,9 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
}
bp = hostbuf;
ep = hostbuf + sizeof(hostbuf);
cp = (u_char *) &answer + HFIXEDSZ;
bp = hostbuf;
buflen = sizeof(hostbuf);
cp = (u_char *) &answer + HFIXEDSZ;
/* Skip over question section. */
while (qdcount-- > 0) {
@@ -257,7 +257,7 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
printedAnswers = TRUE;
} else {
while (--ancount >= 0 && cp < eom) {
n = dn_expand(answer.qb2, eom, cp, (char *)bp, ep - bp);
n = dn_expand(answer.qb2, eom, cp, (char *)bp, buflen);
if (n < 0)
return(ERROR);
cp += n;
@@ -282,12 +282,13 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
host_aliases_len[numAliases] = s;
numAliases++;
bp += s;
buflen -= s;
continue;
} else if (type == T_PTR) {
/*
* Found a "pointer" to the real name.
*/
n = dn_expand(answer.qb2, eom, cp, (char *)bp, ep - bp);
n = dn_expand(answer.qb2, eom, cp, (char *)bp, buflen);
if (n < 0) {
cp += n;
continue;
@@ -327,7 +328,7 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
memcpy(hostPtr->name, bp, s);
}
}
bp += (((size_t)bp) % sizeof(align));
bp += (((u_long)bp) % sizeof(align));
if (bp + dlen >= &hostbuf[sizeof(hostbuf)]) {
if (res.options & RES_DEBUG) {
@@ -467,7 +468,7 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
* that serve the requested domain.
*/
n = dn_expand(answer.qb2, eom, cp, (char *)bp, ep - bp);
n = dn_expand(answer.qb2, eom, cp, (char *)bp, buflen);
if (n < 0) {
return(ERROR);
}
@@ -490,7 +491,7 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
} else {
Boolean found;
n = dn_expand(answer.qb2, eom, cp, (char *)bp, ep - bp);
n = dn_expand(answer.qb2, eom, cp, (char *)bp, buflen);
if (n < 0) {
return(ERROR);
}
@@ -546,7 +547,7 @@ GetAnswer(union res_sockaddr_union *nsAddrPtr, int queryType,
}
} else {
while (--arcount >= 0 && cp < eom) {
n = dn_expand(answer.qb2, eom, cp, (char *)bp, ep - bp);
n = dn_expand(answer.qb2, eom, cp, (char *)bp, buflen);
if (n < 0) {
break;
}
@@ -944,7 +945,7 @@ GetHostInfoByAddr(union res_sockaddr_union *nsAddrPtr,
p[9] & 0xf, (p[9] >> 4) & 0xf,
p[8] & 0xf, (p[8] >> 4) & 0xf,
p[7] & 0xf, (p[7] >> 4) & 0xf,
p[6] & 0xf, (p[6] >> 4) & 0xf,
p[6] & 0xf, (p[4] >> 4) & 0xf,
p[5] & 0xf, (p[5] >> 4) & 0xf,
p[4] & 0xf, (p[4] >> 4) & 0xf,
p[3] & 0xf, (p[3] >> 4) & 0xf,
@@ -964,7 +965,7 @@ GetHostInfoByAddr(union res_sockaddr_union *nsAddrPtr,
p[9] & 0xf, (p[9] >> 4) & 0xf,
p[8] & 0xf, (p[8] >> 4) & 0xf,
p[7] & 0xf, (p[7] >> 4) & 0xf,
p[6] & 0xf, (p[6] >> 4) & 0xf,
p[6] & 0xf, (p[4] >> 4) & 0xf,
p[5] & 0xf, (p[5] >> 4) & 0xf,
p[4] & 0xf, (p[4] >> 4) & 0xf,
p[3] & 0xf, (p[3] >> 4) & 0xf,
@@ -1017,7 +1018,7 @@ GetHostInfoByAddr(union res_sockaddr_union *nsAddrPtr,
n = GetAnswer(nsAddrPtr, T_PTR, (char *) &buf, n, 1, hostPtr, 1, 0);
if (n == SUCCESS) {
hostPtr->addrList = (AddrInfo **)Calloc(2, sizeof(AddrInfo *));
hostPtr->addrList[0] = (AddrInfo *)Calloc(1, sizeof(AddrInfo));
hostPtr->addrList[0] = (AddrInfo *)Calloc(1, sizeof(AddrInfo *));
hostPtr->addrList[0]->addr = Calloc(16, sizeof(char));
memcpy(hostPtr->addrList[0]->addr, p, 16);
hostPtr->addrList[0]->addrType = AF_INET6;
+2 -2
View File
@@ -78,7 +78,7 @@ char copyright[] =
#ifndef lint
static const char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: main.c,v 8.25 2003/01/26 11:38:56 marka Exp $";
static const char rcsid[] = "$Id: main.c,v 8.24 2002/05/26 03:12:20 marka Exp $";
#endif /* not lint */
/*
@@ -607,7 +607,7 @@ SetDefaultServer(string, local)
UnionFromAddr(&servAddr, defaultPtr->addrList[0]->addrType,
defaultPtr->addrList[0]->addr);
} else {
UnionFromAddr(&servAddr, defaultPtr->servers[0]->addrList[0]->addrType,
UnionFromAddr(&servAddr, defaultPtr->addrList[0]->addrType,
defaultPtr->servers[0]->addrList[0]->addr);
}
+2 -2
View File
@@ -53,7 +53,7 @@
#ifndef lint
static const char sccsid[] = "@(#)send.c 5.18 (Berkeley) 3/2/91";
static const char rcsid[] = "$Id: send.c,v 8.14.10.1 2003/06/02 05:59:56 marka Exp $";
static const char rcsid[] = "$Id: send.c,v 8.14 2002/05/10 04:35:09 marka Exp $";
#endif /* not lint */
/*
@@ -181,7 +181,7 @@ SendRequest(union res_sockaddr_union *nsAddrPtr, const u_char *buf,
/*
* Send length & message
*/
ns_put16(buflen, (u_char *)&len);
__putshort(buflen, (u_char *)&len);
iov[0].iov_base = (caddr_t)&len;
iov[0].iov_len = INT16SZ;
DE_CONST(buf, iov[1].iov_base);
+6 -7
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: nsupdate.c,v 8.30 2003/04/03 05:51:07 marka Exp $";
static const char rcsid[] = "$Id: nsupdate.c,v 8.27 2001/06/18 14:43:46 marka Exp $";
#endif /* not lint */
/*
@@ -155,6 +155,9 @@ main(int argc, char **argv) {
struct map *mp;
ns_updrec *rrecp;
ns_updque listuprec;
extern int getopt();
extern char *optarg;
extern int optind, opterr, optopt;
ns_tsig_key key;
char *keyfile=NULL, *keyname=NULL;
@@ -395,15 +398,11 @@ main(int argc, char **argv) {
(void) getword_str(buf2, sizeof buf2, &startp, endp);
if (isdigit(buf2[0])) { /* ttl */
u_long tmp_ttl;
errno = 0;
tmp_ttl = strtoul(buf2, 0, 10);
if ((errno == ERANGE && tmp_ttl == ULONG_MAX) ||
tmp_ttl > 0x7fffffffUL) {
r_ttl = strtoul(buf2, 0, 10);
if (errno == ERANGE && r_ttl == ULONG_MAX) {
fprintf(stderr, "oversized ttl: %s\n", buf2);
exit (1);
}
r_ttl = tmp_ttl;
(void) getword_str(buf2, sizeof buf2, &startp, endp);
}
+1 -12
View File
@@ -70,7 +70,6 @@ options {
[ <A HREF="#sortlist">sortlist</A> { <VAR>address_match_list</VAR> }; ]
[ rrset-order { <VAR>order_spec</VAR> ; [ <VAR>order_spec</VAR> ; ... ] }; ]
[ preferred-glue ( A | AAAA ); ]
[ edns-udp-size <VAR>number</VAR>; ]
};
</PRE>
<HR>
@@ -820,16 +819,6 @@ the answer to a priming query. This can be achieved by setting
<CODE>preferred-glue A;</CODE> which will add A records before other types
in the additional section.
<H4>EDNS</H4>
Some firewalls fail to pass EDNS/UDP messages that are larger than
certain size, 512 or the UDP reassembly buffer. To allow EDNS to
work across such firewalls it is necessary to advertise a EDNS
buffer size that is small enough to not trigger failures.
<CODE>edns-udp-size</CODE> can be use to adjust the advertised size.
Values less than 512 will be increased to 512 and values greater than
4096 will be truncated to 4096.
<H4>Tuning</H4>
<DL>
@@ -858,7 +847,7 @@ request for the root servers to be accepted. Default 2.
<HR>
<ADDRESS>
Last Updated: $Id: options.html,v 1.49.6.1 2003/06/02 09:56:33 marka Exp $
Last Updated: $Id: options.html,v 1.49 2002/09/09 00:19:17 marka Exp $
</ADDRESS>
</BODY>
</HTML>
+3 -3
View File
@@ -1,5 +1,5 @@
.\" $FreeBSD$
.\" $Id: dig.1,v 8.11 2003/04/03 05:52:34 marka Exp $
.\" $Id: dig.1,v 8.9 2002/06/18 01:53:43 marka Exp $
.\"
.\" ++Copyright++ 1993
.\" -
@@ -246,7 +246,7 @@ one can simply
.It Fl x Ar IPv6-address
Convenient form to specify inverse address mapping.
Instead of
.Dq Ic dig 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa ,
.Dq Ic dig 1.0.0.0.0.0.0.0.0.0.0.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa ,
one can simply
.Dq Ic dig -x ::1 .
.It Fl f Ar file
@@ -685,7 +685,7 @@ authored by Andrew Cherenson.
.Sh BUGS
.Ic Dig
has a serious case of "creeping featurism" -- the result of
considering several potential uses during its development. It would
considering several potential uses during it's development. It would
probably benefit from a rigorous diet. Similarly, the print flags
and granularity of the items they specify make evident their
rather ad hoc genesis.
+1 -28
View File
@@ -61,7 +61,7 @@
.\" THE SOFTWARE IS PROVIDED "AS IS" AND CHECK POINT SOFTWARE TECHNOLOGIES
.\" INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
.\" IN NO EVENT SHALL CHECK POINT SOFTWARE TECHNOLOGIES INCORPORATED
.\" IN NO EVENT SHALL CHECK POINT SOFTWARE TECHNOLOGIES INCORPRATED
.\" BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
@@ -87,11 +87,7 @@
.Op Fl i Ar ixfr_file
.Op Fl t Ar trace_file
.Op Fl p Ar port#
.Op Fl C Ar class
.Op Fl S
.Op Fl q
.Op Fl x Ar src_address
.Op Fl T Ar tsig_file
.Ar nameserver
.Op Sy axfr | ixfr
.Sh DESCRIPTION
@@ -148,9 +144,6 @@ as returned by
.Xr getservbyname @LIB_NETWORK_EXT@
for the service
.Dq Li domain .
.It Fl C Ar class
Defines which class to use.
Defaults to 'IN'.
.It Fl S
Perform a restricted transfer of only the SOA, NS records and glue A records
for the zone. The SOA record will not be loaded by
@@ -161,26 +154,6 @@ determine when to verify the NS records. See the
directive in
.Xr @INDOT@named @SYS_OPS_EXT@
for more information.
.It Fl q
Tells @INDOT@named-xfer to be quiet.
.It Fl x Ar src_address
Specifies the source address to use for this query.
.It Fl T Ar tsig_file
Specifies a file to transfer TSIG information to @INDOT@named-xfer.
Multiple entries of the following format:
.Pp
.Bl -hang -width "IP address" -compact
.It IP address
When connecting to this address use this TSIG key.
.It key name
.It algorithm
157 (HMAC-MD5) is the only algorithm supported.
.It key data
base64
.El
.Pp
@INDOT@named-xfer expects this file to be temporary in nature and
will explicitly delete this file after its use.
.El
.Pp
Additional arguments are taken as name server addresses in so-called
+1 -1
View File
@@ -205,7 +205,7 @@ specified may be either a groupname or a numeric group id.
.Pp
.It Fl t Ar directory
Specifies the directory the server should chroot() into as soon as it is
finished processing command line arguments.
finshed processing command line arguments.
.Pp
.It Fl w Ar directory
Sets the working directory of the server. The
+4 -15
View File
@@ -767,7 +767,6 @@ options {
[ sortlist { \fIaddress_match_list\fR }; ]
[ rrset-order { \fIorder_spec\fR ; [ \fIorder_spec\fR ; ... ] }; ]
[ preferred-glue ( A | AAAA ); ]
[ edns-udp-size \fInumber\fR; ]
};
.Ed
.Ss Definition and Usage
@@ -955,7 +954,7 @@ with
.Ic maintain-ixfr-base ,
and
.Ic rfc2308-type1
is order dependent.
is order dependant.
.It Ic host-statistics
If
.Li yes ,
@@ -969,7 +968,7 @@ can consume huge amounts of memory.
.It Ic maintain-ixfr-base
If
.Li yes ,
a IXFR database file is kept for all dynamically updated zones.
a IXFR database file is kept for all dynamicaly updated zones.
This enables the server to answer IXFR queries which can speed up
zone transfers enormously.
The default is
@@ -1286,7 +1285,7 @@ address must appear in the remote end's
.Nm allow-transfer
option for the zones being transferred, if one is specified. This statement sets the
.Nm transfer-source
for all zones, but can be overridden on a per-zone basis by including a
for all zones, but can be overriden on a per-zone basis by includinga
.Nm transfer-source
statement within the zone block in the configuration file.
.El
@@ -1553,16 +1552,6 @@ in the answer to a priming query.
This can be achieved by setting
.Ic preferred-glue A;
which will add A records before other types in the additional section.
.Ss EDNS
Some firewalls fail to pass EDNS/UDP messages that are larger than
certain size, 512 or the UDP reassembly buffer.
To allow EDNS to
work across such firewalls it is necessary to advertise a EDNS
buffer size that is small enough to not trigger failures.
.Ic edns-udp-size
can be use to adjust the advertised size.
Values less than 512 will be increased to 512 and values greater than
4096 will be truncated to 4096.
.Ss Tuning
.Bl -tag -width 0n
.It Ic lame-ttl
@@ -1982,7 +1971,7 @@ statement, to be used for transaction security when talking to the
remote server.
The
.Ic key
statement must come before the
statememnt must come before the
.Ic server
statement that references it.
.Pp
+2 -47
View File
@@ -16,7 +16,7 @@
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
.\" $Id: resolver.3,v 8.17.6.1 2003/06/02 09:11:27 marka Exp $
.\" $Id: resolver.3,v 8.17 2002/08/07 03:47:33 marka Exp $
.\"
.Dd July 4, 2000
.Dt RESOLVER @LIB_NETWORK_EXT_U@
@@ -37,8 +37,6 @@
.Nm res_nclose ,
.Nm res_nsendsigned ,
.Nm res_findzonecut ,
.Nm res_getservers ,
.Nm res_setservers ,
.Nm dn_comp ,
.Nm dn_expand ,
.Nm hstrerror ,
@@ -61,26 +59,16 @@
.Fd #include <netinet/in.h>
.Fd #include <arpa/nameser.h>
.Fd #include <resolv.h>
.Fd #include <res_update.h>
.Vt typedef struct __res_state *res_state ;
.Pp
.Ft int
.Fn res_ninit "res_state statp"
.Ft int
.Fn res_ourserver_p "const res_state statp" "const struct sockaddr_in *addr"
.Ft void
.Fn fp_resstat "const res_state statp" "FILE *fp"
.Ft "const char *"
.Fn res_hostalias "const res_state statp" "const char *name" "char *buf" "size_t buflen"
.Ft int
.Fn res_pquery "const res_state statp" "const u_char *msg" "int msglen" "FILE *fp"
.Ft int
.Fn res_nquery "res_state statp" "const char *dname" "int class" "int type" "u_char *answer" "int anslen"
.Ft int
.Fn res_nsearch "res_state statp" "const char *dname" "int class" "int type" "u_char * answer" "int anslen"
.Ft int
.Fn res_nquerydomain "res_state statp" "const char *name" "const char *domain" "int class" "int type" "u_char *answer" "int anslen"
.Ft int
.Fo res_nmkquery
.Fa "res_state statp"
.Fa "int op"
@@ -93,51 +81,28 @@
.Fa "u_char *buf"
.Fa "int buflen"
.Fc
.Ft int
.Fn res_nsend "res_state statp" "const u_char *msg" "int msglen" "u_char *answer" "int anslen"
.Ft int
.Fn res_nupdate "res_state statp" "ns_updrec *rrecp_in"
.Ft int
.Fn res_nmkupdate "res_state statp" "ns_updrec *rrecp_in" "u_char *buf" "int buflen"
.Ft void
.Fn res_nclose "res_state statp"
.Ft int
.Fn res_nsendsigned "res_state statp" "const u_char *msg" "int msglen" "ns_tsig_key *key" "u_char *answer" "int anslen"
.Ft int
.Fn res_findzonecut "res_state statp" "const char *dname" "ns_class class" "int options" "char *zname" "size_t zsize" "struct in_addr *addrs" "int naddrs"
.Ft int
.Fn res_getservers "res_state statp" "union res_sockaddr_union *set" "int cnt"
.Ft void
.Fn res_setservers "res_state statp" "const union res_sockaddr_union *set" "int cnt"
.Ft int
.Fn dn_comp "const char *exp_dn" "u_char *comp_dn" "int length" "u_char **dnptrs" "u_char **lastdnptr"
.Ft int
.Fn dn_expand "const u_char *msg" "const u_char *eomorig" "const u_char *comp_dn" "char *exp_dn" "int length"
.Ft "const char *"
.Fn hstrerror "int err"
.Ss DEPRECATED
.Fd #include <sys/types.h>
.Fd #include <netinet/in.h>
.Fd #include <arpa/nameser.h>
.Fd #include <resolv.h>
.Fd #include <res_update.h>
.Ft int
.Fn res_init "void"
.Ft int
.Fn res_isourserver "const struct sockaddr_in *addr"
.Ft int
.Fn fp_nquery "const u_char *msg" "int msglen" "FILE *fp"
.Ft void
.Fn p_query "const u_char *msg" "FILE *fp"
.Ft "const char *"
.Fn hostalias "const char *name"
.Ft int
.Fn res_query "const char *dname" "int class" "int type" "u_char *answer" "int anslen"
.Ft int
.Fn res_search "const char *dname" "int class" "int type" "u_char *answer" "int anslen"
.Ft int
.Fn res_querydomain "const char *name" "const char *domain" "int class" "int type" "u_char *answer" "int anslen"
.Ft int
.Fo res_mkquery
.Fa "int op"
.Fa "const char *dname"
@@ -149,13 +114,9 @@
.Fa "u_char *buf"
.Fa "int buflen"
.Fc
.Ft int
.Fn res_send "const u_char *msg" "int msglen" "u_char *answer" "int anslen"
.Ft int
.Fn res_update "ns_updrec *rrecp_in"
.Ft void
.Fn res_close "void"
.Ft void
.Fn herror "const char *s"
.Sh DESCRIPTION
These routines are used for making, sending and interpreting
@@ -491,12 +452,6 @@ to store the result in,
uses a static buffer.
.Pp
The functions
.Fn res_getservers
and
.Fn res_setservers
are used to get and set the list of server to be queried.
.Pp
The functions
.Fn res_nupdate
/
.Fn res_update
@@ -650,4 +605,4 @@ See
.Xr resolver @FORMAT_EXT@ ;
RFC1032, RFC1033, RFC1034, RFC1035, RFC974;
SMM:11,
.Dq Name Server Operations Guide for BIND
.Dq Name Server Operations Guide for Sy BIND
+3 -5
View File
@@ -49,7 +49,7 @@
*/
/*
* $Id: nameser.h,v 8.48.8.2 2003/06/02 09:24:40 marka Exp $
* $Id: nameser.h,v 8.47 2002/04/30 03:43:53 marka Exp $
*/
#ifndef _ARPA_NAMESER_H_
@@ -78,9 +78,8 @@
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
*/
#define NS_PACKETSZ 512 /* default UDP packet size */
#define NS_PACKETSZ 512 /* maximum packet size */
#define NS_MAXDNAME 1025 /* maximum domain name */
#define NS_MAXMSG 65535 /* maximum message size */
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
#define NS_MAXLABEL 63 /* maximum length of domain label */
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
@@ -295,7 +294,6 @@ typedef enum __ns_type {
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
ns_t_apl = 42, /* Address prefix list (RFC 3123) */
ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
@@ -400,7 +398,7 @@ typedef enum __ns_cert_types {
/* Signatures */
#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
#define NS_MD5RSA_MAX_BITS 4096
#define NS_MD5RSA_MAX_BITS 2552
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
/* Max length of text sig block */
+1 -2
View File
@@ -32,7 +32,7 @@
/*
* from nameser.h 8.1 (Berkeley) 6/2/93
* $Id: nameser_compat.h,v 8.15 2002/07/17 07:01:02 marka Exp $
* $Id: nameser_compat.h,v 8.14 2002/05/18 01:39:11 marka Exp $
*/
#ifndef _ARPA_NAMESER_COMPAT_
@@ -138,7 +138,6 @@ typedef struct {
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
#define INT8SZ NS_INT8SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
+10 -8
View File
@@ -20,19 +20,21 @@
*/
/*
* $Id: hesiod.h,v 1.7.20.1 2003/06/02 05:48:04 marka Exp $
* $Id: hesiod.h,v 1.7 1999/01/08 19:22:45 vixie Exp $
*/
#ifndef _HESIOD_H_INCLUDED
#define _HESIOD_H_INCLUDED
int hesiod_init __P((void **));
void hesiod_end __P((void *));
char * hesiod_to_bind __P((void *, const char *, const char *));
char ** hesiod_resolve __P((void *, const char *, const char *));
void hesiod_free_list __P((void *, char **));
struct __res_state * __hesiod_res_get __P((void *));
void __hesiod_res_set __P((void *, struct __res_state *,
int hesiod_init __P((void **context));
void hesiod_end __P((void *context));
char * hesiod_to_bind __P((void *context, const char *name,
const char *type));
char ** hesiod_resolve __P((void *context, const char *name,
const char *type));
void hesiod_free_list __P((void *context, char **list));
struct __res_state * __hesiod_res_get __P((void *context));
void __hesiod_res_set __P((void *context, struct __res_state *,
void (*)(void *)));
#endif /*_HESIOD_H_INCLUDED*/
+12 -16
View File
@@ -16,7 +16,7 @@
*/
/*
* $Id: irp.h,v 8.1.20.3 2003/06/02 08:20:37 marka Exp $
* $Id: irp.h,v 8.1 1999/01/18 07:46:46 vixie Exp $
*/
#ifndef _IRP_H_INCLUDED
@@ -84,20 +84,16 @@
struct irp_p;
char *irs_irp_read_body(struct irp_p *, size_t *);
int irs_irp_read_response(struct irp_p *, char *, size_t);
void irs_irp_disconnect(struct irp_p *);
int irs_irp_connect(struct irp_p *);
int irs_irp_is_connected(struct irp_p *);
int irs_irp_connection_setup(struct irp_p *, int *);
#ifdef __GNUC__
int irs_irp_send_command(struct irp_p *, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
#else
int irs_irp_send_command(struct irp_p *, const char *, ...);
#endif
int irs_irp_get_full_response(struct irp_p *, int *, char *, size_t,
char **, size_t *);
int irs_irp_read_line(struct irp_p *, char *, int);
char *irs_irp_read_body(struct irp_p *pvt, size_t *size);
int irs_irp_read_response(struct irp_p *pvt, char *text, size_t len);
void irs_irp_disconnect(struct irp_p *pvt);
int irs_irp_connect(struct irp_p *pvt);
int irs_irp_is_connected(struct irp_p *pvt);
int irs_irp_connection_setup(struct irp_p *cxndata, int *warned);
int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...);
int irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text,
size_t textlen, char **body,
size_t *bodylen);
int irs_irp_read_line(struct irp_p *pvt, char *buffer, int len);
#endif
+90 -105
View File
@@ -16,7 +16,7 @@
*/
/*
* $Id: irs.h,v 8.7.6.2 2003/06/02 06:06:58 marka Exp $
* $Id: irs.h,v 8.6 2001/05/29 05:47:00 marka Exp $
*/
#ifndef _IRS_H_INCLUDED
@@ -30,6 +30,7 @@
#include <netdb.h>
#include <resolv.h>
#include <pwd.h>
#include <netgroup.h>
/*
* This is the group map class.
@@ -198,58 +199,18 @@ struct nwent {
#define irs_dns_acc __irs_dns_acc
#define irs_nis_acc __irs_nis_acc
#define irs_irp_acc __irs_irp_acc
#define irs_destroy __irs_destroy
#define irs_dns_gr __irs_dns_gr
#define irs_dns_ho __irs_dns_ho
#define irs_dns_nw __irs_dns_nw
#define irs_dns_pr __irs_dns_pr
#define irs_dns_pw __irs_dns_pw
#define irs_dns_sv __irs_dns_sv
#define irs_gen_gr __irs_gen_gr
#define irs_gen_ho __irs_gen_ho
#define irs_gen_ng __irs_gen_ng
#define irs_gen_nw __irs_gen_nw
#define irs_gen_pr __irs_gen_pr
#define irs_gen_pw __irs_gen_pw
#define irs_gen_sv __irs_gen_sv
#define irs_irp_get_full_response __irs_irp_get_full_response
#define irs_irp_gr __irs_irp_gr
#define irs_irp_ho __irs_irp_ho
#define irs_irp_is_connected __irs_irp_is_connected
#define irs_irp_ng __irs_irp_ng
#define irs_irp_nw __irs_irp_nw
#define irs_irp_pr __irs_irp_pr
#define irs_irp_pw __irs_irp_pw
#define irs_irp_read_line __irs_irp_read_line
#define irs_irp_sv __irs_irp_sv
#define irs_lcl_gr __irs_lcl_gr
#define irs_lcl_ho __irs_lcl_ho
#define irs_lcl_ng __irs_lcl_ng
#define irs_lcl_nw __irs_lcl_nw
#define irs_lcl_pr __irs_lcl_pr
#define irs_lcl_pw __irs_lcl_pw
#define irs_lcl_sv __irs_lcl_sv
#define irs_nis_gr __irs_nis_gr
#define irs_nis_ho __irs_nis_ho
#define irs_nis_ng __irs_nis_ng
#define irs_nis_nw __irs_nis_nw
#define irs_nis_pr __irs_nis_pr
#define irs_nis_pw __irs_nis_pw
#define irs_nis_sv __irs_nis_sv
#define net_data_create __net_data_create
#define net_data_destroy __net_data_destroy
#define net_data_minimize __net_data_minimize
/*
* Externs.
*/
extern struct irs_acc * irs_gen_acc __P((const char *, const char *));
extern struct irs_acc * irs_lcl_acc __P((const char *));
extern struct irs_acc * irs_dns_acc __P((const char *));
extern struct irs_acc * irs_nis_acc __P((const char *));
extern struct irs_acc * irs_irp_acc __P((const char *));
extern struct irs_acc * irs_gen_acc __P((const char *options,
const char *conf_file));
extern struct irs_acc * irs_lcl_acc __P((const char *options));
extern struct irs_acc * irs_dns_acc __P((const char *options));
extern struct irs_acc * irs_nis_acc __P((const char *options));
extern struct irs_acc * irs_irp_acc __P((const char *options));
extern void irs_destroy __P((void));
extern void irs_destroy(void);
/*
* These forward declarations are for the semi-private functions in
@@ -268,78 +229,102 @@ struct net_data; /* forward */
* the default interface will use net_data_create by default. Servers will
* probably want net_data_init (one call per client)
*/
struct net_data *net_data_create __P((const char *));
struct net_data *net_data_init __P((const char *));
void net_data_destroy __P((void *));
struct net_data *net_data_create(const char *conf_file);
struct net_data *net_data_init(const char *conf_file);
void net_data_destroy(void *p);
extern struct group *getgrent_p __P((struct net_data *));
extern struct group *getgrnam_p __P((const char *, struct net_data *));
extern struct group *getgrgid_p __P((gid_t, struct net_data *));
extern int setgroupent_p __P((int, struct net_data *));
extern void endgrent_p __P((struct net_data *));
extern int getgrouplist_p __P((const char *, gid_t, gid_t *, int *,
struct net_data *));
extern struct group *getgrent_p __P((struct net_data *net_data));
extern struct group *getgrnam_p __P((const char *name,
struct net_data *net_data));
extern struct group *getgrgid_p __P((gid_t gid,
struct net_data *net_data));
extern int setgroupent_p __P((int stayopen,
struct net_data *net_data));
extern void endgrent_p __P((struct net_data *net_data));
extern int getgrouplist_p __P((const char *name,
gid_t basegid,
gid_t *groups,
int *ngroups,
struct net_data *net_data));
#ifdef SETGRENT_VOID
extern void setgrent_p __P((struct net_data *));
extern void setgrent_p __P((struct net_data *net_data));
#else
extern int setgrent_p __P((struct net_data *));
extern int setgrent_p __P((struct net_data *net_data));
#endif
extern struct hostent *gethostbyname_p __P((const char *,
struct net_data *));
extern struct hostent *gethostbyname2_p __P((const char *, int,
struct net_data *));
extern struct hostent *gethostbyaddr_p __P((const char *, int, int,
struct net_data *));
extern struct hostent *gethostent_p __P((struct net_data *));
extern void sethostent_p __P((int, struct net_data *));
extern void endhostent_p __P((struct net_data *));
extern struct hostent *getipnodebyname_p __P((const char *, int, int, int *,
struct net_data *));
extern struct hostent *getipnodebyaddr_p __P((const void *, size_t,
int, int *, struct net_data *));
extern struct hostent *gethostbyname_p __P((const char *name,
struct net_data *net_data));
extern struct hostent *gethostbyname2_p __P((const char *name, int af,
struct net_data *net_data));
extern struct hostent *gethostbyaddr_p __P((const char *addr, int len,
int af,
struct net_data *net_data));
extern struct hostent *gethostent_p __P((struct net_data *net_data));
extern void sethostent_p __P((int stayopen,
struct net_data *net_data));
extern void endhostent_p __P((struct net_data *net_data));
extern struct hostent *getipnodebyname_p __P((const char *name, int af,
int flags, int *errp,
struct net_data *net_data));
extern struct hostent *getipnodebyaddr_p __P((const void *addr, size_t len,
int af, int *errp,
struct net_data *net_data));
extern struct netent *getnetent_p __P((struct net_data *));
extern struct netent *getnetbyname_p __P((const char *, struct net_data *));
extern struct netent *getnetbyaddr_p __P((unsigned long, int,
struct net_data *));
extern void setnetent_p __P((int, struct net_data *));
extern void endnetent_p __P((struct net_data *));
extern struct netent *getnetent_p __P((struct net_data *net_data));
extern struct netent *getnetbyname_p __P((const char *name,
struct net_data *net_data));
extern struct netent *getnetbyaddr_p __P((unsigned long net, int type,
struct net_data *net_data));
extern void setnetent_p __P((int stayopen,
struct net_data *net_data));
extern void endnetent_p __P((struct net_data *net_data));
extern void setnetgrent_p __P((const char *, struct net_data *));
extern void endnetgrent_p __P((struct net_data *));
extern int innetgr_p __P((const char *, const char *, const char *,
const char *, struct net_data *));
extern int getnetgrent_p __P((const char **, const char **,
const char **, struct net_data *));
extern void setnetgrent_p __P((const char *netgroup,
struct net_data *net_data));
extern void endnetgrent_p __P((struct net_data *net_data));
extern int innetgr_p __P((const char *netgroup,
const char *host,
const char *user,
const char *domain,
struct net_data *net_data));
extern int getnetgrent_p __P((const char **host, const char **user,
const char **domain,
struct net_data *net_data));
extern struct protoent *getprotoent_p __P((struct net_data *));
extern struct protoent *getprotobyname_p __P((const char *,
struct net_data *));
extern struct protoent *getprotobynumber_p __P((int, struct net_data *));
extern void setprotoent_p __P((int, struct net_data *));
extern void endprotoent_p __P((struct net_data *));
extern struct protoent *getprotoent_p __P((struct net_data *net_data));
extern struct protoent *getprotobyname_p __P((const char *name,
struct net_data *net_data));
extern struct protoent *getprotobynumber_p __P((int proto,
struct net_data *net_data));
extern void setprotoent_p __P((int stayopen,
struct net_data *net_data));
extern void endprotoent_p __P((struct net_data *net_data));
extern struct passwd *getpwent_p __P((struct net_data *));
extern struct passwd *getpwnam_p __P((const char *, struct net_data *));
extern struct passwd *getpwuid_p __P((uid_t, struct net_data *));
extern int setpassent_p __P((int, struct net_data *));
extern void endpwent_p __P((struct net_data *));
extern struct passwd *getpwent_p __P((struct net_data *net_data));
extern struct passwd *getpwnam_p __P((const char *name,
struct net_data *net_data));
extern struct passwd *getpwuid_p __P((uid_t uid,
struct net_data *net_data));
extern int setpassent_p __P((int stayopen,
struct net_data *net_data));
extern void endpwent_p __P((struct net_data *net_data));
#ifdef SETPWENT_VOID
extern void setpwent_p __P((struct net_data *));
extern void setpwent_p __P((struct net_data *net_data));
#else
extern int setpwent_p __P((struct net_data *));
extern int setpwent_p __P((struct net_data *net_data));
#endif
extern struct servent *getservent_p __P((struct net_data *));
extern struct servent *getservbyname_p __P((const char *, const char *,
struct net_data *));
extern struct servent *getservbyport_p __P((int, const char *,
struct net_data *));
extern void setservent_p __P((int, struct net_data *));
extern void endservent_p __P((struct net_data *));
extern struct servent *getservent_p __P((struct net_data *net_data));
extern struct servent *getservbyname_p __P((const char *name,
const char *proto,
struct net_data *net_data));
extern struct servent *getservbyport_p __P((int port, const char *proto,
struct net_data *net_data));
extern void setservent_p __P((int stayopen,
struct net_data *net_data));
extern void endservent_p __P((struct net_data *net_data));
#endif /*_IRS_H_INCLUDED*/
+4 -4
View File
@@ -19,7 +19,7 @@
*/
/*
* $Id: ctl.h,v 8.11.10.1 2003/06/02 06:04:03 marka Exp $
* $Id: ctl.h,v 8.11 2001/08/10 02:40:49 marka Exp $
*/
#include <sys/types.h>
@@ -42,11 +42,11 @@ struct ctl_verb;
enum ctl_severity { ctl_debug, ctl_warning, ctl_error };
typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...);
typedef void (*ctl_logfunc)(enum ctl_severity, const char *fmt, ...);
typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *,
const struct ctl_verb *, const char *,
u_int, const void *, void *);
const struct ctl_verb *, const char *rest,
u_int respflags, const void *respctx, void *uctx);
typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *);
+46 -88
View File
@@ -12,124 +12,82 @@ typedef struct dst_key {
} DST_KEY;
#endif /* HAS_DST_KEY */
/*
* do not taint namespace
*/
#define dst_bsafe_init __dst_bsafe_init
#define dst_buffer_to_key __dst_buffer_to_key
#define dst_check_algorithm __dst_check_algorithm
#define dst_compare_keys __dst_compare_keys
#define dst_cylink_init __dst_cylink_init
#define dst_dnskey_to_key __dst_dnskey_to_key
#define dst_eay_dss_init __dst_eay_dss_init
#define dst_free_key __dst_free_key
#define dst_generate_key __dst_generate_key
#define dst_hmac_md5_init __dst_hmac_md5_init
#define dst_init __dst_init
#define dst_key_to_buffer __dst_key_to_buffer
#define dst_key_to_dnskey __dst_key_to_dnskey
#define dst_random __dst_random
#define dst_read_key __dst_read_key
#define dst_rsaref_init __dst_rsaref_init
#define dst_s_build_filename __dst_s_build_filename
#define dst_s_calculate_bits __dst_s_calculate_bits
#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8
#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64
#define dst_s_dns_key_id __dst_s_dns_key_id
#define dst_s_dump __dst_s_dump
#define dst_s_filename_length __dst_s_filename_length
#define dst_s_fopen __dst_s_fopen
#define dst_s_get_int16 __dst_s_get_int16
#define dst_s_get_int32 __dst_s_get_int32
#define dst_s_id_calc __dst_s_id_calc
#define dst_s_put_int16 __dst_s_put_int16
#define dst_s_put_int32 __dst_s_put_int32
#define dst_s_quick_random __dst_s_quick_random
#define dst_s_quick_random_set __dst_s_quick_random_set
#define dst_s_random __dst_s_random
#define dst_s_semi_random __dst_s_semi_random
#define dst_s_verify_str __dst_s_verify_str
#define dst_sig_size __dst_sig_size
#define dst_sign_data __dst_sign_data
#define dst_verify_data __dst_verify_data
#define dst_write_key __dst_write_key
/*
* DST Crypto API defintions
*/
void dst_init(void);
int dst_check_algorithm(const int);
int dst_sign_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be signed */
const int, /* length of input data */
u_char *, /* buffer to write signature to */
const int); /* size of output buffer */
int dst_sign_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *in_key, /* the key to use */
void **context, /* pointer to state structure */
const u_char *data, /* data to be signed */
const int len, /* length of input data */
u_char *signature, /* buffer to write signature to */
const int sig_len); /* size of output buffer */
int dst_verify_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be verified */
const int, /* length of input data */
const u_char *, /* buffer containing signature */
const int); /* length of signature */
int dst_verify_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *in_key, /* the key to use */
void **context, /* pointer to state structure */
const u_char *data, /* data to be verified */
const int len, /* length of input data */
const u_char *signature,/* buffer containing signature */
const int sig_len); /* length of signature */
DST_KEY *dst_read_key(const char *, /* name of key */
const u_int16_t, /* key tag identifier */
const int, /* key algorithm */
const int); /* Private/PublicKey wanted*/
DST_KEY *dst_read_key(const char *in_name, /* name of key */
const u_int16_t in_id, /* key tag identifier */
const int in_alg, /* key algorithm */
const int key_type); /* Private/PublicKey wanted*/
int dst_write_key(const DST_KEY *, /* key to write out */
const int); /* Public/Private */
int dst_write_key(const DST_KEY *key, /* key to write out */
const int key_type); /* Public/Private */
DST_KEY *dst_dnskey_to_key(const char *, /* KEY record name */
const u_char *, /* KEY RDATA */
const int); /* size of input buffer*/
DST_KEY *dst_dnskey_to_key(const char *in_name, /* KEY record name */
const u_char *key, /* KEY RDATA */
const int len); /* size of input buffer*/
int dst_key_to_dnskey(const DST_KEY *, /* key to translate */
u_char *, /* output buffer */
const int); /* size of out_storage*/
int dst_key_to_dnskey(const DST_KEY *key, /* key to translate */
u_char *out_storage, /* output buffer */
const int out_len); /* size of out_storage*/
DST_KEY *dst_buffer_to_key(const char *, /* name of the key */
const int, /* algorithm */
const int, /* dns flags */
const int, /* dns protocol */
const u_char *, /* key in dns wire fmt */
const int); /* size of key */
DST_KEY *dst_buffer_to_key(const char *key_name, /* name of the key */
const int alg, /* algorithm */
const int flags, /* dns flags */
const int protocol, /* dns protocol */
const u_char *key_buf, /* key in dns wire fmt */
const int key_len); /* size of key */
int dst_key_to_buffer(DST_KEY *, u_char *, int);
int dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len);
DST_KEY *dst_generate_key(const char *, /* name of new key */
const int, /* key algorithm to generate */
const int, /* size of new key */
const int, /* alg dependent parameter*/
const int, /* key DNS flags */
const int); /* key DNS protocol */
DST_KEY *dst_generate_key(const char *name, /* name of new key */
const int alg, /* key algorithm to generate */
const int bits, /* size of new key */
const int exp, /* alg dependent parameter*/
const int flags, /* key DNS flags */
const int protocol); /* key DNS protocol */
DST_KEY *dst_free_key(DST_KEY *);
int dst_compare_keys(const DST_KEY *, const DST_KEY *);
DST_KEY *dst_free_key(DST_KEY *f_key);
int dst_compare_keys(const DST_KEY *key1, const DST_KEY *key2);
int dst_sig_size(DST_KEY *);
int dst_sig_size(DST_KEY *key);
int dst_random(const int, int wanted, u_char *);
int dst_random(const int mode, int wanted, u_char *outran);
/* support for dns key tags/ids */
u_int16_t dst_s_dns_key_id(const u_char *, const int);
u_int16_t dst_s_id_calc(const u_char *, const int);
u_int16_t dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len);
u_int16_t dst_s_id_calc(const u_char *key_data, const int key_len);
/* Used by callers as well as by the library. */
#define RAW_KEY_SIZE 8192 /* large enough to store any key */
/* DST_API control flags */
/* These are used used in functions dst_sign_data and dst_verify_data */
#define SIG_MODE_INIT 1 /* initialize digest */
#define SIG_MODE_INIT 1 /* initalize digest */
#define SIG_MODE_UPDATE 2 /* add data to digest */
#define SIG_MODE_FINAL 4 /* generate/verify signature */
#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL)
Loaded 100 of 4241 files, more files were not shown because too many files have changed in this diff. Show more