Compare commits

..
Author SHA1 Message Date
cvs2svn 37af766bc5 This commit was manufactured by cvs2svn to create tag
'RELENG_3_4_0_RELEASE'.
1999-12-20 00:16:49 +00:00
3116 changed files with 129561 additions and 220889 deletions

No files matched your search

+1 -3
View File
@@ -183,8 +183,6 @@ TMPPATH= ${STRICTTMPPATH}:${PATH}
COMPILER_ENV= BISON_SIMPLE=${TOOLROOT}/usr/share/misc/bison.simple \
COMPILER_PATH=${TOOLROOT}/usr/libexec:${TOOLROOT}/usr/bin \
GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac \
LD_LIBRARY_PATH=${TOOLROOT}${SHLIBDIR} \
LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
@@ -398,7 +396,7 @@ update:
@echo "--------------------------------------------------------------"
@echo ">>> Updating /usr/src from cvs repository" ${CVSROOT}
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; cvs -q update -rRELENG_3 -P -d
cd ${.CURDIR}; cvs -q update -P -d
.endif
#
+1 -1
View File
@@ -35,7 +35,7 @@ bin System/User commands.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
crypto Export controlled stuff (see crypto/README).
etc Template files for /etc
+134 -3
View File
@@ -1,6 +1,137 @@
Updating Information for FreeBSD Stable users
Updating Information for FreeBSD current users
When updating to 4.x-stable from 3.x-stable, please read src/UPDATING
after updating to the new sources for important information.
This file is maintained by [email protected]. Please send new entries
directly to him. See end of file for further details.
19990510:
Previously, one would define "NOAOUT" to keep from building
the legacy a.out bits. Now one would define "WANT_AOUT" to
build them.
19990507:
New devstat API requires recompilation of libdevstat, systat,
iostat, vmstat and rpc.rstatd. A new kernel is also required.
make world + building a kernel should do all of this. Any
ports that use devstat need to be recompiled as well.
19990424:
The 'nlpt' driver has changed names to become the 'lpt' driver.
See ppbus(4) or http://www.freebsd.org/~nsouch/ppbus.html
for proper configuration details.
19990209:
New devstat API requires recompilation of libdevstat, systat,
iostat, vmstat and rpc.rstatd. A new kernel is also required.
make world + building a kernel should do all of this. Any
ports that use devstat need to be recompiled as well.
19990125:
Linux threads options has gone away (they are now standard in
the FreeBSD kernel). A recompile of all libkvm using programs
is in order (or better yet a make world).
19990122:
On or about this date there was a small window when the boot
blocks had some minor problems which seemed to force one to
edit /etc/fstab. This has been corrected, if you are seeing this
problem, please rebuild and reinstall your boot blocks.
19990121:
Vinum has changed. The "vinum read" command has changed. For
updates, please see
http://www.freebsd.org/cgi/getmsg.cgi?fetch=800363+0+current/freebsd-current
for details.
19990120:
Stable branch created. You might want to consider using this
branch. It is tagged with RELENG_3.
19990119:
More work on the syscons driver has been committed. Since
files moved around, you will need to reconfigure your kernel,
and make clean; make depend before rebuilding the kernel. No
config file changes are needed.
19990111:
New keyboard and video card drivers are introduced as the first
stage of console driver reorganization. You are required to
update the kernel configuration file and rebuild the kernel.
kbdcontrol, vidcontrol, and screen savers also need recompilation.
The instruction can be found in
http://www.freebsd.org/~yokota/sc_update.txt
It has notes on splash screen too.
19990106:
Robert Nordier was kind enough to make this page to enable people to
install the new bootblocks:
http://www.freebsd.org/~rnordier/boot.txt
When updating to ELF, make sure that you have updated your
/etc/rc files which have different ldconfig invocations for
elf and aout. Otherwise things like X will stop working with
messages about being unable to find library files. The
mergemaster utility in ports/sysutils/mergemaster helps to
keep critical files like this in sync, and its use is
recommended.
19990104:
Information about ELF day (see 19981230) can be found in
http://www.freebsd.org/~peter/elfday.html
about the upcoming change, its motivations and instructions
for doing the upgrade.
19981230:
You should install new bootblocks now. The ELF kernel will
become default soon. In addition, you'll need to upgrade
your userland programs to ELF before then as well. Use
make aout-to-elf to upgrade your userland programs (old
a.out programs in, for example, /usr/local/bin will
continue to work, even after the upgrade). See src/Makefile
for more details.
19981224:
The old wcd driver has been deleted from the kernel. The
driver that replaces it is named acd. You'll need to change
this in your configuration files.
Failure to do this will result in "ATAPI CD-ROMs not
configured" at boot time.
The floppy tape driver (ft) has been removed from the kernel,
with no replacement driver.
19981202:
New groups from 19981201 commented out of mtree, so they
aren't strictly needed, but still a good idea to have.
19981201:
New user/group added: bind. From src/etc/master.passwd and
src/etc/group:
% grep <newstuff> /usr/src/etc/group
bind:*:53:
% grep <newstuff> /usr/src/etc/master.passwd
tty:*:4:65533::0:0:Tty Sandbox:/:/sbin/nologin
kmem:*:5:65533::0:0:KMem Sandbox:/:/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/sbin/nologin
19981118:
PAM integrated into the tree. Requires new /etc/pam.conf file
to silence warnings from authentication programs (login, etc).
See src/etc/pam.conf for a sample.
This file contains a list, in reverse chronologocal order, of major
breakages in tracking -stable. Not all things will be listed here,
and it only starts on Novemeber 18, 1998. If you have an earlier
version of FreeBSD, you are on your own to get to November 18, 1998.
Please filter your entries through Warner ([email protected]) so that
the style, formatting, etc of this file can be maintained.
$FreeBSD$
+3 -12
View File
@@ -47,7 +47,6 @@
.Fl f
.Fl R
.Op Fl H | Fl L | Fl P
.Fl v
.Oc
.Ar mode
.Ar file ...
@@ -65,8 +64,7 @@ The options are as follows:
If the
.Fl R
option is specified, symbolic links on the command line are followed.
(Symbolic links encountered in the tree traversal are not followed by
default.)
(Symbolic links encountered in the tree traversal are not followed.)
.It Fl L
If the
.Fl R
@@ -83,10 +81,6 @@ Do not display a diagnostic message if
.Nm
could not modify the mode for
.Va file .
.It Fl v
Cause
.Nm
to be verbose, showing files as the mode is modified.
.El
.Pp
Symbolic links do not have modes, so unless the
@@ -172,8 +166,9 @@ others, and no set-uid or set-gid behaviour is 755
The symbolic mode is described by the following grammar:
.Bd -literal -offset indent
mode ::= clause [, clause ...]
clause ::= [who ...] [action ...] action
clause ::= [who ...] [action ...] last_action
action ::= op [perm ...]
last_action ::= op [perm ...]
who ::= a | u | g | o
op ::= + | \- | =
perm ::= r | s | t | w | x | X | u | g | o
@@ -312,10 +307,6 @@ set the group bits equal to the user bits, but clear the group write bit.
There's no
.Ar perm
option for the naughty bits.
.Sh COMPATIBILITY
The
.Fl v
option is non-standard and its use in scripts is not recommended.
.Sh SEE ALSO
.Xr chflags 1 ,
.Xr install 1 ,
+3 -10
View File
@@ -70,13 +70,12 @@ main(argc, argv)
long val;
int oct, omode;
int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval;
int vflag;
char *ep, *mode;
set = NULL;
omode = 0;
Hflag = Lflag = Pflag = Rflag = fflag = hflag = vflag = 0;
while ((ch = getopt(argc, argv, "HLPRXfgorstuvwx")) != -1)
Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0;
while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -119,9 +118,6 @@ main(argc, argv)
argv[optind - 1][2] == '\0')
--optind;
goto done;
case 'v':
vflag = 1;
break;
case '?':
default:
usage();
@@ -195,9 +191,6 @@ done: argv += optind;
getmode(set, p->fts_statp->st_mode)) && !fflag) {
warn(p->fts_path);
rval = 1;
} else {
if (vflag)
(void)printf("%s\n", p->fts_accpath);
}
}
if (errno)
@@ -210,6 +203,6 @@ void
usage()
{
(void)fprintf(stderr,
"usage: chmod [-fv] [-R [-H | -L | -P]] mode file ...\n");
"usage: chmod [-f -R [-H | -L | -P]] mode file ...\n");
exit(1);
}
+2 -4
View File
@@ -875,8 +875,7 @@ to remind you which command is being continued, and cause the command
to resume execution. Unless any input files in use by the suspended
command have been changed in the meantime, the suspension has no effect
whatsoever on the execution of the command. This feature can be very useful
during editing, when you need to look at another file before continuing.
An
during editing, when you need to look at another file before continuing. An
example of command suspension follows.
.DS
% mail harold
@@ -904,8 +903,7 @@ suspended, it typed `Stopped' and prompted for a new command. Then the
.I ls
command was typed to find out the name of the file. The
.I jobs
command was run to find out which command was suspended.
At this time the
command was run to find out which command was suspended. At this time the
.I fg
command was typed to continue execution of the mail program. Input
to the mail program was then continued and ended with a ^D
+1 -2
View File
@@ -678,8 +678,7 @@ the same until the job terminates and then are re-used.
.PP
When a job is started in the backgound using `&', its number, as well
as the process numbers of all its (top level) commands, is typed by the shell
before prompting you for another command.
For example,
before prompting you for another command. For example,
.DS
% ls \-s | sort \-n > usage &
[2] 2034 2035
+1 -2
View File
@@ -224,8 +224,7 @@ is quite special and is replaced by the next line of input read from
the shell's standard input (not the script it is reading). This is
useful for writing shell scripts that are interactive, reading
commands from the terminal, or even writing a shell script that
acts as a filter, reading lines from its input file.
Thus the sequence
acts as a filter, reading lines from its input file. Thus the sequence
.DS
echo 'yes or no?\ec'
set a=($<)
+7 -6
View File
@@ -59,7 +59,7 @@ and a C-like syntax.
It is used both as an interactive login shell and
a shell script command processor.
.Ss Argument list processing
If the shell is executed with a program name starting with
If the first argument (argument 0) to the shell is
.Ql Fl \& ,
then this is a login shell.
A login shell also can be specified by invoking the shell with the
@@ -132,11 +132,12 @@ variable to be set even before
.Pa .cshrc
is executed.
.It Fl X
Cause the
.Ar echo
variable to be set even before
.Pa .cshrc
is executed.
Is to
.Fl x
as
.Fl V
is to
.Fl v .
.El
.Pp
After processing of flag arguments, if arguments remain but none of the
+5 -13
View File
@@ -40,7 +40,6 @@ static const char rcsid[] =
#endif
#endif /* not lint */
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
@@ -851,20 +850,13 @@ heredoc(term)
Char **vp;
bool quoted;
char *tmp;
struct timeval tv;
again:
tmp = short2str(shtemp);
if (open(tmp, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600) < 0) {
if (creat(tmp = short2str(shtemp), 0600) < 0)
stderror(ERR_SYSTEM, tmp, strerror(errno));
(void) close(0);
if (open(tmp, O_RDWR) < 0) {
int oerrno = errno;
if (errno == EEXIST) {
if (unlink(tmp) == -1) {
(void) gettimeofday(&tv, NULL);
shtemp = Strspl(STRtmpsh, putn((((int)tv.tv_sec) ^
((int)tv.tv_usec) ^ ((int)getpid())) & 0x00ffffff));
}
goto again;
}
(void) unlink(tmp);
errno = oerrno;
stderror(ERR_SYSTEM, tmp, strerror(errno));
+3 -31
View File
@@ -92,14 +92,9 @@ option stops
.Nm
from setting the time for other than the current machine.
.It Fl r
Print out the date and time that is
Print out the date and time in
.Ar seconds
from the Epoch
.Po
00:00:00 UTC, January 1, 1970;
see
.Xr time 3
.Pc .
from the Epoch.
.It Fl t
Set the kernel's value for minutes west of
.Tn GMT .
@@ -122,9 +117,7 @@ or backwards according to the remaining string, otherwise the relevant
part of the date is set. The date can be adjusted as many times as
required using these flags. Flags are processed in the order given.
.Pp
When setting values
.Pq rather than adjusting them ,
seconds are in the range 0-59, minutes are in the range 0-59, hours are
Seconds are in the range 0-59, minutes are in the range 0-59, hours are
in the range 1-12, month days are in the range 1-31, week days are in the
range 0-6 (Sun-Sat), months are in the range 1-12 (Jan-Dec) and years are
in the range 80-38 or 1980-2038.
@@ -148,27 +141,6 @@ will be put forwards (or backwards) to the next (previous) date that
matches the given week day or month. This will not adjust the date
if the given week day or month is the same as the current one.
.Pp
When a date is adjusted to a specific value or in units greater than hours,
daylight savings time considerations are ignored.
Adjustments in units of hours or less honour daylight savings time.
So, assuming the current date is March 26, 0:30 and that the DST adjustment
means that the clock goes forward at 01:00 to 02:00, using
.Fl v No +1H
will adjust the date to March 26, 2:30.
Likewise, if the date is October 29, 0:30 and the DST adjustment means that
the clock goes back at 02:00 to 01:00, using
.Fl v No +3H
will be necessary to reach October 20, 2:30.
.Pp
When the date is adjusted to a specific value that doesn't actually exist
.Pq for example March 26, 1:30 BST 2000 ,
the date will be silently adjusted forwards in units of one hour until it
reaches a valid time.
When the date is adjusted to a specific value that occurs twice
.Pq for example October 29, 1:30 2000 ,
the resulting timezone will be set so that the date matches the earlier of
the two times.
.Pp
Refer to the examples below for further details.
.El
.Pp
+88 -131
View File
@@ -41,8 +41,8 @@ struct trans {
static struct trans trans_mon[] = {
{ 1, "january" }, { 2, "february" }, { 3, "march" }, { 4, "april" },
{ 5, "may"}, { 6, "june" }, { 7, "july" }, { 8, "august" },
{ 9, "september" }, { 10, "october" }, { 11, "november" }, { 12, "december" },
{ 6, "june" }, { 7, "july" }, { 8, "august" }, { 9, "september" },
{ 10, "october" }, { 11, "november" }, { 12, "december" },
{ -1, NULL }
};
@@ -53,19 +53,6 @@ static struct trans trans_wday[] = {
};
static char digits[] = "0123456789";
static int adjhour(struct tm *, char, int, int);
static int
domktime(struct tm *t, char type)
{
time_t ret;
while ((ret = mktime(t)) == -1 && t->tm_year > 68 && t->tm_year < 138)
/* While mktime() fails, adjust by an hour */
adjhour(t, type == '-' ? type : '+', 1, 0);
return ret;
}
static int
trans(const struct trans t[], const char *arg)
@@ -125,7 +112,7 @@ daysinmonth(const struct tm *t)
static int
adjyear(struct tm *t, char type, int val, int mk)
adjyear(struct tm *t, char type, int val)
{
switch (type) {
case '+':
@@ -142,51 +129,45 @@ adjyear(struct tm *t, char type, int val, int mk)
t->tm_year -= 1900; /* struct tm holds years since 1900 */
break;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
static int
adjmon(struct tm *t, char type, int val, int istext, int mk)
adjmon(struct tm *t, char type, int val, int istext)
{
if (val < 0)
return 0;
switch (type) {
case '+':
if (istext) {
if (istext)
if (val <= t->tm_mon)
val += 11 - t->tm_mon; /* early next year */
else
val -= t->tm_mon + 1; /* later this year */
}
if (val) {
if (!adjyear(t, '+', (t->tm_mon + val) / 12, 0))
return 0;
val %= 12;
t->tm_mon += val;
if (t->tm_mon > 11)
t->tm_mon -= 12;
}
if (!adjyear(t, '+', (t->tm_mon + val) / 12))
return 0;
val %= 12;
t->tm_mon += val;
if (t->tm_mon > 11)
t->tm_mon -= 12;
break;
case '-':
if (istext) {
if (istext)
if (val-1 > t->tm_mon)
val = 13 - val + t->tm_mon; /* later last year */
else
val = t->tm_mon - val + 1; /* early this year */
}
if (val) {
if (!adjyear(t, '-', val / 12, 0))
if (!adjyear(t, '-', val / 12))
return 0;
val %= 12;
if (val > t->tm_mon) {
if (!adjyear(t, '-', 1))
return 0;
val %= 12;
if (val > t->tm_mon) {
if (!adjyear(t, '-', 1, 0))
return 0;
val -= 12;
}
t->tm_mon -= val;
val -= 12;
}
t->tm_mon -= val;
break;
default:
@@ -195,14 +176,13 @@ adjmon(struct tm *t, char type, int val, int istext, int mk)
t->tm_mon = --val;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
static int
adjday(struct tm *t, char type, int val, int mk)
adjday(struct tm *t, char type, int val)
{
int mdays;
switch (type) {
case '+':
while (val) {
@@ -210,7 +190,7 @@ adjday(struct tm *t, char type, int val, int mk)
if (val > mdays - t->tm_mday) {
val -= mdays - t->tm_mday + 1;
t->tm_mday = 1;
if (!adjmon(t, '+', 1, 0, 0))
if (!adjmon(t, '+', 1, 0))
return 0;
} else {
t->tm_mday += val;
@@ -223,7 +203,7 @@ adjday(struct tm *t, char type, int val, int mk)
if (val >= t->tm_mday) {
val -= t->tm_mday;
t->tm_mday = 1;
if (!adjmon(t, '-', 1, 0, 0))
if (!adjmon(t, '-', 1, 0))
return 0;
t->tm_mday = daysinmonth(t);
} else {
@@ -239,11 +219,11 @@ adjday(struct tm *t, char type, int val, int mk)
break;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
static int
adjwday(struct tm *t, char type, int val, int istext, int mk)
adjwday(struct tm *t, char type, int val, int istext)
{
if (val < 0)
return 0;
@@ -256,62 +236,54 @@ adjwday(struct tm *t, char type, int val, int istext, int mk)
else
val -= t->tm_wday; /* later this week */
else
val *= 7; /* "-v+5w" == "5 weeks in the future" */
return !val || adjday(t, '+', val, mk);
val *= 7; /* "-W +5" == "5 weeks in the future" */
return adjday(t, '+', val);
case '-':
if (istext) {
if (istext)
if (val > t->tm_wday)
val = 7 - val + t->tm_wday; /* later last week */
else
val = t->tm_wday - val; /* early this week */
} else
val *= 7; /* "-v-5w" == "5 weeks ago" */
return !val || adjday(t, '-', val, mk);
else
val *= 7; /* "-W -5" == "5 weeks ago" */
return adjday(t, '-', val);
default:
if (val < t->tm_wday)
return adjday(t, '-', t->tm_wday - val, mk);
return adjday(t, '-', t->tm_wday - val);
else if (val > 6)
return 0;
else if (val > t->tm_wday)
return adjday(t, '+', val - t->tm_wday, mk);
return adjday(t, '+', val - t->tm_wday);
}
return 1;
}
static int
adjhour(struct tm *t, char type, int val, int mk)
adjhour(struct tm *t, char type, int val)
{
if (val < 0)
return 0;
switch (type) {
case '+':
if (val) {
int days;
days = (t->tm_hour + val) / 24;
val %= 24;
t->tm_hour += val;
t->tm_hour %= 24;
if (!adjday(t, '+', days, 0))
return 0;
}
if (!adjday(t, '+', (t->tm_hour + val) / 24))
return 0;
val %= 24;
t->tm_hour += val;
if (t->tm_hour > 23)
t->tm_hour -= 24;
break;
case '-':
if (val) {
int days;
days = val / 24;
val %= 24;
if (val > t->tm_hour) {
days++;
val -= 24;
}
t->tm_hour -= val;
if (!adjday(t, '-', days, 0))
if (!adjday(t, '-', val / 24))
return 0;
val %= 24;
if (val > t->tm_hour) {
if (!adjday(t, '-', 1))
return 0;
val -= 24;
}
t->tm_hour -= val;
break;
default:
@@ -320,39 +292,35 @@ adjhour(struct tm *t, char type, int val, int mk)
t->tm_hour = val;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
static int
adjmin(struct tm *t, char type, int val, int mk)
adjmin(struct tm *t, char type, int val)
{
if (val < 0)
return 0;
switch (type) {
case '+':
if (val) {
if (!adjhour(t, '+', (t->tm_min + val) / 60, 0))
return 0;
val %= 60;
t->tm_min += val;
if (t->tm_min > 59)
t->tm_min -= 60;
}
if (!adjhour(t, '+', (t->tm_min + val) / 60))
return 0;
val %= 60;
t->tm_min += val;
if (t->tm_min > 59)
t->tm_min -= 60;
break;
case '-':
if (val) {
if (!adjhour(t, '-', val / 60, 0))
if (!adjhour(t, '-', val / 60))
return 0;
val %= 60;
if (val > t->tm_min) {
if (!adjhour(t, '-', 1))
return 0;
val %= 60;
if (val > t->tm_min) {
if (!adjhour(t, '-', 1, 0))
return 0;
val -= 60;
}
t->tm_min -= val;
val -= 60;
}
t->tm_min -= val;
break;
default:
@@ -361,39 +329,35 @@ adjmin(struct tm *t, char type, int val, int mk)
t->tm_min = val;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
static int
adjsec(struct tm *t, char type, int val, int mk)
adjsec(struct tm *t, char type, int val)
{
if (val < 0)
return 0;
switch (type) {
case '+':
if (val) {
if (!adjmin(t, '+', (t->tm_sec + val) / 60, 0))
return 0;
val %= 60;
t->tm_sec += val;
if (t->tm_sec > 59)
t->tm_sec -= 60;
}
if (!adjmin(t, '+', (t->tm_sec + val) / 60))
return 0;
val %= 60;
t->tm_sec += val;
if (t->tm_sec > 59)
t->tm_sec -= 60;
break;
case '-':
if (val) {
if (!adjmin(t, '-', val / 60, 0))
if (!adjmin(t, '-', val / 60))
return 0;
val %= 60;
if (val > t->tm_sec) {
if (!adjmin(t, '-', 1))
return 0;
val %= 60;
if (val > t->tm_sec) {
if (!adjmin(t, '-', 1, 0))
return 0;
val -= 60;
}
t->tm_sec -= val;
val -= 60;
}
t->tm_sec -= val;
break;
default:
@@ -402,7 +366,7 @@ adjsec(struct tm *t, char type, int val, int mk)
t->tm_sec = val;
}
return !mk || domktime(t, type) != -1;
return mktime(t) != -1;
}
const struct vary *
@@ -425,18 +389,15 @@ vary_apply(const struct vary *v, struct tm *t)
if (len < 2)
return v;
if (type == '\0')
t->tm_isdst = -1;
if (strspn(arg, digits) != len-1) {
val = trans(trans_wday, arg);
if (val != -1) {
if (!adjwday(t, type, val, 1, 1))
if (!adjwday(t, type, val, 1))
return v;
} else {
val = trans(trans_mon, arg);
if (val != -1) {
if (!adjmon(t, type, val, 1, 1))
if (!adjmon(t, type, val, 1))
return v;
} else
return v;
@@ -447,35 +408,31 @@ vary_apply(const struct vary *v, struct tm *t)
switch (which) {
case 'S':
if (!adjsec(t, type, val, 1))
if (!adjsec(t, type, val))
return v;
break;
case 'M':
if (!adjmin(t, type, val, 1))
if (!adjmin(t, type, val))
return v;
break;
case 'H':
if (!adjhour(t, type, val, 1))
if (!adjhour(t, type, val))
return v;
break;
case 'd':
t->tm_isdst = -1;
if (!adjday(t, type, val, 1))
if (!adjday(t, type, val))
return v;
break;
case 'w':
t->tm_isdst = -1;
if (!adjwday(t, type, val, 0, 1))
if (!adjwday(t, type, val, 0))
return v;
break;
case 'm':
t->tm_isdst = -1;
if (!adjmon(t, type, val, 0, 1))
if (!adjmon(t, type, val, 0))
return v;
break;
case 'y':
t->tm_isdst = -1;
if (!adjyear(t, type, val, 1))
if (!adjyear(t, type, val))
return v;
break;
default:
+1 -2
View File
@@ -282,8 +282,7 @@ appended.
.El
.El
.Pp
Where sizes are specified, a decimal, octal, or hexadecimal number of
bytes is expected.
Where sizes are specified, a decimal number of bytes is expected.
If the number ends with a ``b'', ``k'', ``m'', ``g'', or ``w'', the
number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G)
or the number of bytes in an integer, respectively.
-2
View File
@@ -8,8 +8,6 @@ BINMODE=2555
MOUNT= ${.CURDIR}/../../sbin/mount
CFLAGS+= -I${MOUNT}
LDADD+= ${LIBM}
DPADD+= ${LIBM}
.PATH: ${MOUNT}
.include <bsd.prog.mk>
+1 -28
View File
@@ -40,11 +40,7 @@
.Nd display free disk space
.Sh SYNOPSIS
.Nm df
.Oo
.Fl b | h | H | k |
.Fl m | P
.Oc
.Op Fl in
.Op Fl ikn
.Op Fl t Ar type
.Op Ar file | Ar filesystem ...
.Sh DESCRIPTION
@@ -63,19 +59,6 @@ option below).
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl b
Use 512-byte blocks rather than the default. Note that
this overrides the
.Ev BLOCKSIZE
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 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 three or less using base 2 for sizes.
.It Fl i
Include statistics on the number of free inodes.
.It Fl k
@@ -83,11 +66,6 @@ Use 1024-byte (1-Kbyte) blocks rather than the default. Note that
this overrides the
.Ev BLOCKSIZE
specification from the environment.
.It Fl m
Use 1048576-byte (1-Mbyte) blocks rather than the default. Note that
this overrides the
.Ev BLOCKSIZE
specification from the environment.
.It Fl n
Print out the previously obtained statistics from the filesystems.
This option should be used if it is possible that one or more
@@ -97,11 +75,6 @@ When this option is specified,
.Nm
will not request new statistics from the filesystems, but will respond
with the possibly stale statistics that were previously obtained.
.It Fl P
Use POSIX compliant output of 512-byte blocks rather than the default.
Note that this overrides the
.Ev BLOCKSIZE
specification from the environment.
.It Fl t
Only print out statistics for filesystems of the specified types.
More than one type may be specified in a comma separated list.
+12 -133
View File
@@ -59,55 +59,21 @@ static const char rcsid[] =
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#define UNITS_SI 1
#define UNITS_2 2
#define KILO_SZ(n) (n)
#define MEGA_SZ(n) ((n) * (n))
#define GIGA_SZ(n) ((n) * (n) * (n))
#define TERA_SZ(n) ((n) * (n) * (n) * (n))
#define PETA_SZ(n) ((n) * (n) * (n) * (n) * (n))
#define KILO_2_SZ (KILO_SZ(1024ULL))
#define MEGA_2_SZ (MEGA_SZ(1024ULL))
#define GIGA_2_SZ (GIGA_SZ(1024ULL))
#define TERA_2_SZ (TERA_SZ(1024ULL))
#define PETA_2_SZ (PETA_SZ(1024ULL))
#define KILO_SI_SZ (KILO_SZ(1000ULL))
#define MEGA_SI_SZ (MEGA_SZ(1000ULL))
#define GIGA_SI_SZ (GIGA_SZ(1000ULL))
#define TERA_SI_SZ (TERA_SZ(1000ULL))
#define PETA_SI_SZ (PETA_SZ(1000ULL))
unsigned long long vals_si [] = {1, KILO_SI_SZ, MEGA_SI_SZ, GIGA_SI_SZ, TERA_SI_SZ, PETA_SI_SZ};
unsigned long long vals_base2[] = {1, KILO_2_SZ, MEGA_2_SZ, GIGA_2_SZ, TERA_2_SZ, PETA_2_SZ};
unsigned long long *valp;
typedef enum { NONE, KILO, MEGA, GIGA, TERA, PETA, UNIT_MAX } unit_t;
int unitp [] = { NONE, KILO, MEGA, GIGA, TERA, PETA };
int checkvfsname __P((const char *, char **));
char **makevfslist __P((char *));
long regetmntinfo __P((struct statfs **, long, char **));
int bread __P((off_t, void *, int));
char *getmntpt __P((char *));
void prthuman __P((struct statfs *, long));
void prthumanval __P((double));
void prtstat __P((struct statfs *, int));
int ufs_df __P((char *, int));
unit_t unit_adjust __P((double *));
void usage __P((void));
int hflag, iflag, nflag;
int iflag, nflag;
struct ufs_args mdev;
int
@@ -122,32 +88,13 @@ main(argc, argv)
char *mntpt, *mntpath, **vfslist;
vfslist = NULL;
while ((ch = getopt(argc, argv, "bHhikmnPt:")) != -1)
while ((ch = getopt(argc, argv, "iknt:")) != -1)
switch (ch) {
case 'b':
/* FALLTHROUGH */
case 'P':
putenv("BLOCKSIZE=512");
hflag = 0;
break;
case 'H':
hflag = UNITS_SI;
valp = vals_si;
break;
case 'h':
hflag = UNITS_2;
valp = vals_base2;
break;
case 'i':
iflag = 1;
break;
case 'k':
putenv("BLOCKSIZE=1k");
hflag = 0;
break;
case 'm':
putenv("BLOCKSIZE=1m");
hflag = 0;
break;
case 'n':
nflag = 1;
@@ -183,9 +130,8 @@ main(argc, argv)
maxwidth = width;
}
}
for (i = 0; i < mntsize; i++) {
for (i = 0; i < mntsize; i++)
prtstat(&mntbuf[i], maxwidth);
}
exit(rv);
}
@@ -297,61 +243,6 @@ regetmntinfo(mntbufp, mntsize, vfslist)
return (j);
}
/*
* Output in "human-readable" format. Uses 3 digits max and puts
* unit suffixes at the end. Makes output compact and easy to read,
* especially on huge disks.
*
*/
unit_t
unit_adjust(val)
double *val;
{
double abval;
unit_t unit;
unsigned int unit_sz;
abval = fabs(*val);
unit_sz = abval ? ilogb(abval) / 10 : 0;
if (unit_sz >= UNIT_MAX) {
unit = NONE;
} else {
unit = unitp[unit_sz];
*val /= (double)valp[unit_sz];
}
return (unit);
}
void
prthuman(sfsp, used)
struct statfs *sfsp;
long used;
{
prthumanval((double)sfsp->f_blocks * (double)sfsp->f_bsize);
prthumanval((double)used * (double)sfsp->f_bsize);
prthumanval((double)sfsp->f_bavail * (double)sfsp->f_bsize);
}
void
prthumanval(bytes)
double bytes;
{
unit_t unit;
unit = unit_adjust(&bytes);
if (bytes == 0)
(void)printf(" 0B");
else if (bytes > 10)
(void)printf(" %5.0f%c", bytes, "BKMGTPE"[unit]);
else
(void)printf(" %5.1f%c", bytes, "BKMGTPE"[unit]);
}
/*
* Convert statfs returned filesystem size into BLOCKSIZE units.
* Attempts to avoid overflow for large filesystems.
@@ -376,16 +267,9 @@ prtstat(sfsp, maxwidth)
if (maxwidth < 11)
maxwidth = 11;
if (++timesthrough == 1) {
if (hflag) {
header = " Size";
headerlen = strlen(header);
(void)printf("%-*.*s %-s Used Avail Capacity",
maxwidth, maxwidth, "Filesystem", header);
} else {
header = getbsize(&headerlen, &blocksize);
(void)printf("%-*.*s %-s Used Avail Capacity",
maxwidth, maxwidth, "Filesystem", header);
}
header = getbsize(&headerlen, &blocksize);
(void)printf("%-*.*s %s Used Avail Capacity",
maxwidth, maxwidth, "Filesystem", header);
if (iflag)
(void)printf(" iused ifree %%iused");
(void)printf(" Mounted on\n");
@@ -393,14 +277,10 @@ prtstat(sfsp, maxwidth)
(void)printf("%-*.*s", maxwidth, maxwidth, sfsp->f_mntfromname);
used = sfsp->f_blocks - sfsp->f_bfree;
availblks = sfsp->f_bavail + used;
if (hflag) {
prthuman(sfsp, used);
} else {
(void)printf(" %*ld %8ld %8ld", headerlen,
fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
fsbtoblk(used, sfsp->f_bsize, blocksize),
fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize));
}
(void)printf(" %*ld %8ld %8ld", headerlen,
fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
fsbtoblk(used, sfsp->f_bsize, blocksize),
fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize));
(void)printf(" %5.0f%%",
availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
if (iflag) {
@@ -496,8 +376,7 @@ bread(off, buf, cnt)
void
usage()
{
(void)fprintf(stderr,
"usage: df [-b | -H | -h | -k | -m | -P] [-ain] [-t type] [file | filesystem ...]\n");
exit(EX_USAGE);
"usage: df [-ikn] [-t type] [file | filesystem ...]\n");
exit(1);
}
+1 -11
View File
@@ -59,22 +59,12 @@ Do not print the trailing newline character. This may also be
achieved by appending `\ec' to the end of the string, as is done
by iBCS2 compatible systems.
.El
.Pp
Some shells may provide a builtin
.Nm
command which is similar or identical to this utility.
Consult the
.Xr builtin 1
manual page.
.Sh DIAGNOSTICS
The
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr builtin 1 ,
.Xr csh 1 ,
.Xr printf 1 ,
.Xr sh 1
.Xr printf 1
.Sh STANDARDS
The
.Nm
+6 -12
View File
@@ -4,8 +4,7 @@
.Os
.Sh NAME
.\" ed, red \- text editor
.Nm ed ,
.Nm red
.Nm ed
.Nd text editor
.Sh SYNOPSIS
.Nm ed
@@ -116,8 +115,7 @@ default addresses are supplied.
The following options are available:
.Bl -tag -width indent
.It Fl s
Suppress diagnostics.
This should be used if
Suppress diagnostics. This should be used if
.Nm Ns 's
standard input is from a script.
.It Fl x
@@ -176,8 +174,7 @@ This means "before the first line,"
and is legal wherever it makes sense.
.Pp
An address range is two addresses separated either by a comma or
semi-colon.
The value of the first address in a range cannot exceed the
semi-colon. The value of the first address in a range cannot exceed the
value of the second. If only one address is given in a range, then
the second address is set to the given address. If an
.Em n Ns -tuple
@@ -455,8 +452,7 @@ The current address is set to last line entered.
.It (.,.)d
Delete the addressed lines from the buffer.
If there is a line after the deleted range, then the current address is set
to this line.
Otherwise the current address is set to the line
to this line. Otherwise the current address is set to the line
before the deleted range.
.It e Ar file
Edit
@@ -591,8 +587,7 @@ Print the addressed lines along with
their line numbers. The current address is set to the last line
printed.
.It (.,.)p
Print the addressed lines.
The current address is set to the last line
Print the addressed lines. The current address is set to the last line
printed.
.It P
Toggle the command prompt on and off.
@@ -835,8 +830,7 @@ attempts to write the buffer if the terminal hangs up
USD:12-13
.Rs
.%A B. W. Kernighan
.%A P. J. Plauger
.%A B. W. Kernighan and P. J. Plauger
.%B Software Tools in Pascal
.%O Addison-Wesley
.%D 1981
+3 -5
View File
@@ -175,9 +175,7 @@ top:
if (read_file(*argv, 0) < 0 && !isatty(0))
quit(2);
else if (**argv != '!')
if (strlcpy(old_filename, *argv, sizeof(old_filename))
>= sizeof(old_filename))
quit(2);
strcpy(old_filename, *argv);
} else if (argc) {
fputs("?\n", stderr);
if (**argv == '\0')
@@ -1347,8 +1345,8 @@ strip_escapes(s)
int i = 0;
REALLOC(file, filesz, MAXPATHLEN + 1, NULL);
while (i < filesz - 1 /* Worry about a possible trailing escape */
&& (file[i++] = (*s == '\\') ? *++s : *s))
/* assert: no trailing escape */
while ((file[i++] = (*s == '\\') ? *++s : *s))
s++;
return file;
}
+1 -6
View File
@@ -50,10 +50,6 @@ network initialization script
.Pa /etc/rc.network ,
normally run at boot
time.
This script uses the
.Va hostname
variable in
.Pa /etc/rc.conf .
.Pp
Options:
.Bl -tag -width flag
@@ -62,8 +58,7 @@ Trim off any domain information from the printed
name.
.El
.Sh SEE ALSO
.Xr gethostname 3 ,
.Xr rc.conf 5
.Xr gethostname 3
.Sh HISTORY
The
.Nm
+9 -6
View File
@@ -110,14 +110,17 @@ ALRM (alarm clock)
TERM (software termination signal)
.El
.Pp
Some shells may provide a builtin
.Nm Kill
is a built-in to
.Xr csh 1 ;
it allows job specifiers of the form ``%...'' as arguments
so process id's are not as often used as
.Nm
command which is similar or identical to this utility.
Consult the
.Xr builtin 1
manual page.
arguments.
See
.Xr csh 1
for details.
.Sh SEE ALSO
.Xr builtin 1 ,
.Xr csh 1 ,
.Xr killall 1 ,
.Xr ps 1 ,
-3
View File
@@ -5,7 +5,4 @@ PROG= ln
MAN1= ln.1
MAN7= symlink.7
LINKS= ${BINDIR}/ln ${BINDIR}/link
MLINKS= ln.1 link.1
.include <bsd.prog.mk>
+3 -27
View File
@@ -39,20 +39,17 @@
.Dt LN 1
.Os BSD 4
.Sh NAME
.Nm ln ,
.Nm link
.Nm ln
.Nd make links
.Sh SYNOPSIS
.Nm ln
.Op Fl fsv
.Op Fl fs
.Ar source_file
.Op target_file
.Nm ln
.Op Fl fsv
.Op Fl fs
.Ar source_file ...
.Op target_dir
.Nm link
.Ar source_file Ar target_file
.Sh DESCRIPTION
The
.Nm
@@ -75,10 +72,6 @@ The options are as follows:
Unlink any already existing file, permitting the link to occur.
.It Fl s
Create a symbolic link.
.It Fl v
Cause
.Nm
to be verbose, showing files as they are processed.
.El
.Pp
By default,
@@ -125,15 +118,6 @@ makes links in
.Ar target_dir
to all the named source files.
The links made will have the same name as the files being linked to.
.Pp
When the utility is called as
.Nm link ,
exactly two arguments must be supplied,
neither of which may specify a directory.
No options may be supplied in this simple mode of operation,
which performs a
.Xr link 2
operation using the two passed arguments.
.Sh SEE ALSO
.Xr link 2 ,
.Xr lstat 2 ,
@@ -141,16 +125,8 @@ operation using the two passed arguments.
.Xr stat 2 ,
.Xr symlink 2 ,
.Xr symlink 7
.Sh COMPATIBILITY
The
.Fl v
option is non-standard and its use in scripts is not recommended.
.Sh HISTORY
An
.Nm
command appeared in
.At v1 .
The simplified
.Nm link
command conforms to
.St -susv2 .
+5 -31
View File
@@ -57,10 +57,8 @@ static const char rcsid[] =
int fflag; /* Unlink existing files. */
int sflag; /* Symbolic, not hard, link. */
int vflag; /* Verbose output. */
/* System link call. */
int (*linkf) __P((const char *, const char *));
char linkch;
int linkit __P((char *, char *, int));
void usage __P((void));
@@ -73,26 +71,9 @@ main(argc, argv)
extern int optind;
struct stat sb;
int ch, exitval;
char *p, *sourcedir;
char *sourcedir;
/*
* Test for the special case where the utility is called as
* "link", for which the functionality provided is greatly
* simplified.
*/
if ((p = rindex(argv[0], '/')) == NULL)
p = argv[0];
else
++p;
if (strcmp(p, "link") == 0) {
if (argc == 3) {
linkf = link;
exit(linkit(argv[1], argv[2], 0));
} else
usage();
}
while ((ch = getopt(argc, argv, "fsv")) != -1)
while ((ch = getopt(argc, argv, "fs")) != -1)
switch (ch) {
case 'f':
fflag = 1;
@@ -100,9 +81,6 @@ main(argc, argv)
case 's':
sflag = 1;
break;
case 'v':
vflag = 1;
break;
case '?':
default:
usage();
@@ -112,7 +90,6 @@ main(argc, argv)
argc -= optind;
linkf = sflag ? symlink : link;
linkch = sflag ? '-' : '=';
switch(argc) {
case 0:
@@ -176,17 +153,14 @@ linkit(target, source, isdir)
warn("%s", source);
return (1);
}
if (vflag)
(void)printf("%s %c> %s\n", source, linkch, target);
return (0);
}
void
usage()
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: ln [-fsv] file1 file2",
" ln [-fsv] file ... directory",
" link file1 file2");
(void)fprintf(stderr, "%s\n%s\n",
"usage: ln [-fs] file1 file2",
" ln [-fs] file ... directory");
exit(1);
}
+1 -2
View File
@@ -132,8 +132,7 @@ The
.Bx 4.4
system differs from historical 4BSD systems in that the system call
.Xr chown 2
has been changed to follow symbolic links.
The
has been changed to follow symbolic links. The
.Xr lchown 2
system call was added later when the limitations of the new
.Xr chown 2
+3 -3
View File
@@ -44,10 +44,10 @@ int statcmp __P((const FTSENT *, const FTSENT *));
int revstatcmp __P((const FTSENT *, const FTSENT *));
char *flags_to_string __P((u_long, char *));
void prcopy __P((char *, char *, int));
void printcol __P((DISPLAY *));
void printlong __P((DISPLAY *));
void printscol __P((DISPLAY *));
void usage __P((void));
int len_octal __P((const char *, int));
int prn_octal __P((const char *));
int prn_printable __P((const char *));
int len_octal __P((char *, int));
int prn_octal __P((char *));
+5 -10
View File
@@ -100,8 +100,7 @@ or
options are specified.
.It Fl L
If argument is a symbolic link, list the file or directory the link references
rather than the link itself.
This option cancels the
rather than the link itself. This option cancels the
.Fl P
option.
.It Fl P
@@ -146,8 +145,7 @@ If the
option is specified, print the file size allocation in kilobytes,
not blocks. This option overrides the environment variable BLOCKSIZE.
.It Fl l
(The lowercase letter ``ell.'') List in long format.
(See below.)
(The lowercase letter ``ell.'') List in long format. (See below.)
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 o
@@ -254,8 +252,7 @@ the numeric ID's are displayed.
.Pp
If the file is a character special or block special file,
the major and minor device numbers for the file are displayed
in the size field.
If the file is a symbolic link the pathname of the
in the size field. If the file is a symbolic link the pathname of the
linked-to file is preceded by
.Dq \-> .
.Pp
@@ -320,8 +317,7 @@ The file is executable or the directory is
searchable.
.It Sy \-
The file is neither readable, writable, executable,
nor set-user-ID nor set-group-ID mode, nor sticky.
(See below.)
nor set-user-ID nor set-group-ID mode, nor sticky. (See below.)
.El
.Pp
These next two apply only to the third character in the last group
@@ -331,8 +327,7 @@ These next two apply only to the third character in the last group
The sticky bit is set
(mode
.Li 1000 ) ,
but not execute or search permission.
(See
but not execute or search permission. (See
.Xr chmod 1
or
.Xr sticky 8 . )
+2
View File
@@ -491,6 +491,8 @@ display(p, list)
continue;
}
}
if (f_nonprint)
prcopy(cur->fts_name, cur->fts_name, cur->fts_namelen);
if (cur->fts_namelen > maxlen)
maxlen = cur->fts_namelen;
if (f_octal || f_octal_escape) {
-1
View File
@@ -48,7 +48,6 @@ extern int f_inode; /* print inode */
extern int f_longform; /* long listing format */
extern int f_octal; /* print unprintables in octal */
extern int f_octal_escape; /* like f_octal but use C escapes if possible */
extern int f_nonprint; /* show unprintables as ? */
extern int f_sectime; /* print the real time for all files */
extern int f_size; /* list size in short listing */
extern int f_statustime; /* use time of last mode change */
+9 -19
View File
@@ -81,21 +81,6 @@ printscol(dp)
}
}
/*
* print name in current style
*/
static int
printname(name)
const char *name;
{
if (f_octal || f_octal_escape)
return prn_octal(name);
else if (f_nonprint)
return prn_printable(name);
else
return printf("%s", name);
}
void
printlong(dp)
DISPLAY *dp;
@@ -142,7 +127,8 @@ printlong(dp)
printtime(sp->st_ctime);
else
printtime(sp->st_mtime);
(void)printname(p->fts_name);
if (f_octal || f_octal_escape) (void)prn_octal(p->fts_name);
else (void)printf("%s", p->fts_name);
if (f_type)
(void)printtype(sp->st_mode);
if (S_ISLNK(sp->st_mode))
@@ -242,7 +228,8 @@ printaname(p, inodefield, sizefield)
if (f_size)
chcnt += printf("%*qd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
chcnt += printname(p->fts_name);
chcnt += (f_octal || f_octal_escape) ? prn_octal(p->fts_name)
: printf("%s", p->fts_name);
if (f_type)
chcnt += printtype(sp->st_mode);
return (chcnt);
@@ -323,6 +310,9 @@ printlink(p)
return;
}
path[lnklen] = '\0';
(void)printf(" -> ");
printname(path);
if (f_octal || f_octal_escape) {
(void)printf(" -> ");
(void)prn_octal(path);
}
else (void)printf(" -> %s", path);
}
+11 -13
View File
@@ -56,19 +56,17 @@ static const char rcsid[] =
#include "ls.h"
#include "extern.h"
int
prn_printable(s)
const char *s;
void
prcopy(src, dest, len)
char *src, *dest;
int len;
{
unsigned char c;
int n;
unsigned char ch;
for (n = 0; (c = *s) != '\0'; ++s, ++n)
if (isprint(c))
putchar(c);
else
putchar('?');
return n;
while (len--) {
ch = *src++;
*dest++ = isprint(ch) ? ch : '?';
}
}
/*
@@ -86,7 +84,7 @@ prn_printable(s)
int
len_octal(s, len)
const char *s;
char *s;
int len;
{
int r = 0;
@@ -98,7 +96,7 @@ len_octal(s, len)
int
prn_octal(s)
const char *s;
char *s;
{
unsigned char ch;
int len = 0;
+1 -12
View File
@@ -221,7 +221,7 @@ do_move(from, to)
* it's a regular file, do the copy internally; otherwise, use
* cp and rm.
*/
if (lstat(from, &sb)) {
if (stat(from, &sb)) {
warn("%s", from);
return (1);
}
@@ -290,17 +290,6 @@ err: if (unlink(to))
}
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode (was: 0%03o)", to, oldmode);
/*
* XXX
* NFS doesn't support chflags; ignore errors unless there's reason
* to believe we're losing bits. (Note, this still won't be right
* if the server supports flags and we were trying to *remove* flags
* on a file that we copied, i.e., that we didn't create.)
*/
errno = 0;
if (fchflags(to_fd, sbp->st_flags))
if (errno != EOPNOTSUPP || sbp->st_flags != 0)
warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
tval[0].tv_sec = sbp->st_atime;
tval[1].tv_sec = sbp->st_mtime;
+2 -4
View File
@@ -480,8 +480,7 @@ cannot be opened for reading and writing.
.It Fl k
Do not overwrite existing files.
.It Fl l
Link files.
(The letter ell).
Link files. (The letter ell).
In the
.Em copy
mode (
@@ -624,8 +623,7 @@ The optional trailing
.Cm g
continues to apply the substitution expression to the pathname substring
which starts with the first character following the end of the last successful
substitution.
The first unsuccessful substitution stops the operation of the
substitution. The first unsuccessful substitution stops the operation of the
.Cm g
option.
The optional trailing
+1 -1
View File
@@ -358,7 +358,7 @@ main(argc, argv)
*/
printheader();
if (nentries == 0)
exit(1);
exit(0);
/*
* sort proc list
*/
+3 -13
View File
@@ -47,13 +47,6 @@
.Nm Pwd
writes the absolute pathname of the current working directory to
the standard output.
.Pp
Some shells may provide a builtin
.Nm
command which is similar or identical to this utility.
Consult the
.Xr builtin 1
manual page.
.Sh DIAGNOSTICS
The
.Nm
@@ -65,17 +58,14 @@ utility is expected to be
.St -p1003.2
compatible.
.Sh SEE ALSO
.Xr builtin 1 ,
.Xr cd 1 ,
.Xr csh 1 ,
.Xr getcwd 3 ,
.Xr sh 1
.Xr getcwd 3
.Sh BUGS
In
.Xr csh 1
the command
.Ic dirs
is always faster because it is built into that shell.
However, it can give a different answer in the rare case
is always faster (although it can give a different answer in the rare case
that the current directory or a containing directory was moved after
the shell descended into it.
the shell descended into it).
+4 -9
View File
@@ -55,9 +55,7 @@ copies files between machines. Each
or
.Ar directory
argument is either a remote file name of the
form
.Dq rname@rhost:path ,
or a local file name (containing no `:' characters,
form ``rname@rhost:path'', or a local file name (containing no `:' characters,
or a `/' before any `:'s).
.Pp
The following options are available:
@@ -71,7 +69,7 @@ to obtain tickets
for the remote host in realm
.Ar realm
instead of the remote host's realm as determined by
.Xr krb_realmofhost 3 .
.Xr krb_realmofhost 3 .
.It Fl p
Cause
.Nm
@@ -131,9 +129,7 @@ configure authentication services
.Xr cp 1 ,
.Xr ftp 1 ,
.Xr rlogin 1 ,
.Xr rsh 1 ,
.Xr auth.conf 5 ,
.Xr hosts.equiv 5 .
.Xr rsh 1
.Sh HISTORY
The
.Nm
@@ -156,8 +152,7 @@ or
file on the remote host.
.Pp
The destination user and hostname may have to be specified as
.Dq rhost.rname
when the destination machine is running the
``rhost.rname'' when the destination machine is running the
.Bx 4.2
version of
.Nm Ns .
-3
View File
@@ -4,9 +4,6 @@
PROG= rm
SRCS= rm.c stat_flags.c
LINKS= ${BINDIR}/rm ${BINDIR}/unlink
MLINKS= rm.1 unlink.1
.PATH: ${.CURDIR}/../ls
.include <bsd.prog.mk>
+1 -19
View File
@@ -39,15 +39,12 @@
.Dt RM 1
.Os
.Sh NAME
.Nm rm ,
.Nm unlink
.Nm rm
.Nd remove directory entries
.Sh SYNOPSIS
.Nm rm
.Op Fl dfiPRrvW
.Ar file ...
.Nm unlink
.Ar file
.Sh DESCRIPTION
The
.Nm
@@ -119,16 +116,6 @@ It is an error to attempt to remove the files
or
.Dq .. .
.Pp
When the utility is called as
.Nm unlink ,
only one argument,
which must not be a directory,
may be supplied.
No options may be supplied in this simple mode of operation,
which performs an
.Xr unlink 2
operation on the passed argument.
.Pp
The
.Nm
utility exits 0 if all of the named files or file hierarchies were removed,
@@ -206,11 +193,6 @@ option if such behavior is desired. This follows the historical
behavior of
.Nm
with respect to directories.
.Pp
The simplified
.Nm unlink
command conforms to
.St -susv2 .
.Sh HISTORY
A
.Nm
+1 -21
View File
@@ -86,24 +86,6 @@ main(argc, argv)
char *argv[];
{
int ch, rflag;
char *p;
/*
* Test for the special case where the utility is called as
* "unlink", for which the functionality provided is greatly
* simplified.
*/
if ((p = rindex(argv[0], '/')) == NULL)
p = argv[0];
else
++p;
if (strcmp(p, "unlink") == 0) {
if (argc == 2) {
rm_file(&argv[1]);
exit(eval);
} else
usage();
}
Pflag = rflag = 0;
while ((ch = getopt(argc, argv, "dfiPRrvW")) != -1)
@@ -490,8 +472,6 @@ void
usage()
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: rm [-f | -i] [-dPRrvW] file ...",
" unlink file");
(void)fprintf(stderr, "usage: rm [-f | -i] [-dPRrvW] file ...\n");
exit(EX_USAGE);
}
-1
View File
@@ -109,7 +109,6 @@ setalias(name, val)
ap->val[len+1] = '\0';
}
#endif
ap->flag = 0;
ap->next = *app;
*app = ap;
INTON;
+1 -1
View File
@@ -342,7 +342,7 @@ getpwd()
INTOFF;
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
error("Pipe call failed");
jp = makejob((union node *)NULL, 1);
if (forkshell(jp, (union node *)NULL, FORK_NOJOB) == 0) {
(void) close(pip[0]);
-1
View File
@@ -51,7 +51,6 @@ static const char rcsid[] =
#include "options.h"
#include "output.h"
#include "error.h"
#include "nodes.h" /* show.h needs nodes.h */
#include "show.h"
#include "trap.h"
#include <signal.h>
+4 -31
View File
@@ -45,7 +45,6 @@ static const char rcsid[] =
#include <signal.h>
#include <unistd.h>
#include <sys/wait.h> /* For WIFSIGNALED(status) */
#include <errno.h>
/*
* Evaluate a command.
@@ -489,7 +488,7 @@ evalpipe(n)
if (lp->next) {
if (pipe(pip) < 0) {
close(prevfd);
error("Pipe call failed: %s", strerror(errno));
error("Pipe call failed");
}
}
if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) {
@@ -557,7 +556,7 @@ evalbackcmd(n, result)
} else {
exitstatus = 0;
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
error("Pipe call failed");
jp = makejob(n, 1);
if (forkshell(jp, n, FORK_NOJOB) == 0) {
FORCEINTON;
@@ -612,14 +611,12 @@ evalcommand(cmd, flags, backcmd)
volatile int e;
char *lastarg;
int realstatus;
int do_clearcmdentry;
#if __GNUC__
/* Avoid longjmp clobbering */
(void) &argv;
(void) &argc;
(void) &lastarg;
(void) &flags;
(void) &do_clearcmdentry;
#endif
/* First expand the arguments. */
@@ -628,7 +625,6 @@ evalcommand(cmd, flags, backcmd)
arglist.lastp = &arglist.list;
varlist.lastp = &varlist.list;
varflag = 1;
do_clearcmdentry = 0;
oexitstatus = exitstatus;
exitstatus = 0;
for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) {
@@ -691,29 +687,8 @@ evalcommand(cmd, flags, backcmd)
* is present
*/
for (sp = varlist.list ; sp ; sp = sp->next)
if (strncmp(sp->text, PATH, sizeof(PATH) - 1) == 0) {
if (strncmp(sp->text, PATH, sizeof(PATH) - 1) == 0)
path = sp->text + sizeof(PATH) - 1;
/*
* On `PATH=... command`, we need to make
* sure that the command isn't using the
* non-updated hash table of the outer PATH
* setting and we need to make sure that
* the hash table isn't filled with items
* from the temporary setting.
*
* It would be better to forbit using and
* updating the table while this command
* runs, by the command finding mechanism
* is heavily integrated with hash handling,
* so we just delete the hash before and after
* the command runs. Partly deleting like
* changepatch() does doesn't seem worth the
* bookinging effort, since most such runs add
* diretories in front of the new PATH.
*/
clearcmdentry(0);
do_clearcmdentry = 1;
}
find_command(argv[0], &cmdentry, 1, path);
if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */
@@ -753,7 +728,7 @@ evalcommand(cmd, flags, backcmd)
if (flags & EV_BACKCMD) {
mode = FORK_NOJOB;
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
error("Pipe call failed");
}
if (forkshell(jp, cmd, mode) != 0)
goto parent; /* at end of routine */
@@ -911,8 +886,6 @@ parent: /* parent process gets here (if we forked) */
out:
if (lastarg)
setvar("_", lastarg, 0);
if (do_clearcmdentry)
clearcmdentry(0);
popstackmark(&smark);
}
+2 -1
View File
@@ -104,6 +104,7 @@ STATIC void tryexec __P((char *, char **, char **));
STATIC void execinterp __P((char **, char **));
#endif
STATIC void printentry __P((struct tblentry *, int));
STATIC void clearcmdentry __P((int));
STATIC struct tblentry *cmdlookup __P((char *, int));
STATIC void delete_cmd_entry __P((void));
@@ -639,7 +640,7 @@ changepath(newval)
* PATH which has changed.
*/
void
STATIC void
clearcmdentry(firstchange)
int firstchange;
{
-1
View File
@@ -69,4 +69,3 @@ void addcmdentry __P((char *, struct cmdentry *));
void defun __P((char *, union node *));
int unsetfunc __P((char *));
int typecmd __P((int, char **));
void clearcmdentry __P((int));
+4 -5
View File
@@ -315,7 +315,7 @@ done:
goto lose;
*p = c;
while ((c = *home++) != '\0') {
if (quotes && c >= 0 && SQSYNTAX[(int)c] == CCTL)
if (quotes && SQSYNTAX[c] == CCTL)
STPUTC(CTLESC, expdest);
STPUTC(c, expdest);
}
@@ -478,7 +478,7 @@ expbackq(cmd, quoted, flag)
}
lastc = *p++;
if (lastc != '\0') {
if (quotes && lastc >= 0 && syntax[(int)lastc] == CCTL)
if (quotes && syntax[lastc] == CCTL)
STPUTC(CTLESC, dest);
STPUTC(lastc, dest);
}
@@ -694,8 +694,7 @@ again: /* jump here after setting a variable with ${var=text} */
}
else {
while (*val) {
if (quotes && *val >= 0 &&
syntax[(int)*val] == CCTL)
if (quotes && syntax[*val] == CCTL)
STPUTC(CTLESC, expdest);
STPUTC(*val++, expdest);
}
@@ -866,7 +865,7 @@ varvalue(name, quoted, allow_split)
if (allow_split) { \
syntax = quoted? DQSYNTAX : BASESYNTAX; \
while (*p) { \
if (*p >= 0 && syntax[(int)*p] == CCTL) \
if (syntax[*p] == CCTL) \
STPUTC(CTLESC, expdest); \
STPUTC(*p++, expdest); \
} \
+2 -1
View File
@@ -232,6 +232,7 @@ preadbuffer()
char *p, *q;
int more;
int something;
extern EditLine *el;
char savec;
if (parsefile->strpush) {
@@ -383,7 +384,7 @@ setinputfile(fname, push)
INTOFF;
if ((fd = open(fname, O_RDONLY)) < 0)
error("Can't open %s: %s", fname, strerror(errno));
error("Can't open %s", fname);
if (fd < 10) {
fd2 = copyfd(fd, 10);
close(fd);
+3 -5
View File
@@ -594,7 +594,7 @@ forkshell(jp, n, mode)
if (pid == -1) {
TRACE(("Fork failed, errno=%d\n", errno));
INTON;
error("Cannot fork: %s", strerror(errno));
error("Cannot fork");
}
if (pid == 0) {
struct job *p;
@@ -636,8 +636,7 @@ forkshell(jp, n, mode)
! fd0_redirected_p ()) {
close(0);
if (open("/dev/null", O_RDONLY) != 0)
error("Can't open /dev/null: %s",
strerror(errno));
error("Can't open /dev/null");
}
}
#else
@@ -648,8 +647,7 @@ forkshell(jp, n, mode)
! fd0_redirected_p ()) {
close(0);
if (open("/dev/null", O_RDONLY) != 0)
error("Can't open /dev/null: %s",
strerror(errno));
error("Can't open /dev/null");
}
}
#endif
+1 -1
View File
@@ -300,7 +300,7 @@ readcmdfile(name)
if ((fd = open(name, O_RDONLY)) >= 0)
setinputfd(fd, 1);
else
error("Can't open %s: %s", name, strerror(errno));
error("Can't open %s", name);
INTON;
cmdloop(0);
popfile();
+4
View File
@@ -187,6 +187,10 @@ popstackmark(mark)
INTOFF;
while (stackp != mark->stackp) {
if (stackp == NULL) {
write(2, "Oops, stackp deleted\n", 21);
abort();
}
sp = stackp;
stackp = sp->prev;
ckfree(sp);
+1 -4
View File
@@ -348,9 +348,6 @@ static const struct limits limits[] = {
#endif
#ifdef RLIMIT_SWAP
{ "swap limit", "kbytes", RLIMIT_SWAP, 1024, 'w' },
#endif
#ifdef RLIMIT_SBSIZE
{ "sbsize", "bytes", RLIMIT_SBSIZE, 1, 'b' },
#endif
{ (char *) 0, (char *)0, 0, 0, '\0' }
};
@@ -370,7 +367,7 @@ ulimitcmd(argc, argv)
struct rlimit limit;
what = 'f';
while ((optc = nextopt("HSatfdsmcnulb")) != '\0')
while ((optc = nextopt("HSatfdsmcnul")) != '\0')
switch (optc) {
case 'H':
how = HARD;
+1 -2
View File
@@ -66,7 +66,6 @@ static const char rcsid[] =
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
/*
@@ -479,7 +478,7 @@ ckfopen(file, mode)
FILE *fp;
if ((fp = fopen(file, mode)) == NULL) {
fprintf(stderr, "Can't open %s: %s\n", file, strerror(errno));
fprintf(stderr, "Can't open %s\n", file);
exit(2);
}
return fp;
+3 -4
View File
@@ -56,7 +56,6 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef __STDC__
#include <stdarg.h>
#else
@@ -124,7 +123,7 @@ main(argc, argv)
if (argc != 3)
error("usage: mknodes file");
if ((infp = fopen(argv[1], "r")) == NULL)
error("Can't open %s: %s", argv[1], strerror(errno));
error("Can't open %s", argv[1]);
while (readline()) {
if (line[0] == ' ' || line[0] == '\t')
parsefield();
@@ -233,9 +232,9 @@ output(file)
char *p;
if ((patfile = fopen(file, "r")) == NULL)
error("Can't open %s: %s", file, strerror(errno));
error("Can't open %s", file);
if ((hfile = fopen("nodes.h", "w")) == NULL)
error("Can't create nodes.h: %s", strerror(errno));
error("Can't create nodes.h");
if ((cfile = fopen("nodes.c", "w")) == NULL)
error("Can't create nodes.c");
fputs(writer, hfile);
+1 -1
View File
@@ -350,7 +350,7 @@ print(name)
*/
static char *macro[] = {
"#define is_digit(c)\t((c >= 0 && is_type+SYNBASE)[c] & ISDIGIT)",
"#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)",
"#define is_alpha(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && isalpha((unsigned char) (c)))",
"#define is_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalpha((unsigned char) (c))))",
"#define is_in_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalnum((unsigned char) (c))))",
+6 -15
View File
@@ -868,7 +868,6 @@ readtoken1(firstc, syntax, eofmark, striptabs)
int parenlevel; /* levels of parens in arithmetic */
int oldstyle;
char const *prevsyntax; /* syntax before arithmetic */
int synentry;
#if __GNUC__
/* Avoid longjmp clobbering */
(void) &out;
@@ -880,7 +879,6 @@ readtoken1(firstc, syntax, eofmark, striptabs)
(void) &oldstyle;
(void) &prevsyntax;
(void) &syntax;
(void) &synentry;
#endif
startlinno = plinno;
@@ -908,13 +906,7 @@ readtoken1(firstc, syntax, eofmark, striptabs)
CHECKEND(); /* set c to PEOF if at end of here document */
for (;;) { /* until end of line or end of word */
CHECKSTRSPACE(3, out); /* permit 3 calls to USTPUTC */
if (c < 0 && c != PEOF)
synentry = CWORD;
else
synentry = syntax[c];
switch(synentry) {
switch(syntax[c]) {
case CNL: /* '\n' */
if (syntax == BASESYNTAX)
goto endword; /* exit outer loop */
@@ -945,11 +937,10 @@ readtoken1(firstc, syntax, eofmark, striptabs)
else
setprompt(0);
} else {
if (dblquote && c != '\\' &&
c != '`' && c != '$' &&
(c != '"' || eofmark != NULL))
if (dblquote && c != '\\' && c != '`' && c != '$'
&& (c != '"' || eofmark != NULL))
USTPUTC('\\', out);
if (c >= 0 && SQSYNTAX[c] == CCTL)
if (SQSYNTAX[c] == CCTL)
USTPUTC(CTLESC, out);
else if (eofmark == NULL)
USTPUTC(CTLQUOTEMARK, out);
@@ -1248,7 +1239,7 @@ badsub: synerror("Bad substitution");
} else {
pungetc();
}
if (subtype != VSLENGTH && (dblquote || arinest))
if (dblquote || arinest)
flags |= VSQUOTE;
*(stackblock() + typeloc) = subtype | flags;
if (subtype != VSNORMAL)
@@ -1466,7 +1457,7 @@ noexpand(text)
continue;
if (c == CTLESC)
p++;
else if (c >= 0 && BASESYNTAX[(int)c] == CCTL)
else if (BASESYNTAX[c] == CCTL)
return 0;
}
return 1;
+1 -1
View File
@@ -246,7 +246,7 @@ openhere(redir)
int len = 0;
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
error("Pipe call failed");
if (redir->type == NHERE) {
len = strlen(redir->nhere.doc->narg.text);
if (len <= PIPESIZE) {
+1 -3
View File
@@ -1746,7 +1746,7 @@ for commands and tracked aliases
the complete pathname of the command is printed.
.It Xo
.Ic ulimit
.Op Fl HSabcdflmnust
.Op Fl HSacdflmnust
.Op Ar limit
.Xc
Set or display resource limits (see
@@ -1786,8 +1786,6 @@ The remaining options specify which resource value is to be
displayed or modified.
They are mutually exclusive.
.Bl -tag -width Ds
.It Fl b Ar sbsize
The maximum size of socket buffer usage, in bytes.
.It Fl c Ar coredumpsize
The maximal size of core dump files, in 512-byte blocks.
.It Fl d Ar datasize
+1 -1
View File
@@ -420,7 +420,7 @@ opentrace() {
scopy("./trace", s);
#endif /* not_this_way */
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s: %s\n", s, strerror(errno));
fprintf(stderr, "Can't open %s\n", s);
return;
}
#ifdef O_APPEND
+1 -2
View File
@@ -89,8 +89,7 @@ number seconds later:
.Dl (sleep 1800; sh command_file >& errors)&
.Pp
This incantation would wait a half hour before
running the script command_file.
(See the
running the script command_file. (See the
.Xr at 1
utility.)
.Pp
+2 -4
View File
@@ -313,8 +313,7 @@ If
is set, echo control characters as ^X. Otherwise control characters
echo as themselves.
.It Cm echoprt Pq Fl echoprt
For printing terminals.
If set, echo erased characters backwards within ``\\''
For printing terminals. If set, echo erased characters backwards within ``\\''
and ``/''. Otherwise, disable this feature.
.It Cm noflsh Pq Fl noflsh
Disable (enable) flush after
@@ -468,8 +467,7 @@ performed by either the terminal hardware or by the remote side connected
to a pty.
.It Cm raw Pq Fl raw
If set, change the modes of the terminal so that no input or output processing
is performed.
If unset, change the modes of the terminal to some reasonable
is performed. If unset, change the modes of the terminal to some reasonable
state that performs input and output processing. Note that since the
terminal driver no longer has a single
.Dv RAW
+1 -2
View File
@@ -94,8 +94,7 @@ True if
.Ar file
exists and is a symbolic link.
This operator is retained for compatibility with previous versions of
this program.
Do not rely on its existence; use
this program. Do not rely on its existence; use
.Fl L
instead.
.It Fl k Ar file
+1 -6
View File
@@ -163,13 +163,8 @@ main(argc, argv)
char **argv;
{
int res;
char *p;
if ((p = rindex(argv[0], '/')) == NULL)
p = argv[0];
else
p++;
if (strcmp(p, "[") == 0) {
if (strcmp(argv[0], "[") == 0) {
if (strcmp(argv[--argc], "]"))
errx(2, "missing ]");
argv[argc] = NULL;
+2 -2
View File
@@ -335,8 +335,8 @@ Department of Computing, Imperial College, London, UK.
Department of Computer Science, Columbia University,
New York, USA.
.Pp
Other authors and contributors to am-utils are listed in the
.Pa AUTHORS
.An Other authors and contributors to am-utils are listed in the
.Nm AUTHORS
file distributed with am-utils.
.Sh HISTORY
The
+2 -2
View File
@@ -678,8 +678,8 @@ Department of Computer Science, Columbia University, New York, USA.
.An Jan-Simon Pendry Aq [email protected] ,
Department of Computing, Imperial College, London, UK.
.Pp
Other authors and contributers to am-utils are listed in the
.Pa AUTHORS
.An Other Authors and contributers to am-utils are listed in the
.Nm AUTHORS
file distributed with am-utils.
.Sh HISTORY
The
+2 -8
View File
@@ -463,13 +463,7 @@ check_pos:
break;
case '0':
/*
* Only turn on zero_flag if we haven't seen
* the field width or precision yet. Otherwise,
* screws up floating point formatting.
*/
if (cur == & fw)
zero_flag = TRUE;
zero_flag = TRUE;
if (lj)
goto retry;
/* FALL through */
@@ -2012,7 +2006,7 @@ NODE *tree;
free_temp(tmp);
if (do_lint) {
if (d < 0)
if (uval < 0)
warning("compl(%lf): negative value will give strange results", d);
if (double_to_int(d) != d)
warning("compl(%lf): fractional value will be truncated", d);
-610
View File
@@ -1,613 +1,3 @@
--- 8.2.3-REL released ---
1139. [bug] inet_{net_,}ntop() had an off-by-one error.
1138. [bug] purge_nonglue() should only be fatal on master
servers.
1138. [port] add include/errs.h to various ports.
winnt: #1130 caused linkage failures.
--- 8.2.3-RC5 released ---
1137. [bug] rfc1034 escape sequences not processed when replaying
updates.
1136. [port] winnt: named nolonger creates resolv.conf.
1135. [bug] fixup from #1130/1132.
1134. [port] winnt: SIOCGIFADDR, SIOCGIFFLAGS, SIOCGIFDSTADDR and
mkstemp() fixes.
1133. [bug] sorting of SIG/non-SIG records prior to rrset ordering
of was broken.
--- 8.2.3-RC4 released ---
1132. [lint] more #1130.
1131. [support] TTL 0 is now allowed in zone files.
1130. [lint] massive, massive delinting from "gcc -Wall".
1129. [support] "max_log_size_ixfr" is now a scaled number (4m, etc).
1128. [contrib] updated mdnkit.
1127. [port] winnt: support for more interfaces, dnskeygen.
1126. [bug] resolver: close cached file descriptors when socket()
fails.
1125. [bug] when ns_addr_list is rotated, rotate cached file
descriptors.
1124. [bug] the select() timeout was not always being correctly
computed.
1123. [bug] changes to ns_addr_list were not being reflected into
our private copy.
1122. [port] sco: DESTRUN and DESTSBIN can't be the same.
1121. [cleanup] re-word "server is ??? priming" status message.
1120. [bug] more #1108 fine tuning.
1119. [bug] "delete all" RRs were not being printed correctly.
1118. [port] winnt: always install the named executable
1117. [port] linux: turn off returning ICMP port unreachables.
1116. [bug] minor tweak to #1108
1115. [bug] fail if tsig transfers are requested but we can't
communicate the keys to named-xfer.
1114. [bug] remove extraneous semi-colon from ns_parser.y
--- 8.2.3-T9B released ---
1113. [support] show config file name and age in "ndc status"
1112. [support] "ndc status" no longer mentions loading of config.
1111. [port] some versions of sunos don't have _POSIX_PATH_MAX
1110. [bug] zones with Null keys at delegation incorreclty rejected.
1109. [support] named-xfer was bombing on non-TSIG'd zones
1108. [support] ignore queries that come in during long synch ops
1107. [func] allow the default syslog facility to be set by
adding -DISC_FACILITY=<value> to CDEBUG in Makefile.set.
1106. [func] host statistics can now be cleared after they are
dumped. Use "ndc stats clear".
1105. [func] host-statistics-max can be used to set a upper bound
on the number hosts we collect statistics against.
1104. [func] the source of a record is no longer dependent on
setting "host-statistics yes;"
1103. [doc] winnt: updated port specific notes.
1102. [port] winnt: BINDctrl fixes
1101. [port] winnt: install fixes
1100. [bug] named-xfer some memory allocations were not checked.
1099. [bug] more missing INIT_LINK's.
1098. [support] force gmake to fail if the sub-shell fails.
1097. [port] winnt: lower the logging level so that BINDCtrl status
checks do not cause the eventlog to fillup.
1096. [bug] don't pass '-i' to named-xfer unless we are going
to attempt a IXFR.
1095. [bug] dig: report missing arguements.
1094. [port] winnt: more cylink fixes, updated install.
1093. [bug] winnt: build lib cylink correctly
1092. [cleanup] winnt: snmpmib.c is nolonger required
1091. [support] winnt: workout the install directory.
1090. [bug] winnt: install was copying old over new.
1089. [bug] winnt: fix copyright for nameserver.c
winnt: snmpmib.c not needed in libbind.dsp
1088. [bug] #1053 still contained NAPTR problems.
--- 8.2.3-T8B released ---
1087. [port] sunos/gcc _POSIX_PATH_MAX isn't defined when it should
be.
1086. [doc] malformed man page for heap.
1085. [bug] ixfr responses to zones we don't server were malformed.
1084. [bug] INIT_LINK before APPEND in four more places.
1083. [support] only log "no options before zone" config error
before FIRST zone [kjd].
1082. [bug] have client-side IXFR work in single answer mode [kjd].
1081. [bug] have server-side IXFR work in single answer mode [kjd].
1080. [support] still do IXFR's even when a file name is not specified
for zone [kjd].
1079. [support] need to have a file name for a hints zone [kjd].
1078. [port] WinNT interface enumeration fixes from Danny Mayer.
1077. [support] format string audit.
1076. [port] now recognize RH7.0's "strndup()"
1075. [contrib] add contrib/resparse-1.3 [Henning Schulzrinne @CU]
1074. [support] INSIST that lists are correctly managed.
1073. [port] Win/NT port work from Danny Mayer. Dig, host and
nslookup have been added.
1072. [port] work around a gcc bug on solaris.
1071. [bug] memory leak in res_nsendsigned().
1070. [bug] We were accepting non syntactically valis SOA records.
1069. [port] movefile() is now part of libbind as isc_movefile(),
remaining rename() calls converted to isc_movefile().
1068. [bug] purge the zone from memory if an error is detected
on loading.
1067. [bug] reload the parent zone if loading the child zone fails,
the parent zone may otherwise be corrupted.
1066. [bug] refresh/retry timer need to be reset after IXFR
1065. [bug] IXFR change list could be freed to early.
1064. [bug] unchecked memget in sx_send_ixfr().
1063. [bug] fix #1041 was incomplete.
1062. [bug] host printed out address records multiple times if
they were at the end of a CNAME chain.
1061. [bug] host failed to look for A records for the second an
subsequent entries in the search list when using
the default lookup.
1060. [bug] $GENERATE did not reject a out of zone LHS.
1059. [bug] res_findzonecut() contained a bad debugging printf.
1058. [bug] possible NULL pointer de-reference in
dst_key_to_buffer().
1057. [doc] document that bogus causes anti-alias processing.
1056. [bug] ns_sprintrrf() could incorrectly print "." as "@".
1055. [bug] aa was being cleared on notify "queries" prior to
testing.
1054. [bug] NAPTR records were using name compression.
1053. [bug] NAPTR records were not being printed correctly.
1052. [bug] UPDATES w/ NAPTR records were failing.
1051. [contrib] YADDAS: Yet another DNS database awk script.
1050. [bug] named-bootconf did not handle cacheless secondary/stub
zones. NOTE cacheless secondary/stub zones are not
recommended.
1049. [bug] buffer overruns by 1 in getnameinfo().
1048. [bug] ns_ctl_install() was corrupting the server_controls
list.
1047. [bug] req_iquery() wasn't doing a final update on buflenp.
1046. [port] Win/NT port improved by its author.
--- 8.2.3-T7B released ---
1045. [bug] forwarded and initiated TCP queries weren't affected
by the "query-source" config option, and weren't being
set nonblocking.
1044. [support] add HITCOUNTS compile-time option (from [email protected]).
1043. [bug] dnsquery's command line args could overflow buffers.
1042. [doc] maintain-ixfr-base had wrong description in
named.conf(5).
1041. [bug] host assumed axfr returned "one-answer" responses.
1040. [bug] add d_rcnt processing to update processing.
1039. [bug] qcomp wasn't stable.
1038. [port] solaris needs a strerror that does not return NULL,
call isc_strerror instead.
1037. [support] soften #1025 -- continue to accept !AA notify req's.
1036. [debug] add TKEY debugging support.
1035. [bug] ndc's "help" command worked in signal but not channel
mode.
1034. [bug] loc_ntoa() failed to correctly print altitudes in the
range [-0.99 .. -0.01].
1033. [port] Win/NT portability infusion from Larry @NortelNetworks.
1032. [bug] fix minor signal buglet introduced in #1029.
1031. [bug] nslookup now correctly refuses to accept qtypes AXFR
or IXFR. (use nslookup "ls", not queries, for this.)
1030. [protocol] nslookup "ls" command now uses writev() rather than two
write()'s, to get msglen and query into same tcp seg.
--- 8.2.3-T6B released ---
1029. [bug] incredibly busy systems could starve handle_needs().
1028. [protocol] unrecognized TSIG was returning NOERROR (now NOTAUTH).
1027. [support] INSIST(), ENSURE(), et al, now always have sideeffects.
1026. [port] some kernels bogusly return tv_usec>1000000 from
gettimeofday(). panic and dump core when this happens.
1025. [proto] NOTIFY messages should have AA.
1024. [bug] we were unwilling to use the last 10 octets of a
response buffer in certain transaction types.
1023. [port] HP-UX 10.20 was looping inside contrib/dnssigner.
1022. [port] ensure that all handled signals are unblocked.
1021. [bug] the "host" command wasn't properly printing SRV RR's.
1020. [contrib] new "updatehosts" (V1.1.0) contributed by author.
1019. [port] separate CFLAGS and CPPFLAGS for unusual builds.
1018. [bug] When maintain_ixfr_base is set to "no" a zones IXFR
file was still being written too.
1017. [doc] resolver(3) was out of date with respect to recent API
changes.
1016. [bug] nslookup wasn't properly printing SIG RR's.
1015. [bug] when merging group information gr_name and gr_passwd
could be left pointing at freed memory.
1014. [bug] iquery: DoS (potential), information leak.
1013. [bug] mangled hostent structures returned by
gethostbyname_r() and friends.
1012. [doc] add named-bootconf example to INSTALL.
1011. [bug] if spawnxfer() fails we should return immediately.
1010. [bug] bad responses to the initial IXFR/SOA query could
result in using an uninitalised variable.
1009. [port] Add support for darwin / Mac OS X
1008. [doc] specify allow-query default in named.conf.
1007. [bug] only set STREAM_AXFRIXFR if the original query is
an IXFR.
--- 8.2.3-T5B (RC3) released ---
1006. [port] Windows/NT does not have fchown().
1005. [bug] RD was sometimes left set, inappropriately.
1004. [bug] cached NXT's were corrupted.
1003. [bug] correction to #997.
1002. [bug] file descriptor leak in res_nclose().
1001. [port] some builds were too fast.
--- 8.2.3-T4B (RC2) released ---
1000. [bug] #996 was wrongly implemented; replacement fix.
--- 8.2.3-T3B released ---
999. [support] named now makes an effort to create its files with
ownership as specified by -u and -g command options.
998. [support] show version number in NOTIFY log messages.
997. [support] forwarders are now used in order by measured RTT.
996. [protocol] if answering ixfr with full zone, used qtype axfr.
995. [bug] "dig -b" was broken due to missing switch "break;"
994. [bug] named-xfer did not handle empty question sections.
993. [bug] TSIG AXFR was completely broken in DiG.
992. [bug] OPTION_USE_IXFR and OPTION_MAINTAIN_IXFR_BASE had
non-single-bit flag values in src/bin/named/ns_defs.h.
991. [protocol] send A6 glue records in xfr.
990. [bug] we could loose track of a bottom of zone cut if the
write buffer filled up at just the correct moment.
989. [bug] apply to "fetch-glue no;" to notify processing. need
to add A records that would be found this way w/
also-notify.
988. [support] report expired zones when detected in maintainence
pass.
987. [feature] "ndc reconfig -noexpired" skip attempts to load
expired zoned when reconfiguring.
986. [bug] pushlev only needs to be called for axfr/zxfr not ixfr.
--- 8.2.3-T2B released ---
985. [support] remove "view" command from nslookup (it used mktemp()).
984. [bug] always restart processing query from scratch if we
have chased a CNAME as we might still have the answer
in the cache once the CNAME has been resolved.
983. [support] "notify from non-master server" is now debug, not info.
982. [bug] rollback the compression pointers array when a
RRset/RR does not fit.
981. [port] decunix: typedef (u_)int#m_t
980. [bug] mishandled memget failure w/ TCP connections.
979. [bug] we were failing to call ns_stopxfrs() before calling
purge_zone() in some cases.
978. [port] sco50: setsockopt(SO_REUSEADDR) fails on unix domain
sockets
977. [bug] we should be returning notimpl for update forwarding
rather than refused. a client receiving refused
should terminate the update attempt. notimpl should
just cause the client to skip to the next server.
976. [bug] some stats weren't getting incremented, & added a few.
975. [support] SLAVE_FORWARD is now redundant and has been removed.
974. [port] ultrix with vendor's y2k patch explicitly desupported.
973. [bug] some field names added in #935 conflicted with macros.
972. [support] restore heartbeat notifies.
971. [bug] out of order updates in log.
970. [port] solaris: add ipv6 interface scanning support.
969. [bug] post process a zone load to remove any non-glue at
or below bottom of zone.
968. [bug] TSIGs failed to verify if the key name was compressed.
967. [bug] zones signed by the BIND 9 signer failed to load.
--- 8.2.3-T1A released ---
966. [bug] nslookup and dig misprinted root zone in $ORIGIN.
965. [feature] dig's command line input buffer was rather small.
964. [bug] make res_nsearch() behave like res_search() of olde.
963. [bug] res_debug::do_section() can no longer spin all VM.
962. [bug] another almost-complete rewrite of IXFR from kjd (462)
961. [bug] acl "none" now fails to match but doesn't end search.
960. [bug] more hesiod library fixes from danny.
959. [doc] christos fixed several man page typos and brainos.
958. [bug] getnameinfo() should accept experimental/multicast.
957. [port] ultrix again. "cd" now presumed to be silent again.
956. [bug] multiline was not being cleared correctly.
955. [bug] explicit TTL on SOA records were being replaced with
soa minimum.
954. [bug] cannot load a signed root zone.
953. [bug] memory overrun in set_zone_ixfr_file().
952. [bug] errs was not being correctly adjusted if the included
master file did not exist in db_load().
951. [bug] contrib/dns_signer/signer: write_trim_name
array bounds write error.
950. [bug] hesiod: ctx->res was not being initalised.
949. [port] aix32: add prand_conf.h and define WCOREDUMP
948. [bug] fixed logic error in a number of expressions causing
res_ninit() not to be called when it should be.
947. [bug] sanity check in dst_read_key() wasn't.
946. [port] freebsd: threaded library support.
945. [bug] wrong file name logged in ixfr_have_log().
944. [doc] add forwarders to zone types master/slave/stub in
named.conf man page.
943. [bug] raise CNAME and OTHER / multiple CNAME logging to
warning.
942. [bug] bad referrals logged for forwarders.
941. [bug] lame server detection wasn't checking for SOA record.
940. [clarity] unapproved -> denied in log messages.
939. [bug] reload_master and purgeandload should write the zone
if it has been updated.
938. [bug] update and ixfr logs could get corrupted. fseek()
before ftell() on fopen(, "a+") file.
937. [support] allow parallel makes to work.
936. [protocol] add preliminary A6 glue recognition in ns_req.
935. [cleanup] res_nsend() segmented into multiple functions for
readability. also fixed two file descriptor leaks.
CAN_RECONNECT is gone, keep one socket per nameserver.
934. [bug] Perror and Aerror where incorrect if DEBUG is not
defined.
933. [port] cygwin port added
932. [port] sco42 does not have unix domain sockets or gethostid.
931. [bug] eventlib was not handling unix domain sockets
correctly.
930. [bug] we wern't using all the potential compression pointers
in the question section.
929. [bug] we were accepting updates (adds) with illegal ttls.
928. [bug] if we manage to get a illegal ttl stored, print it
unsigened.
927. [port] hpux: (11.* 10.30) Makefile.set.gcc
926. [port] hpux10: gcc needs -D_HPUX_SOURCE and -fPIC
925. [protocol] when a slave loads it should notify others (RFC 1996).
924. [port] sunos solaris: #define NEED_SECURE_DIRECTORY to
secure the directory containing unix domain socket
rather than the socket itself.
923. [support] shutup "make clean" about missing threaded directories.
922. [bug] removing an cached zone file then performing a
"ndc reload zone" should force a zone transfer.
921. [bug] nsupdate: listuprec was not being initalised.
920. [port] aix4: Makefile.set.gcc
aix4: __P was being defined by <net/radix.h>
919 [port] linux: remove one level of symbolic linkage when
performing make links on port/linux/include
918. [bug] update prerequisite could match w/ wildcard.
917. [port] irix: make the current IRIX release (6.5) work by
not patching res_debug.c. see INSTALL if you have
problems with 6.3.
916. [bug] removing / changing a zone type could result in
Z_NOTIFY being cleared / tested against the wrong zone.
915. [bug] evNewWaitList() was not maintaining the prev chain.
914. [bug] signal EWOULDBLOCK if EV_POLL'ing with no timers.
913. [bug] input could get lost on the server side of a ctl sock.
912. [bug] nsupdate now allows explicit 0 TTL's on added RR's.
911. [bug] gethostbyname() should not return duplicate addresses.
910. [bug] address-sorting logic was exiting early.
909. [bug] dig wasn't respecting the +ti and +ret arguments.
908. [contrib] Tony Stoneley sent us an updated misc/makezones.
907. [port] winnt fixes from Larry at Nortel.
906. [bug] res_findzonecut() failed if the NS referred to a CNAME.
905. [doc] Minor fix to doc/man/Makefile for getnameinfo
904. [bug] bin/host wasn't looking up MX records if no
-t flags were passed to it.
--- 8.2.2-P6 released ---
903. [bug] divide by zero bug when querying for SIG records from
a secure zone.
902. [support] don't attempt to set q_fzone if we won't be using it.
901. [support] delay notify timer setting until all zones have been
loaded.
900. [port] hpux10 fix call to bison; sco call bison consistenly.
899. [bug] dynamically allocate buffer used to display RR rather
than uses a fixed sized one. grow as needed.
898. [bug] if truncation caused no RR's to appear in the answer we
mis-classified the answer on a NODATA.
897. [support] descriptors used by named should not be inherited by
named-xfer.
896. [contrib] add contrib/adm/adm-nxt, an exploit for the NXT bug
in 8.2 and 8.2.1. as before, we do not recommend its
use, and we do recommend that you run the latest BIND.
--- 8.2.2-P5 released ---
895. [port] minor NT build and documentation improvements.
+5 -17
View File
@@ -1,26 +1,23 @@
Systems it is known to compile and run on:
BSD/OS 3.1, 4.0.1
FreeBSD 3.3, 3.4
FreeBSD 3.1, 3.2, 3.3
RH Linux 5.2 (don't use "make links" when building, though)
Debian GNU/Linux 2.2.9 ("unreleased")
Digital UNIX 3.2C, 4.0, 5.0
NetBSD/i386 1.3.2, 1.4
Darwin 1.x (Mac OS X)
SunOS 5.6 (Solaris 2.6), SunOS 5.7 (Solaris 7)
SCO UnixWare 7.0, 7.0.1, 7.1
IRIX 6.5
Systems it has been known in the past to compile and run on:
AIX 4.x
A/UX 3.1.1
Digital ULTRIX 4.5 (without Compaq's Y2K kit installed)
Digital ULTRIX 4.5
HP MPE
HP-UX 9.x, 10.20
IRIX 5.3, 6.2, 6.4
LynxOS
FreeBSD 3.1, 3.2
NetBSD 1.2, 1.3
OpenBSD 2.1
QNX
@@ -142,12 +139,6 @@ Operating System Notes
The kit should compile even if you have intalled the KAME
IPv6 kit.
IRIX
build problems have been reported w/ IRIX 6.3, res_debug.c
and #include <stdlib.h>. You may need to comment out
the #include <stdlib.h> and declare
"void *malloc(size_t size)" to get named to compile on 6.3.
Linux
"make links" and "make stdlinks" cause problems on
@@ -175,7 +166,7 @@ Operating System Notes
"port/solaris/Makefile.set.gcc" to "port/solaris/Makefile.set".
If you're using a Solaris release earlier than 2.5 and you have
a large number of interfaces on your system, you many need to
a large number of interfaces on your system, you many need
use a script to "limit descriptors N" (where 'N' is a
suitably large number) before execing "named". On Solaris
2.5 and later, the server will do this itself.
@@ -266,11 +257,8 @@ Using the Server
there are lots of {curly braces} and it takes some getting used to.
You may get a lot more help from the example file (which is
bin/named/named.conf) than from the documentation (see ../doc/html).
You can convert your named.boot file to a named.conf file using
bin/named-bootconf/named-bootconf.
e.g.
named-bootconf < /etc/named.boot > /etc/named.conf
You can convert your named.boot file to a named.conf file if you have
Perl; see bin/named/named-bootconf.pl.
All the files that used to be created in /var/tmp, e.g. named.run,
will now be created in the directory specified in the options
+2 -2
View File
@@ -1,4 +1,4 @@
## Copyright (c) 1993-2000 by Internet Software Consortium, Inc.
## Copyright (c) 1993-1999 by Internet Software Consortium.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
@@ -19,4 +19,4 @@
Tel: 1-888-868-1001 (toll free in U.S.)
Tel: 1-650-779-7091
Fax: 1-650-779-7055
Email: <[email protected]>
Email: [email protected]
+3 -3
View File
@@ -13,7 +13,7 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.52 2000/11/21 12:54:37 marka Exp $
# $Id: Makefile,v 8.51 1999/11/06 03:24:02 vixie Exp $
TOP=
SUBDIRS= include port lib bin
@@ -37,7 +37,7 @@ all clean depend install distclean:: FRC
eval "${MAKE} $$settings ${MARGS} SYSTYPE=$$systype \
VER=$$version \
$@"; \
) || exit 1; \
); \
done \
fi
@@ -52,7 +52,7 @@ links: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
${MAKE} ${MARGS} SYSTYPE=$$systype links; \
) || exit 1; \
); \
done
stdlinks: FRC
+20 -17
View File
@@ -1,5 +1,5 @@
This is the source portion of BIND version 8. Its companions are "doc" and
"contrib" so you are probably not missing anything.
This is the source portion of BIND version 8.2.2, Patchlevel 5. Its
companions are "doc" and "contrib" so you are probably not missing anything.
See the CHANGES file for a detailed listing of all changes. See the INSTALL
file for information on building and installing BIND.
@@ -7,19 +7,17 @@ file for information on building and installing BIND.
See the SUPPORT file for information on obtaining commercial support for ISC
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.
SECURITY NOTE:
BIND 8.2.3 Highlights
Improved support for Windows NT and Windows 2000.
Host stats are no longer required to track the source of a record.
IXFR improvements.
Forwarders track and use RTT to select fastest.
Unix domain sockets implementions that require the directory
to be secure, are now secured.
Many minor problems fixed.
Linux DoS removed.
Solaris and other pre-4.4BSD kernels do not respect ownership or
protections on UNIX-domain sockets. This means that the default
path for the NDC control socket (/var/run/ndc) is such that any
user (root or other) on such systems can issue any NDC command
except "start" and "restart". The short term fix for this is to
override the default path and put such control sockets into root-
owned directories which do not permit non-root to r/w/x through them.
The medium term fix is for BIND to enforce this requirement internally.
The long term fix is for all kernels to upgrade to 4.4BSD semantics.
BIND 8.2.2 patchlevel 5 Highlights
@@ -49,6 +47,7 @@ BIND 8.2.2 Highlights
New global options for "transfer-source" and "also-notify".
$GENERATE now supports more record types, and options.
BIND 8.2.1 Highlights
Bug fixes, especially to DNSSEC, TSIG, IXFR, and selective forwarding.
@@ -73,6 +72,7 @@ BIND 8.2 Highlights
Documentation improvements
Performance enhancements
BIND 8.1.2 Highlights
Security fixes for a number of problems including:
@@ -133,6 +133,7 @@ BIND 8.1.2 Highlights
Experimental -u (set user id), -g (set group id), and -t (chroot)
command line options. See the INSTALL file for details.
BIND 8 Features
-> DNS Dynamic Updates (RFC 2136)
@@ -154,6 +155,7 @@ BIND 8 Features
-> Many bug fixes
File and Directory Overview
CHANGES history of added features and
@@ -194,6 +196,7 @@ Kits, Questions, Comments, and Bug Reports
<URL:http://www.isc.org/bind.html> the BIND home page
<URL:mailto:[email protected]> bug reports
To Support the Effort
Note that BIND is supported by the Internet Software Consortium, and
@@ -205,6 +208,6 @@ To Support the Effort
The Internet Software Consortium has also commissioned a DHCP server
implementation, has taken over official support/release of the INN
system, and has supported the Kerberos Version 5 effort at MIT. You
can learn more about the ISC's goals and accomplishments from the web
page at <URL:http://www.isc.org/>.
system, and supports the Kerberos Version 5 effort at MIT. You can
learn more about the ISC's goals and accomplishments from the web page
at <URL:http://www.isc.org/>.
+10 -9
View File
@@ -1,9 +1,10 @@
The Internet Software Consortium offers, through certified providers, support,
training, and consulting for BIND and DHCP. These programs are documented on
our web page at:
http://www.isc.org/support.html
Discussion about programs to meet your needs is welcome at [email protected].
Please forward your questions there or call us at +1 650 779-7018 to speak
with the Director of Client Services.
> The Internet Software Consortium now offers support agreements for ISC
> software. Under these programs, organizations using BIND, DHCP or INN
> from ISC can obtain a range of on call assistance, bug fixes, training and
> consultation services. These programs are documented on our web page at:
>
> http://www.isc.org/support.html
>
> Discussion about programs to meet your needs is welcome at
> [email protected]. Please forward your questions there or call us at
> +1 650 779-7018 to speak with the Director of Client Services.
+1 -1
View File
@@ -1 +1 @@
8.2.3-REL
8.2.2-P5-NOESW
+8 -9
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.30 2000/12/23 08:02:48 vixie Exp $
# $Id: Makefile,v 8.27 1999/08/08 17:13:24 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ..
O=o
A=a
@@ -54,12 +54,11 @@ MARGS = "SYSTYPE=${SYSTYPE}" "SHELL=${SHELL}" "A=${A}" "O=${O}" \
"RANLIB=${RANLIB}" "AR=${AR}" "ARPREF=${ARPREF}" "ARSUFF=${ARSUFF}" \
"INCL=../${INCL}" "PORTINCL=../${PORTINCL}" "EXE=${EXE}" \
"LIBBIND=../${LIBBIND}" "LIBPORT=../${LIBPORT}" \
"INSTALL=${INSTALL}" "TOP=../${TOP}" \
"INSTALL=${INSTALL}" "CPPFLAGS=${CPPFLAGS}" "TOP=../${TOP}" \
"VER=${VER}" "STRIP=${STRIP}" "PS=${PS}" "INSTALL_LIB=${INSTALL_LIB}" \
"INSTALL_EXEC=${INSTALL_EXEC}" "BOUNDS=${BOUNDS}"
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
SUBDIRS = addr nslookup dig dnsquery host named named-xfer ndc nsupdate \
mkservdb irpd dnskeygen named-bootconf
@@ -67,11 +66,11 @@ SUBDIRS = addr nslookup dig dnsquery host named named-xfer ndc nsupdate \
all: ${SUBDIRS}
${SUBDIRS}: FRC
@(cd $@; pwd; ${MAKE} ${MARGS}) || exit 1
@(cd $@; pwd; ${MAKE} ${MARGS})
install depend tags clean distclean::
@for x in ${SUBDIRS}; do \
(cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
(cd $$x; pwd; ${MAKE} ${MARGS} $@); \
done
distclean:: clean
@@ -85,7 +84,7 @@ links: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
$(MAKE) $(MARGS) links; \
) || exit 1; \
); \
done
FRC:
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.27 2000/12/23 08:02:49 vixie Exp $
# $Id: Makefile,v 8.25 1999/08/08 17:51:00 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -42,8 +42,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= addr
SRCS= ${PROG}.c
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.27 2000/12/23 08:02:50 vixie Exp $
# $Id: Makefile,v 8.25 1999/08/08 17:51:01 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -42,8 +42,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
NSLOOKUP_OBJS= \
../nslookup/subr.${O} ../nslookup/send.${O} \
+52 -88
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
static const char rcsid[] = "$Id: dig.c,v 8.36 1999/11/05 05:05:14 vixie Exp $";
#endif
/*
@@ -167,7 +167,6 @@ static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
#include <isc/dst.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -185,8 +184,8 @@ static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
/* Global. */
#define VERSION 83
#define VSTRING "8.3"
#define VERSION 82
#define VSTRING "8.2"
#define PRF_DEF 0x2ff9
#define PRF_MIN 0xA930
@@ -201,6 +200,7 @@ static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
static int eecode = 0;
static FILE * qfp;
static int sockFD;
static char *defsrv, *srvmsg;
static char defbuf[40] = "default -- ";
static char srvbuf[60];
@@ -227,7 +227,7 @@ char *pager = NULL;
/* Forward. */
static void Usage(void);
static int setopt(const char *);
static int SetOption(const char *);
static void res_re_init(void);
static int xstrtonum(char *);
static int printZone(ns_type, const char *,
@@ -270,17 +270,19 @@ main(int argc, char **argv) {
ns_type xfr = ns_t_invalid;
int bytes_out, bytes_in;
char cmd[512];
char cmd[256];
char domain[MAXDNAME];
char msg[120], **vtmp;
char msg[120], *msgptr;
char **vtmp;
char *args[DIG_MAXARGS];
char **ax;
int once = 1, dofile = 0; /* batch -vs- interactive control */
char fileq[384];
char fileq[100];
int fp;
int wait=0, delay;
int envset=0, envsave=0;
struct __res_state res_x, res_t;
char *pp;
ns_tsig_key key;
char *keyfile = NULL, *keyname = NULL;
@@ -346,7 +348,6 @@ main(int argc, char **argv) {
res.id = 1;
gettimeofday(&tv1, NULL);
assert(tv1.tv_usec >= 0 && tv1.tv_usec < 1000000);
/*
* Main section: once if cmd-line query
@@ -356,10 +357,8 @@ main(int argc, char **argv) {
while ((dofile && fgets(fileq, sizeof fileq, qfp) != NULL) ||
(!dofile && once--))
{
if (*fileq == '\n' || *fileq == '#' || *fileq==';') {
printf("%s", fileq); /* echo but otherwise ignore */
continue; /* blank lines and comments */
}
if (*fileq == '\n' || *fileq == '#' || *fileq==';')
continue; /* ignore blank lines & comments */
/*
* "Sticky" requests that before current parsing args
@@ -399,7 +398,7 @@ main(int argc, char **argv) {
if (**argv == '%')
continue;
if (**argv == '+') {
setopt(*argv+1);
SetOption(*argv+1);
continue;
}
if (**argv == '=') {
@@ -423,16 +422,11 @@ main(int argc, char **argv) {
if (**argv == '-') {
switch (argv[0][1]) {
case 'T':
if (*++argv == NULL)
printf("; no arg for -T?\n");
else
wait = atoi(*argv);
wait = atoi(*++argv);
break;
case 'c':
if(*++argv == NULL)
printf("; no arg for -c?\n");
else if ((tmp = atoi(*argv))
|| *argv[0] == '0') {
if ((tmp = atoi(*++argv))
|| *argv[0]=='0') {
queryClass = tmp;
} else if ((tmp = StringToClass(*argv,
0, NULL)
@@ -445,9 +439,7 @@ main(int argc, char **argv) {
}
break;
case 't':
if (*++argv == NULL)
printf("; no arg for -t?\n");
else if ((tmp = atoi(*argv))
if ((tmp = atoi(*++argv))
|| *argv[0]=='0') {
queryType = tmp;
qtypeSet++;
@@ -460,15 +452,17 @@ main(int argc, char **argv) {
printf(
"; invalid type specified\n"
);
}
}
break;
case 'x':
if (!qtypeSet) {
queryType = T_ANY;
qtypeSet++;
}
if ((addrc = *++argv) == NULL) {
printf("; no arg for -x?\n");
if (!(addrc = *++argv)) {
printf(
"; no arg for -x?\n"
);
break;
}
addrend = addrc + strlen(addrc);
@@ -486,10 +480,8 @@ main(int argc, char **argv) {
case 'p':
if (argv[0][2] != '\0')
port = ntohs(atoi(argv[0]+2));
else if (*++argv == NULL)
printf("; no arg for -p?\n");
else
port = htons(atoi(*argv));
port = htons(atoi(*++argv));
break;
case 'P':
if (argv[0][2] != '\0')
@@ -500,21 +492,16 @@ main(int argc, char **argv) {
case 'n':
if (argv[0][2] != '\0')
res.ndots = atoi(argv[0]+2);
else if (*++argv == NULL)
printf("; no arg for -n?\n");
else
res.ndots = atoi(*argv);
res.ndots = atoi(*++argv);
break;
case 'b': {
char *a, *p;
if (argv[0][2] != '\0')
a = argv[0]+2;
else if (*++argv == NULL) {
printf("; no arg for -b?\n");
break;
} else
a = *argv;
else
a = *++argv;
if ((p = strchr(a, ':')) != NULL) {
*p++ = '\0';
myaddress.sin_port =
@@ -525,18 +512,14 @@ main(int argc, char **argv) {
";; bad -b addr\n");
exit(1);
}
}
break;
}
case 'k':
/* -k keydir:keyname */
if (argv[0][2] != '\0')
keyfile = argv[0]+2;
else if (*++argv == NULL) {
printf("; no arg for -k?\n");
break;
} else
keyfile = *argv;
else
keyfile = *++argv;
keyname = strchr(keyfile, ':');
if (keyname == NULL) {
@@ -862,7 +845,6 @@ main(int argc, char **argv) {
if (res.pfcode & RES_PRF_HEAD1)
fp_resstat(&res, stdout);
(void) gettimeofday(&start_time, NULL);
assert(start_time.tv_usec >= 0 && start_time.tv_usec < 1000000);
if (keyfile)
n = res_nsendsigned(&res, packet, n, &key, answer, sizeof answer);
else
@@ -887,9 +869,10 @@ main(int argc, char **argv) {
}
}
(void) gettimeofday(&end_time, NULL);
assert(end_time.tv_usec >= 0 && end_time.tv_usec < 1000000);
if (res.pfcode & RES_PRF_STATS) {
time_t t;
query_time = difftv(start_time, end_time);
printf(";; Total query time: ");
prnttime(query_time);
@@ -919,7 +902,6 @@ main(int argc, char **argv) {
* batches started at different sites somewhat synchronized.
*/
gettimeofday(&tv2, NULL);
assert(tv2.tv_usec >= 0 && tv2.tv_usec < 1000000);
delay = (int)(tv2.tv_sec - tv1.tv_sec);
if (delay < wait) {
sleep(wait - delay);
@@ -964,13 +946,13 @@ 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.44 2000/12/23 08:14:31 vixie Exp $\n\
$Id: dig.c,v 8.36 1999/11/05 05:05:14 vixie Exp $\n\
", stderr);
}
static int
setopt(const char *string) {
char option[NAME_LEN], *ptr;
SetOption(const char *string) {
char option[NAME_LEN], type[NAME_LEN], *ptr;
int i;
i = pickString(string, option, sizeof option);
@@ -1122,7 +1104,6 @@ res_re_init() {
static char localdomain[] = "LOCALDOMAIN";
u_long pfcode = res.pfcode, options = res.options;
unsigned ndots = res.ndots;
int retrans = res.retrans, retry = res.retry;
char *buf;
/*
@@ -1135,8 +1116,6 @@ res_re_init() {
res.pfcode = pfcode;
res.options = options;
res.ndots = ndots;
res.retrans = retrans;
res.retry = retry;
}
/*
@@ -1194,18 +1173,19 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
static int answerLen = 0;
querybuf buf;
HEADER *headerPtr;
int msglen, amtToRead, numRead, result = 0, sockFD, len;
int count, type, class, rlen, done, n;
int numAnswers = 0, numRecords = 0, soacnt = 0;
u_char *cp, tmp[NS_INT16SZ];
char dname[2][NS_MAXDNAME];
char dname[2][NS_MAXDNAME], file[NAME_LEN];
enum { NO_ERRORS, ERR_READING_LEN, ERR_READING_MSG, ERR_PRINTING }
error = NO_ERRORS;
pid_t zpid;
u_char *newmsg;
int newmsglen;
ns_tcp_tsig_state tsig_state;
int tsig_ret, tsig_required, tsig_present;
int tsig_ret;
switch (xfr) {
case ns_t_axfr:
@@ -1423,6 +1403,18 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
break;
}
/*
* Verify the TSIG
*/
if (key) {
tsig_ret = ns_verify_tcp(answer, &len, &tsig_state, 1);
if (tsig_ret == 0)
printf("; TSIG ok\n");
else
printf("; TSIG invalid\n");
}
result = print_axfr(stdout, answer, len);
if (result != 0) {
error = ERR_PRINTING;
@@ -1483,30 +1475,6 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
break;
}
}
/*
* Verify the TSIG
*/
if (key) {
if (ns_find_tsig(answer, answer + len) != NULL)
tsig_present = 1;
else
tsig_present = 0;
if (numAnswers == 1 || soacnt > 1)
tsig_required = 1;
else
tsig_required = 0;
tsig_ret = ns_verify_tcp(answer, &len, &tsig_state,
tsig_required);
if (tsig_ret == 0) {
if (tsig_present)
printf("; TSIG ok\n");
}
else
printf("; TSIG invalid\n");
}
}
printf(";; Received %d answer%s (%d record%s).\n",
@@ -1536,7 +1504,7 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
return (ERROR);
}
printf(";; pid %lu: exit %d, signal %d, core %c\n",
(u_long)pid, WEXITSTATUS(status),
pid, WEXITSTATUS(status),
WIFSIGNALED(status) ? WTERMSIG(status) : 0,
WCOREDUMP(status) ? 't' : 'f');
}
@@ -1602,12 +1570,8 @@ print_axfr(FILE *file, const u_char *msg, size_t msglen) {
}
name = ns_rr_name(rr);
if (origin[0] == '\0' && name[0] != '\0') {
if (strcmp(name, ".") != 0)
strcpy(origin, name);
fprintf(file, "$ORIGIN %s.\n", origin);
if (strcmp(name, ".") == 0)
strcpy(origin, name);
strcpy(name_ctx, "@");
fprintf(file, "$ORIGIN %s.\n", name);
strcpy(origin, name);
}
if (ns_sprintrr(&handle, &rr, name_ctx, origin,
buf, sizeof buf) < 0) {
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.7 2000/12/23 08:02:50 vixie Exp $
# $Id: Makefile,v 1.5 1999/08/08 17:51:01 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -44,8 +44,7 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= dnskeygen
SRCS= dnskeygen.c
+3 -4
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: dnskeygen.c,v 1.11 2000/12/23 08:14:31 vixie Exp $";
static const char rcsid[] = "$Id: dnskeygen.c,v 1.9 1999/10/13 16:38:59 vixie Exp $";
#endif /* not lint */
/*
@@ -50,8 +50,9 @@ main(int argc, char **argv) {
int size = -1, exp = 0;
int no_auth = 0, no_conf = 0;
int sign_val = 0, flags = 0, protocol = -1;
int i, err = 0;
int i, err = 0, n;
extern char *optarg;
char array[1024];
dst_init();
if ((prog = strrchr(argv[0],'/')) == NULL)
@@ -215,8 +216,6 @@ main(int argc, char **argv) {
}
else if (size < 0)
usage("No size specified", 0);
else /* size == 0 */
sign_val = 0;
if (err)
usage("errors encountered/unknown flag", 1);
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.26 2000/12/23 08:02:51 vixie Exp $
# $Id: Makefile,v 8.24 1999/08/08 17:51:01 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -42,8 +42,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= dnsquery
SRCS= ${PROG}.c
+5 -16
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: dnsquery.c,v 8.15 2000/12/23 08:14:32 vixie Exp $";
static const char rcsid[] = "$Id: dnsquery.c,v 8.13 1999/10/13 16:38:59 vixie Exp $";
#endif /* not lint */
/*
@@ -55,6 +55,7 @@ main(int argc, char *argv[]) {
struct hostent *q_nsname;
extern int optind, opterr;
extern char *optarg;
HEADER *hp;
int stream = 0, debug = 0;
/* set defaults */
@@ -79,12 +80,7 @@ main(int argc, char *argv[]) {
case 'p' : res.retrans = atoi(optarg);
break;
case 'h' : if (strlen(optarg) >= sizeof(name)) {
fprintf(stderr,
"Domain name too long (%s)\n", optarg);
exit(-1);
} else
strcpy(name, optarg);
case 'h' : strcpy(name, optarg);
break;
case 'c' : {
@@ -161,15 +157,8 @@ main(int argc, char *argv[]) {
exit(-1);
}
}
if (optind < argc) {
if (strlen(argv[optind]) >= sizeof(name)) {
fprintf(stderr,
"Domain name too long (%s)\n", argv[optind]);
exit(-1);
} else {
strcpy(name, argv[optind]);
}
}
if (optind < argc)
strcpy(name, argv[optind]);
len = sizeof(answer);
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.26 2000/12/23 08:02:51 vixie Exp $
# $Id: Makefile,v 8.24 1999/08/08 17:51:01 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -42,8 +42,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= host
SRCS= ${PROG}.c
+57 -94
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: host.c,v 8.42 2000/12/23 08:14:32 vixie Exp $";
static const char rcsid[] = "$Id: host.c,v 8.34 1999/11/11 19:39:10 cyarnell Exp $";
#endif /* not lint */
/*
@@ -126,9 +126,6 @@ static const char copyright[] =
#define SUCCESS 0
#define TIME_OUT -1
#define NO_INFO -2
#ifdef ERROR
#undef ERROR
#endif
#define ERROR -3
#define NONAUTH -4
@@ -169,13 +166,12 @@ static u_char hostbuf[NS_MAXDNAME];
static int sockFD;
static FILE *filePtr;
static struct __res_state res;
static struct __res_state res, orig;
static char *cname = NULL;
static const char *progname = "amnesia";
static int getclass = ns_c_in, verbose = 0, list = 0;
static int server_specified = 0;
static int gettype = 0;
static int querytype = 0;
static int gettype;
static char getdomain[NS_MAXDNAME];
/* Forward. */
@@ -225,9 +221,9 @@ main(int argc, char **argv) {
struct in_addr addr;
struct hostent *hp;
char *s;
int waitmode = 0;
int inverse = 0, waitmode = 0;
int ncnames, ch;
int nkeychains;
int nkeychains, i;
dst_init();
@@ -241,7 +237,7 @@ main(int argc, char **argv) {
switch (ch) {
case 'a':
verbose = 1;
querytype = ns_t_any;
gettype = ns_t_any;
break;
case 'c':
getclass = parseclass(optarg);
@@ -259,7 +255,7 @@ main(int argc, char **argv) {
sigchase = 1;
break;
case 't':
querytype = parsetype(optarg);
gettype = parsetype(optarg);
break;
case 'v':
verbose = 1;
@@ -274,10 +270,10 @@ main(int argc, char **argv) {
/*NOTREACHED*/
}
}
if ((querytype == 0) && (sigchase)) {
if (gettype == 0) {
if (verbose)
printf ("Forcing `-t a' for signature trace.\n");
querytype = ns_t_a;
gettype = ns_t_a;
}
argc -= optind;
argv += optind;
@@ -324,7 +320,7 @@ main(int argc, char **argv) {
res.options &= ~RES_DEFNAMES;
if (list)
exit(ListHosts(getdomain, querytype ? querytype : ns_t_a));
exit(ListHosts(getdomain, gettype ? gettype : ns_t_a));
ncnames = 5; nkeychains = 18;
while (hp == NULL && res.res_h_errno == TRY_AGAIN) {
if (addr.s_addr == INADDR_NONE) {
@@ -340,17 +336,18 @@ main(int argc, char **argv) {
/* start new query, for KEY */
strcpy (getdomain, chase_signer);
strcat (getdomain, ".");
querytype = ns_t_key;
gettype = ns_t_key;
} else if (!(chase_step & SD_BADSIG)) {
/* start new query, for SIG */
strcpy (getdomain, chase_domain);
strcat (getdomain, ".");
querytype = ns_t_sig;
gettype = ns_t_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",
chase_step & SD_SIG ? chase_signer : chase_domain,
chase_domain,
chase_lastgoodkey ? chase_lastgoodkey : "None");
}
}
@@ -539,7 +536,7 @@ gethostinfo(char *name) {
char *cp, **domain;
char tmp[NS_MAXDNAME];
const char *tp;
int hp;
int hp, nDomain;
int asis = 0;
u_int n;
@@ -590,8 +587,8 @@ static int
getdomaininfo(const char *name, const char *domain) {
int val1, val2;
if (querytype)
return (getinfo(name, domain, gettype=querytype));
if (gettype)
return (getinfo(name, domain, gettype));
else {
val1 = getinfo(name, domain, gettype=ns_t_a);
if (cname || verbose)
@@ -603,9 +600,11 @@ getdomaininfo(const char *name, const char *domain) {
static int
getinfo(const char *name, const char *domain, int type) {
u_char *eom;
HEADER *hp;
u_char *eom, *bp, *cp;
querybuf buf, answer;
int n;
int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
u_short pref, class;
char host[NS_MAXDNAME];
if (domain == NULL)
@@ -635,7 +634,8 @@ getinfo(const char *name, const char *domain, int type) {
static int
printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) {
int n, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
u_short pref, class;
const u_char *bp, *cp;
const HEADER *hp;
@@ -696,18 +696,8 @@ printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) {
if (!hp->ad)
if (verbose && isls == 0)
printf("The following answer is not verified as authentic by the server:\n");
while (--ancount >= 0 && cp && cp < eom) {
while (--ancount >= 0 && cp && cp < eom)
cp = pr_rr(cp, answer->qb2, stdout, filter);
/*
* When we ask for address and there is a CNAME, it
* seems to return both the CNAME and the address.
* Since we trace down the CNAME chain ourselves, we
* don't really want to print the address at this
* point.
*/
if (cname && ! verbose)
return (1);
}
}
if (!verbose)
return (1);
@@ -977,24 +967,24 @@ 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%ld\t;serial (version)",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file, "\n\t\t\t%lu\t;refresh period",
fprintf(file, "\n\t\t\t%ld\t;refresh period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file,
"\n\t\t\t%lu\t;retry refresh this often",
"\n\t\t\t%ld\t;retry refresh this often",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file, "\n\t\t\t%lu\t;expiration period",
fprintf(file, "\n\t\t\t%ld\t;expiration period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file, "\n\t\t\t%lu\t;minimum TTL\n\t\t\t)",
fprintf(file, "\n\t\t\t%ld\t;minimum TTL\n\t\t\t)",
ns_get32(cp));
cp += INT32SZ;
break;
@@ -1053,7 +1043,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
cp += sizeof(u_short);
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
if (doprint)
fprintf(file, " %s", name);
fprintf(file,"%s",name);
break;
case ns_t_naptr:
@@ -1245,15 +1235,15 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
/* original ttl */
origttl = cp;
if (doprint && verbose)
fprintf(file, " %ld", ns_get32(cp));
fprintf(file, " %d", ns_get32(cp));
cp += INT32SZ;
/* signature expiration */
if (doprint && verbose)
fprintf(file, " %ld", ns_get32(cp));
fprintf(file, " %d", ns_get32(cp));
cp += INT32SZ;
/* time signed */
if (doprint && verbose)
fprintf(file, " %ld", ns_get32(cp));
fprintf(file, " %d", ns_get32(cp));
cp += INT32SZ;
/* key footprint */
if (doprint && verbose)
@@ -1275,7 +1265,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
if (sigchase && !(chase_step & SD_SIG) &&
strcmp (chase_domain, thisdomain) == 0 &&
chase_class == class && chase_type == tc)
chase_class == class & chase_type == tc)
{
u_char cdname[NS_MAXCDNAME];
@@ -1346,7 +1336,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
if (sigchase && (chase_step & (SD_SIG|SD_RR)) &&
strcmp (getdomain, name) == 0 &&
getclass == class && gettype == type)
getclass == class & gettype == type)
{
DST_KEY *dstkey;
int rc, len, i, j;
@@ -1462,7 +1452,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
u_char cdname[NS_MAXCDNAME];
if (doprint && !verbose)
fprintf(file, " (chasing signature)");
fprintf (file, " (chasing signature)", sigchase-1);
/* unpack rr */
@@ -1576,7 +1566,6 @@ ListHosts(char *namePtr, int queryType) {
int nshaveaddr[NUMNS];
struct in_addr nsipaddr[NUMNSADDR];
int numns, numnsaddr, thisns;
int qdcount, ancount;
/*
* Normalize to not have trailing dot. We do string compares below
@@ -1649,8 +1638,7 @@ ListHosts(char *namePtr, int queryType) {
cp = answer.qb2 + HFIXEDSZ;
eom = answer.qb2 + msglen;
qdcount = ntohs(answer.qb1.qdcount);
while (qdcount-- > 0) {
if (ntohs(answer.qb1.qdcount) > 0) {
n = dn_skipname(cp, eom);
if (n < 0) {
printf("Form error.\n");
@@ -1888,60 +1876,35 @@ ListHosts(char *namePtr, int queryType) {
}
numAnswers++;
cp = buf.qb2 + HFIXEDSZ;
qdcount = ntohs(buf.qb1.qdcount);
while (qdcount-- > 0) {
if (ntohs(buf.qb1.qdcount) > 0) {
n = dn_skipname(cp, buf.qb2 + len);
if (n <= 0) {
error = ERR_PRINTING;
break;
}
if (cp + n + QFIXEDSZ > buf.qb2 + len) {
if (n < 0) {
error = ERR_PRINTING;
break;
}
cp += n + QFIXEDSZ;
}
ancount = ntohs(buf.qb1.ancount);
while (ancount-- > 0) {
nmp = cp;
n = dn_skipname(cp, buf.qb2 + len);
if (n <= 0) {
error = ERR_PRINTING;
break;
}
cp += n;
if (cp + INT16SZ > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
type = ns_get16(cp);
cp += INT16SZ;
if (type == ns_t_soa) {
(void) dn_expand(buf.qb2, buf.qb2 + len, nmp,
dname[soacnt], sizeof dname[0]);
if (soacnt) {
if (ns_samename(dname[0], dname[1]) == 1)
goto done;
} else
soacnt++;
}
if (cp + INT16SZ*2 + INT32SZ > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
cp += INT32SZ + INT16SZ;
dlen = ns_get16(cp);
cp += INT16SZ;
if (cp + dlen > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
cp += dlen;
}
if (error != NO_ERRORS)
nmp = cp;
n = dn_skipname(cp, buf.qb2 + len);
if (n < 0) {
error = ERR_PRINTING;
break;
}
cp += n;
if (cp + INT16SZ > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
if ((ns_get16(cp) == ns_t_soa)) {
(void) dn_expand(buf.qb2, buf.qb2 + len, nmp,
dname[soacnt], sizeof dname[0]);
if (soacnt) {
if (ns_samename(dname[0], dname[1]) == 1)
break;
} else
soacnt++;
}
}
done:
(void) close(sockFD);
sockFD = -1;
+5 -8
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.7 2000/12/23 08:02:52 vixie Exp $
# $Id: Makefile,v 1.3 1999/02/22 02:47:55 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -46,8 +46,7 @@ STRIP=-s
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} -I${TOP}/lib/irs ${DEFS}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} -I${TOP}/lib/irs ${DEFS}
VER= LOCAL-`date +%y%m%d.%H%M%S`
HOSTNAMECMD= hostname || uname -n
@@ -62,8 +61,6 @@ all: ${PROG}${EXE}
${PROG}${EXE}: irpd.${O} tmp_version.${O} ${LIBBIND}
${CC} ${CDEBUG} ${LDFLAGS} -o ${PROG}${EXE} ${OBJS} tmp_version.${O} \
${LIBBIND} ${SYSLIBS}
.c.${O}:
${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c
tmp_version.${O}: tmp_version.c
@@ -71,7 +68,7 @@ tmp_version.c: version.c Makefile ../Makefile ${SRCS} ${HDRS}
(u=$${USER-root} d=`pwd` h=`${HOSTNAMECMD}` t=`date`; \
sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< version.c > tmp_version.c); sleep 1
< version.c > tmp_version.c)
distclean: clean
+138 -16
View File
@@ -37,7 +37,7 @@ seem to be so for getnetbyaddr
#endif
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: irpd.c,v 1.10 2000/12/23 08:14:33 vixie Exp $";
static const char rcsid[] = "$Id: irpd.c,v 1.7 1999/10/13 16:26:23 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -144,6 +144,7 @@ static struct response_buff *newbuffer(u_int length);
static void release_buffer(struct response_buff *b);
static struct arg_s *split_string(const char *string);
static void free_args(struct arg_s *args);
static int is_all_digits(char *p);
static struct client_ctx *make_cli_ctx(void);
static struct net_data *get_net_data(struct ctl_sess *sess);
@@ -247,6 +248,8 @@ static void irpd_abort(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx);
static void irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess,
void *param);
static void response_done(struct ctl_sctx *ctx, struct ctl_sess *sess,
void *uap);
static void logger(enum ctl_severity, const char *fmt, ...);
@@ -326,10 +329,9 @@ int
main(int argc, char **argv) {
struct ctl_sctx *ctx;
struct sockaddr *addr;
#ifndef NO_SOCKADDR_UN
struct sockaddr_un uaddr;
#endif
struct sockaddr_in iaddr;
log_channel chan;
short port = IRPD_PORT;
char *prog = argv[0];
char *sockname = IRPD_PATH;
@@ -340,7 +342,7 @@ main(int argc, char **argv) {
addr = (struct sockaddr *)&iaddr;
socksize = sizeof iaddr;
openlog("iprd", LOG_CONS|LOG_PID, ISC_FACILITY);
openlog("iprd", LOG_CONS|LOG_PID, LOG_DAEMON);
while ((ch = getopt(argc, argv, "u:p:c:")) != -1) {
switch(ch) {
case 'c':
@@ -356,13 +358,11 @@ main(int argc, char **argv) {
}
break;
#ifndef NO_SOCKADDR_UN
case 'u':
sockname = optarg;
addr = (struct sockaddr *)&uaddr;
socksize = sizeof uaddr;
break;
#endif
case 'h':
case '?':
@@ -374,6 +374,7 @@ main(int argc, char **argv) {
argc -= optind;
argv += optind;
memset(&uaddr, 0, sizeof uaddr);
memset(&iaddr, 0, sizeof iaddr);
#ifdef HAVE_SA_LEN
@@ -383,21 +384,17 @@ main(int argc, char **argv) {
iaddr.sin_port = htons(IRPD_PORT);
iaddr.sin_addr.s_addr = htonl(INADDR_ANY);
#ifndef NO_SOCKADDR_UN
memset(&uaddr, 0, sizeof uaddr);
if (addr == (struct sockaddr *)&uaddr) {
uaddr.sun_family = AF_UNIX;
strncpy(uaddr.sun_path, sockname, sizeof uaddr.sun_path);
uaddr.sun_family = AF_UNIX;
strncpy(uaddr.sun_path, sockname, sizeof uaddr.sun_path);
#ifdef HAVE_SA_LEN
uaddr.sun_len = SUN_LEN(&uaddr);
uaddr.sun_len = SUN_LEN(&uaddr);
#endif
if (addr == (struct sockaddr *)&uaddr)
socksize = SUN_LEN(&uaddr);
/* XXX what if this file is not currently a socket? */
unlink(sockname);
}
#endif
/* XXX what if this file is not currently a socket? */
unlink(sockname);
evCreate(&ev);
@@ -444,6 +441,7 @@ send_hostent(struct ctl_sess *sess, struct hostent *ho) {
if (ho == NULL)
simple_response(sess, IRPD_GETHOST_NONE, "No such host");
else {
size_t need;
struct response_buff *b = newbuffer(0);
if (irp_marshall_ho(ho, &b->buff, &b->bufflen) != 0) {
@@ -495,6 +493,7 @@ irpd_gethostbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
char hname[MAXHOSTNAMELEN];
struct arg_s *args;
int i;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -533,6 +532,7 @@ irpd_gethostbyname2(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
char hname[MAXHOSTNAMELEN];
struct arg_s *args;
int i;
int af;
struct net_data *netdata = get_net_data(sess);
@@ -584,6 +584,7 @@ irpd_gethostbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
char haddr[MAXHOSTNAMELEN];
char tmpaddr[NS_IN6ADDRSZ];
struct arg_s *args;
int i;
int af;
int addrlen;
struct net_data *netdata = get_net_data(sess);
@@ -649,6 +650,9 @@ irpd_gethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct hostent *ho;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -672,6 +676,10 @@ irpd_sethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct hostent *ho;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -727,6 +735,8 @@ irpd_getpwnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct passwd *pw;
char username[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -769,6 +779,8 @@ irpd_getpwuid(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct passwd *pw;
char userid[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -828,6 +840,9 @@ irpd_getpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct passwd *pw;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -850,6 +865,10 @@ irpd_setpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct passwd *pw;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -889,6 +908,34 @@ send_nwent(struct ctl_sess *sess, struct nwent *nw) {
}
}
/*
* static void
* send_netent(struct ctl_sess *sess, struct netent *ne);
* Sends a NETENT structure over the wire, or "No such
* Network" error if NE is NULL.
*/
static void
send_netent(struct ctl_sess *sess, struct netent *ne) {
if (ne == NULL) {
simple_response(sess, IRPD_GETNET_NONE, "No such net");
} else {
struct response_buff *b = newbuffer(0);
if (irp_marshall_ne(ne, &b->buff,
&b->bufflen) != 0) {
simple_response(sess, IRPD_GETNET_ERROR,
"Internal error");
logger(ctl_warning, "Cant marshall ne\n");
return;
}
strcat(b->buff, "\r\n");
ctl_response(sess, IRPD_GETNET_OK, "Network found", 0, 0,
response_done, b, b->buff, strlen(b->buff));
}
}
/*
* static void
* irpd_getnetbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
@@ -905,6 +952,8 @@ irpd_getnetbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct netent *ne;
struct nwent *nw;
char netname[MAXNETNAMELEN];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -959,6 +1008,7 @@ irpd_getnetbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
char haddr[MAXHOSTNAMELEN];
long tmpaddr;
struct arg_s *args;
int i;
int af;
int addrlen;
int bits;
@@ -1048,6 +1098,9 @@ irpd_getnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
struct netent *ne;
struct nwent *nw;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1076,6 +1129,11 @@ irpd_setnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct netent *ne;
struct nwent *nw;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1130,6 +1188,8 @@ irpd_getgrnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct group *gr;
char groupname[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1172,6 +1232,8 @@ irpd_getgrgid(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct group *gr;
char groupid[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1231,6 +1293,9 @@ irpd_getgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct group *gr;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1253,6 +1318,10 @@ irpd_setgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct group *gr;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1296,6 +1365,8 @@ irpd_getservbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct servent *serv;
char servicename[64];
char protoname[10];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1347,6 +1418,8 @@ irpd_getservbyport(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct servent *sv;
char portnum[64];
char protoname[10];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1414,6 +1487,9 @@ irpd_getservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct servent *sv;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1436,6 +1512,10 @@ irpd_setservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct servent *sv;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1490,6 +1570,8 @@ irpd_getprotobyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct protoent *pr;
char protoname[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1532,6 +1614,8 @@ irpd_getprotobynumber(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct protoent *pr;
char protonum[64];
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1591,6 +1675,9 @@ irpd_getprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct protoent *pr;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1613,6 +1700,10 @@ irpd_setprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct protoent *pr;
size_t need;
size_t need_total = 0;
struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1659,6 +1750,9 @@ irpd_getnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
char netgroupname[64];
struct response_buff *b = NULL;
size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1693,6 +1787,8 @@ irpd_innetgr(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct arg_s *args;
struct response_buff *b;
size_t need;
struct net_data *netdata = get_net_data(sess);
char *host;
char *user;
@@ -1734,6 +1830,7 @@ irpd_innetgr(struct ctl_sctx *ctx, struct ctl_sess *sess,
memput(ngtmp, args->iov[1].iov_len + 1);
}
untimely:
free_args(args);
}
@@ -1766,6 +1863,7 @@ irpd_setnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
"setnetgrent ok");
}
untimely:
free_args(args);
}
@@ -1781,6 +1879,7 @@ irpd_endnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
struct arg_s *args;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1797,6 +1896,20 @@ irpd_endnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
}
}
/*
* static void
* irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess, void *param)
* Callback for when QUIT respnse is sent out.
*/
static void
irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess, void *param) {
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
net_data_destroy(netdata);
}
/*
* static void
* irpd_quit(struct ctl_sctx *ctx, struct ctl_sess *sess,
@@ -2119,6 +2232,15 @@ make_cli_ctx(void) {
return (p);
}
static void
release_cli_ctx(struct client_ctx *ctx) {
INSIST(ctx != NULL);
INSIST(ctx->net_data != NULL);
net_data_destroy(ctx->net_data);
memput(ctx, sizeof *ctx);
}
static struct net_data *
get_net_data(struct ctl_sess *sess) {
struct client_ctx *ctx = ctl_getcsctx(sess);
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.8 2000/12/23 08:02:52 vixie Exp $
# $Id: Makefile,v 1.6 1999/08/08 17:51:01 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -41,8 +41,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= mkservdb
SRCS= ${PROG}.c
+10 -17
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: mkservdb.c,v 1.9 2001/01/26 06:54:11 vixie Exp $";
static const char rcsid[] = "$Id: mkservdb.c,v 1.6 1999/10/13 16:39:00 vixie Exp $";
#endif /* not lint */
/*
@@ -29,7 +29,6 @@ static const char rcsid[] = "$Id: mkservdb.c,v 1.9 2001/01/26 06:54:11 vixie Exp
#include <ctype.h>
#ifdef IRS_LCL_SV_DB
#include <db.h>
#include <err.h>
#endif
#include <fcntl.h>
#include <limits.h>
@@ -38,11 +37,9 @@ static const char rcsid[] = "$Id: mkservdb.c,v 1.9 2001/01/26 06:54:11 vixie Exp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../../include/irs.h"
#include "../../lib/irs/irs_p.h"
#include "../../include/isc/misc.h"
#include "port_after.h"
@@ -64,7 +61,6 @@ main(int argc, char **argv) {
struct servent *getnextent(FILE *);
int
main(int argc, char **argv) {
DB *db;
DBT key;
@@ -116,26 +112,24 @@ main(int argc, char **argv) {
}
data.size = p - dbuf;
if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
if (r < 0)
errx(1, "failed to write %s", (char *)key.data);
errx(1, "failed to write %s", key.data);
else
warnx("will not overwrite %s", (char *)key.data);
}
warnx("will not overwrite %s", key.data);
for (n = 0; sv->s_aliases[n]; ++n) {
if (strlen(sv->s_aliases[n]) + sizeof "/"
+ strlen(sv->s_proto) > sizeof kbuf)
continue;
key.size = SPRINTF((kbuf, "%s/%s",
sv->s_aliases[n], sv->s_proto))+1;
if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
if (r < 0)
errx(1, "failed to write %s",
(char *)key.data);
key.data);
else
warnx("will not overwrite %s",
(char *)key.data);
}
key.data);
}
ports = (u_short *)kbuf;
@@ -158,17 +152,16 @@ main(int argc, char **argv) {
}
data.size = p - dbuf;
if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
if (r < 0)
errx(1, "failed to write %d/%s",
ntohs(sv->s_port), sv->s_proto);
else
warnx("will not overwrite %d/%s",
ntohs(sv->s_port), sv->s_proto);
}
ntohs(sv->s_port), sv->s_proto);
}
db->close(db);
if (isc_movefile(tmpdatabase, database))
if (rename(tmpdatabase, database))
err(1, "rename %s -> %s", tmpdatabase, database);
exit(0);
}
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.3 2000/12/23 08:02:53 vixie Exp $
# $Id: Makefile,v 1.1 1999/01/07 02:09:37 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -41,8 +41,7 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
PROG= named-bootconf
@@ -181,24 +181,19 @@ while read CMD ARGS; do
esac
set - X $ARGS
shift
if [ $# -gt 1 ]; then
if [ $# -gt 2 ]; then
ZONE=$1
shift
PRIMARIES=""
while [ $# -gt 1 ]; do
PRIMARIES="$PRIMARIES $1"
PRIMARIES=$1
while [ $# -gt 2 ]; do
shift
PRIMARIES="$PRIMARIES $1"
done
(echo ""
cat $COMMENTFILE
echo "zone \"$ZONE\" ${class}{"
echo " type slave;"
if expr x"$1" : '^x[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null
then
PRIMARIES="$PRIMARIES $1"
else
echo " file \"$1\";"
fi
echo " file \"$2\";"
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
@@ -220,24 +215,19 @@ while read CMD ARGS; do
esac
set - X $ARGS
shift
if [ $# -gt 1 ]; then
if [ $# -gt 2 ]; then
ZONE=$1
shift
PRIMARIES=""
while [ $# -gt 1 ]; do
PRIMARIES="$PRIMARIES $1"
PRIMARIES=$1
while [ $# -gt 2 ]; do
shift
PRIMARIES="$PRIMARIES $1"
done
(echo ""
cat $COMMENTFILE
echo "zone \"$ZONE\" ${class}{"
echo " type stub;"
if expr x"$1" : '^x[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null
then
PRIMARIES="$PRIMARIES $1"
else
echo " file \"$1\";"
fi
echo " file \"$2\";"
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
+4 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.31 2000/12/23 08:02:54 vixie Exp $
# $Id: Makefile,v 8.29 1999/08/08 17:51:02 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -45,8 +45,7 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
NAMED_OBJS= \
../named/db_glue.${O} ../named/ns_glue.${O} ../named/tmp_version.${O}
File diff suppressed because it is too large. Load diff
+6 -7
View File
@@ -1,4 +1,4 @@
## Copyright (c) 1996-2000 by Internet Software Consortium
## Copyright (c) 1996-1999 by Internet Software Consortium
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
@@ -13,17 +13,17 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.51 2000/12/23 08:02:53 vixie Exp $
# $Id: Makefile,v 8.47 1999/08/26 18:42:31 vixie Exp $
# $FreeBSD$
DESTDIR=
CC= cc
SHELL= /bin/sh
CDEBUG= -g -Wall
CDEBUG= -g
#(net2 and its descendents)
SYSTYPE = freebsd
SYSTYPE = bsdos
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -48,8 +48,7 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} ${DEFS}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
VER= LOCAL-`date +%Y%m%d.%H%M%S`
HOSTNAMECMD= hostname || uname -n
@@ -88,7 +87,7 @@ tmp_version.c: version.c Makefile ../Makefile ${SRCS} ${HDRS}
(u=$${USER-root} d=`pwd` h=`${HOSTNAMECMD}` t=`date`; \
sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< version.c > tmp_version.c); sleep 1
< version.c > tmp_version.c)
pathnames.h: ${TOP}/.settings Makefile pathtemplate.h
rm -f pathnames.h
+3 -22
View File
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_defs.h,v 8.40 2000/11/29 06:55:46 marka Exp $
* $Id: db_defs.h,v 8.36 1999/08/26 18:42:32 vixie Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -103,17 +103,9 @@
/*
* Hash table structures.
*/
/*
* XXX
* For IPv6 transport support we need a seperate reference counted
* database of source addresses and d_addr should become a union with
* a pointer into that database. A bit can be robbed from d_rode to
* indicate what the union is being used for. This should require less
* memory than making d_addr a union of struct in6_addr and struct in_addr.
*/
struct databuf {
struct databuf *d_next; /* linked list */
struct in_addr d_addr; /* NS from whence this came */
struct nameser *d_ns; /* NS from whence this came */
u_int32_t d_ttl; /* time to live */
/* if d_zone == DB_Z_CACHE, then
* d_ttl is actually the time when
@@ -133,18 +125,11 @@ struct databuf {
int16_t d_type; /* type number */
int16_t d_size; /* size of data area */
u_int32_t d_rcnt;
#ifdef HITCOUNTS
u_int32_t d_hitcnt; /* Number of requests for this data. */
#endif /* HITCOUNTS */
u_int16_t d_nstime; /* NS response time, milliseconds */
u_char d_data[sizeof(void*)]; /* dynamic (padded) */
};
#define DATASIZE(n) (sizeof(struct databuf) - sizeof(void*) + n)
#ifdef HITCOUNTS
extern u_int32_t db_total_hits;
#endif /* HITCOUNTS */
#ifdef BIND_UPDATE
/*
* d_mark definitions
@@ -322,7 +307,3 @@ struct db_rrset {
if (((x)->d_rcnt)-- == 0) \
ns_panic(ns_log_db, 1, "d_rcnt-- == 0"); \
} while (0)
#define ISVALIDGLUE(xdp) ((xdp)->d_type == T_NS || (xdp)->d_type == T_A \
|| (xdp)->d_type == T_AAAA || (xdp)->d_type == ns_t_a6)
+21 -51
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp $";
static const char rcsid[] = "$Id: db_dump.c,v 8.40 1999/10/13 16:39:01 vixie Exp $";
#endif /* not lint */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -125,20 +125,15 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp
#include "named.h"
#ifdef HITCOUNTS
u_int32_t db_total_hits;
#endif /* HITCOUNTS */
static const char *MkCredStr(int);
static int fwd_dump(FILE *fp);
/*
* Dump current data base in a format similar to RFC 883.
*/
void
doadump(void) {
doadump()
{
FILE *fp;
ns_notice(ns_log_db, "dumping nameserver data");
@@ -146,15 +141,9 @@ doadump(void) {
if ((fp = write_open(server_options->dump_filename)) == NULL)
return;
gettime(&tt);
#ifdef HITCOUNTS
if (NS_OPTION_P(OPTION_HITCOUNT))
fprintf(fp, "; Total hits: %d\n",db_total_hits);
#endif /* HITCOUNTS */
fprintf(fp, "; Dumped at %s", ctimel(tt.tv_sec));
if (zones != NULL && nzones != 0)
zt_dump(fp);
if (fwddata != NULL && fwddata_count != 0)
fwd_dump(fp);
fputs(
"; Note: Cr=(auth,answer,addtnl,cache) tag only shown for non-auth RR's\n",
fp);
@@ -214,19 +203,6 @@ zt_dump(FILE *fp) {
return (0);
}
static int
fwd_dump(FILE *fp) {
int i;
fprintf(fp, ";; ++forwarders table++\n");
for (i=0;i<fwddata_count;i++) {
fprintf(fp,"; %s rtt=%d\n",
inet_ntoa(fwddata[i]->fwdaddr.sin_addr),
fwddata[i]->nsdata->d_nstime);
}
fprintf(fp, ";; --forwarders table--\n");
return (0);
}
int
db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
struct databuf *dp = NULL;
@@ -300,9 +276,9 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
fprintf(fp, "%d\t",
(int)(dp->d_ttl - tt.tv_sec));
} else if (dp->d_ttl != USE_MINIMUM)
fprintf(fp, "%u\t", dp->d_ttl);
fprintf(fp, "%d\t", (int)dp->d_ttl);
else
fprintf(fp, "%u\t",
fprintf(fp, "%d\t",
zones[dp->d_zone].z_minimum);
fprintf(fp, "%s\t%s\t",
p_class(dp->d_class),
@@ -481,18 +457,18 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
NS_GET16(preference, cp);
fprintf(fp, "%u", preference);
n = *cp++;
fprintf(fp, "\"%.*s\"", (int)n, cp);
cp += n;
n = *cp++;
fprintf(fp, "\"%.*s\"", (int)n, cp);
cp += n;
n = *cp++;
fprintf(fp, " \"%.*s\"", (int)n, cp);
cp += n;
if ((n = *cp++) != 0) {
fprintf(fp, "\"%.*s\"", (int)n, cp);
cp += n;
}
if ((n = *cp++) != 0) {
fprintf(fp, "\"%.*s\"", (int)n, cp);
cp += n;
}
if ((n = *cp++) != 0) {
fprintf(fp, " \"%.*s\"", (int)n, cp);
cp += n;
}
fprintf(fp, " %s.", cp);
break;
@@ -637,24 +613,18 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
getname(np, dname, sizeof(dname));
when = db_lame_find(dname, dp);
if (when != 0 && when > tt.tv_sec) {
fprintf(fp, "%sLAME=%ld",
fprintf(fp, "%sLAME=%d",
sep, when - tt.tv_sec);
sep = " ";
}
}
eoln:
if (dp->d_addr.s_addr != htonl(0)) {
if (dp->d_ns != NULL){
fprintf(fp, "%s[%s]",
sep, inet_ntoa(dp->d_addr));
sep, inet_ntoa(dp->d_ns->addr));
sep = " ";
}
#ifdef HITCOUNTS
if (NS_OPTION_P(OPTION_HITCOUNT)) {
fprintf(fp, "%shits=%d", sep, dp->d_hitcnt);
sep=" ";
}
#endif /* HITCOUNTS */
putc('\n', fp);
}
}
+56 -54
View File
@@ -52,7 +52,7 @@
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -90,53 +90,53 @@
/* db_proc.h - prototypes for functions in db_*.c
*
* $Id: db_func.h,v 8.44 2000/12/02 23:28:33 vixie Exp $
* $Id: db_func.h,v 8.40 1999/10/07 08:24:06 vixie Exp $
*/
/* ++from db_update.c++ */
int db_update(const char *name,
extern int db_update(const char *name,
struct databuf *odp,
struct databuf *newdp,
struct databuf **savedpp,
int flags,
struct hashbuf *htp,
struct sockaddr_in from);
int db_cmp(const struct databuf *, const struct databuf *);
int findMyZone(struct namebuf *np, int class);
struct sockaddr_in from),
db_cmp(const struct databuf *, const struct databuf *),
findMyZone(struct namebuf *np, int class);
void fixttl(struct databuf *dp);
/* --from db_update.c-- */
/* ++from db_save.c++ */
struct namebuf * savename(const char *, int);
struct databuf * savedata(int, int, u_int32_t, u_char *, int);
struct hashbuf * savehash(struct hashbuf *);
extern struct namebuf *savename(const char *, int);
extern struct databuf *savedata(int, int, u_int32_t, u_char *, int);
extern struct hashbuf *savehash(struct hashbuf *);
/* --from db_save.c-- */
/* ++from db_dump.c++ */
int db_dump(struct hashbuf *, FILE *, int, char *),
extern int db_dump(struct hashbuf *, FILE *, int, char *),
zt_dump(FILE *);
void doadump(void);
extern void doadump(void);
/* --from db_dump.c-- */
/* ++from db_load.c++ */
int makename_ok(char *name, const char *origin, int class,
extern int makename_ok(char *name, const char *origin, int class,
struct zoneinfo *zp,
enum transport transport,
enum context context,
const char *owner, const char *filename,
int lineno, int size);
void endline(FILE *);
int getword(char *, size_t, FILE *, int);
int getttl(FILE *, const char *, int, u_int32_t *, int *);
int getnum(FILE *, const char *, int, int *);
int db_load(const char *, const char *, struct zoneinfo *,
extern void endline(FILE *);
extern int getword(char *, size_t, FILE *, int),
getttl(FILE *, const char *, int, u_int32_t *, int *),
getnum(FILE *, const char *, int),
db_load(const char *, const char *, struct zoneinfo *,
const char *, int);
int getnonblank(FILE *, const char *, int);
int getservices(int, char *, FILE *, const char *);
char getprotocol(FILE *, const char *);
int makename(char *, const char *, int);
void db_err(int, char *, int, const char *, int);
int parse_sec_rdata(char *inp, int inp_len, int inp_full,
extern int getnonblank(FILE *, const char *),
getservices(int, char *, FILE *, const char *);
extern char getprotocol(FILE *, const char *);
extern int makename(char *, const char *, int);
extern void db_err(int, char *, int, const char *, int);
extern int parse_sec_rdata(char *inp, int inp_len, int inp_full,
u_char *data, int data_len,
FILE *fp, struct zoneinfo *zp,
char *domain, u_int32_t ttl,
@@ -146,37 +146,40 @@ int parse_sec_rdata(char *inp, int inp_len, int inp_full,
/* --from db_load.c-- */
/* ++from db_glue.c++ */
void buildservicelist(void);
void destroyservicelist(void);
void buildprotolist(void);
void destroyprotolist(void);
void getname(struct namebuf *, char *, int);
int servicenumber(const char *);
int protocolnumber(const char *);
int get_class(const char *);
u_int nhash(const char *);
const char * protocolname(int);
const char * servicename(u_int16_t, const char *);
struct databuf * rm_datum(struct databuf *,
struct namebuf *,
struct databuf *,
struct databuf **);
struct namebuf * rm_name(struct namebuf *,
struct namebuf **,
struct namebuf *);
void rm_hash(struct hashbuf *);
void db_freedata(struct databuf *);
void db_lame_add(char *zone, char *server, time_t when);
time_t db_lame_find(char *zone, struct databuf *dp);
void db_lame_clean(void);
void db_lame_destroy(void);
extern void buildservicelist(void),
destroyservicelist(void),
buildprotolist(void),
destroyprotolist(void),
getname(struct namebuf *, char *, int);
extern int servicenumber(const char *),
protocolnumber(const char *),
get_class(const char *);
extern u_int nhash(const char *);
extern const char *protocolname(int),
*servicename(u_int16_t, const char *);
#ifndef BSD
extern int getdtablesize(void);
#endif
extern struct databuf *rm_datum(struct databuf *,
struct namebuf *,
struct databuf *,
struct databuf **);
extern struct namebuf *rm_name(struct namebuf *,
struct namebuf **,
struct namebuf *);
extern void rm_hash(struct hashbuf *);
extern void db_freedata(struct databuf *);
extern void db_lame_add(char *zone, char *server, time_t when);
extern time_t db_lame_find(char *zone, struct databuf *dp);
extern void db_lame_clean(void);
extern void db_lame_destroy(void);
/* --from db_glue.c-- */
/* ++from db_lookup.c++ */
struct namebuf * nlookup(const char *, struct hashbuf **,
const char **, int);
struct namebuf * np_parent(struct namebuf *);
int match(struct databuf *, int, int),
extern struct namebuf *nlookup(const char *, struct hashbuf **,
const char **, int);
extern struct namebuf *np_parent __P((struct namebuf *));
extern int match(struct databuf *, int, int),
nxtmatch(const char *, struct databuf *,
struct databuf *),
rrmatch(const char *, struct databuf *,
@@ -184,8 +187,8 @@ int match(struct databuf *, int, int),
/* --from db_lookup.c-- */
/* ++from db_ixfr.c++ */
ns_deltalist * ixfr_get_change_list(struct zoneinfo *, u_int32_t,
u_int32_t);
struct ns_updrec * ixfr_get_change_list(struct zoneinfo *, u_int32_t,
u_int32_t);
int ixfr_have_log(struct zoneinfo *, u_int32_t,
u_int32_t);
/* --from db_ixfr.c++ */
@@ -201,7 +204,6 @@ int db_set_update(char *name, struct databuf *dp,
int *rrcount, int line,
const char *file);
/* --from db_sec.c-- */
/* ++from db_tsig.c++ */
char * tsig_alg_name(int value);
int tsig_alg_value(char *name);
+2 -3
View File
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_glob.h,v 8.14 2000/04/21 06:54:02 vixie Exp $
* $Id: db_glob.h,v 8.12 1999/08/08 21:10:01 vixie Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -95,7 +95,6 @@ DECL struct hashbuf *fcachetab INIT(NULL);
/* state of ns_reload() and ns_reconfig(). */
DECL int reloading INIT(0);
DECL int reconfiging INIT(0);
DECL int noexpired INIT(0);
DECL const int hashsizes[]
#ifdef MAIN_PROGRAM
+13 -4
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_glue.c 4.4 (Berkeley) 6/1/90";
static const char rcsid[] = "$Id: db_glue.c,v 8.42 2000/12/23 08:14:35 vixie Exp $";
static const char rcsid[] = "$Id: db_glue.c,v 8.39 1999/10/15 19:48:57 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_glue.c,v 8.42 2000/12/23 08:14:35 vixie Exp
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -345,14 +345,17 @@ rm_datum(struct databuf *dp, struct namebuf *np, struct databuf *pdp,
np->n_data = ndp;
else
pdp->d_next = ndp;
#ifdef BIND_UPDATE
if (savedpp != NULL) {
/* mark deleted or pending deletion */
dp->d_mark |= D_MARK_DELETED;
dp->d_next = *savedpp;
DRCNTINC(dp);
*savedpp = dp;
} else
dp->d_next = NULL;
#else
dp->d_next = NULL;
#endif
dp->d_flags &= ~DB_F_ACTIVE;
DRCNTDEC(dp);
if (dp->d_rcnt) {
@@ -378,7 +381,10 @@ rm_datum(struct databuf *dp, struct namebuf *np, struct databuf *pdp,
"rm_datum: rcnt = %d", dp->d_rcnt);
}
} else
db_freedata(dp);
#ifdef BIND_UPDATE
if (savedpp == NULL)
#endif
db_freedata(dp);
return (ndp);
}
@@ -433,6 +439,9 @@ getname(struct namebuf *np, char *buf, int buflen) {
while (np != NULL) {
i = (int) NAMELEN(*np);
if (i + 1 >= buflen) {
*cp = '\0';
ns_info(ns_log_db,
"domain name too long: %s...", buf);
strcpy(buf, "Name_Too_Long");
return;
}
+88 -151
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: db_ixfr.c,v 8.23 2000/12/23 08:14:35 vixie Exp $";
#endif
static char rcsid[] = "$Id: db_ixfr.c,v 8.18 1999/10/15 19:48:57 vixie Exp $";
#endif /* not lint */
/*
* Portions Copyright (c) 1999 by Check Point Software Technologies, Inc.
@@ -51,137 +51,81 @@ static char rcsid[] = "$Id: db_ixfr.c,v 8.23 2000/12/23 08:14:35 vixie Exp $
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
#include "port_after.h"
#include "named.h"
#define DBIXFR_ERROR (-1)
#define DBIXFR_FOUND_RR 2
#define DBIXFR_END 3
#define DBIXFR_ERROR -1
#define DBIXFR_FOUND_RR 2
#define DBIXFR_END 3
static int ixfr_getdelta(struct zoneinfo *, FILE *, const char *, char *,
ns_updque *, u_int32_t *, u_int32_t *);
static int ixfr_getrr(struct zoneinfo *, FILE *, const char *, char *,
ns_updrec **, u_int32_t *, u_int32_t *);
ns_deltalist *
ns_updrec *
ixfr_get_change_list(struct zoneinfo *zp,
u_int32_t from_serial, u_int32_t to_serial)
{
FILE * fp = NULL;
FILE * fp;
u_int32_t old_serial, new_serial;
char origin[MAXDNAME];
ns_deltalist *dlhead = NULL;
int ret;
struct namebuf *np, *listnp, *finlistnp;
LIST(ns_updrec) listuprec;
int ret, mode;
ns_updrec *uprec;
ns_delta *dl;
if (SEQ_GT(from_serial, to_serial))
return (NULL);
dlhead = memget(sizeof(*dlhead));
if (dlhead == NULL)
return (NULL);
INIT_LIST(*dlhead);
listnp = finlistnp = NULL;
INIT_LIST(listuprec);
if ((fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
goto cleanup;
return (NULL);
}
strcpy(origin, zp->z_origin);
lineno = 1;
np = NULL;
mode = 0;
old_serial = new_serial = 0;
for (;;) {
dl = memget(sizeof *dl);
if (dl == NULL) {
ns_warning(ns_log_db,
"ixfr_get_change_list: out of memory");
goto cleanup;
}
INIT_LINK(dl, d_link);
INIT_LIST(dl->d_changes);
ret = ixfr_getdelta(zp, fp, zp->z_ixfr_base, origin, &dl->d_changes,
&old_serial, &new_serial);
ret = ixfr_getrr(zp, fp, zp->z_ixfr_base, origin, &uprec,
&old_serial, &new_serial);
switch (ret) {
case DBIXFR_ERROR:
ns_warning(ns_log_db, "Logical error in %s: unlinking",
zp->z_ixfr_base);
unlink(zp->z_ixfr_base);
goto cleanup;
(void) my_fclose(fp);
ns_warning(ns_log_db, "Logical error in %s line %d",
zp->z_ixfr_base, lineno);
return (NULL);
case DBIXFR_FOUND_RR:
ns_debug(ns_log_default, 4, "ixfr_getdelta DBIXFR_FOUND_RR (%s)",
zp->z_origin);
if (EMPTY(*dlhead)) {
if (EMPTY(listuprec)) {
/* skip updates prior to the one we want */
uprec = HEAD(dl->d_changes);
INSIST(uprec != NULL);
if ((uprec->r_zone < from_serial) ||
(uprec->r_zone > to_serial))
{
while ((uprec = HEAD(dl->d_changes)) != NULL) {
UNLINK(dl->d_changes, uprec, r_link);
if (uprec->r_zone != from_serial) {
while (uprec != NULL) {
ns_updrec *prev;
if (uprec->r_dp != NULL)
db_freedata(uprec->r_dp);
db_freedata(uprec->r_dp);
uprec->r_dp = NULL;
prev = PREV(uprec, r_link);
res_freeupdrec(uprec);
uprec = prev;
}
memput(dl, sizeof *dl);
break;
}
else if (uprec->r_zone > from_serial) {
/* missed the boat */
ns_debug(ns_log_default, 3,
"ixfr_getdelta first SOA is %d, asked for %d (%s)",
uprec->r_zone,
from_serial,
zp->z_origin);
goto cleanup;
}
}
ns_debug(ns_log_default, 4,
"adding to change list (%s)",
zp->z_origin);
APPEND(*dlhead, dl, d_link);
APPEND(listuprec, uprec, r_link);
/* continue; */
break;
case DBIXFR_END:
ns_debug(ns_log_default, 4,
"ixfr_getdelta DBIXFR_END (%s)",
zp->z_origin);
(void) my_fclose(fp);
memput(dl, sizeof *dl);
return (dlhead);
return (HEAD(listuprec));
default:
(void) my_fclose(fp);
if (dl != NULL)
memput(dl, sizeof *dl);
return (NULL);
}
}
cleanup:
if (fp != NULL)
(void) my_fclose(fp);
while ((dl = HEAD(*dlhead)) != NULL) {
UNLINK(*dlhead, dl, d_link);
while ((uprec = HEAD(dl->d_changes)) != NULL) {
UNLINK(dl->d_changes, uprec, r_link);
if (uprec->r_dp != NULL)
db_freedata(uprec->r_dp);
uprec->r_dp = NULL;
res_freeupdrec(uprec);
}
memput(dl, sizeof *dl);
}
memput(dlhead, sizeof *dlhead);
return (NULL);
}
/*
@@ -193,7 +137,7 @@ ixfr_get_change_list(struct zoneinfo *zp,
*
* returns:
* 0 = serial number is up to date
* 1 = transmission is possible
* 1 = transision is possible
* -1 = error while opening the ixfr transaction log
* -2 = error in parameters
* -3 = logical error in the history file
@@ -203,17 +147,14 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
{
FILE *fp;
u_int32_t old_serial = 0, new_serial = 0;
u_int32_t last_serial = 0;
u_int32_t first_serial = 0;
char buf[BUFSIZ];
char *cp;
struct stat st;
int nonempty_lineno = -1, prev_pktdone = 0, cont = 0,
inside_next = 0;
int err;
int first = 0;
int rval = 0;
int id, rcode = NOERROR;
if (SEQ_GT(from_serial, to_serial))
return (-2);
if (from_serial == to_serial)
@@ -221,10 +162,6 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
/* If there is no log file, just return. */
if (zp->z_ixfr_base == NULL || zp->z_updatelog == NULL)
return (-1);
if (zp->z_serial_ixfr_start > 0) {
if (from_serial >= zp->z_serial_ixfr_start)
return (1);
}
if (stat(zp->z_ixfr_base, &st) < 0) {
if (errno != ENOENT)
ns_error(ns_log_db,
@@ -239,18 +176,17 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
}
if (fgets(buf, sizeof(buf), fp) == NULL) {
ns_error(ns_log_update, "fgets() from %s failed: %s",
zp->z_ixfr_base, strerror(errno));
zp->z_updatelog, strerror(errno));
fclose(fp);
return (-1);
}
if (strcmp(buf, LogSignature) != 0) {
ns_error(ns_log_update, "invalid log file %s",
zp->z_ixfr_base);
zp->z_updatelog);
fclose(fp);
return (-3);
}
lineno = 1;
first = 1;
for (;;) {
if (getword(buf, sizeof buf, fp, 0)) {
nonempty_lineno = lineno;
@@ -278,13 +214,12 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
if (cp != NULL)
lineno++;
if (sscanf((char *) cp, "%u", &old_serial)) {
if (first == 1) {
first = 0;
first_serial = old_serial;
}
last_serial = old_serial;
if (from_serial >= old_serial) {
rval = 1;
fclose(fp);
return (1);
} else {
fclose(fp);
return (-1);
}
}
prev_pktdone = 1;
@@ -297,16 +232,14 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
if (cp == NULL ||
sscanf((char *) cp, "from %u to %u",
&old_serial, &new_serial) != 2) {
rval = -3;
break;
fclose(fp);
return (-3);
} else if (from_serial >= old_serial) {
if (first == 1) {
first = 0;
first_serial = old_serial;
}
last_serial = old_serial;
rval = 1;
fclose(fp);
return (1);
}
fclose(fp);
return (-1);
}
if (prev_pktdone) {
prev_pktdone = 0;
@@ -315,19 +248,7 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
}
}
fclose(fp);
if (last_serial +1 < zp->z_serial) {
ns_warning(ns_log_db,
"%s: File Deleted. Found gap between serial:"
" %d and current serial: %d",
zp->z_ixfr_base, last_serial, zp->z_serial);
(void) unlink(zp->z_ixfr_base);
rval = -3;
}
if (from_serial < first_serial || from_serial > last_serial)
rval = -3;
if (rval == 1)
zp->z_serial_ixfr_start = first_serial;
return (rval);
return (0);
}
/* from db_load.c */
@@ -357,7 +278,12 @@ static struct map m_opcode[] = {
#define M_TYPE_CNT m_type_cnt
/*
* read a line from the history of a zone.
* int
* ixfr_getrr(struct zoneinfo *zp, FILE *fp,
* const char *filename, char *origin, struct namebuf **np,
* u_int32_t *old_serial, u_int32_t *new_serial)
*
* read a line from the historic of a zone.
*
* returns:
*
@@ -366,17 +292,20 @@ static struct map m_opcode[] = {
* DBIXFR_END = end of file
*/
static int
ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updque *listuprec, u_int32_t *old_serial,
ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updrec **uprec, u_int32_t *old_serial,
u_int32_t *new_serial)
{
static int read_soa, read_ns, rrcount;
char data[MAXDATA], dnbuf[MAXDNAME], sclass[3];
const char *errtype = "Database";
char *dname, *cp, *cp1;
char buf[MAXDATA];
u_int32_t serial, ttl;
int nonempty_lineno = -1, prev_pktdone = 0, cont = 0,
inside_next = 0;
int id;
int id, rcode = NOERROR;
int i, c, section, opcode, matches, zonenum, err, multiline;
int type, class;
u_int32_t n;
@@ -385,7 +314,9 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
int zonelist[MAXDNAME];
struct databuf *dp;
struct in_addr ina;
struct sockaddr_in empty_from;
int datasize;
ns_updque listuprec;
ns_updrec * rrecp;
u_long l;
@@ -394,6 +325,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
err = 0;
transport = primary_trans;
lineno = 1;
INIT_LIST(listuprec);
for (;;) {
if (!getword(buf, sizeof buf, fp, 0)) {
if (lineno == (nonempty_lineno + 1) && !(feof(fp))) {
@@ -405,10 +337,11 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
}
/*
* Empty line or EOF.
*
* Marks completion of current update packet.
*/
if (feof(fp))
break;
inside_next = 0;
prev_pktdone = 1;
cont = 1;
} else {
nonempty_lineno = lineno;
@@ -416,12 +349,15 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
if (!strcasecmp(buf, "[DYNAMIC_UPDATE]") ||
!strcasecmp(buf, "[IXFR_UPDATE]")) {
err = 0;
rcode = NOERROR;
cp = fgets(buf, sizeof buf, fp);
if (cp != NULL)
lineno++;
if (cp == NULL || !sscanf((char *) cp, "id %d", &id))
id = -1;
inside_next = 1;
prev_pktdone = 1;
cont = 1;
} else if (!strcasecmp(buf, "[INCR_SERIAL]")) {
/* XXXRTH not enough error checking here */
@@ -444,11 +380,14 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
lineno++;
}
if (prev_pktdone) {
if (!EMPTY(*listuprec)) {
if (!EMPTY(listuprec)) {
n++;
*uprec = TAIL(listuprec);
return (DBIXFR_FOUND_RR);
}
prev_pktdone = 0;
if (feof(fp))
break;
}
if (cont) {
cont = 0;
@@ -479,7 +418,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
cp = fgets(buf, sizeof buf, fp);
if (!cp)
*buf = '\0';
n = sscanf(cp, "origin %s class %s serial %lu",
n = sscanf(cp, "origin %s class %s serial %ul",
origin, sclass, &serial);
if (n != 3 || ns_samename(origin, zp->z_origin) != 1)
err++;
@@ -634,15 +573,14 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
err++;
break;
}
c = getnonblank(fp, zp->z_updatelog, 0);
c = getnonblank(fp, zp->z_updatelog);
if (c == '(') {
multiline = 1;
} else {
multiline = 0;
ungetc(c, fp);
}
n = getnum(fp, zp->z_updatelog, GETNUM_SERIAL,
&multiline);
n = getnum(fp, zp->z_updatelog, GETNUM_SERIAL);
if (getnum_error) {
err++;
break;
@@ -662,13 +600,11 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
n = l;
PUTLONG(n, cp);
}
if (multiline) {
c = getnonblank(fp, zp->z_updatelog, 1);
if (c != ')') {
ungetc(c, fp);
err++;
break;
}
if (multiline &&
getnonblank(fp, zp->z_updatelog) != ')')
{
err++;
break;
}
endline(fp);
n = cp - data;
@@ -864,7 +800,9 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_debug(ns_log_update, 1,
"merge of update id %d failed due to error at line %d",
id, lineno);
return (DBIXFR_ERROR);
memset(&empty_from, 0, sizeof empty_from);
free_rrecp(&listuprec, rcode, empty_from);
continue;
}
rrecp = res_mkupdrec(section, dname, class, type, ttl);
if (section != S_ZONE) {
@@ -884,7 +822,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updrec *arp;
int foundmatch;
arp = TAIL(*listuprec);
arp = TAIL(listuprec);
foundmatch = 0;
while (arp) {
if (arp->r_section == S_UPDATE &&
@@ -899,7 +837,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
db_cmp(arp->r_dp, dp) == 0) {
db_freedata(dp);
db_freedata(arp->r_dp);
UNLINK(*listuprec, arp, r_link);
UNLINK(listuprec, arp, r_link);
res_freeupdrec(arp);
res_freeupdrec(rrecp);
foundmatch = 1;
@@ -911,7 +849,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
continue;
}
APPEND(*listuprec, rrecp, r_link);
APPEND(listuprec, rrecp, r_link);
/* Override zone number with current zone serial number */
rrecp->r_zone = serial;
}
@@ -921,4 +859,3 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
return (DBIXFR_END);
}
+33 -107
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.110 2001/01/25 05:50:53 marka Exp $";
static const char rcsid[] = "$Id: db_load.c,v 8.97 1999/10/30 03:21:35 vixie Exp $";
#endif /* not lint */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: db_load.c,v 8.110 2001/01/25 05:50:53 marka Ex
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -252,7 +252,6 @@ db_load(const char *filename, const char *in_origin,
int genstart, genend, genstep;
char *thisfile;
void *state = NULL;
int loggenerr;
empty_from.sin_family = AF_INET;
empty_from.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -268,16 +267,7 @@ db_load(const char *filename, const char *in_origin,
switch (zp->z_type) {
case Z_PRIMARY:
/* Any updates should be saved before we attempt to reload. */
INSIST((zp->z_flags & (Z_NEED_DUMP|Z_NEED_SOAUPDATE)) == 0);
case Z_HINT:
if(filename == NULL) {
ns_error(ns_log_load,
"Required filename not specified for Hint zone");
zp->z_flags |= Z_DB_BAD;
zp->z_ftime = 0;
return (0);
}
transport = primary_trans;
break;
case Z_SECONDARY:
@@ -302,7 +292,6 @@ db_load(const char *filename, const char *in_origin,
default_warn = 1;
clev = nlabels(in_origin);
filenames = NULL;
zp->z_minimum = USE_MINIMUM;
}
ttl = default_ttl;
@@ -322,10 +311,7 @@ db_load(const char *filename, const char *in_origin,
ns_warning(ns_log_load, "db_load could not open: %s: %s",
filename, strerror(errno));
zp->z_ftime = 0;
if (ininclude)
return (-1);
errs = -1;
goto cleanup;
return (-1);
}
if (zp->z_type == Z_HINT) {
dbflags = DB_NODATA | DB_NOHINTS;
@@ -372,8 +358,7 @@ db_load(const char *filename, const char *in_origin,
endline(fp);
}
didinclude = 1;
i = db_load(buf, tmporigin, zp, domain, ISNOTIXFR);
errs += (i == -1) ? 1 : i;
errs += db_load(buf, tmporigin, zp, domain, ISNOTIXFR);
continue;
case ORIGIN:
@@ -425,21 +410,10 @@ db_load(const char *filename, const char *in_origin,
}
if (!getword(genrhs, sizeof(genrhs), fp, 2))
ERRTOZ("$GENERATE missing RHS");
loggenerr = 1;
for (i = genstart; i <= genend; i += genstep) {
if (genname(genlhs, i, origin, domain,
sizeof domain) == -1)
ERRTOZ("$GENERATE genname LHS failed");
if (!ns_samedomain(domain, zp->z_origin)) {
/* Log first per $GENERATE. */
if (loggenerr) {
ns_info(ns_log_load,
"%s:%d: $GENERATE LHS out of zone (ignored)",
filename, lineno);
loggenerr = 0;
}
continue;
}
context = ns_ownercontext(type, transport);
if (!ns_nameok(NULL, domain, class, zp, transport,
context, domain, inaddr_any)) {
@@ -552,7 +526,7 @@ db_load(const char *filename, const char *in_origin,
ns_warning(ns_log_load,
"Zone \"%s\" (file %s): %s",
zp->z_origin, filename,
"No default TTL ($TTL <value>) set, using SOA minimum instead");
"No default TTL set using SOA minimum instead");
default_warn = 0;
}
ttl = (u_int32_t)default_ttl;
@@ -690,7 +664,7 @@ db_load(const char *filename, const char *in_origin,
filename, lineno, domain,
zp->z_origin);
}
c = getnonblank(fp, filename, 0);
c = getnonblank(fp, filename);
if (c == '(') {
multiline = 1;
} else {
@@ -699,8 +673,7 @@ db_load(const char *filename, const char *in_origin,
}
serial = zp->z_serial;
zp->z_serial = getnum(fp, filename,
GETNUM_SERIAL,
&multiline);
GETNUM_SERIAL);
if (getnum_error)
errs++;
n = (u_int32_t) zp->z_serial;
@@ -769,15 +742,14 @@ db_load(const char *filename, const char *in_origin,
zp->z_minimum = 0;
} else
zp->z_minimum = n;
if (ttl == USE_MINIMUM)
if (default_ttl == USE_MINIMUM)
ttl = n;
n = cp - (char *)data;
if (multiline) {
buf[0] = getnonblank(fp, filename, 1);
buf[0] = getnonblank(fp, filename);
buf[1] = '\0';
if (buf[0] != ')')
ERRTO("SOA \")\"");
multiline = 0;
endline(fp);
}
read_soa++;
@@ -830,8 +802,7 @@ db_load(const char *filename, const char *in_origin,
PUTSHORT((u_int16_t)n, cp);
/* Preference */
n = getnum(fp, filename, GETNUM_NONE,
&multiline);
n = getnum(fp, filename, GETNUM_NONE);
if (getnum_error || n > 65536)
ERRTO("NAPTR Preference");
PUTSHORT((u_int16_t)n, cp);
@@ -898,14 +869,12 @@ db_load(const char *filename, const char *in_origin,
PUTSHORT((u_int16_t)n, cp);
if (type == ns_t_srv) {
n = getnum(fp, filename, GETNUM_NONE,
&multiline);
n = getnum(fp, filename, GETNUM_NONE);
if (getnum_error || n > 65536)
ERRTO("SRV RR");
PUTSHORT((u_int16_t)n, cp);
n = getnum(fp, filename, GETNUM_NONE,
&multiline);
n = getnum(fp, filename, GETNUM_NONE);
if (getnum_error || n > 65536)
ERRTO("SRV RR");
PUTSHORT((u_int16_t)n, cp);
@@ -1002,10 +971,7 @@ db_load(const char *filename, const char *in_origin,
case ns_t_cert:
case ns_t_sig: {
char *errmsg = NULL;
int ret;
if (ttl == USE_MINIMUM) /* no ttl set */
ttl = 0;
ret = parse_sec_rdata(buf, sizeof(buf), 0,
int ret = parse_sec_rdata(buf, sizeof(buf), 0,
data, sizeof(data),
fp, zp, domain, ttl,
type, domain_ctx,
@@ -1056,8 +1022,6 @@ db_load(const char *filename, const char *in_origin,
zp->z_origin);
continue;
}
if (ttl == USE_MINIMUM) /* no ttl set */
ttl = 0;
dp = savedata(class, type, (u_int32_t)ttl,
(u_char *)data, (int)n);
dp->d_zone = zp - zones;
@@ -1119,29 +1083,18 @@ db_load(const char *filename, const char *in_origin,
zp->z_origin, filename, msg);
}
}
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;
filenames = filenames->next;
freestr(fn->name);
memput(fn, sizeof *fn);
}
if (errs != 0) {
if (errs != -1)
ns_warning(ns_log_load,
if (errs != 0)
ns_warning(ns_log_load,
"%s zone \"%s\" (%s) rejected due to errors (serial %u)",
zoneTypeString(zp->z_type),
zp->z_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->z_origin, zp->z_type, zp->z_class,
loading);
} else
zoneTypeString(zp->z_type), zp->z_origin,
p_class(zp->z_class), zp->z_serial);
else
ns_info(ns_log_load,
"%s zone \"%s\" (%s) loaded (serial %u)",
zoneTypeString(zp->z_type), zp->z_origin,
@@ -1162,8 +1115,8 @@ db_load(const char *filename, const char *in_origin,
void
db_err(int err, char *domain, int type, const char *filename, int lineno) {
if (filename != NULL && err == CNAMEANDOTHER)
ns_warning(ns_log_load, "%s:%d:%s: CNAME and OTHER data error",
filename, lineno, domain);
ns_notice(ns_log_load, "%s:%d:%s: CNAME and OTHER data error",
filename, lineno, domain);
if (err != DATAEXISTS)
ns_debug(ns_log_load, 1, "update failed %s %d",
domain, type);
@@ -1400,7 +1353,7 @@ getttl(FILE *fp, const char *fn, int lineno, u_int32_t *ttl, int *multiline) {
return (-1);
}
if (*multiline) {
ch = getnonblank(fp, fn, 1);
ch = getnonblank(fp, fn);
if (ch == EOF)
return (-1);
if (ch == ';')
@@ -1481,7 +1434,7 @@ getallwords(char *buf, size_t size, FILE *fp, int preserve) {
}
int
getnum(FILE *fp, const char *src, int opt, int *multiline) {
getnum(FILE *fp, const char *src, int opt) {
int c, n;
int seendigit = 0;
int seendecimal = 0;
@@ -1495,12 +1448,8 @@ getnum(FILE *fp, const char *src, int opt, int *multiline) {
#endif
for (n = 0; (c = getc(fp)) != EOF; ) {
if (isspace(c)) {
if (c == '\n') {
if (*multiline)
lineno++;
else if (!seendigit)
goto eol;
}
if (c == '\n')
lineno++;
if (seendigit)
break;
continue;
@@ -1508,12 +1457,8 @@ getnum(FILE *fp, const char *src, int opt, int *multiline) {
if (c == ';') {
while ((c = getc(fp)) != EOF && c != '\n')
;
if (c == '\n') {
if (*multiline)
lineno++;
else if (!seendigit)
goto eol;
}
if (c == '\n')
lineno++;
if (seendigit)
break;
continue;
@@ -1583,50 +1528,32 @@ getnum(FILE *fp, const char *src, int opt, int *multiline) {
src, lineno, n+m);
}
return (n + m);
eol:
ns_error(ns_log_db, "%s:%d: unexpected end of line", src, lineno);
getnum_error = 1;
(void) ungetc(c, fp);
return (0);
}
#ifndef BIND_UPDATE
static
#endif
int
getnonblank(FILE *fp, const char *src, int multiline) {
getnonblank(FILE *fp, const char *src) {
int c;
while ((c = getc(fp)) != EOF) {
if (isspace(c)) {
if (c == '\n') {
if (multiline)
lineno++;
else
goto eol;
}
if (c == '\n')
lineno++;
continue;
}
if (c == ';') {
while ((c = getc(fp)) != EOF && c != '\n')
;
if (c == '\n') {
if (multiline)
lineno++;
else
goto eol;
}
if (c == '\n')
lineno++;
continue;
}
return (c);
}
ns_info(ns_log_db, "%s:%d: unexpected EOF", src, lineno);
return (EOF);
eol:
ns_error(ns_log_db, "%s:%d: unexpected end of line", src, lineno);
/* don't ungetc(c, fp); as the caller will do this. */
return(c);
}
/*
@@ -2151,8 +2078,7 @@ parse_sig_rr(char *buf, int buf_len, u_char *data, int data_size,
if (!getmlword(buf, my_buf_size, fp, 0))
ERRTO("Missing label count");
la = wordtouint32(buf);
if (wordtouint32_error || 255 <= la ||
(0 == la && *domain != '\0'))
if (0 == la || wordtouint32_error || 255 <= la)
ERRTO("Bad label count number");
data[i] = (u_char) la;
i++;
@@ -2178,7 +2104,7 @@ parse_sig_rr(char *buf, int buf_len, u_char *data, int data_size,
} else {
/* Parse and output OTTL; scan TEXP */
origTTL = wordtouint32(buf);
if (origTTL >= 0 || wordtouint32_error ||
if (0 >= origTTL || wordtouint32_error ||
(origTTL > 0x7fffffff))
ERRTO("Original TTL value bad");
cp = &data[i];
+4 -14
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_lookup.c 4.18 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: db_lookup.c,v 8.26 2000/04/21 06:54:03 vixie Exp $";
static const char rcsid[] = "$Id: db_lookup.c,v 8.24 1999/10/15 19:48:58 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_lookup.c,v 8.26 2000/04/21 06:54:03 vixie E
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -291,18 +291,8 @@ nxtlower(const char *name, struct databuf *dp) {
int
nxtmatch(const char *name, struct databuf *dp1, struct databuf *dp2) {
int dp1_lower, dp2_lower;
int type1, type2;
if (dp1->d_type == ns_t_sig)
type1 = SIG_COVERS(dp1);
else
type1 = dp1->d_type;
if (dp2->d_type == ns_t_sig)
type2 = SIG_COVERS(dp2);
else
type2 = dp2->d_type;
if (type1 != ns_t_nxt || type2 != ns_t_nxt)
if (dp1->d_type != ns_t_nxt || dp2->d_type != ns_t_nxt)
return (0);
dp1_lower = nxtlower(name, dp1);
dp2_lower = nxtlower(name, dp2);
+3 -3
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_save.c 4.16 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: db_save.c,v 8.28 2000/11/29 06:55:48 marka Exp $";
static const char rcsid[] = "$Id: db_save.c,v 8.26 1999/10/13 16:39:02 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_save.c,v 8.28 2000/11/29 06:55:48 marka Exp
*/
/*
* Portions Copyright (c) 1996-2000 by Internet Software Consortium.
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -156,7 +156,7 @@ savedata(class, type, ttl, data, size)
dp->d_clev = 0;
dp->d_secure = DB_S_INSECURE;
dp->d_rcode = NOERROR;
dp->d_addr.s_addr = htonl(0);
dp->d_ns = NULL;
dp->d_nstime = 0;
memcpy(dp->d_data, data, dp->d_size);
return (dp);
Loaded 100 of 3116 files, more files were not shown because too many files have changed in this diff. Show more