Compare commits

...
1 Commits
Author SHA1 Message Date
cvs2git 7150d5e275 This commit was manufactured by cvs2git to create tag 'v9_2_0rc8'. 2002-02-08 05:42:28 +00:00
186 changed files with 2736 additions and 44105 deletions
-255
View File
@@ -1,257 +1,3 @@
1191. [bug] A dynamic update removing the last non-apex name in
a secure zone would fail. [RT #2399]
1189. [bug] On some systems, malloc(0) returns NULL, which
could cause the caller to report an out of memory
error. [RT #2398]
1188. [bug] Dynamic updates of a signed zone would fail if
some of the zone private keys were unavailable.
1186. [bug] isc_hex_tobuffer(,,length = 0) failed to unget the
EOL token when reading to end of line.
1185. [bug] libbind: don't assume statp->_u._ext.ext is valid
unless RES_INIT is set when calling res_*init().
1184. [bug] libbind: call res_ndestroy() if RES_INIT is set
when res_*init() is called.
1183. [bug] Handle ENOSR error when writing to the internal
control pipe. [RT #2395]
1182. [bug] The server could throw an assertion failure when
constructing a negative response packet.
1176. [doc] Document that allow-v6-synthesis is only performed
for clients that are supplied recursive service.
[RT #2260]
1175. [bug] named-checkzone failed to call dns_result_register()
at startup which could result in runtime
exceptions when printing "out of memory" errors.
[RT #2335]
1174. [bug] Win32: add WSAECONNRESET to the expected errors
from connect(). [RT #2308]
1173. [bug] Potential memory leaks in isc_log_create() and
isc_log_settag(). [RT #2336]
1172. [doc] Add CERT, GPOS, KX, NAPTR, NSAP, PX and TXT to
table of RR types in ARM.
1170. [bug] Don't attempt to print the token when a I/O error
occurs when parsing named.conf. [RT #2275]
1168. [bug] Empty also-notify clauses were not handled. [RT #2309]
1167. [contrib] nslint-2.1a3 (from author).
1166. [bug] "Not Implemented" should be reported as NOTIMP,
not NOTIMPL. [RT #2281]
1165. [bug] We were rejecting notify-source{-v6} in zone clauses.
1164. [bug] Empty masters clauses in slave / stub zones were not
handled gracefully. [RT #2262]
1162. [bug] The allow-notify option was not accepted in slave
zone statements.
1161. [bug] named-checkzone looped on unbalanced brackets.
[RT #2248]
1160. [bug] Generating Diffie-Hellman keys longer than 1024
bits could fail. [RT #2241]
1156. [port] The configure test for strsep() incorrectly
succeeded on certain patched versions of
AIX 4.3.3. [RT #2190]
1154. [bug] Don't attempt to obtain the netmask of a interface
if there is no address configured. [RT #2176]
1152. [bug] libbind: read buffer overflows.
1144. [bug] rndc-confgen would crash if both the -a and -t
options were specified. [RT #2159]
1142. [bug] dnssec-signzone would fail to delete temporary files
in some failure cases. [RT #2144]
1141. [bug] When named rejected a control message, it would
leak a file descriptor and memory. It would also
fail to respond, causing rndc to hang.
[RT #2139, #2164]
1140. [bug] rndc-confgen did not accept IPv6 addresses as arguments
to the -s option. [RT #2138]
1136. [bug] CNAME records synthesized from DNAMEs did not
have a TTL of zero as required by RFC2672.
[RT #2129]
1125. [bug] rndc: -k option was missing from usage message.
[RT #2057]
1124. [doc] dig: +[no]dnssec, +[no]besteffort and +[no]fail
are now documented. [RT #2052]
1123. [bug] dig +[no]fail did not match description. [RT #2052]
1109. [bug] nsupdate accepted illegal ttl values.
1108. [bug] On Win32, rndc was hanging when named was not running
due to failure to select for exceptional conditions
in select(). [RT #1870]
1081. [bug] Multicast queries were incorrectly identified
based on the source address, not the destination
address.
1072. [bug] The TCP client quota could be exceeded when
recursion occurred. [RT #1937]
1071. [bug] Sockets listening for TCP DNS connections
specified an excessive listen backlog. [RT #1937]
1070. [bug] Copy DNSSEC OK (DO) to response as specified by
draft-ietf-dnsext-dnssec-okbit-03.txt.
1014. [bug] Some queries would cause statistics counters to
increment more than once or not at all. [RT #1321]
1012. [bug] The -p option to named did not behave as documented.
988. [bug] 'additional-from-auth no;' did not work reliably
in the case of queries answered from the cache.
[RT #1436]
995. [bug] dig, host, nslookup: using a raw IPv6 address as a
target address should be fatal on a IPv4 only system.
--- 9.2.0 released ---
1134. [bug] Multithreaded servers could deadlock in ferror()
when reloading zone files. [RT #1951, #1998]
1133. [bug] IN6_IS_ADDR_LOOPBACK was not portably defined on
platforms without IN6_IS_ADDR_LOOPBACK. [RT #2106]
--- 9.2.0rc10 released ---
1131. [bug] The match-destinations view option did not work with
IPv6 destinations. [RT #2073, #2074]
1130. [bug] Log messages reporting an out-of-range serial number
did not include the out-of-range number but the
following token. [RT #2076]
1129. [bug] Multithreaded servers could crash under heavy
resolution load due to a race condition. [RT #2018]
1126. [bug] The server could access a freed event if shut
down while a client start event was pending
delivery. [RT #2061]
1121. [bug] The server could attempt to access a NULL zone
table if shut down while resolving.
[RT #1587, #2054]
1120. [bug] Errors in options were not fatal. [RT #2002]
1118. [bug] On multithreaded servers, a race condition
could cause an assertion failure in resolver.c
during resolver shutdown. [RT #2029]
1117. [port] The configure check for in6addr_loopback incorrectly
succeeded on AIX 4.3 when compiling with -O2
because the test code was optimized away.
[RT #2016]
1116. [bug] Setting transfers in a server clause, transfers-in,
or transfers-per-ns to a value greater than
2147483647 disabled transfers. [RT #2002]
1114. [port] Ignore more accept() errors. [RT #2021]
1113. [bug] The allow-update-forwarding option was ignored
when specified in a view. [RT #2014]
1111. [bug] Multithreaded servers could deadlock processing
recursive queries due to a locking hieararchy
violation in adb.c. [RT #2017]
--- 9.2.0rc9 released ---
1107. [bug] nsupdate could catch an assertion failure if an
invalid domain name was given as the argument to
the "zone" command.
1106. [bug] After seeing an out of range TTL, nsupdate would
treat all TTLs as out of range. [RT #2001]
1104. [bug] Invalid arguments to the transfer-format option
could cause an assertion failure. [RT #1995]
1103. [port] OpenUNIX 8 support (ifconfig.sh). [RT #1970]
1102. [doc] Note that query logging is enabled by directing the
queries category to a channel.
1101. [bug] Array bounds read error in lwres_gai_strerror.
1100. [bug] libbind: DNSSEC key ids were computed incorrectly.
1099. [cleanup] libbind: defining REPORT_ERRORS in lib/bind/dst caused
compile time errors.
1098. [bug] libbind: HMAC-MD5 key files are now mode 0600.
1093. [doc] libbind: miscellaneous nroff fixes.
1092. [bug] libbind: get*by*() failed to check if res_init() had
been called.
1091. [bug] libbind: misplaced va_end().
1090. [bug] libbind: dns_ho.c:add_hostent() was not returning
the amount of memory consumed resulting in garbage
address being returned. Alignment calculations were
wasting space. We weren't suppressing duplicate
addresses.
1088. [port] libbind: MPE/iX C.70 (incomplete)
1087. [bug] libbind: struct __res_state too large on 64 bit arch.
1086. [port] libbind: sunos: old sprintf.
1085. [port] libbind: solaris: sys_nerr and sys_errlist do not
exist when compiling in 64 bit mode.
1084. [cleanup] libbind: gai_strerror() rewritten.
1083. [bug] The default control channel listened on the
wildcard adress, not the loopback as documented.
[RT #1975]
1082. [bug] The -g option to named incorrectly caused logging
to be sent to syslog in addition to stderr.
[RT #1974]
1078. [bug] We failed to correct bad tv_usec values in one case.
[RT #1966]
1076. [bug] A badly defined global key could trigger an assertion
on load/reload if views were used. [RT #1947]
1075. [bug] Out-of-range network prefix lengths were not
reported. [RT #1954]
1074. [bug] Running out of memory in dump_rdataset() could
cause an assertion failure. [RT #1946]
--- 9.2.0rc8 released ---
@@ -396,7 +142,6 @@
--- 9.2.0rc4 released ---
1013. [bug] It was possible to cancel a query twice when marking
a server as bogus or by having a blackhole acl.
[RT #1776]
-1
View File
@@ -13,7 +13,6 @@ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$Id: COPYRIGHT,v 1.6.2.1 2002/02/08 03:56:56 marka Exp $
Portions Copyright (C) 1996-2001 Nominum, Inc.
-68
View File
@@ -1,68 +0,0 @@
1007. [port] config.guess, config.sub from autoconf-2.52.
1008. [port] libtool.m4, ltmain.sh from libtool-1.4.2.
1009. [port] OpenUNIX 8 support. [RT #1728]
1024. [port] Compilation failed on HP-UX 11.11 due to
incompatible use of the SIOCGLIFCONF macro
name. [RT #1831]
[needs more work]
1073. [bug] The ADB cache cleaning should also be space driven.
[RT #1915, #1938]
[ New function dns_adb_setadbsize() ]
1105. [port] OpenUNIX 8 enable threads by default. [RT #1970]
[Functional change]
1110. [bug] dig should only accept valid abbreviations of +options.
[RT #2003]
[Potentially breaks scripts. Leave to 9.3.0.]
1143. [bug] When a trusted-keys statement was present and named
was built without crypto support, it would leak memory.
[ Not applicable to 9.2 ]
1150. [bug] named incorrectly accepted TTL values
containing plus or minus signs, such as
1d+1h-1s.
[ Uses new function isc_parse_uint32() ]
1151. [bug] nslookup failed to check that the arguments to
the port, timeout, and retry options were
valid integers and in range. [RT #2099]
[ Uses new function isc_parse_uint32() ]
1159. [bug] MD and MF are not permitted to be loaded by RFC1123
[ Could cause zones that loaded in 9.2.0 to fail
to load. Leave such breakages to 9.3.0. ]
1187. [bug] named was incorrectly returning DNSSEC records
in negative responses when the DO bit was not set.
[ Requires API change (new arguement) to
dns_rdataset_towire(), dns_rdataset_towirepartial()
and dns_rdataset_towirepartial() ]
1025. [bug] Don't use multicast addresses to resolve iterative
queries. [RT #101]
1034. [bug] Ignore the RD bit on multicast queries as specified
in RFC 1123. [RT #137]
1035. [bug] If we respond to multicast queries (which we
currently do not), respond from a unicast address
as specified in RFC 1123. [RT #137]
1037. [bug] Negative responses whose authority section contain
SOA or NS records whose owner names are not equal
equal to or parents of the query name should be
rejected. [RT #1862]
1079. [bug] BIND 8 compatibility: accept bare elements at top
level of sort list treating them as if they were
a single element list. [RT #1963]
1080. [bug] BIND 8 compatibility: accept bare IP prefixes
as the second element of a two-element top level
sort list statement. [RT #1964]
-86
View File
@@ -209,89 +209,3 @@ dynamic update for a zone using the "allow-update" option, you are not
supposed to edit the zone file by hand, and the server will not
attempt to reload it.
Q: I can query the nameserver from the nameserver but not from other
machines. Why?
A: This is usually the result of the firewall configuration stopping
the queries and / or the replies.
Q: How can I make a server a slave for both an internal and
an external view at the same time? When I tried, both views
on the slave were transfered from the same view on the master.
A: You will need to give the master and slave multiple IP addresses and
use those to make sure you reach the correct view on the other machine.
e.g.
Master: 10.0.1.1 (internal), 10.0.1.2 (external, IP alias)
internal:
match-clients { !10.0.1.2; !10.0.1.4; 10.0.1/24; };
notify-source 10.0.1.1;
transfer-source 10.0.1.1;
query-source 10.0.1.1;
external:
match-clients { any; };
recursion no; // don't offer recursion to the world
notify-source 10.0.1.2;
transfer-source 10.0.1.2;
query-source 10.0.1.2;
Slave: 10.0.1.3 (internal), 10.0.1.4 (external, IP alias)
internal:
match-clients { !10.0.1.2; !10.0.1.4; 10.0.1/24; };
notify-source 10.0.1.3;
transfer-source 10.0.1.3;
query-source 10.0.1.3;
external:
match-clients { any; };
recursion no; // don't offer recursion to the world
notify-source 10.0.1.4;
transfer-source 10.0.1.4;
query-source 10.0.1.4;
You put the external address on the alias so that all the other
dns clients on these boxes see the internal view by default.
Q: When I try to use rndc, I get the error message "network
unreachable" or "connection refused", even though I know named is
running.
A: You probably have "default-server localhost" in /etc/rndc.conf,
your /etc/hosts or DNS maps "localhost" to both the IPv4 loopback
address 127.0.0.1 and the IPv6 loopback address ::1, and you do not
have IPv6 fully operational. Change the "default-server localhost" to
"default-server 127.0.0.1" to make sure rdnc does not try to contact
the name server using IPv6.
Q: I have Freebsd 4.4 and "rndc-confgen -a" just sits there.
A: /dev/random is not configured. Use rndcontrol(8) to tell the kernel
to use certian interupts as a source of random events. You can make this
permanent by setting rand_irqs in /etc/rc.conf.
e.g.
/etc/rc.conf
rand_irqs="3 14 15"
Q: Why is named listening on UDP port other than 53?
A: Named uses a system selected port to make queries of other nameservers.
This behaviour can be overridden by using query-source to lock down the
port and/or address.
Q: I get error messages like "multiple RRs of singleton type" and
"CNAME and other data" when transfering a zone. What does this mean?
A: These indicate a malformed master zone. You can identify the
exact records involved by transfering the zone using dig then
running named-checkzone on it.
e.g.
dig axfr example.com @master-server > tmp
named-checkzone example.com tmp
+5 -24
View File
@@ -44,18 +44,12 @@ BIND 9
Nominum, Inc.
BIND 9.2.1
BIND 9.2.0rc8
BIND 9.2.1 is a maintenance release, containing fixes for
a number of bugs in 9.2.0 but no new features.
BIND 9.2.0rc8 is a release candidate for BIND 9.2.0.
It fixes a number of bugs in 9.2.0rc7.
NOTE: dig, nslookup name. now report "Not Implemented" as
NOTIMP rather than NOTIMPL. This will have impact on scripts
that are looking for NOTIMPL.
BIND 9.2.0
BIND 9.2.0 introduces a number of new features over 9.1,
BIND 9.2.0 has a number of new features over 9.1,
including:
- The size of the cache can now be limited using the
@@ -155,16 +149,13 @@ Building
COMPAQ Tru64 UNIX 4.0D
COMPAQ Tru64 UNIX 5 (with IPv6 EAK)
FreeBSD 3.4-STABLE, 3.5, 4.0, 4.1
HP-UX 11.x, x < 11
HP-UX 11
IRIX64 6.5
NetBSD 1.5
Red Hat Linux 6.0, 6.1, 6.2, 7.0
Solaris 2.6, 7, 8
Windows NT/W2K
HP-UX 11.11 is not yet supported due to its incompatible
SIOCGLIFCONF ioctl.
Additionally, we have unverified reports of success building
previous versions of BIND 9 from users of the following systems:
@@ -172,13 +163,10 @@ Building
SuSE Linux 7.0
Slackware Linux 7.x, 8.0
Red Hat Linux 7.1
Debian GNU/Linux 2.2 and 3.0
OpenBSD 2.6, 2.8, 2.9
UnixWare 7.1.1
HP-UX 10.20
BSD/OS 4.2
OpenUNIX 8
Mac OS X 10.1
To build, just
@@ -252,9 +240,6 @@ Building
should also "make depend". If you're using Emacs, you might find
"make tags" helpful.
If you need to re-run configure please run "make distclean" first.
This will ensure that all the option changes take.
Building with gcc is not supported, unless gcc is the vendor's usual
compiler (e.g. the various BSD systems, Linux).
@@ -289,10 +274,6 @@ Bug Reports and Mailing Lists
To join the BIND 9 Users mailing list, send mail to
bind9-users-request@isc.org
archives of which can be found via
http://www.isc.org/ml-archives/
If you're planning on making changes to the BIND 9 source
code, you might want to join the BIND 9 Workers mailing list.
+2 -2
View File
@@ -1,6 +1,6 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<!--
- Copyright (C) 2001, 2002 Internet Software Consortium.
- Copyright (C) 2001 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
@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: named-checkconf.docbook,v 1.3.2.1 2002/02/08 03:56:57 marka Exp $ -->
<!-- $Id: named-checkconf.docbook,v 1.3 2001/06/29 01:04:56 gson Exp $ -->
<refentry>
<refentryinfo>
+2 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named-checkzone.c,v 1.13.2.2 2002/02/08 03:56:58 marka Exp $ */
/* $Id: named-checkzone.c,v 1.13 2001/06/29 01:04:59 gson Exp $ */
#include <config.h>
@@ -157,8 +157,6 @@ main(int argc, char **argv) {
dns_log_setcontext(lctx);
}
dns_result_register();
origin = argv[isc_commandline_index++];
filename = argv[isc_commandline_index++];
result = setup(origin, filename, classname);
+2 -16
View File
@@ -274,7 +274,7 @@ Sets the timeout for a query to
An attempt to set \fIT\fR to less than 1 will result
in a query timeout of 1 second being applied.
.TP
\fB+tries=T\fR
\fB+tries=A\fR
Sets the number of times to retry UDP queries to server to
\fIT\fR instead of the default, 3. If
\fIT\fR is less than or equal to zero, the number of
@@ -301,19 +301,6 @@ Print records like the SOA records in a verbose multi-line
format with human-readable comments. The default is to print
each record on a single line, to facilitate machine parsing
of the \fBdig\fR output.
.TP
\fB+[no]fail\fR
Do not try the next server if you receive a SERVFAIL. The default is
to not try the next server which is the reverse of normal stub resolver
behaviour.
.TP
\fB+[no]besteffort\fR
Attempt to display the contents of messages which are malformed.
The default is to not display malformed answers.
.TP
\fB+[no]dnssec\fR
Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
in the the OPT record in the additional section of the query.
.SH "MULTIPLE QUERIES"
.PP
The BIND 9 implementation of \fBdig \fR supports
@@ -331,8 +318,7 @@ should be applied to that query.
A global set of query options, which should be applied to all queries,
can also be supplied. These global query options must precede the
first tuple of name, class, type, options, flags, and query options
supplied on the command line. Any global query options (except
the \fB+[no]cmd\fR option) can be
supplied on the command line. Any global query options can be
overridden by a query-specific set of query options. For example:
.sp
.nf
+30 -9
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2000-2002 Internet Software Consortium.
* Copyright (C) 2000, 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.157.2.6 2002/02/08 03:57:00 marka Exp $ */
/* $Id: dig.c,v 1.157.2.2 2001/09/18 01:04:05 gson Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -111,7 +111,7 @@ static const char *rcodetext[] = {
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"NOTIMPL",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
@@ -156,11 +156,9 @@ help(void) {
" -x dot-notation (shortcut for in-addr lookups)\n"
" -n (nibble form for reverse IPv6 lookups)\n"
" -f filename (batch mode)\n"
" -b address (bind to source address)\n"
" -p port (specify port number)\n"
" -t type (specify query type)\n"
" -c class (specify query class)\n"
" -k keyfile (specify tsig key file)\n"
" -y name:key (specify named base64 tsig key)\n"
" d-opt is of the form +keyword[=value], where keyword is:\n"
" +[no]vc (TCP mode)\n"
@@ -169,7 +167,6 @@ help(void) {
" +tries=### (Set number of UDP attempts) [3]\n"
" +domain=### (Set default domainname)\n"
" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
" +ndots=### (Set NDOTS value)\n"
" +[no]search (Set whether to use searchlist)\n"
" +[no]defname (Ditto)\n"
" +[no]recursive (Recursive mode)\n"
@@ -180,6 +177,7 @@ help(void) {
" +[no]aaonly (Set AA flag in query)\n"
" +[no]adflag (Set AD flag in query)\n"
" +[no]cdflag (Set CD flag in query)\n"
" +ndots=### (Set NDOTS value)\n"
" +[no]cmd (Control display of command line)\n"
" +[no]comments (Control display of comment lines)\n"
" +[no]question (Control display of question)\n"
@@ -190,7 +188,7 @@ help(void) {
" +[no]short (Disable everything except short\n"
" form of answer)\n"
" +[no]all (Set or clear all display flags)\n"
" +[no]qr (Print question before sending)\n"
" +qr (Print question before sending)\n"
" +[no]nssearch (Search all authoritative nameservers)\n"
" +[no]identify (ID responders in short answers)\n"
" +[no]trace (Trace delegation down from root)\n"
@@ -858,9 +856,32 @@ plus_option(char *option, isc_boolean_t is_batchfile,
}
break;
case 'v':
if (!is_batchfile)
lookup->tcp_mode = state;
#ifdef DNS_OPT_NEWCODES_LIVE
switch (cmd[1]) {
default:
case 'c': /* vc, and default */
#endif /* DNS_OPT_NEWCODES_LIVE */
if (!is_batchfile)
lookup->tcp_mode = state;
break;
#ifdef DNS_OPT_NEWCODES_LIVE
case 'i': /* view */
if (value == NULL)
goto need_value;
if (!state)
goto invalid_option;
strncpy(lookup->viewname, value, MXNAME);
break;
}
break;
case 'z': /* zone */
if (value == NULL)
goto need_value;
if (!state)
goto invalid_option;
strncpy(lookup->zonename, value, MXNAME);
break;
#endif /* DNS_OPT_NEWCODES_LIVE */
default:
invalid_option:
need_value:
+3 -25
View File
@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: dig.docbook,v 1.4.2.2 2001/11/28 23:35:02 gson Exp $ -->
<!-- $Id: dig.docbook,v 1.4 2001/07/12 16:29:11 bwelling Exp $ -->
<refentry>
@@ -414,7 +414,7 @@ An attempt to set <parameter>T</parameter> to less than 1 will result
in a query timeout of 1 second being applied.
</para></listitem></varlistentry>
<varlistentry><term><option>+tries=T</option></term>
<varlistentry><term><option>+tries=A</option></term>
<listitem><para>
Sets the number of times to retry UDP queries to server to
<parameter>T</parameter> instead of the default, 3. If
@@ -452,27 +452,6 @@ of the <command>dig</command> output.
</para>
</listitem></varlistentry>
<varlistentry><term><option>+[no]fail</option></term>
<listitem><para>
Do not try the next server if you receive a SERVFAIL. The default is
to not try the next server which is the reverse of normal stub resolver
behaviour.
</para>
</listitem></varlistentry>
<varlistentry><term><option>+[no]besteffort</option></term>
<listitem><para>
Attempt to display the contents of messages which are malformed.
The default is to not display malformed answers.
</para>
</listitem></varlistentry>
<varlistentry><term><option>+[no]dnssec</option></term>
<listitem><para>
Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
in the the OPT record in the additional section of the query.
</para>
</variablelist>
</para>
@@ -501,8 +480,7 @@ should be applied to that query.
A global set of query options, which should be applied to all queries,
can also be supplied. These global query options must precede the
first tuple of name, class, type, options, flags, and query options
supplied on the command line. Any global query options (except
the <option>+[no]cmd</option> option) can be
supplied on the command line. Any global query options can be
overridden by a query-specific set of query options. For example:
<programlisting>
dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
+6 -41
View File
@@ -870,7 +870,7 @@ in a query timeout of 1 second being applied.</P
><DT
><TT
CLASS="OPTION"
>+tries=T</TT
>+tries=A</TT
></DT
><DD
><P
@@ -959,37 +959,6 @@ CLASS="COMMAND"
>dig</B
> output.</P
></DD
><DT
><TT
CLASS="OPTION"
>+[no]fail</TT
></DT
><DD
><P
>Do not try the next server if you receive a SERVFAIL. The default is
to not try the next server which is the reverse of normal stub resolver
behaviour.</P
></DD
><DT
><TT
CLASS="OPTION"
>+[no]besteffort</TT
></DT
><DD
><P
>Attempt to display the contents of messages which are malformed.
The default is to not display malformed answers.</P
></DD
><DT
><TT
CLASS="OPTION"
>+[no]dnssec</TT
></DT
><DD
><P
>Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
in the the OPT record in the additional section of the query.</P
></DD
></DL
></DIV
>&#13;</P
@@ -997,7 +966,7 @@ in the the OPT record in the additional section of the query.</P
><DIV
CLASS="REFSECT1"
><A
NAME="AEN335"
NAME="AEN320"
></A
><H2
>MULTIPLE QUERIES</H2
@@ -1028,11 +997,7 @@ should be applied to that query.</P
>A global set of query options, which should be applied to all queries,
can also be supplied. These global query options must precede the
first tuple of name, class, type, options, flags, and query options
supplied on the command line. Any global query options (except
the <TT
CLASS="OPTION"
>+[no]cmd</TT
> option) can be
supplied on the command line. Any global query options can be
overridden by a query-specific set of query options. For example:
<PRE
CLASS="PROGRAMLISTING"
@@ -1081,7 +1046,7 @@ CLASS="LITERAL"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN353"
NAME="AEN337"
></A
><H2
>FILES</H2
@@ -1094,7 +1059,7 @@ CLASS="FILENAME"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN357"
NAME="AEN341"
></A
><H2
>SEE ALSO</H2
@@ -1128,7 +1093,7 @@ CLASS="CITETITLE"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN370"
NAME="AEN354"
></A
><H2
>BUGS </H2
+102 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2000-2002 Internet Software Consortium.
* Copyright (C) 2000, 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.221.2.10 2002/02/08 03:57:02 marka Exp $ */
/* $Id: dighost.c,v 1.221.2.5 2001/10/15 23:06:07 bwelling Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@@ -36,6 +36,9 @@
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
#ifdef DNS_OPT_NEWCODES
#include <dns/opt.h>
#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
@@ -363,7 +366,7 @@ make_empty_lookup(void) {
looknew->identify = ISC_FALSE;
looknew->identify_previous_line = ISC_FALSE;
looknew->ignore = ISC_FALSE;
looknew->servfail_stops = ISC_TRUE;
looknew->servfail_stops = ISC_FALSE;
looknew->besteffort = ISC_TRUE;
looknew->dnssec = ISC_FALSE;
looknew->udpsize = 0;
@@ -386,6 +389,10 @@ make_empty_lookup(void) {
looknew->section_authority = ISC_TRUE;
looknew->section_additional = ISC_TRUE;
looknew->new_search = ISC_FALSE;
#ifdef DNS_OPT_NEWCODES_LIVE
looknew->zonename[0] = 0;
looknew->viewname[0] = 0;
#endif /* DNS_OPT_NEWCODES_LIVE */
ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q);
ISC_LIST_INIT(looknew->my_server_list);
@@ -442,6 +449,10 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->section_additional = lookold->section_additional;
looknew->retries = lookold->retries;
looknew->tsigctx = NULL;
#ifdef DNS_OPT_NEWCODES_LIVE
strncpy(looknew->viewname, lookold->viewname, MXNAME);
strncpy(looknew->zonename, lookold->zonename, MXNAME);
#endif /* DNS_OPT_NEWCODES_LIVE */
if (servers)
clone_server_list(lookold->my_server_list,
@@ -744,11 +755,20 @@ setup_libs(void) {
* options are UDP buffer size and the DO bit.
*/
static void
add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec) {
add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec
#ifdef DNS_OPT_NEWCODES_LIVE
, dns_optlist_t optlist
#endif /* DNS_OPT_NEWCODES_LIVE */
)
{
dns_rdataset_t *rdataset = NULL;
dns_rdatalist_t *rdatalist = NULL;
dns_rdata_t *rdata = NULL;
isc_result_t result;
#ifdef DNS_OPT_NEWCODES_LIVE
isc_buffer_t *rdatabuf = NULL;
unsigned int i, optsize = 0;
#endif /* DNS_OPT_NEWCODES_LIVE */
debug("add_opt()");
result = dns_message_gettemprdataset(msg, &rdataset);
@@ -768,6 +788,15 @@ add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec) {
rdatalist->ttl = DNS_MESSAGEEXTFLAG_DO;
rdata->data = NULL;
rdata->length = 0;
#ifdef DNS_OPT_NEWCODES_LIVE
for (i = 0; i < optlist.used; i++)
optsize += optlist.attrs[i].value.length + 4;
result = isc_buffer_allocate(mctx, &rdatabuf, optsize);
check_result(result, "isc_buffer_allocate");
result = dns_opt_add(rdata, &optlist, rdatabuf);
check_result(result, "dns_opt_add");
dns_message_takebuffer(msg, &rdatabuf);
#endif /* DNS_OPT_NEWCODES_LIVE */
ISC_LIST_INIT(rdatalist->rdata);
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
dns_rdatalist_tordataset(rdatalist, rdataset);
@@ -1025,9 +1054,9 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
if (!success) {
success = ISC_TRUE;
lookup_counter++;
cancel_lookup(query->lookup);
lookup = requeue_lookup(query->lookup,
ISC_FALSE);
cancel_lookup(query->lookup);
lookup->doing_xfr = ISC_FALSE;
if (!lookup->trace_root &&
section == DNS_SECTION_ANSWER)
@@ -1081,9 +1110,9 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
* Then we just did rootorg; there's nothing left.
*/
return (ISC_FALSE);
cancel_lookup(query->lookup);
lookup = requeue_lookup(query->lookup, ISC_TRUE);
lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
cancel_lookup(query->lookup);
return (ISC_TRUE);
}
@@ -1354,10 +1383,67 @@ setup_lookup(dig_lookup_t *lookup) {
result = dns_message_renderbegin(lookup->sendmsg, &cctx,
&lookup->sendbuf);
check_result(result, "dns_message_renderbegin");
#ifndef DNS_OPT_NEWCODES_LIVE
if (lookup->udpsize > 0 || lookup->dnssec) {
#else /* DNS_OPT_NEWCODES_LIVE */
if (lookup->udpsize > 0 || || lookup->dnssec ||
lookup->zonename[0] != 0 || lookup->viewname[0] != 0) {
dns_fixedname_t fname;
isc_buffer_t namebuf, *wirebuf = NULL;
dns_compress_t zcctx;
dns_optlist_t optlist;
dns_optattr_t optattr[2];
#endif /* DNS_OPT_NEWCODES_LIVE */
if (lookup->udpsize == 0)
lookup->udpsize = 2048;
#ifdef DNS_OPT_NEWCODES_LIVE
optlist.size = 2;
optlist.used = 0;
optlist.next = 0;
optlist.attrs = optattr;
if (lookup->zonename[0] != 0) {
optattr[optlist.used].code = DNS_OPTCODE_ZONE;
dns_fixedname_init(&fname);
isc_buffer_init(&namebuf, lookup->zonename,
strlen(lookup->zonename));
isc_buffer_add(&namebuf, strlen(lookup->zonename));
result = dns_name_fromtext(&(fname.name), &namebuf,
dns_rootname, ISC_FALSE,
NULL);
check_result(result, "; illegal zone option");
result = dns_compress_init(&zcctx, 0, mctx);
check_result(result, "dns_compress_init");
result = isc_buffer_allocate(mctx, &wirebuf,
MXNAME);
check_result(result, "isc_buffer_allocate");
result = dns_name_towire(&(fname.name), &zcctx,
wirebuf);
check_result(result, "dns_name_towire");
optattr[optlist.used].value.base =
isc_buffer_base(wirebuf);
optattr[optlist.used].value.length =
isc_buffer_usedlength(wirebuf);
optlist.used++;
dns_compress_invalidate(&zcctx);
}
if (lookup->viewname[0] != 0) {
optattr[optlist.used].code = DNS_OPTCODE_VIEW;
optattr[optlist.used].value.base =
lookup->viewname;
optattr[optlist.used].value.length =
strlen(lookup->viewname);
optlist.used++;
}
add_opt(lookup->sendmsg, lookup->udpsize, lookup->dnssec,
optlist);
if (wirebuf != NULL)
isc_buffer_free(&wirebuf);
#else /* DNS_OPT_NEWCODES_LIVE */
add_opt(lookup->sendmsg, lookup->udpsize, lookup->dnssec);
#endif /* DNS_OPT_NEWCODES_LIVE */
}
result = dns_message_rendersection(lookup->sendmsg,
@@ -1699,9 +1785,9 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
} else {
debug("making new TCP request, %d tries left",
l->retries);
cancel_lookup(l);
l->retries--;
requeue_lookup(l, ISC_TRUE);
cancel_lookup(l);
}
} else {
fputs(l->cmdline, stdout);
@@ -2208,7 +2294,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
UNLOCK_LOOKUP;
return;
}
if (msg->rcode == dns_rcode_servfail && !l->servfail_stops) {
if (msg->rcode == dns_rcode_servfail && l->servfail_stops) {
dig_query_t *next = ISC_LIST_NEXT(query, link);
if (l->current_query == query)
l->current_query = NULL;
@@ -2393,16 +2479,15 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
debug("get_address()");
if (inet_pton(AF_INET6, host, &in6) == 1) {
if (!have_ipv6)
fatal("Protocol family INET6 not supported '%s'", host);
/*
* Assume we have v4 if we don't have v6, since setup_libs
* fatal()'s out if we don't have either.
*/
if (have_ipv6 && inet_pton(AF_INET6, host, &in6) == 1)
isc_sockaddr_fromin6(sockaddr, &in6, port);
} else if (inet_pton(AF_INET, host, &in4) == 1) {
if (have_ipv4)
isc_sockaddr_fromin(sockaddr, &in4, port);
else
isc_sockaddr_v6fromin(sockaddr, &in4, port);
} else {
else if (inet_pton(AF_INET, host, &in4) == 1)
isc_sockaddr_fromin(sockaddr, &in4, port);
else {
#ifdef USE_GETADDRINFO
memset(&hints, 0, sizeof(hints));
if (!have_ipv6)
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2000-2002 Internet Software Consortium.
* Copyright (C) 2000, 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: host.c,v 1.76.2.2 2002/02/08 03:57:04 marka Exp $ */
/* $Id: host.c,v 1.76 2001/08/27 21:31:29 gson Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -78,7 +78,7 @@ static const char *rcodetext[] = {
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"NOTIMPL",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
+5 -1
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.h,v 1.71.2.3 2001/11/15 01:24:13 marka Exp $ */
/* $Id: dig.h,v 1.71.2.2 2001/10/04 22:21:45 gson Exp $ */
#ifndef DIG_H
#define DIG_H
@@ -140,6 +140,10 @@ struct dig_lookup {
isc_uint32_t ixfr_serial;
isc_buffer_t rdatabuf;
char rdatastore[MXNAME];
#ifdef DNS_OPT_NEWCODES_LIVE
char zonename[MXNAME];
char viewname[MXNAME];
#endif /* DNS_OPT_NEWCODES_LIVE */
dst_context_t *tsigctx;
isc_buffer_t *querysig;
isc_uint32_t msgcounter;
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2000-2002 Internet Software Consortium.
* Copyright (C) 2000, 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.90.2.2 2002/02/08 03:57:05 marka Exp $ */
/* $Id: nslookup.c,v 1.90 2001/07/30 01:09:14 marka Exp $ */
#include <config.h>
@@ -80,7 +80,7 @@ static const char *rcodetext[] = {
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"NOTIMPL",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
+6 -3
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssectool.c,v 1.31.2.2 2001/11/27 22:41:49 gson Exp $ */
/* $Id: dnssectool.c,v 1.31.2.1 2001/09/06 00:14:15 gson Exp $ */
#include <config.h>
@@ -65,8 +65,11 @@ setfatalcallback(fatalcallback_t *callback) {
void
check_result(isc_result_t result, const char *message) {
if (result != ISC_R_SUCCESS)
fatal("%s: %s", message, isc_result_totext(result));
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "%s: %s: %s\n", program, message,
isc_result_totext(result));
exit(1);
}
}
void
+296 -136
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: client.c,v 1.176.2.10 2002/02/08 03:57:07 marka Exp $ */
/* $Id: client.c,v 1.176.2.4 2001/10/12 19:14:47 gson Exp $ */
#include <config.h>
@@ -33,6 +33,9 @@
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/message.h>
#ifdef DNS_OPT_NEWCODES
#include <dns/opt.h>
#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
@@ -173,6 +176,113 @@ static void client_start(isc_task_t *task, isc_event_t *event);
static void client_request(isc_task_t *task, isc_event_t *event);
static void ns_client_dumpmessage(ns_client_t *client, const char *reason);
/*
* Enter the inactive state.
*
* Requires:
* No requests are outstanding.
*/
static void
client_deactivate(ns_client_t *client) {
REQUIRE(NS_CLIENT_VALID(client));
if (client->interface)
ns_interface_detach(&client->interface);
INSIST(client->naccepts == 0);
INSIST(client->recursionquota == NULL);
if (client->tcplistener != NULL)
isc_socket_detach(&client->tcplistener);
if (client->udpsocket != NULL)
isc_socket_detach(&client->udpsocket);
if (client->dispatch != NULL)
dns_dispatch_detach(&client->dispatch);
client->attributes = 0;
client->mortal = ISC_FALSE;
LOCK(&client->manager->lock);
ISC_LIST_UNLINK(client->manager->active, client, link);
ISC_LIST_APPEND(client->manager->inactive, client, link);
client->list = &client->manager->inactive;
UNLOCK(&client->manager->lock);
}
/*
* Clean up a client object and free its memory.
* Requires:
* The client is in the inactive state.
*/
static void
client_free(ns_client_t *client) {
isc_boolean_t need_clientmgr_destroy = ISC_FALSE;
ns_clientmgr_t *manager = NULL;
REQUIRE(NS_CLIENT_VALID(client));
/*
* When "shuttingdown" is true, either the task has received
* its shutdown event or no shutdown event has ever been
* set up. Thus, we have no outstanding shutdown
* event at this point.
*/
REQUIRE(client->state == NS_CLIENTSTATE_INACTIVE);
INSIST(client->recursionquota == NULL);
ns_query_free(client);
isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE);
isc_event_free((isc_event_t **)&client->sendevent);
isc_event_free((isc_event_t **)&client->recvevent);
isc_timer_detach(&client->timer);
if (client->tcpbuf != NULL)
isc_mem_put(client->mctx, client->tcpbuf, TCP_BUFFER_SIZE);
if (client->opt != NULL) {
INSIST(dns_rdataset_isassociated(client->opt));
dns_rdataset_disassociate(client->opt);
dns_message_puttemprdataset(client->message, &client->opt);
}
#ifdef DNS_OPT_NEWCODES
if (client->opt_zone != NULL) {
isc_mem_put(client->mctx, client->opt_zone,
sizeof(*client->opt_zone));
client->opt_zone = NULL;
}
if (client->opt_view != NULL)
isc_buffer_free(&client->opt_view);
#endif /* DNS_OPT_NEWCODES */
dns_message_destroy(&client->message);
if (client->manager != NULL) {
manager = client->manager;
LOCK(&manager->lock);
ISC_LIST_UNLINK(*client->list, client, link);
client->list = NULL;
if (manager->exiting &&
ISC_LIST_EMPTY(manager->active) &&
ISC_LIST_EMPTY(manager->inactive))
need_clientmgr_destroy = ISC_TRUE;
UNLOCK(&manager->lock);
}
/*
* Detaching the task must be done after unlinking from
* the manager's lists because the manager accesses
* client->task.
*/
if (client->task != NULL)
isc_task_detach(&client->task);
CTRACE("free");
client->magic = 0;
isc_mem_put(client->mctx, client, sizeof *client);
if (need_clientmgr_destroy)
clientmgr_destroy(manager);
}
void
ns_client_settimeout(ns_client_t *client, unsigned int seconds) {
isc_result_t result;
@@ -199,9 +309,6 @@ ns_client_settimeout(ns_client_t *client, unsigned int seconds) {
*/
static isc_boolean_t
exit_check(ns_client_t *client) {
ns_clientmgr_t *locked_manager = NULL;
ns_clientmgr_t *destroy_manager = NULL;
REQUIRE(NS_CLIENT_VALID(client));
if (client->state <= client->newstate)
@@ -341,47 +448,12 @@ exit_check(ns_client_t *client) {
}
/* Recv cancel is complete. */
if (client->nctls > 0) {
/* Still waiting for control event to be delivered */
return (ISC_TRUE);
}
/* Deactivate the client. */
if (client->interface)
ns_interface_detach(&client->interface);
INSIST(client->naccepts == 0);
INSIST(client->recursionquota == NULL);
if (client->tcplistener != NULL)
isc_socket_detach(&client->tcplistener);
if (client->udpsocket != NULL)
isc_socket_detach(&client->udpsocket);
if (client->dispatch != NULL)
dns_dispatch_detach(&client->dispatch);
client->attributes = 0;
client->mortal = ISC_FALSE;
LOCK(&client->manager->lock);
/*
* Put the client on the inactive list. If we are aiming for
* the "freed" state, it will be removed from the inactive
* list shortly, and we need to keep the manager locked until
* that has been done, lest the manager decide to reactivate
* the dying client inbetween.
*/
locked_manager = client->manager;
ISC_LIST_UNLINK(*client->list, client, link);
ISC_LIST_APPEND(client->manager->inactive, client, link);
client->list = &client->manager->inactive;
client_deactivate(client);
client->state = NS_CLIENTSTATE_INACTIVE;
INSIST(client->recursionquota == NULL);
if (client->state == client->newstate) {
client->newstate = NS_CLIENTSTATE_MAX;
goto unlock;
return (ISC_TRUE); /* We're done. */
}
}
@@ -389,71 +461,11 @@ exit_check(ns_client_t *client) {
INSIST(client->newstate == NS_CLIENTSTATE_FREED);
/*
* We are trying to free the client.
*
* When "shuttingdown" is true, either the task has received
* its shutdown event or no shutdown event has ever been
* set up. Thus, we have no outstanding shutdown
* event at this point.
*/
REQUIRE(client->state == NS_CLIENTSTATE_INACTIVE);
INSIST(client->recursionquota == NULL);
ns_query_free(client);
isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE);
isc_event_free((isc_event_t **)&client->sendevent);
isc_event_free((isc_event_t **)&client->recvevent);
isc_timer_detach(&client->timer);
if (client->tcpbuf != NULL)
isc_mem_put(client->mctx, client->tcpbuf, TCP_BUFFER_SIZE);
if (client->opt != NULL) {
INSIST(dns_rdataset_isassociated(client->opt));
dns_rdataset_disassociate(client->opt);
dns_message_puttemprdataset(client->message, &client->opt);
}
dns_message_destroy(&client->message);
if (client->manager != NULL) {
ns_clientmgr_t *manager = client->manager;
if (locked_manager == NULL) {
LOCK(&manager->lock);
locked_manager = manager;
}
ISC_LIST_UNLINK(*client->list, client, link);
client->list = NULL;
if (manager->exiting &&
ISC_LIST_EMPTY(manager->active) &&
ISC_LIST_EMPTY(manager->inactive))
destroy_manager = manager;
}
/*
* Detaching the task must be done after unlinking from
* the manager's lists because the manager accesses
* client->task.
*/
if (client->task != NULL)
isc_task_detach(&client->task);
CTRACE("free");
client->magic = 0;
isc_mem_put(client->mctx, client, sizeof(*client));
goto unlock;
client_free(client);
return (ISC_TRUE);
}
unlock:
if (locked_manager != NULL) {
UNLOCK(&locked_manager->lock);
locked_manager = NULL;
}
/*
* Only now is it safe to destroy the client manager (if needed),
* because we have accessed its lock for the last time.
*/
if (destroy_manager != NULL)
clientmgr_destroy(destroy_manager);
return (ISC_TRUE);
}
@@ -469,12 +481,6 @@ client_start(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
INSIST(client->nctls == 1);
client->nctls--;
if (exit_check(client))
return;
if (TCP_CLIENT(client)) {
client_accept(client);
} else {
@@ -980,6 +986,75 @@ ns_client_error(ns_client_t *client, isc_result_t result) {
ns_client_send(client);
}
#ifdef DNS_OPT_NEWCODES
static isc_result_t
client_addoptattrs(ns_client_t *client, dns_rdata_t *rdata) {
isc_result_t result;
isc_buffer_t *zonebuf = NULL, *buf = NULL;
dns_optlist_t attrlist;
dns_optattr_t attrs[CLIENT_NUMATTRS];
dns_compress_t cctx;
int i, sizeneeded = 0;
result = dns_compress_init(&cctx, 0, client->mctx);
if (result != ISC_R_SUCCESS)
goto fail1;
dns_compress_setmethods(&cctx, DNS_COMPRESS_NONE);
attrlist.size=2;
attrlist.used=0;
attrlist.attrs=attrs;
for (i=0; i<CLIENT_NUMATTRS; i++) {
attrs[i].code = 0;
attrs[i].value.base = NULL;
attrs[i].value.length = 0;
}
if (client->opt_zone != NULL) {
result = isc_buffer_allocate(client->mctx, &zonebuf,
DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
goto fail2;
result = dns_name_towire(dns_fixedname_name(client->opt_zone),
&cctx, zonebuf);
if (result != ISC_R_SUCCESS)
goto fail2;
attrs[attrlist.used].code = DNS_OPTCODE_ZONE;
attrs[attrlist.used].value.base = isc_buffer_base(zonebuf);
attrs[attrlist.used].value.length =
isc_buffer_usedlength(zonebuf);
attrlist.used++;
sizeneeded += 4 + isc_buffer_usedlength(zonebuf);
}
if (client->opt_view != NULL) {
attrs[attrlist.used].code = DNS_OPTCODE_VIEW;
attrs[attrlist.used].value.base =
isc_buffer_base(client->opt_view);
attrs[attrlist.used].value.length =
isc_buffer_usedlength(client->opt_view);
attrlist.used++;
sizeneeded += 4 + isc_buffer_usedlength(client->opt_view);
}
if (sizeneeded == 0) {
result = ISC_R_SUCCESS;
goto fail2;
}
result = isc_buffer_allocate(client->mctx, &buf, sizeneeded+1);
if (result != ISC_R_SUCCESS)
goto fail2;
result = dns_opt_add(rdata, &attrlist, buf);
if (result != ISC_R_SUCCESS)
goto fail2;
dns_message_takebuffer(client->message, &buf);
fail2:
dns_compress_invalidate(&cctx);
fail1:
if (buf != NULL)
isc_buffer_free(&buf);
if (zonebuf != NULL)
isc_buffer_free(&zonebuf);
return (result);
}
#endif /* DNS_OPT_NEWCODES */
static inline isc_result_t
client_addopt(ns_client_t *client) {
dns_rdataset_t *rdataset;
@@ -1014,7 +1089,7 @@ client_addopt(ns_client_t *client) {
/*
* Set EXTENDED-RCODE, VERSION, and Z to 0.
*/
rdatalist->ttl = (client->extflags & DNS_MESSAGEEXTFLAG_REPLYPRESERVE);
rdatalist->ttl = 0;
/*
* No ENDS options in the default case.
@@ -1025,6 +1100,13 @@ client_addopt(ns_client_t *client) {
rdata->type = rdatalist->type;
rdata->flags = 0;
#ifdef DNS_OPT_NEWCODES
/*
* Set the attributes
*/
client_addoptattrs(client, rdata);
#endif /* DNS_OPT_NEWCODES */
ISC_LIST_INIT(rdatalist->rdata);
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
dns_rdatalist_tordataset(rdatalist, rdataset);
@@ -1034,6 +1116,80 @@ client_addopt(ns_client_t *client) {
return (ISC_R_SUCCESS);
}
#ifdef DNS_OPT_NEWCODES
static void
client_getoptattrs(ns_client_t *client, dns_rdataset_t *opt) {
dns_optlist_t optlist;
dns_optattr_t optattr;
isc_result_t result, iresult;
isc_buffer_t zonebuf;
dns_decompress_t dctx;
/* If an old set of opts are still around, free them. */
if (client->opt_zone != NULL) {
isc_mem_put(client->mctx, client->opt_zone,
sizeof(*client->opt_zone));
client->opt_zone = NULL;
}
if (client->opt_view != NULL)
isc_buffer_free(&client->opt_view);
/*
* If there are any options, extract them here
*/
optlist.size = 1;
optlist.used = 0;
optlist.next = 0;
optlist.attrs = &optattr;
do {
result = dns_opt_decodeall(&optlist, opt);
if (result == ISC_R_SUCCESS ||
result == DNS_R_MOREDATA) {
switch (optattr.code) {
case DNS_OPTCODE_ZONE:
dns_decompress_init(&dctx, 0,
DNS_DECOMPRESS_NONE);
client->opt_zone = isc_mem_get(
client->mctx,
sizeof(*client->opt_zone));
if (client->opt_zone == NULL)
goto zonefail1;
dns_fixedname_init(client->opt_zone);
isc_buffer_init(&zonebuf,
optattr.value.base,
optattr.value.length);
isc_buffer_add(&zonebuf,optattr.value.length);
isc_buffer_setactive(&zonebuf,
optattr.value.length);
iresult = dns_name_fromwire(
dns_fixedname_name(
client->opt_zone),
&zonebuf,
&dctx, ISC_FALSE,
NULL);
if (iresult != ISC_R_SUCCESS) {
dns_fixedname_invalidate(
client->opt_zone);
zonefail1:
dns_decompress_invalidate(&dctx);
}
break;
case DNS_OPTCODE_VIEW:
iresult = isc_buffer_allocate(client->mctx,
&client->opt_view,
optattr.value.length);
if (iresult != ISC_R_SUCCESS)
break;
isc_buffer_putmem(client->opt_view,
optattr.value.base,
optattr.value.length);
break;
}
}
} while (result == DNS_R_MOREDATA);
}
#endif /* DNS_OPT_NEWCODES */
static inline isc_boolean_t
allowed(isc_netaddr_t *addr, dns_acl_t *acl) {
int match;
@@ -1064,7 +1220,6 @@ client_request(isc_task_t *task, isc_event_t *event) {
dns_rdataset_t *opt;
isc_boolean_t ra; /* Recursion available. */
isc_netaddr_t netaddr;
isc_netaddr_t destaddr;
int match;
dns_messageid_t id;
unsigned int flags;
@@ -1249,10 +1404,28 @@ client_request(isc_task_t *task, isc_event_t *event) {
if (client->udpsize < 512)
client->udpsize = 512;
#ifdef DNS_OPT_NEWCODES
/*
* Get the flags out of the OPT record.
*/
client->extflags = DNS_OPT_FLAGS(opt);
/*
* Set up the rest of the opt stuff
*/
client_getoptattrs(client, opt);
/*
* If we're using a fixed zone option (opt_zone), set it to
* allow glue here.
*/
if (client->opt_zone != NULL)
client->query.dboptions |= DNS_DBFIND_GLUEOK;
#else /* DNS_OPT_NEWCODES */
/*
* Get the flags out of the OPT record.
*/
client->extflags = (isc_uint16_t)(opt->ttl & 0xFFFF);
#endif /* DNS_OPT_NEWCODES */
/*
* Create an OPT for our reply.
@@ -1285,20 +1458,6 @@ client_request(isc_task_t *task, isc_event_t *event) {
goto cleanup;
}
/*
* Determine the destination address. For IPv6, we get this from the
* pktinfo structure (if supported). For IPv4, we have to make do with
* the address of the interface where the request was received.
*/
if (client->interface->addr.type.sa.sa_family == AF_INET6) {
if ((client->attributes & NS_CLIENTATTR_PKTINFO) != 0)
isc_netaddr_fromin6(&destaddr, &client->pktinfo.ipi6_addr);
else
isc_netaddr_any6(&destaddr);
} else {
isc_netaddr_fromsockaddr(&destaddr, &client->interface->addr);
}
/*
* Find a view that matches the client's source address.
*/
@@ -1308,6 +1467,10 @@ client_request(isc_task_t *task, isc_event_t *event) {
if (client->message->rdclass == view->rdclass ||
client->message->rdclass == dns_rdataclass_any)
{
isc_netaddr_t destaddr;
isc_netaddr_fromsockaddr(&destaddr,
&client->interface->addr);
if (allowed(&netaddr, view->matchclients) &&
allowed(&destaddr, view->matchdestinations) &&
!((flags & DNS_MESSAGEFLAG_RD) == 0 &&
@@ -1492,6 +1655,9 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp)
if (result != ISC_R_SUCCESS)
goto cleanup_client;
isc_task_setname(client->task, "client", client);
result = isc_task_onshutdown(client->task, client_shutdown, client);
if (result != ISC_R_SUCCESS)
goto cleanup_task;
client->timer = NULL;
result = isc_timer_create(manager->timermgr, isc_timertype_inactive,
@@ -1544,7 +1710,6 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp)
client->nreads = 0;
client->nsends = 0;
client->nrecvs = 0;
client->nctls = 0;
client->references = 0;
client->attributes = 0;
client->view = NULL;
@@ -1557,6 +1722,10 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp)
client->opt = NULL;
client->udpsize = 512;
client->extflags = 0;
#ifdef DNS_OPT_NEWCODES
client->opt_zone = NULL;
client->opt_view = NULL;
#endif /* DNS_OPT_NEWCODES */
client->next = NULL;
client->shutdown = NULL;
client->shutdown_arg = NULL;
@@ -1588,19 +1757,12 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp)
if (result != ISC_R_SUCCESS)
goto cleanup_recvevent;
result = isc_task_onshutdown(client->task, client_shutdown, client);
if (result != ISC_R_SUCCESS)
goto cleanup_query;
CTRACE("create");
*clientp = client;
return (ISC_R_SUCCESS);
cleanup_query:
ns_query_free(client);
cleanup_recvevent:
isc_event_free((isc_event_t **)&client->recvevent);
@@ -2015,8 +2177,6 @@ ns_clientmgr_createclients(ns_clientmgr_t *manager, unsigned int n,
ISC_LIST_APPEND(manager->active, client, link);
client->list = &manager->active;
INSIST(client->nctls == 0);
client->nctls++;
ev = &client->ctlevent;
isc_task_send(client->task, &ev);
}
+7 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2001, 2002 Internet Software Consortium.
* Copyright (C) 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.11.2.3 2002/02/08 03:57:09 marka Exp $ */
/* $Id: config.c,v 1.11.2.1 2001/09/21 20:30:32 gson Exp $ */
#include <config.h>
@@ -419,6 +419,11 @@ ns_config_getport(cfg_obj_t *config, in_port_t *portp) {
isc_result_t result;
int i;
if (ns_g_port != 0) {
*portp = ns_g_port;
return (ISC_R_SUCCESS);
}
cfg_map_get(config, "options", &options);
i = 0;
if (options != NULL)
+3 -10
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: controlconf.c,v 1.28.2.7 2001/11/27 22:38:14 gson Exp $ */
/* $Id: controlconf.c,v 1.28.2.5 2001/10/19 22:29:08 bwelling Exp $ */
#include <config.h>
@@ -25,7 +25,6 @@
#include <isc/file.h>
#include <isc/fsaccess.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/random.h>
@@ -539,7 +538,6 @@ control_newconn(isc_task_t *task, isc_event_t *event) {
NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"rejected command channel message from %s",
socktext);
isc_socket_detach(&sock);
goto restart;
}
@@ -551,7 +549,6 @@ control_newconn(isc_task_t *task, isc_event_t *event) {
NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"dropped command channel from %s: %s",
socktext, isc_result_totext(result));
isc_socket_detach(&sock);
goto restart;
}
@@ -1171,17 +1168,13 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config,
isc_sockaddr_t addr;
if (i == 0) {
struct in_addr localhost;
if (isc_net_probeipv4() != ISC_R_SUCCESS)
continue;
localhost.s_addr = htonl(INADDR_LOOPBACK);
isc_sockaddr_fromin(&addr, &localhost, 0);
isc_sockaddr_any(&addr);
} else {
if (isc_net_probeipv6() != ISC_R_SUCCESS)
continue;
isc_sockaddr_fromin6(&addr,
&in6addr_loopback, 0);
isc_sockaddr_any6(&addr);
}
isc_sockaddr_setport(&addr, NS_CONTROL_PORT);
+16 -2
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: client.h,v 1.60.2.2 2001/11/15 02:51:46 marka Exp $ */
/* $Id: client.h,v 1.60 2001/08/28 03:57:59 marka Exp $ */
#ifndef NAMED_CLIENT_H
#define NAMED_CLIENT_H 1
@@ -72,6 +72,9 @@
#include <dns/types.h>
#include <dns/tcpmsg.h>
#include <dns/fixedname.h>
#ifdef DNS_OPT_NEWCODES
#include <dns/opt.h>
#endif /* DNS_OPT_NEWCODES */
#include <named/types.h>
#include <named/query.h>
@@ -91,7 +94,6 @@ struct ns_client {
int nreads;
int nsends;
int nrecvs;
int nctls;
int references;
unsigned int attributes;
isc_task_t * task;
@@ -112,6 +114,10 @@ struct ns_client {
dns_rdataset_t * opt;
isc_uint16_t udpsize;
isc_uint16_t extflags;
#ifdef DNS_OPT_NEWCODES
dns_fixedname_t * opt_zone;
isc_buffer_t * opt_view;
#endif /* DNS_OPT_NEWCODES */
void (*next)(ns_client_t *);
void (*shutdown)(void *arg, isc_result_t result);
void *shutdown_arg;
@@ -146,6 +152,14 @@ struct ns_client {
client_list_t *list;
};
#ifdef DNS_OPT_NEWCODES
/*
* Number of attr fields (opt_zone, opt_view) in above structure. Used in
* client_addoptattrs()
*/
#define CLIENT_NUMATTRS 2
#endif /* DNS_OPT_NEWCODES */
#define NS_CLIENT_MAGIC ISC_MAGIC('N','S','C','c')
#define NS_CLIENT_VALID(c) ISC_MAGIC_VALID(c, NS_CLIENT_MAGIC)
+2 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.h,v 1.28.2.3 2002/02/08 03:57:17 marka Exp $ */
/* $Id: query.h,v 1.28 2001/03/14 19:33:00 halley Exp $ */
#ifndef NAMED_QUERY_H
#define NAMED_QUERY_H 1
@@ -46,9 +46,6 @@ struct ns_query {
unsigned int fetchoptions;
dns_db_t * gluedb;
dns_db_t * authdb;
dns_zone_t * authzone;
isc_boolean_t authdbset;
isc_boolean_t isreferral;
dns_fetch_t * fetch;
dns_a6context_t a6ctx;
isc_bufferlist_t namebufs;
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: interfacemgr.c,v 1.59.2.5 2002/02/08 03:57:10 marka Exp $ */
/* $Id: interfacemgr.c,v 1.59.2.3 2001/10/22 17:42:05 gson Exp $ */
#include <config.h>
@@ -301,7 +301,7 @@ ns_interface_accepttcp(ns_interface_t *ifp) {
isc_result_totext(result));
goto tcp_bind_failure;
}
result = isc_socket_listen(ifp->tcpsocket, 3);
result = isc_socket_listen(ifp->tcpsocket, 0);
if (result != ISC_R_SUCCESS) {
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR,
"listening on TCP socket: %s",
+5 -7
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: log.c,v 1.33.2.1 2001/10/31 22:44:15 marka Exp $ */
/* $Id: log.c,v 1.33 2001/06/14 14:14:17 gson Exp $ */
#include <config.h>
@@ -168,12 +168,10 @@ isc_result_t
ns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
isc_result_t result;
if (! ns_g_logstderr) {
result = isc_log_usechannel(lcfg, "default_syslog",
ISC_LOGCATEGORY_DEFAULT, NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
}
result = isc_log_usechannel(lcfg, "default_syslog",
ISC_LOGCATEGORY_DEFAULT, NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
result = isc_log_usechannel(lcfg, "default_debug",
ISC_LOGCATEGORY_DEFAULT, NULL);
+134 -95
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.198.2.6 2002/02/08 03:57:12 marka Exp $ */
/* $Id: query.c,v 1.198 2001/08/27 17:20:09 gson Exp $ */
#include <config.h>
@@ -29,6 +29,9 @@
#include <dns/db.h>
#include <dns/events.h>
#include <dns/message.h>
#ifdef DNS_OPT_NEWCODES
#include <dns/opt.h>
#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
@@ -143,55 +146,20 @@ synth_rev_respond(ns_client_t *client, dns_byaddrevent_t *bevent);
* Increment query statistics counters.
*/
static inline void
inc_stats(ns_client_t *client, dns_statscounter_t counter) {
dns_zone_t *zone = client->query.authzone;
count_query(dns_zone_t *zone, isc_boolean_t is_zone,
dns_statscounter_t counter)
{
REQUIRE(counter < DNS_STATS_NCOUNTERS);
ns_g_server->querystats[counter]++;
if (zone != NULL) {
if (is_zone && zone != NULL) {
isc_uint64_t *zonestats = dns_zone_getstatscounters(zone);
if (zonestats != NULL)
zonestats[counter]++;
}
}
static void
query_send(ns_client_t *client) {
dns_statscounter_t counter;
if (client->message->rcode == dns_rcode_noerror) {
if (ISC_LIST_EMPTY(client->message->sections[DNS_SECTION_ANSWER])) {
if (client->query.isreferral) {
counter = dns_statscounter_referral;
} else {
counter = dns_statscounter_nxrrset;
}
} else {
counter = dns_statscounter_success;
}
} else if (client->message->rcode == dns_rcode_nxdomain) {
counter = dns_statscounter_nxdomain;
} else {
/* We end up here in case of YXDOMAIN, and maybe others */
counter = dns_statscounter_failure;
}
inc_stats(client, counter);
ns_client_send(client);
}
static void
query_error(ns_client_t *client, isc_result_t result) {
inc_stats(client, dns_statscounter_failure);
ns_client_error(client, result);
}
static void
query_next(ns_client_t *client, isc_result_t result) {
inc_stats(client, dns_statscounter_failure);
ns_client_next(client, result);
}
static inline void
query_maybeputqname(ns_client_t *client) {
if (client->query.restarts > 0) {
@@ -240,8 +208,6 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
if (client->query.authdb != NULL)
dns_db_detach(&client->query.authdb);
if (client->query.authzone != NULL)
dns_zone_detach(&client->query.authzone);
/*
* Clean up free versions.
@@ -283,12 +249,11 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
client->query.dboptions = 0;
client->query.fetchoptions = 0;
client->query.gluedb = NULL;
client->query.authdbset = ISC_FALSE;
client->query.isreferral = ISC_FALSE;
client->query.authdb = NULL;
}
static void
query_next_callback(ns_client_t *client) {
query_next(ns_client_t *client) {
query_reset(client, ISC_FALSE);
}
@@ -511,9 +476,6 @@ ns_query_init(ns_client_t *client) {
client->query.qname = NULL;
client->query.fetch = NULL;
client->query.authdb = NULL;
client->query.authzone = NULL;
client->query.authdbset = ISC_FALSE;
client->query.isreferral = ISC_FALSE;
query_reset(client, ISC_FALSE);
result = query_newdbversion(client, 3);
if (result != ISC_R_SUCCESS)
@@ -591,15 +553,25 @@ query_getzonedb(ns_client_t *client, dns_name_t *name, unsigned int options,
goto fail;
/*
* If this is the first time we are called (that is, looking up
* the actual name in the query section) remember this database.
*
* If authdb is non-NULL, we have been here before, and the
* found database is always returned.
*
* This limits our searching to the zone where the first name
* (the query target) was looked for. This prevents following
* CNAMES or DNAMES into other zones and prevents returning
* additional data from other zones.
* (the query target) is found. This prevents following CNAMES
* or DNAMES into other zones and prevents returning additional
* data from other zones.
*/
if (!client->view->additionalfromauth &&
client->query.authdbset &&
db != client->query.authdb)
goto refuse;
if (!client->view->additionalfromauth) {
if (client->query.authdb != NULL) {
if (db != client->query.authdb)
goto refuse;
} else {
dns_db_attach(db, &client->query.authdb);
}
}
/*
* If the zone has an ACL, we'll check it, otherwise
@@ -817,6 +789,25 @@ query_getdb(ns_client_t *client, dns_name_t *name, unsigned int options,
{
isc_result_t result;
#ifdef DNS_OPT_NEWCODES_LIVE
if (client->opt_zone != NULL) {
result = query_getzonedb(client, &(client->opt_zone->name),
options, zonep, dbp, versionp);
if (result == ISC_R_SUCCESS)
*is_zonep = ISC_TRUE;
else
result = DNS_R_REFUSED;
} else {
result = query_getzonedb(client, name, options, zonep, dbp,
versionp);
if (result == ISC_R_SUCCESS) {
*is_zonep = ISC_TRUE;
} else if (result == ISC_R_NOTFOUND) {
result = query_getcachedb(client, dbp, options);
*is_zonep = ISC_FALSE;
}
}
#else /* DNS_OPT_NEWCODES_LIVE */
result = query_getzonedb(client, name, options, zonep, dbp, versionp);
if (result == ISC_R_SUCCESS) {
*is_zonep = ISC_TRUE;
@@ -824,6 +815,7 @@ query_getdb(ns_client_t *client, dns_name_t *name, unsigned int options,
result = query_getcachedb(client, dbp, options);
*is_zonep = ISC_FALSE;
}
#endif /* DNS_OPT_NEWCODES_LIVE */
return (result);
}
@@ -878,6 +870,7 @@ query_simplefind(void *arg, dns_name_t *name, dns_rdatatype_t type,
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
if (is_zone) {
count_query(zone, is_zone, dns_statscounter_referral);
if (USECACHE(client)) {
/*
* Either the answer is in the cache, or we
@@ -942,8 +935,11 @@ query_simplefind(void *arg, dns_name_t *name, dns_rdatatype_t type,
}
/*
* If we get here, the result is ISC_R_SUCCESS, and we found the
* answer we were looking for in the zone.
* answer we were looking for in the zone. Update the zone's
* query counter.
*/
if (result == ISC_R_SUCCESS)
count_query(zone, is_zone, dns_statscounter_success);
cleanup:
if (dns_rdataset_isassociated(&zrdataset)) {
@@ -2068,7 +2064,7 @@ query_resume(isc_task_t *task, isc_event_t *event) {
if (devent->sigrdataset != NULL)
query_putrdataset(client, &devent->sigrdataset);
isc_event_free(&event);
query_next(client, ISC_R_CANCELED);
ns_client_next(client, ISC_R_CANCELED);
/*
* This may destroy the client.
*/
@@ -2085,23 +2081,18 @@ query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qdomain,
isc_result_t result;
dns_rdataset_t *rdataset, *sigrdataset;
inc_stats(client, dns_statscounter_recursion);
/*
* We are about to recurse, which means that this client will
* be unavailable for serving new requests for an indeterminate
* amount of time. If this client is currently responsible
* for handling incoming queries, set up a new client
* object to handle them while we are waiting for a
* response. There is no need to replace TCP clients
* because those have already been replaced when the
* connection was accepted (if allowed by the TCP quota).
* response.
*/
if (! client->mortal) {
result = isc_quota_attach(&ns_g_server->recursionquota,
&client->recursionquota);
if (result == ISC_R_SUCCESS &&
(client->attributes & NS_CLIENTATTR_TCP) == 0)
if (result == ISC_R_SUCCESS)
result = ns_client_replace(client);
if (result != ISC_R_SUCCESS) {
ns_client_log(client, NS_LOGCATEGORY_CLIENT,
@@ -2417,17 +2408,20 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
dbuf = query_getnamebuf(client);
if (dbuf == NULL) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
fname = query_newname(client, dbuf, &b);
if (fname == NULL) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
tname = dns_fixedname_name(&event->foundname);
result = dns_name_copy(tname, fname, NULL);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -2461,6 +2455,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
result = query_getdb(client, client->query.qname, 0, &zone, &db,
&version, &is_zone);
if (result != ISC_R_SUCCESS) {
count_query(NULL, ISC_FALSE, dns_statscounter_failure);
if (result == DNS_R_REFUSED)
QUERY_ERROR(DNS_R_REFUSED);
else
@@ -2470,14 +2465,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
if (is_zone)
authoritative = ISC_TRUE;
if (event == NULL && client->query.restarts == 0) {
if (is_zone) {
dns_zone_attach(zone, &client->query.authzone);
dns_db_attach(db, &client->query.authdb);
}
client->query.authdbset = ISC_TRUE;
}
db_find:
CTRACE("query_find: db_find");
@@ -2486,18 +2473,21 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
dbuf = query_getnamebuf(client);
if (dbuf == NULL) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
fname = query_newname(client, dbuf, &b);
rdataset = query_newrdataset(client);
if (fname == NULL || rdataset == NULL) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
if (WANTDNSSEC(client)) {
sigrdataset = query_newrdataset(client);
if (sigrdataset == NULL) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -2554,6 +2544,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
result = dns_name_copy(client->query.qname,
fname, NULL);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone,
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -2571,11 +2563,17 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
CTRACE("query_find: resume");
switch (result) {
case ISC_R_SUCCESS:
count_query(zone, is_zone, dns_statscounter_success);
/*
* This case is handled in the main line below.
*/
break;
case DNS_R_GLUE:
#ifdef DNS_OPT_NEWCODES_LIVE
if (client->opt_zone != NULL)
break;
/* Fallthrough if we don't have opt_zone */
#endif /* DNS_OPT_NEWCODES_LIVE */
case DNS_R_ZONECUT:
/*
* These cases are handled in the main line below.
@@ -2584,6 +2582,13 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
authoritative = ISC_FALSE;
break;
case ISC_R_NOTFOUND:
#ifdef DNS_OPT_NEWCODES_LIVE
/*
* If we've passed in opt_zone, don't try anything more.
*/
if (client->opt_zone != NULL)
break;
#endif /* DNS_OPT_NEWCODES_LIVE */
/*
* The cache doesn't even have the root NS. Get them from
* the hints DB.
@@ -2620,6 +2625,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
* recurse anyway.
*/
if (RECURSIONOK(client)) {
count_query(zone, is_zone,
dns_statscounter_recursion);
result = query_recurse(client, qtype,
NULL, NULL);
if (result == ISC_R_SUCCESS)
@@ -2627,11 +2634,15 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
NS_QUERYATTR_RECURSING;
else {
/* Unable to recurse. */
count_query(zone, is_zone,
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
}
goto cleanup;
} else {
/* Unable to give root server referral. */
count_query(zone, is_zone,
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -2641,6 +2652,14 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
/* FALLTHROUGH */
case DNS_R_DELEGATION:
#ifdef DNS_OPT_NEWCODES_LIVE
/*
* If we've passed in opt_zone, don't try anything more.
*/
if (client->opt_zone != NULL) {
break;
}
#endif /* DNS_OPT_NEWCODES_LIVE */
authoritative = ISC_FALSE;
if (is_zone) {
/*
@@ -2663,7 +2682,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
* database by setting client->query.gluedb.
*/
client->query.gluedb = db;
client->query.isreferral = ISC_TRUE;
/*
* We must ensure NOADDITIONAL is off,
* because the generation of
@@ -2676,9 +2694,9 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
sigrdatasetp = &sigrdataset;
else
sigrdatasetp = NULL;
query_addrrset(client, &fname,
&rdataset, sigrdatasetp,
dbuf, DNS_SECTION_AUTHORITY);
query_addrrset(client, &fname, &rdataset,
sigrdatasetp, dbuf,
DNS_SECTION_AUTHORITY);
client->query.gluedb = NULL;
} else {
/*
@@ -2739,6 +2757,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
/*
* Recurse!
*/
count_query(zone, is_zone,
dns_statscounter_recursion);
if (type == dns_rdatatype_key)
result = query_recurse(client, qtype,
NULL, NULL);
@@ -2748,16 +2768,20 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
if (result == ISC_R_SUCCESS)
client->query.attributes |=
NS_QUERYATTR_RECURSING;
else
else {
count_query(zone, is_zone,
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
}
} else {
/*
* This is the best answer.
*/
count_query(zone, is_zone,
dns_statscounter_referral);
client->query.gluedb = zdb;
client->query.attributes |=
NS_QUERYATTR_CACHEGLUEOK;
client->query.gluedb = zdb;
client->query.isreferral = ISC_TRUE;
/*
* We must ensure NOADDITIONAL is off,
* because the generation of
@@ -2781,6 +2805,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
goto cleanup;
case DNS_R_NXRRSET:
INSIST(is_zone);
count_query(zone, is_zone, dns_statscounter_nxrrset);
if (dns_rdataset_isassociated(rdataset)) {
/*
* If we've got a NXT record, we need to save the
@@ -2801,6 +2826,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
result = query_addsoa(client, db, ISC_FALSE);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(result);
goto cleanup;
}
@@ -2816,6 +2842,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
goto cleanup;
case DNS_R_NXDOMAIN:
INSIST(is_zone);
count_query(zone, is_zone, dns_statscounter_nxdomain);
if (dns_rdataset_isassociated(rdataset)) {
/*
* If we've got a NXT record, we need to save the
@@ -2842,6 +2869,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
else
result = query_addsoa(client, db, ISC_FALSE);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(result);
goto cleanup;
}
@@ -2860,8 +2888,13 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
client->message->rcode = dns_rcode_nxdomain;
goto cleanup;
case DNS_R_NCACHENXDOMAIN:
INSIST(!is_zone);
count_query(NULL, is_zone, dns_statscounter_nxdomain);
goto ncachenxrrset;
case DNS_R_NCACHENXRRSET:
INSIST(!is_zone);
count_query(NULL, is_zone, dns_statscounter_nxrrset);
ncachenxrrset:
authoritative = ISC_FALSE;
/*
* Set message rcode, if required.
@@ -3034,7 +3067,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
dns_name_init(tname, NULL);
query_addcnamelike(client, client->query.qname, fname,
0, &tname, dns_rdatatype_cname);
trdataset->ttl, &tname,
dns_rdatatype_cname);
if (tname != NULL)
dns_message_puttempname(client->message, &tname);
/*
@@ -3049,6 +3083,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
/*
* Something has gone wrong.
*/
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -3062,6 +3097,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
rdsiter = NULL;
result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -3137,11 +3173,14 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
/*
* Something went wrong.
*/
count_query(zone, is_zone,
dns_statscounter_failure);
result = DNS_R_SERVFAIL;
}
}
dns_rdatasetiter_destroy(&rdsiter);
if (result != ISC_R_NOMORE) {
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -3237,7 +3276,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
* or if the client requested recursion and thus wanted
* the complete answer, send an error response.
*/
query_error(client, eresult);
ns_client_error(client, eresult);
ns_client_detach(&client);
} else if (!RECURSING(client)) {
/*
@@ -3252,7 +3291,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
client->view->auth_nxdomain == ISC_TRUE)
client->message->flags |= DNS_MESSAGEFLAG_AA;
query_send(client);
ns_client_send(client);
ns_client_detach(&client);
}
CTRACE("query_find: done");
@@ -3292,7 +3331,7 @@ ns_query_start(ns_client_t *client) {
/*
* Ensure that appropriate cleanups occur.
*/
client->next = query_next_callback;
client->next = query_next;
if ((message->flags & DNS_MESSAGEFLAG_RD) != 0)
client->query.attributes |= NS_QUERYATTR_WANTRECURSION;
@@ -3329,7 +3368,7 @@ ns_query_start(ns_client_t *client) {
*/
result = dns_message_firstname(message, DNS_SECTION_QUESTION);
if (result != ISC_R_SUCCESS) {
query_error(client, result);
ns_client_error(client, result);
return;
}
dns_message_currentname(message, DNS_SECTION_QUESTION,
@@ -3342,9 +3381,9 @@ ns_query_start(ns_client_t *client) {
* There's more than one QNAME in the question
* section.
*/
query_error(client, DNS_R_FORMERR);
ns_client_error(client, DNS_R_FORMERR);
} else
query_error(client, result);
ns_client_error(client, result);
return;
}
@@ -3355,7 +3394,7 @@ ns_query_start(ns_client_t *client) {
* Check for multiple question queries, since edns1 is dead.
*/
if (message->counts[DNS_SECTION_QUESTION] > 1) {
query_error(client, DNS_R_FORMERR);
ns_client_error(client, DNS_R_FORMERR);
return;
}
@@ -3375,19 +3414,19 @@ ns_query_start(ns_client_t *client) {
return;
case dns_rdatatype_maila:
case dns_rdatatype_mailb:
query_error(client, DNS_R_NOTIMP);
ns_client_error(client, DNS_R_NOTIMP);
return;
case dns_rdatatype_tkey:
result = dns_tkey_processquery(client->message,
ns_g_server->tkeyctx,
client->view->dynamickeys);
if (result == ISC_R_SUCCESS)
query_send(client);
ns_client_send(client);
else
query_error(client, result);
ns_client_error(client, result);
return;
default: /* TSIG, etc. */
query_error(client, DNS_R_FORMERR);
ns_client_error(client, DNS_R_FORMERR);
return;
}
}
@@ -3409,7 +3448,7 @@ ns_query_start(ns_client_t *client) {
*/
result = dns_message_reply(message, ISC_TRUE);
if (result != ISC_R_SUCCESS) {
query_next(client, result);
ns_client_next(client, result);
return;
}
@@ -3678,9 +3717,9 @@ synth_fwd_respond(ns_client_t *client, dns_adbfind_t *find) {
static void
synth_finish(ns_client_t *client, isc_result_t result) {
if (result == ISC_R_SUCCESS)
query_send(client);
ns_client_send(client);
else
query_error(client, result);
ns_client_error(client, result);
ns_client_detach(&client);
}
+9 -19
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.339.2.4 2002/02/08 03:57:13 marka Exp $ */
/* $Id: server.c,v 1.339.2.1 2001/09/28 05:35:47 marka Exp $ */
#include <config.h>
@@ -1088,10 +1088,7 @@ configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin,
/*
* Determine which port to send forwarded requests to.
*/
if (ns_g_lwresdonly && ns_g_port != 0)
port = ns_g_port;
else
CHECKM(ns_config_getport(config, &port), "port");
CHECKM(ns_config_getport(config, &port), "port");
if (forwarders != NULL) {
portobj = cfg_tuple_get(forwarders, "port");
@@ -1730,10 +1727,7 @@ load_configuration(const char *filename, ns_server_t *server,
/*
* Determine which port to use for listening for incoming connections.
*/
if (ns_g_port != 0)
listen_port = ns_g_port;
else
CHECKM(ns_config_getport(config, &listen_port), "port");
CHECKM(ns_config_getport(config, &listen_port), "port");
/*
* Configure the interface manager according to the "listen-on"
@@ -2677,13 +2671,9 @@ ns_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config,
portobj = cfg_tuple_get(listener, "port");
if (!cfg_obj_isuint32(portobj)) {
if (ns_g_port != 0) {
port = ns_g_port;
} else {
result = ns_config_getport(config, &port);
if (result != ISC_R_SUCCESS)
return (result);
}
result = ns_config_getport(config, &port);
if (result != ISC_R_SUCCESS)
return (result);
} else {
if (cfg_obj_asuint32(portobj) >= ISC_UINT16_MAX) {
cfg_obj_log(portobj, ns_g_lctx, ISC_LOG_ERROR,
@@ -2861,7 +2851,7 @@ ns_server_flushcache(ns_server_t *server, char *args) {
isc_result_t
ns_server_status(ns_server_t *server, isc_buffer_t *text) {
int zonecount, xferrunning, xferdeferred, soaqueries;
unsigned int n;
int n;
zonecount = dns_zonemgr_getcount(server->zonemgr, DNS_ZONESTATE_ANY);
xferrunning = dns_zonemgr_getcount(server->zonemgr,
@@ -2881,7 +2871,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) {
"server is up and running",
zonecount, ns_g_debuglevel, xferrunning, xferdeferred,
soaqueries, server->log_queries ? "ON" : "OFF");
if (n >= isc_buffer_availablelength(text))
if (n < 0)
return (ISC_R_NOSPACE);
isc_buffer_add(text, n);
return (ISC_R_SUCCESS);
+8 -13
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1999-2002 Internet Software Consortium.
* Copyright (C) 1999-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: update.c,v 1.88.2.3 2002/02/08 03:57:15 marka Exp $ */
/* $Id: update.c,v 1.88 2001/05/31 10:37:58 tale Exp $ */
#include <config.h>
@@ -151,10 +151,6 @@ static void forward_done(isc_task_t *task, isc_event_t *event);
/**************************************************************************/
static void
update_log(ns_client_t *client, dns_zone_t *zone,
int level, const char *fmt, ...) ISC_FORMAT_PRINTF(4, 5);
static void
update_log(ns_client_t *client, dns_zone_t *zone,
int level, const char *fmt, ...)
@@ -1417,7 +1413,6 @@ next_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *oldname,
/*
* Add a NXT record for "name", recording the change in "diff".
* The existing NXT is removed.
*/
static isc_result_t
add_nxt(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_diff_t *diff)
@@ -1433,6 +1428,7 @@ add_nxt(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_diff_t *diff)
dns_fixedname_init(&fixedname);
target = dns_fixedname_name(&fixedname);
/*
* Find the successor name, aka NXT target.
*/
@@ -1447,12 +1443,7 @@ add_nxt(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_diff_t *diff)
dns_db_detachnode(db, &node);
/*
* Delete the old NXT and record the change.
*/
CHECK(delete_if(true_p, db, ver, name, dns_rdatatype_nxt, 0,
NULL, diff));
/*
* Add the new NXT and record the change.
* Create a diff tuple, update the database, and record the change.
*/
CHECK(dns_difftuple_create(diff->mctx, DNS_DIFFOP_ADD, name,
3600, /* XXXRTH */
@@ -1803,6 +1794,9 @@ update_signatures(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *oldver,
* there is other data, and if there is other data,
* there are other SIGs.
*/
CHECK(delete_if(true_p, db, newver, &t->name,
dns_rdatatype_nxt, 0,
NULL, &nxt_diff));
CHECK(add_nxt(db, newver, &t->name, &nxt_diff));
}
}
@@ -2413,6 +2407,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
}
if (dns_db_issecure(db)) {
result = update_signatures(mctx, db, oldver, ver,
&diff, dns_zone_getsigvalidityinterval(zone));
if (result != ISC_R_SUCCESS) {
+2 -2
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: xfrout.c,v 1.101.2.3 2001/10/30 01:28:29 marka Exp $ */
/* $Id: xfrout.c,v 1.101.2.2 2001/09/28 22:07:12 bwelling Exp $ */
#include <config.h>
@@ -1093,7 +1093,6 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
ISC_LOG_DEBUG(4),
"IXFR version not in journal, "
"falling back to AXFR");
mnemonic = "AXFR-style IXFR";
goto axfr_fallback;
}
CHECK(result);
@@ -1101,6 +1100,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
axfr_fallback:
CHECK(axfr_rrstream_create(mctx, db, ver,
&data_stream));
mnemonic = "AXFR-style IXFR";
}
/*
+3 -3
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.87.2.4 2001/11/13 01:15:33 gson Exp $ */
/* $Id: zoneconf.c,v 1.87.2.3 2001/10/18 00:35:20 marka Exp $ */
#include <config.h>
@@ -482,7 +482,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
*/
if (ztype == dns_zone_master) {
dns_acl_t *updateacl;
RETERR(configure_zone_acl(zconfig, vconfig, config,
RETERR(configure_zone_acl(zconfig, NULL, config,
"allow-update", ac, zone,
dns_zone_setupdateacl,
dns_zone_clearupdateacl));
@@ -503,7 +503,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
dns_zone_setsigvalidityinterval(zone,
cfg_obj_asuint32(obj) * 86400);
} else if (ztype == dns_zone_slave) {
RETERR(configure_zone_acl(zconfig, vconfig, config,
RETERR(configure_zone_acl(zconfig, NULL, config,
"allow-update-forwarding", ac, zone,
dns_zone_setforwardacl,
dns_zone_clearforwardacl));
+1 -1
View File
@@ -296,7 +296,7 @@ The newly-added record has a 1 day TTL (86400 seconds)
.nf
# nsupdate
> prereq nxdomain nickname.example.com
> update add nickname.example.com 86400 CNAME somehost.example.com
> update add nickname.example.com CNAME somehost.example.com
>
.sp
.fi
+13 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2000-2002 Internet Software Consortium.
* Copyright (C) 2000, 2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsupdate.c,v 1.103.2.9 2002/02/08 03:57:18 marka Exp $ */
/* $Id: nsupdate.c,v 1.103.2.4 2001/10/15 20:25:57 gson Exp $ */
#include <config.h>
@@ -1089,7 +1089,6 @@ evaluate_zone(char *cmdline) {
result = dns_name_fromtext(userzone, &b, dns_rootname, ISC_FALSE,
NULL);
if (result != ISC_R_SUCCESS) {
userzone = NULL; /* Lest it point to an invalid name */
fprintf(stderr, "could not parse zone name\n");
return (STATUS_SYNTAX);
}
@@ -1101,7 +1100,7 @@ static isc_uint16_t
update_addordelete(char *cmdline, isc_boolean_t isdelete) {
isc_result_t result;
dns_name_t *name = NULL;
unsigned long ttl;
long ttl;
char *word;
dns_rdataclass_t rdataclass;
dns_rdatatype_t rdatatype;
@@ -1147,20 +1146,26 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
goto doneparsing;
}
}
ttl = strtoul(word, &endp, 10);
if (!isdigit((unsigned char)*word) || *endp != '\0') {
ttl = strtol(word, &endp, 0);
if (*endp != '\0') {
if (isdelete) {
ttl = 0;
goto parseclass;
} else {
fprintf(stderr, "ttl '%s' is not legal\n", word);
fprintf(stderr, "ttl '%s' is not numeric\n", word);
goto failure;
}
}
if (isdelete)
ttl = 0;
else if (ttl > TTL_MAX) {
else if (ttl < 0 || ttl > TTL_MAX || errno == ERANGE) {
/*
* The errno test is needed to catch when strtol()
* overflows on a platform where sizeof(int) ==
* sizeof(long), because ttl will be set to LONG_MAX,
* which will be equal to TTL_MAX.
*/
fprintf(stderr, "ttl '%s' is out of range (0 to %d)\n",
word, TTL_MAX);
goto failure;
+2 -2
View File
@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: nsupdate.docbook,v 1.8.2.1 2001/11/27 18:57:40 gson Exp $ -->
<!-- $Id: nsupdate.docbook,v 1.8 2001/07/14 18:30:01 bwelling Exp $ -->
<refentry>
<refentryinfo>
@@ -463,7 +463,7 @@ The newly-added record has a 1 day TTL (86400 seconds)
<programlisting>
# nsupdate
> prereq nxdomain nickname.example.com
> update add nickname.example.com 86400 CNAME somehost.example.com
> update add nickname.example.com CNAME somehost.example.com
>
</programlisting>
</para>
+1 -1
View File
@@ -801,7 +801,7 @@ The newly-added record has a 1 day TTL (86400 seconds)
CLASS="PROGRAMLISTING"
># nsupdate
&#62; prereq nxdomain nickname.example.com
&#62; update add nickname.example.com 86400 CNAME somehost.example.com
&#62; update add nickname.example.com CNAME somehost.example.com
&#62;</PRE
></P
><P
+2 -3
View File
@@ -1,4 +1,5 @@
.\" Copyright (C) 2001 Internet Software Consortium.
.\"
.\" Copyright (C) 2000, 2001 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,8 +14,6 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: rndc-confgen.8,v 1.3.2.1 2002/02/08 03:57:20 marka Exp $
.TH "RNDC-CONFGEN" "8" "Aug 27, 2001" "BIND9" ""
.SH NAME
rndc-confgen \- rndc key generation tool
+7 -9
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rndc-confgen.c,v 1.9.2.4 2001/11/30 01:10:09 gson Exp $ */
/* $Id: rndc-confgen.c,v 1.9.2.1 2001/09/06 00:14:16 gson Exp $ */
#include <config.h>
@@ -66,7 +66,7 @@ Usage:\n\
[-s addr] [-t chrootdir] [-u user]\n\
-a: generate just the key clause and write it to keyfile (%s)\n\
-b bits: from 1 through 512, default %d; total length of the secret\n\
-c keyfile: specify an alternate key file (requires -a)\n\
-c keyfile: specify a alterate keyfile (requires -a)\n\
-k keyname: the name as it will be used in named.conf and rndc.conf\n\
-p port: the port named will listen on and rndc will connect to\n\
-r randomfile: a file containing random data\n\
@@ -139,8 +139,7 @@ main(int argc, char **argv) {
int keysize;
int entropy_flags = 0;
int open_keyboard = ISC_ENTROPY_KEYBOARDMAYBE;
struct in_addr addr4_dummy;
struct in6_addr addr6_dummy;
struct in_addr addr;
char *chrootdir = NULL;
char *user = NULL;
isc_boolean_t keyonly = ISC_FALSE;
@@ -198,9 +197,9 @@ main(int argc, char **argv) {
break;
case 's':
serveraddr = isc_commandline_argument;
if (inet_pton(AF_INET, serveraddr, &addr4_dummy) != 1 &&
inet_pton(AF_INET6, serveraddr, &addr6_dummy) != 1)
if (inet_aton(serveraddr, &addr) == 0)
fatal("-s should be an IPv4 or IPv6 address");
break;
case 't':
chrootdir = isc_commandline_argument;
@@ -280,9 +279,8 @@ main(int argc, char **argv) {
char *buf;
len = strlen(chrootdir) + strlen(keyfile) + 2;
buf = isc_mem_get(mctx, len);
if (buf == NULL) {
fprintf(stderr, "isc_mem_get(%d) failed\n",
len);
if (buf != NULL) {
fprintf(stderr, "isc_mem_get(%d) failed\n", len);
goto cleanup;
}
snprintf(buf, len, "%s/%s", chrootdir, keyfile);
+3 -6
View File
@@ -1,10 +1,10 @@
<!--
- Copyright (C) 2001 Internet Software Consortium.
-
- Copyright (C) 2000, 2001 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
- copyright notice and this permission notice appear in all copies.
-
-
- THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
@@ -14,9 +14,6 @@
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: rndc-confgen.html,v 1.3.2.1 2002/02/08 03:57:21 marka Exp $ -->
<HTML
><HEAD
><TITLE
+2 -3
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rndc.c,v 1.77.2.2 2001/11/28 23:37:50 gson Exp $ */
/* $Id: rndc.c,v 1.77.2.1 2001/10/17 18:26:01 gson Exp $ */
/*
* Principal Author: DCL
@@ -89,8 +89,7 @@ static isc_socket_t *sock = NULL;
static void
usage(int status) {
fprintf(stderr, "\
Usage: %s [-c config] [-s server] [-p port]\n\
[-k key-file ] [-y key] [-V] command\n\
Usage: %s [-c config] [-s server] [-p port] [-y key] [-V] command\n\
\n\
command is one of the following:\n\
\n\
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1998-2002 Internet Software Consortium.
* Copyright (C) 1998-2001 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
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: printmsg.c,v 1.25.2.2 2002/02/08 03:57:23 marka Exp $ */
/* $Id: printmsg.c,v 1.25 2001/05/09 18:47:49 bwelling Exp $ */
#include <config.h>
@@ -51,7 +51,7 @@ static const char *rcodetext[] = {
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"NOTIMPL",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
+3 -3
View File
@@ -15,7 +15,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# $Id: ifconfig.sh,v 1.35.2.1 2001/11/05 04:29:35 marka Exp $
# $Id: ifconfig.sh,v 1.35 2001/06/14 14:10:32 gson Exp $
#
# Set up interface aliases for bind9 system tests.
@@ -62,7 +62,7 @@ case "$1" in
*-sgi-irix6.*)
ifconfig lo0 alias 10.53.0.$ns
;;
*-*-sysv5uw[7-8]*)
*-*-sysv5uw7*)
ifconfig lo0 10.53.0.$ns alias netmask 0xffffffff
;;
*-ibm-aix4.*)
@@ -107,7 +107,7 @@ case "$1" in
*-sgi-irix6.*)
ifconfig lo0 -alias 10.53.0.$ns
;;
*-*-sysv5uw[7-8]*)
*-*-sysv5uw7*)
ifconfig lo0 -alias 10.53.0.$ns
;;
*-ibm-aix4.*)
Vendored
+393 -378
View File
File diff suppressed because it is too large Load Diff
+10 -33
View File
@@ -13,7 +13,12 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_REVISION($Revision: 1.294.2.7 $)
dnl
AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.294.2.3 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
@@ -1014,7 +1019,7 @@ $isc_netinetin6_hack
$isc_netinet6in6_hack
$isc_in_addr6_hack
],
[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
[struct in6_addr in6; in6 = in6addr_any; return (0);],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
@@ -1022,23 +1027,6 @@ $isc_in_addr6_hack
ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
AC_MSG_CHECKING(for in6addr_loopback)
AC_TRY_LINK([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
$isc_in_addr6_hack
],
[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
[AC_MSG_RESULT(no)
ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -1092,8 +1080,6 @@ AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
AC_SUBST(ISC_IPV6_H)
@@ -1348,18 +1334,9 @@ found_rt_iflist
#
# Check for some other useful functions that are not ever-present.
#
# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
# reportedly defines strsep() without declaring it in <string.h> when
# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
# AC_CHECK_FUNC() incorrectly succeeds because it declares
# the function itself.
AC_MSG_CHECKING(for correctly declared strsep())
AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
AC_CHECK_FUNC(strsep,
[ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
[ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
AC_CHECK_FUNC(vsnprintf,
[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
-200
View File
@@ -1,200 +0,0 @@
# $Id: DISTFILES,v 1.1 2002/02/08 05:38:30 marka Exp $
README
README.ja
INSTALL
INSTALL.ja
ChangeLog
DISTFILES
LICENSE.txt
Makefile.in
NEWS
make.wnt
acconfig.h
aclocal.m4
config.guess
config.sub
ltconfig
ltmain.sh
configure.in
configure
install-sh
mkinstalldirs
include/Makefile.in
include/config.h.in
include/config.h.win
include/mdn/Makefile.in
include/mdn/ace.h
include/mdn/altdude.h
include/mdn/amcacem.h
include/mdn/amcaceo.h
include/mdn/amcacer.h
include/mdn/amcacev.h
include/mdn/amcacew.h
include/mdn/amcacez.h
include/mdn/api.h
include/mdn/assert.h
include/mdn/brace.h
include/mdn/checker.h
include/mdn/converter.h
include/mdn/debug.h
include/mdn/delimitermap.h
include/mdn/dn.h
include/mdn/dude.h
include/mdn/filechecker.h
include/mdn/filemapper.h
include/mdn/lace.h
include/mdn/localencoding.h
include/mdn/log.h
include/mdn/logmacro.h
include/mdn/mace.h
include/mdn/mapper.h
include/mdn/mapselector.h
include/mdn/msgheader.h
include/mdn/msgtrans.h
include/mdn/nameprep.h
include/mdn/normalizer.h
include/mdn/race.h
include/mdn/res.h
include/mdn/resconf.h
include/mdn/result.h
include/mdn/selectiveencode.h
include/mdn/strhash.h
include/mdn/ucsmap.h
include/mdn/ucsset.h
include/mdn/unicode.h
include/mdn/unormalize.h
include/mdn/utf5.h
include/mdn/utf6.h
include/mdn/utf8.h
include/mdn/util.h
include/mdn/version.h
lib/Makefile.in
lib/ace.c
lib/altdude.c
lib/amcacem.c
lib/amcaceo.c
lib/amcacer.c
lib/amcacev.c
lib/amcacew.c
lib/amcacez.c
lib/api.c
lib/brace.c
lib/checker.c
lib/converter.c
lib/debug.c
lib/delimitermap.c
lib/dn.c
lib/dude.c
lib/filechecker.c
lib/filemapper.c
lib/lace.c
lib/localencoding.c
lib/log.c
lib/make.wnt
lib/mace.c
lib/mapper.c
lib/mapselector.c
lib/msgheader.c
lib/msgtrans.c
lib/nameprep.c
lib/nameprep_template.c
lib/nameprepdata.c
lib/normalizer.c
lib/race.c
lib/res.c
lib/resconf.c
lib/result.c
lib/selectiveencode.c
lib/strhash.c
lib/ucsmap.c
lib/ucsset.c
lib/unicode.c
lib/unicode_template.c
lib/unicodedata_301.c
lib/unicodedata_310.c
lib/unormalize.c
lib/utf5.c
lib/utf6.c
lib/utf8.c
lib/util.c
lib/version.c
lib/mdn.conf.sample.in
mdnsproxy/Makefile.in
mdnsproxy/acl.c
mdnsproxy/logging.c
mdnsproxy/make.wnt
mdnsproxy/mdnsproxy.8.in
mdnsproxy/mdnsproxy.conf.sample
mdnsproxy/mdnsproxy.def
mdnsproxy/mdnsproxy.h
mdnsproxy/message.c
mdnsproxy/os2main.c
mdnsproxy/proxycnf.c
mdnsproxy/proxycnf.h
mdnsproxy/server.c
mdnsproxy/translate.c
mdnsproxy/unxmain.c
mdnsproxy/winmain.c
mdnsproxy/winserv.c
mdnsproxy/winserv.h
tools/Makefile.in
tools/mdnconv/Makefile.in
tools/mdnconv/mdnconv.c
tools/mdnconv/util.c
tools/mdnconv/util.h
tools/mdnconv/mdnconv.1
tools/mdnconv/mdnslookup.in
tools/rpm/mdnsproxy.init
tools/rpm/mdnkit.spec
tools/runmdn/Makefile.in
tools/runmdn/resolver.c
tools/runmdn/stub.c
tools/runmdn/stub.h
tools/runmdn/runmdn.1
tools/runmdn/runmdn.in
man/Makefile.in
man/libmdn.3.in
man/mdn.conf.5.in
patch/bind8/bind-8.2.3-patch
patch/bind9/bind-9.1.3-patch
patch/bind9/bind-9.2.0-patch
patch/libiconv/libiconv-1.6.1.patch
patch/squid/squid-2.4.STABLE1-patch
win/README.WIN
wsock/README.txt
wsock/README_j.txt
wsock/make.wnt
wsock/common/checkdll.c
wsock/common/convert.c
wsock/common/dllmain.c
wsock/common/dump.c
wsock/common/encoding.c
wsock/common/hook.c
wsock/common/jpnicmdn.def
wsock/common/jpnicmdn.h
wsock/common/make.wnt
wsock/common/printf.c
wsock/config/make.wnt
wsock/config/mdnconf.tcl
wsock/wsock11/dlldef.h
wsock/wsock11/dllfunc.c
wsock/wsock11/dllload.c
wsock/wsock11/dllmain.c
wsock/wsock11/dllstub.c
wsock/wsock11/make.wnt
wsock/wsock11/wsock32.def
wsock/wsock11/wsock32o.def
wsock/wsock20/dlldef.h
wsock/wsock20/dllfunc.c
wsock/wsock20/dllload.c
wsock/wsock20/dllmain.c
wsock/wsock20/dllstub.c
wsock/wsock20/make.wnt
wsock/wsock20/ws2_32.def
wsock/wsock20/ws2_32o.def
util/SparseMap.pm
util/UCD.pm
util/generate_nameprep_data.pl
util/generate_normalize_data.pl
map/Makefile.in
map/jp.map
-248
View File
@@ -1,248 +0,0 @@
mDNkit
Compilation and Installation
Japan Network Information Center (JPNIC)
This file explains how to compile and install the source package.
These procedures take the following steps:
+ Prerequisite: making iconv() available
+ System Configuration: running `configure' script
+ Compilation: running `make'
+ Installation: running `make install'
+ Site Configuration: tailoring `mdn.conf'
+ Configuration Check (optional)
0. Prerequisite
If your system's library does not have iconv() function, which is a
general codeset conversion utility, install it as an external library.
You also need external library if the system's implementation cannot
handle UTF-8 encoding, or it doesn't support some encodings which your
client applications uses.
You can get a free version of iconv() implementation (under LGPL
license, aka GNU libiconv) from:
http://clisp.cons.org/~haible/packages-libiconv.html
*Note*
GNU libiconv-1.6.1 have a compilation problem on NetBSD 1.5. There
is a patch file for the bug under patch/libiconv directory. If you
are a NetBSD 1.5 user and found a problem in compiling libiconv,
apply the patch and try again. The patch file contains brief
instructions on how to apply it at the beginning.
1. Running configure script
Run `configure' script in the top directory. This checks various
characteristics of your system and it will create Makefiles and
config.h appropriate for your system.
% ./configure
`configure' accepts many options. Here is a list of some important
options.
--prefix=PREFIX
Specifies the prefix of install directories of mDNkit. The
default is /usr/local.
--with-libiconv=LIBICONV_PREFIX
If you have installed GNU libiconv and would like to link it
to mDNkit, specify this option. The argument LIBICONV_PREFIX
is install prefix of GNU libiconv. If the argument is omitted,
PREFIX (derived from --prefix=PREFIX option) is assumed.
--with-libiconv is shorthand option for GNU libiconv.
--with-libiconv=/usr/local
This is equivalent to:
--with-iconv-include='-I/usr/local/include'
--with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
If both the shorthand option (--with-libiconv) and longhand
options (--with-iconv-include and/or --with-iconv) are specified,
the longhand options have priority.
--with-iconv-include=ICONV_INCDIR
If the header file "iconv.h" resides in a directory where your
C compiler doesn't search by default, specify the directory as
DIR like this:
--with-iconv-include=/usr/local/include
--with-iconv=ICONV_LIB
If your libc doesn't contain iconv(), specify the library
that contains iconv(). For example, if iconv() is libiconv
in /usr/local/lib, you should specify:
--with-iconv="-L/usr/local/lib -liconv"
Note that if the library is a shared one, you might also want
to specify -R option, like:
--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
--with-iconv-sofile=SOFILE_PATH
``runmdn'' command in this kit needs to know the pathname of
shared library file that contains iconv(), if iconv() is not
part of libc. mDNkit tries to find out the pathname from the
informaiton provided by ``--with-iconv'' option described
above. But when it fails, you have to specify it with this
option, like:
--with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
--with-utf8=UTF8_NAME
If your iconv() (precisely, iconv_open()) does not accept
"UTF-8" as the name of UTF-8 encoding, specify the name for
it. For example if your iconv() uses "utf8" instead, you
should specify:
--with-utf8=utf8
2. Other configure options
The configure script has many other options though they are not widely
used:
--with-preference=PREFERENCE
This option sets the preference for the sample mDNkit
configuration file (mdn.conf.sample). Also this option
enables to install default configuration file (mdn.conf)
if the file didn't exist.
The only preference supported by this version is "jp".
--with-amc-ace-z-prefix=AMCZ_PREFIX
AMC-ACE-Z is a proposed encoding for multilingual domain name
in DNS protocol data. It requires a specific prefix string
to distinguish domain names encoded by them from normal ASCII
domain names, but the current Internet draft of AMC-ACE-Z
doesn't define prefix. You can specify the prefix with this
option. Otherwise mDNkit defines "zq--" as the prefix.
--with-race-prefix=RACE_PREFIX
--with-dude-prefix=DUDE_PREFIX
Also RACE and DUDE are encodings for multilingual domain name,
but they are obsolete. Since Internet drafts for these
encodings defines ACE prefixes, mDNkit uses them by default,
but you can specify prefix with these options.
--exec-prefix=EXEC_PREFIX
Specifies the prefix of install directories for machine-specific
files. The default is PREFIX (derived from ``--prefix=PREFIX''
and its default is /usr/local).
--sbindir=SBINDIR
Specifies the install directory for mdnsproxy. The default is
EXEC_PREFIX/sbin.
--bindir=BINDIR
Specifies the install directory for mdnconv and runmdn.
The default is EXEC_PREFIX/bin.
--libdir=LIBDIR
Specifies the install directory for the MDN library (libmdn).
The default is EXEC_PREFIX/lib.
--includedir=INCDIR
Specifies the install directory for the header files of the MDN
library. The default is PREFIX/include.
--sysconfdir=SYSCONFDIR
Specifies the install directory for sample configuration files
of the MDN Library and mdnsproxy. The default is PREFIX/etc.
--mandir=MANDIR
Specifies the base install directory for online manuals.
The default is PREFIX/man.
--datadir=DATADIR
Specifies the base install directory for machine independent
data files. The default is PREFIX/share. Some data files for
mDNkit will be put under the DATADIR/mdnkit directory.
--localstatedir=LOCALSTATEDIR
--with-logdir=LOGDIR
LOGDIR specifies the directory where mdnsproxy outputs log
files by default. Its default value is LOCALSTATEDIR/mdnsproxy,
and the default value of LOCALSTATEDIR is PREFIX/var.
--enable-debug
Enable debugging codes. The fault is "no".
--enable-shared
Build shared library. The fault is "yes".
--enable-static
Build static library. The fault is "yes".
To see the list of available options, you should run it with --help
option.
% ./configure --help
3. Compiling
Run `make' for compilation.
% make
4. Installation
Run `make install' to install binaries and manuals. Don't forget to
become a super-user before the installation.
% su
# make install
5. Configuration and usage
mDNkit needs a configuration file `mdn.conf' to work properly. Unless
you specified --with-preference option to the `configure' script, you
have to create the file. Please refer the manual for `mdn.conf' for
details. A sample configuration (`mdn.conf.sample') is also provided
for your convenience.
Also online manuals for `mdnsproxy', `mdnconv' and `runmdn' commands
are available. Please refer them for the usage and configuration of
these commands.
% man mdn.conf
% man mdnsproxy
% man mdnconv
% man runmdn
6. Check your configuration
A simple shell script `mdnslookup' is available in the directory
`tools/mdnconv', with which you can make queries for multilingual
domain names. It may help you check your configuration.
The usage of `mdnslookup' is:
% tools/mdnconv/mdnslookup <domain-name> <dns-server>
Suppose that <domain-name> is an internationalized domain name written
in the local codeset (see ``LOCAL CODESET'' in the `mdn.conf' man page
for details), and <dns-server> is a hostname or IP address of DNS
server.
`mdnslookup' inquires <mdn-domain-name> from <dns-server>, using
`mdnconv' and `nslookup' commands. If something is wrong, you will
see an error message output by `mdnconv', `nslookup' or `mdnslookup'
itself.
; $Id: INSTALL,v 1.1 2002/02/08 05:38:30 marka Exp $
-253
View File
@@ -1,253 +0,0 @@
mDNkit
$B%3%s%Q%$%k$H%$%s%9%H!<%k$NJ}K!(B
($B<R(B) $BF|K\%M%C%H%o!<%/%$%s%U%)%a!<%7%g%s%;%s%?!<(B (JPNIC)
$BK\%Q%C%1!<%8$N%3%s%Q%$%k$*$h$S%$%s%9%H!<%k$O!"<!$N$h$&$J%9%F%C%W$G9T(B
$B$$$^$9!#(B
+ $BA0=`Hw(B: iconv() $B$,MxMQ$G$-$k$h$&$K$9$k(B
+ $B%7%9%F%`@_Dj(B: `configure' $B%9%/%j%W%H$N<B9T(B
+ $B%3%s%Q%$%k(B: `make' $B$N<B9T(B
+ $B%$%s%9%H!<%k(B: `make install' $B$N<B9T(B
+ $B%5%$%HKh$N@_Dj(B: `mdn.conf' $B$K$h$k@_Dj(B
+ $B@_Dj$N3NG'(B ($B>JN,2D(B)
0. $BA0=`Hw(B
$B$b$7$"$J$?$N;HMQ$7$F$$$k%7%9%F%`$N%i%$%V%i%j$K(B iconv() $B$,$J$$>l9g!"$"(B
$B$k$$$O$"$C$F$b(B UTF-8 $B$r07$&$3$H$,$G$-$J$$>l9g$K$O$"$i$+$8$a(B iconv() $B$r(B
$B%$%s%9%H!<%k$7$F$*$$$F$/$@$5$$!#(Biconv() $B$O!"Nc$($P(B GNU libiconv $B$H8F$P(B
$B$l$k%U%j!<(B (LGPL) $B$N<BAu$,(B
http://clisp.cons.org/~haible/packages-libiconv.html
$B$+$iF~<j2DG=$G$9!#(B
*$BCm0U(B*
GNU libiconv-1.6.1 $B$O(B NetBSD 1.5 $B$H$NAH9g$o$;$GLdBj$,$"$j!"%3%s%Q%$(B
$B%k;~$K%(%i!<$,H/@8$7$^$9!#$3$N%P%0$r=$@5$9$k$?$a$N%Q%C%A$,(B
patch/libiconv $B%G%#%l%/%H%j$N2<$KMQ0U$5$l$F$$$^$9$N$G!"$3$NLdBj$KAx(B
$B6x$7$?>l9g$K$O(B libiconv $B$K%Q%C%A$rEv$F$F:F%$%s%9%H!<%k$7$F$/$@$5$$!#(B
$B$J$*!"%Q%C%A$NEv$FJ}$O%Q%C%A%U%!%$%k$N@hF,$K=q$+$l$F$$$^$9!#(B
1. configure $B%9%/%j%W%H$N<B9T(B
$B%H%C%W%G%#%l%/%H%j$K$"$k(B configure $B%9%/%j%W%H$r<B9T$7$F$/$@$5$$!#(B
% ./configure
configure $B%9%/%j%W%H$K$O!"?tB?$/$N%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#$=$N$&(B
$B$A=EMW$H;W$o$l$k$b$N$O<!$NDL$j$G$9!#(B
--prefix=PREFIX
mDNkit $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj$7$^$9!#%G%U%)(B
$B%k%H$O(B /usr/local $B$G$9!#(B
--with-libiconv=LIBICONV_PREFIX
$B$"$i$+$8$a%$%s%9%H!<%k$7$F$"$k(B GNU libiconv $B$r(B mDNkit $B$K%j%s%/(B
$B$5$;$k>l9g$O!"$3$N%*%W%7%g%s$r;XDj$7$F2<$5$$!#0z?t(B LIBICONV_PREFIX
$B$K$O!"(BGNU libiconv $B$,%$%s%9%H!<%k$5$l$F$$$k0LCV$r;XDj$7$^$9!#(B
$B0z?t$r>JN,$9$k$H!"(BPREFIX (PREFIX $B$NCM$O(B --prefix=PREFIX $B$+$i(B
$BF3=P$5$l$^$9(B) $B$r;XDj$7$?$b$N$H8+$J$5$l$^$9!#(B
--with-libiconv $B$O(B GNU libiconv $BMQ$NC;=L7A$N%*%W%7%g%s$G(B
--with-libiconv=/usr/local
$B$3$l$O<!$HEy2A$K$J$j$^$9!#(B
--with-iconv-include='-I/usr/local/include'
--with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
$BC;=L7A$N%*%W%7%g%s(B (--with-libiconv) $B$HDL>oMQ$N%*%W%7%g%s(B
(--with-iconv-include, --with-iconv) $B$rN>J}$H$b;XDj$7$?>l9g$O!"(B
$BDL>oMQ$N%*%W%7%g%s$[$&$,M%@h$5$l$^$9!#(B
--with-iconv-include=ICONV_INCDIR
C $B%3%s%Q%$%i$,DL>o$G$O8!:w$7$J$$%G%#%l%/%H%j$K(B "iconv.h" $B$,CV(B
$B$+$l$F$$$k>l9g!"<!$N$h$&$K$7$F$=$N%G%#%l%/%H%j$r;XDj$7$^$9!#(B
--with-iconv-include=/usr/local/include
--with-iconv=ICONV_LIB
libc $B$K(B iconv $B$,F~$C$F$$$J$$>l9g(B ($B>e5-$N%Q%C%1!<%8$rF~$l$?(B
$B>l9g$J$I(B) $B$K!"(Biconv $B$N%i%$%V%i%j$r;XDj$7$^$9!#Nc$($P(B
--with-iconv="-L/usr/local/lib -liconv"
$B$N$h$&$K;XDj$7$^$9!#$b$7(B iconv $B$,6&M-%i%$%V%i%j$K$J$C$F$$$k(B
$B>l9g$K$O!"(B-R $B%*%W%7%g%s$b;XDj$7$F(B
--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
$B$H$9$kI,MW$,$"$k$+$b$7$l$^$;$s!#(B
--with-iconv-sofile=SOFILE_PATH
mDNkit $B$K4^$^$l$F$$$k(B runmdn $B%3%^%s%I$O!"(Biconv() $B$,(B libc $B$N0l(B
$BIt$H$7$FDs6!$5$l$J$$$H$-$K!"(Biconv() $B$r4^$`6&M-%i%$%V%i%j$X$N%Q(B
$B%9L>$rCN$kI,MW$,$"$j$^$9!#(BmDNkit $B$O!"(B--with-iconv $B%*%W%7%g%s$N(B
$B5-=R$r4p$K%Q%9L>$r8!:w$7$^$9$,!"$3$l$K<:GT$7$?$H$-$K!"0J2<$N$h(B
$B$&$K6&M-%i%$%V%i%j$r;XDj$9$k$3$H$,$G$-$^$9!#(B
--with-iconv-sofile=/usr/local/lib/libiconvv.so.2.0
--with-utf8=UTF8_NAME
iconv $B$K(B utf-8 $B%(%s%3!<%G%#%s%0$r;XDj$9$k>l9g!"K\%i%$%V%i%j$O(B
$B%G%U%)%k%H$G$O(B "UTF-8" $B$H$$$&L>A0$r;XDj$7$^$9!#$b$7$"$J$?$N(B
$B%7%9%F%`$N(B iconv $B$,(B "UTF-8" $B$H$$$&L>A0$r<u$1IU$1$J$$>l9g$K$O!"(B
$BBe$j$NL>A0$r;XDj$7$^$9!#Nc$($P(B "UTF-8" $B$G$O$J$/(B "utf8" $B$N(B
$B>l9g$K$O<!$N$h$&$K;XDj$7$^$9!#(B
--with-utf8=utf8
2. $B$=$NB>$N(B configure $B$N%*%W%7%g%s(B
$B$=$l$[$I$h$/;H$&$o$1$G$O$"$j$^$;$s$,!"(Bconfigure $B$K$OA09`$N$b$N0J30$K(B
$B$bMM!9$J%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#(B
--with-preference=PREFERENCE
mDNkit $B$N%5%s%W%k%3%s%U%#%.%e%l!<%7%g%s%U%!%$%k(B (mdn.conf.sample)
$B$N@_Dj$r(B PREFERENCE $B8~$1$N$b$N$K$7$^$9!#$^$?$3$N%*%W%7%g%s$r;XDj(B
$B$9$k$H%G%U%)%k%H$N%3%s%U%#%.%e%l!<%7%g%s%U%!%$%k(B (mdn.conf) $B$,(B
$B%$%s%9%H!<%k$5$l$^$9!#$?$@$7%U%!%$%k$,$9$G$KB8:_$7$F$$$k>l9g$K$O(B
$B%$%s%9%H!<%k$7$^$;$s!#(B
$B8=:_$N$H$3$m!";XDj$G$-$k(B PREFERENCE $B$O(B "jp" $B$N$_$G$9!#(B
--with-amc-ace-z-prefix=AMCZ_PREFIX
AMC-ACE-Z $B$O(B DNS $B%W%m%H%3%k>e$G;HMQ$5$l$kB?8@8l%I%a%$%sL>$K4X$7(B
$B$FDs0F$5$l$F$$$k%(%s%3!<%G%#%s%0J}<0$G$9!#$3$N%(%s%3!<%G%#%s%0(B
$B$G%3%s%3!<%I$5$l$?%I%a%$%sL>$H=>Mh$N(B ASCII $B%I%a%$%sL>$H6hJL$9(B
$B$k$?$a$K$O!"8GDj$N@\F,<-$rMQ0U$9$kI,MW$,$"$j$^$9!#$7$+$7$J$,$i!"(B
$B8=:_$N(B AMCE-ACE-Z $B$N%$%s%?!<%M%C%H%I%i%U%H$G$O@\F,<-$rDj5A$7$F(B
$B$$$^$;$s!#$3$N%*%W%7%g%s$rMQ$$$k$3$H$G!"@\F,<-$r;XDj$9$k$3$H$,(B
$B$G$-$^$9!#;XDj$7$J$1$l$P!"(B"zq--" $B$,@\F,<-$H$7$FDj5A$5$l$^$9!#(B
--with-race-prefix=RACE_PREFIX
--with-dude-prefix=DUDE_PREFIX
RACE $B$b(B DUDE $B$b(B DNS $B%W%m%H%3%k>e$G;HMQ$5$l$kB?8@8l%I%a%$%sL>$K(B
$B4X$7$FDs0F$5$l$F$$$k%(%s%3!<%G%#%s%0J}<0$G$9$,!"$9$G$KGQ$l$?$b(B
$B$N$H$J$C$F$$$^$9!#%(%s%3!<%G%#%s%0J}<0$K$D$$$F5-=R$7$?%$%s%?!<(B
$B%M%C%H%I%i%U%H$K$O@\F,<-$,Dj5A$5$l$F$$$^$9$,!"$3$l$i$N%*%W%7%g(B
$B%s$rMQ$$$F@\F,<-$rJQ99$9$k$3$H$b2DG=$G$9!#(B
--exec-prefix=EXEC_PREFIX
$B%^%7%s8GM-$N%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj(B
$B$7$^$9!#%G%U%)%k%H$O(B PREFIX (``--prefix=PREFIX'' $B$K$h$C$F;XDj(B
$B2DG=!"(BPREFIX $B$N%G%U%)%k%H$O(B /usr/local) $B$K$J$j$^$9!#(B
--sbindir=SBINDIR
mdnsproxy $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#%G%U%)%k(B
$B%H$G$O(B EXEC_PREFIX/sbin $B$G$9!#(B
--bindir=BINDIR
mdnconv $B$H(B runmdn $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O(B EXEC_PREFIX/bin $B$G$9!#(B
--libdir=LIBDIR
MDN $B%i%$%V%i%j(B (libmdn) $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7(B
$B$^$9!#%G%U%)%k%H$G$O(B EXEC_PREFIX/lib $B$G$9!#(B
--includedir=INCDIR
MDN $B%i%$%V%i%j$N%X%C%@%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r(B
$B;XDj$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/include $B$G$9!#(B
--sysconfdir=SYSCONFDIR
MDN $B%i%$%V%i%j$*$h$S(B mdnsproxy $B$N@_Dj%U%!%$%k$N%5%s%W%k$r%$%s(B
$B%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/etc
$B$G$9!#(B
--mandir=MANDIR
$B%*%s%i%$%s%^%K%e%"%k$N%$%s%9%H!<%k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O(B PREFIX/man $B$G$9!#(B
--datadir=DATADIR
$B0[$J$k%^%7%s$G6&M-2DG=$J%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j(B
$B$r;XDj$7$^$9!#%G%U%)%k%H$O(B PREFIX/share $B$G$9!#(BDATADIR/mdnkit
$B$N2<$K!"(BmDNkit $B$G;HMQ$9$k4v$D$+$N%G!<%?%U%!%$%k$,%$%s%9%H!<%k(B
$B$5$l$^$9!#(B
--localstatedir=LOCALSTATEDIR
--with-logdir=LOGDIR
LOGDIR $B$O(B mdnsproxy $B$N%m%0%U%!%$%k$r=PNO$9$kI8=`$N%G%#%l%/%H%j(B
$B$r;XDj$7$^$9!#(BLOGDIR $B$N%G%U%)%k%H$O(B LOLOCALSTATEDIR/mdnsproxy
$B$G!"(BLOLOCALSTATEDIR $B$N%G%U%)%k%H$O(B PREFIX/var $B$G$9!#(B
--enable-debug
$B%G%P%C%0MQ$N%3!<%I$rM-8z$K$7$^$9!#%G%U%)%k%H$O(B "no" ($BL58z(B) $B$G$9!#(B
--enable-shared
$B6&M-%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
--enable-static
$B@EE*%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
configure $B$K$OB>$K$bB?$/$N%*%W%7%g%s$,$"$j$^$9$,!";D$j$O0lHLE*$J%*%W%7%g(B
$B%s$J$N$G@bL@$O>J$-$^$9!#(B
% ./configure --help
$B$r<B9T$9$k$H%*%W%7%g%s$N0lMw$,I=<($5$l$^$9!#(B
3. $B%3%s%Q%$%k(B
configure $B$r<B9T$9$k$H(B Makefile $B$J$I$,@8@.$5$l$^$9$N$G!"B3$1$F(B make$B$r(B
$B<B9T$7$F%3%s%Q%$%k$7$^$9!#(B
% make
4. $B%$%s%9%H!<%k(B
$B%9!<%Q%f!<%6$K$J$C$F%$%s%9%H!<%k$7$^$9!#(B
% su
# make install
5. $B@_Dj$H;HMQJ}K!(B
mDNkit $B$r@5$7$/F0:n$5$;$k$K$O!"@_Dj%U%!%$%k(B `mdn.conf' $B$,I,MW$G$9!#(B
configure $B%9%/%j%W%H$K(B --with-preference $B%*%W%7%g%s$r;XDj$7$J$+$C$?>l(B
$B9g$K$O$3$N%U%!%$%k$r:n@.$9$kI,MW$,$"$j$^$9!#$3$N@_Dj%U%!%$%k$N>\:Y$K$D(B
$B$$$F$O(Bmdn.conf $B$N%*%s%i%$%s%^%K%e%"%k$r$4Mw$/$@$5$$!#$^$?@_DjNc$,=q$+(B
$B$l$?%5%s%W%k%U%!%$%k(B (mdn.conf.sample) $B$b%$%s%9%H!<%k$5$l$^$9$N$G$4Mx(B
$BMQ$/$@$5$$!#(B
$B$^$?!"(Bmdnsproxy$B!"(Bmdnconv$B!"(Brunmdn $B$H$$$C$?%D!<%k$N%*%s%i%$%s%^%K%e%"%k(B
$B$bDs6!$5$l$F$$$^$9!#$3$l$i$N%3%^%s%I$N;H$$J}!"@_DjJ}K!$K4X$7$F$O$=$A$i(B
$B$r;2>H$7$F$/$@$5$$!#(B
% man mdn.conf
% man mdnsproxy
% man mdnconv
% man runmdn
6. $B@_Dj$N3NG'(B
`mdnsproxy' $B$H$$$&4JC1$J%7%'%k%9%/%j%W%H$,(B tools/mdnconv $B%G%#%l%/%H%j(B
$B$KMQ0U$5$l$F$$$^$9!#$3$N%9%/%j%W%H$r;H$&$H(B DNS $B%5!<%P$KBP$7$FB?8@8l%I(B
$B%a%$%sL>$rLd$$9g$o$;$k$3$H$,$G$-$^$9!#@_Dj%U%!%$%k$N3NG'$KLrN)$D$+$bCN(B
$B$l$^$;$s!#(B
`mdnslookup' $B$N;HMQJ}K!$O!"<!$NDL$j$G$9!#(B
% tools/mdnconv/mdnslookup <domain-name> <dns-server>
$B$3$3$G(B <domain-name> $B$O%m!<%+%k%3!<%I%;%C%H(B ($B>\$7$/$O(B mdn.conf $B$N%^%K%e(B
$B%"%k$N(B ``LOCAL CODESET'' $B$r;2>H$N$3$H(B) $B$G=q$+$l$?B?8@8l%I%a%$%sL>$G!"(B
<dns-server> $B$O(B DNS $B%5!<%P$N%[%9%HL>$b$7$/$O(B IP $B%"%I%l%9$G$9!#(B
`mdnslookup' $B$O(B `mdnconv' $B$*$h$S(B `nslookup' $B%3%^%s%I$rMQ$$$F!"(B
<dns-server> $B$KBP$7$F(B <domain-name> $B$r0z$-$K9T$-$^$9!#@_Dj$K2?$+4V0c$$(B
$B$,$"$l$P!"(B`mdnconv', `nslookup', $B$"$k$$$O(B `mdnslookup' $B<+?H$K$h$k%(%i!<(B
$B%a%C%;!<%8$,=PNO$5$l$^$9!#(B
; $Id: INSTALL.ja,v 1.1 2002/02/08 05:38:30 marka Exp $
-85
View File
@@ -1,85 +0,0 @@
/* $Id: amcacev.h,v 1.1 2002/02/08 05:38:59 marka Exp $ */
/*
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#ifndef MDN_AMCACEV_H
#define MDN_AMCACEV_H 1
/*
* AMC-ACE-V Converter.
*
* See Internet Draft draft-ietf-idn-amc-ace-v-00.txt for details.
*/
#include <mdn/result.h>
#include <mdn/converter.h>
extern mdn_result_t
mdn__amcacev_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata);
extern mdn_result_t
mdn__amcacev_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir);
extern mdn_result_t
mdn__amcacev_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir, const char *from, char *to,
size_t tolen);
#endif /* MDN_AMCACEV_H */
-85
View File
@@ -1,85 +0,0 @@
/* $Id: amcacew.h,v 1.1 2002/02/08 05:39:00 marka Exp $ */
/*
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#ifndef MDN_AMCACEW_H
#define MDN_AMCACEW_H 1
/*
* AMC-ACE-W Converter.
*
* See Internet Draft draft-ietf-idn-amc-ace-w-00.txt for details.
*/
#include <mdn/result.h>
#include <mdn/converter.h>
extern mdn_result_t
mdn__amcacew_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata);
extern mdn_result_t
mdn__amcacew_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir);
extern mdn_result_t
mdn__amcacew_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir, const char *from, char *to,
size_t tolen);
#endif /* MDN_AMCACEW_H */
-86
View File
@@ -1,86 +0,0 @@
/* $Id: amcacez.h,v 1.1 2002/02/08 05:39:00 marka Exp $ */
/*
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#ifndef MDN_AMCACEZ_H
#define MDN_AMCACEZ_H 1
/*
* AMC-ACE-Z (version 0.3.1) Converter.
*
* See Internet Draft draft-ietf-idn-amc-ace-z-01.txt
* for details.
*/
#include <mdn/result.h>
#include <mdn/converter.h>
extern mdn_result_t
mdn__amcacez_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata);
extern mdn_result_t
mdn__amcacez_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir);
extern mdn_result_t
mdn__amcacez_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir, const char *from, char *to,
size_t tolen);
#endif /* MDN_AMCACEZ_H */
-86
View File
@@ -1,86 +0,0 @@
/* $Id: mace.h,v 1.1 2002/02/08 05:39:19 marka Exp $ */
/*
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#ifndef MDN_MACE_H
#define MDN_MACE_H 1
/*
* MACE Converter.
*
* See Internet Draft draft-ietf-idn-mace-00.txt (but not yet
* published at the time of this writing) for details.
*/
#include <mdn/result.h>
#include <mdn/converter.h>
extern mdn_result_t
mdn__mace_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata);
extern mdn_result_t
mdn__mace_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir);
extern mdn_result_t
mdn__mace_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir, const char *from, char *to,
size_t tolen);
#endif /* MDN_MACE_H */
-545
View File
@@ -1,545 +0,0 @@
#ifndef lint
static char *rcsid = "$Id: amcacev.c,v 1.1 2002/02/08 05:39:56 marka Exp $";
#endif
/*
* Copyright (c) 2001 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <mdn/result.h>
#include <mdn/assert.h>
#include <mdn/logmacro.h>
#include <mdn/converter.h>
#include <mdn/utf8.h>
#include <mdn/debug.h>
#include <mdn/amcacev.h>
#include <mdn/ace.h>
#include <mdn/util.h>
/*
* Although draft-ietf-idn-amc-ace-v-00.txt doesn't specify the ACE
* signature, we have to choose one. In order to prevent the converted
* name from beginning with a hyphen, we should choose a prefix rather
* than a suffix.
*/
#if !defined(MDN_AMCACEV_PREFIX) && !defined(MDN_AMCACEV_SUFFIX)
#define MDN_AMCACEV_PREFIX "amc4-"
#endif
#define MAX_UCS 0x10FFFF
#define AMCACEV_BUFSIZE 64
typedef struct {
unsigned long *history; /* history of non-LDH characters */
unsigned long local_buf[AMCACEV_BUFSIZE];
int cur; /* current index */
int style; /* 0 or 1 */
unsigned long refpoint[2][6]; /* refpoint[0] is not used. */
} amcacev_ctx;
#define IN_WINDOW(ctx, c, st, win) \
((c) >= (ctx)->refpoint[st][win] && \
((c) - (ctx)->refpoint[st][win]) <= amcacev_winsize[st][win])
static const unsigned long amcacev_refpoint_initial[2][6] = {
{ 0, 0xe0, 0xa0, 0, 0, 0x10000 },
{ 0, 0, 0, 0, 0, 0x10000 },
};
static const unsigned long amcacev_winsize[2][6] = {
{ 0, 0xf, 0xff, 0xfff, 0xffff, 0xfffff },
{ 0, 0, 0xff, 0x4fff, 0xffff, 0xfffff },
};
static const char *base32encode = "abcdefghijkmnpqrstuvwxyz23456789";
static const int base32decode_ascii[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 11, 12, -1, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
};
static const int base32decode_digit[10] = {
-1, -1, 24, 25, 26, 27, 28, 29, 30, 31,
};
static mdn_result_t amcacev_decode(const char *from, size_t fromlen,
char *to, size_t tolen);
static mdn_result_t amcacev_encode(const char *from, size_t fromlen,
char *to, size_t tolen);
static mdn_result_t init_ctx(amcacev_ctx *ctx, size_t len);
static void release_ctx(amcacev_ctx *ctx);
static void update_ctx(amcacev_ctx *ctx, unsigned long v);
static unsigned long get_refpoint(unsigned long v, int st, int win);
static int eval_compression(amcacev_ctx *ctx);
static unsigned long encode_delta(unsigned long v,
amcacev_ctx *ctx, int *szp);
static int amcacev_getwc(const char *s, size_t len, int style,
unsigned long *vp);
static int amcacev_putwc(char *s, size_t len,
unsigned long delta, int w);
static int is_ldh(unsigned long v);
static mdn__ace_t amcacev_profile = {
#ifdef MDN_AMCACEV_PREFIX
mdn__ace_prefix,
MDN_AMCACEV_PREFIX,
#else
mdn__ace_suffix,
MDN_AMCACEV_SUFFIX,
#endif
amcacev_encode,
amcacev_decode,
};
/* ARGSUSED */
mdn_result_t
mdn__amcacev_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata)
{
return (mdn_success);
}
/* ARGSUSED */
mdn_result_t
mdn__amcacev_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir)
{
return (mdn_success);
}
mdn_result_t
mdn__amcacev_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir,
const char *from, char *to, size_t tolen)
{
mdn_result_t r;
assert(ctx != NULL &&
(dir == mdn_converter_l2u || dir == mdn_converter_u2l));
TRACE(("mdn__amcacev_convert(dir=%s,from=\"%s\")\n",
dir == mdn_converter_l2u ? "l2u" : "u2l",
mdn_debug_xstring(from, 20)));
r = mdn__ace_convert(&amcacev_profile, dir, from, to, tolen);
if (r != mdn_success)
return (r);
DUMP(("mdn__amcacev_convert: \"%s\"\n", mdn_debug_xstring(to, 70)));
return (r);
}
static mdn_result_t
amcacev_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal_mode = 0;
amcacev_ctx ctx;
mdn_result_t r;
/* Initialize context. */
if ((r = init_ctx(&ctx, fromlen)) != mdn_success)
return (r);
while (fromlen > 0) {
unsigned long v;
int len;
if (from[0] == '-') {
if (fromlen > 1 && from[1] == '-') {
v = '-';
from += 2;
fromlen -= 2;
} else {
literal_mode = !literal_mode;
from++;
fromlen--;
continue;
}
} else if (literal_mode) {
v = from[0];
from++;
fromlen--;
} else {
len = amcacev_getwc(from, fromlen, ctx.style, &v);
if (len == 0)
goto invalid_encoding;
from += len;
fromlen -= len;
v += ctx.refpoint[ctx.style][len];
/* Update refpoints. */
update_ctx(&ctx, v);
}
len = mdn_utf8_putwc(to, tolen, v);
if (len == 0)
goto overflow;
to += len;
tolen -= len;
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
goto overflow;
*to = '\0';
ret:
release_ctx(&ctx);
return (r);
invalid_encoding:
r = mdn_invalid_encoding;
goto ret;
overflow:
r = mdn_buffer_overflow;
goto ret;
}
static mdn_result_t
amcacev_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal_mode = 0;
amcacev_ctx ctx;
mdn_result_t r;
/* Initialize context. */
if ((r = init_ctx(&ctx, fromlen)) != mdn_success)
return (r);
while (fromlen > 0) {
unsigned long c;
size_t len;
len = mdn_utf8_getwc(from, fromlen, &c);
from += len;
fromlen -= len;
if (len == 0)
goto invalid_encoding;
if (c >= MAX_UCS) {
/*
* Invalid Unicode code point.
*/
goto invalid_encoding;
} else if (c == '-') {
/*
* Convert "-" to "--".
*/
if (tolen < 2)
goto overflow;
to[0] = to[1] = '-';
to += 2;
tolen -= 2;
} else if (is_ldh(c)) {
/*
* LDH characters.
*/
if (literal_mode == 0) {
/*
* Go into literal mode.
*/
if (tolen < 1)
goto overflow;
*to++ = '-';
tolen--;
literal_mode = 1;
}
if (tolen < 1)
goto overflow;
*to++ = c;
tolen--;
} else {
/*
* Non-LDH characters.
*/
int sz;
unsigned long delta;
if (literal_mode != 0) {
/*
* Get out of literal mode.
*/
if (tolen < 1)
goto overflow;
*to++ = '-';
tolen--;
literal_mode = 0;
}
delta = encode_delta(c, &ctx, &sz);
sz = amcacev_putwc(to, tolen, delta, sz);
if (sz == 0)
goto overflow;
to += sz;
tolen -= sz;
/* Add to the history, and update refpoints. */
update_ctx(&ctx, c);
}
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
goto overflow;
*to = '\0';
ret:
release_ctx(&ctx);
return (r);
invalid_encoding:
r = mdn_invalid_encoding;
goto ret;
overflow:
r = mdn_buffer_overflow;
goto ret;
}
static mdn_result_t
init_ctx(amcacev_ctx *ctx, size_t len) {
if (len <= AMCACEV_BUFSIZE) {
ctx->history = ctx->local_buf;
} else {
ctx->history = malloc(sizeof(ctx->history[0]) * len);
if (ctx->history == NULL)
return (mdn_nomemory);
}
ctx->cur = 0;
ctx->style = 0;
(void)memcpy(ctx->refpoint, amcacev_refpoint_initial,
sizeof(ctx->refpoint));
return (mdn_success);
}
static void
release_ctx(amcacev_ctx *ctx) {
if (ctx->history != ctx->local_buf)
free(ctx->history);
ctx->history = NULL;
}
static void
update_ctx(amcacev_ctx *ctx, unsigned long v) {
int st, win;
/* Get style */
if (IN_WINDOW(ctx, v, 0, 1))
ctx->style = 0;
else if (!IN_WINDOW(ctx, v, 0, 1) &&
!IN_WINDOW(ctx, v, 0, 2) &&
!IN_WINDOW(ctx, v, 0, 3))
ctx->style = 1;
/* Add the character to the history. */
ctx->history[ctx->cur++] = v;
for (st = 0; st < 2; st++) {
for (win = (st == 0) ? 1 : 2; win < 4; win++) {
unsigned long oldref = ctx->refpoint[st][win];
unsigned long newref = get_refpoint(v, st, win);
int enclen1, enclen2;
if (newref == oldref)
continue;
enclen1 = eval_compression(ctx);
ctx->refpoint[st][win] = newref;
enclen2 = eval_compression(ctx);
if (enclen2 > enclen1)
ctx->refpoint[st][win] = oldref;
}
}
}
static unsigned long
get_refpoint(unsigned long v, int st, int win) {
#define ROUND_BITS(v, b) (((v) >> (b)) << (b))
if (win == 1) {
return (ROUND_BITS(v, 3));
} else if (win == 2) {
if (0xa0 <= v && v <= 0x17f)
return (0xa0);
else
return (ROUND_BITS(v, 8));
} else if (win == 3) {
if (0x3000 <= v && v <= 0x9ffff)
return (0x4e00);
else if (st == 1 && 0xa000 <= v && v <= 0xd7ff)
return (0x8800);
else
return (ROUND_BITS(v, (st == 0) ? 19 : 20));
} else {
FATAL(("get_refpoint: internal error\n"));
return (0); /* for lint */
}
#undef ROUND_BITS
}
static int
eval_compression(amcacev_ctx *ctx) {
int i;
int len = 0;
int cur = ctx->cur;
unsigned long *p = ctx->history;
for (i = 0; i < cur; i++) {
if (!is_ldh(p[i])) {
int sz;
(void)encode_delta(p[i], ctx, &sz);
len += sz;
}
}
return (len);
}
static unsigned long
encode_delta(unsigned long v, amcacev_ctx *ctx, int *szp) {
int sz;
for (sz = (ctx->style == 0) ? 1 : 2; sz < 6; sz++) {
if (IN_WINDOW(ctx, v, ctx->style, sz)) {
*szp = sz;
return (v - ctx->refpoint[ctx->style][sz]);
}
}
FATAL(("amcacev_encode_mode: internal error\n"));
return (0); /* for lint */
}
static int
amcacev_getwc(const char *s, size_t len, int style, unsigned long *vp) {
size_t orglen = len;
unsigned long v = 0;
int style1_special = 0;
while (len > 0) {
int c = *s++;
if ('a' <= c && c <= 'z')
c = base32decode_ascii[c - 'a'];
else if ('A' <= c && c <= 'Z')
c = base32decode_ascii[c - 'A'];
else if ('0' <= c && c <= '9')
c = base32decode_digit[c - '0'];
else
c = -1;
if (c < 0)
return (0); /* invalid character */
if (style == 1 && len == orglen && (c & 0x10) == 0)
style1_special = 3;
len--;
if (style1_special != 0) {
v = (v << 5) + (c & 0x1f);
if (--style1_special == 0) {
*vp = v + 0x1000;
return (3);
}
} else {
v = (v << 4) + (c & 0xf);
if ((c & 0x10) == 0) {
*vp = v;
return (orglen - len);
}
}
}
return (0); /* final character missing */
}
static int
amcacev_putwc(char *s, size_t len, unsigned long delta, int w) {
if (len < w)
return (0);
if (w == 3 && delta >= 0x1000) {
delta -= 0x1000;
s[0] = base32encode[(delta >> 10) & 0x1f];
s[1] = base32encode[(delta >> 5) & 0x1f];
s[2] = base32encode[delta & 0x1f];
} else {
int i, shift;
for (shift = 0, i = w - 1; i >= 0; i--) {
s[i] = base32encode[(delta & 0xf) + shift];
delta >>= 4;
shift = 16;
}
}
return (w);
}
static int
is_ldh(unsigned long v) {
if (('a' <= v && v <= 'z') || ('A' <= v && v <= 'Z') ||
('0' <= v && v <= '9') || v == '-')
return (1);
else
return (0);
}
-459
View File
@@ -1,459 +0,0 @@
#ifndef lint
static char *rcsid = "$Id: amcacew.c,v 1.1 2002/02/08 05:39:57 marka Exp $";
#endif
/*
* Copyright (c) 2001 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <mdn/result.h>
#include <mdn/assert.h>
#include <mdn/logmacro.h>
#include <mdn/converter.h>
#include <mdn/utf8.h>
#include <mdn/debug.h>
#include <mdn/amcacew.h>
#include <mdn/ace.h>
#include <mdn/util.h>
/*
* Although draft-ietf-idn-amc-ace-w-00.txt doesn't specify the ACE
* signature, we have to choose one. In order to prevent the converted
* name from beginning with a hyphen, we should choose a prefix rather
* than a suffix.
*/
#if !defined(MDN_AMCACEW_PREFIX) && !defined(MDN_AMCACEW_SUFFIX)
#define MDN_AMCACEW_PREFIX "amc5-"
#endif
#define MAX_UCS 0x10FFFF
typedef struct {
int style; /* 0 or 1 */
unsigned long refpoint[6]; /* refpoint[0] is not used. */
} amcacew_ctx;
static const unsigned long amcacew_refpoint_initial[6] = {
0, 0xe0, 0xa0, 0, 0, 0x10000,
};
static const char *base32encode = "abcdefghijkmnpqrstuvwxyz23456789";
static const int base32decode_ascii[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 11, 12, -1, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
};
static const int base32decode_digit[10] = {
-1, -1, 24, 25, 26, 27, 28, 29, 30, 31,
};
static mdn_result_t amcacew_decode(const char *from, size_t fromlen,
char *to, size_t tolen);
static mdn_result_t amcacew_encode(const char *from, size_t fromlen,
char *to, size_t tolen);
static void amcacew_init_ctx(amcacew_ctx *ctx);
static void amcacew_update_ctx(amcacew_ctx *ctx, unsigned long v,
int sz);
static unsigned long amcacew_encode_delta(unsigned long v,
amcacew_ctx *ctx, int *szp);
static int amcacew_getwc(const char *s, size_t len, int style,
unsigned long *vp);
static int amcacew_putwc(char *s, size_t len,
unsigned long delta, int w);
static int is_ldh(unsigned long v);
static mdn__ace_t amcacew_profile = {
#ifdef MDN_AMCACEW_PREFIX
mdn__ace_prefix,
MDN_AMCACEW_PREFIX,
#else
mdn__ace_suffix,
MDN_AMCACEW_SUFFIX,
#endif
amcacew_encode,
amcacew_decode,
};
/* ARGSUSED */
mdn_result_t
mdn__amcacew_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata)
{
return (mdn_success);
}
/* ARGSUSED */
mdn_result_t
mdn__amcacew_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir)
{
return (mdn_success);
}
mdn_result_t
mdn__amcacew_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir,
const char *from, char *to, size_t tolen)
{
mdn_result_t r;
assert(ctx != NULL &&
(dir == mdn_converter_l2u || dir == mdn_converter_u2l));
TRACE(("mdn__amcacew_convert(dir=%s,from=\"%s\")\n",
dir == mdn_converter_l2u ? "l2u" : "u2l",
mdn_debug_xstring(from, 20)));
r = mdn__ace_convert(&amcacew_profile, dir, from, to, tolen);
if (r != mdn_success)
return (r);
DUMP(("mdn__amcacew_convert: \"%s\"\n", mdn_debug_xstring(to, 70)));
return (r);
}
static mdn_result_t
amcacew_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal_mode = 0;
amcacew_ctx ctx;
/* Initialize refpoints. */
amcacew_init_ctx(&ctx);
while (fromlen > 0) {
unsigned long v;
int len;
if (from[0] == '-') {
if (fromlen > 1 && from[1] == '-') {
v = '-';
from += 2;
fromlen -= 2;
} else {
literal_mode = !literal_mode;
from++;
fromlen--;
continue;
}
} else if (literal_mode) {
v = from[0];
from++;
fromlen--;
} else {
len = amcacew_getwc(from, fromlen, ctx.style, &v);
if (len == 0)
return (mdn_invalid_encoding);
from += len;
fromlen -= len;
v += ctx.refpoint[len];
amcacew_update_ctx(&ctx, v, len);
}
len = mdn_utf8_putwc(to, tolen, v);
if (len == 0)
return (mdn_buffer_overflow);
to += len;
tolen -= len;
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
return (mdn_buffer_overflow);
*to = '\0';
return (mdn_success);
}
static mdn_result_t
amcacew_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal_mode = 0;
amcacew_ctx ctx;
/* Initialize refpoints. */
amcacew_init_ctx(&ctx);
while (fromlen > 0) {
unsigned long c;
size_t len;
len = mdn_utf8_getwc(from, fromlen, &c);
from += len;
fromlen -= len;
if (len == 0)
return (mdn_invalid_encoding);
if (c > MAX_UCS) {
/*
* Invalid Unicode code point.
*/
return (mdn_invalid_encoding);
} else if (c == '-') {
/*
* Convert "-" to "--".
*/
if (tolen < 2)
return (mdn_buffer_overflow);
to[0] = to[1] = '-';
to += 2;
tolen -= 2;
} else if (is_ldh(c)) {
/*
* LDH characters.
*/
if (literal_mode == 0) {
/*
* Go into literal mode.
*/
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = '-';
tolen--;
literal_mode = 1;
}
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = c;
tolen--;
} else {
/*
* Non-LDH characters.
*/
int sz;
unsigned long delta;
if (literal_mode != 0) {
/*
* Get out of literal mode.
*/
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = '-';
tolen--;
literal_mode = 0;
}
delta = amcacew_encode_delta(c, &ctx, &sz);
sz = amcacew_putwc(to, tolen, delta, sz);
if (sz == 0)
return (mdn_buffer_overflow);
to += sz;
tolen -= sz;
amcacew_update_ctx(&ctx, c, sz);
}
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
return (mdn_buffer_overflow);
*to = '\0';
return (mdn_success);
}
static void
amcacew_init_ctx(amcacew_ctx *ctx) {
ctx->style = 0;
(void)memcpy(ctx->refpoint, amcacew_refpoint_initial,
sizeof(ctx->refpoint));
}
static void
amcacew_update_ctx(amcacew_ctx *ctx, unsigned long v, int sz) {
if (sz != 3)
ctx->style = (sz < 3) ? 0 : 1;
#define ROUND_BITS(v, b) (((v) >> (b)) << (b))
/* Update refpoint[1] */
ctx->refpoint[1] = ROUND_BITS(v, 4);
/* Update refpoint[2] */
if (sz > 2) {
if (0xa0 <= v && v <= 0x17f)
ctx->refpoint[2] = 0xa0;
else
ctx->refpoint[2] = ROUND_BITS(v, 8);
}
/* Update refpoint[3] */
if (sz > 3) {
if (0x3000 <= v && v <= 0x9fff)
ctx->refpoint[3] = 0x4e00;
else if (0xa000 <= v && v <= 0xd7ff && ctx->style == 1)
ctx->refpoint[3] = 0x8800;
else
ctx->refpoint[3] = ROUND_BITS(v, 12);
}
#undef ROUND_BITS
}
static unsigned long
amcacew_encode_delta(unsigned long v, amcacew_ctx *ctx, int *szp) {
int sz, szinit;
unsigned long *maxdelta;
unsigned long *refpoint = ctx->refpoint;
static unsigned long maxdelta_style0[6] = {
0, 0xf, 0xff, 0xfff, 0xffff, 0xfffff,
};
static unsigned long maxdelta_style1[6] = {
0, 0, 0xff, 0x4fff, 0xffff, 0xfffff,
};
if (ctx->style == 0) {
szinit = 1;
maxdelta = maxdelta_style0;
} else {
szinit = 2;
maxdelta = maxdelta_style1;
}
for (sz = szinit; sz < 6; sz++) {
if (v >= refpoint[sz] && v - refpoint[sz] <= maxdelta[sz]) {
*szp = sz;
return (v - refpoint[sz]);
}
}
FATAL(("amcacew_encode_mode: internal error\n"));
return (0); /* for lint */
}
static int
amcacew_getwc(const char *s, size_t len, int style, unsigned long *vp) {
size_t orglen = len;
unsigned long v = 0;
int style1_special = 0;
while (len > 0) {
int c = *s++;
if ('a' <= c && c <= 'z')
c = base32decode_ascii[c - 'a'];
else if ('A' <= c && c <= 'Z')
c = base32decode_ascii[c - 'A'];
else if ('0' <= c && c <= '9')
c = base32decode_digit[c - '0'];
else
c = -1;
if (c < 0)
return (0); /* invalid character */
if (style == 1 && len == orglen && (c & 0x10) == 0)
style1_special = 3;
len--;
if (style1_special != 0) {
v = (v << 5) + (c & 0x1f);
if (--style1_special == 0) {
*vp = v + 0x1000;
return (3);
}
} else {
v = (v << 4) + (c & 0xf);
if ((c & 0x10) == 0) {
*vp = v;
return (orglen - len);
}
}
}
return (0); /* final character missing */
}
static int
amcacew_putwc(char *s, size_t len, unsigned long delta, int w) {
if (len < w)
return (0);
if (w == 3 && delta >= 0x1000) {
delta -= 0x1000;
s[0] = base32encode[(delta >> 10) & 0x1f];
s[1] = base32encode[(delta >> 5) & 0x1f];
s[2] = base32encode[delta & 0x1f];
} else {
int i, shift;
for (shift = 0, i = w - 1; i >= 0; i--) {
s[i] = base32encode[(delta & 0xf) + shift];
delta >>= 4;
shift = 16;
}
}
return (w);
}
static int
is_ldh(unsigned long v) {
if (('a' <= v && v <= 'z') || ('A' <= v && v <= 'Z') ||
('0' <= v && v <= '9') || v == '-')
return (1);
else
return (0);
}
-484
View File
@@ -1,484 +0,0 @@
#ifndef lint
static char *rcsid = "$Id: amcacez.c,v 1.1 2002/02/08 05:39:57 marka Exp $";
#endif
/*
* Copyright (c) 2001 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <mdn/result.h>
#include <mdn/assert.h>
#include <mdn/logmacro.h>
#include <mdn/converter.h>
#include <mdn/utf8.h>
#include <mdn/debug.h>
#include <mdn/amcacez.h>
#include <mdn/ace.h>
#include <mdn/util.h>
/*
* Although draft-ietf-idn-amc-ace-z-01.txt doesn't specify the ACE
* signature, we have to choose one. In order to prevent the converted
* name from beginning with a hyphen, we should choose a prefix rather
* than a suffix.
*/
#if !defined(MDN_AMCACEZ_PREFIX) && !defined(MDN_AMCACEZ_SUFFIX)
#define MDN_AMCACEZ_PREFIX "zq--"
#endif
#define INVALID_UCS 0x80000000
#define MAX_UCS 0x10FFFF
/*
* As the draft states, it is possible that `delta' may overflow during
* the encoding. The upper bound of 'delta' is:
* <# of chars. of input string> + <max. difference in code point> *
* <# of chars. of input string + 1>
* For this value not to be greater than 0xffffffff (since the calculation
* is done using unsigned long, which is at least 32bit long), the maxmum
* input string size is about 3850 characters, which is long enough for
* a domain label...
*/
#define AMCACEZ_MAXINPUT 3800
/*
* Parameters.
*/
#define AMCACEZ_BASE 36
#define AMCACEZ_TMIN 1
#define AMCACEZ_TMAX 26
#define AMCACEZ_SKEW 38
#define AMCACEZ_DAMP 700
#define AMCACEZ_INITIAL_BIAS 72
#define AMCACEZ_INITIAL_N 0x80
static mdn_result_t amcacez_decode(const char *from, size_t fromlen,
char *to, size_t tolen);
static mdn_result_t amcacez_encode(const char *from, size_t fromlen,
char *to, size_t tolen);
static int amcacez_getwc(const char *s, size_t len,
int bias, unsigned long *vp);
static int amcacez_putwc(char *s, size_t len,
unsigned long delta, int bias);
static int amcacez_update_bias(unsigned long delta,
size_t npoints, int first);
static mdn__ace_t amcacez_profile = {
#ifdef MDN_AMCACEZ_PREFIX
mdn__ace_prefix,
MDN_AMCACEZ_PREFIX,
#else
mdn__ace_suffix,
MDN_AMCACEZ_SUFFIX,
#endif
amcacez_encode,
amcacez_decode,
};
/* ARGSUSED */
mdn_result_t
mdn__amcacez_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata)
{
return (mdn_success);
}
/* ARGSUSED */
mdn_result_t
mdn__amcacez_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir)
{
return (mdn_success);
}
mdn_result_t
mdn__amcacez_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir,
const char *from, char *to, size_t tolen)
{
mdn_result_t r;
assert(ctx != NULL &&
(dir == mdn_converter_l2u || dir == mdn_converter_u2l));
TRACE(("mdn__amcacez_convert(dir=%s,from=\"%s\")\n",
dir == mdn_converter_l2u ? "l2u" : "u2l",
mdn_debug_xstring(from, 20)));
r = mdn__ace_convert(&amcacez_profile, dir, from, to, tolen);
if (r != mdn_success)
return (r);
DUMP(("mdn__amcacez_convert: \"%s\"\n", mdn_debug_xstring(to, 70)));
return (r);
}
static mdn_result_t
amcacez_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
unsigned long *ucs, ucs_tmp[64], c, idx;
size_t uidx, fidx, ucslen;
int first, bias;
mdn_result_t r;
/*
* Allocate enough memory for UCS-4 code point array 'ucs'.
*/
if (fromlen > 64) {
ucs = malloc(fromlen * sizeof(unsigned long));
if (ucs == NULL)
return (mdn_nomemory);
} else {
ucs = ucs_tmp;
}
ucslen = 0;
/*
* Find the last delimiter, and copy the characters
* before it verbatim.
*/
for (fidx = fromlen; fidx > 0; fidx--) {
if (from[fidx - 1] == '-') {
for (uidx = 0; uidx < fidx - 1; uidx++) {
ucs[uidx] = from[uidx];
}
ucslen = uidx;
break;
}
}
first = 1;
bias = AMCACEZ_INITIAL_BIAS;
c = AMCACEZ_INITIAL_N;
idx = 0;
while (fidx < fromlen) {
int len;
unsigned long delta;
int i;
len = amcacez_getwc(from + fidx, fromlen - fidx, bias, &delta);
if (len == 0)
return (mdn_invalid_encoding);
fidx += len;
bias = amcacez_update_bias(delta, ucslen + 1, first);
first = 0;
idx += delta;
c += idx / (ucslen + 1);
uidx = idx % (ucslen + 1);
/* Insert 'c' at uidx. */
for (i = ucslen; i > uidx; i--)
ucs[i] = ucs[i - 1];
ucs[uidx] = c;
ucslen++;
idx = uidx + 1;
}
/*
* Convert from UCS-4 to UTF-8.
*/
for (uidx = 0; uidx < ucslen; uidx++) {
int len = mdn_utf8_putwc(to, tolen, ucs[uidx]);
if (len == 0)
goto overflow;
to += len;
tolen -= len;
}
/* Terminate with NUL. */
if (tolen <= 0)
goto overflow;
*to = '\0';
r = mdn_success;
ret:
if (ucs != ucs_tmp)
free(ucs);
return (r);
overflow:
r = mdn_buffer_overflow;
goto ret;
}
static mdn_result_t
amcacez_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
unsigned long *ucs, ucs_tmp[64];
unsigned long cur_code, next_code, delta;
size_t ucslen, ucsdone;
size_t toidx;
int uidx, bias, first;
mdn_result_t r;
/*
* Convert UTF-8 string 'from' to UCS-4 code point array 'ucs'.
*/
if (fromlen > 64) {
ucs = malloc(fromlen * sizeof(unsigned long));
if (ucs == NULL)
return (mdn_nomemory);
} else {
ucs = ucs_tmp;
}
ucslen = 0;
while (fromlen > 0) {
unsigned long c;
int len;
len = mdn_utf8_getwc(from, fromlen, &c);
if (len == 0 || c > MAX_UCS)
goto invalid;
ucs[ucslen++] = c;
from += len;
fromlen -= len;
}
/*
* If the input string is too long (actually too long to be sane),
* return failure in order to prevent possible overflow.
*/
if (ucslen > AMCACEZ_MAXINPUT)
return (mdn_failure);
ucsdone = 0; /* number of characters processed */
toidx = 0;
/*
* First, pick up basic code points and copy them to 'to'.
*/
for (uidx = 0; uidx < ucslen; uidx++) {
if (ucs[uidx] < 0x80) {
if (toidx >= tolen)
goto overflow;
to[toidx++] = ucs[uidx];
ucsdone++;
}
}
/*
* If there are any basic code points, output a delimiter
* (hyphen-minus).
*/
if (toidx > 0) {
if (toidx >= tolen)
goto overflow;
to[toidx++] = '-';
to += toidx;
tolen -= toidx;
}
/*
* Then encode non-basic characters.
*/
first = 1;
cur_code = AMCACEZ_INITIAL_N;
bias = AMCACEZ_INITIAL_BIAS;
delta = 0;
while (ucsdone < ucslen) {
int limit = -1, rest;
/*
* Find the smallest code point equal to or greater
* than 'cur_code'. Also remember the index of the
* last occurence of the code point.
*/
for (next_code = MAX_UCS, uidx = ucslen - 1;
uidx >= 0; uidx--) {
if (ucs[uidx] >= cur_code && ucs[uidx] < next_code) {
next_code = ucs[uidx];
limit = uidx;
}
}
/* There must be such code point. */
assert(limit >= 0);
delta += (next_code - cur_code) * (ucsdone + 1);
cur_code = next_code;
/*
* Scan the input string again, and encode characters
* whose code point is 'cur_code'. Use 'limit' to avoid
* unnecessary scan.
*/
for (uidx = 0, rest = ucsdone; uidx <= limit; uidx++) {
if (ucs[uidx] < cur_code) {
delta++;
rest--;
} else if (ucs[uidx] == cur_code) {
int sz = amcacez_putwc(to, tolen, delta, bias);
if (sz == 0)
goto overflow;
to += sz;
tolen -= sz;
ucsdone++;
bias = amcacez_update_bias(delta, ucsdone,
first);
delta = 0;
first = 0;
}
}
delta += rest + 1;
cur_code++;
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
goto overflow;
*to = '\0';
r = mdn_success;
ret:
if (ucs != ucs_tmp)
free(ucs);
return (r);
invalid:
r = mdn_invalid_encoding;
goto ret;
overflow:
r = mdn_buffer_overflow;
goto ret;
}
static int
amcacez_getwc(const char *s, size_t len, int bias, unsigned long *vp) {
size_t orglen = len;
unsigned long v = 0, w = 1;
int k;
for (k = AMCACEZ_BASE - bias; len > 0; k += AMCACEZ_BASE) {
int c = *s++;
int t = (k < AMCACEZ_TMIN) ? AMCACEZ_TMIN :
(k > AMCACEZ_TMAX) ? AMCACEZ_TMAX : k;
len--;
if ('a' <= c && c <= 'z')
c = c - 'a';
else if ('A' <= c && c <= 'Z')
c = c - 'A';
else if ('0' <= c && c <= '9')
c = c - '0' + 26;
else
c = -1;
if (c < 0)
return (0); /* invalid character */
v += c * w;
if (c < t) {
*vp = v;
return (orglen - len);
}
w *= (AMCACEZ_BASE - t);
}
return (0); /* final character missing */
}
static int
amcacez_putwc(char *s, size_t len, unsigned long delta, int bias) {
const char *amcacez_base36 = "abcdefghijklmnopqrstuvwxyz0123456789";
int k;
char *sorg = s;
for (k = AMCACEZ_BASE - bias; 1; k += AMCACEZ_BASE) {
int t = (k < AMCACEZ_TMIN) ? AMCACEZ_TMIN :
(k > AMCACEZ_TMAX) ? AMCACEZ_TMAX : k;
if (delta < t)
break;
if (len < 1)
return (0);
*s++ = amcacez_base36[t + ((delta - t) % (AMCACEZ_BASE - t))];
len--;
delta = (delta - t) / (AMCACEZ_BASE - t);
}
if (len < 1)
return (0);
*s++ = amcacez_base36[delta];
return (s - sorg);
}
static int
amcacez_update_bias(unsigned long delta, size_t npoints, int first) {
int k = 0;
delta /= first ? AMCACEZ_DAMP : 2;
delta += delta / npoints;
while (delta > ((AMCACEZ_BASE - AMCACEZ_TMIN) * AMCACEZ_TMAX) / 2) {
delta /= AMCACEZ_BASE - AMCACEZ_TMIN;
k++;
}
return (AMCACEZ_BASE * k +
(((AMCACEZ_BASE - AMCACEZ_TMIN + 1) * delta) /
(delta + AMCACEZ_SKEW)));
}
-506
View File
@@ -1,506 +0,0 @@
#ifndef lint
static char *rcsid = "$Id: mace.c,v 1.1 2002/02/08 05:40:14 marka Exp $";
#endif
/*
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <mdn/result.h>
#include <mdn/assert.h>
#include <mdn/logmacro.h>
#include <mdn/converter.h>
#include <mdn/utf8.h>
#include <mdn/debug.h>
#include <mdn/mace.h>
#include <mdn/ace.h>
#include <mdn/util.h>
/*
* MACE
*/
#ifndef MDN_MACE_PREFIX
#define MDN_MACE_PREFIX "mq--"
#endif
/* Mode switcher */
#define MACE_MODE_SWITCH '-' /* Literal/Non-Literal switching */
/* Submode introducer */
#define MACE_SUBMODE_BMP_A 'w' /* U+0000-U+1FFF, U+A000-U+FFFF */
#define MACE_SUBMODE_BMP_B 'x' /* U+2000-U+9FFF */
#define MACE_SUBMODE_NONBMP 'y' /* U+10000-U+10FFFF */
#define MACE_SUBMODE_COMP 'z' /* 4/9bit differential encoding */
/* Initial state */
#define MACE_SUBMODE_INIT MACE_SUBMODE_BMP_A
#define MACE_PREV_INIT 0
#define MACE_COMP_BITS_1 4
#define MACE_COMP_BITS_2 9
#define MACE_COMP_MASK ((1 << MACE_COMP_BITS_2) - 1)
#define MACE_SAME_PREFIX(b, c1, c2) (((c1) ^ (c2)) < (1 << (b)))
#define MACE_INVALID_CHAR 0x80000000
static mdn_result_t mace_decode(const char *from, size_t fromlen,
char *to, size_t tolen);
static mdn_result_t mace_encode(const char *from, size_t fromlen,
char *to, size_t tolen);
static int mace_get_submode(int submode, unsigned long c,
unsigned long prev,
const char *rest, size_t rlen);
static int mace_getbase32(const char *s, int w,
unsigned long *vp);
static int mace_encodelength(int submode);
static int mace_getwc(const char *s, size_t len, int mode,
unsigned long ref, unsigned long *vp);
static int mace_putwc(char *s, size_t len, int mode,
unsigned long ref, unsigned long v);
static int peek_next_nonldh(const char *rest, size_t rlen,
unsigned long *cp);
static int letter_or_digit(unsigned long v);
static mdn__ace_t mace_ctx = {
mdn__ace_prefix,
MDN_MACE_PREFIX,
mace_encode,
mace_decode,
};
/* ARGSUSED */
mdn_result_t
mdn__mace_open(mdn_converter_t ctx, mdn_converter_dir_t dir,
void **privdata)
{
return (mdn_success);
}
/* ARGSUSED */
mdn_result_t
mdn__mace_close(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir)
{
return (mdn_success);
}
mdn_result_t
mdn__mace_convert(mdn_converter_t ctx, void *privdata,
mdn_converter_dir_t dir,
const char *from, char *to, size_t tolen)
{
mdn_result_t r;
assert(ctx != NULL &&
(dir == mdn_converter_l2u || dir == mdn_converter_u2l));
TRACE(("mdn__mace_convert(dir=%s,from=\"%s\")\n",
dir == mdn_converter_l2u ? "l2u" : "u2l",
mdn_debug_xstring(from, 20)));
r = mdn__ace_convert(&mace_ctx, dir, from, to, tolen);
if (r != mdn_success)
return (r);
DUMP(("mdn__mace_convert: \"%s\"\n", mdn_debug_xstring(to, 70)));
return (r);
}
static mdn_result_t
mace_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal = 0;
int submode = MACE_SUBMODE_INIT;
unsigned long prev = MACE_PREV_INIT;
while (fromlen > 0) {
int consume = 1; /* # of input octets consumed */
unsigned long c = MACE_INVALID_CHAR;
if (from[0] == MACE_MODE_SWITCH) {
/*
* LD/non-LD mode switcher or just a hyphen.
*/
if (fromlen > 1 && from[1] == MACE_MODE_SWITCH) {
c = MACE_MODE_SWITCH;
consume = 2;
} else {
literal = !literal;
}
} else if (literal) {
/*
* Now in LD mode. Just output literally.
*/
if (tolen < 1)
return (mdn_buffer_overflow);
c = from[0];
} else if (from[0] == 'w' || from[0] == 'W') {
submode = MACE_SUBMODE_BMP_A;
} else if (from[0] == 'x' || from[0] == 'X') {
submode = MACE_SUBMODE_BMP_B;
} else if (from[0] == 'y' || from[0] == 'Y') {
submode = MACE_SUBMODE_NONBMP;
} else if (from[0] == 'z' || from[0] == 'Z') {
submode = MACE_SUBMODE_COMP;
} else {
/*
* Must be base32-format string.
*/
consume = mace_getwc(from, fromlen, submode,
prev, &c);
if (consume == 0)
return (mdn_invalid_encoding);
prev = c;
}
/* Output decoded character. */
if (c != MACE_INVALID_CHAR) {
size_t len = mdn_utf8_putwc(to, tolen, c);
if (len == 0)
return (mdn_buffer_overflow);
to += len;
tolen -= len;
}
from += consume;
fromlen -= consume;
}
/*
* Terminate with NUL.
*/
if (tolen <= 0)
return (mdn_buffer_overflow);
*to = '\0';
return (mdn_success);
}
static mdn_result_t
mace_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
int literal = 0;
int submode = MACE_SUBMODE_INIT;
unsigned long prev = MACE_PREV_INIT;
while (fromlen > 0) {
unsigned long c;
size_t len;
/* Get next character. */
len = mdn_utf8_getwc(from, fromlen, &c);
if (len == 0 || c > 0x10ffff)
return (mdn_invalid_encoding);
from += len;
fromlen -= len;
if (c == '-') {
/*
* Hyphen. Always encode as `--'.
*/
if (tolen < 2)
return (mdn_buffer_overflow);
to[0] = to[1] = '-';
to += 2;
tolen -= 2;
} else if (letter_or_digit(c)) {
/*
* Letter or digit.
* Shift to Literal mode if necessary, then
* encode it as it is.
*/
if (!literal) {
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = MACE_MODE_SWITCH;
tolen--;
literal = 1;
}
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = c;
tolen--;
} else {
/*
* Non-LDH character.
*/
int new_submode;
/* Move back from LD mode if necessary. */
if (literal) {
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = MACE_MODE_SWITCH;
tolen--;
literal = 0;
}
/* Determine the new submode and shift to it. */
new_submode = mace_get_submode(submode, c, prev,
from, fromlen);
if (new_submode != submode) {
if (tolen < 1)
return (mdn_buffer_overflow);
*to++ = new_submode; /* introducer */
tolen--;
submode = new_submode;
}
/* Encode and output the character. */
len = mace_putwc(to, tolen, submode, prev, c);
if (len == 0)
return (mdn_buffer_overflow);
to += len;
tolen -= len;
prev = c;
}
}
/*
* Terminate with NUL.
*/
if (tolen < 1)
return (mdn_buffer_overflow);
*to = '\0';
return (mdn_success);
}
static int
mace_get_submode(int submode, unsigned long c, unsigned long prev,
const char *rest, size_t rlen)
{
/*
* Determine the submode.
*/
unsigned long nxt;
/*
* First, check if we should use Compress submode.
*/
if (MACE_SAME_PREFIX(MACE_COMP_BITS_2, prev, c) &&
(submode == MACE_SUBMODE_COMP ||
c > 0xffff ||
MACE_SAME_PREFIX(MACE_COMP_BITS_1, prev, c) ||
(peek_next_nonldh(rest, rlen, &nxt) &&
MACE_SAME_PREFIX(MACE_COMP_BITS_2, c, nxt))))
return (MACE_SUBMODE_COMP);
/*
* Then, determine the submode based on the code point.
*/
if (c > 0xffff)
return (MACE_SUBMODE_NONBMP);
else if (0x2000 <= c && c <= 0x9fff)
return (MACE_SUBMODE_BMP_B);
else
return (MACE_SUBMODE_BMP_A);
}
static int
mace_encodelength(int submode) {
switch (submode) {
case MACE_SUBMODE_BMP_A:
case MACE_SUBMODE_BMP_B:
return (3);
case MACE_SUBMODE_NONBMP:
return (4);
default: /* MACE_SUBMODE_COMP */
return (1); /* actually 1 or 2. caller must decide. */
}
}
static int
mace_getbase32(const char *s, int w, unsigned long *vp) {
unsigned long v = 0;
while (w-- > 0) {
int c = *s++;
if ('a' <= c && c <= 'v')
c = c - 'a' + 10;
else if ('A' <= c && c <= 'V')
c = c - 'A' + 10;
else if ('0' <= c && c <= '9')
c = c - '0';
else
return (0); /* invalid character */
v = (v << 5) + (c & 0x1f);
}
*vp = v;
return (1);
}
static int
mace_getwc(const char *s, size_t len, int submode,
unsigned long prev, unsigned long *vp)
{
unsigned long v = 0;
int w = mace_encodelength(submode);
if (len < w || !mace_getbase32(s, w, &v))
return (0);
switch (submode) {
case MACE_SUBMODE_BMP_A:
if (v >= 0x2000)
v += 0x8000;
break;
case MACE_SUBMODE_BMP_B:
v += 0x2000;
break;
case MACE_SUBMODE_NONBMP:
v += 0x10000;
break;
case MACE_SUBMODE_COMP:
if (v > 0xf) {
w = 2;
if (len < w || !mace_getbase32(s, w, &v))
return (0);
}
v = prev ^ (v & MACE_COMP_MASK);
break;
default:
FATAL(("mace_getwc: internal error"));
break;
}
*vp = v;
return (w);
}
static int
mace_putwc(char *s, size_t len, int submode,
unsigned long prev, unsigned long v)
{
static const char *base32encode = "0123456789abcdefghijklmnopqrstuv";
int w = mace_encodelength(submode);
int i;
switch (submode) {
case MACE_SUBMODE_BMP_A:
if (v >= 0xa000)
v -= 0x8000;
break;
case MACE_SUBMODE_BMP_B:
v -= 0x2000;
break;
case MACE_SUBMODE_NONBMP:
v -= 0x10000;
break;
case MACE_SUBMODE_COMP:
v = (prev ^ v) & MACE_COMP_MASK;
if (v > 0xf) {
v |= 0x200;
w++;
}
break;
default:
FATAL(("mace_putwc: internal error"));
break;
}
if (len < w)
return (0);
for (i = w - 1; i >= 0; i--) {
s[i] = base32encode[v & 0x1f];
v >>= 5;
}
return (w);
}
static int
peek_next_nonldh(const char *rest, size_t rlen, unsigned long *cp) {
/*
* Get the next non-LDH character from 'rest', store its
* code point to '*cp' and return 1. If there are no
* such character, return 0.
*/
while (rlen > 0) {
unsigned long v;
size_t len;
if ((len = mdn_utf8_getwc(rest, rlen, &v)) == 0) {
break;
} else if (v != '-' && !letter_or_digit(v)) {
*cp = v;
return (1);
}
rest += len;
rlen -= len;
}
return (0);
}
static int
letter_or_digit(unsigned long v) {
if (('a' <= v && v <= 'z') ||
('A' <= v && v <= 'Z') ||
('0' <= v && v <= '9'))
return (1);
else
return (0);
}
-145
View File
@@ -1,145 +0,0 @@
/* $Id: unicode_template.c,v 1.1 2002/02/08 05:40:41 marka Exp $ */
/*
* Copyright (c) 2000,2001 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) Japan Network Information Center. All rights reserved."
*
* 4. Neither the name of JPNIC may be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 6. Indemnification by Licensee
* Any person or entities using and/or redistributing this Software under
* this License Terms and Conditions shall defend indemnify and hold
* harmless JPNIC from and against any and all judgements damages,
* expenses, settlement liabilities, cost and other liabilities of any
* kind as a result of use and redistribution of this Software or any
* claim, suite, action, litigation or proceeding by any third party
* arising out of or relates to this License Terms and Conditions.
*
* 7. Governing Law, Jurisdiction and Venue
* This License Terms and Conditions shall be governed by and and
* construed in accordance with the law of Japan. Any person or entities
* using and/or redistributing this Software under this License Terms and
* Conditions hereby agrees and consent to the personal and exclusive
* jurisdiction and venue of Tokyo District Court of Japan.
*/
#ifndef UNICODE_TEMPLATE_INIT
#define UNICODE_TEMPLATE_INIT
/*
* Macro for multi-level index table.
*/
#define LOOKUPTBL(vprefix, mprefix, v) \
DMAP(vprefix)[\
IMAP(vprefix)[\
IMAP(vprefix)[IDX0(mprefix, v)] + IDX1(mprefix, v)\
]\
].tbl[IDX2(mprefix, v)]
#define IDX0(mprefix, v) IDX_0(v, BITS1(mprefix), BITS2(mprefix))
#define IDX1(mprefix, v) IDX_1(v, BITS1(mprefix), BITS2(mprefix))
#define IDX2(mprefix, v) IDX_2(v, BITS1(mprefix), BITS2(mprefix))
#define IDX_0(v, bits1, bits2) ((v) >> ((bits1) + (bits2)))
#define IDX_1(v, bits1, bits2) (((v) >> (bits2)) & ((1 << (bits1)) - 1))
#define IDX_2(v, bits1, bits2) ((v) & ((1 << (bits2)) - 1))
#define BITS1(mprefix) mprefix ## _BITS_1
#define BITS2(mprefix) mprefix ## _BITS_2
#define IMAP(vprefix) concat4(VERSION, _, vprefix, _imap)
#define DMAP(vprefix) concat4(VERSION, _, vprefix, _table)
#define SEQ(vprefix) concat4(VERSION, _, vprefix, _seq)
#define concat4(a,b,c,d) concat4X(a, b, c, d)
#define concat4X(a,b,c,d) a ## b ## c ## d
#endif /* UNICODE_TEMPLATE_INIT */
static int
compose_sym(canonclass_, VERSION) (unsigned long c) {
/* Look up canonicalclass table. */
return (LOOKUPTBL(canon_class, CANON_CLASS, c));
}
static int
compose_sym(decompose_, VERSION) (unsigned long c, const unsigned long **seqp)
{
/* Look up decomposition table. */
int seqidx = LOOKUPTBL(decompose, DECOMP, c);
*seqp = SEQ(decompose) + (seqidx & ~DECOMP_COMPAT);
return (seqidx);
}
static int
compose_sym(compose_, VERSION) (unsigned long c,
const struct composition **compp)
{
/* Look up composition table. */
int seqidx = LOOKUPTBL(compose, CANON_COMPOSE, c);
*compp = SEQ(compose) + (seqidx & 0xffff);
return (seqidx >> 16);
}
static int
compose_sym(toupper_, VERSION) (unsigned long c, const unsigned long **seqp) {
int seqidx = LOOKUPTBL(toupper, CASEMAP, c);
*seqp = SEQ(toupper) + seqidx;
return (seqidx);
}
static int
compose_sym(tolower_, VERSION) (unsigned long c, const unsigned long **seqp) {
int seqidx = LOOKUPTBL(tolower, CASEMAP, c);
*seqp = SEQ(tolower) + seqidx;
return (seqidx);
}
static int
compose_sym(casemapctx_, VERSION) (unsigned long c) {
return (LOOKUPTBL(casemap_ctx, CASEMAP_CTX, c));
}
static int
compose_sym(casefolding_, VERSION) (unsigned long c,
const unsigned long **seqp)
{
int seqidx = LOOKUPTBL(case_folding, CASE_FOLDING, c);
*seqp = SEQ(case_folding) + seqidx;
return (seqidx);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,132 +0,0 @@
#! /bin/sh
# $Id: mdnslookup.in,v 1.1 2002/02/08 05:41:33 marka Exp $
#
# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
#
# By using this file, you agree to the terms and conditions set forth bellow.
#
# LICENSE TERMS AND CONDITIONS
#
# The following License Terms and Conditions apply, unless a different
# license is obtained from Japan Network Information Center ("JPNIC"),
# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
# Tokyo, Japan.
#
# 1. Use, Modification and Redistribution (including distribution of any
# modified or derived work) in source and/or binary forms is permitted
# under this License Terms and Conditions.
#
# 2. Redistribution of source code must retain the copyright notices as they
# appear in each source code file, this License Terms and Conditions.
#
# 3. Redistribution in binary form must reproduce the Copyright Notice,
# this License Terms and Conditions, in the documentation and/or other
# materials provided with the distribution. For the purposes of binary
# distribution the "Copyright Notice" refers to the following language:
# "Copyright (c) Japan Network Information Center. All rights reserved."
#
# 4. Neither the name of JPNIC may be used to endorse or promote products
# derived from this Software without specific prior written approval of
# JPNIC.
#
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# 6. Indemnification by Licensee
# Any person or entities using and/or redistributing this Software under
# this License Terms and Conditions shall defend indemnify and hold
# harmless JPNIC from and against any and all judgements damages,
# expenses, settlement liabilities, cost and other liabilities of any
# kind as a result of use and redistribution of this Software or any
# claim, suite, action, litigation or proceeding by any third party
# arising out of or relates to this License Terms and Conditions.
#
# 7. Governing Law, Jurisdiction and Venue
# This License Terms and Conditions shall be governed by and and
# construed in accordance with the law of Japan. Any person or entities
# using and/or redistributing this Software under this License Terms and
# Conditions hereby agrees and consent to the personal and exclusive
# jurisdiction and venue of Tokyo District Court of Japan.
USAGE="Usage: $0 domain-name DNS-server"
#
# Parse command line arguments.
#
if [ $# -lt 2 ] ; then
echo "$0: too few argument" 1>&2
echo $USAGE 1>&2
exit 1
fi
if [ $# -gt 2 ] ; then
echo "$0: too many argument" 1>&2
echo $USAGE 1>&2
exit 1
fi
case "$1" in
-*) echo "$0: unknown option $1" 1>&2
echo $USAGE 1>&2
exit 1
;;
esac
LOCAL_DOMAIN_NAME="$1"
NAME_SERVER="$2"
#
# Append some directories to PATH.
#
[ -d /usr/sbin ] && PATH=$PATH:/usr/sbin
[ -d /sbin ] && PATH=$PATH:/sbin
#
# Find `nslookup' command.
#
if [ x"$NSLOOKUP" = x ] ; then
for I in `echo $PATH | sed -e 's/:/ /g'` ; do
if [ -x $I/nslookup ] ; then
NSLOOKUP="$I/nslookup"
break
fi
done
if [ "$NSLOOKUP" = "" ] ; then
echo "$0: nslookup not found" 1>&2
exit 1
fi
fi
if [ ! -x "$NSLOOKUP" ] ; then
echo "$0: nslookup not found" 1>&2
exit 1
fi
#
# Check if `mdnconv' command exists.
#
MDNCONV=${MDNCONV-"@bindir@/mdnconv"}
if [ ! -x "$MDNCONV" ] ; then
echo "$0: mdnconv not found" 1>&2
exit 1
fi
#
# Convert domain name to IDN encoding.
#
IDN_DOMAIN_NAME="`echo $LOCAL_DOMAIN_NAME | $MDNCONV -w`" || exit 1
#
# Invoke nslookup.
#
$NSLOOKUP $IDN_DOMAIN_NAME $NAME_SERVER < /dev/null || exit 1
exit 0
-191
View File
@@ -1,191 +0,0 @@
@(#) $Id: CHANGES,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
v2.1 Wed Aug 22 18:30:35 PDT 2001
- Handle "srv" records.
- Fix some ttl parsing problems.
- Add "ignore" option
v2.0.2 Tue Mar 20 17:49:13 PST 2001
- Allow missing trailing dot in certain special cases.
- Include zone names when checking NS records.
- Document nslint.conf network keyword.
v2.0.1 Tue Dec 14 11:24:31 PST 1999
- Handle $ttl.
- Fix some minor portability/compiler problems for OSF 4.
- Correctly detect mx records that point to themselves but not a
real "a" record.
- Fix file descriptor leak in doconf(). Thanks to Paul McIlfatrick
(paul.mcilfatrick@bt.com)
v2.0 Wed Dec 9 16:48:54 PST 1998
- Add support for BIND 8 named.conf file.
- Support protocols in addition to tcp and udp for WKS records.
Resulted from a bug report from Petter Reinholdtsen (pere@td.org.uit.no)
- Support dotted serial numbers in SOA records. Resulted from a
bug report from Frank Ederveen (frank@our.domaintje.com)
- Ignore unknown statements and options in named.boot and named.conf
(instead of issuing warnings).
- Handle '#' and C style named.conf comments.
- Handle optional "in" in named.conf zone statements. Reported by
DJ Coster (djc@discoverbrokerage.com)
- Add support for include directives in named.boot and named.conf.
- Redo differing ttls check and do mx records in addition to a
records. Change place where soa values gets zeroed so they don't
get clobbered when we use includes.
- Allow "@" abbr. for ptr, mx, cname and ns records.
- Detect cname referenced by another cname or mx record.
- Handle chaos records (to some minor extent).
v1.7 Tue Jul 22 14:26:21 PDT 1997
- Report differing ttls in A records. Check SOA records.
- Detect hosts with more than one ip address on a subnet.
v1.6.1 Sat Jun 7 03:12:01 PDT 1997
- Fix "unknown service" printf format.
- Fix off-by-one error in the ptr parsing code. Thanks to Andreas
Lamprecht (andreas.lamprecht@siemens.at)
- Fix broken $origin code.
v1.6 Mon Apr 7 19:09:52 PDT 1997
- Add support for classless delegation.
- Fix some case sensitive bugs.
- Report domain names outside the current zone.
- Fixed off-by-one bug that broke single character hostnames.
- Increase size of hash table.
- Make tcp and udp service name tables dynamic.
- Improved error message for garbage in /etc/services.
v1.5.1 Thu Jul 18 21:44:44 PDT 1996
- Use $CC when checking gcc version. Thanks to Carl Lindberg
(carl_lindberg@blacksmith.com)
- Raise size of hash table to 65K.
v1.5 Fri Jul 12 18:58:47 PDT 1996
- Detect extra octets and other garbage in PTR records.
- Handle multi-line WKS records.
- Allow multple WKS records (since we can have udp and tcp).
- Convert to autoconf.
- Declare optarg, optind and opterr extern. Thanks to Howard Moftich
(howardm@lsil.com).
- BS/DOS does not have malloc.h. Thanks to Jordan Hayes
(jordan@thinkbank.com).
- Correctly handle named.boot comments with leading whitespace.
- Handle fully specified in-addr.arpa records. Resulted from a bug
report from Joe Kelly (joe@gol.com).
- Fix endian problems. Thanks to Carl Lindberg (carl_lindberg@blacksmith.com).
- Fixed some mixed case problems.
- Update man page to describe how nslint.boot works.
v1.4 Sat Jun 3 23:38:14 PDT 1995
- Allow TXT records to exist with no other records.
- Full system prototypes.
- Complain about extra arguments.
- Detect MX record chains.
- Handle single line SOA records correctly. Thanks to Edward J. O'Brien
(ejobrie@sam.wal-mart.com)
v1.3 Wed Mar 8 17:27:20 PST 1995
- Add "allowdupa" record type for use with nslint.boot. This allows ip
addresses to have multiple A records.
- Fixed bug that caused dangling cname references to not be reported
properly. Thanks to Edward J. O'Brien (ejobrie@sam.wal-mart.com).
v1.2 Thu Sep 1 15:55:38 PDT 1994
- Allow hostnames with a leading numeric as per rfc1123. Thanks to Bill
Gianopoulos (wag@sccux1.msd.ray.com).
- Remove (undocumented) -u flag and allow uppercase.
- Support TXT records. Thanks to Paul Pomes (paul@uxc.cso.uiuc.edu).
- Support RP records.
- Ignore new bind keywords.
- Fix bug where we could exit with a zero status even though errors had
been detected
- Complain about hosts that have smtp/tcp WKS entries but no MX records.
- Add -B flag to handle PTR records that point outside the domains
listed in named.boot.
v1.1 Sun May 22 20:43:03 PDT 1994
- Allow ns records with no a records (the preferred way to go).
- Fix typos in the sawstr array.
- Use string.h instead of strings.h and add rindex(), index() and
bzero() macros for SYSV compatibility. Thanks to Bill King
(wrk@cle.ab.com).
- Handle $origin directives. Thanks to Bill Gianopoulos
(wag@sccux1.msd.ray.com).
- Fix add_domain() to work for the root. Thanks to Bill Gianopoulos.
- Handle quotes in hinfo records. Thanks to Bill Gianopoulos.
- Fix endian problems in parseinaddr() and parseptr().
- Check non in-addr.arpa names for cname conflicts.
v1.0 Thu Apr 21 11:02:59 PDT 1994
- Initial release.
-24
View File
@@ -1,24 +0,0 @@
CHANGES
FILES
INSTALL
Makefile.in
README
VERSION
aclocal.m4
config.guess
config.sub
configure
configure.in
install-sh
lbl/gnuc.h
lbl/os-irix5.h
lbl/os-osf3.h
lbl/os-solaris2.h
lbl/os-sunos4.h
lbl/os-ultrix4.h
mkdep
nslint.8
nslint.c
savestr.c
savestr.h
strerror.c
-42
View File
@@ -1,42 +0,0 @@
@(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/INSTALL,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
You will need an ANSI C compiler to build nslint. The configure
script will abort if your compiler is not ANSI compliant. If this
happens, use the GNU C compiler, available via anonymous ftp:
ftp://prep.ai.mit.edu/pub/gnu/gcc.tar.gz
If necessary, edit the BINDEST and MANDEST paths in Makefile.in
and run ./configure (a shell script). "configure" will determine
your system attributes and generate an appropriate Makefile from
Makefile.in. Now build nslint by running "make".
If everything builds ok, su and type "make install" (and optionally
"make install-man). This will install nslint and its manual entry.
If your system is not one which we have tested nslint on, you may
have to modify the configure script and Makefile.in. Please send
us patches for any modifications you need to make.
FILES
-----
CHANGES - description of differences between releases
FILES - list of files exported as part of the distribution
INSTALL - this file
Makefile.in - compilation rules (input to the configure script)
README - description of distribution
VERSION - version of this release
aclocal.m4 - autoconf macros
config.guess - autoconf support
config.sub - autoconf support
configure - configure script (run this first)
configure.in - configure script source
install-sh - BSD style install script
lbl/gnuc.h - gcc macros and defines
lbl/os-*.h - os dependent defines and prototypes
mkdep - construct Makefile dependency list
nslint.8 - manual entry
nslint.c - main program
savestr.c - strdup() replacement
savestr.h - savestr prototypes
strerror.c - missing routine
-122
View File
@@ -1,122 +0,0 @@
# Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997, 2000
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Id: Makefile.in,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
# Top level hierarchy
prefix = @prefix@
exec_prefix = @exec_prefix@
# Pathname of directory to install the binary
BINDEST = @bindir@
# Pathname of directory to install the man page
MANDEST = @mandir@
# VPATH
srcdir = @srcdir@
VPATH = @srcdir@
#
# You shouldn't need to edit anything below here.
#
PROG = nslint
CC = @CC@
CCOPT = @V_CCOPT@
INCLS = @V_INCLS@
DEFS = @DEFS@
# Standard CFLAGS
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
# Standard LIBS
LIBS = @LIBS@
INSTALL = @INSTALL@
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.c.o:
@rm -f $@
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
CSRC = nslint.c savestr.c
GENSRC = version.c
SRC = $(CSRC) $(GENSRC)
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
TAGHDR = \
/usr/include/sys/types.h \
/usr/include/netinet/in.h
TAGFILES = $(SRC) $(TAGHDR)
CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
$(PROG): $(OBJ)
@rm -f $@
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS)
version.o: version.c
version.c: $(srcdir)/VERSION
@rm -f $@
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
install: force
$(INSTALL) -m 555 -o bin -g bin $(PROG) $(DESTDIR)$(BINDEST)/$(PROG)
install-man: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).8 \
$(DESTDIR)$(MANDEST)/man8/$(PROG).8
clean: force
rm -f $(CLEANFILES)
distclean: force
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
gnuc.h os-proto.h
tags: $(TAGFILES)
ctags -wtd $(TAGFILES)
tar: force
@cwd=`pwd` ; name=$(PROG)-`cat VERSION` ; \
list="" ; tar="tar chf" ; temp="$$name.tar.gz" ; \
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
echo \
"rm -f $$name; ln -s . $$name" ; \
rm -f $$name; ln -s . $$name ; \
echo \
"$$tar - [lots of files] | gzip > $$temp" ; \
$$tar - $$list | gzip > $$temp ; \
echo \
"rm -f $$name" ; \
rm -f $$name
force: /tmp
depend: $(GENSRC) force
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
-14
View File
@@ -1,14 +0,0 @@
@(#) $Id: README,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
NSLINT 2.0
Lawrence Berkeley National Laboratory
Network Research Group
nslint@ee.lbl.gov
ftp://ftp.ee.lbl.gov/nslint.tar.gz
This directory contains source code for nslint, a lint program for dns
files.
Please send bugs and comments to nslint@ee.lbl.gov.
- Craig Leres
-1
View File
@@ -1 +0,0 @@
2.1a3
-765
View File
@@ -1,765 +0,0 @@
dnl @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/aclocal.m4,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998, 1999
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that: (1) source code distributions
dnl retain the above copyright notice and this paragraph in its entirety, (2)
dnl distributions including binary code include the above copyright notice and
dnl this paragraph in its entirety in the documentation or other materials
dnl provided with the distribution, and (3) all advertising materials mentioning
dnl features or use of this software display the following acknowledgement:
dnl ``This product includes software developed by the University of California,
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
dnl the University nor the names of its contributors may be used to endorse
dnl or promote products derived from this software without specific prior
dnl written permission.
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl
dnl LBL autoconf macros
dnl
dnl
dnl Determine which compiler we're using (cc or gcc)
dnl If using gcc, determine the version number
dnl If using cc, require that it support ansi prototypes
dnl If using gcc, use -O2 (otherwise use -O)
dnl If using cc, explicitly specify /usr/local/include
dnl
dnl usage:
dnl
dnl AC_LBL_C_INIT(copt, incls)
dnl
dnl results:
dnl
dnl $1 (copt set)
dnl $2 (incls set)
dnl CC
dnl LDFLAGS
dnl LBL_CFLAGS
dnl
AC_DEFUN(AC_LBL_C_INIT,
[AC_PREREQ(2.12)
AC_BEFORE([$0], [AC_PROG_CC])
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL])
AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
$1="-O"
$2=""
if test "${srcdir}" != "." ; then
$2="-I\$\(srcdir\)"
fi
if test "${CFLAGS+set}" = set; then
LBL_CFLAGS="$CFLAGS"
fi
if test -z "$CC" ; then
case "$target_os" in
bsdi*)
AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
if test $SHLICC2 = yes ; then
CC=shlicc2
export CC
fi
;;
esac
fi
if test -z "$CC" -a "$with_gcc" = no ; then
CC=cc
export CC
fi
AC_PROG_CC
if test "$GCC" != yes ; then
AC_MSG_CHECKING(that $CC handles ansi prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_lbl_cc_ansi_prototypes=yes,
ac_cv_lbl_cc_ansi_prototypes=no))
AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
case "$target_os" in
hpux*)
AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_lbl_cc_hpux_cc_aa=yes,
ac_cv_lbl_cc_hpux_cc_aa=no))
AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
CFLAGS="$savedcflags"
$1="-Aa $$1"
AC_DEFINE(_HPUX_SOURCE)
;;
*)
AC_MSG_ERROR(see the INSTALL doc for more info)
;;
esac
fi
$2="$$2 -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
case "$target_os" in
irix*)
$1="$$1 -xansi -signed -g3"
;;
osf*)
$1="$$1 -std1 -g3"
;;
ultrix*)
AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[struct a { int b; };
void c(const struct a *)],
ac_cv_lbl_cc_const_proto=yes,
ac_cv_lbl_cc_const_proto=no))
AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
if test $ac_cv_lbl_cc_const_proto = no ; then
AC_DEFINE(const,)
fi
;;
esac
fi
])
dnl
dnl Use pfopen.c if available and pfopen() not in standard libraries
dnl Require libpcap
dnl Look for libpcap in ..
dnl Use the installed libpcap if there is no local version
dnl
dnl usage:
dnl
dnl AC_LBL_LIBPCAP(pcapdep, incls)
dnl
dnl results:
dnl
dnl $1 (pcapdep set)
dnl $2 (incls appended)
dnl LIBS
dnl LDFLAGS
dnl LBL_LIBS
dnl
AC_DEFUN(AC_LBL_LIBPCAP,
[AC_REQUIRE([AC_LBL_LIBRARY_NET])
dnl
dnl save a copy before locating libpcap.a
dnl
LBL_LIBS="$LIBS"
pfopen=/usr/examples/packetfilter/pfopen.c
if test -f $pfopen ; then
AC_CHECK_FUNCS(pfopen)
if test $ac_cv_func_pfopen = "no" ; then
AC_MSG_RESULT(Using $pfopen)
LIBS="$LIBS $pfopen"
fi
fi
AC_MSG_CHECKING(for local pcap library)
libpcap=FAIL
lastdir=FAIL
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
for dir in $places ../libpcap libpcap ; do
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
if test $lastdir = $basedir ; then
dnl skip alphas when an actual release is present
continue;
fi
lastdir=$dir
if test -r $dir/pcap.c ; then
libpcap=$dir/libpcap.a
d=$dir
dnl continue and select the last one that exists
fi
done
if test "x$libpcap" = xFAIL ; then
AC_MSG_RESULT(not found)
unset ac_cv_lbl_lib_pcap_pcap_open_live_
AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
if test "x$libpcap" = xFAIL ; then
unset ac_cv_lbl_lib_pcap_pcap_open_live_
CFLAGS="$CFLAGS -I/usr/local/include"
LIBS="$LIBS -L/usr/local/lib"
AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
if test "x$libpcap" = xFAIL ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
$2="$$2 -I/usr/local/include"
fi
LIBS="$LIBS -lpcap"
else
$1=$libpcap
$2="-I$d $$2"
AC_MSG_RESULT($libpcap)
fi
if test "x$libpcap" != "x-lpcap" ; then
LIBS="$libpcap $LIBS"
fi
case "$target_os" in
aix*)
pseexe="/lib/pse.exp"
AC_MSG_CHECKING(for $pseexe)
if test -f $pseexe ; then
AC_MSG_RESULT(yes)
LIBS="$LIBS -I:$pseexe"
fi
;;
esac])
dnl
dnl Define RETSIGTYPE and RETSIGVAL
dnl
dnl usage:
dnl
dnl AC_LBL_TYPE_SIGNAL
dnl
dnl results:
dnl
dnl RETSIGTYPE (defined)
dnl RETSIGVAL (defined)
dnl
AC_DEFUN(AC_LBL_TYPE_SIGNAL,
[AC_BEFORE([$0], [AC_LBL_LIBPCAP])
AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = void ; then
AC_DEFINE(RETSIGVAL,)
else
AC_DEFINE(RETSIGVAL,(0))
fi
case "$target_os" in
irix*)
AC_DEFINE(_BSD_SIGNALS)
;;
*)
dnl prefer sigset() to sigaction()
AC_CHECK_FUNCS(sigset)
if test $ac_cv_func_sigset = yes ; then
AC_DEFINE(signal,sigset)
else
AC_CHECK_FUNCS(sigaction)
fi
;;
esac])
dnl
dnl If using gcc, make sure we have ANSI ioctl definitions
dnl
dnl usage:
dnl
dnl AC_LBL_FIXINCLUDES
dnl
AC_DEFUN(AC_LBL_FIXINCLUDES,
[if test "$GCC" = yes ; then
AC_MSG_CHECKING(for ANSI ioctl definitions)
AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
AC_TRY_COMPILE(
[/*
* This generates a "duplicate case value" when fixincludes
* has not be run.
*/
# include <sys/types.h>
# include <sys/time.h>
# include <sys/ioctl.h>
# ifdef HAVE_SYS_IOCCOM_H
# include <sys/ioccom.h>
# endif],
[switch (0) {
case _IO('A', 1):;
case _IO('B', 1):;
}],
ac_cv_lbl_gcc_fixincludes=yes,
ac_cv_lbl_gcc_fixincludes=no))
AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
if test $ac_cv_lbl_gcc_fixincludes = no ; then
# Don't cache failure
unset ac_cv_lbl_gcc_fixincludes
AC_MSG_ERROR(see the INSTALL for more info)
fi
fi])
dnl
dnl Check for flex, default to lex
dnl Require flex 2.4 or higher
dnl Check for bison, default to yacc
dnl Default to lex/yacc if both flex and bison are not available
dnl Define the yy prefix string if using flex and bison
dnl
dnl usage:
dnl
dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
dnl
dnl results:
dnl
dnl $1 (lex set)
dnl $2 (yacc appended)
dnl $3 (optional flex and bison -P prefix)
dnl
AC_DEFUN(AC_LBL_LEX_AND_YACC,
[AC_ARG_WITH(flex, [ --without-flex don't use flex])
AC_ARG_WITH(bison, [ --without-bison don't use bison])
if test "$with_flex" = no ; then
$1=lex
else
AC_CHECK_PROGS($1, flex, lex)
fi
if test "$$1" = flex ; then
# The -V flag was added in 2.4
AC_MSG_CHECKING(for flex 2.4 or higher)
AC_CACHE_VAL(ac_cv_lbl_flex_v24,
if flex -V >/dev/null 2>&1; then
ac_cv_lbl_flex_v24=yes
else
ac_cv_lbl_flex_v24=no
fi)
AC_MSG_RESULT($ac_cv_lbl_flex_v24)
if test $ac_cv_lbl_flex_v24 = no ; then
s="2.4 or higher required"
AC_MSG_WARN(ignoring obsolete flex executable ($s))
$1=lex
fi
fi
if test "$with_bison" = no ; then
$2=yacc
else
AC_CHECK_PROGS($2, bison, yacc)
fi
if test "$$2" = bison ; then
$2="$$2 -y"
fi
if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
$1=lex
$2=yacc
fi
if test "$$1" = flex -a -n "$3" ; then
$1="$$1 -P$3"
$2="$$2 -p $3"
fi])
dnl
dnl Checks to see if union wait is used with WEXITSTATUS()
dnl
dnl usage:
dnl
dnl AC_LBL_UNION_WAIT
dnl
dnl results:
dnl
dnl DECLWAITSTATUS (defined)
dnl
AC_DEFUN(AC_LBL_UNION_WAIT,
[AC_MSG_CHECKING(if union wait is used)
AC_CACHE_VAL(ac_cv_lbl_union_wait,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/wait.h>],
[int status;
u_int i = WEXITSTATUS(status);
u_int j = waitpid(0, &status, 0);],
ac_cv_lbl_union_wait=no,
ac_cv_lbl_union_wait=yes))
AC_MSG_RESULT($ac_cv_lbl_union_wait)
if test $ac_cv_lbl_union_wait = yes ; then
AC_DEFINE(DECLWAITSTATUS,union wait)
else
AC_DEFINE(DECLWAITSTATUS,int)
fi])
dnl
dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
dnl
dnl usage:
dnl
dnl AC_LBL_SOCKADDR_SA_LEN
dnl
dnl results:
dnl
dnl HAVE_SOCKADDR_SA_LEN (defined)
dnl
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>],
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
ac_cv_lbl_sockaddr_has_sa_len=yes,
ac_cv_lbl_sockaddr_has_sa_len=no))
AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi])
dnl
dnl Checks to see if the IFF_LOOPBACK exists as a define or enum
dnl
dnl (stupidly some versions of linux use an enum...)
dnl
dnl usage:
dnl
dnl AC_LBL_IFF_LOOPBACK
dnl
dnl results:
dnl
dnl HAVE_IFF_LOOPBACK (defined)
dnl
AC_DEFUN(AC_LBL_IFF_LOOPBACK,
[AC_MSG_CHECKING(for IFF_LOOPBACK define/enum)
AC_CACHE_VAL(ac_cv_lbl_have_iff_loopback,
AC_TRY_COMPILE([
# include <sys/param.h>
# include <sys/file.h>
# include <sys/ioctl.h>
# include <sys/socket.h>
# ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
# endif
# include <sys/time.h>
# include <net/if.h>
# include <netinet/in.h>],
[int i = IFF_LOOPBACK],
ac_cv_lbl_have_iff_loopback=yes,
ac_cv_lbl_have_iff_loopback=no))
AC_MSG_RESULT($ac_cv_lbl_have_iff_loopback)
if test $ac_cv_lbl_have_iff_loopback = yes ; then
AC_DEFINE(HAVE_IFF_LOOPBACK)
fi])
dnl
dnl Checks to see if -R is used
dnl
dnl usage:
dnl
dnl AC_LBL_HAVE_RUN_PATH
dnl
dnl results:
dnl
dnl ac_cv_lbl_have_run_path (yes or no)
dnl
AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
[AC_MSG_CHECKING(for ${CC-cc} -R)
AC_CACHE_VAL(ac_cv_lbl_have_run_path,
[echo 'main(){}' > conftest.c
${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
if test ! -s conftest.out ; then
ac_cv_lbl_have_run_path=yes
else
ac_cv_lbl_have_run_path=no
fi
rm -f conftest*])
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
])
dnl
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_TYPE
dnl
dnl results:
dnl
dnl int32_t (defined)
dnl u_int32_t (defined)
dnl
AC_DEFUN(AC_LBL_CHECK_TYPE,
[AC_MSG_CHECKING(for $1 using $CC)
AC_CACHE_VAL(ac_cv_lbl_have_$1,
AC_TRY_COMPILE([
# include "confdefs.h"
# include <sys/types.h>
# if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
# endif],
[$1 i],
ac_cv_lbl_have_$1=yes,
ac_cv_lbl_have_$1=no))
AC_MSG_RESULT($ac_cv_lbl_have_$1)
if test $ac_cv_lbl_have_$1 = no ; then
AC_DEFINE($1, $2)
fi])
dnl
dnl Checks to see if unaligned memory accesses fail
dnl
dnl usage:
dnl
dnl AC_LBL_UNALIGNED_ACCESS
dnl
dnl results:
dnl
dnl LBL_ALIGN (DEFINED)
dnl
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
[AC_MSG_CHECKING(if unaligned accesses fail)
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
[case "$target_cpu" in
alpha|hp*|mips|sparc)
ac_cv_lbl_unaligned_fail=yes
;;
*)
cat >conftest.c <<EOF
# include <sys/types.h>
# include <sys/wait.h>
# include <stdio.h>
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
main() {
unsigned int i;
pid_t pid;
int status;
/* avoid "core dumped" message */
pid = fork();
if (pid < 0)
exit(2);
if (pid > 0) {
/* parent */
pid = waitpid(pid, &status, 0);
if (pid < 0)
exit(3);
exit(!WIFEXITED(status));
}
/* child */
i = *(unsigned int *)&a[[1]];
printf("%d\n", i);
exit(0);
}
EOF
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
dnl failed to compile for some reason
ac_cv_lbl_unaligned_fail=yes
else
./conftest >conftest.out
if test ! -s conftest.out ; then
ac_cv_lbl_unaligned_fail=yes
else
ac_cv_lbl_unaligned_fail=no
fi
fi
rm -f conftest* core core.conftest
;;
esac])
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
if test $ac_cv_lbl_unaligned_fail = yes ; then
AC_DEFINE(LBL_ALIGN)
fi])
dnl
dnl add all warning option to CFLAGS
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_WALL(copt)
dnl
dnl results:
dnl
dnl $1 (copt appended)
dnl ac_cv_lbl_gcc_vers
dnl
AC_DEFUN(AC_LBL_CHECK_WALL,
[ if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_lbl_gcc_vers=2
$1="`echo $$1 | sed -e 's/-O/-O2/'`"
else
AC_MSG_CHECKING(gcc version)
AC_CACHE_VAL(ac_cv_lbl_gcc_vers,
ac_cv_lbl_gcc_vers=`$CC --version 2>&1 | \
sed -e 's/\..*//'`)
AC_MSG_RESULT($ac_cv_lbl_gcc_vers)
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="`echo $$1 | sed -e 's/-O/-O2/'`"
fi
fi
if test "${LBL_CFLAGS+set}" != set; then
if test "$ac_cv_prog_cc_g" = yes ; then
$1="-g $$1"
fi
$1="$$1 -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
fi
fi
else
case "$target_os" in
irix6*)
$1="$$1 -fullwarn -n32"
;;
*)
;;
esac
fi])
dnl
dnl If using gcc and the file .devel exists:
dnl Compile with -g (if supported) and -Wall
dnl If using gcc 2, do extra prototype checking
dnl If an os prototype include exists, symlink os-proto.h to it
dnl
dnl usage:
dnl
dnl AC_LBL_DEVEL(copt)
dnl
dnl results:
dnl
dnl $1 (copt appended)
dnl HAVE_OS_PROTO_H (defined)
dnl os-proto.h (symlinked)
dnl
AC_DEFUN(AC_LBL_DEVEL,
[rm -f os-proto.h
if test "${LBL_CFLAGS+set}" = set; then
$1="$$1 ${LBL_CFLAGS}"
fi
if test -f .devel ; then
AC_LBL_CHECK_WALL($1)
os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
name="lbl/os-$os.h"
if test -f $name ; then
ln -s $name os-proto.h
AC_DEFINE(HAVE_OS_PROTO_H)
else
AC_MSG_WARN(can't find $name)
fi
fi])
dnl
dnl Improved version of AC_CHECK_LIB
dnl
dnl Thanks to John Hawkinson (jhawk@mit.edu)
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl
dnl results:
dnl
dnl LIBS
dnl
define(AC_LBL_CHECK_LIB,
[AC_MSG_CHECKING([for $2 in -l$1])
dnl Use a cache variable name containing both the library and function name,
dnl because the test really is for library $1 defining function $2, not
dnl just for library $1. Separate tests with the same $1 and different $2's
dnl may have different results.
ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
[ac_save_LIBS="$LIBS"
LIBS="-l$1 $5 $LIBS"
AC_TRY_LINK(dnl
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
#endif
])dnl
[/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $2();
]),
[$2()],
eval "ac_cv_lbl_lib_$ac_lib_var=yes",
eval "ac_cv_lbl_lib_$ac_lib_var=no")
LIBS="$ac_save_LIBS"
])dnl
if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$3], ,
[changequote(, )dnl
ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_lib)
LIBS="-l$1 $LIBS"
], [$3])
else
AC_MSG_RESULT(no)
ifelse([$4], , , [$4
])dnl
fi
])
dnl
dnl AC_LBL_LIBRARY_NET
dnl
dnl This test is for network applications that need socket() and
dnl gethostbyname() -ish functions. Under Solaris, those applications
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
dnl with "-lnsl" but should *not* link with "-lsocket" because
dnl libsocket.a breaks a number of things (for instance:
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
dnl versions of IRIX).
dnl
dnl Unfortunately, many application developers are not aware of this,
dnl and mistakenly write tests that cause -lsocket to be used under
dnl IRIX. It is also easy to write tests that cause -lnsl to be used
dnl under operating systems where neither are necessary (or useful),
dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
dnl
dnl This test exists so that every application developer does not test
dnl this in a different, and subtly broken fashion.
dnl It has been argued that this test should be broken up into two
dnl seperate tests, one for the resolver libraries, and one for the
dnl libraries necessary for using Sockets API. Unfortunately, the two
dnl are carefully intertwined and allowing the autoconf user to use
dnl them independantly potentially results in unfortunate ordering
dnl dependancies -- as such, such component macros would have to
dnl carefully use indirection and be aware if the other components were
dnl executed. Since other autoconf macros do not go to this trouble,
dnl and almost no applications use sockets without the resolver, this
dnl complexity has not been implemented.
dnl
dnl The check for libresolv is in case you are attempting to link
dnl statically and happen to have a libresolv.a lying around (and no
dnl libnsl.a).
dnl
AC_DEFUN(AC_LBL_LIBRARY_NET, [
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
AC_CHECK_FUNC(gethostbyname, ,
# Some OSes (eg. Solaris) place it in libnsl:
AC_LBL_CHECK_LIB(nsl, gethostbyname, ,
# Some strange OSes (SINIX) have it in libsocket:
AC_LBL_CHECK_LIB(socket, gethostbyname, ,
# Unfortunately libsocket sometimes depends on libnsl.
# AC_CHECK_LIB's API is essentially broken so the
# following ugliness is necessary:
AC_LBL_CHECK_LIB(socket, gethostbyname,
LIBS="-lsocket -lnsl $LIBS",
AC_CHECK_LIB(resolv, gethostbyname),
-lnsl))))
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
-lnsl)))
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
AC_CHECK_LIB(str, putmsg)
])
-693
View File
@@ -1,693 +0,0 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-cbm-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-atari-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-sun-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-apple-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp3[0-9][05]:OpenBSD:*:*)
echo m68k-hp-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-pc-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
echo "powerpc-unknown-linux-gnu" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "sparc" ; then
echo sparc-unknown-linux-gnu ; exit 0
else
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-pc-linux-gnu\n", argv[1]);
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1
-927
View File
@@ -1,927 +0,0 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
then
echo Configuration name missing. 1>&2
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
echo "or $0 ALIAS" 1>&2
echo where ALIAS is a recognized configuration type. 1>&2
exit 1
fi
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[3456]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
basic_machine=m68k-cbm
os=-amigados
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
basic_machine=i586-intel
;;
pentiumpro | p6)
basic_machine=i686-intel
;;
pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
basic_machine=mips-mips
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-unixware* | svr4*)
os=-sysv4
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-semi)
os=-aout
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigados
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
-1905
View File
File diff suppressed because it is too large Load Diff
-47
View File
@@ -1,47 +0,0 @@
dnl @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/configure.in,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(nslint.c)
AC_CANONICAL_SYSTEM
umask 002
if test -z "$PWD" ; then
PWD=`pwd`
fi
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_CHECK_HEADERS(fcntl.h malloc.h memory.h)
AC_REPLACE_FUNCS(strerror)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(socket, main)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(u_int32_t, u_int)
AC_LBL_DEVEL(V_CCOPT)
if test -r lbl/gnuc.h ; then
rm -f gnuc.h
ln -s lbl/gnuc.h gnuc.h
fi
AC_SUBST(V_CCOPT)
AC_SUBST(V_INCLS)
AC_PROG_INSTALL
AC_OUTPUT(Makefile)
if test -f .devel ; then
make depend
fi
exit 0
-250
View File
@@ -1,250 +0,0 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
-43
View File
@@ -1,43 +0,0 @@
/* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/lbl/gnuc.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL) */
/* Define __P() macro, if necessary */
#ifndef __P
#if __STDC__
#define __P(protos) protos
#else
#define __P(protos) ()
#endif
#endif
/* inline foo */
#ifdef __GNUC__
#define inline __inline
#else
#define inline
#endif
/*
* Handle new and old "dead" routine prototypes
*
* For example:
*
* __dead void foo(void) __attribute__((volatile));
*
*/
#ifdef __GNUC__
#ifndef __dead
#define __dead volatile
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
#ifndef __attribute__
#define __attribute__(args)
#endif
#endif
#else
#ifndef __dead
#define __dead
#endif
#ifndef __attribute__
#define __attribute__(args)
#endif
#endif
-38
View File
@@ -1,38 +0,0 @@
/*
* Copyright (c) 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/lbl/os-irix5.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
/* Prototypes missing in IRIX 5 */
#ifdef __STDC__
struct ether_addr;
#endif
int ether_hostton(char *, struct ether_addr *);
char *ether_ntoa(struct ether_addr *);
#ifdef __STDC__
struct utmp;
#endif
void login(struct utmp *);
int setenv(const char *, const char *, int);
int sigblock(int);
int sigsetmask(int);
int snprintf(char *, size_t, const char *, ...);
time_t time(time_t *);
-32
View File
@@ -1,32 +0,0 @@
/*
* Copyright (c) 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/lbl/os-osf3.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
/* Prototypes missing in osf3 */
int flock(int, int);
int ioctl(int, int, caddr_t);
int iruserok(u_int, int, char *, char *);
int pfopen(char *, int);
int rcmd(char **, u_short, const char *, const char *, const char *, int *);
int rresvport(int *);
int snprintf(char *, size_t, const char *, ...);
void sync(void);
-50
View File
@@ -1,50 +0,0 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 2000
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Id: os-solaris2.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
/* Prototypes missing in SunOS 5 */
int daemon(int, int);
int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
int dn_skipname(const u_char *, const u_char *);
int flock(int, int);
int getdtablesize(void);
int gethostname(char *, int);
int getpagesize(void);
char *getusershell(void);
char *getwd(char *);
int iruserok(u_int, int, char *, char *);
#ifdef __STDC__
struct utmp;
void login(struct utmp *);
#endif
int logout(const char *);
int res_query(const char *, int, int, u_char *, int);
int setenv(const char *, const char *, int);
#if defined(_STDIO_H) && defined(HAVE_SETLINEBUF)
int setlinebuf(FILE *);
#endif
int sigblock(int);
int sigsetmask(int);
char *strerror(int);
int snprintf(char *, size_t, const char *, ...);
int strcasecmp(const char *, const char *);
void unsetenv(const char *);
-215
View File
@@ -1,215 +0,0 @@
/*
* Copyright (c) 1989, 1990, 1993, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/lbl/os-sunos4.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
/* Prototypes missing in SunOS 4 */
#ifdef FILE
int _filbuf(FILE *);
int _flsbuf(u_char, FILE *);
int fclose(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fprintf(FILE *, const char *, ...);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
u_int fread(void *, u_int, u_int, FILE *);
int fseek(FILE *, long, int);
u_int fwrite(const void *, u_int, u_int, FILE *);
int pclose(FILE *);
void rewind(FILE *);
void setbuf(FILE *, char *);
int setlinebuf(FILE *);
int ungetc(int, FILE *);
int vfprintf(FILE *, const char *, ...);
int vprintf(const char *, ...);
#endif
#if __GNUC__ <= 1
int read(int, char *, u_int);
int write(int, char *, u_int);
#endif
long a64l(const char *);
#ifdef __STDC__
struct sockaddr;
#endif
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int bcmp(const void *, const void *, u_int);
void bcopy(const void *, void *, u_int);
void bzero(void *, int);
int chroot(const char *);
int close(int);
void closelog(void);
int connect(int, struct sockaddr *, int);
char *crypt(const char *, const char *);
int daemon(int, int);
int fchmod(int, int);
int fchown(int, int, int);
void endgrent(void);
void endpwent(void);
void endservent(void);
#ifdef __STDC__
struct ether_addr;
#endif
struct ether_addr *ether_aton(const char *);
int flock(int, int);
#ifdef __STDC__
struct stat;
#endif
int fstat(int, struct stat *);
#ifdef __STDC__
struct statfs;
#endif
int fstatfs(int, struct statfs *);
int fsync(int);
#ifdef __STDC__
struct timeb;
#endif
int ftime(struct timeb *);
int ftruncate(int, off_t);
int getdtablesize(void);
long gethostid(void);
int gethostname(char *, int);
int getopt(int, char * const *, const char *);
int getpagesize(void);
char *getpass(char *);
int getpeername(int, struct sockaddr *, int *);
int getpriority(int, int);
#ifdef __STDC__
struct rlimit;
#endif
int getrlimit(int, struct rlimit *);
int getsockname(int, struct sockaddr *, int *);
int getsockopt(int, int, int, char *, int *);
#ifdef __STDC__
struct timeval;
struct timezone;
#endif
int gettimeofday(struct timeval *, struct timezone *);
char *getusershell(void);
char *getwd(char *);
int initgroups(const char *, int);
int ioctl(int, int, caddr_t);
int iruserok(u_long, int, char *, char *);
int isatty(int);
int killpg(int, int);
int listen(int, int);
#ifdef __STDC__
struct utmp;
#endif
void login(struct utmp *);
int logout(const char *);
off_t lseek(int, off_t, int);
int lstat(const char *, struct stat *);
int mkstemp(char *);
char *mktemp(char *);
int munmap(caddr_t, int);
void openlog(const char *, int, int);
void perror(const char *);
int printf(const char *, ...);
int puts(const char *);
long random(void);
int readlink(const char *, char *, int);
#ifdef __STDC__
struct iovec;
#endif
int readv(int, struct iovec *, int);
int recv(int, char *, u_int, int);
int recvfrom(int, char *, u_int, int, struct sockaddr *, int *);
int rename(const char *, const char *);
int rcmd(char **, u_short, char *, char *, char *, int *);
int rresvport(int *);
int send(int, char *, u_int, int);
int sendto(int, char *, u_int, int, struct sockaddr *, int);
int setenv(const char *, const char *, int);
int seteuid(int);
int setpriority(int, int, int);
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
int setpgrp(int, int);
void setpwent(void);
int setrlimit(int, struct rlimit *);
void setservent(int);
int setsockopt(int, int, int, char *, int);
int shutdown(int, int);
int sigblock(int);
void (*signal (int, void (*) (int))) (int);
int sigpause(int);
int sigsetmask(int);
#ifdef __STDC__
struct sigvec;
#endif
int sigvec(int, struct sigvec *, struct sigvec*);
int snprintf(char *, size_t, const char *, ...);
int socket(int, int, int);
int socketpair(int, int, int, int *);
int symlink(const char *, const char *);
void srandom(int);
int sscanf(char *, const char *, ...);
int stat(const char *, struct stat *);
int statfs(char *, struct statfs *);
char *strerror(int);
int strcasecmp(const char *, const char *);
#ifdef __STDC__
struct tm;
#endif
int strftime(char *, int, char *, struct tm *);
int strncasecmp(const char *, const char *, int);
long strtol(const char *, char **, int);
void sync(void);
void syslog(int, const char *, ...);
int system(const char *);
long tell(int);
time_t time(time_t *);
char *timezone(int, int);
int tolower(int);
int toupper(int);
int truncate(char *, off_t);
void unsetenv(const char *);
int vfork(void);
int vsprintf(char *, const char *, ...);
int writev(int, struct iovec *, int);
#ifdef __STDC__
struct rusage;
#endif
int utimes(const char *, struct timeval *);
#if __GNUC__ <= 1
int wait(int *);
pid_t wait3(int *, int, struct rusage *);
#endif
/* Ugly signal hacking */
#ifdef SIG_ERR
#undef SIG_ERR
#define SIG_ERR (void (*)(int))-1
#undef SIG_DFL
#define SIG_DFL (void (*)(int))0
#undef SIG_IGN
#define SIG_IGN (void (*)(int))1
#ifdef KERNEL
#undef SIG_CATCH
#define SIG_CATCH (void (*)(int))2
#endif
#undef SIG_HOLD
#define SIG_HOLD (void (*)(int))3
#endif
-39
View File
@@ -1,39 +0,0 @@
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/lbl/os-ultrix4.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
/* Prototypes missing in Ultrix 4 */
int bcmp(const char *, const char *, u_int);
void bcopy(const void *, void *, u_int);
void bzero(void *, u_int);
void endservent(void);
int getopt(int, char * const *, const char *);
#ifdef __STDC__
struct timeval;
struct timezone;
#endif
int gettimeofday(struct timeval *, struct timezone *);
int ioctl(int, int, caddr_t);
int pfopen(char *, int);
int setlinebuf(FILE *);
int socket(int, int, int);
int strcasecmp(const char *, const char *);
-109
View File
@@ -1,109 +0,0 @@
#!/bin/sh -
#
# Copyright (c) 1994, 1996
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of California at Berkeley. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#
# @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
#
PATH=/bin:/usr/bin:/usr/ucb:/usr/local:/usr/local/bin
export PATH
MAKE=Makefile # default makefile name is "Makefile"
CC=cc # default C compiler is "cc"
while :
do case "$1" in
# -c allows you to specify the C compiler
-c)
CC=$2
shift; shift ;;
# -f allows you to select a makefile name
-f)
MAKE=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
SED='s;\.o;;'
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-c cc] [-f makefile] [flags] file ...'
exit 1
fi
if [ ! -w $MAKE ]; then
echo "mkdep: no writeable file \"$MAKE\""
exit 1
fi
TMP=/tmp/mkdep$$
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
cat << _EOF_ >> $TMP
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
_EOF_
# If your compiler doesn't have -M, add it. If you can't, the next two
# lines will try and replace the "cc -M". The real problem is that this
# hack can't deal with anything that requires a search path, and doesn't
# even try for anything using bracket (<>) syntax.
#
# egrep '^#include[ ]*".*"' /dev/null $* |
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
# XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
$CC -M $* |
sed "
s; \./; ;g
$SED" |
awk '{
if ($1 != prev) {
if (rec != "")
print rec;
rec = $0;
prev = $1;
}
else {
if (length(rec $2) > 78) {
print rec;
rec = $0;
}
else
rec = rec " " $2
}
}
END {
print rec
}' >> $TMP
cat << _EOF_ >> $TMP
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
_EOF_
# copy to preserve permissions
cp $TMP $MAKE
rm -f ${MAKE}.bak $TMP
exit 0
-451
View File
@@ -1,451 +0,0 @@
.\" @(#) $Id: nslint.8,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
.\"
.\" Copyright (c) 1994, 1996, 1997, 1999, 2001
.\" The Regents of the University of California. All rights reserved.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that: (1) source code distributions
.\" retain the above copyright notice and this paragraph in its entirety, (2)
.\" distributions including binary code include the above copyright notice and
.\" this paragraph in its entirety in the documentation or other materials
.\" provided with the distribution, and (3) all advertising materials mentioning
.\" features or use of this software display the following acknowledgement:
.\" ``This product includes software developed by the University of California,
.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
.\" the University nor the names of its contributors may be used to endorse
.\" or promote products derived from this software without specific prior
.\" written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.TH nslint 8 "20 March 2001"
.UC 4
.SH NAME
nslint - perform consistency checks on dns files
.SH SYNOPSIS
.B nslint
[
.B -d
] [
.B -b
.I named.boot
] [
.B -B
.I nslint.boot
]
.br
.B nslint
[
.B -d
] [
.B -c
.I named.conf
] [
.B -C
.I nslint.conf
]
.SH DESCRIPTION
.B Nslint
reads the nameserver configuration files and performs a number of
consistency checks on the dns records. If any problems are discovered,
error messages are displayed on
.I stderr
and
.B nslint
exits with a non-zero status.
.LP
Here is a short list of errors
.B nslint
detects:
.IP
Records that are malformed.
.IP
Names that contain dots but are missing a trailing dot.
.IP
.B PTR
records with names that are missing a trailing dot.
.IP
Names that contain illegal characters (rfc1034).
.IP
.B A
records
without matching
.B PTR
records
.IP
.B PTR
records
without matching
.B A
records
.IP
Names with more than one address on the same subnet.
.IP
Addresses in use by more than one name.
.IP
Names with
.B CNAME
and other records (rfc1033).
.IP
Unknown service and/or protocol keywords in
.B WKS
records.
.IP
Missing quotes.
.LP
.SH OPTIONS
.TP
.B -b
Specify an alternate
.I named.boot
file. The default is
.IR /etc/named.boot .
.TP
.TP
.B -c
Specify an alternate
.I named.conf
file. The default is
.IR /etc/named.conf .
.TP
.B -B
Specify an alternate
.I nslint.boot
file. The default is
.I nslint.boot
in the last
.B directory
line processed in
.I named.boot
(or the current working directory).
This file is processed like a second
.IR named.boot .
The most common use is to tell
.B nslint
about
.B A
records that match
.B PTR
records that point outside the domains listed in
.IR named.boot .
.TP
.B -C
Specify an alternate
.I nslint.conf
file. The default is
.I nslint.conf
in the last
.B directory
line processed in
.I named.conf
(or the current working directory).
This file is processed like a second
.IR named.conf .
.TP
.B -d
Raise the debugging level. Debugging information is
displayed on
.IR stdout .
.LP
.B Nslint
knows how to read old style
.I named.boot
and BIND 8's new
.I named.conf
files. If both files exist,
.B nslint
will prefer
.I named.conf
(on the theory that you forgot to delete
.I named.boot
when you upgraded to BIND 8).
.LP
.SH "ADVANCED CONFIGURATION"
There are some cases where it is necessary to use the
advanced configuration features of
.BR nslint .
Advanced configuration is done with the
.I nslint.boot
file.
.LP
The most common is when a site has a demilitarized zone (DMZ).
The problem here is that the DMZ network will have
.B PTR
records for hosts outside its domain. For example lets say
we have
.I 128.0.rev
with:
.LP
.RS
.nf
.sp .5
1.1 604800 in ptr gateway.lbl.gov.
2.1 604800 in ptr gateway.es.net.
.sp .5
.fi
.RE
.LP
Obviously we will define an
.B A
record for
.I gateway.lbl.gov
pointing to
.I 128.0.1.1
but we will get errors because there is no
.B A
record defined for
.IR gateway.es.net .
The solution is to create a
.I nslint.boot
file (in the same directory as the other dns files)
with:
.LP
.RS
.nf
.sp .5
primary es.net nslint.es.net
.sp .5
.fi
.RE
.LP
And then create the file
.I nslint.es.net
with:
.LP
.RS
.nf
.sp .5
gateway 1 in a 128.0.1.2
.sp .5
.fi
.RE
.LP
Another problem occurs when there is a
.B CNAME
that points to a host outside the local domains. Let's say we have
.I info.lbl.gov
pointing to
.IR larry.es.net :
.LP
.RS
.nf
.sp .5
info 604800 in cname larry.es.net.
.sp .5
.fi
.RE
.LP
In this case we would need:
.LP
.RS
.nf
.sp .5
primary es.net nslint.es.net
.sp .5
.fi
.RE
.LP
in
.I nslint.boot
and:
.LP
.RS
.nf
.sp .5
larry 1 in txt "place holder"
.sp .5
.fi
.RE
.LP
.IR nslint.es.net .
.LP
One last problem
when a pseudo host is setup to allow two more
more actual hosts provide a service. For, let's say that
.I lbl.gov
contains:
.LP
.RS
.nf
.sp .5
server 604800 in a 128.0.6.6
server 604800 in a 128.0.6.94
;
tom 604800 in a 128.0.6.6
tom 604800 in mx 0 lbl.gov.
;
jerry 604800 in a 128.0.6.94
jerry 604800 in mx 0 lbl.gov.
.sp .5
.fi
.RE
.LP
In this case
.B nslint
would complain about missing
.B PTR
records and ip addresses in use by more than one host.
To suppress these warnings, add you would the lines:
.LP
.RS
.nf
.sp .5
primary lbl.gov nslint.lbl.gov
primary 0.128.in-addr.arpa nslint.128.0.rev
.sp .5
.fi
.RE
.LP
to
.I nslint.boot
and create
.I nslint.lbl.gov
with:
.LP
.RS
.nf
.sp .5
server 1 in allowdupa 128.0.6.6
server 1 in allowdupa 128.0.6.94
.sp .5
.fi
.RE
.LP
and create
.I nslint.128.0.rev
with:
.LP
.RS
.nf
.sp .5
6.6 604800 in ptr server.lbl.gov.
94.6 604800 in ptr server.lbl.gov.
.sp .5
.fi
.RE
.LP
In this example, the
.B allowdupa
keyword tells
.B nslint
that it's ok for
.I 128.0.6.6
and
.I 128.0.6.94
to be shared by
.IR server.lbl.gov ,
.IR tom.lbl.gov ,
and
.IR jerry.lbl.gov .
.LP
One last
.B nslint
feature helps detect hosts that have mistakenly had two ip addresses
assigned on the same subnet. This can happen when two different
people request an ip address for the same hostname or when someone
forgets an address has been assigned and requests a new number.
.LP
To detect such
.B A
records, add a
.B nslint
section to your
.I nslint.conf
containing something similar to:
.LP
.RS
.nf
.sp .5
nslint {
.RS
network "128.0.6/22";
network "128.0.6 255.255.252.0";
.RE
};
.sp .5
.fi
.RE
.LP
The two network lines in this example are equivalent ways of saying the same
thing; that subnet
.I 128.0.6
has a 22 bit wide subnet mask.
.LP
If you are using
.IR nslint.boot ,
the syntax would be:
.LP
.RS
.nf
.sp .5
network 128.0.6/22
network 128.0.6 255.255.252.0
.sp .5
.fi
.RE
.LP
Again this shows two ways of saying the same thing.
.LP
Using information from the above
.B network
statement,
.B nslint
would would flag the following
.B A
records as being in error:
.LP
.RS
.nf
.sp .5
server 1 in a 128.0.6.48
server 1 in a 128.0.7.16
.sp .5
.fi
.RE
.LP
Note that if you specify any
.B network
lines in your
.I nslint.conf
or
.I nslint.boot
files,
.B nslint
requires you to include lines for all networks;
otherwise you might forget to add
.B network
lines for new networks.
.LP
.SH FILES
.na
.nh
.nf
/etc/named.boot - default named configuration file
nslint.boot - default nslint configuration file
.ad
.hy
.fi
.LP
.SH "SEE ALSO"
.na
.nh
.IR named (8),
rfc1033,
rfc1034
.ad
.hy
.SH AUTHOR
Craig Leres of the
Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
.LP
The current version is available via anonymous ftp:
.LP
.RS
.I ftp://ftp.ee.lbl.gov/nslint.tar.gz
.RE
.SH BUGS
Please send bug reports to nslint@ee.lbl.gov.
.LP
Not everyone is guaranteed to agree with all the checks done.
File diff suppressed because it is too large Load Diff
-67
View File
@@ -1,67 +0,0 @@
/*
* Copyright (c) 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/savestr.c,v 1.1 2001/12/21 04:12:04 marka Exp $ (LBL)";
#endif
#include <sys/types.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
#include "savestr.h"
/* A replacement for strdup() that cuts down on malloc() overhead */
char *
savestr(register const char *str)
{
register u_int size;
register char *p;
static char *strptr = NULL;
static u_int strsize = 0;
size = strlen(str) + 1;
if (size > strsize) {
strsize = 1024;
if (strsize < size)
strsize = size;
strptr = (char *)malloc(strsize);
if (strptr == NULL) {
fprintf(stderr, "savestr: malloc\n");
exit(1);
}
}
(void)strcpy(strptr, str);
p = strptr;
strptr += size;
strsize -= size;
return (p);
}
-24
View File
@@ -1,24 +0,0 @@
/*
* Copyright (c) 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/contrib/nslint-2.1a3/savestr.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
*/
extern char *savestr(const char *);
-75
View File
@@ -1,75 +0,0 @@
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <string.h>
#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
char *
strerror(num)
int num;
{
extern int sys_nerr;
extern char *sys_errlist[];
#define UPREFIX "Unknown error: "
static char ebuf[40] = UPREFIX; /* 64-bit number + slop */
register unsigned int errnum;
register char *p, *t;
char tmp[40];
errnum = num; /* convert to unsigned */
if (errnum < sys_nerr)
return(sys_errlist[errnum]);
/* Do this by hand, so we don't include stdio(3). */
t = tmp;
do {
*t++ = "0123456789"[errnum % 10];
} while (errnum /= 10);
for (p = ebuf + sizeof(UPREFIX) - 1;;) {
*p++ = *--t;
if (t <= tmp)
break;
}
*p = '\0';
return(ebuf);
}
-195
View File
@@ -1,195 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dirdb.c,v 1.9 2001/01/09 21:46:22 bwelling Exp $ */
/*
* A simple database driver that returns basic information about
* files and directories in the Unix file system as DNS data.
*/
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/sdb.h>
#include <named/globals.h>
#include "dirdb.h"
static dns_sdbimplementation_t *dirdb = NULL;
#define CHECK(op) \
do { result = (op); \
if (result != ISC_R_SUCCESS) return (result); \
} while (0)
#define CHECKN(op) \
do { n = (op); \
if (n < 0) return (ISC_R_FAILURE); \
} while (0)
/*
* This database operates on relative names.
*
* Any name will be interpreted as a pathname offset from the directory
* specified in the configuration file.
*/
static isc_result_t
dirdb_lookup(const char *zone, const char *name, void *dbdata,
dns_sdblookup_t *lookup)
{
char filename[255];
char filename2[255];
char buf[1024];
struct stat statbuf;
isc_result_t result;
int n;
UNUSED(zone);
UNUSED(dbdata);
if (strcmp(name, "@") == 0)
snprintf(filename, sizeof(filename), "%s", (char *)dbdata);
else
snprintf(filename, sizeof(filename), "%s/%s",
(char *)dbdata, name);
CHECKN(lstat(filename, &statbuf));
if (S_ISDIR(statbuf.st_mode))
CHECK(dns_sdb_putrr(lookup, "txt", 3600, "dir"));
else if (S_ISCHR(statbuf.st_mode) || S_ISBLK(statbuf.st_mode)) {
CHECKN(snprintf(buf, sizeof(buf),
"\"%sdev\" \"major %d\" \"minor %d\"",
S_ISCHR(statbuf.st_mode) ? "chr" : "blk",
major(statbuf.st_rdev),
minor(statbuf.st_rdev)));
CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
} else if (S_ISFIFO(statbuf.st_mode))
CHECK(dns_sdb_putrr(lookup, "txt", 3600, "pipe"));
else if (S_ISSOCK(statbuf.st_mode))
CHECK(dns_sdb_putrr(lookup, "txt", 3600, "socket"));
else if (S_ISLNK(statbuf.st_mode)) {
CHECKN(readlink(filename, filename2, sizeof(filename2) - 1));
buf[n] = 0;
CHECKN(snprintf(buf, sizeof(buf), "\"symlink\" \"%s\"",
filename2));
CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
} else if (!S_ISREG(statbuf.st_mode))
CHECK(dns_sdb_putrr(lookup, "txt", 3600, "unknown"));
else {
CHECKN(snprintf(buf, sizeof(buf), "\"file\" \"size = %u\"",
(unsigned int)statbuf.st_size));
CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
}
return (ISC_R_SUCCESS);
}
/*
* lookup () does not return SOA or NS records, so authority() must be defined.
*/
static isc_result_t
dirdb_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
isc_result_t result;
UNUSED(zone);
UNUSED(dbdata);
result = dns_sdb_putsoa(lookup, "ns", "hostmaster", 0);
INSIST(result == ISC_R_SUCCESS);
result = dns_sdb_putrr(lookup, "ns", 86400, "ns1");
INSIST(result == ISC_R_SUCCESS);
result = dns_sdb_putrr(lookup, "ns", 86400, "ns2");
INSIST(result == ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
}
/*
* Each database stores the top-level directory as the dbdata opaque
* object. The create() function allocates it. argv[0] holds the top
* level directory.
*/
static isc_result_t
dirdb_create(const char *zone, int argc, char **argv,
void *driverdata, void **dbdata)
{
UNUSED(zone);
UNUSED(driverdata);
if (argc < 1)
return (ISC_R_FAILURE);
*dbdata = isc_mem_strdup((isc_mem_t *)driverdata, argv[0]);
if (*dbdata == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
}
/*
* The destroy() function frees the memory allocated by create().
*/
static void
dirdb_destroy(const char *zone, void *driverdata, void **dbdata) {
UNUSED(zone);
UNUSED(driverdata);
isc_mem_free((isc_mem_t *)driverdata, *dbdata);
}
/*
* This zone does not support zone transfer, so allnodes() is NULL.
*/
static dns_sdbmethods_t dirdb_methods = {
dirdb_lookup,
dirdb_authority,
NULL, /* allnodes */
dirdb_create,
dirdb_destroy
};
/*
* Wrapper around dns_sdb_register(). Note that the first ns_g_mctx is
* being passed as the "driverdata" parameter, so that will it will be
* passed to create() and destroy().
*/
isc_result_t
dirdb_init(void) {
unsigned int flags;
flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA |
DNS_SDBFLAG_THREADSAFE;
return (dns_sdb_register("dir", &dirdb_methods, ns_g_mctx, flags,
ns_g_mctx, &dirdb));
}
/*
* Wrapper around dns_sdb_unregister().
*/
void
dirdb_clear(void) {
if (dirdb != NULL)
dns_sdb_unregister(&dirdb);
}
-25
View File
@@ -1,25 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dirdb.h,v 1.2 2001/01/09 21:46:23 bwelling Exp $ */
#include <isc/types.h>
isc_result_t dirdb_init(void);
void dirdb_clear(void);
-55
View File
@@ -1,55 +0,0 @@
This is the INSTALL file for 0.4. See
http://www.venaas.no/ldap/bind-sdb/ for updates or other information.
BUILDING
You need the source for BIND 9.1.0 or newer (for zone transfers you
will need at least 9.1.1rc3 due to a bug). Basically you need to follow
the instructions in doc/misc/sdb, if my instructions doesn't make sense,
please have a look at that as well.
Copy ldapdb.c to bin/named and ldapdb.h to bin/named/include in the
source tree.
Next alter bin/named/Makefile.in. Add ldapdb.@O@ to DBDRIVER_OBJS and
ldapdb.c to DBDRIVER_SRCS. You also need to add something like
-I/usr/local/include to DBDRIVER_INCLUDES and
-L/usr/local/lib -lldap -llber -lresolv to DBDRIVER_LIBS
depending on what LDAP library you have and where you installed it.
Finally you need to edit bin/named/main.c. Below where it says
"#include "xxdb.h"", add the line "#include <ldapdb.h>". Below where
it says "xxdb_init();" add the line "ldapdb_init();", and finally
below where it says "xxdb_clear();", add "ldapdb_clear();".
Now you should hopefully be able to build it.
CONFIGURING
Before you do any configuring of LDAP stuff, please try to configure
and start bind as usual to see if things work.
To do anything useful, you need to store a zone in some LDAP server.
From this release on, you must use a schema called dNSZone. Note that
it relies on some attribute definitions in the Cosine schema, so that
must be included as well. The Cosine schema probably comes with your
LDAP server. You can find dNSZone and further details on how to store
the data in your LDAP server at
http://www.venaas.no/ldap/bind-sdb/
For an example, have a look at my venaas.com zone. Try a subtree search
for objectClass=* at
ldap ldap://129.241.20.67/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no
To use it with BIND, I've added the following to named.conf:
zone "venaas.com" {
type master;
database "ldap ldap://129.241.20.67/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no 172800";
};
When doing lookups BIND will do a sub-tree search below the base in the
URL. The number 172800 is the TTL which will be used for all entries that
haven't got the dNSTTL attribute.
Stig Venaas <venaas@uninett.no> 2001-04-12
-18
View File
@@ -1,18 +0,0 @@
This is an attempt at an LDAP back-end for BIND 9 using the new simplified
database interface "sdb". This is the fifth release (0.5) and is not ready
for production use yet. Note that this version (and 0.4) uses a new schema
and is not backwards compatible with versions before 0.4. The big changes in
0.5 are thread support and improved connection handling. Multiple threads
can now access the back-end simultaneously, and rather than having one
connection per zone, there is now one connection per thread per LDAP server.
This should help people with multiple CPUs and people with a huge number of
zones. One final change is support for literal IPv6 addresses in LDAP URLs.
At least OpenLDAP 2 has IPv6 support, so if you use OpenLDAP 2 libraries and
server, you got all you need.
If you have bug reports, fixes, comments, questions or whatever, please
contact me. See also http://www.venaas.no/ldap/bind-sdb/ for information.
See INSTALL for how to build, install and use.
Stig Venaas <venaas@uninett.no> 2001-05-06
-17
View File
@@ -1,17 +0,0 @@
INSTALLATION
To Compile zone2ldap from contrib/sdb directory:
gcc -g `../../isc-config.sh --cflags isc dns` -c zone2ldap.c
gcc -g -o zone2ldap zone2ldap.o `isc-config.sh --libs isc dns` -lldap -llber -lresolv
USAGE:
See zone2ldap.1
BUGS:
Jeff McNeil <jeff@snapcase.g-rock.net>
-466
View File
@@ -1,466 +0,0 @@
/*
* Copyright (C) 2001 Stig Venaas
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <isc/thread.h>
#include <dns/sdb.h>
#include <named/globals.h>
#include <ldap.h>
#include "ldapdb.h"
/*
* A simple database driver for LDAP. Not production quality yet
*/
static dns_sdbimplementation_t *ldapdb = NULL;
struct ldapdb_data {
char *hostport;
char *hostname;
int portno;
char *base;
int defaultttl;
};
/* used by ldapdb_getconn */
struct ldapdb_entry {
void *index;
size_t size;
void *data;
struct ldapdb_entry *next;
};
static struct ldapdb_entry *ldapdb_find(struct ldapdb_entry *stack,
const void *index, size_t size) {
while (stack != NULL) {
if (stack->size == size && !memcmp(stack->index, index, size))
return stack;
stack = stack->next;
}
return NULL;
}
static void ldapdb_insert(struct ldapdb_entry **stack,
struct ldapdb_entry *item) {
item->next = *stack;
*stack = item;
}
static void ldapdb_lock(int what) {
static isc_mutex_t lock;
switch (what) {
case 0:
isc_mutex_init(&lock);
break;
case 1:
LOCK(&lock);
break;
case -1:
UNLOCK(&lock);
break;
}
}
/* data == NULL means cleanup */
static LDAP **
ldapdb_getconn(struct ldapdb_data *data)
{
static struct ldapdb_entry *allthreadsdata = NULL;
struct ldapdb_entry *threaddata, *conndata;
unsigned long threadid;
if (data == NULL) {
/* cleanup */
/* lock out other threads */
ldapdb_lock(1);
while (allthreadsdata != NULL) {
threaddata = allthreadsdata;
free(threaddata->index);
while (threaddata->data != NULL) {
conndata = threaddata->data;
free(conndata->index);
if (conndata->data != NULL)
ldap_unbind((LDAP *)conndata->data);
threaddata->data = conndata->next;
free(conndata);
}
allthreadsdata = threaddata->next;
free(threaddata);
}
ldapdb_lock(-1);
return (NULL);
}
/* look for connection data for current thread */
threadid = isc_thread_self();
threaddata = ldapdb_find(allthreadsdata, &threadid, sizeof(threadid));
if (threaddata == NULL) {
/* no data for this thread, create empty connection list */
threaddata = malloc(sizeof(*threaddata));
if (threaddata == NULL)
return (NULL);
threaddata->index = malloc(sizeof(threadid));
if (threaddata->index == NULL) {
free(threaddata);
return (NULL);
}
*(unsigned long *)threaddata->index = threadid;
threaddata->size = sizeof(threadid);
threaddata->data = NULL;
/* need to lock out other threads here */
ldapdb_lock(1);
ldapdb_insert(&allthreadsdata, threaddata);
ldapdb_lock(-1);
}
/* threaddata points at the connection list for current thread */
/* look for existing connection to our server */
conndata = ldapdb_find((struct ldapdb_entry *)threaddata->data,
data->hostport, strlen(data->hostport));
if (conndata == NULL) {
/* no connection data structure for this server, create one */
conndata = malloc(sizeof(*conndata));
if (conndata == NULL)
return (NULL);
(char *)conndata->index = data->hostport;
conndata->size = strlen(data->hostport);
conndata->data = NULL;
ldapdb_insert((struct ldapdb_entry **)&threaddata->data,
conndata);
}
return (LDAP **)&conndata->data;
}
/* callback routines */
static isc_result_t
ldapdb_create(const char *zone, int argc, char **argv,
void *driverdata, void **dbdata)
{
struct ldapdb_data *data;
char *s;
int defaultttl;
UNUSED(zone);
UNUSED(driverdata);
/* we assume that only one thread will call create at a time */
/* want to do this only once for all instances */
if ((argc < 2)
|| (argv[0] != strstr( argv[0], "ldap://"))
|| ((defaultttl = atoi(argv[1])) < 1))
return (ISC_R_FAILURE);
data = isc_mem_get(ns_g_mctx, sizeof(struct ldapdb_data));
if (data == NULL)
return (ISC_R_NOMEMORY);
data->hostport = isc_mem_strdup(ns_g_mctx, argv[0] + strlen("ldap://"));
if (data->hostport == NULL) {
isc_mem_put(ns_g_mctx, data, sizeof(struct ldapdb_data));
return (ISC_R_NOMEMORY);
}
data->defaultttl = defaultttl;
s = strchr(data->hostport, '/');
if (s != NULL) {
*s++ = '\0';
data->base = *s != '\0' ? s : NULL;
}
/* support URLs with literal IPv6 addresses */
data->hostname = isc_mem_strdup(ns_g_mctx, data->hostport +
(*data->hostport == '[' ? 1 : 0));
if (data->hostname == NULL) {
isc_mem_free(ns_g_mctx, data->hostport);
isc_mem_put(ns_g_mctx, data, sizeof(struct ldapdb_data));
return (ISC_R_NOMEMORY);
}
if (*data->hostport == '[' &&
(s = strchr(data->hostname, ']')) != NULL )
*s++ = '\0';
else
s = data->hostname;
s = strchr(s, ':');
if (s != NULL) {
*s++ = '\0';
data->portno = atoi(s);
} else
data->portno = LDAP_PORT;
*dbdata = data;
return (ISC_R_SUCCESS);
}
static void
ldapdb_destroy(const char *zone, void *driverdata, void **dbdata) {
struct ldapdb_data *data = *dbdata;
UNUSED(zone);
UNUSED(driverdata);
if (data->hostport != NULL)
isc_mem_free(ns_g_mctx, data->hostport);
if (data->hostname != NULL)
isc_mem_free(ns_g_mctx, data->hostname);
isc_mem_put(ns_g_mctx, data, sizeof(struct ldapdb_data));
}
static void
ldapdb_bind(struct ldapdb_data *data, LDAP **ldp)
{
if (*ldp != NULL)
ldap_unbind(*ldp);
*ldp = ldap_open(data->hostname, data->portno);
if (*ldp == NULL)
return;
if (ldap_simple_bind_s(*ldp, NULL, NULL) != LDAP_SUCCESS) {
ldap_unbind(*ldp);
*ldp = NULL;
}
}
static isc_result_t
ldapdb_lookup(const char *zone, const char *name, void *dbdata,
dns_sdblookup_t *lookup)
{
isc_result_t result = ISC_R_NOTFOUND;
struct ldapdb_data *data = dbdata;
LDAP **ldp;
LDAPMessage *res, *e;
char *fltr, *a, **vals;
char type[64];
BerElement *ptr;
int i;
ldp = ldapdb_getconn(data);
if (ldp == NULL)
return (ISC_R_FAILURE);
if (*ldp == NULL) {
ldapdb_bind(data, ldp);
if (*ldp == NULL)
return (ISC_R_FAILURE);
}
fltr = isc_mem_get(ns_g_mctx, strlen(zone) + strlen(name) +
strlen("(&(zoneName=)(relativeDomainName=))") + 1);
if (fltr == NULL)
return (ISC_R_NOMEMORY);
strcpy(fltr, "(&(zoneName=");
strcat(fltr, zone);
strcat(fltr, ")(relativeDomainName=");
strcat(fltr, name);
strcat(fltr, "))");
if (ldap_search_s(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0,
&res) != LDAP_SUCCESS) {
ldapdb_bind(data, ldp);
if (*ldp != NULL)
ldap_search_s(*ldp, data->base, LDAP_SCOPE_SUBTREE,
fltr, NULL, 0, &res);
}
isc_mem_put(ns_g_mctx, fltr, strlen(fltr) + 1);
if (*ldp == NULL)
goto exit;
for (e = ldap_first_entry(*ldp, res); e != NULL;
e = ldap_next_entry(*ldp, e)) {
LDAP *ld = *ldp;
int ttl = data->defaultttl;
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL;
a = ldap_next_attribute(ld, e, ptr)) {
if (!strcmp(a, "dNSTTL")) {
vals = ldap_get_values(ld, e, a);
ttl = atoi(vals[0]);
ldap_value_free(vals);
ldap_memfree(a);
break;
}
ldap_memfree(a);
}
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL;
a = ldap_next_attribute(ld, e, ptr)) {
char *s;
for (s = a; *s; s++)
*s = toupper(*s);
s = strstr(a, "RECORD");
if ((s == NULL) || (s == a)
|| (s - a >= (signed int)sizeof(type))) {
ldap_memfree(a);
continue;
}
strncpy(type, a, s - a);
type[s - a] = '\0';
vals = ldap_get_values(ld, e, a);
for (i=0; vals[i] != NULL; i++) {
result = dns_sdb_putrr(lookup, type, ttl,
vals[i]);
if (result != ISC_R_SUCCESS) {
ldap_value_free(vals);
ldap_memfree(a);
result = ISC_R_FAILURE;
goto exit;
}
}
ldap_value_free(vals);
ldap_memfree(a);
}
}
exit:
ldap_msgfree(res);
return (result);
}
static isc_result_t
ldapdb_allnodes(const char *zone, void *dbdata,
dns_sdballnodes_t *allnodes) {
isc_result_t result = ISC_R_NOTFOUND;
struct ldapdb_data *data = dbdata;
LDAP **ldp;
LDAPMessage *res, *e;
char type[64];
char *fltr, *a, **vals;
BerElement *ptr;
int i;
ldp = ldapdb_getconn(data);
if (ldp == NULL)
return (ISC_R_FAILURE);
if (*ldp == NULL) {
ldapdb_bind(data, ldp);
if (*ldp == NULL)
return (ISC_R_FAILURE);
}
fltr = isc_mem_get(ns_g_mctx, strlen(zone) + strlen("(zoneName=)") + 1);
if (fltr == NULL)
return (ISC_R_NOMEMORY);
strcpy(fltr, "(zoneName=");
strcat(fltr, zone);
strcat(fltr, ")");
if (ldap_search_s(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0,
&res) != LDAP_SUCCESS) {
ldapdb_bind(data, ldp);
if (*ldp != NULL)
ldap_search_s(*ldp, data->base, LDAP_SCOPE_SUBTREE,
fltr, NULL, 0, &res);
}
isc_mem_put(ns_g_mctx, fltr, strlen(fltr) + 1);
for (e = ldap_first_entry(*ldp, res); e != NULL;
e = ldap_next_entry(*ldp, e)) {
LDAP *ld = *ldp;
char *name = NULL;
int ttl = data->defaultttl;
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL;
a = ldap_next_attribute(ld, e, ptr)) {
if (!strcmp(a, "dNSTTL")) {
vals = ldap_get_values(ld, e, a);
ttl = atoi(vals[0]);
ldap_value_free(vals);
} else if (!strcmp(a, "relativeDomainName")) {
vals = ldap_get_values(ld, e, a);
name = isc_mem_strdup(ns_g_mctx, vals[0]);
ldap_value_free(vals);
}
ldap_memfree(a);
}
if (name == NULL)
continue;
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL;
a = ldap_next_attribute(ld, e, ptr)) {
char *s;
for (s = a; *s; s++)
*s = toupper(*s);
s = strstr(a, "RECORD");
if ((s == NULL) || (s == a)
|| (s - a >= (signed int)sizeof(type))) {
ldap_memfree(a);
continue;
}
strncpy(type, a, s - a);
type[s - a] = '\0';
vals = ldap_get_values(ld, e, a);
for (i=0; vals[i] != NULL; i++) {
result = dns_sdb_putnamedrr(allnodes, name,
type, ttl, vals[i]);
if (result != ISC_R_SUCCESS) {
ldap_value_free(vals);
ldap_memfree(a);
isc_mem_free(ns_g_mctx, name);
result = ISC_R_FAILURE;
goto exit;
}
}
ldap_value_free(vals);
ldap_memfree(a);
}
isc_mem_free(ns_g_mctx, name);
}
exit:
ldap_msgfree(res);
return (result);
}
static dns_sdbmethods_t ldapdb_methods = {
ldapdb_lookup,
NULL, /* authority */
ldapdb_allnodes,
ldapdb_create,
ldapdb_destroy
};
/* Wrapper around dns_sdb_register() */
isc_result_t
ldapdb_init(void) {
unsigned int flags =
DNS_SDBFLAG_RELATIVEOWNER |
DNS_SDBFLAG_RELATIVERDATA |
DNS_SDBFLAG_THREADSAFE;
ldapdb_lock(0);
return (dns_sdb_register("ldap", &ldapdb_methods, NULL, flags,
ns_g_mctx, &ldapdb));
}
/* Wrapper around dns_sdb_unregister() */
void
ldapdb_clear(void) {
if (ldapdb != NULL) {
/* clean up thread data */
ldapdb_getconn(NULL);
dns_sdb_unregister(&ldapdb);
}
}
-6
View File
@@ -1,6 +0,0 @@
#include <isc/types.h>
isc_result_t ldapdb_init(void);
void ldapdb_clear(void);
-64
View File
@@ -1,64 +0,0 @@
.TH zone2ldap 1 "8 March 2001"
.SH NAME
zone2ldap /- Load BIND 9 Zone files into LDAP Directory
.SH SYNOPSIS
zone2ldap [-D Bind DN] [-w Bind Password] [-b Base DN] [-z Zone] [-f Zone File ] [-h Ldap Host] [-cd] [-v]
.SH DESCRIPTION
zone2ldap will parse a complete BIND 9 format DNS zone file, and load
the contents into an LDAP directory, for use with the LDAP sdb back-end.
If the zone already exists, zone2ldap will exit succesfully. If the zone does not exists, or
partially exists, zone2ldap will attempt to add all/missing zone data.
.SS Options
.TP
-b
LDAP Base DN. LDAP systems require a "base dn", which is generally considered the LDAP Directory root.
If the zone you are loading is different from the base, then you will need to tell zone2ldap what your LDAP
base is.
.TP
-v
Print version information, and immediatly exit.
.TP
-f
Zone file. Bind 9.1 compatible zone file, from which zone information will be read.
.TP
-d
Dump debug information to standard out.
.TP
-w
LDAP Bind password, corresponding the the value of "-b".
.TP
-h
LDAP Directory host. This is the hostname of the LDAP system you wish to store zone information on.
An LDAP server should be listening on port 389 of the target system. This may be ommited, and will default
to "localhost".
.TP
-c
This will create the zone portion of the DN you are importing. For instance, if you are creating a domain.com zone,
zone2ldap should first create "dc=domain,dc=com". This is useful if you are creating multiple domains.
.TP
-z
This is the name of the zone specified in the SOA record.
.SH EXAMPLES
Following are brief examples of how to import a zone file into your LDAP DIT.
.SS Loading zone domain.com, with an LDAP Base DN of dc=domain,dc=com
zone2ldap -D dc=root -w secret -h localhost -z domain.com -f domain.com.zone
This will add Resource Records into an ALREADY EXISTING dc=domain,dc=com. The final SOA DN in this case, will be
dc=@,dc=domain,dc=com
.SS Loading customer.com, if your LDAP Base DN is dc=provider,dc=net.
zone2ldap -D dc=root -w secret -h localhost -z customer.com -b dc=provider,dc=net -f customer.com.zone -c
This will create dc=customer,dc=com under dc=provider,dc=net, and add all necessary Resource Records. The final
root DN to the SOA will be dc=@,dc=customer,dc=com,dc=provider,dc=net.
.SH "SEE ALSO"
named(8) ldap(3)
http://www.venaas.no/ldap/bind-sdb/
.SH "BUGS"
Send all bug reports to Jeff McNeil <jeff@snapcase.g-rock.net>
.SH AUTHOR
Jeff McNeil <jeff@snapcase.g-rock.net>
-721
View File
@@ -1,721 +0,0 @@
/*
* Copyright (C) 2001 Jeff McNeil <jeff@snapcase.g-rock.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* Change Log
*
* Tue May 1 19:19:54 EDT 2001 - Jeff McNeil
* Update to objectClass code, and add_to_rr_list function
* (I need to rename that) to support the dNSZone schema,
* ditched dNSDomain2 schema support. Version 0.3-ALPHA
*/
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
#include <dns/rdatatype.h>
#include <ldap.h>
#define DNS_OBJECT 6
#define DNS_TOP 2
#define VERSION "0.4-ALPHA"
#define NO_SPEC 0
#define WI_SPEC 1
/* Global Zone Pointer */
char *gbl_zone = NULL;
typedef struct LDAP_INFO
{
char *dn;
LDAPMod **attrs;
struct LDAP_INFO *next;
int attrcnt;
}
ldap_info;
/* usage Info */
void usage ();
/* Add to the ldap dit */
void add_ldap_values (ldap_info * ldinfo);
/* Init an ldap connection */
void init_ldap_conn ();
/* Ldap error checking */
void ldap_result_check (char *msg, char *dn, int err);
/* Put a hostname into a char ** array */
char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags);
/* Find out how many items are in a char ** array */
int get_attr_list_size (char **tmp);
/* Get a DN */
char *build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag);
/* Add to RR list */
void add_to_rr_list (char *dn, char *name, char *type, char *data,
unsigned int ttl, unsigned int flags);
/* Error checking */
void isc_result_check (isc_result_t res, char *errorstr);
/* Generate LDIF Format files */
void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
unsigned int ttl);
/* head pointer to the list */
ldap_info *ldap_info_base = NULL;
char *argzone, *ldapbase, *binddn, *bindpw = NULL;
char *ldapsystem = "localhost";
static char *objectClasses[] =
{ "top", "dNSZone", NULL };
static char *topObjectClasses[] = { "top", NULL };
LDAP *conn;
unsigned int debug = 0;
#ifdef DEBUG
debug = 1;
#endif
int
main (int *argc, char **argv)
{
isc_mem_t *isc_ctx = NULL;
isc_result_t result;
char *basedn;
ldap_info *tmp;
LDAPMod *base_attrs[2];
LDAPMod base;
isc_buffer_t buff;
char *zonefile;
char fullbasedn[1024];
char *ctmp;
dns_fixedname_t fixedzone, fixedname;
dns_rdataset_t rdataset;
char **dc_list;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdatasetiter_t *riter;
dns_name_t *zone, *name;
dns_db_t *db = NULL;
dns_dbiterator_t *dbit = NULL;
dns_dbnode_t *node;
extern char *optarg;
extern int optind, opterr, optopt;
int create_base = 0;
int topt;
if ((int) argc < 2)
{
usage ();
exit (-1);
}
while ((topt = getopt ((int) argc, argv, "D:w:b:z:f:h:?dcv")) != -1)
{
switch (topt)
{
case 'v':
printf("%s\n", VERSION);
exit(0);
case 'c':
create_base++;
break;
case 'd':
debug++;
break;
case 'D':
binddn = strdup (optarg);
break;
case 'w':
bindpw = strdup (optarg);
break;
case 'b':
ldapbase = strdup (optarg);
break;
case 'z':
argzone = strdup (optarg);
// We wipe argzone all to hell when we parse it for the DN */
gbl_zone = strdup(argzone);
break;
case 'f':
zonefile = strdup (optarg);
break;
case 'h':
ldapsystem = strdup (optarg);
break;
case '?':
default:
usage ();
exit (0);
}
}
if ((argzone == NULL) || (zonefile == NULL))
{
usage ();
exit (-1);
}
if (debug)
printf ("Initializing ISC Routines, parsing zone file\n");
result = isc_mem_create (0, 0, &isc_ctx);
isc_result_check (result, "isc_mem_create");
isc_buffer_init (&buff, argzone, strlen (argzone));
isc_buffer_add (&buff, strlen (argzone));
dns_fixedname_init (&fixedzone);
zone = dns_fixedname_name (&fixedzone);
result = dns_name_fromtext (zone, &buff, dns_rootname, ISC_FALSE, NULL);
isc_result_check (result, "dns_name_fromtext");
result =
dns_db_create (isc_ctx, "rbt", zone, dns_dbtype_zone, dns_rdataclass_in,
0, NULL, &db);
isc_result_check (result, "dns_db_create");
result = dns_db_load (db, zonefile);
isc_result_check (result, "Check Zone Syntax: dns_db_load");
result = dns_db_createiterator (db, ISC_FALSE, &dbit);
isc_result_check (result, "dns_db_createiterator");
result = dns_dbiterator_first (dbit);
isc_result_check (result, "dns_dbiterator_first");
dns_fixedname_init (&fixedname);
name = dns_fixedname_name (&fixedname);
dns_rdataset_init (&rdataset);
dns_rdata_init (&rdata);
while (result == ISC_R_SUCCESS)
{
node = NULL;
result = dns_dbiterator_current (dbit, &node, name);
if (result == ISC_R_NOMORE)
break;
isc_result_check (result, "dns_dbiterator_current");
riter = NULL;
result = dns_db_allrdatasets (db, node, NULL, 0, &riter);
isc_result_check (result, "dns_db_allrdatasets");
result = dns_rdatasetiter_first (riter);
//isc_result_check(result, "dns_rdatasetiter_first");
while (result == ISC_R_SUCCESS)
{
dns_rdatasetiter_current (riter, &rdataset);
result = dns_rdataset_first (&rdataset);
isc_result_check (result, "dns_rdatasetiter_current");
while (result == ISC_R_SUCCESS)
{
dns_rdataset_current (&rdataset, &rdata);
generate_ldap (name, &rdata, rdataset.ttl);
dns_rdata_reset (&rdata);
result = dns_rdataset_next (&rdataset);
}
dns_rdataset_disassociate (&rdataset);
result = dns_rdatasetiter_next (riter);
}
dns_rdatasetiter_destroy (&riter);
result = dns_dbiterator_next (dbit);
}
/* Initialize the LDAP Connection */
if (debug)
printf ("Initializing LDAP Connection to %s as %s\n", ldapsystem, binddn);
init_ldap_conn ();
if (create_base)
{
if (debug)
printf ("Creating base zone DN %s\n", argzone);
dc_list = hostname_to_dn_list (argzone, argzone, DNS_TOP);
basedn = build_dn_from_dc_list (dc_list, 0, NO_SPEC);
for (ctmp = &basedn[strlen (basedn)]; ctmp >= &basedn[0]; ctmp--)
{
if ((*ctmp == ',') || (ctmp == &basedn[0]))
{
base.mod_op = LDAP_MOD_ADD;
base.mod_type = "objectClass";
base.mod_values = topObjectClasses;
base_attrs[0] = &base;
base_attrs[1] = NULL;
if (ldapbase)
{
if (ctmp != &basedn[0])
sprintf (fullbasedn, "%s,%s", ctmp + 1, ldapbase);
else
sprintf (fullbasedn, "%s,%s", ctmp, ldapbase);
}
else
{
if (ctmp != &basedn[0])
sprintf (fullbasedn, "%s", ctmp + 1);
else
sprintf (fullbasedn, "%s", ctmp);
}
result = ldap_add_s (conn, fullbasedn, base_attrs);
ldap_result_check ("intial ldap_add_s", fullbasedn, result);
}
}
}
else
{
if (debug)
printf ("Skipping zone base dn creation for %s\n", argzone);
}
for (tmp = ldap_info_base; tmp != NULL; tmp = tmp->next)
{
if (debug)
printf ("Adding DN: %s\n", tmp->dn);
add_ldap_values (tmp);
}
if (debug)
printf("Operation Complete.\n");
return 0;
}
/* Check the status of an isc_result_t after any isc routines.
* I should probably rename this function, as not to cause any
* confusion with the isc* routines. Will exit on error. */
void
isc_result_check (isc_result_t res, char *errorstr)
{
if (res != ISC_R_SUCCESS)
{
fprintf (stderr, " %s: %s\n", errorstr, isc_result_totext (res));
exit (-1);
}
}
/* Takes DNS information, in bind data structure format, and adds textual
* zone information to the LDAP run queue. */
void
generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl)
{
unsigned char name[DNS_NAME_MAXTEXT + 1];
unsigned int len;
unsigned char type[20];
unsigned char data[2048];
char **dc_list;
char *dn;
isc_buffer_t buff;
isc_result_t result;
isc_buffer_init (&buff, name, sizeof (name));
result = dns_name_totext (dnsname, ISC_TRUE, &buff);
isc_result_check (result, "dns_name_totext");
name[isc_buffer_usedlength (&buff)] = 0;
isc_buffer_init (&buff, type, sizeof (type));
result = dns_rdatatype_totext (rdata->type, &buff);
isc_result_check (result, "dns_rdatatype_totext");
type[isc_buffer_usedlength (&buff)] = 0;
isc_buffer_init (&buff, data, sizeof (data));
result = dns_rdata_totext (rdata, NULL, &buff);
isc_result_check (result, "dns_rdata_totext");
data[isc_buffer_usedlength (&buff)] = 0;
dc_list = hostname_to_dn_list (name, argzone, DNS_OBJECT);
len = (get_attr_list_size (dc_list) - 2);
dn = build_dn_from_dc_list (dc_list, ttl, WI_SPEC);
if (debug)
printf ("Adding %s (%s %s) to run queue list.\n", dn, type, data);
add_to_rr_list (dn, dc_list[len], type, data, ttl, DNS_OBJECT);
}
/* Locate an item in the Run queue linked list, by DN. Used by functions
* which add items to the run queue.
*/
ldap_info *
locate_by_dn (char *dn)
{
ldap_info *tmp;
for (tmp = ldap_info_base; tmp != (ldap_info *) NULL; tmp = tmp->next)
{
if (!strncmp (tmp->dn, dn, strlen (dn)))
return tmp;
}
return (ldap_info *) NULL;
}
/* Take textual zone data, and add to the LDAP Run queue. This works like so:
* If locate_by_dn does not return, alloc a new ldap_info structure, and then
* calloc a LDAPMod array, fill in the default "everyone needs this" information,
* including object classes and dc's. If it locate_by_dn does return, then we'll
* realloc for more LDAPMod structs, and appened the new data. If an LDAPMod exists
* for the parameter we're adding, then we'll realloc the mod_values array, and
* add the new value to the existing LDAPMod. Finnaly, it assures linkage exists
* within the Run queue linked ilst*/
void
add_to_rr_list (char *dn, char *name, char *type,
char *data, unsigned int ttl, unsigned int flags)
{
int i;
int x;
ldap_info *tmp;
int attrlist;
char ldap_type_buffer[128];
char charttl[64];
if ((tmp = locate_by_dn (dn)) == NULL)
{
/* There wasn't one already there, so we need to allocate a new one,
* and stick it on the list */
tmp = (ldap_info *) malloc (sizeof (ldap_info));
if (tmp == (ldap_info *) NULL)
{
fprintf (stderr, "malloc: %s\n", strerror (errno));
ldap_unbind_s (conn);
exit (-1);
}
tmp->dn = strdup (dn);
tmp->attrs = (LDAPMod **) calloc (sizeof (LDAPMod *), flags);
if (tmp->attrs == (LDAPMod **) NULL)
{
fprintf (stderr, "calloc: %s\n", strerror (errno));
ldap_unbind_s (conn);
exit (-1);
}
for (i = 0; i < flags; i++)
{
tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod));
if (tmp->attrs[i] == (LDAPMod *) NULL)
{
fprintf (stderr, "malloc: %s\n", strerror (errno));
exit (-1);
}
}
tmp->attrs[0]->mod_op = LDAP_MOD_ADD;
tmp->attrs[0]->mod_type = "objectClass";
if (flags == DNS_OBJECT)
tmp->attrs[0]->mod_values = objectClasses;
else
{
tmp->attrs[0]->mod_values = topObjectClasses;
tmp->attrs[1] = NULL;
tmp->attrcnt = 2;
tmp->next = ldap_info_base;
ldap_info_base = tmp;
return;
}
tmp->attrs[1]->mod_op = LDAP_MOD_ADD;
tmp->attrs[1]->mod_type = "relativeDomainName";
tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);
if (tmp->attrs[1]->mod_values == (char **)NULL)
exit(-1);
tmp->attrs[1]->mod_values[0] = strdup (name);
tmp->attrs[1]->mod_values[2] = NULL;
sprintf (ldap_type_buffer, "%sRecord", type);
tmp->attrs[2]->mod_op = LDAP_MOD_ADD;
tmp->attrs[2]->mod_type = strdup (ldap_type_buffer);
tmp->attrs[2]->mod_values = (char **) calloc (sizeof (char *), 2);
if (tmp->attrs[2]->mod_values == (char **)NULL)
exit(-1);
tmp->attrs[2]->mod_values[0] = strdup (data);
tmp->attrs[2]->mod_values[1] = NULL;
tmp->attrs[3]->mod_op = LDAP_MOD_ADD;
tmp->attrs[3]->mod_type = "dNSTTL";
tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);
if (tmp->attrs[3]->mod_values == (char **)NULL)
exit(-1);
sprintf (charttl, "%d", ttl);
tmp->attrs[3]->mod_values[0] = strdup (charttl);
tmp->attrs[3]->mod_values[1] = NULL;
tmp->attrs[4]->mod_op = LDAP_MOD_ADD;
tmp->attrs[4]->mod_type = "zoneName";
tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);
tmp->attrs[4]->mod_values[0] = gbl_zone;
tmp->attrs[4]->mod_values[1] = NULL;
tmp->attrs[5] = NULL;
tmp->attrcnt = flags;
tmp->next = ldap_info_base;
ldap_info_base = tmp;
}
else
{
for (i = 0; tmp->attrs[i] != NULL; i++)
{
sprintf (ldap_type_buffer, "%sRecord", type);
if (!strncmp
(ldap_type_buffer, tmp->attrs[i]->mod_type,
strlen (tmp->attrs[i]->mod_type)))
{
attrlist = get_attr_list_size (tmp->attrs[i]->mod_values);
tmp->attrs[i]->mod_values =
(char **) realloc (tmp->attrs[i]->mod_values,
sizeof (char *) * (attrlist + 1));
if (tmp->attrs[i]->mod_values == (char **) NULL)
{
fprintf (stderr, "realloc: %s\n", strerror (errno));
ldap_unbind_s (conn);
exit (-1);
}
for (x = 0; tmp->attrs[i]->mod_values[x] != NULL; x++);
tmp->attrs[i]->mod_values[x] = strdup (data);
tmp->attrs[i]->mod_values[x + 1] = NULL;
return;
}
}
tmp->attrs =
(LDAPMod **) realloc (tmp->attrs,
sizeof (LDAPMod) * ++(tmp->attrcnt));
if (tmp->attrs == NULL)
{
fprintf (stderr, "realloc: %s\n", strerror (errno));
ldap_unbind_s (conn);
exit (-1);
}
for (x = 0; tmp->attrs[x] != NULL; x++);
tmp->attrs[x] = (LDAPMod *) malloc (sizeof (LDAPMod));
tmp->attrs[x]->mod_op = LDAP_MOD_ADD;
tmp->attrs[x]->mod_type = strdup (ldap_type_buffer);
tmp->attrs[x]->mod_values = (char **) calloc (sizeof (char *), 2);
tmp->attrs[x]->mod_values[0] = strdup (data);
tmp->attrs[x]->mod_values[1] = NULL;
tmp->attrs[x + 1] = NULL;
}
}
/* Size of a mod_values list, plus the terminating NULL field. */
int
get_attr_list_size (char **tmp)
{
int i = 0;
char **ftmp = tmp;
while (*ftmp != NULL)
{
i++;
ftmp++;
}
return ++i;
}
/* take a hostname, and split it into a char ** of the dc parts,
* example, we have www.domain.com, this function will return:
* array[0] = com, array[1] = domain, array[2] = www. */
char **
hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)
{
char *tmp;
static char *dn_buffer[64];
int i = 0;
char *zname;
char *hnamebuff;
zname = strdup (hostname);
if (flags == DNS_OBJECT)
{
if (strlen (zname) != strlen (zone))
{
tmp = &zname[strlen (zname) - strlen (zone)];
*--tmp = '\0';
hnamebuff = strdup (zname);
zname = ++tmp;
}
else
hnamebuff = "@";
}
else
{
zname = zone;
hnamebuff = NULL;
}
for (tmp = strrchr (zname, '.'); tmp != (char *) 0;
tmp = strrchr (zname, '.'))
{
*tmp++ = '\0';
dn_buffer[i++] = tmp;
}
dn_buffer[i++] = zname;
dn_buffer[i++] = hnamebuff;
dn_buffer[i] = NULL;
return dn_buffer;
}
/* build an sdb compatible LDAP DN from a "dc_list" (char **).
* will append dNSTTL information to each RR Record, with the
* exception of "@"/SOA. */
char *
build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag)
{
int size;
int x;
static char dn[1024];
char tmp[128];
bzero (tmp, sizeof (tmp));
bzero (dn, sizeof (dn));
size = get_attr_list_size (dc_list);
for (x = size - 2; x > 0; x--)
{
if (flag == WI_SPEC)
{
if (x == (size - 2) && (strncmp (dc_list[x], "@", 1) == 0) && (ttl))
sprintf (tmp, "relativeDomainName=%s + dNSTTL=%d,", dc_list[x], ttl);
else if (x == (size - 2))
sprintf(tmp, "relativeDomainName=%s,",dc_list[x]);
else
sprintf(tmp,"dc=%s,", dc_list[x]);
}
else
{
sprintf(tmp, "dc=%s,", dc_list[x]);
}
strncat (dn, tmp, sizeof (dn) - strlen (dn));
}
sprintf (tmp, "dc=%s", dc_list[0]);
strncat (dn, tmp, sizeof (dn) - strlen (dn));
fflush(NULL);
return dn;
}
/* Initialize LDAP Conn */
void
init_ldap_conn ()
{
int result;
conn = ldap_open (ldapsystem, LDAP_PORT);
if (conn == NULL)
{
fprintf (stderr, "Error opening Ldap connection: %s\n",
strerror (errno));
exit (-1);
}
result = ldap_simple_bind_s (conn, binddn, bindpw);
ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result);
}
/* Like isc_result_check, only for LDAP */
void
ldap_result_check (char *msg, char *dn, int err)
{
if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS))
{
fprintf(stderr, "Error while adding %s (%s):\n",
dn, msg);
ldap_perror (conn, dn);
ldap_unbind_s (conn);
exit (-1);
}
}
/* For running the ldap_info run queue. */
void
add_ldap_values (ldap_info * ldinfo)
{
int result;
char dnbuffer[1024];
if (ldapbase != NULL)
sprintf (dnbuffer, "%s,%s", ldinfo->dn, ldapbase);
else
sprintf (dnbuffer, "%s", ldinfo->dn);
result = ldap_add_s (conn, dnbuffer, ldinfo->attrs);
ldap_result_check ("ldap_add_s", dnbuffer, result);
}
/* name says it all */
void
usage ()
{
fprintf (stderr,
"zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]
[-c Create LDAP Base structure][-d Debug Output (lots !)] \n ");}
-348
View File
@@ -1,348 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: pgsqldb.c,v 1.12 2001/02/28 23:42:37 bwelling Exp $ */
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pgsql/libpq-fe.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/sdb.h>
#include <dns/result.h>
#include <named/globals.h>
#include "pgsqldb.h"
/*
* A simple database driver that interfaces to a PostgreSQL database. This
* is not complete, and not designed for general use. It opens one
* connection to the database per zone, which is inefficient. It also may
* not handle quoting correctly.
*
* The table must contain the fields "name", "rdtype", and "rdata", and
* is expected to contain a properly constructed zone. The program "zonetodb"
* creates such a table.
*/
static dns_sdbimplementation_t *pgsqldb = NULL;
struct dbinfo {
PGconn *conn;
char *database;
char *table;
char *host;
char *user;
char *passwd;
};
static void
pgsqldb_destroy(const char *zone, void *driverdata, void **dbdata);
/*
* Canonicalize a string before writing it to the database.
* "dest" must be an array of at least size 2*strlen(source) + 1.
*/
static void
quotestring(const char *source, char *dest) {
while (*source != 0) {
if (*source == '\'')
*dest++ = '\'';
/* SQL doesn't treat \ as special, but PostgreSQL does */
else if (*source == '\\')
*dest++ = '\\';
*dest++ = *source++;
}
*dest++ = 0;
}
/*
* Connect to the database.
*/
static isc_result_t
db_connect(struct dbinfo *dbi) {
dbi->conn = PQsetdbLogin(dbi->host, NULL, NULL, NULL, dbi->database,
dbi->user, dbi->passwd);
if (PQstatus(dbi->conn) == CONNECTION_OK)
return (ISC_R_SUCCESS);
else
return (ISC_R_FAILURE);
}
/*
* Check to see if the connection is still valid. If not, attempt to
* reconnect.
*/
static isc_result_t
maybe_reconnect(struct dbinfo *dbi) {
if (PQstatus(dbi->conn) == CONNECTION_OK)
return (ISC_R_SUCCESS);
return (db_connect(dbi));
}
/*
* This database operates on absolute names.
*
* Queries are converted into SQL queries and issued synchronously. Errors
* are handled really badly.
*/
static isc_result_t
pgsqldb_lookup(const char *zone, const char *name, void *dbdata,
dns_sdblookup_t *lookup)
{
isc_result_t result;
struct dbinfo *dbi = dbdata;
PGresult *res;
char str[1500];
char *canonname;
int i;
UNUSED(zone);
canonname = isc_mem_get(ns_g_mctx, strlen(name) * 2 + 1);
if (canonname == NULL)
return (ISC_R_NOMEMORY);
quotestring(name, canonname);
snprintf(str, sizeof(str),
"SELECT TTL,RDTYPE,RDATA FROM \"%s\" WHERE "
"lower(NAME) = lower('%s')", dbi->table, canonname);
isc_mem_put(ns_g_mctx, canonname, strlen(name) * 2 + 1);
result = maybe_reconnect(dbi);
if (result != ISC_R_SUCCESS)
return (result);
res = PQexec(dbi->conn, str);
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
PQclear(res);
return (ISC_R_FAILURE);
}
if (PQntuples(res) == 0) {
PQclear(res);
return (ISC_R_NOTFOUND);
}
for (i = 0; i < PQntuples(res); i++) {
char *ttlstr = PQgetvalue(res, i, 0);
char *type = PQgetvalue(res, i, 1);
char *data = PQgetvalue(res, i, 2);
dns_ttl_t ttl;
char *endp;
ttl = strtol(ttlstr, &endp, 10);
if (*endp != '\0') {
PQclear(res);
return (DNS_R_BADTTL);
}
result = dns_sdb_putrr(lookup, type, ttl, data);
if (result != ISC_R_SUCCESS) {
PQclear(res);
return (ISC_R_FAILURE);
}
}
PQclear(res);
return (ISC_R_SUCCESS);
}
/*
* Issue an SQL query to return all nodes in the database and fill the
* allnodes structure.
*/
static isc_result_t
pgsqldb_allnodes(const char *zone, void *dbdata, dns_sdballnodes_t *allnodes) {
struct dbinfo *dbi = dbdata;
PGresult *res;
isc_result_t result;
char str[1500];
int i;
UNUSED(zone);
snprintf(str, sizeof(str),
"SELECT TTL,NAME,RDTYPE,RDATA FROM \"%s\" ORDER BY NAME",
dbi->table);
result = maybe_reconnect(dbi);
if (result != ISC_R_SUCCESS)
return (result);
res = PQexec(dbi->conn, str);
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ) {
PQclear(res);
return (ISC_R_FAILURE);
}
if (PQntuples(res) == 0) {
PQclear(res);
return (ISC_R_NOTFOUND);
}
for (i = 0; i < PQntuples(res); i++) {
char *ttlstr = PQgetvalue(res, i, 0);
char *name = PQgetvalue(res, i, 1);
char *type = PQgetvalue(res, i, 2);
char *data = PQgetvalue(res, i, 3);
dns_ttl_t ttl;
char *endp;
ttl = strtol(ttlstr, &endp, 10);
if (*endp != '\0') {
PQclear(res);
return (DNS_R_BADTTL);
}
result = dns_sdb_putnamedrr(allnodes, name, type, ttl, data);
if (result != ISC_R_SUCCESS) {
PQclear(res);
return (ISC_R_FAILURE);
}
}
PQclear(res);
return (ISC_R_SUCCESS);
}
/*
* Create a connection to the database and save any necessary information
* in dbdata.
*
* argv[0] is the name of the database
* argv[1] is the name of the table
* argv[2] (if present) is the name of the host to connect to
* argv[3] (if present) is the name of the user to connect as
* argv[4] (if present) is the name of the password to connect with
*/
static isc_result_t
pgsqldb_create(const char *zone, int argc, char **argv,
void *driverdata, void **dbdata)
{
struct dbinfo *dbi;
isc_result_t result;
UNUSED(zone);
UNUSED(driverdata);
if (argc < 2)
return (ISC_R_FAILURE);
dbi = isc_mem_get(ns_g_mctx, sizeof(struct dbinfo));
if (dbi == NULL)
return (ISC_R_NOMEMORY);
dbi->conn = NULL;
dbi->database = NULL;
dbi->table = NULL;
dbi->host = NULL;
dbi->user = NULL;
dbi->passwd = NULL;
#define STRDUP_OR_FAIL(target, source) \
do { \
target = isc_mem_strdup(ns_g_mctx, source); \
if (target == NULL) { \
result = ISC_R_NOMEMORY; \
goto cleanup; \
} \
} while (0);
STRDUP_OR_FAIL(dbi->database, argv[0]);
STRDUP_OR_FAIL(dbi->table, argv[1]);
if (argc > 2)
STRDUP_OR_FAIL(dbi->host, argv[2]);
if (argc > 3)
STRDUP_OR_FAIL(dbi->user, argv[3]);
if (argc > 4)
STRDUP_OR_FAIL(dbi->passwd, argv[4]);
result = db_connect(dbi);
if (result != ISC_R_SUCCESS)
goto cleanup;
*dbdata = dbi;
return (ISC_R_SUCCESS);
cleanup:
pgsqldb_destroy(zone, driverdata, (void **)&dbi);
return (result);
}
/*
* Close the connection to the database.
*/
static void
pgsqldb_destroy(const char *zone, void *driverdata, void **dbdata) {
struct dbinfo *dbi = *dbdata;
UNUSED(zone);
UNUSED(driverdata);
if (dbi->conn != NULL)
PQfinish(dbi->conn);
if (dbi->database != NULL)
isc_mem_free(ns_g_mctx, dbi->database);
if (dbi->table != NULL)
isc_mem_free(ns_g_mctx, dbi->table);
if (dbi->host != NULL)
isc_mem_free(ns_g_mctx, dbi->host);
if (dbi->user != NULL)
isc_mem_free(ns_g_mctx, dbi->user);
if (dbi->passwd != NULL)
isc_mem_free(ns_g_mctx, dbi->passwd);
if (dbi->database != NULL)
isc_mem_free(ns_g_mctx, dbi->database);
isc_mem_put(ns_g_mctx, dbi, sizeof(struct dbinfo));
}
/*
* Since the SQL database corresponds to a zone, the authority data should
* be returned by the lookup() function. Therefore the authority() function
* is NULL.
*/
static dns_sdbmethods_t pgsqldb_methods = {
pgsqldb_lookup,
NULL, /* authority */
pgsqldb_allnodes,
pgsqldb_create,
pgsqldb_destroy
};
/*
* Wrapper around dns_sdb_register().
*/
isc_result_t
pgsqldb_init(void) {
unsigned int flags;
flags = 0;
return (dns_sdb_register("pgsql", &pgsqldb_methods, NULL, flags,
ns_g_mctx, &pgsqldb));
}
/*
* Wrapper around dns_sdb_unregister().
*/
void
pgsqldb_clear(void) {
if (pgsqldb != NULL)
dns_sdb_unregister(&pgsqldb);
}
-25
View File
@@ -1,25 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: pgsqldb.h,v 1.2 2001/01/09 21:46:27 bwelling Exp $ */
#include <isc/types.h>
isc_result_t pgsqldb_init(void);
void pgsqldb_clear(void);
-51
View File
@@ -1,51 +0,0 @@
# Copyright (C) 2000, 2001 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
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# $Id: lookup.tcl,v 1.7 2001/01/09 21:46:24 bwelling Exp $
#
# Sample lookup procedure for tcldb
#
# This lookup procedure defines zones with identical SOA, NS, and MX
# records at the apex and a single A record that varies from zone to
# zone at the name "www".
#
# Something like this could be used by a web hosting company to serve
# a number of domains without needing to create a separate master file
# for each domain. Instead, all per-zone data (in this case, a single
# IP address) specified in the named.conf file like this:
#
# zone "a.com." { type master; database "tcl 10.0.0.42"; };
# zone "b.com." { type master; database "tcl 10.0.0.99"; };
#
# Since the tcldb driver doesn't support zone transfers, there should
# be at least two identically configured master servers. In the
# example below, they are assumed to be called ns1.isp.nil and
# ns2.isp.nil.
#
proc lookup {zone name} {
global dbargs
switch -- $name {
@ { return [list \
{SOA 86400 "ns1.isp.nil. hostmaster.isp.nil. \
1 3600 1800 1814400 3600"} \
{NS 86400 "ns1.isp.nil."} \
{NS 86400 "ns2.isp.nil."} \
{MX 86400 "10 mail.isp.nil."} ] }
www { return [list [list A 3600 $dbargs($zone)] ] }
}
return NXDOMAIN
}
-232
View File
@@ -1,232 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tcldb.c,v 1.7 2001/01/09 21:46:28 bwelling Exp $ */
/*
* A simple database driver that calls a Tcl procedure to define
* the contents of the DNS namespace. The procedure is loaded
* from the file lookup.tcl; look at the comments there for
* more information.
*/
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/log.h>
#include <dns/sdb.h>
#include <named/globals.h>
#include <tcl.h>
#include <tcldb.h>
#define CHECK(op) \
do { result = (op); \
if (result != ISC_R_SUCCESS) return (result); \
} while (0)
typedef struct tcldb_driver {
isc_mem_t *mctx;
Tcl_Interp *interp;
} tcldb_driver_t;
static tcldb_driver_t *the_driver = NULL;
static dns_sdbimplementation_t *tcldb = NULL;
static isc_result_t
tcldb_driver_create(isc_mem_t *mctx, tcldb_driver_t **driverp) {
int tclres;
isc_result_t result = ISC_R_SUCCESS;
tcldb_driver_t *driver = isc_mem_get(mctx, sizeof(tcldb_driver_t));
if (driver == NULL)
return (ISC_R_NOMEMORY);
driver->mctx = mctx;
driver->interp = Tcl_CreateInterp();
tclres = Tcl_EvalFile(driver->interp, (char *) "lookup.tcl");
if (tclres != TCL_OK) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
"initializing tcldb: "
"loading 'lookup.tcl' failed: %s",
driver->interp->result);
result = ISC_R_FAILURE;
goto cleanup;
}
*driverp = driver;
return (ISC_R_SUCCESS);
cleanup:
isc_mem_put(mctx, driver, sizeof(tcldb_driver_t));
return (result);
}
static void
tcldb_driver_destroy(tcldb_driver_t **driverp) {
tcldb_driver_t *driver = *driverp;
Tcl_DeleteInterp(driver->interp);
isc_mem_put(driver->mctx, driver, sizeof(tcldb_driver_t));
}
/*
* Perform a lookup, by invoking the Tcl procedure "lookup".
*/
static isc_result_t
tcldb_lookup(const char *zone, const char *name, void *dbdata,
dns_sdblookup_t *lookup)
{
isc_result_t result = ISC_R_SUCCESS;
int tclres;
int rrc; /* RR count */
char **rrv; /* RR vector */
int i;
char *cmdv[3];
char *cmd;
tcldb_driver_t *driver = (tcldb_driver_t *) dbdata;
cmdv[0] = "lookup";
cmdv[1] = zone;
cmdv[2] = name;
cmd = Tcl_Merge(3, cmdv);
tclres = Tcl_Eval(driver->interp, cmd);
Tcl_Free(cmd);
if (tclres != TCL_OK) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
"zone '%s': tcl lookup function failed: %s",
zone, driver->interp->result);
return (ISC_R_FAILURE);
}
if (strcmp(driver->interp->result, "NXDOMAIN") == 0) {
result = ISC_R_NOTFOUND;
goto fail;
}
tclres = Tcl_SplitList(driver->interp, driver->interp->result,
&rrc, &rrv);
if (tclres != TCL_OK)
goto malformed;
for (i = 0; i < rrc; i++) {
isc_result_t tmpres;
int fieldc; /* Field count */
char **fieldv; /* Field vector */
tclres = Tcl_SplitList(driver->interp, rrv[i],
&fieldc, &fieldv);
if (tclres != TCL_OK) {
tmpres = ISC_R_FAILURE;
goto failrr;
}
if (fieldc != 3)
goto malformed;
tmpres = dns_sdb_putrr(lookup, fieldv[0], atoi(fieldv[1]),
fieldv[2]);
Tcl_Free((char *) fieldv);
failrr:
if (tmpres != ISC_R_SUCCESS)
result = tmpres;
}
Tcl_Free((char *) rrv);
if (result == ISC_R_SUCCESS)
return (result);
malformed:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
"zone '%s': "
"malformed return value from tcl lookup function: %s",
zone, driver->interp->result);
result = ISC_R_FAILURE;
fail:
return (result);
}
/*
* Set up per-zone state. In our case, the database arguments of the
* zone are collected into a Tcl list and assigned to an element of
* the global array "dbargs".
*/
static isc_result_t
tcldb_create(const char *zone, int argc, char **argv,
void *driverdata, void **dbdata)
{
tcldb_driver_t *driver = (tcldb_driver_t *) driverdata;
char *list = Tcl_Merge(argc, argv);
Tcl_SetVar2(driver->interp, (char *) "dbargs", (char *) zone, list, 0);
Tcl_Free(list);
*dbdata = driverdata;
return (ISC_R_SUCCESS);
}
/*
* This driver does not support zone transfer, so allnodes() is NULL.
*/
static dns_sdbmethods_t tcldb_methods = {
tcldb_lookup,
NULL, /* authority */
NULL, /* allnodes */
tcldb_create,
NULL /* destroy */
};
/*
* Initialize the tcldb driver.
*/
isc_result_t
tcldb_init(void) {
isc_result_t result;
int flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA;
result = tcldb_driver_create(ns_g_mctx, &the_driver);
if (result != ISC_R_SUCCESS)
return (result);
return (dns_sdb_register("tcl", &tcldb_methods, the_driver, flags,
ns_g_mctx, &tcldb));
}
/*
* Wrapper around dns_sdb_unregister().
*/
void
tcldb_clear(void) {
if (tcldb != NULL)
dns_sdb_unregister(&tcldb);
if (the_driver != NULL)
tcldb_driver_destroy(&the_driver);
}
-25
View File
@@ -1,25 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tcldb.h,v 1.4 2001/01/09 21:46:29 bwelling Exp $ */
#include <isc/types.h>
isc_result_t tcldb_init(void);
void tcldb_clear(void);
-143
View File
@@ -1,143 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: timedb.c,v 1.7 2001/01/09 21:46:30 bwelling Exp $ */
/*
* A simple database driver that enables the server to return the
* current time in a DNS record.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/sdb.h>
#include <named/globals.h>
#include "timedb.h"
static dns_sdbimplementation_t *timedb = NULL;
/*
* This database operates on relative names.
*
* "time" and "@" return the time in a TXT record.
* "clock" is a CNAME to "time"
* "current" is a DNAME to "@" (try time.current.time)
*/
static isc_result_t
timedb_lookup(const char *zone, const char *name, void *dbdata,
dns_sdblookup_t *lookup)
{
isc_result_t result;
UNUSED(zone);
UNUSED(dbdata);
if (strcmp(name, "@") == 0 || strcmp(name, "time") == 0) {
time_t now = time(NULL);
char buf[100];
int n;
/*
* Call ctime to create the string, put it in quotes, and
* remove the trailing newline.
*/
n = snprintf(buf, sizeof(buf), "\"%s", ctime(&now));
if (n < 0)
return (ISC_R_FAILURE);
buf[n - 1] = '\"';
result = dns_sdb_putrr(lookup, "txt", 1, buf);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
} else if (strcmp(name, "clock") == 0) {
result = dns_sdb_putrr(lookup, "cname", 1, "time");
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
} else if (strcmp(name, "current") == 0) {
result = dns_sdb_putrr(lookup, "dname", 1, "@");
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
} else
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
}
/*
* lookup() does not return SOA or NS records, so authority() must be defined.
*/
static isc_result_t
timedb_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
isc_result_t result;
UNUSED(zone);
UNUSED(dbdata);
result = dns_sdb_putsoa(lookup, "localhost.", "root.localhost.", 0);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
result = dns_sdb_putrr(lookup, "ns", 86400, "ns1.localdomain.");
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
result = dns_sdb_putrr(lookup, "ns", 86400, "ns2.localdomain.");
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
/*
* This zone does not support zone transfer, so allnodes() is NULL. There
* is no database specific data, so create() and destroy() are NULL.
*/
static dns_sdbmethods_t timedb_methods = {
timedb_lookup,
timedb_authority,
NULL, /* allnodes */
NULL, /* create */
NULL /* destroy */
};
/*
* Wrapper around dns_sdb_register().
*/
isc_result_t
timedb_init(void) {
unsigned int flags;
flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA;
return (dns_sdb_register("time", &timedb_methods, NULL, flags,
ns_g_mctx, &timedb));
}
/*
* Wrapper around dns_sdb_unregister().
*/
void
timedb_clear(void) {
if (timedb != NULL)
dns_sdb_unregister(&timedb);
}
-25
View File
@@ -1,25 +0,0 @@
/*
* Copyright (C) 2000, 2001 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: timedb.h,v 1.2 2001/01/09 21:46:31 bwelling Exp $ */
#include <isc/types.h>
isc_result_t timedb_init(void);
void timedb_clear(void);
+46 -104
View File
@@ -2,7 +2,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
<!-- File: $Id: Bv9ARM-book.xml,v 1.155.2.16 2002/01/23 01:41:17 gson Exp $ -->
<!-- File: $Id: Bv9ARM-book.xml,v 1.155.2.2 2001/10/15 18:21:25 gson Exp $ -->
<book>
<title>BIND 9 Administrator Reference Manual</title>
@@ -158,8 +158,8 @@ domain.</para>
<para>For example, a domain name for a host at the
company <emphasis>Example, Inc.</emphasis> could be
<literal>mail.example.com</literal>,
where <literal>com</literal> is the
<literal>mail.example.net</literal>,
were <literal>com</literal> is the
top level domain to which
<literal>ourhost.example.com</literal> belongs,
<literal>example</literal> is
@@ -764,11 +764,7 @@ of a server.</para>
</varlistentry>
<varlistentry><term><userinput>querylog</userinput></term>
<listitem><para>Toggle query logging. Query logging can also be enabled
by explictly directing the <command>queries</command>
<command>category</command> to a <command>channel</command> in the
<command>logging</command> section of
<filename>named.conf</filename>.</para></listitem></varlistentry>
<listitem><para>Toggle query logging.</para></listitem></varlistentry>
<varlistentry><term><userinput>dumpdb</userinput></term>
<listitem><para>Dump the server's caches to the dump file. </para></listitem></varlistentry>
@@ -1144,7 +1140,7 @@ options {
...
};
zone "site1.example.com" { // sample master zone
zone "site1.example.com" { // sample slave zone
type master;
file "m/site1.example.com";
forwarders { }; // do normal iterative
@@ -1432,10 +1428,9 @@ allow-update { key host1-host2. ;};
the zone keys of any secure delegated zones. Zone keys must
have the same name as the zone, a name type of
<command>ZONE</command>, and must be usable for authentication.
It is recommended that zone keys use a cryptographic algorithm
designated as "mandatory to implement" by the IETF; currently
these are RSASHA1 (which is not yet supported in BIND 9.2)
and DSA.</para>
It is recommended that zone keys be mandatory to implement a
cryptographic algorithm; currently the only key mandatory to
implement an algorithm is DSA.</para>
<para>The following command will generate a 768 bit DSA key for
the <filename>child.example</filename> zone:</para>
@@ -1794,7 +1789,7 @@ that is distinct from and simpler than the full DNS protocol.</para></sect1>
run the resolver daemon <command>lwresd</command>.</para>
<para>By default, applications using the lightweight resolver library will make
UDP requests to the IPv4 loopback address (127.0.0.1) on port 921. The
address can be overridden by <command>lwserver</command> lines in
address can be overriden by <command>lwserver</command> lines in
<filename>/etc/resolv.conf</filename>.
The daemon will try to find the answer to the questions "what are the
addresses for host
@@ -1899,9 +1894,9 @@ separated by semicolons and ending with a semicolon.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para><varname>number</varname></para></entry>
<entry colname = "2"><para>A non-negative 32 bit unsigned integer
(i.e., a number between 0 and 4294967295, inclusive).
Its acceptable value might further
<entry colname = "2"><para>A non-negative integer with an entire
range limited by the range of a C language signed integer (2,147,483,647
on a machine with 32 bit integers). Its acceptable value might further
be limited by the context in which it is used.</para></entry>
</row>
<row rowsep = "0">
@@ -1912,17 +1907,18 @@ a pathname, such as <filename>zones/master/my.test.domain</filename>.</para></en
<row rowsep = "0">
<entry colname = "1"><para><varname>size_spec</varname></para></entry>
<entry colname = "2"><para>A number, the word <userinput>unlimited</userinput>,
or the word <userinput>default</userinput>.</para><para>
An <varname>unlimited</varname> <varname>size_spec</varname> requests unlimited
or the word <userinput>default</userinput>.</para><para>The maximum
value of <varname>size_spec</varname> is that of unsigned long integers
on the machine. An <varname>unlimited</varname> <varname>size_spec</varname> requests unlimited
use, or the maximum available amount. A <varname>default size_spec</varname> uses
the limit that was in force when the server was started.</para><para>A <varname>number</varname> can
optionally be followed by a scaling factor: <userinput>K</userinput> or <userinput>k</userinput> for
kilobytes, <userinput>M</userinput> or <userinput>m</userinput> for
megabytes, and <userinput>G</userinput> or <userinput>g</userinput> for gigabytes,
which scale by 1024, 1024*1024, and 1024*1024*1024 respectively.</para>
<para>The value must be representable as a 64-bit unsigned integer
(0 to 18446744073709551615, inclusive).
Using <varname>unlimited</varname> is the best way
which scale by 1024, 1024*1024, and 1024*1024*1024 respectively.</para><para>Integer
storage overflow is currently silently ignored during conversion
of scaled values, resulting in values less than intended, possibly
even negative. Using <varname>unlimited</varname> is the best way
to safely set a really large number.</para></entry>
</row>
<row rowsep = "0">
@@ -2155,7 +2151,7 @@ Usage</title>
<para>The following ACLs are built-in:</para>
<informaltable colsep = "0" rowsep = "0"><tgroup cols = "2"
<informaltable colsep = "0" rowsep = "0"><tgroup cols = "2"
colsep = "0" rowsep = "0" tgroupstyle = "3Level-table">
<colspec colname = "1" colnum = "1" colsep = "0" colwidth = "1.130in"/>
<colspec colname = "2" colnum = "2" colsep = "0" colwidth = "4.000in"/>
@@ -2170,27 +2166,18 @@ Usage</title>
</row>
<row rowsep = "0">
<entry colname = "1"><para><command>localhost</command></para></entry>
<entry colname = "2"><para>Matches the IPv4 addresses of all network
interfaces on the system.</para></entry>
<entry colname = "2"><para>Matches the IP addresses of all interfaces
on the system.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para><command>localnets</command></para></entry>
<entry colname = "2"><para>Matches any host on an IPv4 network for which
<entry colname = "2"><para>Matches any host on a network for which
the system has an interface.</para></entry>
</row>
</tbody>
</tgroup></informaltable>
<para>The <command>localhost</command> and <command>localnets</command>
ACLs do not currently support IPv6 (that is,
<command>localhost</command> does not match the host's IPv6 addresses,
and <command>localnets</command> does not match the host's attached
IPv6 networks) due to the lack of a standard method of determining the
complete set of local IPv6 addresses for a host.
</para>
</sect2>
<sect2>
</sect2>
<sect2>
<title><command>controls</command> Statement Grammar</title>
<programlisting><command>controls</command> {
inet ( ip_addr | * ) <optional> port ip_port </optional> allow { <replaceable> address_match_list </replaceable> }
@@ -2209,20 +2196,12 @@ complete set of local IPv6 addresses for a host.
used by the <command>rndc</command> utility to send commands to
and retrieve non-DNS results from a nameserver.</para>
<para>An <command>inet</command> control channel is a TCP
socket listening at the specified
<para>An <command>inet</command> control channel is a TCP/IP
socket accessible to the Internet, created at the specified
<command>ip_port</command> on the specified
<command>ip_addr</command>, which can be an IPv4 or IPv6
address. An <command>ip_addr</command>
of <literal>*</literal> is interpreted as the IPv4 wildcard
address; connections will be accepted on any of the system's
IPv4 addresses. To listen on the IPv6 wildcard address,
use an <command>ip_addr</command> of <literal>::</literal>.
If you will only use <command>rndc</command> on the local host,
using the loopback address (<literal>127.0.0.1</literal>
or <literal>::1</literal>) is recommended for maximum
security.
</para>
<command>ip_addr</command>. If no port is specified, port 953
is used by default. "*" cannot be used for
<command>ip_port</command>.</para>
<para>The ability to issue commands over the control channel is
restricted by the <command>allow</command> and
@@ -2265,7 +2244,7 @@ It makes it possible to use an existing <acronym>BIND</acronym> 8
configuration file in <acronym>BIND</acronym> 9 unchanged,
and still have <command>rndc</command> work the same way
<command>ndc</command> worked in BIND 8, simply by executing the
command <userinput>rndc-confgen -a</userinput> after BIND 9 is
command <userinput>rndc-keygen -a</userinput> after BIND 9 is
installed.
</para>
@@ -2290,11 +2269,6 @@ installed.
<acronym>BIND</acronym> 8 configuration file, it is ignored
and a warning is logged.</para>
<para>
To disable the command channel, use an empty <command>controls</command>
statement: <command>controls { };</command>.
</para>
</sect2>
<sect2>
<title><command>include</command> Statement Grammar</title>
@@ -2529,7 +2503,7 @@ used is described in <xref linkend="the_category_phrase"/>.
</para>
<programlisting>channel "default_syslog" {
syslog daemon; // send to syslog's daemon
syslog daemon; // end to syslog's daemon
// facility
severity info; // only send priority info
// and higher
@@ -2674,7 +2648,7 @@ the <command>null</command> channel.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para><command>queries</command></para></entry>
<entry colname = "2"><para>Queries. Using the category <command>queries</command> will enable query logging.</para></entry>
<entry colname = "2"><para>Queries.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para><command>dispatch</command></para></entry>
@@ -2935,7 +2909,11 @@ receiving and sending DNS protocol traffic.
The default is 53. This option is mainly intended for server testing;
a server using a port other than 53 will not be able to communicate with
the global DNS.
</para>
The <command>port</command> option should be placed at
the beginning of the options block, before
any other options that take port numbers or IP addresses,
to ensure that the port value takes effect for all addresses
used by the server.</para>
</listitem></varlistentry>
<varlistentry><term><command>random-device</command></term>
@@ -3420,7 +3398,7 @@ hour).</para>
<listitem><para>Slave servers will periodically query master servers
to find out if zone serial numbers have changed. Each such query uses
a minute amount of the slave server's network bandwidth. To limit the
amount of bandwidth used, BIND 9 limits the rate at which queries are
amount of bandwith used, BIND 9 limits the rate at which queries are
sent. The value of the <command>serial-query-rate</command> option,
an integer, is the maximum number of queries sent per second.
The default is 20.
@@ -3600,7 +3578,7 @@ and ignored for BIND 8 compatibility.</para>
<varlistentry><term><command>recursive-clients</command></term>
<listitem><para>The maximum number of simultaneous recursive lookups
the server will perform on behalf of clients. The default is
<literal>1000</literal>. Because each recursing client uses a fair
<literal>1000</literal>. Because each recursing clients uses a fair
bit of memory, on the order of 20 kilobytes, the value of the
<command>recursive-clients</command> option may have to be decreased
on hosts with limited memory.
@@ -3854,7 +3832,7 @@ PTR records.</para>
basis by adding a
<command>allow-v6-synthesis { <replaceable>address_match_list</replaceable> };</command>
clause to the <command>options</command> or <command>view</command> statement.
When it is enabled, recursive
When it is enabled, recursive
AAAA queries cause the server to first try an A6 lookup and if that
fails, an AAAA lookups. No matter which one succeeds, the results are
returned as a set of synthetic AAAA records. Similarly, recursive PTR
@@ -3867,9 +3845,6 @@ The results are returned as a synthetic PTR record in
<para>The synthetic records have a TTL of zero. DNSSEC validation of
synthetic responses is not currently supported; therefore responses
containing synthetic RRs will not have the AD flag set.</para>
<note><para><command>allow-v6-synthesis</command> is only performed for
clients that are supplied recursive service.</para></note>
</sect3>
<sect3 id="tuning"><title>Tuning</title>
@@ -4319,7 +4294,7 @@ of type <command>forward</command> can contain a <command>forward</command> and/
which will apply to queries within the domain given by the zone
name. If no <command>forwarders</command> statement is present or
an empty list for <command>forwarders</command> is given, then no
forwarding will be done for the domain, canceling the effects of
forwarding will be done for the domain, cancelling the effects of
any forwarders in the <command>options</command> statement. Thus
if you want to use this type of zone to change the behavior of the
global <command>forward</command> option (that is, "forward first
@@ -4417,7 +4392,7 @@ The default is the empty list.</para>
<listitem><para>
This option was used in BIND 8 to restrict the character set of
domain names in master files and/or DNS responses received from the
network. BIND 9 does not restrict the character set of domain names
netowrk. BIND 9 does not restrict the character set of domain names
and does not implement the <command>check-names</command> option.
</para>
</listitem></varlistentry>
@@ -4699,10 +4674,6 @@ or historical (h) and no longer in general use):</para>
Experimental.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>CERT</para></entry>
<entry colname = "2"><para>holds a digital certificate.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>CNAME</para></entry>
<entry colname = "2"><para>identifies the canonical name of an alias.</para></entry>
</row>
@@ -4713,10 +4684,6 @@ Replaces the domain name specified with another name to be looked
up. Described in RFC 2672.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>GPOS</para></entry>
<entry colname = "2"><para>Specifies the global position. Superseded by LOC.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>HINFO</para></entry>
<entry colname = "2"><para>identifies the CPU and OS used by a host.</para></entry>
</row>
@@ -4731,11 +4698,6 @@ Experimental.</para></entry>
DNS name.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>KX</para></entry>
<entry colname = "2"><para>identifies a key exchanger for this
DNS name.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>LOC</para></entry>
<entry colname = "2"><para>(x) for storing GPS info. See RFC 1876.
Experimental.</para></entry>
@@ -4746,14 +4708,6 @@ Experimental.</para></entry>
See RFC 974 for details.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>NAPTR</para></entry>
<entry colname = "2"><para>name authority pointer.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>NSAP</para></entry>
<entry colname = "2"><para>a network service access point.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>NS</para></entry>
<entry colname = "2"><para>the authoritative nameserver for the
domain.</para></entry>
@@ -4771,11 +4725,6 @@ See RFC 2535 for details.</para></entry>
name space.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>PX</para></entry>
<entry colname = "2"><para>provides mappings between RFC 822 and X.400
addresses.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>RP</para></entry>
<entry colname = "2"><para>(x) information on persons responsible
for the domain. Experimental.</para></entry>
@@ -4800,10 +4749,6 @@ in the secure DNS. See RFC 2535 for details.</para></entry>
services (replaces WKS).</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>TXT</para></entry>
<entry colname = "2"><para>text records.</para></entry>
</row>
<row rowsep = "0">
<entry colname = "1"><para>WKS</para></entry>
<entry colname = "2"><para>(h) information about which well known
network services, such as SMTP, that a domain supports. Historical,
@@ -4983,17 +4928,14 @@ domain names.</para>
</tgroup></informaltable>
<para>This example shows two addresses for <literal>XX.LCS.MIT.EDU</literal>,
each of a different class.</para></sect3></sect2>
<sect2><title>Discussion of MX Records</title>
<para>As described above, domain servers store information as a
series of resource records, each of which contains a particular
piece of information about a given domain name (which is usually,
but not always, a host). The simplest way to think of a RR is as
a typed pair of data, a domain name matched with a relevant datum,
and stored with some additional type information to help systems
determine when the RR is relevant.</para>
a typed pair of datum, a domain name matched with relevant data,
and stored with some additional type information to help systems determine
when the RR is relevant.</para>
<para>MX records are used to control delivery of email. The data
specified in the record is a priority and a domain name. The priority
controls the order in which email delivery is attempted, with the
+2 -2
View File
@@ -529,9 +529,9 @@ CLASS="emphasis"
> could be
<TT
CLASS="literal"
>mail.example.com</TT
>mail.example.net</TT
>,
where <TT
were <TT
CLASS="literal"
>com</TT
> is the
+3 -22
View File
@@ -984,26 +984,7 @@ CLASS="userinput"
></DT
><DD
><P
>Toggle query logging. Query logging can also be enabled
by explictly directing the <B
CLASS="command"
>queries</B
>
<B
CLASS="command"
>category</B
> to a <B
CLASS="command"
>channel</B
> in the
<B
CLASS="command"
>logging</B
> section of
<TT
CLASS="filename"
>named.conf</TT
>.</P
>Toggle query logging.</P
></DD
><DT
><TT
@@ -1391,7 +1372,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN661"
NAME="AEN656"
>3.4.2. Signals</A
></H2
><P
@@ -1404,7 +1385,7 @@ CLASS="command"
><DIV
CLASS="informaltable"
><A
NAME="AEN665"
NAME="AEN660"
></A
><P
></P

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