Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c7e86aa51 | ||
|
|
5c4917f66e | ||
|
|
b7f9192ff1 | ||
|
|
d9fa5d5a9a | ||
|
|
6ab0b3d51a | ||
|
|
8917d2f9b6 | ||
|
|
1a8b581510 | ||
|
|
2c823cc84f | ||
|
|
e4e753f46a | ||
|
|
228e769d75 | ||
|
|
3590a811a2 | ||
|
|
4de0a36a42 | ||
|
|
bbe83c3b2a | ||
|
|
fe745d238d | ||
|
|
f1326c124a | ||
|
|
05cb183b91 | ||
|
|
b7b62bf0b2 | ||
|
|
2c17edf417 | ||
|
|
feba3113c4 | ||
|
|
18194962f2 | ||
|
|
d3786c0cf1 | ||
|
|
1c2f8ab09f | ||
|
|
2f7613333f | ||
|
|
0ff879f145 |
@@ -1,73 +0,0 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterEnum: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterControlStatement: MultiLine
|
||||
AfterFunction: false # should also be MultiLine, but not yet supported
|
||||
AfterExternBlock: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakAfterReturnType: All
|
||||
Cpp11BracedListStyle: false
|
||||
ColumnLimit: 80
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
AlignEscapedNewlines: Left
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
PointerBindsToType: false
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<isc/'
|
||||
Priority: 5
|
||||
- Regex: '^<(pk11|pkcs11)/'
|
||||
Priority: 10
|
||||
- Regex: '^<dns/'
|
||||
Priority: 15
|
||||
- Regex: '^<dst/'
|
||||
Priority: 20
|
||||
- Regex: '^<isccc/'
|
||||
Priority: 25
|
||||
- Regex: '^<isccfg/'
|
||||
Priority: 30
|
||||
- Regex: '^<ns/'
|
||||
Priority: 35
|
||||
- Regex: '^<irs/'
|
||||
Priority: 40
|
||||
- Regex: '^<bind9/'
|
||||
Priority: 45
|
||||
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
|
||||
Priority: 50
|
||||
- Regex: '^<dlz_'
|
||||
Priority: 55
|
||||
- Regex: '^".*"'
|
||||
Priority: 99
|
||||
- Regex: '<openssl/'
|
||||
Priority: 1
|
||||
- Regex: '<(mysql|protobuf-c)/'
|
||||
Priority: 1
|
||||
- Regex: '.*'
|
||||
Priority: 0
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
@@ -1,61 +0,0 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterEnum: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterControlStatement: MultiLine
|
||||
AfterFunction: false # should also be MultiLine, but not yet supported
|
||||
AfterExternBlock: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakAfterReturnType: All
|
||||
Cpp11BracedListStyle: false
|
||||
ColumnLimit: 80
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignConsecutiveMacros: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
AlignEscapedNewlines: Left
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
PointerBindsToType: false
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<isc/'
|
||||
Priority: 2
|
||||
- Regex: '^<dns/'
|
||||
Priority: 3
|
||||
- Regex: '^<iscccc/'
|
||||
Priority: 4
|
||||
- Regex: '^<isccfg/'
|
||||
Priority: 5
|
||||
- Regex: '^<ns/'
|
||||
Priority: 6
|
||||
- Regex: '^<bind9/)'
|
||||
Priority: 7
|
||||
- Regex: '^(<[^/]*)/)'
|
||||
Priority: 8
|
||||
- Regex: '<[[:alnum:].]+>'
|
||||
Priority: 1
|
||||
- Regex: '".*"'
|
||||
Priority: 9
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
@@ -7,5 +7,4 @@
|
||||
/doc/dev export-ignore
|
||||
/util/** export-ignore
|
||||
/util/bindkeys.pl -export-ignore
|
||||
/util/check-make-install.in -export-ignore
|
||||
/util/mksymtbl.pl -export-ignore
|
||||
|
||||
@@ -61,4 +61,3 @@ timestamp
|
||||
/cppcheck_html/
|
||||
/cppcheck.results
|
||||
/tsan
|
||||
/util/check-make-install
|
||||
|
||||
+413
-513
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,6 @@
|
||||
- [ ] ***(QA)*** Ensure all new tags are annotated and signed.
|
||||
- [ ] ***(SwEng)*** Push tags for the published releases to the public repository.
|
||||
- [ ] ***(SwEng)*** Merge the automatically prepared `prep 9.X.Y` commit which updates `version` and documentation on the release branch into the relevant maintenance branch (`v9_X`).
|
||||
- [ ] ***(QA)*** For each maintained branch, update the `BIND_BASELINE_VERSION` variable for the `abi-check:sid:amd64` job in `.gitlab-ci.yml` to the latest published BIND version tag for a given branch.
|
||||
|
||||
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ string_escape_char2 = 0 # number
|
||||
# Improvements to template detection may make this option obsolete.
|
||||
tok_split_gte = false # false/true
|
||||
|
||||
# Control what to do with the UTF-8 BOM (recommend 'remove')
|
||||
# Control what to do with the UTF-8 BOM (recommed 'remove')
|
||||
utf8_bom = ignore # ignore/add/remove/force
|
||||
|
||||
# If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8
|
||||
@@ -1352,7 +1352,7 @@ cmt_insert_func_header = "" # string
|
||||
# Will substitute $(class) with the class name.
|
||||
cmt_insert_class_header = "" # string
|
||||
|
||||
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment.
|
||||
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment.
|
||||
# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff.
|
||||
cmt_insert_oc_msg_header = "" # string
|
||||
|
||||
|
||||
@@ -1,152 +1,3 @@
|
||||
--- 9.17.1 released ---
|
||||
|
||||
5383. [func] Add a quota attach function with a callback and clean up
|
||||
the isc_quota API. [GL !3280]
|
||||
|
||||
5382. [bug] Use clock_gettime() instead of gettimeofday() for
|
||||
isc_stdtime() function. [GL #1679]
|
||||
|
||||
5381. [bug] Fix logging API data race by adding rwlock and caching
|
||||
logging levels in stdatomic variables to restore
|
||||
performance to original levels. [GL #1675] [GL #1717]
|
||||
|
||||
5380. [contrib] Fix building MySQL DLZ modules against MySQL 8
|
||||
libraries. [GL #1678]
|
||||
|
||||
5379. [placeholder]
|
||||
|
||||
5378. [bug] Receiving invalid DNS data was triggering an assertion
|
||||
failure in nslookup. [GL #1652]
|
||||
|
||||
5377. [placeholder]
|
||||
|
||||
5376. [bug] Fix ineffective DNS rebinding protection when BIND is
|
||||
configured as a forwarding DNS server. Thanks to Tobias
|
||||
Klein. [GL #1574]
|
||||
|
||||
5375. [test] Fix timing issues in the "kasp" system test. [GL #1669]
|
||||
|
||||
5374. [bug] Statistics counters tracking recursive clients and
|
||||
active connections could underflow. [GL #1087]
|
||||
|
||||
5373. [bug] Collecting statistics for DNSSEC signing operations
|
||||
(change 5254) caused an array of significant size (over
|
||||
100 kB) to be allocated for each configured zone. Each
|
||||
of these arrays is tracking all possible key IDs; this
|
||||
could trigger an out-of-memory condition on servers with
|
||||
a high enough number of zones configured. Fixed by
|
||||
tracking up to four keys per zone and rotating counters
|
||||
when keys are replaced. This fixes the immediate problem
|
||||
of high memory usage, but should be improved in a future
|
||||
release by growing or shrinking the number of keys to
|
||||
track upon key rollover events. [GL #1179]
|
||||
|
||||
5372. [bug] Fix migration from existing DNSSEC key files
|
||||
("auto-dnssec maintain") to "dnssec-policy". [GL #1706]
|
||||
|
||||
5371. [bug] Improve incremental updates of the RPZ summary
|
||||
database to reduce delays that could occur when
|
||||
a policy zone update included a large number of
|
||||
record deletions. [GL #1447]
|
||||
|
||||
5370. [bug] Deactivation of a netmgr handle associated with a
|
||||
socket could be skipped in some circumstances.
|
||||
Fixed by deactivating the netmgr handle before
|
||||
scheduling the asynchronous close routine. [GL #1700]
|
||||
|
||||
5369. [func] Add the ability to specify whether to wait for
|
||||
nameserver domain names to be looked up, with a new RPZ
|
||||
modifying directive 'nsdname-wait-recurse'. [GL #1138]
|
||||
|
||||
5368. [bug] Named failed to restart if 'rndc addzone' names
|
||||
contained special characters (e.g. '/'). [GL #1655]
|
||||
|
||||
5367. [placeholder]
|
||||
|
||||
--- 9.17.0 released ---
|
||||
|
||||
5366. [bug] Fix a race condition with the keymgr when the same
|
||||
zone plus dnssec-policy is configured in multiple
|
||||
views. [GL #1653]
|
||||
|
||||
5365. [bug] Algorithm rollover was stuck on submitting DS
|
||||
because keymgr thought it would move to an invalid
|
||||
state. Fixed by checking the current key against
|
||||
the desired state, not the existing state. [GL #1626]
|
||||
|
||||
5364. [bug] Algorithm rollover waited too long before introducing
|
||||
zone signatures. It waited to make sure all signatures
|
||||
were regenerated, but when introducing a new algorithm,
|
||||
all signatures are regenerated immediately. Only
|
||||
add the sign delay if there is a predecessor key.
|
||||
[GL #1625]
|
||||
|
||||
5363. [bug] When changing a dnssec-policy, existing keys with
|
||||
properties that no longer match were not being retired.
|
||||
[GL #1624]
|
||||
|
||||
5362. [func] Limit the size of IXFR responses so that AXFR will
|
||||
be used instead if it would be smaller. This is
|
||||
controlled by the "max-ixfr-ratio" option, which
|
||||
is a percentage representing the ratio of IXFR size
|
||||
to the size of the entire zone. This value cannot
|
||||
exceed 100%, which is the default. [GL #1515]
|
||||
|
||||
5361. [bug] named might not accept new connections after
|
||||
hitting tcp-clients quota. [GL #1643]
|
||||
|
||||
5360. [bug] delv could fail to load trust anchors in DNSKEY
|
||||
format. [GL #1647]
|
||||
|
||||
5359. [func] "rndc nta -d" and "rndc secroots" now include
|
||||
"validate-except" entries when listing negative
|
||||
trust anchors. These are indicated by the keyword
|
||||
"permanent" in place of an expiry date. [GL #1532]
|
||||
|
||||
5358. [bug] Inline master zones whose master files were touched
|
||||
but otherwise unchanged and were subsequently reloaded
|
||||
may have stopped re-signing. [GL !3135]
|
||||
|
||||
5357. [bug] Newly added RRSIG records with expiry times before
|
||||
the previous earliest expiry times might not be
|
||||
re-signed in time. This was a side effect of 5315.
|
||||
[GL !3137]
|
||||
|
||||
5356. [func] Update dnssec-policy configuration statements:
|
||||
- Rename "zone-max-ttl" dnssec-policy option to
|
||||
"max-zone-ttl" for consistency with the existing
|
||||
zone option.
|
||||
- Allow for "lifetime unlimited" as a synonym for
|
||||
"lifetime PT0S".
|
||||
- Make "key-directory" optional.
|
||||
- Warn if specifying a key length does not make
|
||||
sense; fail if key length is out of range for
|
||||
the algorithm.
|
||||
- Allow use of mnemonics when specifying key
|
||||
algorithm (e.g. "rsasha256", "ecdsa384", etc.).
|
||||
- Make ISO 8601 durations case-insensitive.
|
||||
[GL #1598]
|
||||
|
||||
5355. [func] What was set with --with-tuning=large option in
|
||||
older BIND9 versions is now a default, and
|
||||
a --with-tuning=small option was added for small
|
||||
(e.g. OpenWRT) systems. [GL !2989]
|
||||
|
||||
5354. [bug] dnssec-policy created new KSK keys for zones in the
|
||||
initial stage of signing (with the DS not yet in the
|
||||
rumoured or omnipresent states). Fix by checking the
|
||||
key goals rather than the active state when determining
|
||||
whether new keys are needed. [GL #1593]
|
||||
|
||||
5353. [doc] Document port and dscp parameters in forwarders
|
||||
configuration option. [GL #914]
|
||||
|
||||
5352. [bug] Correctly handle catalog zone entries containing
|
||||
characters that aren't legal in filenames. [GL #1592]
|
||||
|
||||
5351. [bug] CDS / CDNSKEY consistency checks failed to handle
|
||||
removal records. [GL #1554]
|
||||
|
||||
5350. [bug] When a view was configured with class CHAOS, the
|
||||
server could crash while processing a query for a
|
||||
non-existent record. [GL #1540]
|
||||
@@ -238,7 +89,7 @@
|
||||
close all open sockets during shutdown. [GL #1312]
|
||||
|
||||
5324. [bug] Change the category of some log messages from general
|
||||
to the more appropriate catergory of xfer-in. [GL #1394]
|
||||
to the more appopriate catergory of xfer-in. [GL #1394]
|
||||
|
||||
5323. [bug] Fix a bug in DNSSEC trust anchor verification.
|
||||
[GL !2609]
|
||||
@@ -286,7 +137,7 @@
|
||||
|
||||
See the ARM for configuration details. [GL #1134]
|
||||
|
||||
5315. [bug] Apply the initial RRSIG expiration spread fixed
|
||||
5315. [bug] Apply the inital RRSIG expiration spread fixed
|
||||
to all dynamically created records in the zone
|
||||
including NSEC3. Also fix the signature clusters
|
||||
when the server has been offline for prolonged
|
||||
@@ -1499,7 +1350,7 @@
|
||||
4965. [func] Add support for marking options as deprecated.
|
||||
[GL #322]
|
||||
|
||||
4964. [bug] Reduce the probability of double signature when deleting
|
||||
4964. [bug] Reduce the probabilty of double signature when deleting
|
||||
a DNSKEY by checking if the node is otherwise signed
|
||||
by the algorithm of the key to be deleted. [GL #240]
|
||||
|
||||
@@ -1583,7 +1434,7 @@
|
||||
for unsigned zones since change 4596. [GL #209]
|
||||
|
||||
4945. [func] BIND can no longer be built without DNSSEC support.
|
||||
A cryptography provider (i.e., OpenSSL or a hardware
|
||||
A cryptography provder (i.e., OpenSSL or a hardware
|
||||
service module with PKCS#11 support) must be
|
||||
available. [GL #244]
|
||||
|
||||
@@ -1642,7 +1493,7 @@
|
||||
dig (+[no]raflag, +[no]tcflag). [GL #213]
|
||||
|
||||
4928. [func] The "dnskey-sig-validity" option allows
|
||||
"sig-validity-interval" to be overridden for signatures
|
||||
"sig-validity-interval" to be overriden for signatures
|
||||
covering DNSKEY RRsets. [GL #145]
|
||||
|
||||
4927. [placeholder]
|
||||
@@ -1981,7 +1832,7 @@
|
||||
[RT #46725]
|
||||
|
||||
4831. [bug] Convert the RRSIG expirytime to 64 bits for
|
||||
comparisons in diff.c:resign. [RT #46710]
|
||||
comparisions in diff.c:resign. [RT #46710]
|
||||
|
||||
4830. [bug] Failure to configure ATF when requested did not cause
|
||||
an error in top-level configure script. [RT #46655]
|
||||
@@ -2207,7 +2058,7 @@
|
||||
used to append a formatted string to the used region of
|
||||
a buffer. [RT #46201]
|
||||
|
||||
4766. [cleanup] Address Coverity warnings. [RT #46150]
|
||||
4766. [cleanup] Addresss Coverity warnings. [RT #46150]
|
||||
|
||||
4765. [bug] Address potential INSIST in dnssec-cds. [RT #46150]
|
||||
|
||||
@@ -2401,7 +2252,7 @@
|
||||
|
||||
4719. [bug] Address PVS static analyzer warnings. [RT #45946]
|
||||
|
||||
4718. [func] Avoid searching for a owner name compression pointer
|
||||
4718. [func] Avoid seaching for a owner name compression pointer
|
||||
more than once when writing out a RRset. [RT #45802]
|
||||
|
||||
4717. [bug] Treat replies with QCOUNT=0 as truncated if TC=1,
|
||||
@@ -6546,7 +6397,7 @@
|
||||
|
||||
3518. [bug] Increase the size of dns_rrl_key.s.rtype by one bit
|
||||
so that all dns_rrl_rtype_t enum values fit regardless
|
||||
of whether it is treated as signed or unsigned by
|
||||
of whether it is teated as signed or unsigned by
|
||||
the compiler. [RT #32792]
|
||||
|
||||
3517. [bug] Reorder destruction to avoid shutdown race. [RT #32777]
|
||||
@@ -7621,7 +7472,7 @@
|
||||
|
||||
--- 9.9.0b1 released ---
|
||||
|
||||
3186. [bug] Version/db mismatch in rpz code. [RT #26180]
|
||||
3186. [bug] Version/db mis-match in rpz code. [RT #26180]
|
||||
|
||||
3185. [func] New 'rndc signing' option for auto-dnssec zones:
|
||||
- 'rndc signing -list' displays the current
|
||||
@@ -8286,7 +8137,7 @@
|
||||
2998. [func] Add isc_task_beginexclusive and isc_task_endexclusive
|
||||
to the task api. [RT #22776]
|
||||
|
||||
2997. [func] named -V now reports the OpenSSL and libxml2 versions
|
||||
2997. [func] named -V now reports the OpenSSL and libxml2 verions
|
||||
it was compiled against. [RT #22687]
|
||||
|
||||
2996. [security] Temporarily disable SO_ACCEPTFILTER support.
|
||||
@@ -11269,7 +11120,7 @@
|
||||
2096. [bug] libbind: handle applications that fail to detect
|
||||
res_init() failures better.
|
||||
|
||||
2095. [port] libbind: always prototype inet_cidr_ntop_ipv6() and
|
||||
2095. [port] libbind: alway prototype inet_cidr_ntop_ipv6() and
|
||||
net_cidr_ntop_ipv6(). [RT #16388]
|
||||
|
||||
2094. [contrib] Update named-bootconf. [RT #16404]
|
||||
@@ -11325,7 +11176,7 @@
|
||||
2076. [bug] Several files were missing #include <config.h>
|
||||
causing build failures on OSF. [RT #16341]
|
||||
|
||||
2075. [bug] The spillat timer event handler could leak memory.
|
||||
2075. [bug] The spillat timer event hander could leak memory.
|
||||
[RT #16357]
|
||||
|
||||
2074. [bug] dns_request_createvia2(), dns_request_createvia3(),
|
||||
@@ -12087,7 +11938,7 @@
|
||||
|
||||
1831. [doc] Update named-checkzone documentation. [RT #13604]
|
||||
|
||||
1830. [bug] adb lame cache has sense of test reversed. [RT #13600]
|
||||
1830. [bug] adb lame cache has sence of test reversed. [RT #13600]
|
||||
|
||||
1829. [bug] win32: "pid-file none;" broken. [RT #13563]
|
||||
|
||||
@@ -12198,7 +12049,7 @@
|
||||
1796. [func] "rndc freeze/thaw" now freezes/thaws all zones.
|
||||
|
||||
1795. [bug] "rndc dumpdb" was not fully documented. Minor
|
||||
formatting issues with "rndc dumpdb -all". [RT #13396]
|
||||
formating issues with "rndc dumpdb -all". [RT #13396]
|
||||
|
||||
1794. [func] Named and named-checkzone can now both check for
|
||||
non-terminal wildcard records.
|
||||
@@ -13375,7 +13226,7 @@
|
||||
acl.
|
||||
|
||||
1393. [port] Bind to individual IPv6 interfaces if IPV6_IPV6ONLY
|
||||
is not available in the kernel to prevent accidentally
|
||||
is not available in the kernel to prevent accidently
|
||||
listening on IPv4 interfaces.
|
||||
|
||||
1392. [bug] named-checkzone: update usage.
|
||||
@@ -15103,7 +14954,7 @@
|
||||
839. [func] Dump packets for which there was no view or that the
|
||||
class could not be determined to category "unmatched".
|
||||
|
||||
838. [port] UnixWare 7.x.x is now supported by
|
||||
838. [port] UnixWare 7.x.x is now suported by
|
||||
bin/tests/system/ifconfig.sh.
|
||||
|
||||
837. [cleanup] Multi-threading is now enabled by default only on
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ e-mail is not a secure choice for communications concerning undisclosed
|
||||
security issues so please encrypt your communications to us if possible,
|
||||
using the ISC Security Officer public key.
|
||||
|
||||
Do not discuss undisclosed security vulnerabilities on any public mailing
|
||||
Do not discuss undisclosed security vulnerabilites on any public mailing
|
||||
list. ISC has a long history of handling reported vulnerabilities promptly
|
||||
and effectively and we respect and acknowledge responsible reporters.
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ e-mail is not a secure choice for communications concerning undisclosed
|
||||
security issues so please encrypt your communications to us if possible,
|
||||
using the [ISC Security Officer public key](https://www.isc.org/downloads/software-support-policy/openpgp-key/).
|
||||
|
||||
Do not discuss undisclosed security vulnerabilities on any public mailing list.
|
||||
Do not discuss undisclosed security vulnerabilites on any public mailing list.
|
||||
ISC has a long history of handling reported vulnerabilities promptly and
|
||||
effectively and we respect and acknowledge responsible reporters.
|
||||
|
||||
|
||||
@@ -2,21 +2,6 @@ HISTORY
|
||||
|
||||
Functional enhancements from prior major releases of BIND 9
|
||||
|
||||
BIND 9.16
|
||||
|
||||
BIND 9.16 (a stable branch based on the 9.15 development branch) includes
|
||||
a number of changes from BIND 9.14 and earlier releases. New features
|
||||
include:
|
||||
|
||||
* New dnssec-policy statement to configure a key and signing policy for
|
||||
zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on libuv.
|
||||
* Added support for the new GeoIP2 geolocation API, libmaxminddb.
|
||||
* Improved DNSSEC trust anchor configuration using the trust-anchors
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for dig, mdig, and delv.
|
||||
|
||||
BIND 9.14
|
||||
|
||||
BIND 9.14 (a stable branch based on the 9.13 development branch) includes
|
||||
@@ -158,7 +143,7 @@ releases. New features include:
|
||||
* "rndc modzone" reconfigures a single zone, without requiring the
|
||||
entire server to be reconfigured.
|
||||
* "rndc showzone" displays the current configuration of a zone.
|
||||
* "rndc managed-keys" can be used to check the status of RFC 5011
|
||||
* "rndc managed-keys" can be used to check the status of RFC 5001
|
||||
managed trust anchors, or to force trust anchors to be refreshed.
|
||||
* "max-cache-size" can now be set to a percentage of available memory.
|
||||
The default is 90%.
|
||||
@@ -530,8 +515,8 @@ BIND 9.4.0
|
||||
* dig: report the number of extra bytes still left in the packet after
|
||||
processing all the records.
|
||||
* Support for IPSECKEY rdata type.
|
||||
* Raise the UDP receive buffer size to 32k if it is less than 32k.
|
||||
* x86 and x86_64 now have separate atomic locking implementations.
|
||||
* Raise the UDP recieve buffer size to 32k if it is less than 32k.
|
||||
* x86 and x86_64 now have seperate atomic locking implementations.
|
||||
* named-checkconf now validates update-policy entries.
|
||||
* Attempt to make the amount of work performed in a iteration self
|
||||
tuning. The covers nodes clean from the cache per iteration, nodes
|
||||
@@ -548,8 +533,8 @@ BIND 9.4.0
|
||||
* dig now warns if 'RA' is not set in the answer when 'RD' was set in
|
||||
the query. host/nslookup skip servers that fail to set 'RA' when 'RD'
|
||||
is set unless a server is explicitly set.
|
||||
* Integrate contributed DLZ code into named.
|
||||
* Integrate contributed IDN code from JPNIC.
|
||||
* Integrate contibuted DLZ code into named.
|
||||
* Integrate contibuted IDN code from JPNIC.
|
||||
* libbind: corresponds to that from BIND 8.4.7.
|
||||
|
||||
BIND 9.3.0
|
||||
|
||||
+4
-19
@@ -10,21 +10,6 @@
|
||||
-->
|
||||
### Functional enhancements from prior major releases of BIND 9
|
||||
|
||||
#### BIND 9.16
|
||||
|
||||
BIND 9.16 (a stable branch based on the 9.15 development branch)
|
||||
includes a number of changes from BIND 9.14 and earlier releases.
|
||||
New features include:
|
||||
|
||||
* New `dnssec-policy` statement to configure a key and signing policy
|
||||
for zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on `libuv`.
|
||||
* Added support for the new GeoIP2 geolocation API, `libmaxminddb`.
|
||||
* Improved DNSSEC trust anchor configuration using the `trust-anchors`
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for `dig`, `mdig`, and `delv`.
|
||||
|
||||
#### BIND 9.14
|
||||
|
||||
BIND 9.14 (a stable branch based on the 9.13 development branch)
|
||||
@@ -548,8 +533,8 @@ BIND 9.4.0
|
||||
- dig: report the number of extra bytes still left in the packet after
|
||||
processing all the records.
|
||||
- Support for IPSECKEY rdata type.
|
||||
- Raise the UDP receive buffer size to 32k if it is less than 32k.
|
||||
- x86 and x86_64 now have separate atomic locking implementations.
|
||||
- Raise the UDP recieve buffer size to 32k if it is less than 32k.
|
||||
- x86 and x86_64 now have seperate atomic locking implementations.
|
||||
- named-checkconf now validates update-policy entries.
|
||||
- Attempt to make the amount of work performed in a iteration self tuning.
|
||||
The covers nodes clean from the cache per iteration, nodes written to
|
||||
@@ -566,8 +551,8 @@ BIND 9.4.0
|
||||
- dig now warns if 'RA' is not set in the answer when 'RD' was set in the
|
||||
query. host/nslookup skip servers that fail to set 'RA' when 'RD' is set
|
||||
unless a server is explicitly set.
|
||||
- Integrate contributed DLZ code into named.
|
||||
- Integrate contributed IDN code from JPNIC.
|
||||
- Integrate contibuted DLZ code into named.
|
||||
- Integrate contibuted IDN code from JPNIC.
|
||||
- libbind: corresponds to that from BIND 8.4.7.
|
||||
|
||||
#### BIND 9.3.0
|
||||
|
||||
@@ -17,7 +17,7 @@ The following C11 features are used in BIND 9:
|
||||
the form of C11 _Thread_local/thread_local, the __thread GCC
|
||||
extension, or the __declspec(thread) MSVC extension on Windows.
|
||||
|
||||
BIND 9.17 requires a fairly recent version of libuv (at least 1.x). For
|
||||
BIND 9.15 requires a fairly recent version of libuv (at least 1.x). For
|
||||
some of the older systems listed below, you will have to install an
|
||||
updated libuv package from sources such as EPEL, PPA, or other native
|
||||
sources for updated packages. The other option is to build and install
|
||||
@@ -34,15 +34,15 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
Regularly tested platforms
|
||||
|
||||
As of Mar 2020, BIND 9.17 is fully supported and regularly tested on the
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
* Ubuntu LTS 16.04, 18.04
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.1
|
||||
* OpenBSD 6.6
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully
|
||||
@@ -86,7 +86,7 @@ platforms.
|
||||
|
||||
Unsupported platforms
|
||||
|
||||
These are platforms on which BIND 9.17 is known not to build or run:
|
||||
These are platforms on which BIND 9.15 is known not to build or run:
|
||||
|
||||
* Platforms without at least OpenSSL 1.0.2
|
||||
* Windows 10 / x86
|
||||
|
||||
+5
-5
@@ -25,7 +25,7 @@ The following C11 features are used in BIND 9:
|
||||
of C11 `_Thread_local`/`thread_local`, the `__thread` GCC extension, or
|
||||
the `__declspec(thread)` MSVC extension on Windows.
|
||||
|
||||
BIND 9.17 requires a fairly recent version of `libuv` (at least 1.x). For
|
||||
BIND 9.15 requires a fairly recent version of `libuv` (at least 1.x). For
|
||||
some of the older systems listed below, you will have to install an updated
|
||||
`libuv` package from sources such as EPEL, PPA, or other native sources for
|
||||
updated packages. The other option is to build and install `libuv` from
|
||||
@@ -42,15 +42,15 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
### Regularly tested platforms
|
||||
|
||||
As of Mar 2020, BIND 9.17 is fully supported and regularly tested on the
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
* Ubuntu LTS 16.04, 18.04
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.1
|
||||
* OpenBSD 6.6
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully supported.
|
||||
@@ -93,7 +93,7 @@ platforms.
|
||||
|
||||
## Unsupported platforms
|
||||
|
||||
These are platforms on which BIND 9.17 is known *not* to build or run:
|
||||
These are platforms on which BIND 9.15 is known *not* to build or run:
|
||||
|
||||
* Platforms without at least OpenSSL 1.0.2
|
||||
* Windows 10 / x86
|
||||
|
||||
@@ -7,7 +7,7 @@ Contents
|
||||
1. Introduction
|
||||
2. Reporting bugs and getting help
|
||||
3. Contributing to BIND
|
||||
4. BIND 9.17 features
|
||||
4. BIND 9.15 features
|
||||
5. Building BIND
|
||||
6. macOS
|
||||
7. Dependencies
|
||||
@@ -69,10 +69,7 @@ named-checkconf -px.
|
||||
|
||||
If the bug you are reporting is a potential security issue, such as an
|
||||
assertion failure or other crash in named, please do NOT use GitLab to
|
||||
report it. Instead, send mail to security-officer@isc.org using our
|
||||
OpenPGP key to secure your message. (Information about OpenPGP and links
|
||||
to our key can be found at https://www.isc.org/pgpkey.) Please do not
|
||||
discuss the bug on any public mailing list.
|
||||
report it. Instead, please send mail to security-officer@isc.org.
|
||||
|
||||
For a general overview of ISC security policies, read the Knowledge Base
|
||||
article at https://kb.isc.org/docs/aa-00861.
|
||||
@@ -109,15 +106,19 @@ If you prefer, you may also submit code by opening a GitLab Issue and
|
||||
including your patch as an attachment, preferably generated by git
|
||||
format-patch.
|
||||
|
||||
BIND 9.17 features
|
||||
BIND 9.15 features
|
||||
|
||||
BIND 9.17 is the newest development branch of BIND 9. It includes a number
|
||||
of changes from BIND 9.16 and earlier releases. New features include:
|
||||
BIND 9.15 is the newest development branch of BIND 9. It includes a number
|
||||
of changes from BIND 9.14 and earlier releases. New features include:
|
||||
|
||||
* New option "max-ixfr-ratio" to limit the size of outgoing IXFR
|
||||
responses before falling back to full zone transfers.
|
||||
* "rndc nta -d" and "rndc secroots" now include "validate-except"
|
||||
entries when listing negative trust anchors.
|
||||
* New dnssec-policy statement to configure a key and signing policy for
|
||||
zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on libuv.
|
||||
* Added support for the new GeoIP2 geolocation API, libmaxminddb.
|
||||
* Improved DNSSEC trust anchor configuration using the trust-anchors
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for dig, mdig, and delv.
|
||||
|
||||
Building BIND
|
||||
|
||||
@@ -147,7 +148,7 @@ If you're planning on making changes to the BIND 9 source, you should run
|
||||
make depend. If you're using Emacs, you might find make tags helpful.
|
||||
|
||||
Several environment variables that can be set before running configure
|
||||
will affect compilation. Significant ones are:
|
||||
will affect compilation:
|
||||
|
||||
Variable Description
|
||||
CC The C compiler to use. configure tries to figure out the
|
||||
@@ -169,17 +170,11 @@ BUILD_CPPFLAGS CPPFLAGS for the target system during cross-compiling.
|
||||
BUILD_LDFLAGS LDFLAGS for the target system during cross-compiling.
|
||||
BUILD_LIBS LIBS for the target system during cross-compiling.
|
||||
|
||||
Additional environment variables affecting the build are listed at the end
|
||||
of the configure help text, which can be obtained by running the command:
|
||||
|
||||
$ ./configure --help
|
||||
|
||||
macOS
|
||||
|
||||
Building on macOS assumes that the "Command Tools for Xcode" is installed.
|
||||
This can be downloaded from https://developer.apple.com/download/more/ or,
|
||||
if you have Xcode already installed, you can run xcode-select --install.
|
||||
(Note that an Apple ID may be required to access the download page.)
|
||||
This can be downloaded from https://developer.apple.com/download/more/ or
|
||||
if you have Xcode already installed you can run xcode-select --install.
|
||||
|
||||
Dependencies
|
||||
|
||||
@@ -232,10 +227,12 @@ github.com/farsightsec/fstrm and libprotobuf-c https://
|
||||
developers.google.com/protocol-buffers, and BIND must be configured with
|
||||
--enable-dnstap.
|
||||
|
||||
Certain compiled-in constants and default settings can be decreased to
|
||||
values better suited to small machines, e.g. OpenWRT boxes, by specifying
|
||||
--with-tuning=small on the configure command line. This will decrease
|
||||
memory usage by using smaller structures, but will degrade performance.
|
||||
Certain compiled-in constants and default settings can be increased to
|
||||
values better suited to large servers with abundant memory resources (e.g,
|
||||
64-bit servers with 12G or more of memory) by specifying --with-tuning=
|
||||
large on the configure command line. This can improve performance on big
|
||||
servers, but will consume more memory and may degrade performance on
|
||||
smaller systems.
|
||||
|
||||
On Linux, process capabilities are managed in user space using the libcap
|
||||
library, which can be installed on most Linux systems via the libcap-dev
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
1. [Introduction](#intro)
|
||||
1. [Reporting bugs and getting help](#help)
|
||||
1. [Contributing to BIND](#contrib)
|
||||
1. [BIND 9.17 features](#features)
|
||||
1. [BIND 9.15 features](#features)
|
||||
1. [Building BIND](#build)
|
||||
1. [macOS](#macos)
|
||||
1. [Dependencies](#dependencies)
|
||||
@@ -79,12 +79,8 @@ using `named-checkconf -px`.
|
||||
|
||||
If the bug you are reporting is a potential security issue, such as an
|
||||
assertion failure or other crash in `named`, please do *NOT* use GitLab to
|
||||
report it. Instead, send mail to
|
||||
[security-officer@isc.org](mailto:security-officer@isc.org) using our
|
||||
OpenPGP key to secure your message. (Information about OpenPGP and links
|
||||
to our key can be found at
|
||||
[https://www.isc.org/pgpkey](https://www.isc.org/pgpkey).) Please do not
|
||||
discuss the bug on any public mailing list.
|
||||
report it. Instead, please send mail to
|
||||
[security-officer@isc.org](mailto:security-officer@isc.org).
|
||||
|
||||
For a general overview of ISC security policies, read the Knowledge Base
|
||||
article at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
|
||||
@@ -125,15 +121,20 @@ If you prefer, you may also submit code by opening a
|
||||
including your patch as an attachment, preferably generated by
|
||||
`git format-patch`.
|
||||
|
||||
### <a name="features"/> BIND 9.17 features
|
||||
### <a name="features"/> BIND 9.15 features
|
||||
|
||||
BIND 9.17 is the newest development branch of BIND 9. It includes a
|
||||
number of changes from BIND 9.16 and earlier releases. New features include:
|
||||
BIND 9.15 is the newest development branch of BIND 9. It includes a
|
||||
number of changes from BIND 9.14 and earlier releases. New features
|
||||
include:
|
||||
|
||||
* New option "max-ixfr-ratio" to limit the size of outgoing IXFR responses
|
||||
before falling back to full zone transfers.
|
||||
* "rndc nta -d" and "rndc secroots" now include "validate-except" entries
|
||||
when listing negative trust anchors.
|
||||
* New `dnssec-policy` statement to configure a key and signing policy
|
||||
for zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on libuv.
|
||||
* Added support for the new GeoIP2 geolocation API, `libmaxminddb`.
|
||||
* Improved DNSSEC trust anchor configuration using the `trust-anchors`
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for `dig`, `mdig`, and `delv`.
|
||||
|
||||
### <a name="build"/> Building BIND
|
||||
|
||||
@@ -165,7 +166,7 @@ If you're planning on making changes to the BIND 9 source, you should run
|
||||
`make depend`. If you're using Emacs, you might find `make tags` helpful.
|
||||
|
||||
Several environment variables that can be set before running `configure` will
|
||||
affect compilation. Significant ones are:
|
||||
affect compilation:
|
||||
|
||||
|Variable|Description |
|
||||
|--------------------|-----------------------------------------------|
|
||||
@@ -180,20 +181,11 @@ affect compilation. Significant ones are:
|
||||
|`BUILD_LDFLAGS`|`LDFLAGS` for the target system during cross-compiling.|
|
||||
|`BUILD_LIBS`|`LIBS` for the target system during cross-compiling.|
|
||||
|
||||
Additional environment variables affecting the build are listed at the
|
||||
end of the `configure` help text, which can be obtained by running the
|
||||
command:
|
||||
|
||||
$ ./configure --help
|
||||
|
||||
#### <a name="macos"> macOS
|
||||
|
||||
Building on macOS assumes that the "Command Tools for Xcode" is installed.
|
||||
This can be downloaded from
|
||||
[https://developer.apple.com/download/more/](https://developer.apple.com/download/more/)
|
||||
or, if you have Xcode already installed, you can run `xcode-select
|
||||
--install`. (Note that an Apple ID may be required to access the download
|
||||
page.)
|
||||
This can be downloaded from [https://developer.apple.com/download/more/](https://developer.apple.com/download/more/)
|
||||
or if you have Xcode already installed you can run `xcode-select --install`.
|
||||
|
||||
### <a name="dependencies"/> Dependencies
|
||||
|
||||
@@ -249,10 +241,12 @@ and `libprotobuf-c`
|
||||
[https://developers.google.com/protocol-buffers](https://developers.google.com/protocol-buffers),
|
||||
and BIND must be configured with `--enable-dnstap`.
|
||||
|
||||
Certain compiled-in constants and default settings can be decreased to
|
||||
values better suited to small machines, e.g. OpenWRT boxes, by specifying
|
||||
`--with-tuning=small` on the `configure` command line. This will decrease
|
||||
memory usage by using smaller structures, but will degrade performance.
|
||||
Certain compiled-in constants and default settings can be increased to
|
||||
values better suited to large servers with abundant memory resources (e.g,
|
||||
64-bit servers with 12G or more of memory) by specifying
|
||||
`--with-tuning=large` on the `configure` command line. This can improve
|
||||
performance on big servers, but will consume more memory and may degrade
|
||||
performance on smaller systems.
|
||||
|
||||
On Linux, process capabilities are managed in user space using
|
||||
the `libcap` library, which can be installed on most Linux systems via
|
||||
|
||||
Vendored
-1
@@ -376,7 +376,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
m4_include([m4/ax_check_compile_flag.m4])
|
||||
m4_include([m4/ax_check_openssl.m4])
|
||||
m4_include([m4/ax_lib_lmdb.m4])
|
||||
m4_include([m4/ax_posix_shell.m4])
|
||||
m4_include([m4/ax_pthread.m4])
|
||||
m4_include([m4/ax_restore_flags.m4])
|
||||
|
||||
@@ -24,7 +24,8 @@ CWARNINGS =
|
||||
|
||||
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
BIND9LIBS = ../../lib/bind9/libbind9.@A@
|
||||
NSLIBS = ../../lib/ns/libns.@A@
|
||||
|
||||
@@ -35,6 +36,7 @@ BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
|
||||
NSDEPENDLIBS = ../../lib/ns/libns.@A@
|
||||
|
||||
LIBS = ${ISCLIBS} @LIBS@
|
||||
NOSYMLIBS = ${ISCNOSYMLIBS} @LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
+125
-170
@@ -9,21 +9,23 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
#include "check-tool.h"
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/netdb.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/stdio.h>
|
||||
@@ -50,31 +52,29 @@
|
||||
|
||||
#include <ns/log.h>
|
||||
|
||||
#include "check-tool.h"
|
||||
|
||||
#ifndef CHECK_SIBLING
|
||||
#define CHECK_SIBLING 1
|
||||
#endif /* ifndef CHECK_SIBLING */
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_LOCAL
|
||||
#define CHECK_LOCAL 1
|
||||
#endif /* ifndef CHECK_LOCAL */
|
||||
#endif
|
||||
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_LOOKUP_FAILURE 3
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
|
||||
static const char *dbtype[] = { "rbt" };
|
||||
|
||||
@@ -85,26 +85,31 @@ bool nomerge = true;
|
||||
bool docheckmx = true;
|
||||
bool dochecksrv = true;
|
||||
bool docheckns = true;
|
||||
#else /* if CHECK_LOCAL */
|
||||
#else
|
||||
bool docheckmx = false;
|
||||
bool dochecksrv = false;
|
||||
bool docheckns = false;
|
||||
#endif /* if CHECK_LOCAL */
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
|
||||
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
|
||||
#endif
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_CHECKMX |
|
||||
DNS_ZONEOPT_MANYERRORS |
|
||||
DNS_ZONEOPT_CHECKNAMES |
|
||||
DNS_ZONEOPT_CHECKINTEGRITY |
|
||||
#if CHECK_SIBLING
|
||||
DNS_ZONEOPT_CHECKSIBLING |
|
||||
#endif /* if CHECK_SIBLING */
|
||||
#endif
|
||||
DNS_ZONEOPT_CHECKWILDCARD |
|
||||
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
|
||||
DNS_ZONEOPT_WARNMXCNAME |
|
||||
DNS_ZONEOPT_WARNSRVCNAME;
|
||||
|
||||
/*
|
||||
* This needs to match the list in bin/named/log.c.
|
||||
*/
|
||||
static isc_logcategory_t categories[] = { { "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 } };
|
||||
static isc_logcategory_t categories[] = {
|
||||
{ "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static isc_symtab_t *symtab = NULL;
|
||||
static isc_mem_t *sym_mctx;
|
||||
@@ -128,9 +133,8 @@ add(char *key, int value) {
|
||||
if (symtab == NULL) {
|
||||
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
|
||||
false, &symtab);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
key = isc_mem_strdup(sym_mctx, key);
|
||||
@@ -138,29 +142,27 @@ add(char *key, int value) {
|
||||
symvalue.as_pointer = NULL;
|
||||
result = isc_symtab_define(symtab, key, value, symvalue,
|
||||
isc_symexists_reject);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
isc_mem_free(sym_mctx, key);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
logged(char *key, int value) {
|
||||
isc_result_t result;
|
||||
|
||||
if (symtab == NULL) {
|
||||
if (symtab == NULL)
|
||||
return (false);
|
||||
}
|
||||
|
||||
result = isc_symtab_lookup(symtab, key, value, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
static bool
|
||||
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa) {
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
||||
{
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
@@ -178,9 +180,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
REQUIRE(aaaa == NULL || !dns_rdataset_isassociated(aaaa) ||
|
||||
aaaa->type == dns_rdatatype_aaaa);
|
||||
|
||||
if (a == NULL || aaaa == NULL) {
|
||||
if (a == NULL || aaaa == NULL)
|
||||
return (answer);
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -207,17 +208,16 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL) {
|
||||
cur->ai_next != NULL)
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0 &&
|
||||
!logged(namebuf, ERR_IS_CNAME))
|
||||
{
|
||||
!logged(namebuf, ERR_IS_CNAME)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' (out of zone) "
|
||||
"is a CNAME '%s' (illegal)",
|
||||
ownerbuf, namebuf, cur->ai_canonname);
|
||||
ownerbuf, namebuf,
|
||||
cur->ai_canonname);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = false; */
|
||||
add(namebuf, ERR_IS_CNAME);
|
||||
@@ -226,7 +226,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
#endif
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' (out of zone) "
|
||||
@@ -240,8 +240,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -250,17 +250,15 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
/*
|
||||
* Check that all glue records really exist.
|
||||
*/
|
||||
if (!dns_rdataset_isassociated(a)) {
|
||||
if (!dns_rdataset_isassociated(a))
|
||||
goto checkaaaa;
|
||||
}
|
||||
result = dns_rdataset_first(a);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(a, &rdata);
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET) {
|
||||
if (cur->ai_family != AF_INET)
|
||||
continue;
|
||||
}
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = true;
|
||||
@@ -268,12 +266,11 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
}
|
||||
}
|
||||
if (!match && !logged(namebuf, ERR_EXTRA_A)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
"extra GLUE A record (%s)",
|
||||
ownerbuf, namebuf,
|
||||
inet_ntop(AF_INET, rdata.data, addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
inet_ntop(AF_INET, rdata.data,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_A);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = false; */
|
||||
@@ -282,32 +279,28 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
result = dns_rdataset_next(a);
|
||||
}
|
||||
|
||||
checkaaaa:
|
||||
if (!dns_rdataset_isassociated(aaaa)) {
|
||||
checkaaaa:
|
||||
if (!dns_rdataset_isassociated(aaaa))
|
||||
goto checkmissing;
|
||||
}
|
||||
result = dns_rdataset_first(aaaa);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(aaaa, &rdata);
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET6) {
|
||||
if (cur->ai_family != AF_INET6)
|
||||
continue;
|
||||
}
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
|
||||
->sin6_addr;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match && !logged(namebuf, ERR_EXTRA_AAAA)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
"extra GLUE AAAA record (%s)",
|
||||
ownerbuf, namebuf,
|
||||
inet_ntop(AF_INET6, rdata.data, addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
inet_ntop(AF_INET6, rdata.data,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_AAAA);
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = false; */
|
||||
@@ -316,7 +309,7 @@ checkaaaa:
|
||||
result = dns_rdataset_next(aaaa);
|
||||
}
|
||||
|
||||
checkmissing:
|
||||
checkmissing:
|
||||
/*
|
||||
* Check that all addresses appear in the glue.
|
||||
*/
|
||||
@@ -326,50 +319,42 @@ checkmissing:
|
||||
switch (cur->ai_family) {
|
||||
case AF_INET:
|
||||
rdataset = a;
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))
|
||||
->sin_addr;
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||
type = "A";
|
||||
break;
|
||||
case AF_INET6:
|
||||
rdataset = aaaa;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
|
||||
->sin6_addr;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||
type = "AAAA";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
match = false;
|
||||
if (dns_rdataset_isassociated(rdataset)) {
|
||||
if (dns_rdataset_isassociated(rdataset))
|
||||
result = dns_rdataset_first(rdataset);
|
||||
} else {
|
||||
else
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
while (result == ISC_R_SUCCESS && !match) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
result = dns_rdataset_next(rdataset);
|
||||
}
|
||||
if (!match) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
"missing GLUE %s record (%s)",
|
||||
ownerbuf, namebuf, type,
|
||||
inet_ntop(cur->ai_family, ptr,
|
||||
addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = false; */
|
||||
missing_glue = true;
|
||||
}
|
||||
}
|
||||
if (missing_glue) {
|
||||
if (missing_glue)
|
||||
add(namebuf, ERR_MISSING_GLUE);
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
return (answer);
|
||||
@@ -409,15 +394,12 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL) {
|
||||
cur->ai_next != NULL)
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0) {
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0)
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
if ((zone_options & DNS_ZONEOPT_IGNOREMXCNAME) == 0) {
|
||||
if (!logged(namebuf, ERR_IS_MXCNAME)) {
|
||||
dns_zone_log(zone, level,
|
||||
@@ -428,9 +410,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
cur->ai_canonname);
|
||||
add(namebuf, ERR_IS_MXCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR) {
|
||||
if (level == ISC_LOG_ERROR)
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -439,7 +420,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
#endif
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/MX '%s' (out of zone) "
|
||||
@@ -453,8 +434,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -495,28 +476,23 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL) {
|
||||
cur->ai_next != NULL)
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0) {
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0)
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
if ((zone_options & DNS_ZONEOPT_IGNORESRVCNAME) == 0) {
|
||||
if (!logged(namebuf, ERR_IS_SRVCNAME)) {
|
||||
dns_zone_log(zone, level,
|
||||
"%s/SRV '%s'"
|
||||
dns_zone_log(zone, level, "%s/SRV '%s'"
|
||||
" (out of zone) is a "
|
||||
"CNAME '%s' (illegal)",
|
||||
ownerbuf, namebuf,
|
||||
cur->ai_canonname);
|
||||
add(namebuf, ERR_IS_SRVCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR) {
|
||||
if (level == ISC_LOG_ERROR)
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -525,7 +501,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
#endif
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/SRV '%s' (out of zone) "
|
||||
@@ -539,8 +515,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -553,7 +529,7 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_log_t *log = NULL;
|
||||
|
||||
isc_log_create(mctx, &log, &logconfig);
|
||||
RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS);
|
||||
isc_log_registercategories(log, categories);
|
||||
isc_log_setcontext(log);
|
||||
dns_log_init(log);
|
||||
@@ -565,11 +541,12 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination, 0);
|
||||
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_createchannel(logconfig, "stderr",
|
||||
ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination, 0) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
|
||||
NULL, NULL) == ISC_R_SUCCESS);
|
||||
|
||||
*logp = log;
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -596,20 +573,18 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
CHECK(dns_db_newversion(db, &version));
|
||||
CHECK(dns_db_createiterator(db, 0, &dbiter));
|
||||
|
||||
for (result = dns_dbiterator_first(dbiter); result == ISC_R_SUCCESS;
|
||||
result = dns_dbiterator_next(dbiter))
|
||||
{
|
||||
for (result = dns_dbiterator_first(dbiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_dbiterator_next(dbiter)) {
|
||||
result = dns_dbiterator_current(dbiter, &node, name);
|
||||
if (result == DNS_R_NEWORIGIN) {
|
||||
if (result == DNS_R_NEWORIGIN)
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
CHECK(result);
|
||||
|
||||
CHECK(dns_db_allrdatasets(db, node, version, 0, &rdsiter));
|
||||
for (result = dns_rdatasetiter_first(rdsiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdatasetiter_next(rdsiter))
|
||||
{
|
||||
result = dns_rdatasetiter_next(rdsiter)) {
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
if (rdataset.ttl > maxttl) {
|
||||
char nbuf[DNS_NAME_FORMATSIZE];
|
||||
@@ -632,35 +607,28 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
}
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
}
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
CHECK(result);
|
||||
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (node != NULL) {
|
||||
cleanup:
|
||||
if (node != NULL)
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
if (rdsiter != NULL) {
|
||||
if (rdsiter != NULL)
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
}
|
||||
if (dbiter != NULL) {
|
||||
if (dbiter != NULL)
|
||||
dns_dbiterator_destroy(&dbiter);
|
||||
}
|
||||
if (version != NULL) {
|
||||
if (version != NULL)
|
||||
dns_db_closeversion(db, &version, false);
|
||||
}
|
||||
if (db != NULL) {
|
||||
if (db != NULL)
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -669,7 +637,8 @@ cleanup:
|
||||
isc_result_t
|
||||
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
dns_masterformat_t fileformat, const char *classname,
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep) {
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_textregion_t region;
|
||||
@@ -680,10 +649,9 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
|
||||
REQUIRE(zonep == NULL || *zonep == NULL);
|
||||
|
||||
if (debug) {
|
||||
if (debug)
|
||||
fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n",
|
||||
zonename, filename, classname);
|
||||
}
|
||||
|
||||
CHECK(dns_zone_create(&zone, mctx));
|
||||
|
||||
@@ -694,17 +662,11 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
origin = dns_fixedname_initname(&fixorigin);
|
||||
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
|
||||
CHECK(dns_zone_setorigin(zone, origin));
|
||||
dns_zone_setdbtype(zone, 1, (const char *const *)dbtype);
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
CHECK(dns_zone_setstream(zone, stdin, fileformat,
|
||||
&dns_master_style_default));
|
||||
} else {
|
||||
CHECK(dns_zone_setfile(zone, filename, fileformat,
|
||||
&dns_master_style_default));
|
||||
}
|
||||
if (journal != NULL) {
|
||||
dns_zone_setdbtype(zone, 1, (const char * const *) dbtype);
|
||||
CHECK(dns_zone_setfile(zone, filename, fileformat,
|
||||
&dns_master_style_default));
|
||||
if (journal != NULL)
|
||||
CHECK(dns_zone_setjournal(zone, journal));
|
||||
}
|
||||
|
||||
DE_CONST(classname, region.base);
|
||||
region.length = strlen(classname);
|
||||
@@ -716,15 +678,12 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
|
||||
dns_zone_setmaxttl(zone, maxttl);
|
||||
|
||||
if (docheckmx) {
|
||||
if (docheckmx)
|
||||
dns_zone_setcheckmx(zone, checkmx);
|
||||
}
|
||||
if (docheckns) {
|
||||
if (docheckns)
|
||||
dns_zone_setcheckns(zone, checkns);
|
||||
}
|
||||
if (dochecksrv) {
|
||||
if (dochecksrv)
|
||||
dns_zone_setchecksrv(zone, checksrv);
|
||||
}
|
||||
|
||||
CHECK(dns_zone_load(zone, false));
|
||||
|
||||
@@ -741,10 +700,9 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
zone = NULL;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (zone != NULL) {
|
||||
cleanup:
|
||||
if (zone != NULL)
|
||||
dns_zone_detach(&zone);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -752,7 +710,8 @@ cleanup:
|
||||
isc_result_t
|
||||
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
||||
const uint32_t rawversion) {
|
||||
const uint32_t rawversion)
|
||||
{
|
||||
isc_result_t result;
|
||||
FILE *output = stdout;
|
||||
const char *flags;
|
||||
@@ -760,31 +719,27 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
flags = (fileformat == dns_masterformat_text) ? "w" : "wb";
|
||||
|
||||
if (debug) {
|
||||
if (filename != NULL && strcmp(filename, "-") != 0) {
|
||||
fprintf(stderr, "dumping \"%s\" to \"%s\"\n", zonename,
|
||||
filename);
|
||||
} else {
|
||||
if (filename != NULL && strcmp(filename, "-") != 0)
|
||||
fprintf(stderr, "dumping \"%s\" to \"%s\"\n",
|
||||
zonename, filename);
|
||||
else
|
||||
fprintf(stderr, "dumping \"%s\"\n", zonename);
|
||||
}
|
||||
}
|
||||
|
||||
if (filename != NULL && strcmp(filename, "-") != 0) {
|
||||
result = isc_stdio_open(filename, flags, &output);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"could not open output "
|
||||
"file \"%s\" for writing\n",
|
||||
filename);
|
||||
fprintf(stderr, "could not open output "
|
||||
"file \"%s\" for writing\n", filename);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_zone_dumptostream(zone, output, fileformat, style,
|
||||
rawversion);
|
||||
if (output != stdout) {
|
||||
if (output != stdout)
|
||||
(void)isc_stdio_close(output);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -798,7 +753,7 @@ InitSockets(void) {
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "WSAStartup() failed: %d\n", err);
|
||||
exit(1);
|
||||
@@ -809,4 +764,4 @@ void
|
||||
DestroySockets(void) {
|
||||
WSACleanup();
|
||||
}
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CHECK_TOOL_H
|
||||
#define CHECK_TOOL_H
|
||||
|
||||
@@ -41,11 +42,9 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
const uint32_t rawversion);
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
InitSockets(void);
|
||||
void
|
||||
DestroySockets(void);
|
||||
#endif /* ifdef _WIN32 */
|
||||
void InitSockets(void);
|
||||
void DestroySockets(void);
|
||||
#endif
|
||||
|
||||
extern int debug;
|
||||
extern const char *journal;
|
||||
@@ -57,4 +56,4 @@ extern dns_zoneopt_t zone_options;
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ifndef CHECK_TOOL_H */
|
||||
#endif
|
||||
|
||||
+90
-125
@@ -9,12 +9,13 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
@@ -26,6 +27,11 @@
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <isccfg/namedconf.h>
|
||||
#include <isccfg/grammar.h>
|
||||
|
||||
#include <bind9/check.h>
|
||||
|
||||
#include <dns/db.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/log.h>
|
||||
@@ -35,11 +41,6 @@
|
||||
#include <dns/rootns.h>
|
||||
#include <dns/zone.h>
|
||||
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#include <bind9/check.h>
|
||||
|
||||
#include "check-tool.h"
|
||||
|
||||
static const char *program = "named-checkconf";
|
||||
@@ -48,11 +49,11 @@ static bool loadplugins = true;
|
||||
|
||||
isc_log_t *logc = NULL;
|
||||
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
#define CHECK(r)\
|
||||
do { \
|
||||
result = (r); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
/*% usage */
|
||||
@@ -61,10 +62,8 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr,
|
||||
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n",
|
||||
program);
|
||||
fprintf(stderr, "usage: %s [-chijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n", program);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -86,8 +85,8 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
|
||||
result = isc_dir_chdir(directory);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
|
||||
"change directory to '%s' failed: %s\n", directory,
|
||||
isc_result_totext(result));
|
||||
"change directory to '%s' failed: %s\n",
|
||||
directory, isc_result_totext(result));
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -98,12 +97,10 @@ static bool
|
||||
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
|
||||
int i;
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL) {
|
||||
if (maps[i] == NULL)
|
||||
return (false);
|
||||
}
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,26 +114,25 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||
int i;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL) {
|
||||
if (maps[i] == NULL)
|
||||
return (false);
|
||||
}
|
||||
checknames = NULL;
|
||||
result = cfg_map_get(maps[i], "check-names", &checknames);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
continue;
|
||||
}
|
||||
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
||||
*obj = checknames;
|
||||
return (true);
|
||||
}
|
||||
for (element = cfg_list_first(checknames); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
for (element = cfg_list_first(checknames);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element)) {
|
||||
value = cfg_listelt_value(element);
|
||||
type = cfg_tuple_get(value, "type");
|
||||
if ((strcasecmp(cfg_obj_asstring(type), "primary") !=
|
||||
0) &&
|
||||
(strcasecmp(cfg_obj_asstring(type), "master") != 0))
|
||||
if ((strcasecmp(cfg_obj_asstring(type),
|
||||
"primary") != 0) &&
|
||||
(strcasecmp(cfg_obj_asstring(type),
|
||||
"master") != 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -153,21 +149,18 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_textregion_t r;
|
||||
|
||||
if (zfile == NULL) {
|
||||
if (zfile == NULL)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
DE_CONST(zclass, r.base);
|
||||
r.length = strlen(zclass);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_rootns_create(mctx, rdclass, zfile, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_db_detach(&db);
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -175,9 +168,10 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
||||
|
||||
/*% configure the zone */
|
||||
static isc_result_t
|
||||
configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
const cfg_obj_t *vconfig, const cfg_obj_t *config,
|
||||
isc_mem_t *mctx, bool list) {
|
||||
configure_zone(const char *vclass, const char *view,
|
||||
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
|
||||
const cfg_obj_t *config, isc_mem_t *mctx, bool list)
|
||||
{
|
||||
int i = 0;
|
||||
isc_result_t result;
|
||||
const char *zclass;
|
||||
@@ -201,22 +195,19 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
|
||||
zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
|
||||
classobj = cfg_tuple_get(zconfig, "class");
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
if (!cfg_obj_isstring(classobj))
|
||||
zclass = vclass;
|
||||
} else {
|
||||
else
|
||||
zclass = cfg_obj_asstring(classobj);
|
||||
}
|
||||
|
||||
zoptions = cfg_tuple_get(zconfig, "options");
|
||||
maps[i++] = zoptions;
|
||||
if (vconfig != NULL) {
|
||||
if (vconfig != NULL)
|
||||
maps[i++] = cfg_tuple_get(vconfig, "options");
|
||||
}
|
||||
if (config != NULL) {
|
||||
cfg_map_get(config, "options", &obj);
|
||||
if (obj != NULL) {
|
||||
if (obj != NULL)
|
||||
maps[i++] = obj;
|
||||
}
|
||||
}
|
||||
maps[i] = NULL;
|
||||
|
||||
@@ -225,14 +216,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
const char *inview = cfg_obj_asstring(inviewobj);
|
||||
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
|
||||
}
|
||||
if (inviewobj != NULL) {
|
||||
if (inviewobj != NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "type", &typeobj);
|
||||
if (typeobj == NULL) {
|
||||
if (typeobj == NULL)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (list) {
|
||||
const char *ztype = cfg_obj_asstring(typeobj);
|
||||
@@ -244,21 +233,18 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
* Skip checks when using an alternate data source.
|
||||
*/
|
||||
cfg_map_get(zoptions, "database", &dbobj);
|
||||
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
|
||||
if (dbobj != NULL &&
|
||||
strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
|
||||
strcmp("rbt64", cfg_obj_asstring(dbobj)) != 0)
|
||||
{
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "dlz", &dlzobj);
|
||||
if (dlzobj != NULL) {
|
||||
if (dlzobj != NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "file", &fileobj);
|
||||
if (fileobj != NULL) {
|
||||
if (fileobj != NULL)
|
||||
zfile = cfg_obj_asstring(fileobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check hints files for hint zones.
|
||||
@@ -279,14 +265,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
*/
|
||||
if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) {
|
||||
cfg_map_get(zoptions, "masters", &mastersobj);
|
||||
if (mastersobj != NULL) {
|
||||
if (mastersobj != NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if (zfile == NULL) {
|
||||
if (zfile == NULL)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-dup-records", &obj)) {
|
||||
@@ -330,14 +314,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-integrity", &obj)) {
|
||||
if (cfg_obj_asboolean(obj)) {
|
||||
if (cfg_obj_asboolean(obj))
|
||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
} else {
|
||||
else
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-mx-cname", &obj)) {
|
||||
@@ -381,11 +363,10 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-sibling", &obj)) {
|
||||
if (cfg_obj_asboolean(obj)) {
|
||||
if (cfg_obj_asboolean(obj))
|
||||
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
|
||||
} else {
|
||||
else
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
||||
}
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
@@ -418,8 +399,8 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
ISC_UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMES;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMES;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
|
||||
}
|
||||
|
||||
masterformat = dns_masterformat_text;
|
||||
@@ -444,19 +425,19 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
zone_options |= DNS_ZONEOPT_CHECKTTL;
|
||||
}
|
||||
|
||||
result = load_zone(mctx, zname, zfile, masterformat, zclass, maxttl,
|
||||
NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = load_zone(mctx, zname, zfile, masterformat,
|
||||
zclass, maxttl, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
|
||||
dns_result_totext(result));
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*% configure a view */
|
||||
static isc_result_t
|
||||
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list) {
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list)
|
||||
{
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *voptions;
|
||||
const cfg_obj_t *zonelist;
|
||||
@@ -464,33 +445,32 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||
isc_result_t tresult;
|
||||
|
||||
voptions = NULL;
|
||||
if (vconfig != NULL) {
|
||||
if (vconfig != NULL)
|
||||
voptions = cfg_tuple_get(vconfig, "options");
|
||||
}
|
||||
|
||||
zonelist = NULL;
|
||||
if (voptions != NULL) {
|
||||
if (voptions != NULL)
|
||||
(void)cfg_map_get(voptions, "zone", &zonelist);
|
||||
} else {
|
||||
else
|
||||
(void)cfg_map_get(config, "zone", &zonelist);
|
||||
}
|
||||
|
||||
for (element = cfg_list_first(zonelist); element != NULL;
|
||||
for (element = cfg_list_first(zonelist);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *zconfig = cfg_listelt_value(element);
|
||||
tresult = configure_zone(vclass, view, zconfig, vconfig, config,
|
||||
mctx, list);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
tresult = configure_zone(vclass, view, zconfig, vconfig,
|
||||
config, mctx, list);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
dns_rdataclass_t *classp) {
|
||||
dns_rdataclass_t *classp)
|
||||
{
|
||||
isc_textregion_t r;
|
||||
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
@@ -505,7 +485,8 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
/*% load zones from the configuration */
|
||||
static isc_result_t
|
||||
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
bool list_zones) {
|
||||
bool list_zones)
|
||||
{
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *views;
|
||||
const cfg_obj_t *vconfig;
|
||||
@@ -515,7 +496,8 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
views = NULL;
|
||||
|
||||
(void)cfg_map_get(config, "view", &views);
|
||||
for (element = cfg_list_first(views); element != NULL;
|
||||
for (element = cfg_list_first(views);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *classobj;
|
||||
@@ -524,31 +506,28 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
char buf[sizeof("CLASS65535")];
|
||||
|
||||
vconfig = cfg_listelt_value(element);
|
||||
if (vconfig == NULL) {
|
||||
if (vconfig == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
classobj = cfg_tuple_get(vconfig, "class");
|
||||
CHECK(config_getclass(classobj, dns_rdataclass_in, &viewclass));
|
||||
if (dns_rdataclass_ismeta(viewclass)) {
|
||||
CHECK(config_getclass(classobj, dns_rdataclass_in,
|
||||
&viewclass));
|
||||
if (dns_rdataclass_ismeta(viewclass))
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
dns_rdataclass_format(viewclass, buf, sizeof(buf));
|
||||
vname = cfg_obj_asstring(cfg_tuple_get(vconfig, "name"));
|
||||
tresult = configure_view(buf, vname, config, vconfig, mctx,
|
||||
list_zones);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
|
||||
if (views == NULL) {
|
||||
tresult = configure_view("IN", "_default", config, NULL, mctx,
|
||||
list_zones);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@@ -590,23 +569,15 @@ main(int argc, char **argv) {
|
||||
switch (c) {
|
||||
case 'm':
|
||||
if (strcasecmp(isc_commandline_argument, "record") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "trace") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "usage") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -670,17 +641,16 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
usage();
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -694,19 +664,16 @@ main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (isc_commandline_index + 1 < argc) {
|
||||
if (isc_commandline_index + 1 < argc)
|
||||
usage();
|
||||
}
|
||||
if (argv[isc_commandline_index] != NULL) {
|
||||
if (argv[isc_commandline_index] != NULL)
|
||||
conffile = argv[isc_commandline_index];
|
||||
}
|
||||
if (conffile == NULL || conffile[0] == '\0') {
|
||||
if (conffile == NULL || conffile[0] == '\0')
|
||||
conffile = NAMED_CONFFILE;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
InitSockets();
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
|
||||
|
||||
@@ -732,14 +699,12 @@ main(int argc, char **argv) {
|
||||
|
||||
if (result == ISC_R_SUCCESS && (load_zones || list_zones)) {
|
||||
result = load_zones_fromconfig(config, mctx, list_zones);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
exit_status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (print && exit_status == 0) {
|
||||
if (print && exit_status == 0)
|
||||
cfg_printx(config, flags, output, NULL);
|
||||
}
|
||||
cfg_obj_destroy(parser, &config);
|
||||
|
||||
cfg_parser_destroy(&parser);
|
||||
@@ -750,7 +715,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#ifdef _WIN32
|
||||
DestroySockets();
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
return (exit_status);
|
||||
}
|
||||
|
||||
+65
-84
@@ -9,16 +9,16 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -53,14 +53,14 @@ static const char *prog_name = NULL;
|
||||
static const dns_master_style_t *outputstyle = NULL;
|
||||
static enum { progmode_check, progmode_compile } progmode;
|
||||
|
||||
#define ERRRET(result, function) \
|
||||
do { \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
if (!quiet) \
|
||||
fprintf(stderr, "%s() returned %s\n", \
|
||||
#define ERRRET(result, function) \
|
||||
do { \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
if (!quiet) \
|
||||
fprintf(stderr, "%s() returned %s\n", \
|
||||
function, dns_result_totext(result)); \
|
||||
return (result); \
|
||||
} \
|
||||
return (result); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -77,7 +77,7 @@ usage(void) {
|
||||
"[-i (full|full-sibling|local|local-sibling|none)] "
|
||||
"[-M (ignore|warn|fail)] [-S (ignore|warn|fail)] "
|
||||
"[-W (ignore|warn)] "
|
||||
"%s zonename [ (filename|-) ]\n",
|
||||
"%s zonename filename\n",
|
||||
prog_name,
|
||||
progmode == progmode_check ? "[-o filename]" : "-o filename");
|
||||
exit(1);
|
||||
@@ -95,7 +95,7 @@ int
|
||||
main(int argc, char **argv) {
|
||||
int c;
|
||||
char *origin = NULL;
|
||||
const char *filename = NULL;
|
||||
char *filename = NULL;
|
||||
isc_log_t *lctx = NULL;
|
||||
isc_result_t result;
|
||||
char classname_in[] = "IN";
|
||||
@@ -121,21 +121,18 @@ main(int argc, char **argv) {
|
||||
outputstyle = &dns_master_style_full;
|
||||
|
||||
prog_name = strrchr(argv[0], '/');
|
||||
if (prog_name == NULL) {
|
||||
if (prog_name == NULL)
|
||||
prog_name = strrchr(argv[0], '\\');
|
||||
}
|
||||
if (prog_name != NULL) {
|
||||
if (prog_name != NULL)
|
||||
prog_name++;
|
||||
} else {
|
||||
else
|
||||
prog_name = argv[0];
|
||||
}
|
||||
/*
|
||||
* Libtool doesn't preserve the program name prior to final
|
||||
* installation. Remove the libtool prefix ("lt-").
|
||||
*/
|
||||
if (strncmp(prog_name, "lt-", 3) == 0) {
|
||||
if (strncmp(prog_name, "lt-", 3) == 0)
|
||||
prog_name += 3;
|
||||
}
|
||||
|
||||
#define PROGCMP(X) \
|
||||
(strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0)
|
||||
@@ -151,23 +148,24 @@ main(int argc, char **argv) {
|
||||
|
||||
/* Compilation specific defaults */
|
||||
if (progmode == progmode_compile) {
|
||||
zone_options |= (DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_FATALNS |
|
||||
DNS_ZONEOPT_CHECKSPF | DNS_ZONEOPT_CHECKDUPRR |
|
||||
zone_options |= (DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_FATALNS |
|
||||
DNS_ZONEOPT_CHECKSPF |
|
||||
DNS_ZONEOPT_CHECKDUPRR |
|
||||
DNS_ZONEOPT_CHECKNAMES |
|
||||
DNS_ZONEOPT_CHECKNAMESFAIL |
|
||||
DNS_ZONEOPT_CHECKWILDCARD);
|
||||
} else {
|
||||
zone_options |= (DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF);
|
||||
}
|
||||
} else
|
||||
zone_options |= (DNS_ZONEOPT_CHECKDUPRR |
|
||||
DNS_ZONEOPT_CHECKSPF);
|
||||
|
||||
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv,
|
||||
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:"
|
||||
"M:S:T:W:")) != EOF)
|
||||
{
|
||||
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
|
||||
!= EOF) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
classname = isc_commandline_argument;
|
||||
@@ -271,15 +269,16 @@ main(int argc, char **argv) {
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
if (ARGCMP("ignore")) {
|
||||
zone_options &= ~(DNS_ZONEOPT_CHECKNS |
|
||||
zone_options &= ~(DNS_ZONEOPT_CHECKNS|
|
||||
DNS_ZONEOPT_FATALNS);
|
||||
} else if (ARGCMP("warn")) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS;
|
||||
zone_options &= ~DNS_ZONEOPT_FATALNS;
|
||||
} else if (ARGCMP("fail")) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS |
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS|
|
||||
DNS_ZONEOPT_FATALNS;
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -n: %s\n",
|
||||
@@ -331,9 +330,9 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (ARGCMP("full")) {
|
||||
if (ARGCMP("full"))
|
||||
outputstyle = &dns_master_style_full;
|
||||
} else if (ARGCMP("relative")) {
|
||||
else if (ARGCMP("relative")) {
|
||||
outputstyle = &dns_master_style_default;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
@@ -412,25 +411,23 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
if (ARGCMP("warn")) {
|
||||
if (ARGCMP("warn"))
|
||||
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
|
||||
} else if (ARGCMP("ignore")) {
|
||||
else if (ARGCMP("ignore"))
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
|
||||
}
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
prog_name, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
usage();
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
prog_name, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -438,26 +435,26 @@ main(int argc, char **argv) {
|
||||
if (workdir != NULL) {
|
||||
result = isc_dir_chdir(workdir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
|
||||
isc_result_totext(result));
|
||||
fprintf(stderr, "isc_dir_chdir: %s: %s\n",
|
||||
workdir, isc_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (inputformatstr != NULL) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0)
|
||||
inputformat = dns_masterformat_text;
|
||||
} else if (strcasecmp(inputformatstr, "raw") == 0) {
|
||||
else if (strcasecmp(inputformatstr, "raw") == 0)
|
||||
inputformat = dns_masterformat_raw;
|
||||
} else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
|
||||
else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
|
||||
inputformat = dns_masterformat_raw;
|
||||
fprintf(stderr, "WARNING: input format raw, version "
|
||||
"ignored\n");
|
||||
fprintf(stderr,
|
||||
"WARNING: input format raw, version ignored\n");
|
||||
} else if (strcasecmp(inputformatstr, "map") == 0) {
|
||||
inputformat = dns_masterformat_map;
|
||||
} else {
|
||||
fprintf(stderr, "unknown file format: %s\n",
|
||||
inputformatstr);
|
||||
inputformatstr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -474,7 +471,8 @@ main(int argc, char **argv) {
|
||||
rawversion = strtol(outputformatstr + 4, &end, 10);
|
||||
if (end == outputformatstr + 4 || *end != '\0' ||
|
||||
rawversion > 1U) {
|
||||
fprintf(stderr, "unknown raw format version\n");
|
||||
fprintf(stderr,
|
||||
"unknown raw format version\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if (strcasecmp(outputformatstr, "map") == 0) {
|
||||
@@ -487,60 +485,47 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (progmode == progmode_compile) {
|
||||
dumpzone = 1; /* always dump */
|
||||
dumpzone = 1; /* always dump */
|
||||
logdump = !quiet;
|
||||
if (output_filename == NULL) {
|
||||
fprintf(stderr, "output file required, but not "
|
||||
"specified\n");
|
||||
fprintf(stderr,
|
||||
"output file required, but not specified\n");
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (output_filename != NULL) {
|
||||
if (output_filename != NULL)
|
||||
dumpzone = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are printing to stdout then send the informational
|
||||
* If we are outputing to stdout then send the informational
|
||||
* output to stderr.
|
||||
*/
|
||||
if (dumpzone &&
|
||||
(output_filename == NULL || strcmp(output_filename, "-") == 0 ||
|
||||
(output_filename == NULL ||
|
||||
strcmp(output_filename, "-") == 0 ||
|
||||
strcmp(output_filename, "/dev/fd/1") == 0 ||
|
||||
strcmp(output_filename, "/dev/stdout") == 0))
|
||||
{
|
||||
strcmp(output_filename, "/dev/stdout") == 0)) {
|
||||
errout = stderr;
|
||||
logdump = false;
|
||||
}
|
||||
|
||||
if (argc - isc_commandline_index < 1 ||
|
||||
argc - isc_commandline_index > 2) {
|
||||
if (isc_commandline_index + 2 != argc)
|
||||
usage();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
InitSockets();
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
if (!quiet) {
|
||||
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) ==
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
if (!quiet)
|
||||
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
|
||||
== ISC_R_SUCCESS);
|
||||
|
||||
dns_result_register();
|
||||
|
||||
origin = argv[isc_commandline_index++];
|
||||
|
||||
if (isc_commandline_index == argc) {
|
||||
/* "-" will be interpreted as stdin */
|
||||
filename = "-";
|
||||
} else {
|
||||
filename = argv[isc_commandline_index];
|
||||
}
|
||||
|
||||
isc_commandline_index++;
|
||||
|
||||
filename = argv[isc_commandline_index++];
|
||||
result = load_zone(mctx, origin, filename, inputformat, classname,
|
||||
maxttl, &zone);
|
||||
|
||||
@@ -556,24 +541,20 @@ main(int argc, char **argv) {
|
||||
fprintf(errout, "dump zone to %s...", output_filename);
|
||||
fflush(errout);
|
||||
}
|
||||
result = dump_zone(origin, zone, output_filename, outputformat,
|
||||
outputstyle, rawversion);
|
||||
if (logdump) {
|
||||
result = dump_zone(origin, zone, output_filename,
|
||||
outputformat, outputstyle, rawversion);
|
||||
if (logdump)
|
||||
fprintf(errout, "done\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet && result == ISC_R_SUCCESS) {
|
||||
if (!quiet && result == ISC_R_SUCCESS)
|
||||
fprintf(errout, "OK\n");
|
||||
}
|
||||
destroy();
|
||||
if (lctx != NULL) {
|
||||
if (lctx != NULL)
|
||||
isc_log_destroy(&lctx);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
#ifdef _WIN32
|
||||
DestroySockets();
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#endif
|
||||
return ((result == ISC_R_SUCCESS) ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ CWARNINGS =
|
||||
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
BIND9LIBS = ../../lib/bind9/libbind9.@A@
|
||||
|
||||
@@ -42,6 +43,8 @@ RNDCDEPLIBS = ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${BIND9DEPLIBS} ${DNSDEPLIBS} ${I
|
||||
|
||||
LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
|
||||
|
||||
NOSYMLIBS = ${DNSLIBS} ${ISCNOSYMLIBS} @LIBS@
|
||||
|
||||
CONFDEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
|
||||
|
||||
SRCS= rndc-confgen.c ddns-confgen.c
|
||||
|
||||
+42
-54
@@ -36,25 +36,24 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "keygen.h"
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
|
||||
#define KEYGEN_DEFAULT "tsig-key"
|
||||
#define CONFGEN_DEFAULT "ddns-key"
|
||||
#define KEYGEN_DEFAULT "tsig-key"
|
||||
#define CONFGEN_DEFAULT "ddns-key"
|
||||
|
||||
static char program[256];
|
||||
const char *progname;
|
||||
static enum { progmode_keygen, progmode_confgen } progmode;
|
||||
static enum { progmode_keygen, progmode_confgen} progmode;
|
||||
bool verbose = false; /* needed by util.c but not used here */
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -71,16 +70,16 @@ Usage:\n\
|
||||
-s name: domain name to be updated using the created key\n\
|
||||
-z zone: name of the zone as it will be used in named.conf\n\
|
||||
-q: quiet mode: print the key, with no explanatory text\n",
|
||||
progname);
|
||||
progname);
|
||||
} else {
|
||||
fprintf(stderr, "\
|
||||
Usage:\n\
|
||||
%s [-a alg] [keyname]\n\
|
||||
-a alg: algorithm (default hmac-sha256)\n\n",
|
||||
progname);
|
||||
progname);
|
||||
}
|
||||
|
||||
exit(status);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -103,22 +102,20 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
result = isc_file_progname(*argv, program, sizeof(program));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
memmove(program, "tsig-keygen", 11);
|
||||
}
|
||||
progname = program;
|
||||
|
||||
/*
|
||||
* Libtool doesn't preserve the program name prior to final
|
||||
* installation. Remove the libtool prefix ("lt-").
|
||||
*/
|
||||
if (strncmp(progname, "lt-", 3) == 0) {
|
||||
if (strncmp(progname, "lt-", 3) == 0)
|
||||
progname += 3;
|
||||
}
|
||||
|
||||
#define PROGCMP(X) \
|
||||
(strcasecmp(progname, X) == 0 || strcasecmp(progname, X ".exe") == 0)
|
||||
@@ -135,26 +132,24 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "a:hk:Mmr:qs:y:z:")) !=
|
||||
-1) {
|
||||
while ((ch = isc_commandline_parse(argc, argv,
|
||||
"a:hk:Mmr:qs:y:z:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
algname = isc_commandline_argument;
|
||||
alg = alg_fromtext(algname);
|
||||
if (alg == DST_ALG_UNKNOWN) {
|
||||
if (alg == DST_ALG_UNKNOWN)
|
||||
fatal("Unsupported algorithm '%s'", algname);
|
||||
}
|
||||
keysize = alg_bits(alg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y':
|
||||
if (progmode == progmode_confgen) {
|
||||
if (progmode == progmode_confgen)
|
||||
keyname = isc_commandline_argument;
|
||||
} else {
|
||||
else
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
|
||||
@@ -163,58 +158,51 @@ main(int argc, char **argv) {
|
||||
show_final_mem = true;
|
||||
break;
|
||||
case 'q':
|
||||
if (progmode == progmode_confgen) {
|
||||
if (progmode == progmode_confgen)
|
||||
quiet = true;
|
||||
} else {
|
||||
else
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
fatal("The -r option has been deprecated.");
|
||||
break;
|
||||
case 's':
|
||||
if (progmode == progmode_confgen) {
|
||||
if (progmode == progmode_confgen)
|
||||
self_domain = isc_commandline_argument;
|
||||
} else {
|
||||
else
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (progmode == progmode_confgen) {
|
||||
if (progmode == progmode_confgen)
|
||||
zone = isc_commandline_argument;
|
||||
} else {
|
||||
else
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(1);
|
||||
} else {
|
||||
} else
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (progmode == progmode_keygen) {
|
||||
if (progmode == progmode_keygen)
|
||||
keyname = argv[isc_commandline_index++];
|
||||
}
|
||||
|
||||
POST(argv);
|
||||
|
||||
if (self_domain != NULL && zone != NULL) {
|
||||
usage(1); /* -s and -z cannot coexist */
|
||||
}
|
||||
if (self_domain != NULL && zone != NULL)
|
||||
usage(1); /* -s and -z cannot coexist */
|
||||
|
||||
if (argc > isc_commandline_index) {
|
||||
if (argc > isc_commandline_index)
|
||||
usage(1);
|
||||
}
|
||||
|
||||
/* Use canonical algorithm name */
|
||||
algname = alg_totext(alg);
|
||||
@@ -224,18 +212,18 @@ main(int argc, char **argv) {
|
||||
if (keyname == NULL) {
|
||||
const char *suffix = NULL;
|
||||
|
||||
keyname = ((progmode == progmode_keygen) ? KEYGEN_DEFAULT
|
||||
: CONFGEN_DEFAULT);
|
||||
if (self_domain != NULL) {
|
||||
keyname = ((progmode == progmode_keygen)
|
||||
? KEYGEN_DEFAULT
|
||||
: CONFGEN_DEFAULT);
|
||||
if (self_domain != NULL)
|
||||
suffix = self_domain;
|
||||
} else if (zone != NULL) {
|
||||
else if (zone != NULL)
|
||||
suffix = zone;
|
||||
}
|
||||
if (suffix != NULL) {
|
||||
len = strlen(keyname) + strlen(suffix) + 2;
|
||||
keybuf = isc_mem_get(mctx, len);
|
||||
snprintf(keybuf, len, "%s.%s", keyname, suffix);
|
||||
keyname = (const char *)keybuf;
|
||||
keyname = (const char *) keybuf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,19 +231,20 @@ main(int argc, char **argv) {
|
||||
|
||||
generate_key(mctx, alg, keysize, &key_txtbuffer);
|
||||
|
||||
if (!quiet) {
|
||||
|
||||
if (!quiet)
|
||||
printf("\
|
||||
# To activate this key, place the following in named.conf, and\n\
|
||||
# in a separate keyfile on the system or systems from which nsupdate\n\
|
||||
# will be run:\n");
|
||||
}
|
||||
|
||||
printf("\
|
||||
key \"%s\" {\n\
|
||||
algorithm %s;\n\
|
||||
secret \"%.*s\";\n\
|
||||
};\n",
|
||||
keyname, algname, (int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer));
|
||||
|
||||
if (!quiet) {
|
||||
@@ -293,15 +282,14 @@ update-policy {\n\
|
||||
# After the keyfile has been placed, the following command will\n\
|
||||
# execute nsupdate using this key:\n\
|
||||
nsupdate -k <keyfile>\n");
|
||||
|
||||
}
|
||||
|
||||
if (keybuf != NULL) {
|
||||
if (keybuf != NULL)
|
||||
isc_mem_put(mctx, keybuf, len);
|
||||
}
|
||||
|
||||
if (show_final_mem) {
|
||||
if (show_final_mem)
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../.clang-format.headers
|
||||
@@ -9,19 +9,18 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#ifndef RNDC_OS_H
|
||||
#define RNDC_OS_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <stdio.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
int
|
||||
set_user(FILE *fd, const char *user);
|
||||
int set_user(FILE *fd, const char *user);
|
||||
/*%<
|
||||
* Set the owner of the file referenced by 'fd' to 'user'.
|
||||
* Returns:
|
||||
@@ -31,4 +30,4 @@ set_user(FILE *fd, const char *user);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ifndef RNDC_OS_H */
|
||||
#endif
|
||||
|
||||
+70
-81
@@ -9,11 +9,11 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include "keygen.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
@@ -29,10 +29,10 @@
|
||||
#include <dns/name.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
|
||||
/*%
|
||||
* Convert algorithm type to string.
|
||||
@@ -40,20 +40,20 @@
|
||||
const char *
|
||||
alg_totext(dns_secalg_t alg) {
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
return ("hmac-md5");
|
||||
case DST_ALG_HMACSHA1:
|
||||
return ("hmac-sha1");
|
||||
case DST_ALG_HMACSHA224:
|
||||
return ("hmac-sha224");
|
||||
case DST_ALG_HMACSHA256:
|
||||
return ("hmac-sha256");
|
||||
case DST_ALG_HMACSHA384:
|
||||
return ("hmac-sha384");
|
||||
case DST_ALG_HMACSHA512:
|
||||
return ("hmac-sha512");
|
||||
default:
|
||||
return ("(unknown)");
|
||||
case DST_ALG_HMACMD5:
|
||||
return "hmac-md5";
|
||||
case DST_ALG_HMACSHA1:
|
||||
return "hmac-sha1";
|
||||
case DST_ALG_HMACSHA224:
|
||||
return "hmac-sha224";
|
||||
case DST_ALG_HMACSHA256:
|
||||
return "hmac-sha256";
|
||||
case DST_ALG_HMACSHA384:
|
||||
return "hmac-sha384";
|
||||
case DST_ALG_HMACSHA512:
|
||||
return "hmac-sha512";
|
||||
default:
|
||||
return "(unknown)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,29 +63,22 @@ alg_totext(dns_secalg_t alg) {
|
||||
dns_secalg_t
|
||||
alg_fromtext(const char *name) {
|
||||
const char *p = name;
|
||||
if (strncasecmp(p, "hmac-", 5) == 0) {
|
||||
if (strncasecmp(p, "hmac-", 5) == 0)
|
||||
p = &name[5];
|
||||
}
|
||||
|
||||
if (strcasecmp(p, "md5") == 0) {
|
||||
return (DST_ALG_HMACMD5);
|
||||
}
|
||||
if (strcasecmp(p, "sha1") == 0) {
|
||||
return (DST_ALG_HMACSHA1);
|
||||
}
|
||||
if (strcasecmp(p, "sha224") == 0) {
|
||||
return (DST_ALG_HMACSHA224);
|
||||
}
|
||||
if (strcasecmp(p, "sha256") == 0) {
|
||||
return (DST_ALG_HMACSHA256);
|
||||
}
|
||||
if (strcasecmp(p, "sha384") == 0) {
|
||||
return (DST_ALG_HMACSHA384);
|
||||
}
|
||||
if (strcasecmp(p, "sha512") == 0) {
|
||||
return (DST_ALG_HMACSHA512);
|
||||
}
|
||||
return (DST_ALG_UNKNOWN);
|
||||
if (strcasecmp(p, "md5") == 0)
|
||||
return DST_ALG_HMACMD5;
|
||||
if (strcasecmp(p, "sha1") == 0)
|
||||
return DST_ALG_HMACSHA1;
|
||||
if (strcasecmp(p, "sha224") == 0)
|
||||
return DST_ALG_HMACSHA224;
|
||||
if (strcasecmp(p, "sha256") == 0)
|
||||
return DST_ALG_HMACSHA256;
|
||||
if (strcasecmp(p, "sha384") == 0)
|
||||
return DST_ALG_HMACSHA384;
|
||||
if (strcasecmp(p, "sha512") == 0)
|
||||
return DST_ALG_HMACSHA512;
|
||||
return DST_ALG_UNKNOWN;
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -94,20 +87,20 @@ alg_fromtext(const char *name) {
|
||||
int
|
||||
alg_bits(dns_secalg_t alg) {
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
return (128);
|
||||
case DST_ALG_HMACSHA1:
|
||||
return (160);
|
||||
case DST_ALG_HMACSHA224:
|
||||
return (224);
|
||||
case DST_ALG_HMACSHA256:
|
||||
return (256);
|
||||
case DST_ALG_HMACSHA384:
|
||||
return (384);
|
||||
case DST_ALG_HMACSHA512:
|
||||
return (512);
|
||||
default:
|
||||
return (0);
|
||||
case DST_ALG_HMACMD5:
|
||||
return 128;
|
||||
case DST_ALG_HMACSHA1:
|
||||
return 160;
|
||||
case DST_ALG_HMACSHA224:
|
||||
return 224;
|
||||
case DST_ALG_HMACSHA256:
|
||||
return 256;
|
||||
case DST_ALG_HMACSHA384:
|
||||
return 384;
|
||||
case DST_ALG_HMACSHA512:
|
||||
return 512;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,31 +117,30 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
dst_key_t *key = NULL;
|
||||
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
case DST_ALG_HMACSHA1:
|
||||
case DST_ALG_HMACSHA224:
|
||||
case DST_ALG_HMACSHA256:
|
||||
if (keysize < 1 || keysize > 512) {
|
||||
case DST_ALG_HMACMD5:
|
||||
case DST_ALG_HMACSHA1:
|
||||
case DST_ALG_HMACSHA224:
|
||||
case DST_ALG_HMACSHA256:
|
||||
if (keysize < 1 || keysize > 512)
|
||||
fatal("keysize %d out of range (must be 1-512)\n",
|
||||
keysize);
|
||||
}
|
||||
break;
|
||||
case DST_ALG_HMACSHA384:
|
||||
case DST_ALG_HMACSHA512:
|
||||
if (keysize < 1 || keysize > 1024) {
|
||||
case DST_ALG_HMACSHA384:
|
||||
case DST_ALG_HMACSHA512:
|
||||
if (keysize < 1 || keysize > 1024)
|
||||
fatal("keysize %d out of range (must be 1-1024)\n",
|
||||
keysize);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
fatal("unsupported algorithm %d\n", alg);
|
||||
}
|
||||
|
||||
DO("initialize dst library", dst_lib_init(mctx, NULL));
|
||||
|
||||
DO("generate key",
|
||||
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
|
||||
dns_rdataclass_in, mctx, &key, NULL));
|
||||
DO("generate key", dst_key_generate(dns_rootname, alg,
|
||||
keysize, 0, 0, DNS_KEYPROTO_ANY,
|
||||
dns_rdataclass_in, mctx, &key,
|
||||
NULL));
|
||||
|
||||
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
|
||||
|
||||
@@ -156,12 +148,11 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
|
||||
isc_buffer_usedregion(&key_rawbuffer, &key_rawregion);
|
||||
|
||||
DO("bsse64 encode secret",
|
||||
isc_base64_totext(&key_rawregion, -1, "", key_txtbuffer));
|
||||
DO("bsse64 encode secret", isc_base64_totext(&key_rawregion, -1, "",
|
||||
key_txtbuffer));
|
||||
|
||||
if (key != NULL) {
|
||||
if (key != NULL)
|
||||
dst_key_free(&key);
|
||||
}
|
||||
|
||||
dst_lib_destroy();
|
||||
}
|
||||
@@ -172,8 +163,9 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
* the name 'keyname' and the secret in the buffer 'secret'.
|
||||
*/
|
||||
void
|
||||
write_key_file(const char *keyfile, const char *user, const char *keyname,
|
||||
isc_buffer_t *secret, dns_secalg_t alg) {
|
||||
write_key_file(const char *keyfile, const char *user,
|
||||
const char *keyname, isc_buffer_t *secret,
|
||||
dns_secalg_t alg) {
|
||||
isc_result_t result;
|
||||
const char *algname = alg_totext(alg);
|
||||
FILE *fd = NULL;
|
||||
@@ -181,22 +173,19 @@ write_key_file(const char *keyfile, const char *user, const char *keyname,
|
||||
DO("create keyfile", isc_file_safecreate(keyfile, &fd));
|
||||
|
||||
if (user != NULL) {
|
||||
if (set_user(fd, user) == -1) {
|
||||
if (set_user(fd, user) == -1)
|
||||
fatal("unable to set file owner\n");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd,
|
||||
"key \"%s\" {\n\talgorithm %s;\n"
|
||||
fprintf(fd, "key \"%s\" {\n\talgorithm %s;\n"
|
||||
"\tsecret \"%.*s\";\n};\n",
|
||||
keyname, algname, (int)isc_buffer_usedlength(secret),
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(secret),
|
||||
(char *)isc_buffer_base(secret));
|
||||
fflush(fd);
|
||||
if (ferror(fd)) {
|
||||
if (ferror(fd))
|
||||
fatal("write to %s failed\n", keyfile);
|
||||
}
|
||||
if (fclose(fd)) {
|
||||
if (fclose(fd))
|
||||
fatal("fclose(%s) failed\n", keyfile);
|
||||
}
|
||||
fprintf(stderr, "wrote key file \"%s\"\n", keyfile);
|
||||
}
|
||||
|
||||
+9
-16
@@ -9,33 +9,26 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RNDC_KEYGEN_H
|
||||
#define RNDC_KEYGEN_H 1
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/mem.h>
|
||||
|
||||
#include <dns/secalg.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
void
|
||||
generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
isc_buffer_t *key_txtbuffer);
|
||||
void generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
isc_buffer_t *key_txtbuffer);
|
||||
|
||||
void
|
||||
write_key_file(const char *keyfile, const char *user, const char *keyname,
|
||||
isc_buffer_t *secret, dns_secalg_t alg);
|
||||
void write_key_file(const char *keyfile, const char *user,
|
||||
const char *keyname, isc_buffer_t *secret,
|
||||
dns_secalg_t alg);
|
||||
|
||||
const char *
|
||||
alg_totext(dns_secalg_t alg);
|
||||
dns_secalg_t
|
||||
alg_fromtext(const char *name);
|
||||
int
|
||||
alg_bits(dns_secalg_t alg);
|
||||
const char *alg_totext(dns_secalg_t alg);
|
||||
dns_secalg_t alg_fromtext(const char *name);
|
||||
int alg_bits(dns_secalg_t alg);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
||||
+26
-35
@@ -43,15 +43,14 @@
|
||||
#include <dns/name.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "keygen.h"
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
|
||||
#define DEFAULT_KEYNAME "rndc-key"
|
||||
#define DEFAULT_SERVER "127.0.0.1"
|
||||
#define DEFAULT_PORT 953
|
||||
#define DEFAULT_KEYNAME "rndc-key"
|
||||
#define DEFAULT_SERVER "127.0.0.1"
|
||||
#define DEFAULT_PORT 953
|
||||
|
||||
static char program[256];
|
||||
const char *progname;
|
||||
@@ -65,6 +64,7 @@ usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(int status) {
|
||||
|
||||
fprintf(stderr, "\
|
||||
Usage:\n\
|
||||
%s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] \
|
||||
@@ -78,9 +78,9 @@ Usage:\n\
|
||||
-s addr: the address to which rndc should connect\n\
|
||||
-t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\
|
||||
-u user: set the keyfile owner to \"user\" (requires -a)\n",
|
||||
progname, keydef);
|
||||
progname, keydef);
|
||||
|
||||
exit(status);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -108,9 +108,8 @@ main(int argc, char **argv) {
|
||||
keydef = keyfile = RNDC_KEYFILE;
|
||||
|
||||
result = isc_file_progname(*argv, program, sizeof(program));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
memmove(program, "rndc-confgen", 13);
|
||||
}
|
||||
progname = program;
|
||||
|
||||
keyname = DEFAULT_KEYNAME;
|
||||
@@ -130,15 +129,13 @@ main(int argc, char **argv) {
|
||||
case 'A':
|
||||
algname = isc_commandline_argument;
|
||||
alg = alg_fromtext(algname);
|
||||
if (alg == DST_ALG_UNKNOWN) {
|
||||
if (alg == DST_ALG_UNKNOWN)
|
||||
fatal("Unsupported algorithm '%s'", algname);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
keysize = strtol(isc_commandline_argument, &p, 10);
|
||||
if (*p != '\0' || keysize < 0) {
|
||||
if (*p != '\0' || keysize < 0)
|
||||
fatal("-b requires a non-negative number");
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
keyfile = isc_commandline_argument;
|
||||
@@ -146,7 +143,7 @@ main(int argc, char **argv) {
|
||||
case 'h':
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y': /* Compatible with rndc -y. */
|
||||
case 'y': /* Compatible with rndc -y. */
|
||||
keyname = isc_commandline_argument;
|
||||
break;
|
||||
case 'M':
|
||||
@@ -158,10 +155,9 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'p':
|
||||
port = strtol(isc_commandline_argument, &p, 10);
|
||||
if (*p != '\0' || port < 0 || port > 65535) {
|
||||
if (*p != '\0' || port < 0 || port > 65535)
|
||||
fatal("port '%s' out of range",
|
||||
isc_commandline_argument);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
fatal("The -r option has been deprecated.");
|
||||
@@ -170,9 +166,7 @@ main(int argc, char **argv) {
|
||||
serveraddr = isc_commandline_argument;
|
||||
if (inet_pton(AF_INET, serveraddr, &addr4_dummy) != 1 &&
|
||||
inet_pton(AF_INET6, serveraddr, &addr6_dummy) != 1)
|
||||
{
|
||||
fatal("-s should be an IPv4 or IPv6 address");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
chrootdir = isc_commandline_argument;
|
||||
@@ -188,13 +182,12 @@ main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(1);
|
||||
} else {
|
||||
} else
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -203,19 +196,17 @@ main(int argc, char **argv) {
|
||||
argv += isc_commandline_index;
|
||||
POST(argv);
|
||||
|
||||
if (argc > 0) {
|
||||
if (argc > 0)
|
||||
usage(1);
|
||||
}
|
||||
|
||||
if (alg == DST_ALG_HMACMD5) {
|
||||
fprintf(stderr, "warning: use of hmac-md5 for RNDC keys "
|
||||
"is deprecated; hmac-sha256 is now "
|
||||
"recommended.\n");
|
||||
fprintf(stderr,
|
||||
"warning: use of hmac-md5 for RNDC keys "
|
||||
"is deprecated; hmac-sha256 is now recommended.\n");
|
||||
}
|
||||
|
||||
if (keysize < 0) {
|
||||
if (keysize < 0)
|
||||
keysize = alg_bits(alg);
|
||||
}
|
||||
algname = alg_totext(alg);
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
@@ -265,16 +256,16 @@ options {\n\
|
||||
# End of named.conf\n",
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer), keyname,
|
||||
serveraddr, port, keyname, algname,
|
||||
(char *)isc_buffer_base(&key_txtbuffer),
|
||||
keyname, serveraddr, port,
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer), serveraddr,
|
||||
port, serveraddr, keyname);
|
||||
(char *)isc_buffer_base(&key_txtbuffer),
|
||||
serveraddr, port, serveraddr, keyname);
|
||||
}
|
||||
|
||||
if (show_final_mem) {
|
||||
if (show_final_mem)
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
|
||||
@@ -9,17 +9,18 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
int
|
||||
set_user(FILE *fd, const char *user) {
|
||||
|
||||
+4
-2
@@ -9,16 +9,18 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include "util.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
extern bool verbose;
|
||||
extern const char *progname;
|
||||
|
||||
|
||||
+11
-9
@@ -9,25 +9,27 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RNDC_UTIL_H
|
||||
#define RNDC_UTIL_H 1
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/formatcheck.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/platform.h>
|
||||
|
||||
#define NS_CONTROL_PORT 953
|
||||
#include <isc/formatcheck.h>
|
||||
|
||||
#define NS_CONTROL_PORT 953
|
||||
|
||||
#undef DO
|
||||
#define DO(name, function) \
|
||||
do { \
|
||||
result = function; \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
#define DO(name, function) \
|
||||
do { \
|
||||
result = function; \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
fatal("%s: %s", name, isc_result_totext(result)); \
|
||||
else \
|
||||
notify("%s", name); \
|
||||
else \
|
||||
notify("%s", name); \
|
||||
} while (0)
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
@@ -37,7 +39,7 @@ notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int
|
||||
set_user(FILE *fd, const char *user) {
|
||||
return (0);
|
||||
|
||||
@@ -25,7 +25,8 @@ CWARNINGS =
|
||||
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
IRSLIBS = ../../lib/irs/libirs.@A@
|
||||
|
||||
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
@@ -36,6 +37,7 @@ IRSDEPLIBS = ../../lib/irs/libirs.@A@
|
||||
DEPLIBS = ${DNSDEPLIBS} ${IRSDEPLIBS} ${ISCCFGDEPLIBS} ${ISCDEPLIBS}
|
||||
|
||||
LIBS = ${DNSLIBS} ${IRSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@
|
||||
NOSYMLIBS = ${DNSLIBS} ${IRSLIBS} ${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
+329
-353
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -28,7 +28,8 @@ CWARNINGS =
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
BIND9LIBS = ../../lib/bind9/libbind9.@A@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
IRSLIBS = ../../lib/irs/libirs.@A@
|
||||
|
||||
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
@@ -43,6 +44,9 @@ DEPLIBS = ${DNSDEPLIBS} ${IRSDEPLIBS} ${BIND9DEPLIBS} \
|
||||
LIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
|
||||
${ISCLIBS} @LIBIDN2_LIBS@ @LIBS@
|
||||
|
||||
NOSYMLIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
|
||||
${ISCNOSYMLIBS} @LIBIDN2_LIBS@ @LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
TARGETS = dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@
|
||||
|
||||
+468
-602
File diff suppressed because it is too large
Load Diff
+508
-627
File diff suppressed because it is too large
Load Diff
+1
-6
@@ -39,7 +39,7 @@
|
||||
host \- DNS lookup utility
|
||||
.SH "SYNOPSIS"
|
||||
.HP \w'\fBhost\fR\ 'u
|
||||
\fBhost\fR [\fB\-aACdlnrsTUwv\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-N\ \fR\fB\fIndots\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-R\ \fR\fB\fInumber\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-W\ \fR\fB\fIwait\fR\fR] [\fB\-m\ \fR\fB\fIflag\fR\fR] [[\fB\-4\fR] | [\fB\-6\fR]] [\fB\-v\fR] [\fB\-V\fR] {name} [server]
|
||||
\fBhost\fR [\fB\-aACdlnrsTUwv\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-N\ \fR\fB\fIndots\fR\fR] [\fB\-R\ \fR\fB\fInumber\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-W\ \fR\fB\fIwait\fR\fR] [\fB\-m\ \fR\fB\fIflag\fR\fR] [[\fB\-4\fR] | [\fB\-6\fR]] [\fB\-v\fR] [\fB\-V\fR] {name} [server]
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
\fBhost\fR
|
||||
@@ -138,11 +138,6 @@ directive in
|
||||
/etc/resolv\&.conf\&.
|
||||
.RE
|
||||
.PP
|
||||
\-p \fIport\fR
|
||||
.RS 4
|
||||
Specify the port on the server to query\&. The default is 53\&.
|
||||
.RE
|
||||
.PP
|
||||
\-r
|
||||
.RS 4
|
||||
Non\-recursive query: Setting this option clears the RD (recursion desired) bit in the query\&. This should mean that the name server receiving the query will not attempt to resolve
|
||||
|
||||
+223
-249
@@ -12,21 +12,21 @@
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif /* ifdef HAVE_LOCALE_H */
|
||||
#endif
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/task.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/fixedname.h>
|
||||
@@ -35,8 +35,8 @@
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
|
||||
@@ -49,56 +49,83 @@ static dns_rdatatype_t list_type = dns_rdatatype_a;
|
||||
static bool printed_server = false;
|
||||
static bool ipv4only = false, ipv6only = false;
|
||||
|
||||
static const char *opcodetext[] = { "QUERY", "IQUERY", "STATUS",
|
||||
"RESERVED3", "NOTIFY", "UPDATE",
|
||||
"RESERVED6", "RESERVED7", "RESERVED8",
|
||||
"RESERVED9", "RESERVED10", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15" };
|
||||
static const char *opcodetext[] = {
|
||||
"QUERY",
|
||||
"IQUERY",
|
||||
"STATUS",
|
||||
"RESERVED3",
|
||||
"NOTIFY",
|
||||
"UPDATE",
|
||||
"RESERVED6",
|
||||
"RESERVED7",
|
||||
"RESERVED8",
|
||||
"RESERVED9",
|
||||
"RESERVED10",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15"
|
||||
};
|
||||
|
||||
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
|
||||
"NXDOMAIN", "NOTIMP", "REFUSED",
|
||||
"YXDOMAIN", "YXRRSET", "NXRRSET",
|
||||
"NOTAUTH", "NOTZONE", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15", "BADVERS" };
|
||||
static const char *rcodetext[] = {
|
||||
"NOERROR",
|
||||
"FORMERR",
|
||||
"SERVFAIL",
|
||||
"NXDOMAIN",
|
||||
"NOTIMP",
|
||||
"REFUSED",
|
||||
"YXDOMAIN",
|
||||
"YXRRSET",
|
||||
"NXRRSET",
|
||||
"NOTAUTH",
|
||||
"NOTZONE",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15",
|
||||
"BADVERS"
|
||||
};
|
||||
|
||||
struct rtype {
|
||||
unsigned int type;
|
||||
const char *text;
|
||||
};
|
||||
|
||||
struct rtype rtypes[] = { { 1, "has address" },
|
||||
{ 2, "name server" },
|
||||
{ 5, "is an alias for" },
|
||||
{ 11, "has well known services" },
|
||||
{ 12, "domain name pointer" },
|
||||
{ 13, "host information" },
|
||||
{ 15, "mail is handled by" },
|
||||
{ 16, "descriptive text" },
|
||||
{ 19, "x25 address" },
|
||||
{ 20, "ISDN address" },
|
||||
{ 24, "has signature" },
|
||||
{ 25, "has key" },
|
||||
{ 28, "has IPv6 address" },
|
||||
{ 29, "location" },
|
||||
{ 0, NULL } };
|
||||
struct rtype rtypes[] = {
|
||||
{ 1, "has address" },
|
||||
{ 2, "name server" },
|
||||
{ 5, "is an alias for" },
|
||||
{ 11, "has well known services" },
|
||||
{ 12, "domain name pointer" },
|
||||
{ 13, "host information" },
|
||||
{ 15, "mail is handled by" },
|
||||
{ 16, "descriptive text" },
|
||||
{ 19, "x25 address" },
|
||||
{ 20, "ISDN address" },
|
||||
{ 24, "has signature" },
|
||||
{ 25, "has key" },
|
||||
{ 28, "has IPv6 address" },
|
||||
{ 29, "location" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static char *
|
||||
rcode_totext(dns_rcode_t rcode) {
|
||||
rcode_totext(dns_rcode_t rcode)
|
||||
{
|
||||
static char buf[sizeof("?65535")];
|
||||
union {
|
||||
const char *consttext;
|
||||
char *deconsttext;
|
||||
} totext;
|
||||
|
||||
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
|
||||
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
|
||||
snprintf(buf, sizeof(buf), "?%u", rcode);
|
||||
totext.deconsttext = buf;
|
||||
} else {
|
||||
} else
|
||||
totext.consttext = rcodetext[rcode];
|
||||
}
|
||||
return (totext.deconsttext);
|
||||
return totext.deconsttext;
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -106,38 +133,35 @@ show_usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
show_usage(void) {
|
||||
fputs("Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W "
|
||||
"time]\n"
|
||||
" [-R number] [-m flag] [-p port] hostname [server]\n"
|
||||
" -a is equivalent to -v -t ANY\n"
|
||||
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
|
||||
" -c specifies query class for non-IN data\n"
|
||||
" -C compares SOA records on authoritative nameservers\n"
|
||||
" -d is equivalent to -v\n"
|
||||
" -l lists all hosts in a domain, using AXFR\n"
|
||||
" -m set memory debugging flag (trace|record|usage)\n"
|
||||
" -N changes the number of dots allowed before root lookup "
|
||||
"is done\n"
|
||||
" -p specifies the port on the server to query\n"
|
||||
" -r disables recursive processing\n"
|
||||
" -R specifies number of retries for UDP packets\n"
|
||||
" -s a SERVFAIL response should stop query\n"
|
||||
" -t specifies the query type\n"
|
||||
" -T enables TCP/IP mode\n"
|
||||
" -U enables UDP mode\n"
|
||||
" -v enables verbose output\n"
|
||||
" -V print version number and exit\n"
|
||||
" -w specifies to wait forever for a reply\n"
|
||||
" -W specifies how long to wait for a reply\n"
|
||||
" -4 use IPv4 query transport only\n"
|
||||
" -6 use IPv6 query transport only\n",
|
||||
stderr);
|
||||
fputs(
|
||||
"Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W time]\n"
|
||||
" [-R number] [-m flag] hostname [server]\n"
|
||||
" -a is equivalent to -v -t ANY\n"
|
||||
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
|
||||
" -c specifies query class for non-IN data\n"
|
||||
" -C compares SOA records on authoritative nameservers\n"
|
||||
" -d is equivalent to -v\n"
|
||||
" -l lists all hosts in a domain, using AXFR\n"
|
||||
" -m set memory debugging flag (trace|record|usage)\n"
|
||||
" -N changes the number of dots allowed before root lookup is done\n"
|
||||
" -r disables recursive processing\n"
|
||||
" -R specifies number of retries for UDP packets\n"
|
||||
" -s a SERVFAIL response should stop query\n"
|
||||
" -t specifies the query type\n"
|
||||
" -T enables TCP/IP mode\n"
|
||||
" -U enables UDP mode\n"
|
||||
" -v enables verbose output\n"
|
||||
" -V print version number and exit\n"
|
||||
" -w specifies to wait forever for a reply\n"
|
||||
" -W specifies how long to wait for a reply\n"
|
||||
" -4 use IPv4 query transport only\n"
|
||||
" -6 use IPv6 query transport only\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
host_shutdown(void) {
|
||||
(void)isc_app_shutdown();
|
||||
(void) isc_app_shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -149,9 +173,9 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
char fromtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
|
||||
TIME_NOW(&now);
|
||||
diff = (int)isc_time_microdiff(&now, &query->time_sent);
|
||||
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
|
||||
diff / 1000);
|
||||
diff = (int) isc_time_microdiff(&now, &query->time_sent);
|
||||
printf("Received %u bytes from %s in %d ms\n",
|
||||
bytes, fromtext, diff/1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,14 +183,14 @@ static void
|
||||
trying(char *frm, dig_lookup_t *lookup) {
|
||||
UNUSED(lookup);
|
||||
|
||||
if (!short_form) {
|
||||
if (!short_form)
|
||||
printf("Trying \"%s\"\n", frm);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
dig_query_t *query) {
|
||||
dig_query_t *query)
|
||||
{
|
||||
isc_buffer_t *b = NULL;
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
isc_region_t r;
|
||||
@@ -174,8 +198,9 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
unsigned int bufsize = BUFSIZ;
|
||||
|
||||
dns_name_format(name, namestr, sizeof(namestr));
|
||||
retry:
|
||||
isc_buffer_allocate(mctx, &b, bufsize);
|
||||
retry:
|
||||
result = isc_buffer_allocate(mctx, &b, bufsize);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
isc_buffer_free(&b);
|
||||
@@ -185,9 +210,11 @@ retry:
|
||||
check_result(result, "dns_rdata_totext");
|
||||
isc_buffer_usedregion(b, &r);
|
||||
if (query->lookup->identify_previous_line) {
|
||||
printf("Nameserver %s:\n\t", query->servname);
|
||||
printf("Nameserver %s:\n\t",
|
||||
query->servname);
|
||||
}
|
||||
printf("%s %s %.*s", namestr, msg, (int)r.length, (char *)r.base);
|
||||
printf("%s %s %.*s", namestr,
|
||||
msg, (int)r.length, (char *)r.base);
|
||||
if (query->lookup->identify) {
|
||||
printf(" on server %s", query->servname);
|
||||
}
|
||||
@@ -197,7 +224,9 @@ retry:
|
||||
|
||||
static isc_result_t
|
||||
printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
const char *section_name, bool headers, dig_query_t *query) {
|
||||
const char *section_name, bool headers,
|
||||
dig_query_t *query)
|
||||
{
|
||||
dns_name_t *name, *print_name;
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
@@ -209,24 +238,21 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
bool first;
|
||||
bool no_rdata;
|
||||
|
||||
if (sectionid == DNS_SECTION_QUESTION) {
|
||||
if (sectionid == DNS_SECTION_QUESTION)
|
||||
no_rdata = true;
|
||||
} else {
|
||||
else
|
||||
no_rdata = false;
|
||||
}
|
||||
|
||||
if (headers) {
|
||||
if (headers)
|
||||
printf(";; %s SECTION:\n", section_name);
|
||||
}
|
||||
|
||||
dns_name_init(&empty_name, NULL);
|
||||
|
||||
result = dns_message_firstname(msg, sectionid);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
@@ -236,9 +262,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
first = true;
|
||||
print_name = name;
|
||||
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
if (query->lookup->rdtype == dns_rdatatype_axfr &&
|
||||
!((!list_addresses &&
|
||||
(list_type == dns_rdatatype_any ||
|
||||
@@ -248,39 +274,36 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
rdataset->type == dns_rdatatype_aaaa ||
|
||||
rdataset->type == dns_rdatatype_ns ||
|
||||
rdataset->type == dns_rdatatype_ptr))))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (list_almost_all &&
|
||||
(rdataset->type == dns_rdatatype_rrsig ||
|
||||
rdataset->type == dns_rdatatype_nsec ||
|
||||
rdataset->type == dns_rdatatype_nsec3))
|
||||
{
|
||||
(rdataset->type == dns_rdatatype_rrsig ||
|
||||
rdataset->type == dns_rdatatype_nsec ||
|
||||
rdataset->type == dns_rdatatype_nsec3))
|
||||
continue;
|
||||
}
|
||||
if (!short_form) {
|
||||
result = dns_rdataset_totext(rdataset,
|
||||
print_name, false,
|
||||
no_rdata, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_name,
|
||||
false,
|
||||
no_rdata,
|
||||
&target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
#ifdef USEINITALWS
|
||||
if (first) {
|
||||
print_name = &empty_name;
|
||||
first = false;
|
||||
}
|
||||
#else /* ifdef USEINITALWS */
|
||||
#else
|
||||
UNUSED(first); /* Shut up compiler. */
|
||||
#endif /* ifdef USEINITALWS */
|
||||
#endif
|
||||
} else {
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
struct rtype *t;
|
||||
const char *rtt;
|
||||
char typebuf[DNS_RDATATYPE_FORMATSIZE];
|
||||
char typebuf2[DNS_RDATATYPE_FORMATSIZE +
|
||||
20];
|
||||
char typebuf2[DNS_RDATATYPE_FORMATSIZE
|
||||
+ 20];
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
||||
for (t = rtypes; t->text != NULL; t++) {
|
||||
@@ -297,8 +320,8 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
"has %s record", typebuf);
|
||||
rtt = typebuf2;
|
||||
found:
|
||||
say_message(print_name, rtt, &rdata,
|
||||
query);
|
||||
say_message(print_name, rtt,
|
||||
&rdata, query);
|
||||
dns_rdata_reset(&rdata);
|
||||
loopresult =
|
||||
dns_rdataset_next(rdataset);
|
||||
@@ -307,19 +330,18 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
}
|
||||
if (!short_form) {
|
||||
isc_buffer_usedregion(&target, &r);
|
||||
if (no_rdata) {
|
||||
printf(";%.*s", (int)r.length, (char *)r.base);
|
||||
} else {
|
||||
if (no_rdata)
|
||||
printf(";%.*s", (int)r.length,
|
||||
(char *)r.base);
|
||||
else
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_message_nextname(msg, sectionid);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -327,23 +349,24 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
|
||||
static isc_result_t
|
||||
printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
||||
const dns_name_t *owner, const char *set_name, bool headers) {
|
||||
const dns_name_t *owner, const char *set_name,
|
||||
bool headers)
|
||||
{
|
||||
isc_buffer_t target;
|
||||
isc_result_t result;
|
||||
isc_region_t r;
|
||||
char tbuf[4096];
|
||||
|
||||
UNUSED(msg);
|
||||
if (headers) {
|
||||
if (headers)
|
||||
printf(";; %s SECTION:\n", set_name);
|
||||
}
|
||||
|
||||
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
||||
|
||||
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dns_rdataset_totext(rdataset, owner, false, false,
|
||||
&target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_usedregion(&target, &r);
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
|
||||
@@ -363,9 +386,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
|
||||
dns_rdatatype_cname, 0, NULL,
|
||||
&rdataset);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
}
|
||||
result = dns_rdataset_first(rdataset);
|
||||
check_result(result, "dns_rdataset_first");
|
||||
dns_rdata_reset(&rdata);
|
||||
@@ -378,8 +400,9 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
bool headers) {
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers)
|
||||
{
|
||||
bool did_flag = false;
|
||||
dns_rdataset_t *opt, *tsig = NULL;
|
||||
const dns_name_t *tsigname;
|
||||
@@ -400,7 +423,8 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
|
||||
printf("Using domain server:\n");
|
||||
printf("Name: %s\n", query->userarg);
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr,
|
||||
sizeof(sockstr));
|
||||
printf("Address: %s\n", sockstr);
|
||||
printf("Aliases: \n\n");
|
||||
printed_server = true;
|
||||
@@ -410,20 +434,17 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
|
||||
|
||||
if (query->lookup->identify_previous_line) {
|
||||
if (query->lookup->identify_previous_line)
|
||||
printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
|
||||
query->servname,
|
||||
(msg->rcode != dns_rcode_nxdomain)
|
||||
? namestr
|
||||
: query->lookup->textname,
|
||||
msg->rcode, rcode_totext(msg->rcode));
|
||||
} else {
|
||||
(msg->rcode != dns_rcode_nxdomain) ? namestr :
|
||||
query->lookup->textname, msg->rcode,
|
||||
rcode_totext(msg->rcode));
|
||||
else
|
||||
printf("Host %s not found: %d(%s)\n",
|
||||
(msg->rcode != dns_rcode_nxdomain)
|
||||
? namestr
|
||||
: query->lookup->textname,
|
||||
msg->rcode, rcode_totext(msg->rcode));
|
||||
}
|
||||
(msg->rcode != dns_rcode_nxdomain) ? namestr :
|
||||
query->lookup->textname, msg->rcode,
|
||||
rcode_totext(msg->rcode));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -501,70 +522,60 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
msg->counts[DNS_SECTION_AUTHORITY],
|
||||
msg->counts[DNS_SECTION_ADDITIONAL]);
|
||||
opt = dns_message_getopt(msg);
|
||||
if (opt != NULL) {
|
||||
if (opt != NULL)
|
||||
printf(";; EDNS: version: %u, udp=%u\n",
|
||||
(unsigned int)((opt->ttl & 0x00ff0000) >> 16),
|
||||
(unsigned int)opt->rdclass);
|
||||
}
|
||||
tsigname = NULL;
|
||||
tsig = dns_message_gettsig(msg, &tsigname);
|
||||
if (tsig != NULL) {
|
||||
if (tsig != NULL)
|
||||
printf(";; PSEUDOSECTIONS: TSIG\n");
|
||||
}
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) && !short_form)
|
||||
{
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) &&
|
||||
!short_form) {
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
if (!short_form) {
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
if (!short_form)
|
||||
printf("\n");
|
||||
}
|
||||
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
|
||||
!short_form, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
|
||||
!short_form) {
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
|
||||
!short_form) {
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = printsection(msg, DNS_SECTION_ADDITIONAL,
|
||||
"ADDITIONAL", true, query);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if ((tsig != NULL) && !short_form) {
|
||||
printf("\n");
|
||||
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
|
||||
true);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = printrdata(msg, tsig, tsigname,
|
||||
"PSEUDOSECTION TSIG", true);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!short_form) {
|
||||
if (!short_form)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (short_form && !default_lookups &&
|
||||
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
|
||||
{
|
||||
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
char typestr[DNS_RDATATYPE_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
|
||||
@@ -576,7 +587,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
return (result);
|
||||
}
|
||||
|
||||
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
|
||||
static const char * optstring = "46aAc:dilnm:rst:vVwCDN:R:TUW:";
|
||||
|
||||
/*% version */
|
||||
static void
|
||||
@@ -593,77 +604,52 @@ pre_parse_args(int argc, char **argv) {
|
||||
case 'm':
|
||||
memdebugging = true;
|
||||
if (strcasecmp("trace", isc_commandline_argument) == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
} else if (strcasecmp("record",
|
||||
isc_commandline_argument) == 0) {
|
||||
else if (strcasecmp("record",
|
||||
isc_commandline_argument) == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
} else if (strcasecmp("usage",
|
||||
isc_commandline_argument) == 0) {
|
||||
else if (strcasecmp("usage",
|
||||
isc_commandline_argument) == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
}
|
||||
break;
|
||||
|
||||
case '4':
|
||||
if (ipv6only) {
|
||||
if (ipv6only)
|
||||
fatal("only one of -4 and -6 allowed");
|
||||
}
|
||||
ipv4only = true;
|
||||
break;
|
||||
case '6':
|
||||
if (ipv4only) {
|
||||
if (ipv4only)
|
||||
fatal("only one of -4 and -6 allowed");
|
||||
}
|
||||
ipv6only = true;
|
||||
break;
|
||||
case 'a':
|
||||
break;
|
||||
case 'A':
|
||||
break;
|
||||
case 'c':
|
||||
break;
|
||||
case 'C':
|
||||
break;
|
||||
case 'd':
|
||||
break;
|
||||
case 'a': break;
|
||||
case 'A': break;
|
||||
case 'c': break;
|
||||
case 'C': break;
|
||||
case 'd': break;
|
||||
case 'D':
|
||||
if (debugging) {
|
||||
if (debugging)
|
||||
debugtiming = true;
|
||||
}
|
||||
debugging = true;
|
||||
break;
|
||||
case 'i':
|
||||
break;
|
||||
case 'l':
|
||||
break;
|
||||
case 'n':
|
||||
break;
|
||||
case 'N':
|
||||
break;
|
||||
case 'p':
|
||||
break;
|
||||
case 'r':
|
||||
break;
|
||||
case 'R':
|
||||
break;
|
||||
case 's':
|
||||
break;
|
||||
case 't':
|
||||
break;
|
||||
case 'T':
|
||||
break;
|
||||
case 'U':
|
||||
break;
|
||||
case 'v':
|
||||
break;
|
||||
case 'i': break;
|
||||
case 'l': break;
|
||||
case 'n': break;
|
||||
case 'N': break;
|
||||
case 'r': break;
|
||||
case 'R': break;
|
||||
case 's': break;
|
||||
case 't': break;
|
||||
case 'T': break;
|
||||
case 'U': break;
|
||||
case 'v': break;
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
case 'w':
|
||||
break;
|
||||
case 'W':
|
||||
break;
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
case 'w': break;
|
||||
case 'W': break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
@@ -689,7 +675,6 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
lookup = make_empty_lookup();
|
||||
|
||||
lookup->servfail_stops = false;
|
||||
lookup->besteffort = false;
|
||||
lookup->comments = false;
|
||||
short_form = !verbose;
|
||||
|
||||
@@ -709,8 +694,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
lookup->recurse = false;
|
||||
break;
|
||||
case 't':
|
||||
if (strncasecmp(isc_commandline_argument, "ixfr=", 5) ==
|
||||
0) {
|
||||
if (strncasecmp(isc_commandline_argument,
|
||||
"ixfr=", 5) == 0) {
|
||||
rdtype = dns_rdatatype_ixfr;
|
||||
/* XXXMPA add error checking */
|
||||
serial = strtoul(isc_commandline_argument + 5,
|
||||
@@ -719,8 +704,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
} else {
|
||||
tr.base = isc_commandline_argument;
|
||||
tr.length = strlen(isc_commandline_argument);
|
||||
result = dns_rdatatype_fromtext(
|
||||
&rdtype, (isc_textregion_t *)&tr);
|
||||
result = dns_rdatatype_fromtext(&rdtype,
|
||||
(isc_textregion_t *)&tr);
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -729,9 +714,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
isc_commandline_argument);
|
||||
}
|
||||
if (!lookup->rdtypeset ||
|
||||
lookup->rdtype != dns_rdatatype_axfr) {
|
||||
lookup->rdtype != dns_rdatatype_axfr)
|
||||
lookup->rdtype = rdtype;
|
||||
}
|
||||
lookup->rdtypeset = true;
|
||||
if (rdtype == dns_rdatatype_axfr) {
|
||||
/* -l -t any -v */
|
||||
@@ -743,20 +727,18 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
lookup->tcp_mode = true;
|
||||
list_type = rdtype;
|
||||
} else if (rdtype == dns_rdatatype_any) {
|
||||
if (!lookup->tcp_mode_set) {
|
||||
if (!lookup->tcp_mode_set)
|
||||
lookup->tcp_mode = true;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
list_type = rdtype;
|
||||
}
|
||||
list_addresses = false;
|
||||
default_lookups = false;
|
||||
break;
|
||||
case 'c':
|
||||
tr.base = isc_commandline_argument;
|
||||
tr.length = strlen(isc_commandline_argument);
|
||||
result = dns_rdataclass_fromtext(
|
||||
&rdclass, (isc_textregion_t *)&tr);
|
||||
result = dns_rdataclass_fromtext(&rdclass,
|
||||
(isc_textregion_t *)&tr);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatalexit = 2;
|
||||
@@ -770,12 +752,11 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
break;
|
||||
case 'A':
|
||||
list_almost_all = true;
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'a':
|
||||
if (!lookup->rdtypeset ||
|
||||
lookup->rdtype != dns_rdatatype_axfr) {
|
||||
lookup->rdtype != dns_rdatatype_axfr)
|
||||
lookup->rdtype = dns_rdatatype_any;
|
||||
}
|
||||
list_type = dns_rdatatype_any;
|
||||
list_addresses = false;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -800,15 +781,13 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
break;
|
||||
case 'W':
|
||||
timeout = atoi(isc_commandline_argument);
|
||||
if (timeout < 1) {
|
||||
if (timeout < 1)
|
||||
timeout = 1;
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
tries = atoi(isc_commandline_argument) + 1;
|
||||
if (tries < 2) {
|
||||
if (tries < 2)
|
||||
tries = 2;
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
lookup->tcp_mode = true;
|
||||
@@ -830,7 +809,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
default_lookups = false;
|
||||
break;
|
||||
case 'N':
|
||||
debug("setting NDOTS to %s", isc_commandline_argument);
|
||||
debug("setting NDOTS to %s",
|
||||
isc_commandline_argument);
|
||||
ndots = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'D':
|
||||
@@ -845,31 +825,26 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
case 's':
|
||||
lookup->servfail_stops = true;
|
||||
break;
|
||||
case 'p':
|
||||
port = atoi(isc_commandline_argument);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lookup->retries = tries;
|
||||
|
||||
if (isc_commandline_index >= argc) {
|
||||
if (isc_commandline_index >= argc)
|
||||
show_usage();
|
||||
}
|
||||
|
||||
strlcpy(hostname, argv[isc_commandline_index], sizeof(hostname));
|
||||
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
set_nameserver(argv[isc_commandline_index + 1]);
|
||||
debug("server is %s", argv[isc_commandline_index + 1]);
|
||||
set_nameserver(argv[isc_commandline_index+1]);
|
||||
debug("server is %s", argv[isc_commandline_index+1]);
|
||||
listed_server = true;
|
||||
} else {
|
||||
} else
|
||||
check_ra = true;
|
||||
}
|
||||
|
||||
lookup->pending = false;
|
||||
if (get_reverse(store, sizeof(store), hostname, true) == ISC_R_SUCCESS)
|
||||
{
|
||||
if (get_reverse(store, sizeof(store), hostname, true)
|
||||
== ISC_R_SUCCESS) {
|
||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||
lookup->rdtype = dns_rdatatype_ptr;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -908,11 +883,10 @@ main(int argc, char **argv) {
|
||||
setup_libs();
|
||||
setup_system(ipv4only, ipv6only);
|
||||
parse_args(false, argc, argv);
|
||||
if (keyfile[0] != 0) {
|
||||
if (keyfile[0] != 0)
|
||||
setup_file_key();
|
||||
} else if (keysecret[0] != 0) {
|
||||
else if (keysecret[0] != 0)
|
||||
setup_text_key();
|
||||
}
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
|
||||
check_result(result, "isc_app_onrun");
|
||||
isc_app_run();
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
<arg choice="opt" rep="norepeat"><option>-aACdlnrsTUwv</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-N <replaceable class="parameter">ndots</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="port">port</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">number</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">wait</replaceable></option></arg>
|
||||
@@ -215,15 +214,6 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-p <replaceable class="parameter">port</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the port on the server to query. The default is 53.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-r</term>
|
||||
<listitem>
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
[<code class="option">-aACdlnrsTUwv</code>]
|
||||
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
|
||||
[<code class="option">-N <em class="replaceable"><code>ndots</code></em></code>]
|
||||
[<code class="option">-p <em class="replaceable"><code>port</code></em></code>]
|
||||
[<code class="option">-R <em class="replaceable"><code>number</code></em></code>]
|
||||
[<code class="option">-t <em class="replaceable"><code>type</code></em></code>]
|
||||
[<code class="option">-W <em class="replaceable"><code>wait</code></em></code>]
|
||||
@@ -166,12 +165,6 @@
|
||||
in <code class="filename">/etc/resolv.conf</code>.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">-p <em class="replaceable"><code>port</code></em></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Specify the port on the server to query. The default is 53.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">-r</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../.clang-format.headers
|
||||
+192
-140
@@ -17,6 +17,10 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dns/rdatalist.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/bufferlist.h>
|
||||
#include <isc/formatcheck.h>
|
||||
@@ -28,24 +32,20 @@
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/socket.h>
|
||||
|
||||
#include <dns/rdatalist.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <TargetConditionals.h>
|
||||
#endif /* ifdef __APPLE__ */
|
||||
#endif
|
||||
|
||||
#define MXSERV 20
|
||||
#define MXNAME (DNS_NAME_MAXTEXT + 1)
|
||||
#define MXRD 32
|
||||
#define MXNAME (DNS_NAME_MAXTEXT+1)
|
||||
#define MXRD 32
|
||||
/*% Buffer Size */
|
||||
#define BUFSIZE 512
|
||||
#define BUFSIZE 512
|
||||
#define COMMSIZE 0xffff
|
||||
#ifndef RESOLV_CONF
|
||||
/*% location of resolve.conf */
|
||||
#define RESOLV_CONF "/etc/resolv.conf"
|
||||
#endif /* ifndef RESOLV_CONF */
|
||||
#endif
|
||||
/*% output buffer */
|
||||
#define OUTPUTBUF 32767
|
||||
/*% Max RR Limit */
|
||||
@@ -77,111 +77,155 @@
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef struct dig_lookup dig_lookup_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_server dig_server_t;
|
||||
typedef ISC_LIST(dig_server_t) dig_serverlist_t;
|
||||
typedef struct dig_searchlist dig_searchlist_t;
|
||||
|
||||
#define DIG_QUERY_MAGIC ISC_MAGIC('D', 'i', 'g', 'q')
|
||||
#define DIG_QUERY_MAGIC ISC_MAGIC('D','i','g','q')
|
||||
|
||||
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
|
||||
|
||||
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
|
||||
|
||||
/*% The dig_lookup structure */
|
||||
struct dig_lookup {
|
||||
bool pending, /*%< Pending a successful answer */
|
||||
waiting_connect, doing_xfr, ns_search_only, /*%< dig
|
||||
* +nssearch,
|
||||
* host -C */
|
||||
bool
|
||||
pending, /*%< Pending a successful answer */
|
||||
waiting_connect,
|
||||
doing_xfr,
|
||||
ns_search_only, /*%< dig +nssearch, host -C */
|
||||
identify, /*%< Append an "on server <foo>" message */
|
||||
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
|
||||
* message, with newline and tab */
|
||||
ignore, recurse, aaonly, adflag, cdflag, raflag, tcflag, zflag,
|
||||
trace, /*% dig +trace */
|
||||
trace_root, /*% initial query for either +trace or +nssearch
|
||||
* */
|
||||
tcp_mode, tcp_mode_set, comments, stats, section_question,
|
||||
section_answer, section_authority, section_additional,
|
||||
servfail_stops, new_search, need_search, done_as_is, besteffort,
|
||||
dnssec, expire, sendcookie, seenbadcookie, badcookie,
|
||||
nsid, /*% Name Server ID (RFC 5001) */
|
||||
tcp_keepalive, header_only, ednsneg, mapped,
|
||||
print_unknown_format, multiline, nottl, noclass, onesoa,
|
||||
use_usec, nocrypto, ttlunits, idnin, idnout, expandaaaa, qr,
|
||||
accept_reply_unexpected_src; /*% print replies from
|
||||
* unexpected
|
||||
* sources. */
|
||||
char textname[MXNAME]; /*% Name we're going to be
|
||||
* looking up */
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
message, with newline and tab */
|
||||
ignore,
|
||||
recurse,
|
||||
aaonly,
|
||||
adflag,
|
||||
cdflag,
|
||||
raflag,
|
||||
tcflag,
|
||||
zflag,
|
||||
trace, /*% dig +trace */
|
||||
trace_root, /*% initial query for either +trace or +nssearch */
|
||||
tcp_mode,
|
||||
tcp_mode_set,
|
||||
comments,
|
||||
stats,
|
||||
section_question,
|
||||
section_answer,
|
||||
section_authority,
|
||||
section_additional,
|
||||
servfail_stops,
|
||||
new_search,
|
||||
need_search,
|
||||
done_as_is,
|
||||
besteffort,
|
||||
dnssec,
|
||||
expire,
|
||||
sendcookie,
|
||||
seenbadcookie,
|
||||
badcookie,
|
||||
nsid, /*% Name Server ID (RFC 5001) */
|
||||
tcp_keepalive,
|
||||
header_only,
|
||||
ednsneg,
|
||||
mapped,
|
||||
print_unknown_format,
|
||||
multiline,
|
||||
nottl,
|
||||
noclass,
|
||||
onesoa,
|
||||
use_usec,
|
||||
nocrypto,
|
||||
ttlunits,
|
||||
idnin,
|
||||
idnout,
|
||||
expandaaaa,
|
||||
qr,
|
||||
accept_reply_unexpected_src; /*% print replies from unexpected
|
||||
sources. */
|
||||
char textname[MXNAME]; /*% Name we're going to be looking up */
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
dns_rdataclass_t rdclass;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char * sendspace;
|
||||
dns_name_t * name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t * sendmsg;
|
||||
dns_name_t * oname;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char *sendspace;
|
||||
dns_name_t *name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t *sendmsg;
|
||||
dns_name_t *oname;
|
||||
ISC_LINK(dig_lookup_t) link;
|
||||
ISC_LIST(dig_query_t) q;
|
||||
ISC_LIST(dig_query_t) connecting;
|
||||
dig_query_t * current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_query_t *current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_searchlist_t *origin;
|
||||
dig_query_t * xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t * tsigctx;
|
||||
isc_buffer_t * querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t * ecs_addr;
|
||||
char * cookie;
|
||||
dns_ednsopt_t * ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
dig_query_t *xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t *tsigctx;
|
||||
isc_buffer_t *querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t *ecs_addr;
|
||||
char *cookie;
|
||||
dns_ednsopt_t *ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
};
|
||||
|
||||
/*% The dig_query structure */
|
||||
struct dig_query {
|
||||
unsigned int magic;
|
||||
unsigned int magic;
|
||||
dig_lookup_t *lookup;
|
||||
bool waiting_connect, pending_free, waiting_senddone, first_pass,
|
||||
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made,
|
||||
warn_id, timedout;
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char * servname;
|
||||
char * userarg;
|
||||
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
|
||||
char * recvspace, *tmpsendspace, lengthspace[4];
|
||||
bool waiting_connect,
|
||||
pending_free,
|
||||
waiting_senddone,
|
||||
first_pass,
|
||||
first_soa_rcvd,
|
||||
second_rr_rcvd,
|
||||
first_repeat_rcvd,
|
||||
recv_made,
|
||||
warn_id,
|
||||
timedout;
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char *servname;
|
||||
char *userarg;
|
||||
isc_buffer_t recvbuf,
|
||||
lengthbuf,
|
||||
tmpsendbuf,
|
||||
sendbuf;
|
||||
char *recvspace, *tmpsendspace,
|
||||
lengthspace[4];
|
||||
isc_socket_t *sock;
|
||||
ISC_LINK(dig_query_t) link;
|
||||
ISC_LINK(dig_query_t) clink;
|
||||
isc_sockaddr_t sockaddr;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t * timer;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t *timer;
|
||||
};
|
||||
|
||||
struct dig_server {
|
||||
@@ -202,38 +246,38 @@ typedef ISC_LIST(dig_lookup_t) dig_lookuplist_t;
|
||||
* Externals from dighost.c
|
||||
*/
|
||||
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_searchlistlist_t search_list;
|
||||
extern unsigned int extrabytes;
|
||||
extern unsigned int extrabytes;
|
||||
|
||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch,
|
||||
showsearch, yaml;
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t * mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source,
|
||||
usesearch, showsearch, yaml;
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t *mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern const dns_name_t *hmacname;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t * tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t * taskmgr;
|
||||
extern isc_task_t * global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t *tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t *taskmgr;
|
||||
extern isc_task_t *global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
|
||||
extern char *progname;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
|
||||
/*
|
||||
* Routines in dighost.c.
|
||||
@@ -249,13 +293,14 @@ get_reverse(char *reverse, size_t len, char *value, bool strict);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
digexit(void) ISC_PLATFORM_NORETURN_POST;
|
||||
digexit(void)
|
||||
ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
@@ -288,10 +333,12 @@ void
|
||||
setup_system(bool ipv4only, bool ipv6only);
|
||||
|
||||
isc_result_t
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max,
|
||||
const char *desc);
|
||||
|
||||
isc_result_t
|
||||
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
|
||||
parse_xint(uint32_t *uip, const char *value, uint32_t max,
|
||||
const char *desc);
|
||||
|
||||
isc_result_t
|
||||
parse_netprefix(isc_sockaddr_t **sap, const char *value);
|
||||
@@ -318,7 +365,8 @@ void
|
||||
set_nameserver(char *opt);
|
||||
|
||||
void
|
||||
clone_server_list(dig_serverlist_t src, dig_serverlist_t *dest);
|
||||
clone_server_list(dig_serverlist_t src,
|
||||
dig_serverlist_t *dest);
|
||||
|
||||
void
|
||||
cancel_all(void);
|
||||
@@ -333,50 +381,54 @@ set_search_domain(char *domain);
|
||||
* Routines to be defined in dig.c, host.c, and nslookup.c. and
|
||||
* then assigned to the appropriate function pointer
|
||||
*/
|
||||
extern isc_result_t (*dighost_printmessage)(dig_query_t * query,
|
||||
const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers);
|
||||
extern isc_result_t
|
||||
(*dighost_printmessage)(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers);
|
||||
|
||||
/*
|
||||
* Print an error message in the appropriate format.
|
||||
*/
|
||||
extern void (*dighost_error)(const char *format, ...);
|
||||
extern void
|
||||
(*dighost_error)(const char *format, ...);
|
||||
|
||||
/*
|
||||
* Print a warning message in the appropriate format.
|
||||
*/
|
||||
extern void (*dighost_warning)(const char *format, ...);
|
||||
extern void
|
||||
(*dighost_warning)(const char *format, ...);
|
||||
|
||||
/*
|
||||
* Print a comment in the appropriate format.
|
||||
*/
|
||||
extern void (*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
|
||||
extern void
|
||||
(*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
|
||||
|
||||
/*%<
|
||||
* Print the final result of the lookup.
|
||||
*/
|
||||
|
||||
extern void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
|
||||
dig_query_t *query);
|
||||
extern void
|
||||
(*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
|
||||
dig_query_t *query);
|
||||
/*%<
|
||||
* Print a message about where and when the response
|
||||
* was received from, like the final comment in the
|
||||
* output of "dig".
|
||||
*/
|
||||
|
||||
extern void (*dighost_trying)(char *frm, dig_lookup_t *lookup);
|
||||
extern void
|
||||
(*dighost_trying)(char *frm, dig_lookup_t *lookup);
|
||||
|
||||
extern void (*dighost_shutdown)(void);
|
||||
extern void
|
||||
(*dighost_shutdown)(void);
|
||||
|
||||
extern void (*dighost_pre_exit_hook)(void);
|
||||
extern void
|
||||
(*dighost_pre_exit_hook)(void);
|
||||
|
||||
void
|
||||
save_opt(dig_lookup_t *lookup, char *code, char *value);
|
||||
void save_opt(dig_lookup_t *lookup, char *code, char *value);
|
||||
|
||||
void
|
||||
setup_file_key(void);
|
||||
void
|
||||
setup_text_key(void);
|
||||
void setup_file_key(void);
|
||||
void setup_text_key(void);
|
||||
|
||||
/*
|
||||
* Routines exported from dig.c for use by dig for iOS
|
||||
@@ -415,4 +467,4 @@ dig_shutdown(void);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ifndef DIG_H */
|
||||
#endif
|
||||
|
||||
+1
-4
@@ -233,10 +233,7 @@ Change the default TCP/UDP name server port to
|
||||
.RS 4
|
||||
Change the type of the information query\&.
|
||||
.sp
|
||||
(Default = A and then AAAA; abbreviations = q, ty)
|
||||
.sp
|
||||
\fBNote:\fR
|
||||
It is only possible to specify one query type, only the default behavior looks up both when an alternative is not specified\&.
|
||||
(Default = A; abbreviations = q, ty)
|
||||
.RE
|
||||
.PP
|
||||
\fB\fI[no]\fR\fR\fBrecurse\fR
|
||||
|
||||
+220
-224
@@ -18,22 +18,22 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/event.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/parseint.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/netaddr.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/message.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/byaddr.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
|
||||
@@ -42,23 +42,25 @@
|
||||
#include <edit/readline/readline.h>
|
||||
#if defined(HAVE_EDIT_READLINE_HISTORY_H)
|
||||
#include <edit/readline/history.h>
|
||||
#endif /* if defined(HAVE_EDIT_READLINE_HISTORY_H) */
|
||||
#endif
|
||||
#elif defined(HAVE_EDITLINE_READLINE_H)
|
||||
#include <editline/readline.h>
|
||||
#elif defined(HAVE_READLINE_READLINE_H)
|
||||
#include <readline/readline.h>
|
||||
#if defined(HAVE_READLINE_HISTORY_H)
|
||||
#if defined (HAVE_READLINE_HISTORY_H)
|
||||
#include <readline/history.h>
|
||||
#endif /* if defined(HAVE_READLINE_HISTORY_H) */
|
||||
#endif /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
|
||||
#endif /* if defined(HAVE_READLINE) */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool short_form = true, tcpmode = false, tcpmode_set = false,
|
||||
identify = false, stats = true, comments = true,
|
||||
section_question = true, section_answer = true,
|
||||
section_authority = true, section_additional = true, recurse = true,
|
||||
aaonly = false, nofail = true, default_lookups = true,
|
||||
a_noanswer = false;
|
||||
static bool short_form = true,
|
||||
tcpmode = false, tcpmode_set = false,
|
||||
identify = false, stats = true,
|
||||
comments = true, section_question = true,
|
||||
section_answer = true, section_authority = true,
|
||||
section_additional = true, recurse = true,
|
||||
aaonly = false, nofail = true,
|
||||
default_lookups = true, a_noanswer = false;
|
||||
|
||||
static bool interactive;
|
||||
|
||||
@@ -70,80 +72,91 @@ static int query_error = 1, print_error = 0;
|
||||
|
||||
static char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
|
||||
"NXDOMAIN", "NOTIMP", "REFUSED",
|
||||
"YXDOMAIN", "YXRRSET", "NXRRSET",
|
||||
"NOTAUTH", "NOTZONE", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15", "BADVERS" };
|
||||
static const char *rcodetext[] = {
|
||||
"NOERROR",
|
||||
"FORMERR",
|
||||
"SERVFAIL",
|
||||
"NXDOMAIN",
|
||||
"NOTIMP",
|
||||
"REFUSED",
|
||||
"YXDOMAIN",
|
||||
"YXRRSET",
|
||||
"NXRRSET",
|
||||
"NOTAUTH",
|
||||
"NOTZONE",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15",
|
||||
"BADVERS"
|
||||
};
|
||||
|
||||
static const char *rtypetext[] = {
|
||||
"rtype_0 = ", /* 0 */
|
||||
"internet address = ", /* 1 */
|
||||
"nameserver = ", /* 2 */
|
||||
"md = ", /* 3 */
|
||||
"mf = ", /* 4 */
|
||||
"canonical name = ", /* 5 */
|
||||
"soa = ", /* 6 */
|
||||
"mb = ", /* 7 */
|
||||
"mg = ", /* 8 */
|
||||
"mr = ", /* 9 */
|
||||
"rtype_10 = ", /* 10 */
|
||||
"protocol = ", /* 11 */
|
||||
"name = ", /* 12 */
|
||||
"hinfo = ", /* 13 */
|
||||
"minfo = ", /* 14 */
|
||||
"mail exchanger = ", /* 15 */
|
||||
"text = ", /* 16 */
|
||||
"rp = ", /* 17 */
|
||||
"afsdb = ", /* 18 */
|
||||
"x25 address = ", /* 19 */
|
||||
"isdn address = ", /* 20 */
|
||||
"rt = ", /* 21 */
|
||||
"nsap = ", /* 22 */
|
||||
"nsap_ptr = ", /* 23 */
|
||||
"signature = ", /* 24 */
|
||||
"key = ", /* 25 */
|
||||
"px = ", /* 26 */
|
||||
"gpos = ", /* 27 */
|
||||
"has AAAA address ", /* 28 */
|
||||
"loc = ", /* 29 */
|
||||
"next = ", /* 30 */
|
||||
"rtype_31 = ", /* 31 */
|
||||
"rtype_32 = ", /* 32 */
|
||||
"service = ", /* 33 */
|
||||
"rtype_34 = ", /* 34 */
|
||||
"naptr = ", /* 35 */
|
||||
"kx = ", /* 36 */
|
||||
"cert = ", /* 37 */
|
||||
"v6 address = ", /* 38 */
|
||||
"dname = ", /* 39 */
|
||||
"rtype_40 = ", /* 40 */
|
||||
"optional = " /* 41 */
|
||||
"rtype_0 = ", /* 0 */
|
||||
"internet address = ", /* 1 */
|
||||
"nameserver = ", /* 2 */
|
||||
"md = ", /* 3 */
|
||||
"mf = ", /* 4 */
|
||||
"canonical name = ", /* 5 */
|
||||
"soa = ", /* 6 */
|
||||
"mb = ", /* 7 */
|
||||
"mg = ", /* 8 */
|
||||
"mr = ", /* 9 */
|
||||
"rtype_10 = ", /* 10 */
|
||||
"protocol = ", /* 11 */
|
||||
"name = ", /* 12 */
|
||||
"hinfo = ", /* 13 */
|
||||
"minfo = ", /* 14 */
|
||||
"mail exchanger = ", /* 15 */
|
||||
"text = ", /* 16 */
|
||||
"rp = ", /* 17 */
|
||||
"afsdb = ", /* 18 */
|
||||
"x25 address = ", /* 19 */
|
||||
"isdn address = ", /* 20 */
|
||||
"rt = ", /* 21 */
|
||||
"nsap = ", /* 22 */
|
||||
"nsap_ptr = ", /* 23 */
|
||||
"signature = ", /* 24 */
|
||||
"key = ", /* 25 */
|
||||
"px = ", /* 26 */
|
||||
"gpos = ", /* 27 */
|
||||
"has AAAA address ", /* 28 */
|
||||
"loc = ", /* 29 */
|
||||
"next = ", /* 30 */
|
||||
"rtype_31 = ", /* 31 */
|
||||
"rtype_32 = ", /* 32 */
|
||||
"service = ", /* 33 */
|
||||
"rtype_34 = ", /* 34 */
|
||||
"naptr = ", /* 35 */
|
||||
"kx = ", /* 36 */
|
||||
"cert = ", /* 37 */
|
||||
"v6 address = ", /* 38 */
|
||||
"dname = ", /* 39 */
|
||||
"rtype_40 = ", /* 40 */
|
||||
"optional = " /* 41 */
|
||||
};
|
||||
|
||||
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
|
||||
|
||||
static void
|
||||
flush_lookup_list(void);
|
||||
static void
|
||||
getinput(isc_task_t *task, isc_event_t *event);
|
||||
static void flush_lookup_list(void);
|
||||
static void getinput(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
static char *
|
||||
rcode_totext(dns_rcode_t rcode) {
|
||||
rcode_totext(dns_rcode_t rcode)
|
||||
{
|
||||
static char buf[sizeof("?65535")];
|
||||
union {
|
||||
const char *consttext;
|
||||
char *deconsttext;
|
||||
} totext;
|
||||
|
||||
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
|
||||
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
|
||||
snprintf(buf, sizeof(buf), "?%u", rcode);
|
||||
totext.deconsttext = buf;
|
||||
} else {
|
||||
} else
|
||||
totext.consttext = rcodetext[rcode];
|
||||
}
|
||||
return (totext.deconsttext);
|
||||
return totext.deconsttext;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -202,22 +215,22 @@ printrdata(dns_rdata_t *rdata) {
|
||||
unsigned int size = 1024;
|
||||
bool done = false;
|
||||
|
||||
if (rdata->type < N_KNOWN_RRTYPES) {
|
||||
if (rdata->type < N_KNOWN_RRTYPES)
|
||||
printf("%s", rtypetext[rdata->type]);
|
||||
} else {
|
||||
else
|
||||
printf("rdata_%d = ", rdata->type);
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
isc_buffer_allocate(mctx, &b, size);
|
||||
result = isc_buffer_allocate(mctx, &b, size);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
printf("%.*s\n", (int)isc_buffer_usedlength(b),
|
||||
(char *)isc_buffer_base(b));
|
||||
done = true;
|
||||
} else if (result != ISC_R_NOSPACE) {
|
||||
} else if (result != ISC_R_NOSPACE)
|
||||
check_result(result, "dns_rdata_totext");
|
||||
}
|
||||
isc_buffer_free(&b);
|
||||
size *= 2;
|
||||
}
|
||||
@@ -238,26 +251,25 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
debug("printsection()");
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
dns_message_currentname(msg, section, &name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
dns_message_currentname(msg, section,
|
||||
&name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
switch (rdata.type) {
|
||||
case dns_rdatatype_a:
|
||||
case dns_rdatatype_aaaa:
|
||||
if (section != DNS_SECTION_ANSWER) {
|
||||
if (section != DNS_SECTION_ANSWER)
|
||||
goto def_short_section;
|
||||
}
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("Name:\t%s\n", namebuf);
|
||||
@@ -282,9 +294,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
}
|
||||
result = dns_message_nextname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
@@ -293,7 +305,7 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
|
||||
static isc_result_t
|
||||
detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
dns_section_t section) {
|
||||
dns_section_t section) {
|
||||
isc_result_t result, loopresult;
|
||||
dns_name_t *name;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
@@ -322,32 +334,36 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
dns_message_currentname(msg, section, &name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
dns_message_currentname(msg, section,
|
||||
&name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
if (section == DNS_SECTION_QUESTION) {
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("\t%s, ", namebuf);
|
||||
dns_rdatatype_format(rdataset->type, namebuf,
|
||||
dns_rdatatype_format(rdataset->type,
|
||||
namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("type = %s, ", namebuf);
|
||||
dns_rdataclass_format(rdataset->rdclass,
|
||||
namebuf, sizeof(namebuf));
|
||||
namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("class = %s\n", namebuf);
|
||||
}
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
printf(" -> %s\n", namebuf);
|
||||
|
||||
switch (rdata.type) {
|
||||
@@ -364,9 +380,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
}
|
||||
result = dns_message_nextname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
if (result == ISC_R_NOMORE)
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
@@ -374,7 +390,8 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
|
||||
static void
|
||||
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query)
|
||||
{
|
||||
UNUSED(bytes);
|
||||
UNUSED(from);
|
||||
UNUSED(query);
|
||||
@@ -397,11 +414,9 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
while (i-- > 0) {
|
||||
rdataset = NULL;
|
||||
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
|
||||
dns_rdatatype_cname, 0, NULL,
|
||||
&rdataset);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_rdatatype_cname, 0, NULL, &rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
}
|
||||
result = dns_rdataset_first(rdataset);
|
||||
check_result(result, "dns_rdataset_first");
|
||||
dns_rdata_reset(&rdata);
|
||||
@@ -414,8 +429,9 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
bool headers) {
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers)
|
||||
{
|
||||
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
UNUSED(msgbuf);
|
||||
@@ -425,7 +441,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
|
||||
debug("printmessage()");
|
||||
|
||||
if (!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
|
||||
if(!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
|
||||
isc_sockaddr_format(&query->sockaddr, servtext,
|
||||
sizeof(servtext));
|
||||
printf("Server:\t\t%s\n", query->userarg);
|
||||
@@ -446,10 +462,10 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
|
||||
if (msg->rcode != 0) {
|
||||
char nametext[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name, nametext,
|
||||
sizeof(nametext));
|
||||
printf("** server can't find %s: %s\n", nametext,
|
||||
rcode_totext(msg->rcode));
|
||||
dns_name_format(query->lookup->name,
|
||||
nametext, sizeof(nametext));
|
||||
printf("** server can't find %s: %s\n",
|
||||
nametext, rcode_totext(msg->rcode));
|
||||
debug("returning with rcode == 0");
|
||||
|
||||
/* the lookup failed */
|
||||
@@ -457,7 +473,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
if ( default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
dig_lookup_t *lookup;
|
||||
dns_fixedname_t fixed;
|
||||
@@ -481,32 +497,29 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
}
|
||||
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) == 0 &&
|
||||
(!default_lookups || query->lookup->rdtype == dns_rdatatype_a))
|
||||
{
|
||||
( !default_lookups || query->lookup->rdtype == dns_rdatatype_a) )
|
||||
puts("Non-authoritative answer:");
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
|
||||
printsection(query, msg, headers, DNS_SECTION_ANSWER);
|
||||
} else {
|
||||
else {
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a)
|
||||
{
|
||||
a_noanswer = true;
|
||||
} else if (!default_lookups ||
|
||||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
||||
a_noanswer))
|
||||
{
|
||||
|
||||
else if (!default_lookups ||
|
||||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
||||
a_noanswer ) )
|
||||
printf("*** Can't find %s: No answer\n",
|
||||
query->lookup->textname);
|
||||
}
|
||||
query->lookup->textname);
|
||||
}
|
||||
|
||||
if (((msg->flags & DNS_MESSAGEFLAG_AA) == 0) &&
|
||||
(query->lookup->rdtype != dns_rdatatype_a) &&
|
||||
(query->lookup->rdtype != dns_rdatatype_aaaa))
|
||||
{
|
||||
(query->lookup->rdtype != dns_rdatatype_aaaa) ) {
|
||||
puts("\nAuthoritative answers can be found from:");
|
||||
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
|
||||
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
|
||||
printsection(query, msg, headers,
|
||||
DNS_SECTION_AUTHORITY);
|
||||
printsection(query, msg, headers,
|
||||
DNS_SECTION_ADDITIONAL);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -527,32 +540,32 @@ show_settings(bool full, bool serv_only) {
|
||||
check_result(result, "get_address");
|
||||
|
||||
isc_sockaddr_format(&sockaddr, sockstr, sizeof(sockstr));
|
||||
printf("Default server: %s\nAddress: %s\n", srv->userarg,
|
||||
sockstr);
|
||||
if (!full) {
|
||||
printf("Default server: %s\nAddress: %s\n",
|
||||
srv->userarg, sockstr);
|
||||
if (!full)
|
||||
return;
|
||||
}
|
||||
srv = ISC_LIST_NEXT(srv, link);
|
||||
}
|
||||
if (serv_only) {
|
||||
if (serv_only)
|
||||
return;
|
||||
}
|
||||
printf("\nSet options:\n");
|
||||
printf(" %s\t\t\t%s\t\t%s\n", tcpmode ? "vc" : "novc",
|
||||
short_form ? "nodebug" : "debug", debugging ? "d2" : "nod2");
|
||||
printf(" %s\t\t%s\n", usesearch ? "search" : "nosearch",
|
||||
printf(" %s\t\t\t%s\t\t%s\n",
|
||||
tcpmode ? "vc" : "novc",
|
||||
short_form ? "nodebug" : "debug",
|
||||
debugging ? "d2" : "nod2");
|
||||
printf(" %s\t\t%s\n",
|
||||
usesearch ? "search" : "nosearch",
|
||||
recurse ? "recurse" : "norecurse");
|
||||
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n", timeout,
|
||||
tries, port, ndots);
|
||||
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n",
|
||||
timeout, tries, port, ndots);
|
||||
printf(" querytype = %-8s\tclass = %s\n", deftype, defclass);
|
||||
printf(" srchlist = ");
|
||||
for (listent = ISC_LIST_HEAD(search_list); listent != NULL;
|
||||
listent = ISC_LIST_NEXT(listent, link))
|
||||
{
|
||||
printf("%s", listent->origin);
|
||||
if (ISC_LIST_NEXT(listent, link) != NULL) {
|
||||
printf("/");
|
||||
}
|
||||
for (listent = ISC_LIST_HEAD(search_list);
|
||||
listent != NULL;
|
||||
listent = ISC_LIST_NEXT(listent, link)) {
|
||||
printf("%s", listent->origin);
|
||||
if (ISC_LIST_NEXT(listent, link) != NULL)
|
||||
printf("/");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@@ -566,9 +579,9 @@ testtype(char *typetext) {
|
||||
tr.base = typetext;
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
return (true);
|
||||
} else {
|
||||
else {
|
||||
printf("unknown query type: %s\n", typetext);
|
||||
return (false);
|
||||
}
|
||||
@@ -583,9 +596,9 @@ testclass(char *typetext) {
|
||||
tr.base = typetext;
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
return (true);
|
||||
} else {
|
||||
else {
|
||||
printf("unknown query class: %s\n", typetext);
|
||||
return (false);
|
||||
}
|
||||
@@ -595,36 +608,32 @@ static void
|
||||
set_port(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, 65535, "port");
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
port = (uint16_t)n;
|
||||
}
|
||||
if (result == ISC_R_SUCCESS)
|
||||
port = (uint16_t) n;
|
||||
}
|
||||
|
||||
static void
|
||||
set_timeout(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
timeout = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_tries(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
tries = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_ndots(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, 128, "ndots");
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
ndots = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -642,13 +651,11 @@ setoption(char *opt) {
|
||||
if (CHECKOPT("all", 3)) {
|
||||
show_settings(true, false);
|
||||
} else if (strncasecmp(opt, "class=", 6) == 0) {
|
||||
if (testclass(&opt[6])) {
|
||||
if (testclass(&opt[6]))
|
||||
strlcpy(defclass, &opt[6], sizeof(defclass));
|
||||
}
|
||||
} else if (strncasecmp(opt, "cl=", 3) == 0) {
|
||||
if (testclass(&opt[3])) {
|
||||
if (testclass(&opt[3]))
|
||||
strlcpy(defclass, &opt[3], sizeof(defclass));
|
||||
}
|
||||
} else if (strncasecmp(opt, "type=", 5) == 0) {
|
||||
if (testtype(&opt[5])) {
|
||||
strlcpy(deftype, &opt[5], sizeof(deftype));
|
||||
@@ -730,9 +737,9 @@ setoption(char *opt) {
|
||||
} else if (CHECKOPT("sil", 3)) {
|
||||
/* deprecation_msg = false; */
|
||||
} else if (CHECKOPT("fail", 3)) {
|
||||
nofail = false;
|
||||
nofail=false;
|
||||
} else if (CHECKOPT("nofail", 5)) {
|
||||
nofail = true;
|
||||
nofail=true;
|
||||
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
|
||||
set_ndots(&opt[6]);
|
||||
} else {
|
||||
@@ -768,7 +775,8 @@ addlookup(char *opt) {
|
||||
rdclass = dns_rdataclass_in;
|
||||
}
|
||||
lookup = make_empty_lookup();
|
||||
if (get_reverse(store, sizeof(store), opt, true) == ISC_R_SUCCESS) {
|
||||
if (get_reverse(store, sizeof(store), opt, true)
|
||||
== ISC_R_SUCCESS) {
|
||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||
lookup->rdtype = dns_rdatatype_ptr;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -788,21 +796,18 @@ addlookup(char *opt) {
|
||||
lookup->retries = tries;
|
||||
lookup->udpsize = 0;
|
||||
lookup->comments = comments;
|
||||
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set) {
|
||||
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
|
||||
lookup->tcp_mode = true;
|
||||
} else {
|
||||
else
|
||||
lookup->tcp_mode = tcpmode;
|
||||
}
|
||||
lookup->stats = stats;
|
||||
lookup->section_question = section_question;
|
||||
lookup->section_answer = section_answer;
|
||||
lookup->section_authority = section_authority;
|
||||
lookup->section_additional = section_additional;
|
||||
lookup->new_search = true;
|
||||
lookup->besteffort = false;
|
||||
if (nofail) {
|
||||
if (nofail)
|
||||
lookup->servfail_stops = false;
|
||||
}
|
||||
ISC_LIST_INIT(lookup->q);
|
||||
ISC_LINK_INIT(lookup, link);
|
||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||
@@ -819,11 +824,11 @@ do_next_command(char *input) {
|
||||
return;
|
||||
}
|
||||
arg = strtok_r(NULL, " \t\r\n", &last);
|
||||
if ((strcasecmp(ptr, "set") == 0) && (arg != NULL)) {
|
||||
if ((strcasecmp(ptr, "set") == 0) &&
|
||||
(arg != NULL))
|
||||
setoption(arg);
|
||||
} else if ((strcasecmp(ptr, "server") == 0) ||
|
||||
(strcasecmp(ptr, "lserver") == 0))
|
||||
{
|
||||
else if ((strcasecmp(ptr, "server") == 0) ||
|
||||
(strcasecmp(ptr, "lserver") == 0)) {
|
||||
isc_app_block();
|
||||
set_nameserver(arg);
|
||||
check_ra = false;
|
||||
@@ -831,16 +836,16 @@ do_next_command(char *input) {
|
||||
show_settings(true, true);
|
||||
} else if (strcasecmp(ptr, "exit") == 0) {
|
||||
in_use = false;
|
||||
} else if (strcasecmp(ptr, "help") == 0 || strcasecmp(ptr, "?") == 0) {
|
||||
} else if (strcasecmp(ptr, "help") == 0 ||
|
||||
strcasecmp(ptr, "?") == 0) {
|
||||
printf("The '%s' command is not yet implemented.\n", ptr);
|
||||
} else if (strcasecmp(ptr, "finger") == 0 ||
|
||||
strcasecmp(ptr, "root") == 0 || strcasecmp(ptr, "ls") == 0 ||
|
||||
strcasecmp(ptr, "view") == 0)
|
||||
{
|
||||
strcasecmp(ptr, "root") == 0 ||
|
||||
strcasecmp(ptr, "ls") == 0 ||
|
||||
strcasecmp(ptr, "view") == 0) {
|
||||
printf("The '%s' command is not implemented.\n", ptr);
|
||||
} else {
|
||||
} else
|
||||
addlookup(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -854,28 +859,24 @@ get_next_command(void) {
|
||||
if (interactive) {
|
||||
#ifdef HAVE_READLINE
|
||||
ptr = readline("> ");
|
||||
if (ptr != NULL) {
|
||||
if (ptr != NULL)
|
||||
add_history(ptr);
|
||||
}
|
||||
#else /* ifdef HAVE_READLINE */
|
||||
#else
|
||||
fputs("> ", stderr);
|
||||
fflush(stderr);
|
||||
ptr = fgets(buf, COMMSIZE, stdin);
|
||||
#endif /* ifdef HAVE_READLINE */
|
||||
} else {
|
||||
#endif
|
||||
} else
|
||||
ptr = fgets(buf, COMMSIZE, stdin);
|
||||
}
|
||||
isc_app_unblock();
|
||||
if (ptr == NULL) {
|
||||
in_use = false;
|
||||
} else {
|
||||
} else
|
||||
do_next_command(ptr);
|
||||
}
|
||||
#ifdef HAVE_READLINE
|
||||
if (interactive) {
|
||||
if (interactive)
|
||||
free(ptr);
|
||||
}
|
||||
#endif /* ifdef HAVE_READLINE */
|
||||
#endif
|
||||
isc_mem_free(mctx, buf);
|
||||
}
|
||||
|
||||
@@ -884,16 +885,16 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] # interactive mode "
|
||||
"using default server\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] - server # interactive mode "
|
||||
"using 'server'\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] host # just look up "
|
||||
"'host' using default server\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
|
||||
"'host' using 'server'\n");
|
||||
exit(1);
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] # interactive mode using default server\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] - server # interactive mode using 'server'\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] host # just look up 'host' using default server\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] host server # just look up 'host' using 'server'\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -909,9 +910,8 @@ parse_args(int argc, char **argv) {
|
||||
exit(0);
|
||||
} else if (argv[0][1] != 0) {
|
||||
setoption(&argv[0][1]);
|
||||
} else {
|
||||
} else
|
||||
have_lookup = true;
|
||||
}
|
||||
} else {
|
||||
if (!have_lookup) {
|
||||
have_lookup = true;
|
||||
@@ -957,10 +957,10 @@ flush_lookup_list(void) {
|
||||
s = ISC_LIST_NEXT(s, link);
|
||||
ISC_LIST_DEQUEUE(l->my_server_list, sp, link);
|
||||
isc_mem_free(mctx, sp);
|
||||
|
||||
}
|
||||
if (l->sendmsg != NULL) {
|
||||
if (l->sendmsg != NULL)
|
||||
dns_message_destroy(&l->sendmsg);
|
||||
}
|
||||
lp = l;
|
||||
l = ISC_LIST_NEXT(l, link);
|
||||
ISC_LIST_DEQUEUE(lookup_list, lp, link);
|
||||
@@ -971,9 +971,8 @@ flush_lookup_list(void) {
|
||||
static void
|
||||
getinput(isc_task_t *task, isc_event_t *event) {
|
||||
UNUSED(task);
|
||||
if (global_event == NULL) {
|
||||
if (global_event == NULL)
|
||||
global_event = event;
|
||||
}
|
||||
while (in_use) {
|
||||
get_next_command();
|
||||
if (ISC_LIST_HEAD(lookup_list) != NULL) {
|
||||
@@ -1010,19 +1009,17 @@ main(int argc, char **argv) {
|
||||
|
||||
setup_system(false, false);
|
||||
parse_args(argc, argv);
|
||||
if (keyfile[0] != 0) {
|
||||
if (keyfile[0] != 0)
|
||||
setup_file_key();
|
||||
} else if (keysecret[0] != 0) {
|
||||
else if (keysecret[0] != 0)
|
||||
setup_text_key();
|
||||
}
|
||||
if (domainopt[0] != '\0') {
|
||||
if (domainopt[0] != '\0')
|
||||
set_search_domain(domainopt);
|
||||
}
|
||||
if (in_use) {
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
|
||||
} else {
|
||||
if (in_use)
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback,
|
||||
NULL);
|
||||
else
|
||||
result = isc_app_onrun(mctx, global_task, getinput, NULL);
|
||||
}
|
||||
check_result(result, "isc_app_onrun");
|
||||
in_use = !in_use;
|
||||
|
||||
@@ -1030,9 +1027,8 @@ main(int argc, char **argv) {
|
||||
|
||||
puts("");
|
||||
debug("done, and starting to shut down");
|
||||
if (global_event != NULL) {
|
||||
if (global_event != NULL)
|
||||
isc_event_free(&global_event);
|
||||
}
|
||||
cancel_all();
|
||||
destroy_libs();
|
||||
isc_app_finish();
|
||||
|
||||
+21
-27
@@ -229,17 +229,17 @@ nslookup -query=hinfo -timeout=10
|
||||
The class specifies the protocol group of the information.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = IN; abbreviation = cl)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>debug</code></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = nodebug; abbreviation = [<span class="optional">no</span>]deb)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -247,9 +247,9 @@ nslookup -query=hinfo -timeout=10
|
||||
<dd>
|
||||
<p>
|
||||
Turn debugging mode on or off. This displays more about
|
||||
what nslookup is doing.
|
||||
what nslookup is doing.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = nod2)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -267,7 +267,7 @@ nslookup -query=hinfo -timeout=10
|
||||
names in the domain search list to the request until an
|
||||
answer is received.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = search)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -276,7 +276,7 @@ nslookup -query=hinfo -timeout=10
|
||||
<p>
|
||||
Change the default TCP/UDP name server port to <em class="replaceable"><code>value</code></em>.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = 53; abbreviation = po)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -289,15 +289,9 @@ nslookup -query=hinfo -timeout=10
|
||||
<p>
|
||||
Change the type of the information query.
|
||||
</p>
|
||||
<p>
|
||||
(Default = A and then AAAA; abbreviations = q, ty)
|
||||
<p>
|
||||
(Default = A; abbreviations = q, ty)
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Note:</strong></span> It is
|
||||
only possible to specify one query type, only
|
||||
the default behavior looks up both when an
|
||||
alternative is not specified.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>recurse</code></span></dt>
|
||||
<dd>
|
||||
@@ -306,16 +300,16 @@ nslookup -query=hinfo -timeout=10
|
||||
have the
|
||||
information.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = recurse; abbreviation = [no]rec)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant">ndots=</code><em class="replaceable"><code>number</code></em></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant">retry=</code><em class="replaceable"><code>number</code></em></span></dt>
|
||||
@@ -337,21 +331,21 @@ nslookup -query=hinfo -timeout=10
|
||||
Always use a virtual circuit when sending requests to the
|
||||
server.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = novc)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>fail</code></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</p>
|
||||
<p>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</p>
|
||||
<p>
|
||||
(Default = nofail)
|
||||
</p>
|
||||
</dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
@@ -23,7 +23,8 @@ CWARNINGS =
|
||||
|
||||
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
|
||||
|
||||
DNSDEPLIBS = ../../lib/dns/libdns.@A@
|
||||
ISCDEPLIBS = ../../lib/isc/libisc.@A@
|
||||
@@ -33,6 +34,8 @@ DEPLIBS = ${DNSDEPLIBS} ${ISCCFGDEPLIBS} ${ISCDEPLIBS}
|
||||
|
||||
LIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@
|
||||
|
||||
NOSYMLIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
|
||||
|
||||
# Alphabetically
|
||||
TARGETS = dnssec-cds@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \
|
||||
dnssec-importkey@EXEEXT@ dnssec-keyfromlabel@EXEEXT@ \
|
||||
|
||||
@@ -60,7 +60,7 @@ file generated by
|
||||
.PP
|
||||
The
|
||||
\fBdnssec\-cds\fR
|
||||
command uses special DNSSEC validation logic specified by RFC 7344\&. It requires that the CDS and/or CDNSKEY records are validly signed by a key represented in the existing DS records\&. This will typically be the pre\-existing key\-signing key (KSK)\&.
|
||||
command uses special DNSSEC validation logic specified by RFC 7344\&. It requires that the CDS and/or CDNSKEY records are validly signed by a key represented in the existing DS records\&. This will typicially be the pre\-existing key\-signing key (KSK)\&.
|
||||
.PP
|
||||
For protection against replay attacks, the signatures on the child records must not be older than they were on a previous run of
|
||||
\fBdnssec\-cds\fR\&. This time is obtained from the modification time of the
|
||||
|
||||
+137
-121
@@ -55,7 +55,7 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -75,9 +75,9 @@ static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static dns_rdataclass_t rdclass = dns_rdataclass_in;
|
||||
|
||||
static const char *startstr = NULL; /* from which we derive notbefore */
|
||||
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
||||
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
|
||||
static const char *startstr = NULL; /* from which we derive notbefore */
|
||||
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
||||
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
|
||||
|
||||
static int nkey; /* number of child zone DNSKEY records */
|
||||
|
||||
@@ -131,7 +131,7 @@ static dns_rdataset_t old_ds_set, new_ds_set;
|
||||
|
||||
static keyinfo_t *old_key_tbl, *new_key_tbl;
|
||||
|
||||
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
|
||||
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
|
||||
|
||||
static void
|
||||
verbose_time(int level, const char *msg, isc_stdtime_t time) {
|
||||
@@ -150,7 +150,8 @@ verbose_time(int level, const char *msg, isc_stdtime_t time) {
|
||||
if (verbose < 3) {
|
||||
vbprintf(level, "%s %s\n", msg, timestr);
|
||||
} else {
|
||||
vbprintf(level, "%s %s (%" PRIu32 ")\n", msg, timestr, time);
|
||||
vbprintf(level, "%s %s (%" PRIu32 ")\n",
|
||||
msg, timestr, time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,15 +173,16 @@ initname(char *setname) {
|
||||
|
||||
static void
|
||||
findset(dns_db_t *db, dns_dbnode_t *node, dns_rdatatype_t type,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
dns_rdataset_init(rdataset);
|
||||
if (sigrdataset != NULL) {
|
||||
dns_rdataset_init(sigrdataset);
|
||||
}
|
||||
result = dns_db_findrdataset(db, node, NULL, type, 0, 0, rdataset,
|
||||
sigrdataset);
|
||||
result = dns_db_findrdataset(db, node, NULL, type, 0, 0,
|
||||
rdataset, sigrdataset);
|
||||
if (result != ISC_R_NOTFOUND) {
|
||||
check_result(result, "dns_db_findrdataset()");
|
||||
}
|
||||
@@ -204,7 +206,8 @@ freelist(dns_rdataset_t *rdataset) {
|
||||
|
||||
dns_rdatalist_fromrdataset(rdataset, &rdlist);
|
||||
|
||||
for (rdata = ISC_LIST_HEAD(rdlist->rdata); rdata != NULL;
|
||||
for (rdata = ISC_LIST_HEAD(rdlist->rdata);
|
||||
rdata != NULL;
|
||||
rdata = ISC_LIST_HEAD(rdlist->rdata))
|
||||
{
|
||||
ISC_LIST_UNLINK(rdlist->rdata, rdata, link);
|
||||
@@ -233,14 +236,15 @@ static void
|
||||
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
|
||||
isc_result_t result;
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, dbp);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, dbp);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_load(*dbp, filename, dns_masterformat_text,
|
||||
DNS_MASTER_HINT);
|
||||
result = dns_db_load(*dbp, filename,
|
||||
dns_masterformat_text, DNS_MASTER_HINT);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
fatal("can't load %s: %s", filename, isc_result_totext(result));
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_findnode(*dbp, name, false, nodep);
|
||||
@@ -268,8 +272,9 @@ load_child_sets(const char *file) {
|
||||
}
|
||||
|
||||
static void
|
||||
get_dsset_name(char *filename, size_t size, const char *path,
|
||||
const char *suffix) {
|
||||
get_dsset_name(char *filename, size_t size,
|
||||
const char *path, const char *suffix)
|
||||
{
|
||||
isc_result_t result;
|
||||
isc_buffer_t buf;
|
||||
size_t len;
|
||||
@@ -313,7 +318,7 @@ get_dsset_name(char *filename, size_t size, const char *path,
|
||||
static void
|
||||
load_parent_set(const char *path) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_time_t modtime;
|
||||
char filename[PATH_MAX + 1];
|
||||
@@ -322,8 +327,8 @@ load_parent_set(const char *path) {
|
||||
|
||||
result = isc_file_getmodtime(filename, &modtime);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not get modification time of %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
fatal("could not get modification time of %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
}
|
||||
notbefore = isc_time_seconds(&modtime);
|
||||
if (startstr != NULL) {
|
||||
@@ -337,8 +342,8 @@ load_parent_set(const char *path) {
|
||||
findset(db, node, dns_rdatatype_ds, &old_ds_set, NULL);
|
||||
|
||||
if (!dns_rdataset_isassociated(&old_ds_set)) {
|
||||
fatal("could not find DS records for %s in %s", namestr,
|
||||
filename);
|
||||
fatal("could not find DS records for %s in %s",
|
||||
namestr, filename);
|
||||
}
|
||||
|
||||
free_db(&db, &node);
|
||||
@@ -360,11 +365,13 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
* which just separates fields with spaces. The huge tab stop width
|
||||
* eliminates any tab characters.
|
||||
*/
|
||||
result = dns_master_stylecreate(&style, styleflags, 0, 0, 0, 0, 0,
|
||||
1000000, 0, mctx);
|
||||
result = dns_master_stylecreate(&style, styleflags,
|
||||
0, 0, 0, 0, 0, 1000000, 0,
|
||||
mctx);
|
||||
check_result(result, "dns_master_stylecreate2 failed");
|
||||
|
||||
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
check_result(result, "printing DS records");
|
||||
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
|
||||
|
||||
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
|
||||
@@ -381,8 +388,9 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
static void
|
||||
write_parent_set(const char *path, const char *inplace, bool nsupdate,
|
||||
dns_rdataset_t *rdataset) {
|
||||
write_parent_set(const char *path, const char *inplace,
|
||||
bool nsupdate, dns_rdataset_t *rdataset)
|
||||
{
|
||||
isc_result_t result;
|
||||
isc_buffer_t *buf = NULL;
|
||||
isc_region_t r;
|
||||
@@ -433,8 +441,8 @@ write_parent_set(const char *path, const char *inplace, bool nsupdate,
|
||||
result = isc_file_settime(tmpname, &filetime);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_file_remove(tmpname);
|
||||
fatal("can't set modification time of %s: %s", tmpname,
|
||||
isc_result_totext(result));
|
||||
fatal("can't set modification time of %s: %s",
|
||||
tmpname, isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (inplace[0] != '\0') {
|
||||
@@ -449,11 +457,13 @@ typedef enum { LOOSE, TIGHT } strictness_t;
|
||||
* Find out if any (C)DS record matches a particular (C)DNSKEY.
|
||||
*/
|
||||
static bool
|
||||
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||
{
|
||||
isc_result_t result;
|
||||
unsigned char dsbuf[DNS_DS_BUFFERSIZE];
|
||||
|
||||
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset))
|
||||
{
|
||||
dns_rdata_ds_t ds;
|
||||
@@ -472,8 +482,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
result = dns_ds_buildrdata(name, &ki->rdata, ds.digest_type,
|
||||
dsbuf, &newdsrdata);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
vbprintf(3,
|
||||
"dns_ds_buildrdata("
|
||||
vbprintf(3, "dns_ds_buildrdata("
|
||||
"keytag=%d, algo=%d, digest=%d): %s\n",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type,
|
||||
dns_result_totext(result));
|
||||
@@ -484,22 +493,23 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
dsrdata.type = dns_rdatatype_ds;
|
||||
if (dns_rdata_compare(&dsrdata, &newdsrdata) == 0) {
|
||||
vbprintf(1, "found matching %s %d %d %d\n",
|
||||
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
|
||||
ds.digest_type);
|
||||
c ? "CDS" : "DS",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||
return (true);
|
||||
} else if (strictness == TIGHT) {
|
||||
vbprintf(0,
|
||||
"key does not match %s %d %d %d "
|
||||
"when it looks like it should\n",
|
||||
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
|
||||
ds.digest_type);
|
||||
vbprintf(0, "key does not match %s %d %d %d "
|
||||
"when it looks like it should\n",
|
||||
c ? "CDS" : "DS",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
vbprintf(1, "no matching %s for %s %d %d\n",
|
||||
dsset->type == dns_rdatatype_cds ? "CDS" : "DS",
|
||||
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
|
||||
dsset->type == dns_rdatatype_cds
|
||||
? "CDS" : "DS",
|
||||
ki->rdata.type == dns_rdatatype_cdnskey
|
||||
? "CDNSKEY" : "DNSKEY",
|
||||
ki->tag, ki->algo);
|
||||
|
||||
return (false);
|
||||
@@ -511,7 +521,8 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
*/
|
||||
static keyinfo_t *
|
||||
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
strictness_t strictness) {
|
||||
strictness_t strictness)
|
||||
{
|
||||
isc_result_t result;
|
||||
keyinfo_t *keytable;
|
||||
int i;
|
||||
@@ -521,7 +532,8 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
|
||||
|
||||
for (result = dns_rdataset_first(keyset), i = 0;
|
||||
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(keyset), i++)
|
||||
{
|
||||
keyinfo_t *ki;
|
||||
dns_rdata_dnskey_t dnskey;
|
||||
@@ -547,13 +559,13 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
continue;
|
||||
}
|
||||
|
||||
result = dns_dnssec_keyfromrdata(name, keyrdata, mctx,
|
||||
&ki->dst);
|
||||
result = dns_dnssec_keyfromrdata(name, keyrdata,
|
||||
mctx, &ki->dst);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
vbprintf(3,
|
||||
"dns_dnssec_keyfromrdata("
|
||||
vbprintf(3, "dns_dnssec_keyfromrdata("
|
||||
"keytag=%d, algo=%d): %s\n",
|
||||
ki->tag, ki->algo, dns_result_totext(result));
|
||||
ki->tag, ki->algo,
|
||||
dns_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +575,6 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
static void
|
||||
free_keytable(keyinfo_t **keytable_p) {
|
||||
keyinfo_t *keytable = *keytable_p;
|
||||
*keytable_p = NULL;
|
||||
keyinfo_t *ki;
|
||||
int i;
|
||||
|
||||
@@ -575,6 +586,7 @@ free_keytable(keyinfo_t **keytable_p) {
|
||||
}
|
||||
|
||||
isc_mem_put(mctx, keytable, sizeof(keyinfo_t) * nkey);
|
||||
*keytable_p = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -588,7 +600,8 @@ free_keytable(keyinfo_t **keytable_p) {
|
||||
*/
|
||||
static dns_secalg_t *
|
||||
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
dns_rdataset_t *sigset) {
|
||||
dns_rdataset_t *sigset)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_secalg_t *algo;
|
||||
int i;
|
||||
@@ -596,7 +609,8 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
algo = isc_mem_get(mctx, nkey);
|
||||
memset(algo, 0, nkey);
|
||||
|
||||
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(sigset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(sigset))
|
||||
{
|
||||
dns_rdata_t sigrdata = DNS_RDATA_INIT;
|
||||
@@ -617,27 +631,26 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
|
||||
for (i = 0; i < nkey; i++) {
|
||||
keyinfo_t *ki = &keytbl[i];
|
||||
if (sig.keyid != ki->tag || sig.algorithm != ki->algo ||
|
||||
if (sig.keyid != ki->tag ||
|
||||
sig.algorithm != ki->algo ||
|
||||
!dns_name_equal(&sig.signer, name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (ki->dst == NULL) {
|
||||
vbprintf(1,
|
||||
"skip RRSIG by key %d:"
|
||||
vbprintf(1, "skip RRSIG by key %d:"
|
||||
" no matching (C)DS\n",
|
||||
sig.keyid);
|
||||
continue;
|
||||
}
|
||||
|
||||
result = dns_dnssec_verify(name, rdataset, ki->dst,
|
||||
false, 0, mctx, &sigrdata,
|
||||
NULL);
|
||||
false, 0, mctx,
|
||||
&sigrdata, NULL);
|
||||
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
result != DNS_R_FROMWILDCARD) {
|
||||
vbprintf(1,
|
||||
"skip RRSIG by key %d:"
|
||||
vbprintf(1, "skip RRSIG by key %d:"
|
||||
" verification failed: %s\n",
|
||||
sig.keyid, isc_result_totext(result));
|
||||
continue;
|
||||
@@ -651,7 +664,8 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
* only after the signature has been verified
|
||||
*/
|
||||
if (oldestsig.timesigned == 0 ||
|
||||
isc_serial_lt(sig.timesigned, oldestsig.timesigned))
|
||||
isc_serial_lt(sig.timesigned,
|
||||
oldestsig.timesigned))
|
||||
{
|
||||
verbose_time(2, "this is the oldest so far",
|
||||
sig.timesigned);
|
||||
@@ -691,7 +705,8 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
|
||||
isc_result_t result;
|
||||
bool all_ok = true;
|
||||
|
||||
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset))
|
||||
{
|
||||
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
||||
@@ -710,10 +725,8 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
|
||||
}
|
||||
}
|
||||
if (!ds_ok) {
|
||||
vbprintf(0,
|
||||
"missing signature for algorithm %d "
|
||||
"(key %d)\n",
|
||||
ds.algorithm, ds.key_tag);
|
||||
vbprintf(0, "missing signature for algorithm %d "
|
||||
"(key %d)\n", ds.algorithm, ds.key_tag);
|
||||
all_ok = false;
|
||||
}
|
||||
}
|
||||
@@ -754,29 +767,26 @@ ds_from_cds(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *cds) {
|
||||
dns_rdata_ds_t ds;
|
||||
dns_rdata_t *rdata;
|
||||
|
||||
REQUIRE(buf != NULL);
|
||||
|
||||
rdata = rdata_get();
|
||||
|
||||
result = dns_rdata_tostruct(cds, &ds, NULL);
|
||||
check_result(result, "dns_rdata_tostruct(CDS)");
|
||||
ds.common.rdtype = dns_rdatatype_ds;
|
||||
|
||||
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds, &ds,
|
||||
buf);
|
||||
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds,
|
||||
&ds, buf);
|
||||
|
||||
return (rdata_put(result, dslist, rdata));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
||||
dns_rdata_t *cdnskey) {
|
||||
dns_rdata_t *cdnskey)
|
||||
{
|
||||
isc_result_t result;
|
||||
unsigned i, n;
|
||||
|
||||
REQUIRE(buf != NULL);
|
||||
|
||||
n = sizeof(dtype) / sizeof(dtype[0]);
|
||||
n = sizeof(dtype)/sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] != 0) {
|
||||
dns_rdata_t *rdata;
|
||||
@@ -805,8 +815,9 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
||||
}
|
||||
|
||||
static void
|
||||
make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
|
||||
dns_rdataset_t *rdset) {
|
||||
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
||||
uint32_t ttl, dns_rdataset_t *rdset)
|
||||
{
|
||||
unsigned int size = 16;
|
||||
for (;;) {
|
||||
isc_result_t result;
|
||||
@@ -823,10 +834,12 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
|
||||
result = dns_rdatalist_tordataset(dslist, &new_ds_set);
|
||||
check_result(result, "dns_rdatalist_tordataset(dslist)");
|
||||
|
||||
isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
result = isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
check_result(result, "building new DS records");
|
||||
|
||||
for (result = dns_rdataset_first(rdset);
|
||||
result == ISC_R_SUCCESS; result = dns_rdataset_next(rdset))
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdset))
|
||||
{
|
||||
isc_result_t tresult;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
@@ -880,7 +893,8 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
|
||||
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
||||
|
||||
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset), i = 0;
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset), i++)
|
||||
{
|
||||
dns_rdata_init(&arrdata[i]);
|
||||
@@ -917,10 +931,10 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
while (i < n) {
|
||||
key_tag = ds[i].key_tag;
|
||||
algorithm = ds[i].algorithm;
|
||||
for (j = 0; j < d && i + j < n; j++) {
|
||||
if (ds[i + j].key_tag != key_tag ||
|
||||
ds[i + j].algorithm != algorithm ||
|
||||
ds[i + j].digest_type != ds[j].digest_type)
|
||||
for (j = 0; j < d && i+j < n; j++) {
|
||||
if (ds[i+j].key_tag != key_tag ||
|
||||
ds[i+j].algorithm != algorithm ||
|
||||
ds[i+j].digest_type != ds[j].digest_type)
|
||||
{
|
||||
match = false;
|
||||
}
|
||||
@@ -957,8 +971,9 @@ print_diff(const char *cmd, dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
static void
|
||||
update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
|
||||
dns_rdataset_t *delset) {
|
||||
update_diff(const char *cmd, uint32_t ttl,
|
||||
dns_rdataset_t *addset, dns_rdataset_t *delset)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_db_t *db;
|
||||
dns_dbnode_t *node;
|
||||
@@ -967,8 +982,8 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
|
||||
uint32_t save;
|
||||
|
||||
db = NULL;
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
ver = NULL;
|
||||
@@ -981,11 +996,12 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
|
||||
|
||||
dns_rdataset_init(&diffset);
|
||||
|
||||
result = dns_db_addrdataset(db, node, ver, 0, addset, DNS_DBADD_MERGE,
|
||||
NULL);
|
||||
result = dns_db_addrdataset(db, node, ver, 0, addset,
|
||||
DNS_DBADD_MERGE, NULL);
|
||||
check_result(result, "dns_db_addrdataset()");
|
||||
|
||||
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
|
||||
result = dns_db_subtractrdataset(db, node, ver, delset,
|
||||
0, &diffset);
|
||||
if (result == DNS_R_UNCHANGED) {
|
||||
save = addset->ttl;
|
||||
addset->ttl = ttl;
|
||||
@@ -1031,22 +1047,18 @@ usage(void) {
|
||||
program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n"
|
||||
" -a <algorithm> digest algorithm (SHA-1 / "
|
||||
"SHA-256 / SHA-384)\n"
|
||||
" -c <class> of domain (default IN)\n"
|
||||
" -D prefer CDNSKEY records instead "
|
||||
"of CDS\n"
|
||||
" -d <file|dir> where to find parent dsset- "
|
||||
"file\n"
|
||||
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG "
|
||||
"records\n"
|
||||
" -i[extension] update dsset- file in place\n"
|
||||
" -s <start-time> oldest permitted child "
|
||||
"signatures\n"
|
||||
" -u emit nsupdate script\n"
|
||||
" -T <ttl> TTL of DS records\n"
|
||||
" -V print version\n"
|
||||
" -v <verbosity>\n");
|
||||
" -a <algorithm> digest algorithm (SHA-1 / SHA-256 / SHA-384)\n"
|
||||
" -c <class> of domain (default IN)\n"
|
||||
" -D prefer CDNSKEY records instead of CDS\n"
|
||||
" -d <file|dir> where to find parent dsset- file\n"
|
||||
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG records\n"
|
||||
" -i[extension] update dsset- file in place\n"
|
||||
" -s <start-time> oldest permitted child signatures\n"
|
||||
" -u emit nsupdate script\n"
|
||||
" -T <ttl> TTL of DS records\n"
|
||||
" -V print version\n"
|
||||
" -v <verbosity>\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1066,7 +1078,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -1095,7 +1107,8 @@ main(int argc, char *argv[]) {
|
||||
* so that it works just like sed(1).
|
||||
*/
|
||||
if (isc_commandline_argument ==
|
||||
argv[isc_commandline_index - 1]) {
|
||||
argv[isc_commandline_index - 1])
|
||||
{
|
||||
isc_commandline_index--;
|
||||
inplace = "";
|
||||
} else {
|
||||
@@ -1104,7 +1117,7 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
case 'm':
|
||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||
ISC_MEM_DEBUGRECORD;
|
||||
ISC_MEM_DEBUGRECORD;
|
||||
break;
|
||||
case 's':
|
||||
startstr = isc_commandline_argument;
|
||||
@@ -1187,7 +1200,8 @@ main(int argc, char *argv[]) {
|
||||
fatal("missing RRSIG CDNSKEY records for %s", namestr);
|
||||
}
|
||||
if (dns_rdataset_isassociated(&cds_set) &&
|
||||
!dns_rdataset_isassociated(&cds_sig)) {
|
||||
!dns_rdataset_isassociated(&cds_sig))
|
||||
{
|
||||
fatal("missing RRSIG CDS records for %s", namestr);
|
||||
}
|
||||
|
||||
@@ -1208,16 +1222,18 @@ main(int argc, char *argv[]) {
|
||||
|
||||
if (dns_rdataset_isassociated(&cdnskey_set)) {
|
||||
vbprintf(1, "verify CDNSKEY signature(s)\n");
|
||||
if (!signed_loose(matching_sigs(old_key_tbl, &cdnskey_set,
|
||||
&cdnskey_sig))) {
|
||||
if (!signed_loose(matching_sigs(old_key_tbl,
|
||||
&cdnskey_set, &cdnskey_sig)))
|
||||
{
|
||||
fatal("could not validate child CDNSKEY RRset for %s",
|
||||
namestr);
|
||||
}
|
||||
}
|
||||
if (dns_rdataset_isassociated(&cds_set)) {
|
||||
vbprintf(1, "verify CDS signature(s)\n");
|
||||
if (!signed_loose(
|
||||
matching_sigs(old_key_tbl, &cds_set, &cds_sig))) {
|
||||
if (!signed_loose(matching_sigs(old_key_tbl,
|
||||
&cds_set, &cds_sig)))
|
||||
{
|
||||
fatal("could not validate child CDS RRset for %s",
|
||||
namestr);
|
||||
}
|
||||
@@ -1234,11 +1250,12 @@ main(int argc, char *argv[]) {
|
||||
dns_rdatatype_format(oldestsig.covered, type, sizeof(type));
|
||||
verbose_time(1, "child signature inception time",
|
||||
oldestsig.timesigned);
|
||||
vbprintf(2, "from RRSIG %s by key %d\n", type, oldestsig.keyid);
|
||||
vbprintf(2, "from RRSIG %s by key %d\n",
|
||||
type, oldestsig.keyid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Successfully do nothing if there's neither CDNSKEY nor CDS
|
||||
* Sucessfully do nothing if there's neither CDNSKEY nor CDS
|
||||
* RFC 7344 section 4.1 first paragraph
|
||||
*/
|
||||
if (!dns_rdataset_isassociated(&cdnskey_set) &&
|
||||
@@ -1271,17 +1288,16 @@ main(int argc, char *argv[]) {
|
||||
|
||||
if (!consistent_digests(&new_ds_set)) {
|
||||
fatal("CDS records at %s do not cover each key "
|
||||
"with the same set of digest types",
|
||||
namestr);
|
||||
"with the same set of digest types", namestr);
|
||||
}
|
||||
|
||||
vbprintf(1, "verify DNSKEY signature(s)\n");
|
||||
if (!signed_strict(&new_ds_set, matching_sigs(new_key_tbl, &dnskey_set,
|
||||
&dnskey_sig)))
|
||||
if (!signed_strict(&new_ds_set,
|
||||
matching_sigs(new_key_tbl,
|
||||
&dnskey_set, &dnskey_sig)))
|
||||
{
|
||||
fatal("could not validate child DNSKEY RRset "
|
||||
"with new DS records for %s",
|
||||
namestr);
|
||||
"with new DS records for %s", namestr);
|
||||
}
|
||||
|
||||
free_keytable(&new_key_tbl);
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
The <command>dnssec-cds</command> command uses special DNSSEC
|
||||
validation logic specified by RFC 7344. It requires that the CDS
|
||||
and/or CDNSKEY records are validly signed by a key represented in the
|
||||
existing DS records. This will typically be the pre-existing
|
||||
existing DS records. This will typicially be the pre-existing
|
||||
key-signing key (KSK).
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
The <span class="command"><strong>dnssec-cds</strong></span> command uses special DNSSEC
|
||||
validation logic specified by RFC 7344. It requires that the CDS
|
||||
and/or CDNSKEY records are validly signed by a key represented in the
|
||||
existing DS records. This will typically be the pre-existing
|
||||
existing DS records. This will typicially be the pre-existing
|
||||
key-signing key (KSK).
|
||||
</p>
|
||||
<p>
|
||||
|
||||
+96
-126
@@ -43,18 +43,18 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-dsfromkey";
|
||||
|
||||
static dns_rdataclass_t rdclass;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static uint32_t ttl;
|
||||
static bool emitttl = false;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static uint32_t ttl;
|
||||
static bool emitttl = false;
|
||||
|
||||
static isc_result_t
|
||||
initname(char *setname) {
|
||||
@@ -76,101 +76,88 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
|
||||
|
||||
dns_rdatacallbacks_init(&callbacks);
|
||||
result = dns_db_beginload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
|
||||
mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0,
|
||||
&callbacks, mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't load from input: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_endload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_endload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
char setname[DNS_NAME_FORMATSIZE];
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't create database");
|
||||
}
|
||||
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
db_load_from_stream(db, stdin);
|
||||
filename = "input";
|
||||
} else {
|
||||
result = dns_db_load(db, filename, dns_masterformat_text, 0);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_db_findnode(db, name, false, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't find %s node in %s", setname, filename);
|
||||
}
|
||||
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
|
||||
rdataset, NULL);
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
|
||||
0, 0, rdataset, NULL);
|
||||
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
fatal("no DNSKEY RR for %s in %s", setname, filename);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_findrdataset");
|
||||
}
|
||||
|
||||
if (node != NULL) {
|
||||
if (node != NULL)
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
if (db != NULL) {
|
||||
if (db != NULL)
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
char filename[PATH_MAX + 1];
|
||||
isc_buffer_t buf;
|
||||
isc_result_t result;
|
||||
char filename[PATH_MAX + 1];
|
||||
isc_buffer_t buf;
|
||||
|
||||
dns_rdataset_init(rdataset);
|
||||
|
||||
isc_buffer_init(&buf, filename, sizeof(filename));
|
||||
if (dirname != NULL) {
|
||||
/* allow room for a trailing slash */
|
||||
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
|
||||
if (strlen(dirname) >= isc_buffer_availablelength(&buf))
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putstr(&buf, dirname);
|
||||
if (dirname[strlen(dirname) - 1] != '/') {
|
||||
if (dirname[strlen(dirname) - 1] != '/')
|
||||
isc_buffer_putstr(&buf, "/");
|
||||
}
|
||||
}
|
||||
|
||||
if (isc_buffer_availablelength(&buf) < 7) {
|
||||
if (isc_buffer_availablelength(&buf) < 7)
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putstr(&buf, "keyset-");
|
||||
|
||||
result = dns_name_tofilenametext(name, false, &buf);
|
||||
check_result(result, "dns_name_tofilenametext()");
|
||||
if (isc_buffer_availablelength(&buf) == 0) {
|
||||
if (isc_buffer_availablelength(&buf) == 0)
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, 0);
|
||||
|
||||
return (loadset(filename, rdataset));
|
||||
@@ -178,22 +165,22 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
|
||||
static void
|
||||
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
dns_rdata_t *rdata)
|
||||
{
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
|
||||
dns_rdata_init(rdata);
|
||||
|
||||
isc_buffer_init(&keyb, key_buf, key_buf_size);
|
||||
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't load %s.key: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't load %s.key: %s",
|
||||
filename, isc_result_totext(result));
|
||||
|
||||
if (verbose > 2) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
@@ -203,13 +190,12 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
}
|
||||
|
||||
result = dst_key_todns(key, &keyb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't decode key");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&keyb, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
|
||||
&r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key),
|
||||
dns_rdatatype_dnskey, &r);
|
||||
|
||||
rdclass = dst_key_class(key);
|
||||
|
||||
@@ -222,16 +208,15 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
static void
|
||||
logkey(dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t buf;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
|
||||
isc_buffer_init(&buf, rdata->data, rdata->length);
|
||||
isc_buffer_add(&buf, rdata->length);
|
||||
result = dst_key_fromdns(name, rdclass, &buf, mctx, &key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
}
|
||||
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
@@ -258,42 +243,35 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
dns_rdata_init(&ds);
|
||||
|
||||
result = dns_rdata_tostruct(rdata, &dnskey, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't convert DNSKEY");
|
||||
}
|
||||
|
||||
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall) {
|
||||
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall)
|
||||
return;
|
||||
}
|
||||
|
||||
result = dns_ds_buildrdata(name, rdata, dt, buf, &ds);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't build record");
|
||||
}
|
||||
|
||||
result = dns_name_totext(name, false, &nameb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't print name");
|
||||
}
|
||||
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *) NULL, 0, 0, 0, "",
|
||||
&textb);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't print rdata");
|
||||
}
|
||||
|
||||
result = dns_rdataclass_totext(rdclass, &classb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't print class");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&nameb, &r);
|
||||
printf("%.*s ", (int)r.length, r.base);
|
||||
|
||||
if (emitttl) {
|
||||
if (emitttl)
|
||||
printf("%u ", ttl);
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&classb, &r);
|
||||
printf("%.*s", (int)r.length, r.base);
|
||||
@@ -312,7 +290,7 @@ static void
|
||||
emits(bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
unsigned i, n;
|
||||
|
||||
n = sizeof(dtype) / sizeof(dtype[0]);
|
||||
n = sizeof(dtype)/sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] != 0) {
|
||||
emit(dtype[i], showall, cds, rdata);
|
||||
@@ -326,46 +304,43 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] -f zonefile [zonename]\n\n", program);
|
||||
fprintf(stderr, " %s [options] -s dnsname\n\n", program);
|
||||
fprintf(stderr, " %s [-h|-V]\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n"
|
||||
" -1: digest algorithm SHA-1\n"
|
||||
" -2: digest algorithm SHA-256\n"
|
||||
" -a algorithm: digest algorithm (SHA-1, SHA-256 or "
|
||||
"SHA-384)\n"
|
||||
" -A: include all keys in DS set, not just KSKs (-f "
|
||||
"only)\n"
|
||||
" -c class: rdata class for DS set (default IN) (-f "
|
||||
"or -s only)\n"
|
||||
" -C: print CDS records\n"
|
||||
" -f zonefile: read keys from a zone file\n"
|
||||
" -h: print help information\n"
|
||||
" -K directory: where to find key or keyset files\n"
|
||||
" -s: read keys from keyset-<dnsname> file\n"
|
||||
" -T: TTL of output records (omitted by default)\n"
|
||||
" -v level: verbosity\n"
|
||||
" -V: print version information\n");
|
||||
" -1: digest algorithm SHA-1\n"
|
||||
" -2: digest algorithm SHA-256\n"
|
||||
" -a algorithm: digest algorithm (SHA-1, SHA-256 or SHA-384)\n"
|
||||
" -A: include all keys in DS set, not just KSKs (-f only)\n"
|
||||
" -c class: rdata class for DS set (default IN) (-f or -s only)\n"
|
||||
" -C: print CDS records\n"
|
||||
" -f zonefile: read keys from a zone file\n"
|
||||
" -h: print help information\n"
|
||||
" -K directory: where to find key or keyset files\n"
|
||||
" -s: read keys from keyset-<dnsname> file\n"
|
||||
" -T: TTL of output records (omitted by default)\n"
|
||||
" -v level: verbosity\n"
|
||||
" -V: print version information\n");
|
||||
fprintf(stderr, "Output: DS or CDS RRs\n");
|
||||
|
||||
exit(-1);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp, *arg1;
|
||||
int ch;
|
||||
bool cds = false;
|
||||
bool usekeyset = false;
|
||||
bool showall = false;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp, *arg1;
|
||||
int ch;
|
||||
bool cds = false;
|
||||
bool usekeyset = false;
|
||||
bool showall = false;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
|
||||
dns_rdata_init(&rdata);
|
||||
|
||||
@@ -377,7 +352,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -404,16 +379,13 @@ main(int argc, char **argv) {
|
||||
classname = isc_commandline_argument;
|
||||
break;
|
||||
case 'd':
|
||||
fprintf(stderr,
|
||||
"%s: the -d option is deprecated; "
|
||||
"use -K\n",
|
||||
program);
|
||||
/* fall through */
|
||||
fprintf(stderr, "%s: the -d option is deprecated; "
|
||||
"use -K\n", program);
|
||||
/* fall through */
|
||||
case 'K':
|
||||
dir = isc_commandline_argument;
|
||||
if (strlen(dir) == 0U) {
|
||||
if (strlen(dir) == 0U)
|
||||
fatal("directory must be non-empty string");
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
filename = isc_commandline_argument;
|
||||
@@ -430,19 +402,17 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -452,8 +422,8 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
+103
-134
@@ -42,23 +42,23 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-importkey";
|
||||
|
||||
static dns_rdataclass_t rdclass;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static bool setpub = false, setdel = false;
|
||||
static bool setttl = false;
|
||||
static isc_stdtime_t pub = 0, del = 0;
|
||||
static dns_ttl_t ttl = 0;
|
||||
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
static bool setsyncadd = false;
|
||||
static bool setsyncdel = false;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static bool setpub = false, setdel = false;
|
||||
static bool setttl = false;
|
||||
static isc_stdtime_t pub = 0, del = 0;
|
||||
static dns_ttl_t ttl = 0;
|
||||
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
static bool setsyncadd = false;
|
||||
static bool setsyncdel = false;
|
||||
|
||||
static isc_result_t
|
||||
initname(char *setname) {
|
||||
@@ -80,36 +80,32 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
|
||||
|
||||
dns_rdatacallbacks_init(&callbacks);
|
||||
result = dns_db_beginload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
|
||||
mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0,
|
||||
&callbacks, mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't load from input: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_endload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_endload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
char setname[DNS_NAME_FORMATSIZE];
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't create database");
|
||||
}
|
||||
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
db_load_from_stream(db, stdin);
|
||||
@@ -117,53 +113,48 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
} else {
|
||||
result = dns_db_load(db, filename, dns_masterformat_text,
|
||||
DNS_MASTER_NOTTL);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_db_findnode(db, name, false, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't find %s node in %s", setname, filename);
|
||||
}
|
||||
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
|
||||
rdataset, NULL);
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
|
||||
0, 0, rdataset, NULL);
|
||||
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
fatal("no DNSKEY RR for %s in %s", setname, filename);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
fatal("dns_db_findrdataset");
|
||||
}
|
||||
|
||||
if (node != NULL) {
|
||||
if (node != NULL)
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
if (db != NULL) {
|
||||
if (db != NULL)
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
dns_rdata_t *rdata)
|
||||
{
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
|
||||
dns_rdata_init(rdata);
|
||||
|
||||
isc_buffer_init(&keyb, key_buf, key_buf_size);
|
||||
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("invalid keyfile name %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("invalid keyfile name %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
|
||||
if (verbose > 2) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
@@ -173,13 +164,12 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
}
|
||||
|
||||
result = dst_key_todns(key, &keyb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't decode key");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&keyb, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
|
||||
&r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key),
|
||||
dns_rdatatype_dnskey, &r);
|
||||
|
||||
rdclass = dst_key_class(key);
|
||||
|
||||
@@ -218,35 +208,31 @@ emit(const char *dir, dns_rdata_t *rdata) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dst_key_fromfile(
|
||||
dst_key_name(key), dst_key_id(key), dst_key_alg(key),
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir, mctx, &tmp);
|
||||
result = dst_key_fromfile(dst_key_name(key), dst_key_id(key),
|
||||
dst_key_alg(key),
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
dir, mctx, &tmp);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp)) {
|
||||
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp))
|
||||
fatal("Private key already exists in %s", priname);
|
||||
}
|
||||
dst_key_free(&tmp);
|
||||
}
|
||||
|
||||
dst_key_setexternal(key, true);
|
||||
if (setpub) {
|
||||
if (setpub)
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
||||
}
|
||||
if (setdel) {
|
||||
if (setdel)
|
||||
dst_key_settime(key, DST_TIME_DELETE, del);
|
||||
}
|
||||
if (setsyncadd) {
|
||||
if (setsyncadd)
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
}
|
||||
if (setsyncdel) {
|
||||
if (setsyncdel)
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
}
|
||||
|
||||
if (setttl) {
|
||||
if (setttl)
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir);
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
dir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
fatal("Failed to write key %s: %s", keystr,
|
||||
@@ -270,54 +256,53 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s options -f file [keyname]\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -f file: read key from zone file\n");
|
||||
fprintf(stderr, " -K <directory>: directory in which to store "
|
||||
"the key files\n");
|
||||
"the key files\n");
|
||||
fprintf(stderr, " -L ttl: set default key TTL\n");
|
||||
fprintf(stderr, " -v <verbose level>\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
fprintf(stderr, " -h: print usage and exit\n");
|
||||
fprintf(stderr, "Timing options:\n");
|
||||
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
|
||||
"publication date\n");
|
||||
"publication date\n");
|
||||
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
|
||||
"deletion date\n");
|
||||
"deletion date\n");
|
||||
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
|
||||
exit(-1);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp;
|
||||
int ch;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
isc_stdtime_t now;
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp;
|
||||
int ch;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
isc_stdtime_t now;
|
||||
|
||||
dns_rdata_init(&rdata);
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
if (argc == 1) {
|
||||
if (argc == 1)
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -328,29 +313,26 @@ main(int argc, char **argv) {
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (setsyncdel) {
|
||||
if (setsyncdel)
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel) {
|
||||
if (setdel)
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
del = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
del = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
break;
|
||||
case 'K':
|
||||
dir = isc_commandline_argument;
|
||||
if (strlen(dir) == 0U) {
|
||||
if (strlen(dir) == 0U)
|
||||
fatal("directory must be non-empty string");
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
ttl = strtottl(isc_commandline_argument);
|
||||
@@ -359,39 +341,35 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (setsyncadd) {
|
||||
if (setsyncadd)
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
break;
|
||||
}
|
||||
/* -Pdnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub) {
|
||||
if (setpub)
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
pub = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
pub = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
break;
|
||||
case 'f':
|
||||
filename = isc_commandline_argument;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -401,26 +379,23 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
rdclass = strtoclass(classname);
|
||||
|
||||
if (argc < isc_commandline_index + 1 && filename == NULL) {
|
||||
if (argc < isc_commandline_index + 1 && filename == NULL)
|
||||
fatal("the key file name was not specified");
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
if (argc > isc_commandline_index + 1)
|
||||
fatal("extraneous arguments");
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
setup_logging(mctx, &log);
|
||||
|
||||
@@ -430,26 +405,23 @@ main(int argc, char **argv) {
|
||||
if (argc < isc_commandline_index + 1) {
|
||||
/* using filename as zone name */
|
||||
namestr = filename;
|
||||
} else {
|
||||
} else
|
||||
namestr = argv[isc_commandline_index];
|
||||
}
|
||||
|
||||
result = initname(namestr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("could not initialize name %s", namestr);
|
||||
}
|
||||
|
||||
result = loadset(filename, &rdataset);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("could not load DNSKEY set: %s\n",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
for (result = dns_rdataset_first(&rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset))
|
||||
{
|
||||
result = dns_rdataset_next(&rdataset)) {
|
||||
|
||||
dns_rdata_init(&rdata);
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
emit(dir, &rdata);
|
||||
@@ -457,27 +429,24 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
unsigned char key_buf[DST_KEY_MAXSIZE];
|
||||
|
||||
loadkey(argv[isc_commandline_index], key_buf, DST_KEY_MAXSIZE,
|
||||
&rdata);
|
||||
loadkey(argv[isc_commandline_index], key_buf,
|
||||
DST_KEY_MAXSIZE, &rdata);
|
||||
|
||||
emit(dir, &rdata);
|
||||
}
|
||||
|
||||
if (dns_rdataset_isassociated(&rdataset)) {
|
||||
if (dns_rdataset_isassociated(&rdataset))
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
}
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10) {
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "write error\n");
|
||||
return (1);
|
||||
} else {
|
||||
} else
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ Specifies the label for a key pair in the crypto hardware\&.
|
||||
.sp
|
||||
When
|
||||
BIND
|
||||
9 is built with OpenSSL\-based PKCS#11 support, the label is an arbitrary string that identifies a particular key\&.
|
||||
9 is built with OpenSSL\-based PKCS#11 support, the label is an arbitrary string that identifies a particular key\&. It may be preceded by an optional OpenSSL engine name, followed by a colon, as in "pkcs11:\fIkeylabel\fR"\&.
|
||||
.sp
|
||||
When
|
||||
BIND
|
||||
|
||||
+185
-256
@@ -19,8 +19,8 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -53,7 +53,8 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s -l label [options] name\n\n", program);
|
||||
fprintf(stderr, " %s -l label [options] name\n\n",
|
||||
program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Required options:\n");
|
||||
fprintf(stderr, " -l label: label of the key pair\n");
|
||||
@@ -68,25 +69,22 @@ usage(void) {
|
||||
fprintf(stderr, " -c class (default: IN)\n");
|
||||
fprintf(stderr, " -E <engine>:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
" path to PKCS#11 provider library "
|
||||
"(default is %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, " path to PKCS#11 provider library "
|
||||
"(default is %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr, " name of an OpenSSL engine to use\n");
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
fprintf(stderr, " -f keyflag: KSK | REVOKE\n");
|
||||
fprintf(stderr, " -K directory: directory in which to place "
|
||||
"key files\n");
|
||||
fprintf(stderr, " -k: generate a TYPE=KEY key\n");
|
||||
fprintf(stderr, " -L ttl: default key TTL\n");
|
||||
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | "
|
||||
"OTHER\n");
|
||||
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | OTHER\n");
|
||||
fprintf(stderr, " (DNSKEY generation defaults to ZONE\n");
|
||||
fprintf(stderr, " -p protocol: default: 3 [dnssec]\n");
|
||||
fprintf(stderr, " -t type: "
|
||||
"AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF "
|
||||
"(default: AUTHCONF)\n");
|
||||
"AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF "
|
||||
"(default: AUTHCONF)\n");
|
||||
fprintf(stderr, " -y: permit keys that might collide\n");
|
||||
fprintf(stderr, " -v verbose level\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
@@ -104,73 +102,72 @@ usage(void) {
|
||||
fprintf(stderr, " -C: generate a backward-compatible key, omitting"
|
||||
" all dates\n");
|
||||
fprintf(stderr, " -S <key>: generate a successor to an existing "
|
||||
"key\n");
|
||||
"key\n");
|
||||
fprintf(stderr, " -i <interval>: prepublication interval for "
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<id>.key, "
|
||||
"K<name>+<alg>+<id>.private\n");
|
||||
|
||||
exit(-1);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *algname = NULL, *freeit = NULL;
|
||||
char *nametype = NULL, *type = NULL;
|
||||
const char *directory = NULL;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
const char *engine = NULL;
|
||||
char *classname = NULL;
|
||||
char *endp;
|
||||
dst_key_t *key = NULL;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||
dns_secalg_t alg;
|
||||
bool oldstyle = false;
|
||||
isc_mem_t *mctx = NULL;
|
||||
int ch;
|
||||
int protocol = -1, signatory = 0;
|
||||
isc_result_t ret;
|
||||
char *algname = NULL, *freeit = NULL;
|
||||
char *nametype = NULL, *type = NULL;
|
||||
const char *directory = NULL;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
const char *engine = NULL;
|
||||
char *classname = NULL;
|
||||
char *endp;
|
||||
dst_key_t *key = NULL;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||
dns_secalg_t alg;
|
||||
bool oldstyle = false;
|
||||
isc_mem_t *mctx = NULL;
|
||||
int ch;
|
||||
int protocol = -1, signatory = 0;
|
||||
isc_result_t ret;
|
||||
isc_textregion_t r;
|
||||
char filename[255];
|
||||
isc_buffer_t buf;
|
||||
isc_log_t *log = NULL;
|
||||
char filename[255];
|
||||
isc_buffer_t buf;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataclass_t rdclass;
|
||||
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
||||
char *label = NULL;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool genonly = false;
|
||||
bool use_nsec3 = false;
|
||||
bool avoid_collisions = true;
|
||||
bool exact;
|
||||
unsigned char c;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
||||
char *label = NULL;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool genonly = false;
|
||||
bool use_nsec3 = false;
|
||||
bool avoid_collisions = true;
|
||||
bool exact;
|
||||
unsigned char c;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
|
||||
if (argc == 1) {
|
||||
if (argc == 1)
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -179,7 +176,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
|
||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (ch) {
|
||||
switch (ch) {
|
||||
case '3':
|
||||
use_nsec3 = true;
|
||||
break;
|
||||
@@ -197,22 +194,20 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'f':
|
||||
c = (unsigned char)(isc_commandline_argument[0]);
|
||||
if (toupper(c) == 'K') {
|
||||
if (toupper(c) == 'K')
|
||||
kskflag = DNS_KEYFLAG_KSK;
|
||||
} else if (toupper(c) == 'R') {
|
||||
else if (toupper(c) == 'R')
|
||||
revflag = DNS_KEYFLAG_REVOKE;
|
||||
} else {
|
||||
else
|
||||
fatal("unknown flag '%s'",
|
||||
isc_commandline_argument);
|
||||
}
|
||||
break;
|
||||
case 'K':
|
||||
directory = isc_commandline_argument;
|
||||
ret = try_dir(directory);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("cannot open directory %s: %s", directory,
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("cannot open directory %s: %s",
|
||||
directory, isc_result_totext(ret));
|
||||
break;
|
||||
case 'k':
|
||||
options |= DST_TYPE_KEY;
|
||||
@@ -229,19 +224,17 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'p':
|
||||
protocol = strtol(isc_commandline_argument, &endp, 10);
|
||||
if (*endp != '\0' || protocol < 0 || protocol > 255) {
|
||||
if (*endp != '\0' || protocol < 0 || protocol > 255)
|
||||
fatal("-p must be followed by a number "
|
||||
"[0..255]");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
type = isc_commandline_argument;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
avoid_collisions = false;
|
||||
@@ -252,74 +245,67 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncadd || setsyncadd) {
|
||||
if (unsetsyncadd || setsyncadd)
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
unsetsyncadd = !setsyncadd;
|
||||
break;
|
||||
}
|
||||
/* -Pdnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub || unsetpub) {
|
||||
if (setpub || unsetpub)
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
publish = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
publish = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
unsetpub = !setpub;
|
||||
break;
|
||||
case 'A':
|
||||
if (setact || unsetact) {
|
||||
if (setact || unsetact)
|
||||
fatal("-A specified more than once");
|
||||
}
|
||||
|
||||
activate = strtotime(isc_commandline_argument, now, now,
|
||||
&setact);
|
||||
activate = strtotime(isc_commandline_argument,
|
||||
now, now, &setact);
|
||||
unsetact = !setact;
|
||||
break;
|
||||
case 'R':
|
||||
if (setrev || unsetrev) {
|
||||
if (setrev || unsetrev)
|
||||
fatal("-R specified more than once");
|
||||
}
|
||||
|
||||
revoke = strtotime(isc_commandline_argument, now, now,
|
||||
&setrev);
|
||||
revoke = strtotime(isc_commandline_argument,
|
||||
now, now, &setrev);
|
||||
unsetrev = !setrev;
|
||||
break;
|
||||
case 'I':
|
||||
if (setinact || unsetinact) {
|
||||
if (setinact || unsetinact)
|
||||
fatal("-I specified more than once");
|
||||
}
|
||||
|
||||
inactive = strtotime(isc_commandline_argument, now, now,
|
||||
&setinact);
|
||||
inactive = strtotime(isc_commandline_argument,
|
||||
now, now, &setinact);
|
||||
unsetinact = !setinact;
|
||||
break;
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncdel || setsyncdel) {
|
||||
if (unsetsyncdel || setsyncdel)
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
unsetsyncdel = !setsyncdel;
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel || unsetdel) {
|
||||
if (setdel || unsetdel)
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
deltime = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
deltime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'S':
|
||||
@@ -329,14 +315,13 @@ main(int argc, char **argv) {
|
||||
prepub = strtottl(isc_commandline_argument);
|
||||
break;
|
||||
case 'F':
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -346,40 +331,36 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = dst_lib_init(mctx, engine);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("could not initialize dst: %s", isc_result_totext(ret));
|
||||
}
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(ret));
|
||||
|
||||
setup_logging(mctx, &log);
|
||||
|
||||
if (predecessor == NULL) {
|
||||
if (label == NULL) {
|
||||
if (label == NULL)
|
||||
fatal("the key label was not specified");
|
||||
}
|
||||
if (argc < isc_commandline_index + 1) {
|
||||
if (argc < isc_commandline_index + 1)
|
||||
fatal("the key name was not specified");
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
if (argc > isc_commandline_index + 1)
|
||||
fatal("extraneous arguments");
|
||||
}
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
isc_buffer_init(&buf, argv[isc_commandline_index],
|
||||
strlen(argv[isc_commandline_index]));
|
||||
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
|
||||
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("invalid key name %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
|
||||
if (strchr(label, ':') == NULL) {
|
||||
char *l;
|
||||
@@ -421,32 +402,29 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
default:
|
||||
fatal("%s is incompatible with NSEC3; "
|
||||
"do not use the -3 option",
|
||||
algname);
|
||||
"do not use the -3 option", algname);
|
||||
}
|
||||
}
|
||||
|
||||
if (type != NULL && (options & DST_TYPE_KEY) != 0) {
|
||||
if (strcasecmp(type, "NOAUTH") == 0) {
|
||||
if (strcasecmp(type, "NOAUTH") == 0)
|
||||
flags |= DNS_KEYTYPE_NOAUTH;
|
||||
} else if (strcasecmp(type, "NOCONF") == 0) {
|
||||
else if (strcasecmp(type, "NOCONF") == 0)
|
||||
flags |= DNS_KEYTYPE_NOCONF;
|
||||
} else if (strcasecmp(type, "NOAUTHCONF") == 0) {
|
||||
else if (strcasecmp(type, "NOAUTHCONF") == 0)
|
||||
flags |= (DNS_KEYTYPE_NOAUTH |
|
||||
DNS_KEYTYPE_NOCONF);
|
||||
} else if (strcasecmp(type, "AUTHCONF") == 0) {
|
||||
/* nothing */
|
||||
} else {
|
||||
else if (strcasecmp(type, "AUTHCONF") == 0)
|
||||
/* nothing */;
|
||||
else
|
||||
fatal("invalid type %s", type);
|
||||
}
|
||||
}
|
||||
|
||||
if (!oldstyle && prepub > 0) {
|
||||
if (setpub && setact && (activate - prepub) < publish) {
|
||||
if (setpub && setact && (activate - prepub) < publish)
|
||||
fatal("Activation and publication dates "
|
||||
"are closer together than the\n\t"
|
||||
"prepublication interval.");
|
||||
}
|
||||
|
||||
if (!setpub && !setact) {
|
||||
setpub = setact = true;
|
||||
@@ -460,55 +438,43 @@ main(int argc, char **argv) {
|
||||
publish = activate - prepub;
|
||||
}
|
||||
|
||||
if ((activate - prepub) < now) {
|
||||
if ((activate - prepub) < now)
|
||||
fatal("Time until activation is shorter "
|
||||
"than the\n\tprepublication interval.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
isc_stdtime_t when;
|
||||
int major, minor;
|
||||
|
||||
if (prepub == -1) {
|
||||
if (prepub == -1)
|
||||
prepub = (30 * 86400);
|
||||
}
|
||||
|
||||
if (algname != NULL) {
|
||||
if (algname != NULL)
|
||||
fatal("-S and -a cannot be used together");
|
||||
}
|
||||
if (nametype != NULL) {
|
||||
if (nametype != NULL)
|
||||
fatal("-S and -n cannot be used together");
|
||||
}
|
||||
if (type != NULL) {
|
||||
if (type != NULL)
|
||||
fatal("-S and -t cannot be used together");
|
||||
}
|
||||
if (setpub || unsetpub) {
|
||||
if (setpub || unsetpub)
|
||||
fatal("-S and -P cannot be used together");
|
||||
}
|
||||
if (setact || unsetact) {
|
||||
if (setact || unsetact)
|
||||
fatal("-S and -A cannot be used together");
|
||||
}
|
||||
if (use_nsec3) {
|
||||
if (use_nsec3)
|
||||
fatal("-S and -3 cannot be used together");
|
||||
}
|
||||
if (oldstyle) {
|
||||
if (oldstyle)
|
||||
fatal("-S and -C cannot be used together");
|
||||
}
|
||||
if (genonly) {
|
||||
if (genonly)
|
||||
fatal("-S and -G cannot be used together");
|
||||
}
|
||||
|
||||
ret = dst_key_fromnamedfile(predecessor, directory,
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
mctx, &prevkey);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", predecessor,
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
if (!dst_key_isprivate(prevkey)) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
predecessor, isc_result_totext(ret));
|
||||
if (!dst_key_isprivate(prevkey))
|
||||
fatal("%s is not a private key", predecessor);
|
||||
}
|
||||
|
||||
name = dst_key_name(prevkey);
|
||||
alg = dst_key_alg(prevkey);
|
||||
@@ -516,106 +482,88 @@ main(int argc, char **argv) {
|
||||
|
||||
dst_key_format(prevkey, keystr, sizeof(keystr));
|
||||
dst_key_getprivateformat(prevkey, &major, &minor);
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
fatal("Key %s has incompatible format version %d.%d\n\t"
|
||||
"It is not possible to generate a successor key.",
|
||||
keystr, major, minor);
|
||||
}
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &when);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("Key %s has no activation date.\n\t"
|
||||
"You must use dnssec-settime -A to set one "
|
||||
"before generating a successor.",
|
||||
keystr);
|
||||
}
|
||||
"before generating a successor.", keystr);
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_INACTIVE, &activate);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("Key %s has no inactivation date.\n\t"
|
||||
"You must use dnssec-settime -I to set one "
|
||||
"before generating a successor.",
|
||||
keystr);
|
||||
}
|
||||
"before generating a successor.", keystr);
|
||||
|
||||
publish = activate - prepub;
|
||||
if (publish < now) {
|
||||
if (publish < now)
|
||||
fatal("Key %s becomes inactive\n\t"
|
||||
"sooner than the prepublication period "
|
||||
"for the new key ends.\n\t"
|
||||
"Either change the inactivation date with "
|
||||
"dnssec-settime -I,\n\t"
|
||||
"or use the -i option to set a shorter "
|
||||
"prepublication interval.",
|
||||
keystr);
|
||||
}
|
||||
"prepublication interval.", keystr);
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_DELETE, &when);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: Key %s has no removal "
|
||||
"date;\n\t it will remain in the zone "
|
||||
"indefinitely after rollover.\n\t "
|
||||
"You can use dnssec-settime -D to "
|
||||
"change this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s: WARNING: Key %s has no removal "
|
||||
"date;\n\t it will remain in the zone "
|
||||
"indefinitely after rollover.\n\t "
|
||||
"You can use dnssec-settime -D to "
|
||||
"change this.\n", program, keystr);
|
||||
|
||||
setpub = setact = true;
|
||||
}
|
||||
|
||||
if (nametype == NULL) {
|
||||
if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
if ((options & DST_TYPE_KEY) != 0) /* KEY */
|
||||
fatal("no nametype specified");
|
||||
}
|
||||
flags |= DNS_KEYOWNER_ZONE; /* DNSKEY */
|
||||
} else if (strcasecmp(nametype, "zone") == 0) {
|
||||
flags |= DNS_KEYOWNER_ZONE; /* DNSKEY */
|
||||
} else if (strcasecmp(nametype, "zone") == 0)
|
||||
flags |= DNS_KEYOWNER_ZONE;
|
||||
} else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
if (strcasecmp(nametype, "host") == 0 ||
|
||||
strcasecmp(nametype, "entity") == 0) {
|
||||
strcasecmp(nametype, "entity") == 0)
|
||||
flags |= DNS_KEYOWNER_ENTITY;
|
||||
} else if (strcasecmp(nametype, "user") == 0) {
|
||||
else if (strcasecmp(nametype, "user") == 0)
|
||||
flags |= DNS_KEYOWNER_USER;
|
||||
} else {
|
||||
else
|
||||
fatal("invalid KEY nametype %s", nametype);
|
||||
}
|
||||
} else if (strcasecmp(nametype, "other") != 0) { /* DNSKEY */
|
||||
} else if (strcasecmp(nametype, "other") != 0) /* DNSKEY */
|
||||
fatal("invalid DNSKEY nametype %s", nametype);
|
||||
}
|
||||
|
||||
rdclass = strtoclass(classname);
|
||||
|
||||
if (directory == NULL) {
|
||||
if (directory == NULL)
|
||||
directory = ".";
|
||||
}
|
||||
|
||||
if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
if ((options & DST_TYPE_KEY) != 0) /* KEY */
|
||||
flags |= signatory;
|
||||
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
|
||||
else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
|
||||
flags |= kskflag;
|
||||
flags |= revflag;
|
||||
}
|
||||
|
||||
if (protocol == -1) {
|
||||
if (protocol == -1)
|
||||
protocol = DNS_KEYPROTO_DNSSEC;
|
||||
} else if ((options & DST_TYPE_KEY) == 0 &&
|
||||
protocol != DNS_KEYPROTO_DNSSEC) {
|
||||
else if ((options & DST_TYPE_KEY) == 0 &&
|
||||
protocol != DNS_KEYPROTO_DNSSEC)
|
||||
fatal("invalid DNSKEY protocol: %d", protocol);
|
||||
}
|
||||
|
||||
if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY) {
|
||||
if ((flags & DNS_KEYFLAG_SIGNATORYMASK) != 0) {
|
||||
if ((flags & DNS_KEYFLAG_SIGNATORYMASK) != 0)
|
||||
fatal("specified null key with signing authority");
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
|
||||
alg == DNS_KEYALG_DH)
|
||||
{
|
||||
fatal("a key with algorithm '%s' cannot be a zone key",
|
||||
algname);
|
||||
}
|
||||
|
||||
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
|
||||
|
||||
@@ -623,9 +571,9 @@ main(int argc, char **argv) {
|
||||
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass,
|
||||
#if USE_PKCS11
|
||||
"pkcs11",
|
||||
#else /* if USE_PKCS11 */
|
||||
#else
|
||||
engine,
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
label, NULL, mctx, &key);
|
||||
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
@@ -633,8 +581,8 @@ main(int argc, char **argv) {
|
||||
char algstr[DNS_SECALG_FORMATSIZE];
|
||||
dns_name_format(name, namestr, sizeof(namestr));
|
||||
dns_secalg_format(alg, algstr, sizeof(algstr));
|
||||
fatal("failed to get key %s/%s: %s", namestr, algstr,
|
||||
isc_result_totext(ret));
|
||||
fatal("failed to get key %s/%s: %s",
|
||||
namestr, algstr, isc_result_totext(ret));
|
||||
/* NOTREACHED */
|
||||
exit(-1);
|
||||
}
|
||||
@@ -648,57 +596,48 @@ main(int argc, char **argv) {
|
||||
if (!oldstyle) {
|
||||
dst_key_settime(key, DST_TIME_CREATED, now);
|
||||
|
||||
if (genonly && (setpub || setact)) {
|
||||
if (genonly && (setpub || setact))
|
||||
fatal("cannot use -G together with -P or -A options");
|
||||
}
|
||||
|
||||
if (setpub) {
|
||||
if (setpub)
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, publish);
|
||||
} else if (setact) {
|
||||
else if (setact)
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, activate);
|
||||
} else if (!genonly && !unsetpub) {
|
||||
else if (!genonly && !unsetpub)
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, now);
|
||||
}
|
||||
|
||||
if (setact) {
|
||||
if (setact)
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, activate);
|
||||
} else if (!genonly && !unsetact) {
|
||||
else if (!genonly && !unsetact)
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, now);
|
||||
}
|
||||
|
||||
if (setrev) {
|
||||
if (kskflag == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is "
|
||||
if (kskflag == 0)
|
||||
fprintf(stderr, "%s: warning: Key is "
|
||||
"not flagged as a KSK, but -R "
|
||||
"was used. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
}
|
||||
dst_key_settime(key, DST_TIME_REVOKE, revoke);
|
||||
}
|
||||
|
||||
if (setinact) {
|
||||
if (setinact)
|
||||
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
|
||||
}
|
||||
|
||||
if (setdel) {
|
||||
if (setdel)
|
||||
dst_key_settime(key, DST_TIME_DELETE, deltime);
|
||||
}
|
||||
if (setsyncadd) {
|
||||
if (setsyncadd)
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
}
|
||||
if (setsyncdel) {
|
||||
if (setsyncdel)
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (setpub || setact || setrev || setinact || setdel ||
|
||||
unsetpub || unsetact || unsetrev || unsetinact ||
|
||||
unsetdel || genonly || setsyncadd || setsyncdel)
|
||||
{
|
||||
if (setpub || setact || setrev || setinact ||
|
||||
setdel || unsetpub || unsetact ||
|
||||
unsetrev || unsetinact || unsetdel || genonly ||
|
||||
setsyncadd || setsyncdel)
|
||||
fatal("cannot use -C together with "
|
||||
"-P, -A, -R, -I, -D, or -G options");
|
||||
}
|
||||
/*
|
||||
* Compatibility mode: Private-key-format
|
||||
* should be set to 1.2.
|
||||
@@ -707,9 +646,8 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
/* Set default key TTL */
|
||||
if (setttl) {
|
||||
if (setttl)
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not overwrite an existing key. Warn LOUDLY if there
|
||||
@@ -719,26 +657,21 @@ main(int argc, char **argv) {
|
||||
if (key_collision(key, name, directory, mctx, &exact)) {
|
||||
isc_buffer_clear(&buf);
|
||||
ret = dst_key_buildfilename(key, 0, directory, &buf);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("dst_key_buildfilename returned: %s\n",
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
if (exact) {
|
||||
if (exact)
|
||||
fatal("%s: %s already exists\n", program, filename);
|
||||
}
|
||||
|
||||
if (avoid_collisions) {
|
||||
if (avoid_collisions)
|
||||
fatal("%s: %s could collide with another key upon "
|
||||
"revokation\n",
|
||||
program, filename);
|
||||
}
|
||||
"revokation\n", program, filename);
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: Key %s could collide with "
|
||||
"another key upon revokation. If you plan "
|
||||
"to revoke keys, destroy this key and "
|
||||
"generate a different one.\n",
|
||||
program, filename);
|
||||
fprintf(stderr, "%s: WARNING: Key %s could collide with "
|
||||
"another key upon revokation. If you plan "
|
||||
"to revoke keys, destroy this key and "
|
||||
"generate a different one.\n",
|
||||
program, filename);
|
||||
}
|
||||
|
||||
ret = dst_key_tofile(key, options, directory);
|
||||
@@ -751,27 +684,23 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_buffer_clear(&buf);
|
||||
ret = dst_key_buildfilename(key, 0, NULL, &buf);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("dst_key_buildfilename returned: %s\n",
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
printf("%s\n", filename);
|
||||
dst_key_free(&key);
|
||||
if (prevkey != NULL) {
|
||||
if (prevkey != NULL)
|
||||
dst_key_free(&prevkey);
|
||||
}
|
||||
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10) {
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_free(mctx, label);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
if (freeit != NULL) {
|
||||
if (freeit != NULL)
|
||||
free(freeit);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,9 @@
|
||||
<para>
|
||||
When <acronym>BIND</acronym> 9 is built with OpenSSL-based
|
||||
PKCS#11 support, the label is an arbitrary string that
|
||||
identifies a particular key.
|
||||
identifies a particular key. It may be preceded by an
|
||||
optional OpenSSL engine name, followed by a colon, as in
|
||||
"pkcs11:<replaceable>keylabel</replaceable>".
|
||||
</para>
|
||||
<para>
|
||||
When <acronym>BIND</acronym> 9 is built with native PKCS#11
|
||||
|
||||
@@ -146,7 +146,9 @@
|
||||
<p>
|
||||
When <acronym class="acronym">BIND</acronym> 9 is built with OpenSSL-based
|
||||
PKCS#11 support, the label is an arbitrary string that
|
||||
identifies a particular key.
|
||||
identifies a particular key. It may be preceded by an
|
||||
optional OpenSSL engine name, followed by a colon, as in
|
||||
"pkcs11:<em class="replaceable"><code>keylabel</code></em>".
|
||||
</p>
|
||||
<p>
|
||||
When <acronym class="acronym">BIND</acronym> 9 is built with native PKCS#11
|
||||
|
||||
+255
-341
File diff suppressed because it is too large
Load Diff
+51
-67
@@ -32,13 +32,13 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-revoke";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
@@ -46,28 +46,26 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
" -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
fprintf(stderr, " -f: force overwrite\n");
|
||||
fprintf(stderr, " -h: help\n");
|
||||
fprintf(stderr, " -K directory: use directory for key files\n");
|
||||
fprintf(stderr, " -r: remove old keyfiles after "
|
||||
"creating revoked version\n");
|
||||
"creating revoked version\n");
|
||||
fprintf(stderr, " -v level: set level of verbosity\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit(-1);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -87,85 +85,79 @@ main(int argc, char **argv) {
|
||||
bool removefile = false;
|
||||
bool id = false;
|
||||
|
||||
if (argc == 1) {
|
||||
if (argc == 1)
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if HAVE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if HAVE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
|
||||
switch (ch) {
|
||||
case 'E':
|
||||
case 'E':
|
||||
engine = isc_commandline_argument;
|
||||
break;
|
||||
case 'f':
|
||||
case 'f':
|
||||
force = true;
|
||||
break;
|
||||
case 'K':
|
||||
case 'K':
|
||||
/*
|
||||
* We don't have to copy it here, but do it to
|
||||
* simplify cleanup later
|
||||
*/
|
||||
dir = isc_mem_strdup(mctx, isc_commandline_argument);
|
||||
break;
|
||||
case 'r':
|
||||
case 'r':
|
||||
removefile = true;
|
||||
break;
|
||||
case 'R':
|
||||
case 'R':
|
||||
id = true;
|
||||
break;
|
||||
case 'v':
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
|
||||
case 'V':
|
||||
case 'V':
|
||||
/* Does not return. */
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < isc_commandline_index + 1 ||
|
||||
argv[isc_commandline_index] == NULL) {
|
||||
argv[isc_commandline_index] == NULL)
|
||||
fatal("The key file name was not specified");
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
if (argc > isc_commandline_index + 1)
|
||||
fatal("Extraneous arguments");
|
||||
}
|
||||
|
||||
if (dir != NULL) {
|
||||
filename = argv[isc_commandline_index];
|
||||
} else {
|
||||
result = isc_file_splitpath(mctx, argv[isc_commandline_index],
|
||||
&dir, &filename);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("cannot process filename %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (strcmp(dir, ".") == 0) {
|
||||
isc_mem_free(mctx, dir);
|
||||
dir = NULL;
|
||||
@@ -173,17 +165,16 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(
|
||||
filename, dir, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, mctx, &key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile name %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
result = dst_key_fromnamedfile(filename, dir,
|
||||
DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile name %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
|
||||
if (id) {
|
||||
fprintf(stdout, "%u\n", dst_key_rid(key));
|
||||
@@ -191,27 +182,24 @@ main(int argc, char **argv) {
|
||||
}
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
|
||||
if (verbose > 2) {
|
||||
if (verbose > 2)
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
if (force)
|
||||
set_keyversion(key);
|
||||
} else {
|
||||
else
|
||||
check_keyversion(key, keystr);
|
||||
}
|
||||
|
||||
|
||||
flags = dst_key_flags(key);
|
||||
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
|
||||
isc_stdtime_t now;
|
||||
|
||||
if ((flags & DNS_KEYFLAG_KSK) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is not flagged "
|
||||
"as a KSK. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
}
|
||||
if ((flags & DNS_KEYFLAG_KSK) == 0)
|
||||
fprintf(stderr, "%s: warning: Key is not flagged "
|
||||
"as a KSK. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
dst_key_settime(key, DST_TIME_REVOKE, now);
|
||||
@@ -223,11 +211,10 @@ main(int argc, char **argv) {
|
||||
|
||||
if (access(newname, F_OK) == 0 && !force) {
|
||||
fatal("Key file %s already exists; "
|
||||
"use -f to force overwrite",
|
||||
newname);
|
||||
"use -f to force overwrite", newname);
|
||||
}
|
||||
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
dir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
@@ -247,9 +234,8 @@ main(int argc, char **argv) {
|
||||
isc_buffer_init(&buf, oldname, sizeof(oldname));
|
||||
dst_key_setflags(key, flags & ~DNS_KEYFLAG_REVOKE);
|
||||
dst_key_buildfilename(key, DST_TYPE_PRIVATE, dir, &buf);
|
||||
if (strcmp(oldname, newname) == 0) {
|
||||
if (strcmp(oldname, newname) == 0)
|
||||
goto cleanup;
|
||||
}
|
||||
(void)unlink(oldname);
|
||||
isc_buffer_clear(&buf);
|
||||
dst_key_buildfilename(key, DST_TYPE_PUBLIC, dir, &buf);
|
||||
@@ -263,12 +249,10 @@ main(int argc, char **argv) {
|
||||
cleanup:
|
||||
dst_key_free(&key);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10) {
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
if (dir != NULL) {
|
||||
if (dir != NULL)
|
||||
isc_mem_free(mctx, dir);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (0);
|
||||
|
||||
+219
-296
@@ -11,12 +11,12 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
@@ -25,24 +25,23 @@
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/log.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-settime";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
@@ -50,22 +49,20 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "General options:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
" -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
fprintf(stderr, " -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n", PK11_LIB_LOCATION);
|
||||
#elif defined(USE_PKCS11)
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine "
|
||||
"(default \"pkcs11\")\n");
|
||||
#else /* if USE_PKCS11 */
|
||||
"(default \"pkcs11\")\n");
|
||||
#else
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
fprintf(stderr, " -f: force update of old-style "
|
||||
"keys\n");
|
||||
"keys\n");
|
||||
fprintf(stderr, " -K directory: set key file location\n");
|
||||
fprintf(stderr, " -L ttl: set default key TTL\n");
|
||||
fprintf(stderr, " -v level: set level of verbosity\n");
|
||||
@@ -73,84 +70,76 @@ usage(void) {
|
||||
fprintf(stderr, " -h: help\n");
|
||||
fprintf(stderr, "Timing options:\n");
|
||||
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
|
||||
"publication date\n");
|
||||
"publication date\n");
|
||||
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
fprintf(stderr, " -A date/[+-]offset/none: set/unset key "
|
||||
"activation date\n");
|
||||
"activation date\n");
|
||||
fprintf(stderr, " -R date/[+-]offset/none: set/unset key "
|
||||
"revocation date\n");
|
||||
"revocation date\n");
|
||||
fprintf(stderr, " -I date/[+-]offset/none: set/unset key "
|
||||
"inactivation date\n");
|
||||
"inactivation date\n");
|
||||
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
|
||||
"deletion date\n");
|
||||
"deletion date\n");
|
||||
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
fprintf(stderr, " -S <key>: generate a successor to an existing "
|
||||
"key\n");
|
||||
"key\n");
|
||||
fprintf(stderr, " -i <interval>: prepublication interval for "
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
fprintf(stderr, "Key state options:\n");
|
||||
fprintf(stderr, " -s: update key state file (default no)\n");
|
||||
fprintf(stderr, " -g state: set the goal state for this key\n");
|
||||
fprintf(stderr, " -d state date/[+-]offset: set the DS state\n");
|
||||
fprintf(stderr, " -k state date/[+-]offset: set the DNSKEY state\n");
|
||||
fprintf(stderr, " -r state date/[+-]offset: set the RRSIG (KSK) "
|
||||
"state\n");
|
||||
"state\n");
|
||||
fprintf(stderr, " -z state date/[+-]offset: set the RRSIG (ZSK) "
|
||||
"state\n");
|
||||
"state\n");
|
||||
fprintf(stderr, "Printing options:\n");
|
||||
fprintf(stderr, " -p C/P/Psync/A/R/I/D/Dsync/all: print a "
|
||||
"particular time value or values\n");
|
||||
"particular time value or values\n");
|
||||
fprintf(stderr, " -u: print times in unix epoch "
|
||||
"format\n");
|
||||
"format\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit(-1);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
printtime(dst_key_t *key, int type, const char *tag, bool epoch, FILE *stream) {
|
||||
printtime(dst_key_t *key, int type, const char *tag, bool epoch,
|
||||
FILE *stream)
|
||||
{
|
||||
isc_result_t result;
|
||||
const char *output = NULL;
|
||||
isc_stdtime_t when;
|
||||
|
||||
if (tag != NULL) {
|
||||
if (tag != NULL)
|
||||
fprintf(stream, "%s: ", tag);
|
||||
}
|
||||
|
||||
result = dst_key_gettime(key, type, &when);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
fprintf(stream, "UNSET\n");
|
||||
} else if (epoch) {
|
||||
fprintf(stream, "%d\n", (int)when);
|
||||
fprintf(stream, "%d\n", (int) when);
|
||||
} else {
|
||||
time_t now = when;
|
||||
struct tm t, *tm = localtime_r(&now, &t);
|
||||
unsigned int flen;
|
||||
char timebuf[80];
|
||||
|
||||
if (tm == NULL) {
|
||||
fprintf(stream, "INVALID\n");
|
||||
return;
|
||||
}
|
||||
|
||||
flen = strftime(timebuf, sizeof(timebuf),
|
||||
"%a %b %e %H:%M:%S %Y", tm);
|
||||
INSIST(flen > 0U && flen < sizeof(timebuf));
|
||||
fprintf(stream, "%s\n", timebuf);
|
||||
time_t timet = when;
|
||||
output = ctime(&timet);
|
||||
fprintf(stream, "%s", output);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
writekey(dst_key_t *key, const char *directory, bool write_state) {
|
||||
writekey(dst_key_t *key, const char *directory, bool write_state)
|
||||
{
|
||||
char newname[1024];
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
isc_buffer_t buf;
|
||||
isc_result_t result;
|
||||
int options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE;
|
||||
int options = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE;
|
||||
|
||||
if (write_state) {
|
||||
options |= DST_TYPE_STATE;
|
||||
@@ -193,61 +182,60 @@ writekey(dst_key_t *key, const char *directory, bool write_state) {
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
isc_result_t result;
|
||||
const char *engine = NULL;
|
||||
const char *filename = NULL;
|
||||
char *directory = NULL;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char *endp, *p;
|
||||
int ch;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
dns_secalg_t alg = 0;
|
||||
unsigned int size = 0;
|
||||
uint16_t flags = 0;
|
||||
int prepub = -1;
|
||||
int options;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t now;
|
||||
isc_stdtime_t dstime = 0, dnskeytime = 0;
|
||||
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
|
||||
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
||||
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
||||
dst_key_state_t goal = DST_KEY_STATE_NA;
|
||||
dst_key_state_t ds = DST_KEY_STATE_NA;
|
||||
dst_key_state_t dnskey = DST_KEY_STATE_NA;
|
||||
dst_key_state_t krrsig = DST_KEY_STATE_NA;
|
||||
dst_key_state_t zrrsig = DST_KEY_STATE_NA;
|
||||
bool setgoal = false, setds = false, setdnskey = false;
|
||||
bool setkrrsig = false, setzrrsig = false;
|
||||
bool setdstime = false, setdnskeytime = false;
|
||||
bool setkrrsigtime = false, setzrrsigtime = false;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool printcreate = false, printpub = false;
|
||||
bool printact = false, printrev = false;
|
||||
bool printinact = false, printdel = false;
|
||||
bool force = false;
|
||||
bool epoch = false;
|
||||
bool changed = false;
|
||||
bool write_state = false;
|
||||
isc_log_t *log = NULL;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
bool printsyncadd = false, printsyncdel = false;
|
||||
isc_result_t result;
|
||||
const char *engine = NULL;
|
||||
const char *filename = NULL;
|
||||
char *directory = NULL;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char *endp, *p;
|
||||
int ch;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
dns_secalg_t alg = 0;
|
||||
unsigned int size = 0;
|
||||
uint16_t flags = 0;
|
||||
int prepub = -1;
|
||||
int options;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t now;
|
||||
isc_stdtime_t dstime = 0, dnskeytime = 0;
|
||||
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
|
||||
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
||||
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
||||
dst_key_state_t goal = DST_KEY_STATE_NA;
|
||||
dst_key_state_t ds = DST_KEY_STATE_NA;
|
||||
dst_key_state_t dnskey = DST_KEY_STATE_NA;
|
||||
dst_key_state_t krrsig = DST_KEY_STATE_NA;
|
||||
dst_key_state_t zrrsig = DST_KEY_STATE_NA;
|
||||
bool setgoal = false, setds = false, setdnskey = false;
|
||||
bool setkrrsig = false, setzrrsig = false;
|
||||
bool setdstime = false, setdnskeytime = false;
|
||||
bool setkrrsigtime = false, setzrrsigtime = false;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool printcreate = false, printpub = false;
|
||||
bool printact = false, printrev = false;
|
||||
bool printinact = false, printdel = false;
|
||||
bool force = false;
|
||||
bool epoch = false;
|
||||
bool changed = false;
|
||||
bool write_state = false;
|
||||
isc_log_t *log = NULL;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
bool printsyncadd = false, printsyncdel = false;
|
||||
|
||||
options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
|
||||
options = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_STATE;
|
||||
|
||||
if (argc == 1) {
|
||||
if (argc == 1)
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
@@ -255,7 +243,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -266,38 +254,35 @@ main(int argc, char **argv) {
|
||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
if (setact || unsetact) {
|
||||
if (setact || unsetact)
|
||||
fatal("-A specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
act = strtotime(isc_commandline_argument, now, now,
|
||||
&setact);
|
||||
act = strtotime(isc_commandline_argument,
|
||||
now, now, &setact);
|
||||
unsetact = !setact;
|
||||
break;
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncdel || setsyncdel) {
|
||||
if (unsetsyncdel || setsyncdel)
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
unsetsyncdel = !setsyncdel;
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel || unsetdel) {
|
||||
if (setdel || unsetdel)
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
del = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
del = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'd':
|
||||
@@ -309,8 +294,8 @@ main(int argc, char **argv) {
|
||||
setds = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
dstime = strtotime(isc_commandline_argument, now, now,
|
||||
&setdstime);
|
||||
dstime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdstime);
|
||||
break;
|
||||
case 'E':
|
||||
engine = isc_commandline_argument;
|
||||
@@ -326,30 +311,27 @@ main(int argc, char **argv) {
|
||||
goal = strtokeystate(isc_commandline_argument);
|
||||
if (goal != DST_KEY_STATE_NA &&
|
||||
goal != DST_KEY_STATE_HIDDEN &&
|
||||
goal != DST_KEY_STATE_OMNIPRESENT)
|
||||
{
|
||||
goal != DST_KEY_STATE_OMNIPRESENT) {
|
||||
fatal("-g must be either none, hidden, or "
|
||||
"omnipresent");
|
||||
}
|
||||
setgoal = true;
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
case 'I':
|
||||
if (setinact || unsetinact) {
|
||||
if (setinact || unsetinact)
|
||||
fatal("-I specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
inact = strtotime(isc_commandline_argument, now, now,
|
||||
&setinact);
|
||||
inact = strtotime(isc_commandline_argument,
|
||||
now, now, &setinact);
|
||||
unsetinact = !setinact;
|
||||
break;
|
||||
case 'i':
|
||||
@@ -372,8 +354,8 @@ main(int argc, char **argv) {
|
||||
setdnskey = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
dnskeytime = strtotime(isc_commandline_argument, now,
|
||||
now, &setdnskeytime);
|
||||
dnskeytime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdnskeytime);
|
||||
break;
|
||||
case 'L':
|
||||
ttl = strtottl(isc_commandline_argument);
|
||||
@@ -382,25 +364,23 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncadd || setsyncadd) {
|
||||
if (unsetsyncadd || setsyncadd)
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
unsetsyncadd = !setsyncadd;
|
||||
break;
|
||||
}
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub || unsetpub) {
|
||||
if (setpub || unsetpub)
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
pub = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
pub = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
unsetpub = !setpub;
|
||||
break;
|
||||
case 'p':
|
||||
@@ -456,13 +436,12 @@ main(int argc, char **argv) {
|
||||
} while (*p != '\0');
|
||||
break;
|
||||
case 'R':
|
||||
if (setrev || unsetrev) {
|
||||
if (setrev || unsetrev)
|
||||
fatal("-R specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
rev = strtotime(isc_commandline_argument, now, now,
|
||||
&setrev);
|
||||
rev = strtotime(isc_commandline_argument,
|
||||
now, now, &setrev);
|
||||
unsetrev = !setrev;
|
||||
break;
|
||||
case 'r':
|
||||
@@ -474,8 +453,8 @@ main(int argc, char **argv) {
|
||||
setkrrsig = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
krrsigtime = strtotime(isc_commandline_argument, now,
|
||||
now, &setkrrsigtime);
|
||||
krrsigtime = strtotime(isc_commandline_argument,
|
||||
now, now, &setkrrsigtime);
|
||||
break;
|
||||
case 'S':
|
||||
predecessor = isc_commandline_argument;
|
||||
@@ -491,9 +470,8 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (setzrrsig) {
|
||||
@@ -503,60 +481,52 @@ main(int argc, char **argv) {
|
||||
zrrsig = strtokeystate(isc_commandline_argument);
|
||||
setzrrsig = true;
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
zrrsigtime = strtotime(isc_commandline_argument, now,
|
||||
now, &setzrrsigtime);
|
||||
zrrsigtime = strtotime(isc_commandline_argument,
|
||||
now, now, &setzrrsigtime);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < isc_commandline_index + 1 ||
|
||||
argv[isc_commandline_index] == NULL) {
|
||||
argv[isc_commandline_index] == NULL)
|
||||
fatal("The key file name was not specified");
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
if (argc > isc_commandline_index + 1)
|
||||
fatal("Extraneous arguments");
|
||||
}
|
||||
|
||||
if ((setgoal || setds || setdnskey || setkrrsig || setzrrsig) &&
|
||||
!write_state) {
|
||||
!write_state)
|
||||
{
|
||||
fatal("Options -g, -d, -k, -r and -z require -s to be set");
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (predecessor != NULL) {
|
||||
int major, minor;
|
||||
|
||||
if (prepub == -1) {
|
||||
if (prepub == -1)
|
||||
prepub = (30 * 86400);
|
||||
}
|
||||
|
||||
if (setpub || unsetpub) {
|
||||
if (setpub || unsetpub)
|
||||
fatal("-S and -P cannot be used together");
|
||||
}
|
||||
if (setact || unsetact) {
|
||||
if (setact || unsetact)
|
||||
fatal("-S and -A cannot be used together");
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(predecessor, directory, options,
|
||||
mctx, &prevkey);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
if (!dst_key_isprivate(prevkey) && !dst_key_isexternal(prevkey))
|
||||
{
|
||||
fatal("%s is not a private key", filename);
|
||||
}
|
||||
|
||||
name = dst_key_name(prevkey);
|
||||
alg = dst_key_alg(prevkey);
|
||||
@@ -565,68 +535,57 @@ main(int argc, char **argv) {
|
||||
|
||||
dst_key_format(prevkey, keystr, sizeof(keystr));
|
||||
dst_key_getprivateformat(prevkey, &major, &minor);
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
fatal("Predecessor has incompatible format "
|
||||
"version %d.%d\n\t",
|
||||
major, minor);
|
||||
}
|
||||
"version %d.%d\n\t", major, minor);
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &prevact);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Predecessor has no activation date. "
|
||||
"You must set one before\n\t"
|
||||
"generating a successor.");
|
||||
}
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_INACTIVE,
|
||||
&previnact);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Predecessor has no inactivation date. "
|
||||
"You must set one before\n\t"
|
||||
"generating a successor.");
|
||||
}
|
||||
|
||||
pub = previnact - prepub;
|
||||
act = previnact;
|
||||
|
||||
if ((previnact - prepub) < now && prepub != 0) {
|
||||
if ((previnact - prepub) < now && prepub != 0)
|
||||
fatal("Time until predecessor inactivation is\n\t"
|
||||
"shorter than the prepublication interval. "
|
||||
"Either change\n\t"
|
||||
"predecessor inactivation date, or use the -i "
|
||||
"option to set\n\t"
|
||||
"a shorter prepublication interval.");
|
||||
}
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_DELETE, &prevdel);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Predecessor has no "
|
||||
"removal date;\n\t"
|
||||
"it will remain in the zone "
|
||||
"indefinitely after rollover.\n",
|
||||
program);
|
||||
} else if (prevdel < previnact) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Predecessor is "
|
||||
"scheduled to be deleted\n\t"
|
||||
"before it is scheduled to be "
|
||||
"inactive.\n",
|
||||
program);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s: warning: Predecessor has no "
|
||||
"removal date;\n\t"
|
||||
"it will remain in the zone "
|
||||
"indefinitely after rollover.\n",
|
||||
program);
|
||||
else if (prevdel < previnact)
|
||||
fprintf(stderr, "%s: warning: Predecessor is "
|
||||
"scheduled to be deleted\n\t"
|
||||
"before it is scheduled to be "
|
||||
"inactive.\n", program);
|
||||
|
||||
changed = setpub = setact = true;
|
||||
} else {
|
||||
if (prepub < 0) {
|
||||
if (prepub < 0)
|
||||
prepub = 0;
|
||||
}
|
||||
|
||||
if (prepub > 0) {
|
||||
if (setpub && setact && (act - prepub) < pub) {
|
||||
if (setpub && setact && (act - prepub) < pub)
|
||||
fatal("Activation and publication dates "
|
||||
"are closer together than the\n\t"
|
||||
"prepublication interval.");
|
||||
}
|
||||
|
||||
if (setpub && !setact) {
|
||||
setact = true;
|
||||
@@ -636,10 +595,9 @@ main(int argc, char **argv) {
|
||||
pub = act - prepub;
|
||||
}
|
||||
|
||||
if ((act - prepub) < now) {
|
||||
if ((act - prepub) < now)
|
||||
fatal("Time until activation is shorter "
|
||||
"than the\n\tprepublication interval.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,137 +606,113 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
result = isc_file_splitpath(mctx, argv[isc_commandline_index],
|
||||
&directory, &filename);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("cannot process filename %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(filename, directory, options, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
|
||||
if (!dst_key_isprivate(key) && !dst_key_isexternal(key)) {
|
||||
if (!dst_key_isprivate(key) && !dst_key_isexternal(key))
|
||||
fatal("%s is not a private key", filename);
|
||||
}
|
||||
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
|
||||
if (predecessor != NULL) {
|
||||
if (!dns_name_equal(name, dst_key_name(key))) {
|
||||
if (!dns_name_equal(name, dst_key_name(key)))
|
||||
fatal("Key name mismatch");
|
||||
}
|
||||
if (alg != dst_key_alg(key)) {
|
||||
if (alg != dst_key_alg(key))
|
||||
fatal("Key algorithm mismatch");
|
||||
}
|
||||
if (size != dst_key_size(key)) {
|
||||
if (size != dst_key_size(key))
|
||||
fatal("Key size mismatch");
|
||||
}
|
||||
if (flags != dst_key_flags(key)) {
|
||||
if (flags != dst_key_flags(key))
|
||||
fatal("Key flags mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
prevdel = previnact = 0;
|
||||
if ((setdel && setinact && del < inact) ||
|
||||
(dst_key_gettime(key, DST_TIME_INACTIVE, &previnact) ==
|
||||
ISC_R_SUCCESS &&
|
||||
(dst_key_gettime(key, DST_TIME_INACTIVE,
|
||||
&previnact) == ISC_R_SUCCESS &&
|
||||
setdel && !setinact && !unsetinact && del < previnact) ||
|
||||
(dst_key_gettime(key, DST_TIME_DELETE, &prevdel) == ISC_R_SUCCESS &&
|
||||
(dst_key_gettime(key, DST_TIME_DELETE,
|
||||
&prevdel) == ISC_R_SUCCESS &&
|
||||
setinact && !setdel && !unsetdel && prevdel < inact) ||
|
||||
(!setdel && !unsetdel && !setinact && !unsetinact && prevdel != 0 &&
|
||||
prevdel < previnact))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is scheduled to "
|
||||
"be deleted before it is\n\t"
|
||||
"scheduled to be inactive.\n",
|
||||
(!setdel && !unsetdel && !setinact && !unsetinact &&
|
||||
prevdel != 0 && prevdel < previnact))
|
||||
fprintf(stderr, "%s: warning: Key is scheduled to "
|
||||
"be deleted before it is\n\t"
|
||||
"scheduled to be inactive.\n",
|
||||
program);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
if (force)
|
||||
set_keyversion(key);
|
||||
} else {
|
||||
else
|
||||
check_keyversion(key, keystr);
|
||||
}
|
||||
|
||||
if (verbose > 2) {
|
||||
if (verbose > 2)
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set time values.
|
||||
*/
|
||||
if (setpub) {
|
||||
if (setpub)
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
||||
} else if (unsetpub) {
|
||||
else if (unsetpub)
|
||||
dst_key_unsettime(key, DST_TIME_PUBLISH);
|
||||
}
|
||||
|
||||
if (setact) {
|
||||
if (setact)
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, act);
|
||||
} else if (unsetact) {
|
||||
else if (unsetact)
|
||||
dst_key_unsettime(key, DST_TIME_ACTIVATE);
|
||||
}
|
||||
|
||||
if (setrev) {
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is already "
|
||||
"revoked; changing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_KSK) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is not flagged as "
|
||||
"a KSK, but -R was used. Revoking a "
|
||||
"ZSK is legal, but undefined.\n",
|
||||
program, keystr);
|
||||
}
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is already "
|
||||
"revoked; changing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_KSK) == 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is not flagged as "
|
||||
"a KSK, but -R was used. Revoking a "
|
||||
"ZSK is legal, but undefined.\n",
|
||||
program, keystr);
|
||||
dst_key_settime(key, DST_TIME_REVOKE, rev);
|
||||
} else if (unsetrev) {
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is already "
|
||||
"revoked; removing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is already "
|
||||
"revoked; removing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
dst_key_unsettime(key, DST_TIME_REVOKE);
|
||||
}
|
||||
|
||||
if (setinact) {
|
||||
if (setinact)
|
||||
dst_key_settime(key, DST_TIME_INACTIVE, inact);
|
||||
} else if (unsetinact) {
|
||||
else if (unsetinact)
|
||||
dst_key_unsettime(key, DST_TIME_INACTIVE);
|
||||
}
|
||||
|
||||
if (setdel) {
|
||||
if (setdel)
|
||||
dst_key_settime(key, DST_TIME_DELETE, del);
|
||||
} else if (unsetdel) {
|
||||
else if (unsetdel)
|
||||
dst_key_unsettime(key, DST_TIME_DELETE);
|
||||
}
|
||||
|
||||
if (setsyncadd) {
|
||||
if (setsyncadd)
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
} else if (unsetsyncadd) {
|
||||
else if (unsetsyncadd)
|
||||
dst_key_unsettime(key, DST_TIME_SYNCPUBLISH);
|
||||
}
|
||||
|
||||
if (setsyncdel) {
|
||||
if (setsyncdel)
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
} else if (unsetsyncdel) {
|
||||
else if (unsetsyncdel)
|
||||
dst_key_unsettime(key, DST_TIME_SYNCDELETE);
|
||||
}
|
||||
|
||||
if (setttl) {
|
||||
if (setttl)
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
if (predecessor != NULL && prevkey != NULL) {
|
||||
dst_key_setnum(prevkey, DST_NUM_SUCCESSOR, dst_key_id(key));
|
||||
@@ -852,46 +786,37 @@ main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed && setttl) {
|
||||
if (!changed && setttl)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out time values, if -p was used.
|
||||
*/
|
||||
if (printcreate) {
|
||||
if (printcreate)
|
||||
printtime(key, DST_TIME_CREATED, "Created", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printpub) {
|
||||
if (printpub)
|
||||
printtime(key, DST_TIME_PUBLISH, "Publish", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printact) {
|
||||
if (printact)
|
||||
printtime(key, DST_TIME_ACTIVATE, "Activate", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printrev) {
|
||||
if (printrev)
|
||||
printtime(key, DST_TIME_REVOKE, "Revoke", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printinact) {
|
||||
if (printinact)
|
||||
printtime(key, DST_TIME_INACTIVE, "Inactive", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printdel) {
|
||||
if (printdel)
|
||||
printtime(key, DST_TIME_DELETE, "Delete", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printsyncadd) {
|
||||
printtime(key, DST_TIME_SYNCPUBLISH, "SYNC Publish", epoch,
|
||||
stdout);
|
||||
}
|
||||
if (printsyncadd)
|
||||
printtime(key, DST_TIME_SYNCPUBLISH, "SYNC Publish",
|
||||
epoch, stdout);
|
||||
|
||||
if (printsyncdel) {
|
||||
printtime(key, DST_TIME_SYNCDELETE, "SYNC Delete", epoch,
|
||||
stdout);
|
||||
}
|
||||
if (printsyncdel)
|
||||
printtime(key, DST_TIME_SYNCDELETE, "SYNC Delete",
|
||||
epoch, stdout);
|
||||
|
||||
if (changed) {
|
||||
writekey(key, directory, write_state);
|
||||
@@ -900,14 +825,12 @@ main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prevkey != NULL) {
|
||||
if (prevkey != NULL)
|
||||
dst_key_free(&prevkey);
|
||||
}
|
||||
dst_key_free(&key);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10) {
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
cleanup_logging(&log);
|
||||
isc_mem_free(mctx, directory);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
@@ -239,7 +239,7 @@ Do not modify the SOA serial number\&.
|
||||
.PP
|
||||
\fB"increment"\fR
|
||||
.RS 4
|
||||
Increment the SOA serial number using RFC 1982 arithmetic\&.
|
||||
Increment the SOA serial number using RFC 1982 arithmetics\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB"unixtime"\fR
|
||||
|
||||
+648
-808
File diff suppressed because it is too large
Load Diff
@@ -445,7 +445,7 @@
|
||||
<term><command>"increment"</command></term>
|
||||
<listitem>
|
||||
<para>Increment the SOA serial number using RFC 1982
|
||||
arithmetic.</para>
|
||||
arithmetics.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
<dt><span class="term"><span class="command"><strong>"increment"</strong></span></span></dt>
|
||||
<dd>
|
||||
<p>Increment the SOA serial number using RFC 1982
|
||||
arithmetic.</p>
|
||||
arithmetics.</p>
|
||||
</dd>
|
||||
<dt><span class="term"><span class="command"><strong>"unixtime"</strong></span></span></dt>
|
||||
<dd>
|
||||
|
||||
+38
-54
@@ -47,9 +47,9 @@
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdatalist.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -71,10 +71,10 @@ const char *program = "dnssec-verify";
|
||||
static isc_stdtime_t now;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static dns_masterformat_t inputformat = dns_masterformat_text;
|
||||
static dns_db_t *gdb; /* The database */
|
||||
static dns_dbversion_t *gversion; /* The database version */
|
||||
static dns_rdataclass_t gclass; /* The class */
|
||||
static dns_name_t *gorigin; /* The database origin */
|
||||
static dns_db_t *gdb; /* The database */
|
||||
static dns_dbversion_t *gversion; /* The database version */
|
||||
static dns_rdataclass_t gclass; /* The class */
|
||||
static dns_name_t *gorigin; /* The database origin */
|
||||
static bool ignore_kskflag = false;
|
||||
static bool keyset_kskonly = false;
|
||||
|
||||
@@ -105,13 +105,12 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed converting name '%s' to dns format: %s", origin,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("failed converting name '%s' to dns format: %s",
|
||||
origin, isc_result_totext(result));
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, db);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_load(*db, file, inputformat, 0);
|
||||
@@ -130,10 +129,10 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
"use -o to specify a different zone origin",
|
||||
origin, file);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
fatal("failed loading zone from '%s': %s", file,
|
||||
isc_result_totext(result));
|
||||
fatal("failed loading zone from '%s': %s",
|
||||
file, isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,13 +159,11 @@ usage(void) {
|
||||
fprintf(stderr, "\t-c class (IN)\n");
|
||||
fprintf(stderr, "\t-E engine:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
"\t\tpath to PKCS#11 provider library "
|
||||
"(default is %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, "\t\tpath to PKCS#11 provider library "
|
||||
"(default is %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
|
||||
"not ZSKs\n");
|
||||
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
|
||||
@@ -185,7 +182,8 @@ main(int argc, char *argv[]) {
|
||||
char *endp;
|
||||
int ch;
|
||||
|
||||
#define CMDLINE_FLAGS "c:E:hm:o:I:qv:Vxz"
|
||||
#define CMDLINE_FLAGS \
|
||||
"c:E:hm:o:I:qv:Vxz"
|
||||
|
||||
/*
|
||||
* Process memory debugging argument first.
|
||||
@@ -194,23 +192,15 @@ main(int argc, char *argv[]) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
if (strcasecmp(isc_commandline_argument, "record") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "trace") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "usage") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0)
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -223,7 +213,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif /* if USE_PKCS11 */
|
||||
#endif
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -252,9 +242,8 @@ main(int argc, char *argv[]) {
|
||||
case 'v':
|
||||
endp = NULL;
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0') {
|
||||
if (*endp != '\0')
|
||||
fatal("verbose level must be numeric");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
@@ -270,10 +259,9 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
if (isc_commandline_option != '?')
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 'h':
|
||||
@@ -285,17 +273,16 @@ main(int argc, char *argv[]) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
@@ -306,9 +293,8 @@ main(int argc, char *argv[]) {
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
|
||||
if (argc < 1) {
|
||||
if (argc < 1)
|
||||
usage();
|
||||
}
|
||||
|
||||
file = argv[0];
|
||||
|
||||
@@ -318,18 +304,16 @@ main(int argc, char *argv[]) {
|
||||
POST(argc);
|
||||
POST(argv);
|
||||
|
||||
if (origin == NULL) {
|
||||
if (origin == NULL)
|
||||
origin = file;
|
||||
}
|
||||
|
||||
if (inputformatstr != NULL) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0)
|
||||
inputformat = dns_masterformat_text;
|
||||
} else if (strcasecmp(inputformatstr, "raw") == 0) {
|
||||
else if (strcasecmp(inputformatstr, "raw") == 0)
|
||||
inputformat = dns_masterformat_raw;
|
||||
} else {
|
||||
else
|
||||
fatal("unknown file format: %s\n", inputformatstr);
|
||||
}
|
||||
}
|
||||
|
||||
gdb = NULL;
|
||||
@@ -342,20 +326,20 @@ main(int argc, char *argv[]) {
|
||||
result = dns_db_newversion(gdb, &gversion);
|
||||
check_result(result, "dns_db_newversion()");
|
||||
|
||||
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL, mctx,
|
||||
ignore_kskflag, keyset_kskonly, report);
|
||||
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL,
|
||||
mctx, ignore_kskflag, keyset_kskonly,
|
||||
report);
|
||||
|
||||
dns_db_closeversion(gdb, &gversion, false);
|
||||
dns_db_detach(&gdb);
|
||||
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10) {
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
(void)isc_app_finish();
|
||||
(void) isc_app_finish();
|
||||
|
||||
return (result == ISC_R_SUCCESS ? 0 : 1);
|
||||
}
|
||||
|
||||
+84
-115
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
#include <isc/base32.h>
|
||||
#include <isc/buffer.h>
|
||||
@@ -46,10 +46,10 @@
|
||||
#include <dns/name.h>
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/secalg.h>
|
||||
@@ -59,10 +59,7 @@
|
||||
|
||||
#define KEYSTATES_NVALUES 4
|
||||
static const char *keystates[KEYSTATES_NVALUES] = {
|
||||
"hidden",
|
||||
"rumoured",
|
||||
"omnipresent",
|
||||
"unretentive",
|
||||
"hidden", "rumoured", "omnipresent", "unretentive",
|
||||
};
|
||||
|
||||
int verbose = 0;
|
||||
@@ -80,9 +77,8 @@ fatal(const char *format, ...) {
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
if (fatalcallback != NULL) {
|
||||
if (fatalcallback != NULL)
|
||||
(*fatalcallback)();
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -93,17 +89,15 @@ setfatalcallback(fatalcallback_t *callback) {
|
||||
|
||||
void
|
||||
check_result(isc_result_t result, const char *message) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("%s: %s", message, isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vbprintf(int level, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
if (level > verbose) {
|
||||
if (level > verbose)
|
||||
return;
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", program);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
@@ -128,14 +122,14 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
|
||||
|
||||
void
|
||||
setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
|
||||
isc_result_t result;
|
||||
isc_logdestination_t destination;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_log_t *log = NULL;
|
||||
int level;
|
||||
|
||||
if (verbose < 0) {
|
||||
if (verbose < 0)
|
||||
verbose = 0;
|
||||
}
|
||||
switch (verbose) {
|
||||
case 0:
|
||||
/*
|
||||
@@ -152,11 +146,12 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
|
||||
break;
|
||||
}
|
||||
|
||||
isc_log_create(mctx, &log, &logconfig);
|
||||
RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS);
|
||||
isc_log_setcontext(log);
|
||||
dns_log_init(log);
|
||||
dns_log_setcontext(log);
|
||||
isc_log_settag(logconfig, program);
|
||||
|
||||
RUNTIME_CHECK(isc_log_settag(logconfig, program) == ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
* Set up a channel similar to default_stderr except:
|
||||
@@ -168,12 +163,15 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC, level,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
|
||||
result = isc_log_createchannel(logconfig, "stderr",
|
||||
ISC_LOG_TOFILEDESC,
|
||||
level,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTAG|ISC_LOG_PRINTLEVEL);
|
||||
check_result(result, "isc_log_createchannel()");
|
||||
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
|
||||
NULL, NULL) == ISC_R_SUCCESS);
|
||||
|
||||
*logp = log;
|
||||
}
|
||||
@@ -187,9 +185,8 @@ cleanup_logging(isc_log_t **logp) {
|
||||
log = *logp;
|
||||
*logp = NULL;
|
||||
|
||||
if (log == NULL) {
|
||||
if (log == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
isc_log_destroy(&log);
|
||||
isc_log_setcontext(NULL);
|
||||
@@ -199,45 +196,35 @@ cleanup_logging(isc_log_t **logp) {
|
||||
static isc_stdtime_t
|
||||
time_units(isc_stdtime_t offset, char *suffix, const char *str) {
|
||||
switch (suffix[0]) {
|
||||
case 'Y':
|
||||
case 'y':
|
||||
case 'Y': case 'y':
|
||||
return (offset * (365 * 24 * 3600));
|
||||
case 'M':
|
||||
case 'm':
|
||||
case 'M': case 'm':
|
||||
switch (suffix[1]) {
|
||||
case 'O':
|
||||
case 'o':
|
||||
case 'O': case 'o':
|
||||
return (offset * (30 * 24 * 3600));
|
||||
case 'I':
|
||||
case 'i':
|
||||
case 'I': case 'i':
|
||||
return (offset * 60);
|
||||
case '\0':
|
||||
case '\0':
|
||||
fatal("'%s' ambiguous: use 'mi' for minutes "
|
||||
"or 'mo' for months",
|
||||
str);
|
||||
default:
|
||||
"or 'mo' for months", str);
|
||||
default:
|
||||
fatal("time value %s is invalid", str);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case 'W': case 'w':
|
||||
return (offset * (7 * 24 * 3600));
|
||||
case 'D':
|
||||
case 'd':
|
||||
case 'D': case 'd':
|
||||
return (offset * (24 * 3600));
|
||||
case 'H':
|
||||
case 'h':
|
||||
case 'H': case 'h':
|
||||
return (offset * 3600);
|
||||
case 'S':
|
||||
case 's':
|
||||
case '\0':
|
||||
case 'S': case 's': case '\0':
|
||||
return (offset);
|
||||
default:
|
||||
default:
|
||||
fatal("time value %s is invalid", str);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return (0); /* silence compiler warning */
|
||||
return(0); /* silence compiler warning */
|
||||
}
|
||||
|
||||
static inline bool
|
||||
@@ -252,14 +239,12 @@ strtottl(const char *str) {
|
||||
dns_ttl_t ttl;
|
||||
char *endp;
|
||||
|
||||
if (isnone(str)) {
|
||||
return ((dns_ttl_t)0);
|
||||
}
|
||||
if (isnone(str))
|
||||
return ((dns_ttl_t) 0);
|
||||
|
||||
ttl = strtol(str, &endp, 0);
|
||||
if (ttl == 0 && endp == str) {
|
||||
if (ttl == 0 && endp == str)
|
||||
fatal("TTL must be numeric");
|
||||
}
|
||||
ttl = time_units(ttl, endp, orig);
|
||||
return (ttl);
|
||||
}
|
||||
@@ -271,16 +256,18 @@ strtokeystate(const char *str) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
|
||||
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
|
||||
{
|
||||
return ((dst_key_state_t)i);
|
||||
if (keystates[i] != NULL &&
|
||||
strcasecmp(str, keystates[i]) == 0) {
|
||||
return (dst_key_state_t) i;
|
||||
}
|
||||
}
|
||||
fatal("unknown key state");
|
||||
}
|
||||
|
||||
isc_stdtime_t
|
||||
strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
strtotime(const char *str, int64_t now, int64_t base,
|
||||
bool *setp)
|
||||
{
|
||||
int64_t val, offset;
|
||||
isc_result_t result;
|
||||
const char *orig = str;
|
||||
@@ -288,19 +275,16 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
size_t n;
|
||||
|
||||
if (isnone(str)) {
|
||||
if (setp != NULL) {
|
||||
if (setp != NULL)
|
||||
*setp = false;
|
||||
}
|
||||
return ((isc_stdtime_t)0);
|
||||
return ((isc_stdtime_t) 0);
|
||||
}
|
||||
|
||||
if (setp != NULL) {
|
||||
if (setp != NULL)
|
||||
*setp = true;
|
||||
}
|
||||
|
||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
|
||||
return ((isc_stdtime_t)0);
|
||||
}
|
||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0')
|
||||
return ((isc_stdtime_t) 0);
|
||||
|
||||
/*
|
||||
* We accept times in the following formats:
|
||||
@@ -311,19 +295,18 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
*/
|
||||
n = strspn(str, "0123456789");
|
||||
if ((n == 8u || n == 14u) &&
|
||||
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
|
||||
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
|
||||
{
|
||||
char timestr[15];
|
||||
|
||||
strlcpy(timestr, str, sizeof(timestr));
|
||||
timestr[n] = 0;
|
||||
if (n == 8u) {
|
||||
if (n == 8u)
|
||||
strlcat(timestr, "000000", sizeof(timestr));
|
||||
}
|
||||
result = dns_time64_fromtext(timestr, &val);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("time value %s is invalid: %s", orig,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
base = val;
|
||||
str += n;
|
||||
} else if (strncmp(str, "now", 3) == 0) {
|
||||
@@ -331,21 +314,20 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
str += 3;
|
||||
}
|
||||
|
||||
if (str[0] == '\0') {
|
||||
return ((isc_stdtime_t)base);
|
||||
} else if (str[0] == '+') {
|
||||
if (str[0] == '\0')
|
||||
return ((isc_stdtime_t) base);
|
||||
else if (str[0] == '+') {
|
||||
offset = strtol(str + 1, &endp, 0);
|
||||
offset = time_units((isc_stdtime_t)offset, endp, orig);
|
||||
offset = time_units((isc_stdtime_t) offset, endp, orig);
|
||||
val = base + offset;
|
||||
} else if (str[0] == '-') {
|
||||
offset = strtol(str + 1, &endp, 0);
|
||||
offset = time_units((isc_stdtime_t)offset, endp, orig);
|
||||
offset = time_units((isc_stdtime_t) offset, endp, orig);
|
||||
val = base - offset;
|
||||
} else {
|
||||
} else
|
||||
fatal("time value %s is invalid", orig);
|
||||
}
|
||||
|
||||
return ((isc_stdtime_t)val);
|
||||
return ((isc_stdtime_t) val);
|
||||
}
|
||||
|
||||
dns_rdataclass_t
|
||||
@@ -354,15 +336,13 @@ strtoclass(const char *str) {
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_result_t result;
|
||||
|
||||
if (str == NULL) {
|
||||
return (dns_rdataclass_in);
|
||||
}
|
||||
if (str == NULL)
|
||||
return dns_rdataclass_in;
|
||||
DE_CONST(str, r.base);
|
||||
r.length = strlen(str);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("unknown class %s", str);
|
||||
}
|
||||
return (rdclass);
|
||||
}
|
||||
|
||||
@@ -375,9 +355,8 @@ strtodsdigest(const char *str) {
|
||||
DE_CONST(str, r.base);
|
||||
r.length = strlen(str);
|
||||
result = dns_dsdigest_fromtext(&alg, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("unknown DS algorithm %s", str);
|
||||
}
|
||||
return (alg);
|
||||
}
|
||||
|
||||
@@ -393,14 +372,14 @@ add_dtype(unsigned int dt) {
|
||||
unsigned i, n;
|
||||
|
||||
/* ensure there is space for a zero terminator */
|
||||
n = sizeof(dtype) / sizeof(dtype[0]) - 1;
|
||||
n = sizeof(dtype)/sizeof(dtype[0]) - 1;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] == dt) {
|
||||
return;
|
||||
}
|
||||
if (dtype[i] == 0) {
|
||||
dtype[i] = dt;
|
||||
qsort(dtype, i + 1, 1, cmp_dtype);
|
||||
qsort(dtype, i+1, 1, cmp_dtype);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -429,16 +408,14 @@ check_keyversion(dst_key_t *key, char *keystr) {
|
||||
dst_key_getprivateformat(key, &major, &minor);
|
||||
INSIST(major <= DST_MAJOR_VERSION); /* invalid private key */
|
||||
|
||||
if (major < DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
if (major < DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
fatal("Key %s has incompatible format version %d.%d, "
|
||||
"use -f to force upgrade to new version.",
|
||||
keystr, major, minor);
|
||||
}
|
||||
if (minor > DST_MINOR_VERSION) {
|
||||
if (minor > DST_MINOR_VERSION)
|
||||
fatal("Key %s has incompatible format version %d.%d, "
|
||||
"use -f to force downgrade to current version.",
|
||||
keystr, major, minor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -447,10 +424,9 @@ set_keyversion(dst_key_t *key) {
|
||||
dst_key_getprivateformat(key, &major, &minor);
|
||||
INSIST(major <= DST_MAJOR_VERSION);
|
||||
|
||||
if (major != DST_MAJOR_VERSION || minor != DST_MINOR_VERSION) {
|
||||
if (major != DST_MAJOR_VERSION || minor != DST_MINOR_VERSION)
|
||||
dst_key_setprivateformat(key, DST_MAJOR_VERSION,
|
||||
DST_MINOR_VERSION);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the key is from a version older than 1.3, set
|
||||
@@ -465,7 +441,8 @@ set_keyversion(dst_key_t *key) {
|
||||
|
||||
bool
|
||||
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
isc_mem_t *mctx, bool *exact) {
|
||||
isc_mem_t *mctx, bool *exact)
|
||||
{
|
||||
isc_result_t result;
|
||||
bool conflict = false;
|
||||
dns_dnsseckeylist_t matchkeys;
|
||||
@@ -477,9 +454,8 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
isc_buffer_t fileb;
|
||||
isc_stdtime_t now;
|
||||
|
||||
if (exact != NULL) {
|
||||
if (exact != NULL)
|
||||
*exact = false;
|
||||
}
|
||||
|
||||
id = dst_key_id(dstkey);
|
||||
rid = dst_key_rid(dstkey);
|
||||
@@ -492,26 +468,23 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
*/
|
||||
if (alg == DST_ALG_DH) {
|
||||
isc_buffer_init(&fileb, filename, sizeof(filename));
|
||||
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE, dir,
|
||||
&fileb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE,
|
||||
dir, &fileb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (true);
|
||||
}
|
||||
return (isc_file_exists(filename));
|
||||
}
|
||||
|
||||
ISC_LIST_INIT(matchkeys);
|
||||
isc_stdtime_get(&now);
|
||||
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
return (false);
|
||||
}
|
||||
|
||||
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
|
||||
key = ISC_LIST_HEAD(matchkeys);
|
||||
if (dst_key_alg(key->key) != alg) {
|
||||
if (dst_key_alg(key->key) != alg)
|
||||
goto next;
|
||||
}
|
||||
|
||||
oldid = dst_key_id(key->key);
|
||||
roldid = dst_key_rid(key->key);
|
||||
@@ -519,24 +492,20 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
if (oldid == rid || roldid == id || id == oldid) {
|
||||
conflict = true;
|
||||
if (id != oldid) {
|
||||
if (verbose > 1) {
|
||||
fprintf(stderr,
|
||||
"Key ID %d could "
|
||||
if (verbose > 1)
|
||||
fprintf(stderr, "Key ID %d could "
|
||||
"collide with %d\n",
|
||||
id, oldid);
|
||||
}
|
||||
} else {
|
||||
if (exact != NULL) {
|
||||
if (exact != NULL)
|
||||
*exact = true;
|
||||
}
|
||||
if (verbose > 1) {
|
||||
if (verbose > 1)
|
||||
fprintf(stderr, "Key ID %d exists\n",
|
||||
id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
next:
|
||||
ISC_LIST_UNLINK(matchkeys, key, link);
|
||||
dns_dnsseckey_destroy(mctx, &key);
|
||||
}
|
||||
@@ -552,7 +521,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
}
|
||||
|
||||
bool
|
||||
isoptarg(const char *arg, char **argv, void (*usage)(void)) {
|
||||
isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
||||
if (!strcasecmp(isc_commandline_argument, arg)) {
|
||||
if (argv[isc_commandline_index] == NULL) {
|
||||
fprintf(stderr, "%s: missing argument -%c %s\n",
|
||||
@@ -561,7 +530,7 @@ isoptarg(const char *arg, char **argv, void (*usage)(void)) {
|
||||
usage();
|
||||
}
|
||||
isc_commandline_argument = argv[isc_commandline_index];
|
||||
/* skip to next argument */
|
||||
/* skip to next arguement */
|
||||
isc_commandline_index++;
|
||||
return (true);
|
||||
}
|
||||
@@ -577,7 +546,7 @@ InitSockets(void) {
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "WSAStartup() failed: %d\n", err);
|
||||
exit(1);
|
||||
@@ -588,4 +557,4 @@ void
|
||||
DestroySockets(void) {
|
||||
WSACleanup();
|
||||
}
|
||||
#endif /* ifdef _WIN32 */
|
||||
#endif
|
||||
|
||||
+12
-18
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DNSSECTOOL_H
|
||||
#define DNSSECTOOL_H 1
|
||||
|
||||
@@ -18,13 +19,10 @@
|
||||
#include <isc/log.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/stdtime.h>
|
||||
|
||||
#include <dns/rdatastruct.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
|
||||
*/
|
||||
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c */
|
||||
extern int verbose;
|
||||
extern bool quiet;
|
||||
|
||||
@@ -40,11 +38,11 @@ extern const char *program;
|
||||
*/
|
||||
extern uint8_t dtype[8];
|
||||
|
||||
typedef void(fatalcallback_t)(void);
|
||||
typedef void (fatalcallback_t)(void);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
setfatalcallback(fatalcallback_t *callback);
|
||||
@@ -60,8 +58,7 @@ version(const char *program) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
|
||||
#define SIG_FORMATSIZE \
|
||||
(DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
|
||||
#define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
|
||||
|
||||
void
|
||||
setup_logging(isc_mem_t *mctx, isc_log_t **logp);
|
||||
@@ -69,14 +66,13 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp);
|
||||
void
|
||||
cleanup_logging(isc_log_t **logp);
|
||||
|
||||
dns_ttl_t
|
||||
strtottl(const char *str);
|
||||
dns_ttl_t strtottl(const char *str);
|
||||
|
||||
dst_key_state_t
|
||||
strtokeystate(const char *str);
|
||||
dst_key_state_t strtokeystate(const char *str);
|
||||
|
||||
isc_stdtime_t
|
||||
strtotime(const char *str, int64_t now, int64_t base, bool *setp);
|
||||
strtotime(const char *str, int64_t now, int64_t base,
|
||||
bool *setp);
|
||||
|
||||
dns_rdataclass_t
|
||||
strtoclass(const char *str);
|
||||
@@ -104,10 +100,8 @@ bool
|
||||
isoptarg(const char *arg, char **argv, void (*usage)(void));
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
InitSockets(void);
|
||||
void
|
||||
DestroySockets(void);
|
||||
#endif /* ifdef _WIN32 */
|
||||
void InitSockets(void);
|
||||
void DestroySockets(void);
|
||||
#endif
|
||||
|
||||
#endif /* DNSSEC_DNSSECTOOL_H */
|
||||
|
||||
+12
-2
@@ -50,7 +50,6 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
|
||||
${OPENSSL_CFLAGS} \
|
||||
${JSON_C_CFLAGS} \
|
||||
${LIBXML2_CFLAGS} \
|
||||
${LMDB_CFLAGS} \
|
||||
${MAXMINDDB_CFLAGS} \
|
||||
${ZLIB_CFLAGS}
|
||||
|
||||
@@ -62,6 +61,7 @@ DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
|
||||
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
||||
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
|
||||
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
|
||||
BIND9LIBS = ../../lib/bind9/libbind9.@A@
|
||||
NSLIBS = ../../lib/ns/libns.@A@
|
||||
|
||||
@@ -78,7 +78,11 @@ DEPLIBS = ${NSDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
|
||||
LIBS = ${NSLIBS} ${DNSLIBS} ${BIND9LIBS} \
|
||||
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
|
||||
${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBCAP_LIBS@ \
|
||||
${LMDB_LIBS} \
|
||||
@LIBS@
|
||||
|
||||
NOSYMLIBS = ${NSLIBS} ${DNSLIBS} ${BIND9LIBS} \
|
||||
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
|
||||
${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBCAP_LIBS@ \
|
||||
@LIBS@
|
||||
|
||||
SUBDIRS = unix
|
||||
@@ -97,6 +101,8 @@ OBJS = builtin.@O@ config.@O@ control.@O@ \
|
||||
|
||||
UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@
|
||||
|
||||
SYMOBJS = symtbl.@O@
|
||||
|
||||
GEOIP2LINKSRCS = geoip.c
|
||||
|
||||
SRCS = builtin.c config.c control.c \
|
||||
@@ -142,6 +148,7 @@ server.@O@: server.c
|
||||
-DVERSION=\"${VERSION}\" -c ${srcdir}/server.c
|
||||
|
||||
named@EXEEXT@: ${OBJS} ${DEPLIBS}
|
||||
export MAKE_SYMTABLE="yes"; \
|
||||
export BASEOBJS="${OBJS} ${UOBJS}"; \
|
||||
${FINALBUILDCMD}
|
||||
|
||||
@@ -177,3 +184,6 @@ uninstall::
|
||||
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@
|
||||
|
||||
@DLZ_DRIVER_RULES@
|
||||
|
||||
named-symtbl.@O@: named-symtbl.c
|
||||
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c named-symtbl.c
|
||||
|
||||
+73
-191
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Generated by convertxsl.pl 1.14 2008/07/17 23:43:26 jinmei Exp
|
||||
* Generated by convertxsl.pl 1.14 2008/07/17 23:43:26 jinmei Exp
|
||||
* From unknown
|
||||
*/
|
||||
static char xslmsg[] =
|
||||
@@ -7,34 +7,26 @@ static char xslmsg[] =
|
||||
"<!--\n"
|
||||
" - Copyright (C) Internet Systems Consortium, Inc. (\"ISC\")\n"
|
||||
" -\n"
|
||||
" - This Source Code Form is subject to the terms of the Mozilla "
|
||||
"Public\n"
|
||||
" - License, v. 2.0. If a copy of the MPL was not distributed with "
|
||||
"this\n"
|
||||
" - This Source Code Form is subject to the terms of the Mozilla Public\n"
|
||||
" - License, v. 2.0. If a copy of the MPL was not distributed with this\n"
|
||||
" - file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
|
||||
" -\n"
|
||||
" - See the COPYRIGHT file distributed with this work for additional\n"
|
||||
" - information regarding copyright ownership.\n"
|
||||
"-->\n"
|
||||
"\n"
|
||||
"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" "
|
||||
"xmlns=\"http://www.w3.org/1999/xhtml\" version=\"1.0\">\n"
|
||||
"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns=\"http://www.w3.org/1999/xhtml\" version=\"1.0\">\n"
|
||||
" <xsl:output method=\"html\" indent=\"yes\" version=\"4.0\"/>\n"
|
||||
" <xsl:template match=\"statistics[@version="3.11"]\">\n"
|
||||
" <html>\n"
|
||||
" <head>\n"
|
||||
" <script type=\"text/javascript\" "
|
||||
"src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/"
|
||||
"jquery.min.js\"></script>\n"
|
||||
" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
" $(function($) {\n"
|
||||
" var wid=0;\n"
|
||||
" $('table.zones').each(function(i) { if( $(this).width() > wid ) wid "
|
||||
"= $(this).width(); return true; });\n"
|
||||
" $('table.zones').each(function(i) { if( $(this).width() > wid ) wid = $(this).width(); return true; });\n"
|
||||
" $('table.zones').css('min-width', wid );\n"
|
||||
" $(\"h2+table,h3+table,h4+table,h2+div,h3+div,h2+script,h3+script\")."
|
||||
"prev().append(' <a class=\"tabletoggle\" href=\"#\" "
|
||||
"style=\"font-size:small\">Show/Hide</a>');\n"
|
||||
" $(\"h2+table,h3+table,h4+table,h2+div,h3+div,h2+script,h3+script\").prev().append(' <a class=\"tabletoggle\" href=\"#\" style=\"font-size:small\">Show/Hide</a>');\n"
|
||||
" $(\".tabletoggle\").click(function(){\n"
|
||||
" var n = $(this).closest(\"h2,h3,h4\").next();\n"
|
||||
" if (n.is(\"script\")) { n = n.next(); }\n"
|
||||
@@ -47,8 +39,7 @@ static char xslmsg[] =
|
||||
"\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
" <script type=\"text/javascript\" "
|
||||
"src=\"https://www.google.com/jsapi\"/>\n"
|
||||
" <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"/>\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
"\n"
|
||||
" google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});\n"
|
||||
@@ -65,12 +56,10 @@ static char xslmsg[] =
|
||||
"\n"
|
||||
" var chart;\n"
|
||||
" if (style == \"barchart\") {\n"
|
||||
" chart = new "
|
||||
"google.visualization.BarChart(document.getElementById(target));\n"
|
||||
" chart = new google.visualization.BarChart(document.getElementById(target));\n"
|
||||
" chart.draw(data, options);\n"
|
||||
" } else if (style == \"piechart\") {\n"
|
||||
" chart = new "
|
||||
"google.visualization.PieChart(document.getElementById(target));\n"
|
||||
" chart = new google.visualization.PieChart(document.getElementById(target));\n"
|
||||
" chart.draw(data, options);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
@@ -92,10 +81,7 @@ static char xslmsg[] =
|
||||
" 'title' : \"Server Incoming Query Types\",\n"
|
||||
" 'target': 'chart_incoming_qtypes',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"server/counters[@type="qtype"]/"
|
||||
"counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of "
|
||||
"select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type="qtype"]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
" </xsl:if>\n"
|
||||
"\n"
|
||||
@@ -105,11 +91,7 @@ static char xslmsg[] =
|
||||
" 'title' : \"Server Incoming Requests by DNS Opcode\",\n"
|
||||
" 'target': 'chart_incoming_opcodes',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Opcode','Counter'],<xsl:for-each "
|
||||
"select=\"server/counters[@type="opcode"]/counter[. > 0 "
|
||||
"or substring(@name,1,3) != 'RES']\">['<xsl:value-of "
|
||||
"select=\"@name\"/>',<xsl:value-of "
|
||||
"select=\".\"/>],</xsl:for-each>]});\n"
|
||||
" 'data': [['Opcode','Counter'],<xsl:for-each select=\"server/counters[@type="opcode"]/counter[. > 0 or substring(@name,1,3) != 'RES']\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]});\n"
|
||||
" </xsl:if>\n"
|
||||
" </script>\n"
|
||||
" </xsl:if>\n"
|
||||
@@ -379,8 +361,7 @@ static char xslmsg[] =
|
||||
" </tr>\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <xsl:if test=\"server/counters[@type="opcode"]/counter[. "
|
||||
"> 0]\">\n"
|
||||
" <xsl:if test=\"server/counters[@type="opcode"]/counter[. > 0]\">\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <h2>Incoming Requests by DNS Opcode</h2>\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
@@ -389,9 +370,7 @@ static char xslmsg[] =
|
||||
" </div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="opcode"]/counter[. > 0 "
|
||||
"or substring(@name,1,3) != 'RES']\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="opcode"]/counter[. > 0 or substring(@name,1,3) != 'RES']\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class0\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -411,8 +390,7 @@ static char xslmsg[] =
|
||||
" <tr>\n"
|
||||
" <th class=\"totals\">Total:</th>\n"
|
||||
" <td class=\"totals\">\n"
|
||||
" <xsl:value-of "
|
||||
"select=\"sum(server/counters[@type="opcode"]/counter)\"/>\n"
|
||||
" <xsl:value-of select=\"sum(server/counters[@type="opcode"]/counter)\"/>\n"
|
||||
" </td>\n"
|
||||
" </tr>\n"
|
||||
" </table>\n"
|
||||
@@ -427,8 +405,7 @@ static char xslmsg[] =
|
||||
" </div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="qtype"]/counter\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="qtype"]/counter\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -448,45 +425,33 @@ static char xslmsg[] =
|
||||
" <tr>\n"
|
||||
" <th class=\"totals\">Total:</th>\n"
|
||||
" <td class=\"totals\">\n"
|
||||
" <xsl:value-of "
|
||||
"select=\"sum(server/counters[@type="qtype"]/counter)\"/>\n"
|
||||
" <xsl:value-of select=\"sum(server/counters[@type="qtype"]/counter)\"/>\n"
|
||||
" </td>\n"
|
||||
" </tr>\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"views/view[count(counters[@type="resqtype"]/counter) "
|
||||
"> 0]\">\n"
|
||||
" <xsl:if test=\"views/view[count(counters[@type="resqtype"]/counter) > 0]\">\n"
|
||||
" <h2>Outgoing Queries per view</h2>\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"views/view[count(counters[@type="resqtype"]/"
|
||||
"counter) > 0]\">\n"
|
||||
" <xsl:for-each select=\"views/view[count(counters[@type="resqtype"]/counter) > 0]\">\n"
|
||||
" <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
" graphs.push({\n"
|
||||
" 'title': \"Outgoing Queries for view: <xsl:value-of "
|
||||
"select=\"@name\"/>\",\n"
|
||||
" 'target': 'chart_outgoing_queries_view_<xsl:value-of "
|
||||
"select=\"@name\"/>',\n"
|
||||
" 'title': \"Outgoing Queries for view: <xsl:value-of select=\"@name\"/>\",\n"
|
||||
" 'target': 'chart_outgoing_queries_view_<xsl:value-of select=\"@name\"/>',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"counters[@type="resqtype"]/"
|
||||
"counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of "
|
||||
"select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type="resqtype"]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
" </script>\n"
|
||||
" <xsl:variable name=\"target\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <div class=\"pie\" id=\"chart_outgoing_queries_view_{$target}\">[no "
|
||||
"data to display]</div>\n"
|
||||
" <div class=\"pie\" id=\"chart_outgoing_queries_view_{$target}\">[no data to display]</div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="resqtype"]/counter\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="resqtype"]/counter\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class1\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -507,8 +472,7 @@ static char xslmsg[] =
|
||||
" <br/>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"server/counters[@type="nsstat"]/counter[.>0]\">\n"
|
||||
" <xsl:if test=\"server/counters[@type="nsstat"]/counter[.>0]\">\n"
|
||||
" <h2>Server Statistics</h2>\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
@@ -517,19 +481,13 @@ static char xslmsg[] =
|
||||
" 'title' : \"Server Counters\",\n"
|
||||
" 'target': 'chart_server_nsstat_restype',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"server/counters[@type="nsstat"]/"
|
||||
"counter[.>0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of "
|
||||
"select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type="nsstat"]/counter[.>0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
" </script>\n"
|
||||
" <div class=\"pie\" id=\"chart_server_nsstat_restype\">[no data to "
|
||||
"display]</div>\n"
|
||||
" <div class=\"pie\" id=\"chart_server_nsstat_restype\">[no data to display]</div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="nsstat"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="nsstat"]/counter[.>0]\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class2\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -549,9 +507,7 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"server/counters[@type="zonestat"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"server/counters[@type="zonestat"]/counter[.>0]\">\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <h2>Zone Maintenance Statistics</h2>\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
@@ -559,19 +515,14 @@ static char xslmsg[] =
|
||||
" 'title' : \"Zone Maintenance Stats\",\n"
|
||||
" 'target': 'chart_server_zone_maint',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"server/counters[@type="zonestat"]/"
|
||||
"counter[.>0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of "
|
||||
"select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type="zonestat"]/counter[.>0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
" </script>\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
" <div class=\"pie\" id=\"chart_server_zone_maint\">[no data to "
|
||||
"display]</div>\n"
|
||||
" <div class=\"pie\" id=\"chart_server_zone_maint\">[no data to display]</div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="zonestat"]/counter\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="zonestat"]/counter\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class3\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -590,12 +541,10 @@ static char xslmsg[] =
|
||||
" </xsl:for-each>\n"
|
||||
" </table>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"server/counters[@type="resstat"]/counter[.>0]\">\n"
|
||||
" <xsl:if test=\"server/counters[@type="resstat"]/counter[.>0]\">\n"
|
||||
" <h2>Resolver Statistics (Common)</h2>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="resstat"]/counter\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="resstat"]/counter\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class4\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -615,13 +564,10 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:for-each select=\"views/view\">\n"
|
||||
" <xsl:if "
|
||||
"test=\"counters[@type="resstats"]/counter[.>0]\">\n"
|
||||
" <h3>Resolver Statistics for View <xsl:value-of "
|
||||
"select=\"@name\"/></h3>\n"
|
||||
" <xsl:if test=\"counters[@type="resstats"]/counter[.>0]\">\n"
|
||||
" <h3>Resolver Statistics for View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="resstats"]/counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="resstats"]/counter[.>0]\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class5\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -642,12 +588,10 @@ static char xslmsg[] =
|
||||
" </xsl:if>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" <xsl:for-each select=\"views/view\">\n"
|
||||
" <xsl:if "
|
||||
"test=\"counters[@type="adbstat"]/counter[.>0]\">\n"
|
||||
" <xsl:if test=\"counters[@type="adbstat"]/counter[.>0]\">\n"
|
||||
" <h3>ADB Statistics for View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="adbstat"]/counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="adbstat"]/counter[.>0]\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class5\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -668,12 +612,10 @@ static char xslmsg[] =
|
||||
" </xsl:if>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" <xsl:for-each select=\"views/view\">\n"
|
||||
" <xsl:if "
|
||||
"test=\"counters[@type="cachestats"]/counter[.>0]\">\n"
|
||||
" <xsl:if test=\"counters[@type="cachestats"]/counter[.>0]\">\n"
|
||||
" <h3>Cache Statistics for View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="cachestats"]/counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="cachestats"]/counter[.>0]\">\n"
|
||||
" <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class5\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -717,25 +659,13 @@ static char xslmsg[] =
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" <xsl:if "
|
||||
"test=\"traffic//udp/counters[@type="request-size"]/"
|
||||
"counter[.>0] or "
|
||||
"traffic//udp/counters[@type="response-size"]/"
|
||||
"counter[.>0] or "
|
||||
"traffic//tcp/counters[@type="request-size"]/counter[.>0] "
|
||||
"or "
|
||||
"traffic//tcp/counters[@type="response-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"traffic//udp/counters[@type="request-size"]/counter[.>0] or traffic//udp/counters[@type="response-size"]/counter[.>0] or traffic//tcp/counters[@type="request-size"]/counter[.>0] or traffic//tcp/counters[@type="response-size"]/counter[.>0]\">\n"
|
||||
" <h2>Traffic Size Statistics</h2>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"traffic//udp/counters[@type="request-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"traffic//udp/counters[@type="request-size"]/counter[.>0]\">\n"
|
||||
" <h4>UDP Requests Received</h4>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"traffic//udp/counters[@type="request-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"traffic//udp/counters[@type="request-size"]/counter[.>0]\">\n"
|
||||
" <xsl:variable name=\"css-class7\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -755,14 +685,10 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"traffic//udp/counters[@type="response-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"traffic//udp/counters[@type="response-size"]/counter[.>0]\">\n"
|
||||
" <h4>UDP Responses Sent</h4>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"traffic//udp/counters[@type="response-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"traffic//udp/counters[@type="response-size"]/counter[.>0]\">\n"
|
||||
" <xsl:variable name=\"css-class7\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -782,14 +708,10 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"traffic//tcp/counters[@type="request-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"traffic//tcp/counters[@type="request-size"]/counter[.>0]\">\n"
|
||||
" <h4>TCP Requests Received</h4>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"traffic//tcp/counters[@type="request-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"traffic//tcp/counters[@type="request-size"]/counter[.>0]\">\n"
|
||||
" <xsl:variable name=\"css-class7\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -809,14 +731,10 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"traffic//tcp/counters[@type="response-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"traffic//tcp/counters[@type="response-size"]/counter[.>0]\">\n"
|
||||
" <h4>TCP Responses Sent</h4>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"traffic//tcp/counters[@type="response-size"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"traffic//tcp/counters[@type="response-size"]/counter[.>0]\">\n"
|
||||
" <xsl:variable name=\"css-class7\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -836,14 +754,10 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"server/counters[@type="sockstat"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:if test=\"server/counters[@type="sockstat"]/counter[.>0]\">\n"
|
||||
" <h2>Socket I/O Statistics</h2>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"server/counters[@type="sockstat"]/"
|
||||
"counter[.>0]\">\n"
|
||||
" <xsl:for-each select=\"server/counters[@type="sockstat"]/counter[.>0]\">\n"
|
||||
" <xsl:variable name=\"css-class7\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -866,8 +780,7 @@ static char xslmsg[] =
|
||||
" <xsl:for-each select=\"views/view\">\n"
|
||||
" <h3>Zones for View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <table class=\"zones\">\n"
|
||||
" <thead><tr><th>Name</th><th>Class</th><th>Type</th><th>Serial</th></"
|
||||
"tr></thead>\n"
|
||||
" <thead><tr><th>Name</th><th>Class</th><th>Type</th><th>Serial</th></tr></thead>\n"
|
||||
" <tbody>\n"
|
||||
" <xsl:for-each select=\"zones/zone\">\n"
|
||||
" <xsl:variable name=\"css-class15\">\n"
|
||||
@@ -886,41 +799,31 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"views/view[zones/zone/counters[@type="qtype"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:if test=\"views/view[zones/zone/counters[@type="qtype"]/counter >0]\">\n"
|
||||
" <h2>Received QTYPES per view/zone</h2>\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"views/view[zones/zone/counters[@type="qtype"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:for-each select=\"views/view[zones/zone/counters[@type="qtype"]/counter >0]\">\n"
|
||||
" <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <xsl:variable name=\"thisview\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <xsl:for-each select=\"zones/zone\">\n"
|
||||
" <xsl:if test=\"counters[@type="qtype"]/counter[count(.) "
|
||||
"> 0]\">\n"
|
||||
" <xsl:if test=\"counters[@type="qtype"]/counter[count(.) > 0]\">\n"
|
||||
" <h4>Zone <xsl:value-of select=\"@name\"/></h4>\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
" graphs.push({\n"
|
||||
" 'title': \"Query types for zone <xsl:value-of select=\"@name\"/>\",\n"
|
||||
" 'target': 'chart_qtype_<xsl:value-of "
|
||||
"select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
|
||||
" 'target': 'chart_qtype_<xsl:value-of select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"counters[@type="qtype"]/counter[.>0 and @name "
|
||||
"!= "QryAuthAns"]\">['<xsl:value-of "
|
||||
"select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type="qtype"]/counter[.>0 and @name != "QryAuthAns"]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
"\n"
|
||||
" </script>\n"
|
||||
" <xsl:variable name=\"target\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <div class=\"pie\" id=\"chart_qtype_{$thisview}_{$target}\">[no data "
|
||||
"to display]</div>\n"
|
||||
" <div class=\"pie\" id=\"chart_qtype_{$thisview}_{$target}\">[no data to display]</div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="qtype"]/counter\">\n"
|
||||
@@ -945,47 +848,34 @@ static char xslmsg[] =
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"views/view[zones/zone/counters[@type="rcode"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:if test=\"views/view[zones/zone/counters[@type="rcode"]/counter >0]\">\n"
|
||||
" <h2>Response Codes per view/zone</h2>\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"views/view[zones/zone/counters[@type="rcode"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:for-each select=\"views/view[zones/zone/counters[@type="rcode"]/counter >0]\">\n"
|
||||
" <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <xsl:variable name=\"thisview2\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <xsl:for-each select=\"zones/zone\">\n"
|
||||
" <xsl:if test=\"counters[@type="rcode"]/counter[. > "
|
||||
"0]\">\n"
|
||||
" <xsl:if test=\"counters[@type="rcode"]/counter[. > 0]\">\n"
|
||||
" <h4>Zone <xsl:value-of select=\"@name\"/></h4>\n"
|
||||
" <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
|
||||
" <!-- Non Mozilla specific markup -->\n"
|
||||
" <script type=\"text/javascript\">\n"
|
||||
" graphs.push({\n"
|
||||
" 'title': \"Response codes for zone <xsl:value-of "
|
||||
"select=\"@name\"/>\",\n"
|
||||
" 'target': 'chart_rescode_<xsl:value-of "
|
||||
"select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
|
||||
" 'title': \"Response codes for zone <xsl:value-of select=\"@name\"/>\",\n"
|
||||
" 'target': 'chart_rescode_<xsl:value-of select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
|
||||
" 'style': 'barchart',\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each "
|
||||
"select=\"counters[@type="rcode"]/counter[.>0 and @name "
|
||||
"!= "QryAuthAns"]\">['<xsl:value-of "
|
||||
"select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type="rcode"]/counter[.>0 and @name != "QryAuthAns"]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
|
||||
" });\n"
|
||||
"\n"
|
||||
" </script>\n"
|
||||
" <xsl:variable name=\"target\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <div class=\"pie\" id=\"chart_rescode_{$thisview2}_{$target}\">[no "
|
||||
"data to display]</div>\n"
|
||||
" <div class=\"pie\" id=\"chart_rescode_{$thisview2}_{$target}\">[no data to display]</div>\n"
|
||||
" </xsl:if>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="rcode"]/counter[.>0 and @name "
|
||||
"!= "QryAuthAns"]\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="rcode"]/counter[.>0 and @name != "QryAuthAns"]\">\n"
|
||||
" <xsl:sort select=\".\"/>\n"
|
||||
" <xsl:variable name=\"css-class11\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -1007,24 +897,18 @@ static char xslmsg[] =
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:for-each>\n"
|
||||
" </xsl:if>\n"
|
||||
" <xsl:if "
|
||||
"test=\"views/view[zones/zone/counters[@type="gluecache"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:if test=\"views/view[zones/zone/counters[@type="gluecache"]/counter >0]\">\n"
|
||||
" <h2>Glue cache statistics</h2>\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"views/view[zones/zone/counters[@type="gluecache"]/"
|
||||
"counter >0]\">\n"
|
||||
" <xsl:for-each select=\"views/view[zones/zone/counters[@type="gluecache"]/counter >0]\">\n"
|
||||
" <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
|
||||
" <xsl:variable name=\"thisview2\">\n"
|
||||
" <xsl:value-of select=\"@name\"/>\n"
|
||||
" </xsl:variable>\n"
|
||||
" <xsl:for-each select=\"zones/zone\">\n"
|
||||
" <xsl:if test=\"counters[@type="gluecache"]/counter[. > "
|
||||
"0]\">\n"
|
||||
" <xsl:if test=\"counters[@type="gluecache"]/counter[. > 0]\">\n"
|
||||
" <h4>Zone <xsl:value-of select=\"@name\"/></h4>\n"
|
||||
" <table class=\"counters\">\n"
|
||||
" <xsl:for-each "
|
||||
"select=\"counters[@type="gluecache"]/counter[. > 0]\">\n"
|
||||
" <xsl:for-each select=\"counters[@type="gluecache"]/counter[. > 0]\">\n"
|
||||
" <xsl:sort select=\".\"/>\n"
|
||||
" <xsl:variable name=\"css-class11\">\n"
|
||||
" <xsl:choose>\n"
|
||||
@@ -1214,8 +1098,7 @@ static char xslmsg[] =
|
||||
" <th>LoWater</th>\n"
|
||||
" </tr>\n"
|
||||
" <xsl:for-each select=\"memory/contexts/context\">\n"
|
||||
" <xsl:sort select=\"total\" data-type=\"number\" "
|
||||
"order=\"descending\"/>\n"
|
||||
" <xsl:sort select=\"total\" data-type=\"number\" order=\"descending\"/>\n"
|
||||
" <xsl:variable name=\"css-class14\">\n"
|
||||
" <xsl:choose>\n"
|
||||
" <xsl:when test=\"position() mod 2 = 0\">even</xsl:when>\n"
|
||||
@@ -1264,8 +1147,7 @@ static char xslmsg[] =
|
||||
" </table>\n"
|
||||
" </xsl:if>\n"
|
||||
" <hr/>\n"
|
||||
" <p class=\"footer\">Internet Systems Consortium Inc.<br/><a "
|
||||
"href=\"http://www.isc.org\">http://www.isc.org</a></p>\n"
|
||||
" <p class=\"footer\">Internet Systems Consortium Inc.<br/><a href=\"http://www.isc.org\">http://www.isc.org</a></p>\n"
|
||||
" </body>\n"
|
||||
" </html>\n"
|
||||
" </xsl:template>\n"
|
||||
|
||||
+149
-169
@@ -9,13 +9,14 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file
|
||||
* \brief
|
||||
* The built-in "version", "hostname", "id", "authors" and "empty" databases.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
@@ -27,23 +28,17 @@
|
||||
|
||||
#include <named/builtin.h>
|
||||
#include <named/globals.h>
|
||||
#include <named/os.h>
|
||||
#include <named/server.h>
|
||||
#include <named/os.h>
|
||||
|
||||
typedef struct builtin builtin_t;
|
||||
|
||||
static isc_result_t
|
||||
do_version_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_hostname_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_authors_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_id_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_empty_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_dns64_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_version_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_hostname_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_authors_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_id_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_empty_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_dns64_lookup(dns_sdblookup_t *lookup);
|
||||
|
||||
/*
|
||||
* We can't use function pointers as the db_data directly
|
||||
@@ -57,7 +52,7 @@ struct builtin {
|
||||
char *contact;
|
||||
};
|
||||
|
||||
static builtin_t version_builtin = { do_version_lookup, NULL, NULL };
|
||||
static builtin_t version_builtin = { do_version_lookup, NULL, NULL };
|
||||
static builtin_t hostname_builtin = { do_hostname_lookup, NULL, NULL };
|
||||
static builtin_t authors_builtin = { do_authors_lookup, NULL, NULL };
|
||||
static builtin_t id_builtin = { do_id_lookup, NULL, NULL };
|
||||
@@ -71,22 +66,22 @@ static dns_sdbimplementation_t *dns64_impl;
|
||||
* Pre computed HEX * 16 or 1 table.
|
||||
*/
|
||||
static const unsigned char hex16[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*00*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*20*/
|
||||
0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 1, 1, 1, 1, 1, 1, /*30*/
|
||||
1, 160, 176, 192, 208, 224, 240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*50*/
|
||||
1, 160, 176, 192, 208, 224, 240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*60*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*70*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*A0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*B0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*C0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*D0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*E0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /*F0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*00*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*20*/
|
||||
0, 16, 32, 48, 64, 80, 96,112,128,144, 1, 1, 1, 1, 1, 1, /*30*/
|
||||
1,160,176,192,208,224,240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*50*/
|
||||
1,160,176,192,208,224,240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*60*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*70*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*A0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*B0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*C0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*D0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*E0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /*F0*/
|
||||
};
|
||||
|
||||
const unsigned char decimal[] = "0123456789";
|
||||
@@ -97,20 +92,16 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
|
||||
|
||||
for (i = 0; i < 4U; i++) {
|
||||
unsigned char c = v[start++];
|
||||
if (start == 7U) {
|
||||
if (start == 7U)
|
||||
start++;
|
||||
}
|
||||
if (c > 99) {
|
||||
rdata[j++] = 3;
|
||||
rdata[j++] = decimal[c / 100];
|
||||
c = c % 100;
|
||||
rdata[j++] = decimal[c / 10];
|
||||
c = c % 10;
|
||||
rdata[j++] = decimal[c/100]; c = c % 100;
|
||||
rdata[j++] = decimal[c/10]; c = c % 10;
|
||||
rdata[j++] = decimal[c];
|
||||
} else if (c > 9) {
|
||||
rdata[j++] = 2;
|
||||
rdata[j++] = decimal[c / 10];
|
||||
c = c % 10;
|
||||
rdata[j++] = decimal[c/10]; c = c % 10;
|
||||
rdata[j++] = decimal[c];
|
||||
} else {
|
||||
rdata[j++] = 1;
|
||||
@@ -123,7 +114,8 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
|
||||
|
||||
static isc_result_t
|
||||
dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
dns_sdblookup_t *lookup) {
|
||||
dns_sdblookup_t *lookup)
|
||||
{
|
||||
size_t zlen, nlen, j, len;
|
||||
unsigned char v[16], n;
|
||||
unsigned int i;
|
||||
@@ -140,9 +132,8 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
*/
|
||||
zlen = zone->length;
|
||||
nlen = name->length;
|
||||
if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U) {
|
||||
if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
/*
|
||||
* We assume the zone name is well formed.
|
||||
@@ -165,15 +156,13 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
j = nlen;
|
||||
memset(v, 0, sizeof(v));
|
||||
while (j != 0U) {
|
||||
INSIST((i / 2) < sizeof(v));
|
||||
if (ndata[0] != 1) {
|
||||
INSIST((i/2) < sizeof(v));
|
||||
if (ndata[0] != 1)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
n = hex16[ndata[1] & 0xff];
|
||||
if (n == 1) {
|
||||
n = hex16[ndata[1]&0xff];
|
||||
if (n == 1)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
v[i / 2] = n | (v[i / 2] >> 4);
|
||||
v[i/2] = n | (v[i/2]>>4);
|
||||
j -= 2;
|
||||
ndata += 2;
|
||||
i++;
|
||||
@@ -185,101 +174,90 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
* it corresponds to a empty node in the zone or there should be
|
||||
* a CNAME.
|
||||
*/
|
||||
#define ZLEN(x) (10 + (x) / 2)
|
||||
#define ZLEN(x) (10 + (x)/2)
|
||||
switch (zlen) {
|
||||
case ZLEN(32): /* prefix len 32 */
|
||||
case ZLEN(32): /* prefix len 32 */
|
||||
/*
|
||||
* The nibbles that map to this byte must be zero for 'name'
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 16U && v[(nlen - 1) / 4 - 4] != 0) {
|
||||
if (nlen > 16U && v[(nlen-1)/4 - 4] != 0)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 8, rdata);
|
||||
break;
|
||||
case ZLEN(40): /* prefix len 40 */
|
||||
case ZLEN(40): /* prefix len 40 */
|
||||
/*
|
||||
* The nibbles that map to this byte must be zero for 'name'
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 12U && v[(nlen - 1) / 4 - 3] != 0) {
|
||||
if (nlen > 12U && v[(nlen-1)/4 - 3] != 0)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 6, rdata);
|
||||
break;
|
||||
case ZLEN(48): /* prefix len 48 */
|
||||
case ZLEN(48): /* prefix len 48 */
|
||||
/*
|
||||
* The nibbles that map to this byte must be zero for 'name'
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 8U && v[(nlen - 1) / 4 - 2] != 0) {
|
||||
if (nlen > 8U && v[(nlen-1)/4 - 2] != 0)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 5, rdata);
|
||||
break;
|
||||
case ZLEN(56): /* prefix len 56 */
|
||||
case ZLEN(56): /* prefix len 56 */
|
||||
/*
|
||||
* The nibbles that map to this byte must be zero for 'name'
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 4U && v[(nlen - 1) / 4 - 1] != 0) {
|
||||
if (nlen > 4U && v[(nlen-1)/4 - 1] != 0)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 4, rdata);
|
||||
break;
|
||||
case ZLEN(64): /* prefix len 64 */
|
||||
case ZLEN(64): /* prefix len 64 */
|
||||
/*
|
||||
* The nibbles that map to this byte must be zero for 'name'
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (v[(nlen - 1) / 4] != 0) {
|
||||
if (v[(nlen-1)/4] != 0)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 3, rdata);
|
||||
break;
|
||||
case ZLEN(96): /* prefix len 96 */
|
||||
case ZLEN(96): /* prefix len 96 */
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
if (nlen + zlen != 74U)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 0, rdata);
|
||||
break;
|
||||
default:
|
||||
@@ -289,50 +267,49 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
*/
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
return (dns_sdb_putrdata(lookup, dns_rdatatype_cname, 600, rdata,
|
||||
(unsigned int)len));
|
||||
return (dns_sdb_putrdata(lookup, dns_rdatatype_cname, 600,
|
||||
rdata, (unsigned int)len));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
builtin_lookup(const char *zone, const char *name, void *dbdata,
|
||||
dns_sdblookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
builtin_t *b = (builtin_t *)dbdata;
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
builtin_t *b = (builtin_t *) dbdata;
|
||||
|
||||
UNUSED(zone);
|
||||
UNUSED(methods);
|
||||
UNUSED(clientinfo);
|
||||
|
||||
if (strcmp(name, "@") == 0) {
|
||||
if (strcmp(name, "@") == 0)
|
||||
return (b->do_lookup(lookup));
|
||||
} else {
|
||||
else
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
dns64_lookup(const dns_name_t *zone, const dns_name_t *name, void *dbdata,
|
||||
dns_sdblookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
builtin_t *b = (builtin_t *)dbdata;
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
builtin_t *b = (builtin_t *) dbdata;
|
||||
|
||||
UNUSED(methods);
|
||||
UNUSED(clientinfo);
|
||||
|
||||
if (name->labels == 0 && name->length == 0) {
|
||||
if (name->labels == 0 && name->length == 0)
|
||||
return (b->do_lookup(lookup));
|
||||
} else {
|
||||
else
|
||||
return (dns64_cname(zone, name, lookup));
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
put_txt(dns_sdblookup_t *lookup, const char *text) {
|
||||
unsigned char buf[256];
|
||||
unsigned int len = strlen(text);
|
||||
if (len > 255) {
|
||||
if (len > 255)
|
||||
len = 255; /* Silently truncate */
|
||||
}
|
||||
buf[0] = len;
|
||||
memmove(&buf[1], text, len);
|
||||
return (dns_sdb_putrdata(lookup, dns_rdatatype_txt, 0, buf, len + 1));
|
||||
@@ -341,11 +318,10 @@ put_txt(dns_sdblookup_t *lookup, const char *text) {
|
||||
static isc_result_t
|
||||
do_version_lookup(dns_sdblookup_t *lookup) {
|
||||
if (named_g_server->version_set) {
|
||||
if (named_g_server->version == NULL) {
|
||||
if (named_g_server->version == NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
else
|
||||
return (put_txt(lookup, named_g_server->version));
|
||||
}
|
||||
} else {
|
||||
return (put_txt(lookup, named_g_version));
|
||||
}
|
||||
@@ -354,17 +330,15 @@ do_version_lookup(dns_sdblookup_t *lookup) {
|
||||
static isc_result_t
|
||||
do_hostname_lookup(dns_sdblookup_t *lookup) {
|
||||
if (named_g_server->hostname_set) {
|
||||
if (named_g_server->hostname == NULL) {
|
||||
if (named_g_server->hostname == NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
else
|
||||
return (put_txt(lookup, named_g_server->hostname));
|
||||
}
|
||||
} else {
|
||||
char buf[256];
|
||||
isc_result_t result = named_os_gethostname(buf, sizeof(buf));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
return (put_txt(lookup, buf));
|
||||
}
|
||||
}
|
||||
@@ -374,27 +348,39 @@ do_authors_lookup(dns_sdblookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
const char **p;
|
||||
static const char *authors[] = {
|
||||
"Mark Andrews", "Curtis Blackburn", "James Brister",
|
||||
"Ben Cottrell", "John H. DuBois III", "Francis Dupont",
|
||||
"Michael Graff", "Andreas Gustafsson", "Bob Halley",
|
||||
"Evan Hunt", "JINMEI Tatuya", "Witold Krecicki",
|
||||
"David Lawrence", "Scott Mann", "Danny Mayer",
|
||||
"Damien Neil", "Matt Nelson", "Jeremy C. Reed",
|
||||
"Michael Sawyer", "Brian Wellington", NULL
|
||||
"Mark Andrews",
|
||||
"Curtis Blackburn",
|
||||
"James Brister",
|
||||
"Ben Cottrell",
|
||||
"John H. DuBois III",
|
||||
"Francis Dupont",
|
||||
"Michael Graff",
|
||||
"Andreas Gustafsson",
|
||||
"Bob Halley",
|
||||
"Evan Hunt",
|
||||
"JINMEI Tatuya",
|
||||
"Witold Krecicki",
|
||||
"David Lawrence",
|
||||
"Scott Mann",
|
||||
"Danny Mayer",
|
||||
"Damien Neil",
|
||||
"Matt Nelson",
|
||||
"Jeremy C. Reed",
|
||||
"Michael Sawyer",
|
||||
"Brian Wellington",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* If a version string is specified, disable the authors.bind zone.
|
||||
*/
|
||||
if (named_g_server->version_set) {
|
||||
if (named_g_server->version_set)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
for (p = authors; *p != NULL; p++) {
|
||||
result = put_txt(lookup, *p);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -406,15 +392,13 @@ do_id_lookup(dns_sdblookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
|
||||
result = named_g_server->sctx->gethostname(buf, sizeof(buf));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
return (put_txt(lookup, buf));
|
||||
} else if (named_g_server->sctx->server_id != NULL) {
|
||||
} else if (named_g_server->sctx->server_id != NULL)
|
||||
return (put_txt(lookup, named_g_server->sctx->server_id));
|
||||
} else {
|
||||
else
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -425,6 +409,7 @@ do_dns64_lookup(dns_sdblookup_t *lookup) {
|
||||
|
||||
static isc_result_t
|
||||
do_empty_lookup(dns_sdblookup_t *lookup) {
|
||||
|
||||
UNUSED(lookup);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -434,7 +419,7 @@ builtin_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
const char *contact = "hostmaster";
|
||||
const char *server = "@";
|
||||
builtin_t *b = (builtin_t *)dbdata;
|
||||
builtin_t *b = (builtin_t *) dbdata;
|
||||
|
||||
UNUSED(zone);
|
||||
UNUSED(dbdata);
|
||||
@@ -443,53 +428,48 @@ builtin_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
|
||||
server = ".";
|
||||
contact = ".";
|
||||
} else {
|
||||
if (b->server != NULL) {
|
||||
if (b->server != NULL)
|
||||
server = b->server;
|
||||
}
|
||||
if (b->contact != NULL) {
|
||||
if (b->contact != NULL)
|
||||
contact = b->contact;
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_sdb_putsoa(lookup, server, contact, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
result = dns_sdb_putrr(lookup, "ns", 0, server);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
builtin_create(const char *zone, int argc, char **argv, void *driverdata,
|
||||
void **dbdata) {
|
||||
builtin_create(const char *zone, int argc, char **argv,
|
||||
void *driverdata, void **dbdata)
|
||||
{
|
||||
REQUIRE(argc >= 1);
|
||||
|
||||
UNUSED(zone);
|
||||
UNUSED(driverdata);
|
||||
|
||||
if (strcmp(argv[0], "empty") == 0 || strcmp(argv[0], "dns64") == 0) {
|
||||
if (argc != 3) {
|
||||
if (argc != 3)
|
||||
return (DNS_R_SYNTAX);
|
||||
}
|
||||
} else if (argc != 1) {
|
||||
} else if (argc != 1)
|
||||
return (DNS_R_SYNTAX);
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "version") == 0) {
|
||||
if (strcmp(argv[0], "version") == 0)
|
||||
*dbdata = &version_builtin;
|
||||
} else if (strcmp(argv[0], "hostname") == 0) {
|
||||
else if (strcmp(argv[0], "hostname") == 0)
|
||||
*dbdata = &hostname_builtin;
|
||||
} else if (strcmp(argv[0], "authors") == 0) {
|
||||
else if (strcmp(argv[0], "authors") == 0)
|
||||
*dbdata = &authors_builtin;
|
||||
} else if (strcmp(argv[0], "id") == 0) {
|
||||
else if (strcmp(argv[0], "id") == 0)
|
||||
*dbdata = &id_builtin;
|
||||
} else if (strcmp(argv[0], "empty") == 0 ||
|
||||
strcmp(argv[0], "dns64") == 0) {
|
||||
else if (strcmp(argv[0], "empty") == 0 ||
|
||||
strcmp(argv[0], "dns64") == 0) {
|
||||
builtin_t *empty;
|
||||
char *server;
|
||||
char *contact;
|
||||
@@ -501,42 +481,36 @@ builtin_create(const char *zone, int argc, char **argv, void *driverdata,
|
||||
server = isc_mem_strdup(named_g_mctx, argv[1]);
|
||||
contact = isc_mem_strdup(named_g_mctx, argv[2]);
|
||||
if (empty == NULL || server == NULL || contact == NULL) {
|
||||
if (strcmp(argv[0], "empty") == 0) {
|
||||
if (strcmp(argv[0], "empty") == 0)
|
||||
*dbdata = &empty_builtin;
|
||||
} else {
|
||||
else
|
||||
*dbdata = &dns64_builtin;
|
||||
}
|
||||
if (server != NULL) {
|
||||
if (server != NULL)
|
||||
isc_mem_free(named_g_mctx, server);
|
||||
}
|
||||
if (contact != NULL) {
|
||||
if (contact != NULL)
|
||||
isc_mem_free(named_g_mctx, contact);
|
||||
}
|
||||
if (empty != NULL) {
|
||||
if (empty != NULL)
|
||||
isc_mem_put(named_g_mctx, empty,
|
||||
sizeof(*empty));
|
||||
}
|
||||
sizeof (*empty));
|
||||
} else {
|
||||
if (strcmp(argv[0], "empty") == 0) {
|
||||
if (strcmp(argv[0], "empty") == 0)
|
||||
memmove(empty, &empty_builtin,
|
||||
sizeof(empty_builtin));
|
||||
} else {
|
||||
sizeof (empty_builtin));
|
||||
else
|
||||
memmove(empty, &dns64_builtin,
|
||||
sizeof(empty_builtin));
|
||||
}
|
||||
sizeof (empty_builtin));
|
||||
empty->server = server;
|
||||
empty->contact = contact;
|
||||
*dbdata = empty;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
builtin_destroy(const char *zone, void *driverdata, void **dbdata) {
|
||||
builtin_t *b = (builtin_t *)*dbdata;
|
||||
builtin_t *b = (builtin_t *) *dbdata;
|
||||
|
||||
UNUSED(zone);
|
||||
UNUSED(driverdata);
|
||||
@@ -547,38 +521,44 @@ builtin_destroy(const char *zone, void *driverdata, void **dbdata) {
|
||||
if (*dbdata == &version_builtin || *dbdata == &hostname_builtin ||
|
||||
*dbdata == &authors_builtin || *dbdata == &id_builtin ||
|
||||
*dbdata == &empty_builtin || *dbdata == &dns64_builtin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
isc_mem_free(named_g_mctx, b->server);
|
||||
isc_mem_free(named_g_mctx, b->contact);
|
||||
isc_mem_put(named_g_mctx, b, sizeof(*b));
|
||||
isc_mem_put(named_g_mctx, b, sizeof (*b));
|
||||
}
|
||||
|
||||
static dns_sdbmethods_t builtin_methods = {
|
||||
builtin_lookup, builtin_authority, NULL, /* allnodes */
|
||||
builtin_create, builtin_destroy, NULL
|
||||
builtin_lookup,
|
||||
builtin_authority,
|
||||
NULL, /* allnodes */
|
||||
builtin_create,
|
||||
builtin_destroy,
|
||||
NULL
|
||||
};
|
||||
|
||||
static dns_sdbmethods_t dns64_methods = {
|
||||
NULL, builtin_authority, NULL, /* allnodes */
|
||||
builtin_create, builtin_destroy, dns64_lookup,
|
||||
NULL,
|
||||
builtin_authority,
|
||||
NULL, /* allnodes */
|
||||
builtin_create,
|
||||
builtin_destroy,
|
||||
dns64_lookup,
|
||||
};
|
||||
|
||||
isc_result_t
|
||||
named_builtin_init(void) {
|
||||
RUNTIME_CHECK(dns_sdb_register("_builtin", &builtin_methods, NULL,
|
||||
DNS_SDBFLAG_RELATIVEOWNER |
|
||||
DNS_SDBFLAG_RELATIVERDATA,
|
||||
named_g_mctx,
|
||||
&builtin_impl) == ISC_R_SUCCESS);
|
||||
DNS_SDBFLAG_RELATIVERDATA,
|
||||
named_g_mctx, &builtin_impl)
|
||||
== ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_sdb_register("_dns64", &dns64_methods, NULL,
|
||||
DNS_SDBFLAG_RELATIVEOWNER |
|
||||
DNS_SDBFLAG_RELATIVERDATA |
|
||||
DNS_SDBFLAG_DNS64,
|
||||
named_g_mctx,
|
||||
&dns64_impl) == ISC_R_SUCCESS);
|
||||
DNS_SDBFLAG_RELATIVERDATA |
|
||||
DNS_SDBFLAG_DNS64,
|
||||
named_g_mctx, &dns64_impl)
|
||||
== ISC_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+149
-191
@@ -11,7 +11,6 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <bind.keys.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -27,6 +26,9 @@
|
||||
|
||||
#include <pk11/site.h>
|
||||
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/rdataclass.h>
|
||||
@@ -36,12 +38,11 @@
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#include <named/config.h>
|
||||
#include <named/globals.h>
|
||||
|
||||
#include <bind.keys.h>
|
||||
|
||||
/*% default configuration */
|
||||
static char defaultconf[] = "\
|
||||
options {\n\
|
||||
@@ -49,12 +50,12 @@ options {\n\
|
||||
automatic-interface-scan yes;\n\
|
||||
bindkeys-file \"" NAMED_SYSCONFDIR "/bind.keys\";\n\
|
||||
# blackhole {none;};\n"
|
||||
" cookie-algorithm siphash24;\n"
|
||||
" cookie-algorithm siphash24;\n"
|
||||
#ifndef WIN32
|
||||
" coresize default;\n\
|
||||
" coresize default;\n\
|
||||
datasize default;\n"
|
||||
#endif /* ifndef WIN32 */
|
||||
"\
|
||||
#endif
|
||||
"\
|
||||
# deallocate-on-exit <obsolete>;\n\
|
||||
# directory <none>\n\
|
||||
dnssec-policy \"none\";\n\
|
||||
@@ -62,16 +63,14 @@ options {\n\
|
||||
edns-udp-size 4096;\n\
|
||||
# fake-iquery <obsolete>;\n"
|
||||
#ifndef WIN32
|
||||
" files unlimited;\n"
|
||||
#endif /* ifndef WIN32 */
|
||||
" files unlimited;\n"
|
||||
#endif
|
||||
#if defined(HAVE_GEOIP2) && !defined(WIN32)
|
||||
" geoip-directory \"" MAXMINDDB_PREFIX "/share/"
|
||||
"GeoIP\";"
|
||||
"\n"
|
||||
" geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP\";\n"
|
||||
#elif defined(HAVE_GEOIP2)
|
||||
" geoip-directory \".\";\n"
|
||||
#endif /* if defined(HAVE_GEOIP2) && !defined(WIN32) */
|
||||
"\
|
||||
" geoip-directory \".\";\n"
|
||||
#endif
|
||||
"\
|
||||
# has-old-clients <obsolete>;\n\
|
||||
heartbeat-interval 60;\n\
|
||||
# host-statistics <obsolete>;\n\
|
||||
@@ -81,7 +80,6 @@ options {\n\
|
||||
listen-on-v6 {any;};\n\
|
||||
# lock-file \"" NAMED_LOCALSTATEDIR "/run/named/named.lock\";\n\
|
||||
match-mapped-addresses no;\n\
|
||||
max-ixfr-ratio 100%;\n\
|
||||
max-rsa-exponent-size 0; /* no limit */\n\
|
||||
max-udp-size 4096;\n\
|
||||
memstatistics-file \"named.memstats\";\n\
|
||||
@@ -109,9 +107,9 @@ options {\n\
|
||||
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
|
||||
session-keyname local-ddns;\n"
|
||||
#ifndef WIN32
|
||||
" stacksize default;\n"
|
||||
#endif /* ifndef WIN32 */
|
||||
" startup-notify-rate 20;\n\
|
||||
" stacksize default;\n"
|
||||
#endif
|
||||
" startup-notify-rate 20;\n\
|
||||
statistics-file \"named.stats\";\n\
|
||||
# statistics-interval <obsolete>;\n\
|
||||
tcp-advertised-timeout 300;\n\
|
||||
@@ -152,9 +150,9 @@ options {\n\
|
||||
dnssec-accept-expired no;\n\
|
||||
dnssec-validation " VALIDATION_DEFAULT "; \n"
|
||||
#ifdef HAVE_DNSTAP
|
||||
" dnstap-identity hostname;\n"
|
||||
#endif /* ifdef HAVE_DNSTAP */
|
||||
"\
|
||||
" dnstap-identity hostname;\n"
|
||||
#endif
|
||||
"\
|
||||
# fetch-glue <obsolete>;\n\
|
||||
fetch-quota-params 100 0.1 0.3 0.7;\n\
|
||||
fetches-per-server 0;\n\
|
||||
@@ -162,9 +160,9 @@ options {\n\
|
||||
glue-cache yes;\n\
|
||||
lame-ttl 600;\n"
|
||||
#ifdef HAVE_LMDB
|
||||
" lmdb-mapsize 32M;\n"
|
||||
#endif /* ifdef HAVE_LMDB */
|
||||
" max-cache-size 90%;\n\
|
||||
" lmdb-mapsize 32M;\n"
|
||||
#endif
|
||||
" max-cache-size 90%;\n\
|
||||
max-cache-ttl 604800; /* 1 week */\n\
|
||||
max-clients-per-query 100;\n\
|
||||
max-ncache-ttl 10800; /* 3 hours */\n\
|
||||
@@ -254,7 +252,7 @@ options {\n\
|
||||
};\n\
|
||||
"
|
||||
|
||||
"#\n\
|
||||
"#\n\
|
||||
# Zones in the \"_bind\" view are NOT counted in the count of zones.\n\
|
||||
#\n\
|
||||
view \"_bind\" chaos {\n\
|
||||
@@ -290,17 +288,17 @@ view \"_bind\" chaos {\n\
|
||||
};\n\
|
||||
};\n\
|
||||
"
|
||||
"#\n\
|
||||
"#\n\
|
||||
# Default trusted key(s), used if \n\
|
||||
# \"dnssec-validation auto;\" is set and\n\
|
||||
# sysconfdir/bind.keys doesn't exist).\n\
|
||||
#\n\
|
||||
# BEGIN DNSSEC KEYS\n"
|
||||
|
||||
/* Imported from bind.keys.h: */
|
||||
TRUST_ANCHORS
|
||||
/* Imported from bind.keys.h: */
|
||||
TRUST_ANCHORS
|
||||
|
||||
"# END MANAGED KEYS\n\
|
||||
"# END MANAGED KEYS\n\
|
||||
\n\
|
||||
masters " DEFAULT_IANA_ROOT_ZONE_MASTERS " {\n\
|
||||
2001:500:84::b; # b.root-servers.net\n\
|
||||
@@ -324,28 +322,29 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
|
||||
|
||||
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
|
||||
isc_buffer_add(&b, sizeof(defaultconf) - 1);
|
||||
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
|
||||
return (cfg_parse_buffer(parser, &b, __FILE__, 0,
|
||||
&cfg_type_namedconf,
|
||||
CFG_PCTX_NODEPRECATED, conf));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_get(cfg_obj_t const *const *maps, const char *name,
|
||||
const cfg_obj_t **obj) {
|
||||
named_config_get(cfg_obj_t const * const *maps, const char *name,
|
||||
const cfg_obj_t **obj)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL) {
|
||||
if (maps[i] == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_checknames_get(const cfg_obj_t **maps, const char *which,
|
||||
const cfg_obj_t **obj) {
|
||||
const cfg_obj_t **obj)
|
||||
{
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *checknames;
|
||||
const cfg_obj_t *type;
|
||||
@@ -353,12 +352,11 @@ named_checknames_get(const cfg_obj_t **maps, const char *which,
|
||||
int i;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL) {
|
||||
if (maps[i] == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
checknames = NULL;
|
||||
if (cfg_map_get(maps[i], "check-names", &checknames) ==
|
||||
ISC_R_SUCCESS) {
|
||||
if (cfg_map_get(maps[i], "check-names",
|
||||
&checknames) == ISC_R_SUCCESS) {
|
||||
/*
|
||||
* Zone map entry is not a list.
|
||||
*/
|
||||
@@ -367,16 +365,17 @@ named_checknames_get(const cfg_obj_t **maps, const char *which,
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
for (element = cfg_list_first(checknames);
|
||||
element != NULL; element = cfg_list_next(element))
|
||||
{
|
||||
element != NULL;
|
||||
element = cfg_list_next(element)) {
|
||||
value = cfg_listelt_value(element);
|
||||
type = cfg_tuple_get(value, "type");
|
||||
if (strcasecmp(cfg_obj_asstring(type), which) ==
|
||||
0) {
|
||||
if (strcasecmp(cfg_obj_asstring(type),
|
||||
which) == 0) {
|
||||
*obj = cfg_tuple_get(value, "mode");
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -386,16 +385,16 @@ named_config_listcount(const cfg_obj_t *list) {
|
||||
const cfg_listelt_t *e;
|
||||
int i = 0;
|
||||
|
||||
for (e = cfg_list_first(list); e != NULL; e = cfg_list_next(e)) {
|
||||
for (e = cfg_list_first(list); e != NULL; e = cfg_list_next(e))
|
||||
i++;
|
||||
}
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
dns_rdataclass_t *classp) {
|
||||
dns_rdataclass_t *classp)
|
||||
{
|
||||
isc_textregion_t r;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -406,16 +405,16 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
DE_CONST(cfg_obj_asstring(classobj), r.base);
|
||||
r.length = strlen(r.base);
|
||||
result = dns_rdataclass_fromtext(classp, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
cfg_obj_log(classobj, named_g_lctx, ISC_LOG_ERROR,
|
||||
"unknown class '%s'", r.base);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
|
||||
dns_rdatatype_t *typep) {
|
||||
dns_rdatatype_t *typep)
|
||||
{
|
||||
isc_textregion_t r;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -426,10 +425,9 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
|
||||
DE_CONST(cfg_obj_asstring(typeobj), r.base);
|
||||
r.length = strlen(r.base);
|
||||
result = dns_rdatatype_fromtext(typep, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
cfg_obj_log(typeobj, named_g_lctx, ISC_LOG_ERROR,
|
||||
"unknown type '%s'", r.base);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -439,10 +437,13 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
|
||||
const char *str;
|
||||
|
||||
str = cfg_obj_asstring(zonetypeobj);
|
||||
if (strcasecmp(str, "primary") == 0 || strcasecmp(str, "master") == 0) {
|
||||
if (strcasecmp(str, "primary") == 0 ||
|
||||
strcasecmp(str, "master") == 0)
|
||||
{
|
||||
ztype = dns_zone_master;
|
||||
} else if (strcasecmp(str, "secondary") == 0 ||
|
||||
strcasecmp(str, "slave") == 0) {
|
||||
strcasecmp(str, "slave") == 0)
|
||||
{
|
||||
ztype = dns_zone_slave;
|
||||
} else if (strcasecmp(str, "mirror") == 0) {
|
||||
ztype = dns_zone_mirror;
|
||||
@@ -461,9 +462,10 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
|
||||
|
||||
isc_result_t
|
||||
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
in_port_t defport, isc_mem_t *mctx,
|
||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||
uint32_t *countp) {
|
||||
in_port_t defport, isc_mem_t *mctx,
|
||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||
uint32_t *countp)
|
||||
{
|
||||
int count, i = 0;
|
||||
const cfg_obj_t *addrlist;
|
||||
const cfg_obj_t *portobj, *dscpobj;
|
||||
@@ -488,14 +490,13 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
"port '%u' out of range", val);
|
||||
return (ISC_R_RANGE);
|
||||
}
|
||||
port = (in_port_t)val;
|
||||
} else if (defport != 0) {
|
||||
port = (in_port_t) val;
|
||||
} else if (defport != 0)
|
||||
port = defport;
|
||||
} else {
|
||||
else {
|
||||
result = named_config_getport(config, &port);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
if (dscpsp != NULL) {
|
||||
@@ -516,7 +517,8 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
|
||||
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
|
||||
|
||||
for (element = cfg_list_first(addrlist); element != NULL;
|
||||
for (element = cfg_list_first(addrlist);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element), i++)
|
||||
{
|
||||
const cfg_obj_t *addr;
|
||||
@@ -526,30 +528,28 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
if (dscpsp != NULL) {
|
||||
isc_dscp_t innerdscp;
|
||||
innerdscp = cfg_obj_getdscp(addr);
|
||||
if (innerdscp == -1) {
|
||||
if (innerdscp == -1)
|
||||
innerdscp = dscp;
|
||||
}
|
||||
dscps[i] = innerdscp;
|
||||
}
|
||||
if (isc_sockaddr_getport(&addrs[i]) == 0) {
|
||||
if (isc_sockaddr_getport(&addrs[i]) == 0)
|
||||
isc_sockaddr_setport(&addrs[i], port);
|
||||
}
|
||||
}
|
||||
INSIST(i == count);
|
||||
|
||||
*addrsp = addrs;
|
||||
*countp = count;
|
||||
|
||||
if (dscpsp != NULL) {
|
||||
if (dscpsp != NULL)
|
||||
*dscpsp = dscps;
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
||||
isc_dscp_t **dscpsp, uint32_t count) {
|
||||
isc_dscp_t **dscpsp, uint32_t count)
|
||||
{
|
||||
INSIST(addrsp != NULL && *addrsp != NULL);
|
||||
INSIST(dscpsp == NULL || *dscpsp != NULL);
|
||||
|
||||
@@ -564,16 +564,17 @@ named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
||||
|
||||
isc_result_t
|
||||
named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
|
||||
const cfg_obj_t **ret) {
|
||||
const cfg_obj_t **ret)
|
||||
{
|
||||
isc_result_t result;
|
||||
const cfg_obj_t *masters = NULL;
|
||||
const cfg_listelt_t *elt;
|
||||
|
||||
result = cfg_map_get(cctx, "masters", &masters);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
for (elt = cfg_list_first(masters); elt != NULL;
|
||||
for (elt = cfg_list_first(masters);
|
||||
elt != NULL;
|
||||
elt = cfg_list_next(elt)) {
|
||||
const cfg_obj_t *list;
|
||||
const char *listname;
|
||||
@@ -591,7 +592,8 @@ named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
|
||||
|
||||
isc_result_t
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl)
|
||||
{
|
||||
uint32_t addrcount = 0, dscpcount = 0, keycount = 0, i = 0;
|
||||
uint32_t listcount = 0, l = 0, j;
|
||||
uint32_t stackcount = 0, pushed = 0;
|
||||
@@ -606,9 +608,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_sockaddr_t *addrs = NULL;
|
||||
isc_dscp_t *dscps = NULL;
|
||||
dns_name_t **keys = NULL;
|
||||
struct {
|
||||
const char *name;
|
||||
} *lists = NULL;
|
||||
struct { const char *name; } *lists = NULL;
|
||||
struct {
|
||||
const cfg_listelt_t *element;
|
||||
in_port_t port;
|
||||
@@ -627,16 +627,14 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
* Get system defaults.
|
||||
*/
|
||||
result = named_config_getport(config, &port);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = named_config_getdscp(config, &dscp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
newlist:
|
||||
newlist:
|
||||
addrlist = cfg_tuple_get(list, "addresses");
|
||||
portobj = cfg_tuple_get(list, "port");
|
||||
dscpobj = cfg_tuple_get(list, "dscp");
|
||||
@@ -649,7 +647,7 @@ newlist:
|
||||
result = ISC_R_RANGE;
|
||||
goto cleanup;
|
||||
}
|
||||
port = (in_port_t)val;
|
||||
port = (in_port_t) val;
|
||||
}
|
||||
|
||||
if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
|
||||
@@ -666,8 +664,11 @@ newlist:
|
||||
result = ISC_R_NOMEMORY;
|
||||
|
||||
element = cfg_list_first(addrlist);
|
||||
resume:
|
||||
for (; element != NULL; element = cfg_list_next(element)) {
|
||||
resume:
|
||||
for ( ;
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *addr;
|
||||
const cfg_obj_t *key;
|
||||
const char *keystr;
|
||||
@@ -683,7 +684,7 @@ resume:
|
||||
|
||||
/* Grow lists? */
|
||||
if (listcount == l) {
|
||||
void *tmp;
|
||||
void * tmp;
|
||||
uint32_t newlen = listcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
@@ -698,31 +699,26 @@ resume:
|
||||
listcount = newlen;
|
||||
}
|
||||
/* Seen? */
|
||||
for (j = 0; j < l; j++) {
|
||||
if (strcasecmp(lists[j].name, listname) == 0) {
|
||||
for (j = 0; j < l; j++)
|
||||
if (strcasecmp(lists[j].name, listname) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j < l) {
|
||||
if (j < l)
|
||||
continue;
|
||||
}
|
||||
tresult = named_config_getmastersdef(config, listname,
|
||||
&list);
|
||||
if (tresult == ISC_R_NOTFOUND) {
|
||||
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
|
||||
"masters \"%s\" not found",
|
||||
listname);
|
||||
"masters \"%s\" not found", listname);
|
||||
|
||||
result = tresult;
|
||||
goto cleanup;
|
||||
}
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
lists[l++].name = listname;
|
||||
/* Grow stack? */
|
||||
if (stackcount == pushed) {
|
||||
void *tmp;
|
||||
void * tmp;
|
||||
uint32_t newlen = stackcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
@@ -748,7 +744,7 @@ resume:
|
||||
}
|
||||
|
||||
if (i == addrcount) {
|
||||
void *tmp;
|
||||
void * tmp;
|
||||
uint32_t newlen = addrcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
@@ -784,18 +780,15 @@ resume:
|
||||
}
|
||||
|
||||
addrs[i] = *cfg_obj_assockaddr(addr);
|
||||
if (isc_sockaddr_getport(&addrs[i]) == 0) {
|
||||
if (isc_sockaddr_getport(&addrs[i]) == 0)
|
||||
isc_sockaddr_setport(&addrs[i], port);
|
||||
}
|
||||
dscps[i] = cfg_obj_getdscp(addr);
|
||||
if (dscps[i] == -1) {
|
||||
if (dscps[i] == -1)
|
||||
dscps[i] = dscp;
|
||||
}
|
||||
keys[i] = NULL;
|
||||
i++; /* Increment here so that cleanup on error works. */
|
||||
if (!cfg_obj_isstring(key)) {
|
||||
i++; /* Increment here so that cleanup on error works. */
|
||||
if (!cfg_obj_isstring(key))
|
||||
continue;
|
||||
}
|
||||
keys[i - 1] = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||
dns_name_init(keys[i - 1], NULL);
|
||||
|
||||
@@ -805,9 +798,8 @@ resume:
|
||||
dns_fixedname_init(&fname);
|
||||
result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
|
||||
dns_rootname, 0, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
dns_name_dup(dns_fixedname_name(&fname), mctx, keys[i - 1]);
|
||||
}
|
||||
if (pushed != 0) {
|
||||
@@ -818,7 +810,7 @@ resume:
|
||||
goto resume;
|
||||
}
|
||||
if (i < addrcount) {
|
||||
void *tmp;
|
||||
void * tmp;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = i * sizeof(isc_sockaddr_t);
|
||||
@@ -826,9 +818,8 @@ resume:
|
||||
if (i != 0) {
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
memmove(tmp, addrs, newsize);
|
||||
} else {
|
||||
} else
|
||||
tmp = NULL;
|
||||
}
|
||||
isc_mem_put(mctx, addrs, oldsize);
|
||||
addrs = tmp;
|
||||
addrcount = i;
|
||||
@@ -838,9 +829,8 @@ resume:
|
||||
if (i != 0) {
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
memmove(tmp, dscps, newsize);
|
||||
} else {
|
||||
} else
|
||||
tmp = NULL;
|
||||
}
|
||||
isc_mem_put(mctx, dscps, oldsize);
|
||||
dscps = tmp;
|
||||
dscpcount = i;
|
||||
@@ -849,21 +839,18 @@ resume:
|
||||
oldsize = keycount * sizeof(dns_name_t *);
|
||||
if (i != 0) {
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
memmove(tmp, keys, newsize);
|
||||
} else {
|
||||
memmove(tmp, keys, newsize);
|
||||
} else
|
||||
tmp = NULL;
|
||||
}
|
||||
isc_mem_put(mctx, keys, oldsize);
|
||||
keys = tmp;
|
||||
keycount = i;
|
||||
}
|
||||
|
||||
if (lists != NULL) {
|
||||
if (lists != NULL)
|
||||
isc_mem_put(mctx, lists, listcount * sizeof(*lists));
|
||||
}
|
||||
if (stack != NULL) {
|
||||
if (stack != NULL)
|
||||
isc_mem_put(mctx, stack, stackcount * sizeof(*stack));
|
||||
}
|
||||
|
||||
INSIST(dscpcount == addrcount);
|
||||
INSIST(keycount == addrcount);
|
||||
@@ -877,31 +864,25 @@ resume:
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (addrs != NULL) {
|
||||
cleanup:
|
||||
if (addrs != NULL)
|
||||
isc_mem_put(mctx, addrs, addrcount * sizeof(isc_sockaddr_t));
|
||||
}
|
||||
if (dscps != NULL) {
|
||||
if (dscps != NULL)
|
||||
isc_mem_put(mctx, dscps, dscpcount * sizeof(isc_dscp_t));
|
||||
}
|
||||
if (keys != NULL) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (keys[j] == NULL) {
|
||||
if (keys[j] == NULL)
|
||||
continue;
|
||||
}
|
||||
if (dns_name_dynamic(keys[j])) {
|
||||
if (dns_name_dynamic(keys[j]))
|
||||
dns_name_free(keys[j], mctx);
|
||||
}
|
||||
isc_mem_put(mctx, keys[j], sizeof(dns_name_t));
|
||||
}
|
||||
isc_mem_put(mctx, keys, keycount * sizeof(dns_name_t *));
|
||||
}
|
||||
if (lists != NULL) {
|
||||
if (lists != NULL)
|
||||
isc_mem_put(mctx, lists, listcount * sizeof(*lists));
|
||||
}
|
||||
if (stack != NULL) {
|
||||
if (stack != NULL)
|
||||
isc_mem_put(mctx, stack, stackcount * sizeof(*stack));
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -915,9 +896,8 @@ named_config_getport(const cfg_obj_t *config, in_port_t *portp) {
|
||||
|
||||
(void)cfg_map_get(config, "options", &options);
|
||||
i = 0;
|
||||
if (options != NULL) {
|
||||
if (options != NULL)
|
||||
maps[i++] = options;
|
||||
}
|
||||
maps[i++] = named_g_defaults;
|
||||
maps[i] = NULL;
|
||||
|
||||
@@ -940,9 +920,8 @@ named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp) {
|
||||
isc_result_t result;
|
||||
|
||||
(void)cfg_map_get(config, "options", &options);
|
||||
if (options == NULL) {
|
||||
if (options == NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
result = cfg_map_get(options, "dscp", &dscpobj);
|
||||
if (result != ISC_R_SUCCESS || dscpobj == NULL) {
|
||||
@@ -961,34 +940,33 @@ named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp) {
|
||||
|
||||
struct keyalgorithms {
|
||||
const char *str;
|
||||
enum { hmacnone,
|
||||
hmacmd5,
|
||||
hmacsha1,
|
||||
hmacsha224,
|
||||
hmacsha256,
|
||||
hmacsha384,
|
||||
hmacsha512 } hmac;
|
||||
enum { hmacnone, hmacmd5, hmacsha1, hmacsha224,
|
||||
hmacsha256, hmacsha384, hmacsha512 } hmac;
|
||||
unsigned int type;
|
||||
uint16_t size;
|
||||
} algorithms[] = { { "hmac-md5", hmacmd5, DST_ALG_HMACMD5, 128 },
|
||||
{ "hmac-md5.sig-alg.reg.int", hmacmd5, DST_ALG_HMACMD5, 0 },
|
||||
{ "hmac-md5.sig-alg.reg.int.", hmacmd5, DST_ALG_HMACMD5, 0 },
|
||||
{ "hmac-sha1", hmacsha1, DST_ALG_HMACSHA1, 160 },
|
||||
{ "hmac-sha224", hmacsha224, DST_ALG_HMACSHA224, 224 },
|
||||
{ "hmac-sha256", hmacsha256, DST_ALG_HMACSHA256, 256 },
|
||||
{ "hmac-sha384", hmacsha384, DST_ALG_HMACSHA384, 384 },
|
||||
{ "hmac-sha512", hmacsha512, DST_ALG_HMACSHA512, 512 },
|
||||
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 } };
|
||||
} algorithms[] = {
|
||||
{ "hmac-md5", hmacmd5, DST_ALG_HMACMD5, 128 },
|
||||
{ "hmac-md5.sig-alg.reg.int", hmacmd5, DST_ALG_HMACMD5, 0 },
|
||||
{ "hmac-md5.sig-alg.reg.int.", hmacmd5, DST_ALG_HMACMD5, 0 },
|
||||
{ "hmac-sha1", hmacsha1, DST_ALG_HMACSHA1, 160 },
|
||||
{ "hmac-sha224", hmacsha224, DST_ALG_HMACSHA224, 224 },
|
||||
{ "hmac-sha256", hmacsha256, DST_ALG_HMACSHA256, 256 },
|
||||
{ "hmac-sha384", hmacsha384, DST_ALG_HMACSHA384, 384 },
|
||||
{ "hmac-sha512", hmacsha512, DST_ALG_HMACSHA512, 512 },
|
||||
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||
uint16_t *digestbits) {
|
||||
uint16_t *digestbits)
|
||||
{
|
||||
return (named_config_getkeyalgorithm2(str, name, NULL, digestbits));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||
unsigned int *typep, uint16_t *digestbits) {
|
||||
unsigned int *typep, uint16_t *digestbits)
|
||||
{
|
||||
int i;
|
||||
size_t len = 0;
|
||||
uint16_t bits;
|
||||
@@ -999,57 +977,37 @@ named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||
if (strncasecmp(algorithms[i].str, str, len) == 0 &&
|
||||
(str[len] == '\0' ||
|
||||
(algorithms[i].size != 0 && str[len] == '-')))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (algorithms[i].str == NULL) {
|
||||
if (algorithms[i].str == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
if (str[len] == '-') {
|
||||
result = isc_parse_uint16(&bits, str + len + 1, 10);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
if (bits > algorithms[i].size) {
|
||||
if (bits > algorithms[i].size)
|
||||
return (ISC_R_RANGE);
|
||||
}
|
||||
} else if (algorithms[i].size == 0) {
|
||||
} else if (algorithms[i].size == 0)
|
||||
bits = 128;
|
||||
} else {
|
||||
else
|
||||
bits = algorithms[i].size;
|
||||
}
|
||||
|
||||
if (name != NULL) {
|
||||
switch (algorithms[i].hmac) {
|
||||
case hmacmd5:
|
||||
*name = dns_tsig_hmacmd5_name;
|
||||
break;
|
||||
case hmacsha1:
|
||||
*name = dns_tsig_hmacsha1_name;
|
||||
break;
|
||||
case hmacsha224:
|
||||
*name = dns_tsig_hmacsha224_name;
|
||||
break;
|
||||
case hmacsha256:
|
||||
*name = dns_tsig_hmacsha256_name;
|
||||
break;
|
||||
case hmacsha384:
|
||||
*name = dns_tsig_hmacsha384_name;
|
||||
break;
|
||||
case hmacsha512:
|
||||
*name = dns_tsig_hmacsha512_name;
|
||||
break;
|
||||
case hmacmd5: *name = dns_tsig_hmacmd5_name; break;
|
||||
case hmacsha1: *name = dns_tsig_hmacsha1_name; break;
|
||||
case hmacsha224: *name = dns_tsig_hmacsha224_name; break;
|
||||
case hmacsha256: *name = dns_tsig_hmacsha256_name; break;
|
||||
case hmacsha384: *name = dns_tsig_hmacsha384_name; break;
|
||||
case hmacsha512: *name = dns_tsig_hmacsha512_name; break;
|
||||
default:
|
||||
INSIST(0);
|
||||
ISC_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
if (typep != NULL) {
|
||||
if (typep != NULL)
|
||||
*typep = algorithms[i].type;
|
||||
}
|
||||
if (digestbits != NULL) {
|
||||
if (digestbits != NULL)
|
||||
*digestbits = bits;
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
+29
-37
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -34,7 +35,7 @@
|
||||
#include <named/server.h>
|
||||
#ifdef HAVE_LIBSCF
|
||||
#include <named/smf_globals.h>
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
#endif
|
||||
|
||||
static isc_result_t
|
||||
getcommand(isc_lex_t *lex, char **cmdp) {
|
||||
@@ -44,15 +45,13 @@ getcommand(isc_lex_t *lex, char **cmdp) {
|
||||
REQUIRE(cmdp != NULL && *cmdp == NULL);
|
||||
|
||||
result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_lex_ungettoken(lex, &token);
|
||||
|
||||
if (token.type != isc_tokentype_string) {
|
||||
if (token.type != isc_tokentype_string)
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
*cmdp = token.value.as_textregion.base;
|
||||
|
||||
@@ -70,7 +69,8 @@ command_compare(const char *str, const char *command) {
|
||||
*/
|
||||
isc_result_t
|
||||
named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
isc_buffer_t **text) {
|
||||
isc_buffer_t **text)
|
||||
{
|
||||
isccc_sexpr_t *data;
|
||||
char *cmdline = NULL;
|
||||
char *command = NULL;
|
||||
@@ -80,7 +80,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
isc_lex_t *lex = NULL;
|
||||
#ifdef HAVE_LIBSCF
|
||||
named_smf_want_disable = 0;
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
#endif
|
||||
|
||||
data = isccc_alist_lookup(message, "_data");
|
||||
if (!isccc_alist_alistp(data)) {
|
||||
@@ -99,21 +99,18 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
}
|
||||
|
||||
result = isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_buffer_init(&src, cmdline, strlen(cmdline));
|
||||
isc_buffer_add(&src, strlen(cmdline));
|
||||
result = isc_lex_openbuffer(lex, &src);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = getcommand(lex, &command);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare the 'command' parameter against all known control commands.
|
||||
@@ -132,7 +129,8 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
* restricted commands here. rndc nta is handled specially
|
||||
* below.
|
||||
*/
|
||||
if (readonly && !command_compare(command, NAMED_COMMAND_NTA) &&
|
||||
if (readonly &&
|
||||
!command_compare(command, NAMED_COMMAND_NTA) &&
|
||||
!command_compare(command, NAMED_COMMAND_NULL) &&
|
||||
!command_compare(command, NAMED_COMMAND_STATUS) &&
|
||||
!command_compare(command, NAMED_COMMAND_SHOWZONE) &&
|
||||
@@ -142,15 +140,15 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, log_level,
|
||||
"rejecting restricted control channel "
|
||||
"command '%s'",
|
||||
cmdline);
|
||||
"command '%s'", cmdline);
|
||||
result = ISC_R_FAILURE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, log_level,
|
||||
"received control channel command '%s'", cmdline);
|
||||
"received control channel command '%s'",
|
||||
cmdline);
|
||||
|
||||
/*
|
||||
* After the lengthy "halt" and "stop", the commands are
|
||||
@@ -171,15 +169,14 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
* If we are managed by smf(5) but not in chroot,
|
||||
* try to disable ourselves the smf way.
|
||||
*/
|
||||
if (named_smf_got_instance == 1 && named_smf_chroot == 0) {
|
||||
if (named_smf_got_instance == 1 && named_smf_chroot == 0)
|
||||
named_smf_want_disable = 1;
|
||||
}
|
||||
/*
|
||||
* If named_smf_got_instance = 0, named_smf_chroot
|
||||
* is not relevant and we fall through to
|
||||
* isc_app_shutdown below.
|
||||
*/
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
#endif
|
||||
/* Do not flush master files */
|
||||
named_server_flushonshutdown(named_g_server, false);
|
||||
named_os_shutdownmsg(cmdline, *text);
|
||||
@@ -195,23 +192,20 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
result = named_smf_add_message(text);
|
||||
goto cleanup;
|
||||
}
|
||||
if (named_smf_got_instance == 1 && named_smf_chroot == 0) {
|
||||
if (named_smf_got_instance == 1 && named_smf_chroot == 0)
|
||||
named_smf_want_disable = 1;
|
||||
}
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
#endif
|
||||
named_server_flushonshutdown(named_g_server, true);
|
||||
named_os_shutdownmsg(cmdline, *text);
|
||||
isc_app_shutdown();
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NAMED_COMMAND_ADDZONE) ||
|
||||
command_compare(command, NAMED_COMMAND_MODZONE))
|
||||
{
|
||||
command_compare(command, NAMED_COMMAND_MODZONE)) {
|
||||
result = named_server_changezone(named_g_server, cmdline, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_DELZONE)) {
|
||||
result = named_server_delzone(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_DNSTAP) ||
|
||||
command_compare(command, NAMED_COMMAND_DNSTAPREOPEN))
|
||||
{
|
||||
command_compare(command, NAMED_COMMAND_DNSTAPREOPEN)) {
|
||||
result = named_server_dnstap(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
|
||||
named_server_dumpdb(named_g_server, lex, text);
|
||||
@@ -227,8 +221,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
} else if (command_compare(command, NAMED_COMMAND_FREEZE)) {
|
||||
result = named_server_freeze(named_g_server, true, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_LOADKEYS) ||
|
||||
command_compare(command, NAMED_COMMAND_SIGN))
|
||||
{
|
||||
command_compare(command, NAMED_COMMAND_SIGN)) {
|
||||
result = named_server_rekey(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_MKEYS)) {
|
||||
result = named_server_mkeys(named_g_server, lex, text);
|
||||
@@ -253,8 +246,8 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
} else if (command_compare(command, NAMED_COMMAND_RELOAD)) {
|
||||
result = named_server_reloadcommand(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RETRANSFER)) {
|
||||
result = named_server_retransfercommand(named_g_server, lex,
|
||||
text);
|
||||
result = named_server_retransfercommand(named_g_server,
|
||||
lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_SCAN)) {
|
||||
named_server_scan_interfaces(named_g_server);
|
||||
result = ISC_R_SUCCESS;
|
||||
@@ -275,8 +268,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
} else if (command_compare(command, NAMED_COMMAND_TESTGEN)) {
|
||||
result = named_server_testgen(lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_THAW) ||
|
||||
command_compare(command, NAMED_COMMAND_UNFREEZE))
|
||||
{
|
||||
command_compare(command, NAMED_COMMAND_UNFREEZE)) {
|
||||
result = named_server_freeze(named_g_server, false, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_TIMERPOKE)) {
|
||||
isc_timermgr_poke(named_g_timermgr);
|
||||
@@ -294,14 +286,14 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
} else {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
|
||||
"unknown control channel command '%s'", command);
|
||||
"unknown control channel command '%s'",
|
||||
command);
|
||||
result = DNS_R_UNKNOWNCOMMAND;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (lex != NULL) {
|
||||
cleanup:
|
||||
if (lex != NULL)
|
||||
isc_lex_destroy(&lex);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
+238
-291
File diff suppressed because it is too large
Load Diff
+127
-118
@@ -15,25 +15,24 @@
|
||||
#include <named/fuzz.h>
|
||||
|
||||
#ifdef ENABLE_AFL
|
||||
#include <arpa/inet.h>
|
||||
#include <named/globals.h>
|
||||
#include <named/server.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <named/log.h>
|
||||
#include <dns/log.h>
|
||||
|
||||
#include <named/globals.h>
|
||||
#include <named/log.h>
|
||||
#include <named/server.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* We are using pthreads directly because we might be using it with
|
||||
@@ -72,7 +71,7 @@ fuzz_thread_client(void *arg) {
|
||||
*port = 0;
|
||||
++port;
|
||||
|
||||
memset(&servaddr, 0, sizeof(servaddr));
|
||||
memset(&servaddr, 0, sizeof (servaddr));
|
||||
servaddr.sin_family = AF_INET;
|
||||
RUNTIME_CHECK(inet_pton(AF_INET, host, &servaddr.sin_addr) == 1);
|
||||
servaddr.sin_port = htons(atoi(port));
|
||||
@@ -99,9 +98,9 @@ fuzz_thread_client(void *arg) {
|
||||
*/
|
||||
#ifdef __AFL_LOOP
|
||||
for (int loop = 0; loop < 100000; loop++) {
|
||||
#else /* ifdef __AFL_LOOP */
|
||||
#else
|
||||
{
|
||||
#endif /* ifdef __AFL_LOOP */
|
||||
#endif
|
||||
ssize_t length;
|
||||
ssize_t sent;
|
||||
|
||||
@@ -136,7 +135,7 @@ fuzz_thread_client(void *arg) {
|
||||
ready = false;
|
||||
|
||||
sent = sendto(sockfd, buf, length, 0,
|
||||
(struct sockaddr *)&servaddr, sizeof(servaddr));
|
||||
(struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||
RUNTIME_CHECK(sent == length);
|
||||
|
||||
/*
|
||||
@@ -145,12 +144,11 @@ fuzz_thread_client(void *arg) {
|
||||
*/
|
||||
(void)recvfrom(sockfd, buf, 65536, MSG_DONTWAIT, NULL, NULL);
|
||||
|
||||
while (!ready) {
|
||||
while (!ready)
|
||||
pthread_cond_wait(&cond, &mutex);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0);
|
||||
next:;
|
||||
next: ;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
@@ -187,12 +185,14 @@ fuzz_thread_resolver(void *arg) {
|
||||
* EDNS and DO=1. 0x88, 0x0c at the start is the ID field which
|
||||
* will be updated for each query.
|
||||
*/
|
||||
char respacket[] = { 0x88, 0x0c, 0x01, 0x20, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x0a, 0x61, 0x61, 0x61,
|
||||
0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x07,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00,
|
||||
0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x29, 0x10,
|
||||
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 };
|
||||
char respacket[] = {
|
||||
0x88, 0x0c, 0x01, 0x20, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x0a, 0x61, 0x61, 0x61,
|
||||
0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x07,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00,
|
||||
0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x29, 0x10,
|
||||
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
|
||||
};
|
||||
/*
|
||||
* Response for example./DNSKEY in wire format. Note that RRSIGs
|
||||
* were generated with this DNSKEY that are used as seeds for
|
||||
@@ -202,66 +202,81 @@ fuzz_thread_resolver(void *arg) {
|
||||
* which will be made to match the query.
|
||||
*/
|
||||
const uint8_t dnskey_wf[] = {
|
||||
0x8d, 0xf6, 0x84, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00,
|
||||
0x00, 0x01, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
|
||||
0x00, 0x00, 0x30, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x30, 0x00,
|
||||
0x01, 0x00, 0x00, 0x01, 0x2c, 0x01, 0x08, 0x01, 0x00, 0x03,
|
||||
0x08, 0x03, 0x01, 0x00, 0x01, 0xbd, 0x81, 0xdc, 0x7f, 0x16,
|
||||
0xd4, 0x81, 0x7c, 0x1f, 0x9f, 0x6a, 0x68, 0xdd, 0xd4, 0xda,
|
||||
0x48, 0xd9, 0x1c, 0xbd, 0xa6, 0x46, 0x1a, 0xf0, 0xb4, 0xb9,
|
||||
0xec, 0x3d, 0x6c, 0x0b, 0x57, 0xc7, 0xd6, 0x54, 0x66, 0xe6,
|
||||
0x6c, 0xd5, 0x90, 0x3a, 0x78, 0x7d, 0x7f, 0x78, 0x80, 0xa2,
|
||||
0x89, 0x61, 0x6d, 0x8a, 0x2b, 0xcd, 0x0a, 0x77, 0x7a, 0xad,
|
||||
0xc9, 0x61, 0x53, 0x53, 0x8c, 0x99, 0x72, 0x86, 0x14, 0x74,
|
||||
0x9c, 0x49, 0x2a, 0x47, 0x23, 0xf7, 0x02, 0x07, 0x73, 0x1c,
|
||||
0x5c, 0x2e, 0xb4, 0x9a, 0xa4, 0xd7, 0x98, 0x42, 0xc3, 0xd2,
|
||||
0xfe, 0xbf, 0xf3, 0xb3, 0x6a, 0x52, 0x92, 0xd5, 0xfa, 0x47,
|
||||
0x00, 0xe3, 0xd9, 0x59, 0x31, 0x95, 0x48, 0x40, 0xfc, 0x06,
|
||||
0x73, 0x90, 0xc6, 0x73, 0x96, 0xba, 0x29, 0x91, 0xe2, 0xac,
|
||||
0xa3, 0xa5, 0x6d, 0x91, 0x6d, 0x52, 0xb9, 0x34, 0xba, 0x68,
|
||||
0x4f, 0xad, 0xf0, 0xc3, 0xf3, 0x1d, 0x6d, 0x61, 0x76, 0xe5,
|
||||
0x3d, 0xa3, 0x9b, 0x2a, 0x0c, 0x92, 0xb3, 0x78, 0x6b, 0xf1,
|
||||
0x20, 0xd6, 0x90, 0xb7, 0xac, 0xe2, 0xf8, 0x2b, 0x94, 0x10,
|
||||
0x79, 0xce, 0xa8, 0x60, 0x42, 0xea, 0x6a, 0x18, 0x2f, 0xc0,
|
||||
0xd8, 0x05, 0x0a, 0x3b, 0x06, 0x0f, 0x02, 0x7e, 0xff, 0x33,
|
||||
0x46, 0xee, 0xb6, 0x21, 0x25, 0x90, 0x63, 0x4b, 0x3b, 0x5e,
|
||||
0xb2, 0x72, 0x3a, 0xcb, 0x91, 0x41, 0xf4, 0x20, 0x50, 0x78,
|
||||
0x1c, 0x93, 0x95, 0xda, 0xfa, 0xae, 0x85, 0xc5, 0xd7, 0x6b,
|
||||
0x92, 0x0c, 0x70, 0x6b, 0xe4, 0xb7, 0x29, 0x3a, 0x2e, 0x18,
|
||||
0x88, 0x82, 0x33, 0x7c, 0xa8, 0xea, 0xb8, 0x31, 0x8f, 0xaf,
|
||||
0x50, 0xc5, 0x9c, 0x08, 0x56, 0x8f, 0x09, 0x76, 0x4e, 0xdf,
|
||||
0x97, 0x75, 0x9d, 0x00, 0x52, 0x7f, 0xdb, 0xec, 0x30, 0xcb,
|
||||
0x1c, 0x4c, 0x2a, 0x21, 0x93, 0xc4, 0x6d, 0x85, 0xa9, 0x40,
|
||||
0x3b, 0xc0, 0x0c, 0x00, 0x2e, 0x00, 0x01, 0x00, 0x00, 0x01,
|
||||
0x2c, 0x01, 0x1b, 0x00, 0x30, 0x08, 0x01, 0x00, 0x00, 0x01,
|
||||
0x2c, 0x67, 0x74, 0x85, 0x80, 0x58, 0xb3, 0xc5, 0x17, 0x36,
|
||||
0x90, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00,
|
||||
0x45, 0xac, 0xd3, 0x82, 0x69, 0xf3, 0x10, 0x3a, 0x97, 0x2c,
|
||||
0x6a, 0xa9, 0x78, 0x99, 0xea, 0xb0, 0xcc, 0xf7, 0xaf, 0x33,
|
||||
0x51, 0x5b, 0xdf, 0x77, 0x04, 0x18, 0x14, 0x99, 0x61, 0xeb,
|
||||
0x8d, 0x76, 0x3f, 0xd1, 0x71, 0x14, 0x43, 0x80, 0x53, 0xc2,
|
||||
0x3b, 0x9f, 0x09, 0x4f, 0xb3, 0x51, 0x04, 0x89, 0x0e, 0xc8,
|
||||
0x54, 0x12, 0xcd, 0x07, 0x20, 0xbe, 0x94, 0xc2, 0xda, 0x99,
|
||||
0xdd, 0x1e, 0xf8, 0xb0, 0x84, 0x2e, 0xf9, 0x19, 0x35, 0x36,
|
||||
0xf5, 0xd0, 0x5d, 0x82, 0x18, 0x74, 0xa0, 0x00, 0xb6, 0x15,
|
||||
0x57, 0x40, 0x5f, 0x78, 0x2d, 0x27, 0xac, 0xc7, 0x8a, 0x29,
|
||||
0x55, 0xa9, 0xcd, 0xbc, 0xf7, 0x3e, 0xff, 0xae, 0x1a, 0x5a,
|
||||
0x1d, 0xac, 0x0d, 0x78, 0x0e, 0x08, 0x33, 0x6c, 0x59, 0x70,
|
||||
0x40, 0xb9, 0x65, 0xbd, 0x35, 0xbb, 0x9a, 0x70, 0xdc, 0x93,
|
||||
0x66, 0xb0, 0xef, 0xfe, 0xf0, 0x32, 0xa6, 0xee, 0xb7, 0x03,
|
||||
0x89, 0xa2, 0x4d, 0xe0, 0xf1, 0x20, 0xdf, 0x39, 0xe8, 0xe3,
|
||||
0xcc, 0x95, 0xe9, 0x9a, 0xad, 0xbf, 0xbd, 0x7c, 0xf7, 0xd7,
|
||||
0xde, 0x47, 0x9e, 0xf6, 0x17, 0xbb, 0x84, 0xa9, 0xed, 0xf2,
|
||||
0x45, 0x61, 0x6d, 0x13, 0x0b, 0x06, 0x29, 0x50, 0xde, 0xfd,
|
||||
0x42, 0xb0, 0x66, 0x2c, 0x1c, 0x2b, 0x63, 0xcb, 0x4e, 0xb9,
|
||||
0x31, 0xc4, 0xea, 0xd2, 0x07, 0x3a, 0x08, 0x79, 0x19, 0x4b,
|
||||
0x4c, 0x50, 0x97, 0x02, 0xd7, 0x26, 0x41, 0x2f, 0xdd, 0x57,
|
||||
0xaa, 0xb0, 0xa0, 0x21, 0x4e, 0x74, 0xb6, 0x97, 0x4b, 0x8b,
|
||||
0x09, 0x9c, 0x3d, 0x29, 0xfb, 0x12, 0x27, 0x47, 0x8f, 0xb8,
|
||||
0xc5, 0x8e, 0x65, 0xcd, 0xca, 0x2f, 0xba, 0xf5, 0x3e, 0xec,
|
||||
0x56, 0xc3, 0xc9, 0xa1, 0x62, 0x7d, 0xf2, 0x9f, 0x90, 0x16,
|
||||
0x1d, 0xbf, 0x97, 0x28, 0xe1, 0x92, 0xb1, 0x53, 0xab, 0xc4,
|
||||
0xe0, 0x99, 0xbb, 0x19, 0x90, 0x7c, 0x00, 0x00, 0x29, 0x10,
|
||||
0x8d, 0xf6, 0x84, 0x00, 0x00, 0x01, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x01, 0x07, 0x65, 0x78, 0x61,
|
||||
0x6d, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x30, 0x00,
|
||||
0x01, 0xc0, 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00,
|
||||
0x00, 0x01, 0x2c, 0x01, 0x08, 0x01, 0x00, 0x03,
|
||||
0x08, 0x03, 0x01, 0x00, 0x01, 0xbd, 0x81, 0xdc,
|
||||
0x7f, 0x16, 0xd4, 0x81, 0x7c, 0x1f, 0x9f, 0x6a,
|
||||
0x68, 0xdd, 0xd4, 0xda, 0x48, 0xd9, 0x1c, 0xbd,
|
||||
0xa6, 0x46, 0x1a, 0xf0, 0xb4, 0xb9, 0xec, 0x3d,
|
||||
0x6c, 0x0b, 0x57, 0xc7, 0xd6, 0x54, 0x66, 0xe6,
|
||||
0x6c, 0xd5, 0x90, 0x3a, 0x78, 0x7d, 0x7f, 0x78,
|
||||
0x80, 0xa2, 0x89, 0x61, 0x6d, 0x8a, 0x2b, 0xcd,
|
||||
0x0a, 0x77, 0x7a, 0xad, 0xc9, 0x61, 0x53, 0x53,
|
||||
0x8c, 0x99, 0x72, 0x86, 0x14, 0x74, 0x9c, 0x49,
|
||||
0x2a, 0x47, 0x23, 0xf7, 0x02, 0x07, 0x73, 0x1c,
|
||||
0x5c, 0x2e, 0xb4, 0x9a, 0xa4, 0xd7, 0x98, 0x42,
|
||||
0xc3, 0xd2, 0xfe, 0xbf, 0xf3, 0xb3, 0x6a, 0x52,
|
||||
0x92, 0xd5, 0xfa, 0x47, 0x00, 0xe3, 0xd9, 0x59,
|
||||
0x31, 0x95, 0x48, 0x40, 0xfc, 0x06, 0x73, 0x90,
|
||||
0xc6, 0x73, 0x96, 0xba, 0x29, 0x91, 0xe2, 0xac,
|
||||
0xa3, 0xa5, 0x6d, 0x91, 0x6d, 0x52, 0xb9, 0x34,
|
||||
0xba, 0x68, 0x4f, 0xad, 0xf0, 0xc3, 0xf3, 0x1d,
|
||||
0x6d, 0x61, 0x76, 0xe5, 0x3d, 0xa3, 0x9b, 0x2a,
|
||||
0x0c, 0x92, 0xb3, 0x78, 0x6b, 0xf1, 0x20, 0xd6,
|
||||
0x90, 0xb7, 0xac, 0xe2, 0xf8, 0x2b, 0x94, 0x10,
|
||||
0x79, 0xce, 0xa8, 0x60, 0x42, 0xea, 0x6a, 0x18,
|
||||
0x2f, 0xc0, 0xd8, 0x05, 0x0a, 0x3b, 0x06, 0x0f,
|
||||
0x02, 0x7e, 0xff, 0x33, 0x46, 0xee, 0xb6, 0x21,
|
||||
0x25, 0x90, 0x63, 0x4b, 0x3b, 0x5e, 0xb2, 0x72,
|
||||
0x3a, 0xcb, 0x91, 0x41, 0xf4, 0x20, 0x50, 0x78,
|
||||
0x1c, 0x93, 0x95, 0xda, 0xfa, 0xae, 0x85, 0xc5,
|
||||
0xd7, 0x6b, 0x92, 0x0c, 0x70, 0x6b, 0xe4, 0xb7,
|
||||
0x29, 0x3a, 0x2e, 0x18, 0x88, 0x82, 0x33, 0x7c,
|
||||
0xa8, 0xea, 0xb8, 0x31, 0x8f, 0xaf, 0x50, 0xc5,
|
||||
0x9c, 0x08, 0x56, 0x8f, 0x09, 0x76, 0x4e, 0xdf,
|
||||
0x97, 0x75, 0x9d, 0x00, 0x52, 0x7f, 0xdb, 0xec,
|
||||
0x30, 0xcb, 0x1c, 0x4c, 0x2a, 0x21, 0x93, 0xc4,
|
||||
0x6d, 0x85, 0xa9, 0x40, 0x3b, 0xc0, 0x0c, 0x00,
|
||||
0x2e, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x01,
|
||||
0x1b, 0x00, 0x30, 0x08, 0x01, 0x00, 0x00, 0x01,
|
||||
0x2c, 0x67, 0x74, 0x85, 0x80, 0x58, 0xb3, 0xc5,
|
||||
0x17, 0x36, 0x90, 0x07, 0x65, 0x78, 0x61, 0x6d,
|
||||
0x70, 0x6c, 0x65, 0x00, 0x45, 0xac, 0xd3, 0x82,
|
||||
0x69, 0xf3, 0x10, 0x3a, 0x97, 0x2c, 0x6a, 0xa9,
|
||||
0x78, 0x99, 0xea, 0xb0, 0xcc, 0xf7, 0xaf, 0x33,
|
||||
0x51, 0x5b, 0xdf, 0x77, 0x04, 0x18, 0x14, 0x99,
|
||||
0x61, 0xeb, 0x8d, 0x76, 0x3f, 0xd1, 0x71, 0x14,
|
||||
0x43, 0x80, 0x53, 0xc2, 0x3b, 0x9f, 0x09, 0x4f,
|
||||
0xb3, 0x51, 0x04, 0x89, 0x0e, 0xc8, 0x54, 0x12,
|
||||
0xcd, 0x07, 0x20, 0xbe, 0x94, 0xc2, 0xda, 0x99,
|
||||
0xdd, 0x1e, 0xf8, 0xb0, 0x84, 0x2e, 0xf9, 0x19,
|
||||
0x35, 0x36, 0xf5, 0xd0, 0x5d, 0x82, 0x18, 0x74,
|
||||
0xa0, 0x00, 0xb6, 0x15, 0x57, 0x40, 0x5f, 0x78,
|
||||
0x2d, 0x27, 0xac, 0xc7, 0x8a, 0x29, 0x55, 0xa9,
|
||||
0xcd, 0xbc, 0xf7, 0x3e, 0xff, 0xae, 0x1a, 0x5a,
|
||||
0x1d, 0xac, 0x0d, 0x78, 0x0e, 0x08, 0x33, 0x6c,
|
||||
0x59, 0x70, 0x40, 0xb9, 0x65, 0xbd, 0x35, 0xbb,
|
||||
0x9a, 0x70, 0xdc, 0x93, 0x66, 0xb0, 0xef, 0xfe,
|
||||
0xf0, 0x32, 0xa6, 0xee, 0xb7, 0x03, 0x89, 0xa2,
|
||||
0x4d, 0xe0, 0xf1, 0x20, 0xdf, 0x39, 0xe8, 0xe3,
|
||||
0xcc, 0x95, 0xe9, 0x9a, 0xad, 0xbf, 0xbd, 0x7c,
|
||||
0xf7, 0xd7, 0xde, 0x47, 0x9e, 0xf6, 0x17, 0xbb,
|
||||
0x84, 0xa9, 0xed, 0xf2, 0x45, 0x61, 0x6d, 0x13,
|
||||
0x0b, 0x06, 0x29, 0x50, 0xde, 0xfd, 0x42, 0xb0,
|
||||
0x66, 0x2c, 0x1c, 0x2b, 0x63, 0xcb, 0x4e, 0xb9,
|
||||
0x31, 0xc4, 0xea, 0xd2, 0x07, 0x3a, 0x08, 0x79,
|
||||
0x19, 0x4b, 0x4c, 0x50, 0x97, 0x02, 0xd7, 0x26,
|
||||
0x41, 0x2f, 0xdd, 0x57, 0xaa, 0xb0, 0xa0, 0x21,
|
||||
0x4e, 0x74, 0xb6, 0x97, 0x4b, 0x8b, 0x09, 0x9c,
|
||||
0x3d, 0x29, 0xfb, 0x12, 0x27, 0x47, 0x8f, 0xb8,
|
||||
0xc5, 0x8e, 0x65, 0xcd, 0xca, 0x2f, 0xba, 0xf5,
|
||||
0x3e, 0xec, 0x56, 0xc3, 0xc9, 0xa1, 0x62, 0x7d,
|
||||
0xf2, 0x9f, 0x90, 0x16, 0x1d, 0xbf, 0x97, 0x28,
|
||||
0xe1, 0x92, 0xb1, 0x53, 0xab, 0xc4, 0xe0, 0x99,
|
||||
0xbb, 0x19, 0x90, 0x7c, 0x00, 0x00, 0x29, 0x10,
|
||||
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
@@ -311,12 +326,12 @@ fuzz_thread_resolver(void *arg) {
|
||||
respacket[32] = (qtype >> 8) & 0xff;
|
||||
respacket[33] = qtype & 0xff;
|
||||
|
||||
memset(&servaddr, 0, sizeof(servaddr));
|
||||
memset(&servaddr, 0, sizeof (servaddr));
|
||||
servaddr.sin_family = AF_INET;
|
||||
RUNTIME_CHECK(inet_pton(AF_INET, shost, &servaddr.sin_addr) == 1);
|
||||
servaddr.sin_port = htons(atoi(sport));
|
||||
|
||||
memset(&recaddr, 0, sizeof(recaddr));
|
||||
memset(&recaddr, 0, sizeof (recaddr));
|
||||
recaddr.sin_family = AF_INET;
|
||||
RUNTIME_CHECK(inet_pton(AF_INET, rhost, &recaddr.sin_addr) == 1);
|
||||
recaddr.sin_port = htons(atoi(rport));
|
||||
@@ -380,7 +395,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
}
|
||||
|
||||
if (length < 12) {
|
||||
length = 12;
|
||||
length = 12;
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||
@@ -398,7 +413,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
*/
|
||||
socklen = sizeof(recvaddr);
|
||||
(void)recvfrom(listenfd, rbuf, 65536, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&recvaddr, &socklen);
|
||||
(struct sockaddr *) &recvaddr, &socklen);
|
||||
|
||||
/*
|
||||
* Send a fixed client query to named(resolver) of
|
||||
@@ -406,7 +421,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
* driver.
|
||||
*/
|
||||
sent = sendto(sockfd, respacket, sizeof(respacket), 0,
|
||||
(struct sockaddr *)&servaddr, sizeof(servaddr));
|
||||
(struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||
RUNTIME_CHECK(sent == sizeof(respacket));
|
||||
|
||||
/*
|
||||
@@ -417,7 +432,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
*/
|
||||
socklen = sizeof(recvaddr);
|
||||
sent = recvfrom(listenfd, rbuf, 65536, 0,
|
||||
(struct sockaddr *)&recvaddr, &socklen);
|
||||
(struct sockaddr *) &recvaddr, &socklen);
|
||||
RUNTIME_CHECK(sent > 0);
|
||||
|
||||
/*
|
||||
@@ -447,11 +462,10 @@ fuzz_thread_resolver(void *arg) {
|
||||
|
||||
/* Skip the name to get to the qtype */
|
||||
i = 0;
|
||||
while (((llen = nameptr[i]) != 0) && (i < 255) &&
|
||||
while (((llen = nameptr[i]) != 0) &&
|
||||
(i < 255) &&
|
||||
(((nameptr + i + 1 + llen) - buf) < length))
|
||||
{
|
||||
i += 1 + llen;
|
||||
}
|
||||
|
||||
if (i <= 255) {
|
||||
nameptr += 1 + i;
|
||||
@@ -471,7 +485,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
* Send the reply to named(resolver).
|
||||
*/
|
||||
sent = sendto(listenfd, buf, length, 0,
|
||||
(struct sockaddr *)&recvaddr, sizeof(recvaddr));
|
||||
(struct sockaddr *) &recvaddr, sizeof(recvaddr));
|
||||
RUNTIME_CHECK(sent == length);
|
||||
|
||||
/* We might get additional questions here (e.g. for CNAME). */
|
||||
@@ -486,7 +500,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
FD_SET(sockfd, &fds);
|
||||
tv.tv_sec = 10;
|
||||
tv.tv_usec = 0;
|
||||
max = (listenfd > sockfd ? listenfd : sockfd) + 1;
|
||||
max = (listenfd > sockfd ? listenfd : sockfd)+1;
|
||||
|
||||
rv = select(max, &fds, NULL, NULL, &tv);
|
||||
RUNTIME_CHECK(rv > 0);
|
||||
@@ -508,8 +522,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
* NOERROR rcode and sending it back.
|
||||
*/
|
||||
length = recvfrom(listenfd, buf, 65536, 0,
|
||||
(struct sockaddr *)&recvaddr,
|
||||
&socklen);
|
||||
(struct sockaddr *) &recvaddr, &socklen);
|
||||
|
||||
/*
|
||||
* If this is a DNSKEY query, send the DNSKEY,
|
||||
@@ -521,11 +534,10 @@ fuzz_thread_resolver(void *arg) {
|
||||
|
||||
/* Skip the name to get to the qtype */
|
||||
i = 0;
|
||||
while (((llen = nameptr[i]) != 0) && (i < 255) &&
|
||||
while (((llen = nameptr[i]) != 0) &&
|
||||
(i < 255) &&
|
||||
(((nameptr + i + 1 + llen) - buf) < length))
|
||||
{
|
||||
i += 1 + llen;
|
||||
}
|
||||
|
||||
if (i <= 255) {
|
||||
nameptr += 1 + i;
|
||||
@@ -546,8 +558,8 @@ fuzz_thread_resolver(void *arg) {
|
||||
|
||||
if (qtype == 48) {
|
||||
memmove(buf + 2, dnskey_wf + 2,
|
||||
sizeof(dnskey_wf) - 2);
|
||||
length = sizeof(dnskey_wf);
|
||||
sizeof (dnskey_wf) - 2);
|
||||
length = sizeof (dnskey_wf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -555,14 +567,13 @@ fuzz_thread_resolver(void *arg) {
|
||||
buf[2] |= 0x80;
|
||||
buf[3] &= 0xF0;
|
||||
sent = sendto(listenfd, buf, length, 0,
|
||||
(struct sockaddr *)&recvaddr,
|
||||
(struct sockaddr *) &recvaddr,
|
||||
sizeof(recvaddr));
|
||||
RUNTIME_CHECK(sent == length);
|
||||
}
|
||||
|
||||
while (!ready) {
|
||||
while (!ready)
|
||||
pthread_cond_wait(&cond, &mutex);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0);
|
||||
}
|
||||
@@ -583,7 +594,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
* in persistent mode if it's present.
|
||||
*/
|
||||
__AFL_LOOP(0);
|
||||
#endif /* ifdef __AFL_LOOP */
|
||||
#endif
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -619,7 +630,7 @@ fuzz_thread_tcp(void *arg) {
|
||||
*port = 0;
|
||||
++port;
|
||||
|
||||
memset(&servaddr, 0, sizeof(servaddr));
|
||||
memset(&servaddr, 0, sizeof (servaddr));
|
||||
servaddr.sin_family = AF_INET;
|
||||
RUNTIME_CHECK(inet_pton(AF_INET, host, &servaddr.sin_addr) == 1);
|
||||
servaddr.sin_port = htons(atoi(port));
|
||||
@@ -652,7 +663,7 @@ fuzz_thread_tcp(void *arg) {
|
||||
* To fuzz DNS TCP client we have to put 16-bit
|
||||
* message length preceding the start of packet.
|
||||
*/
|
||||
length = read(0, buf + 2, 65535);
|
||||
length = read(0, buf+2, 65535);
|
||||
buf[0] = (length >> 8) & 0xff;
|
||||
buf[1] = length & 0xff;
|
||||
length += 2;
|
||||
@@ -672,10 +683,10 @@ fuzz_thread_tcp(void *arg) {
|
||||
* processed.
|
||||
*/
|
||||
INSIST(length <= 65535);
|
||||
buf[length++] = '\r';
|
||||
buf[length++] = '\n';
|
||||
buf[length++] = '\r';
|
||||
buf[length++] = '\n';
|
||||
buf[length++]='\r';
|
||||
buf[length++]='\n';
|
||||
buf[length++]='\r';
|
||||
buf[length++]='\n';
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||
@@ -685,15 +696,14 @@ fuzz_thread_tcp(void *arg) {
|
||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
RUNTIME_CHECK(sockfd != -1);
|
||||
RUNTIME_CHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes,
|
||||
sizeof(int)) == 0);
|
||||
RUNTIME_CHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
|
||||
&yes, sizeof(int)) == 0);
|
||||
|
||||
do {
|
||||
r = connect(sockfd, (struct sockaddr *)&servaddr,
|
||||
r = connect(sockfd, (struct sockaddr*)&servaddr,
|
||||
sizeof(servaddr));
|
||||
if (r != 0) {
|
||||
if (r != 0)
|
||||
usleep(10000);
|
||||
}
|
||||
} while (r != 0);
|
||||
|
||||
/*
|
||||
@@ -704,9 +714,8 @@ fuzz_thread_tcp(void *arg) {
|
||||
|
||||
close(sockfd);
|
||||
|
||||
while (!ready) {
|
||||
while (!ready)
|
||||
pthread_cond_wait(&cond, &mutex);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0);
|
||||
}
|
||||
|
||||
+16
-14
@@ -13,7 +13,7 @@
|
||||
|
||||
#if defined(HAVE_GEOIP2)
|
||||
#include <maxminddb.h>
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
#endif
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include <dns/geoip.h>
|
||||
|
||||
#include <named/geoip.h>
|
||||
#include <named/log.h>
|
||||
#include <named/geoip.h>
|
||||
|
||||
static dns_geoip_databases_t geoip_table;
|
||||
|
||||
@@ -39,8 +39,8 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
|
||||
if (n >= sizeof(pathbuf)) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||
"GeoIP2 database '%s/%s': path too long", dir,
|
||||
dbfile);
|
||||
"GeoIP2 database '%s/%s': path too long",
|
||||
dir, dbfile);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -61,15 +61,16 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
|
||||
}
|
||||
#endif /* HAVE_GEOIP2 */
|
||||
|
||||
|
||||
void
|
||||
named_geoip_init(void) {
|
||||
#if defined(HAVE_GEOIP2)
|
||||
if (named_g_geoip == NULL) {
|
||||
named_g_geoip = &geoip_table;
|
||||
}
|
||||
#else /* if defined(HAVE_GEOIP2) */
|
||||
#else
|
||||
return;
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -84,11 +85,13 @@ named_geoip_load(char *dir) {
|
||||
named_g_geoip->country = open_geoip2(dir, "GeoIP2-Country.mmdb",
|
||||
&geoip_country);
|
||||
if (named_g_geoip->country == NULL) {
|
||||
named_g_geoip->country = open_geoip2(
|
||||
dir, "GeoLite2-Country.mmdb", &geoip_country);
|
||||
named_g_geoip->country = open_geoip2(dir,
|
||||
"GeoLite2-Country.mmdb",
|
||||
&geoip_country);
|
||||
}
|
||||
|
||||
named_g_geoip->city = open_geoip2(dir, "GeoIP2-City.mmdb", &geoip_city);
|
||||
named_g_geoip->city = open_geoip2(dir, "GeoIP2-City.mmdb",
|
||||
&geoip_city);
|
||||
if (named_g_geoip->city == NULL) {
|
||||
named_g_geoip->city = open_geoip2(dir, "GeoLite2-City.mmdb",
|
||||
&geoip_city);
|
||||
@@ -103,15 +106,14 @@ named_geoip_load(char *dir) {
|
||||
named_g_geoip->isp = open_geoip2(dir, "GeoIP2-ISP.mmdb", &geoip_isp);
|
||||
named_g_geoip->domain = open_geoip2(dir, "GeoIP2-Domain.mmdb",
|
||||
&geoip_domain);
|
||||
#else /* if defined(HAVE_GEOIP2) */
|
||||
#else
|
||||
UNUSED(dir);
|
||||
|
||||
return;
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
named_geoip_unload(void) {
|
||||
void named_geoip_unload(void) {
|
||||
#ifdef HAVE_GEOIP2
|
||||
if (named_g_geoip->country != NULL) {
|
||||
MMDB_close(named_g_geoip->country);
|
||||
@@ -133,7 +135,7 @@ named_geoip_unload(void) {
|
||||
MMDB_close(named_g_geoip->domain);
|
||||
named_g_geoip->domain = NULL;
|
||||
}
|
||||
#endif /* ifdef HAVE_GEOIP2 */
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../.clang-format.headers
|
||||
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DLZ_DLOPEN_DRIVER_H
|
||||
#define DLZ_DLOPEN_DRIVER_H
|
||||
|
||||
@@ -17,4 +18,4 @@ dlz_dlopen_init(isc_mem_t *mctx);
|
||||
|
||||
void
|
||||
dlz_dlopen_clear(void);
|
||||
#endif /* ifndef DLZ_DLOPEN_DRIVER_H */
|
||||
#endif
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
|
||||
#include <isc/types.h>
|
||||
|
||||
isc_result_t
|
||||
named_builtin_init(void);
|
||||
isc_result_t named_builtin_init(void);
|
||||
|
||||
void
|
||||
named_builtin_deinit(void);
|
||||
void named_builtin_deinit(void);
|
||||
|
||||
#endif /* NAMED_BUILTIN_H */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NAMED_CONFIG_H
|
||||
#define NAMED_CONFIG_H 1
|
||||
|
||||
@@ -16,47 +17,47 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <isccfg/cfg.h>
|
||||
|
||||
#include <dns/types.h>
|
||||
#include <dns/zone.h>
|
||||
|
||||
#include <isccfg/cfg.h>
|
||||
|
||||
#define DEFAULT_IANA_ROOT_ZONE_MASTERS "_default_iana_root_zone_masters"
|
||||
|
||||
isc_result_t
|
||||
named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf);
|
||||
|
||||
isc_result_t
|
||||
named_config_get(cfg_obj_t const *const *maps, const char *name,
|
||||
const cfg_obj_t **obj);
|
||||
named_config_get(cfg_obj_t const * const *maps, const char *name,
|
||||
const cfg_obj_t **obj);
|
||||
|
||||
isc_result_t
|
||||
named_checknames_get(const cfg_obj_t **maps, const char *name,
|
||||
const cfg_obj_t **obj);
|
||||
const cfg_obj_t **obj);
|
||||
|
||||
int
|
||||
named_config_listcount(const cfg_obj_t *list);
|
||||
|
||||
isc_result_t
|
||||
named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
dns_rdataclass_t *classp);
|
||||
dns_rdataclass_t *classp);
|
||||
|
||||
isc_result_t
|
||||
named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
|
||||
dns_rdatatype_t *typep);
|
||||
dns_rdatatype_t *typep);
|
||||
|
||||
dns_zonetype_t
|
||||
named_config_getzonetype(const cfg_obj_t *zonetypeobj);
|
||||
|
||||
isc_result_t
|
||||
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
in_port_t defport, isc_mem_t *mctx,
|
||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||
uint32_t *countp);
|
||||
in_port_t defport, isc_mem_t *mctx,
|
||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||
uint32_t *countp);
|
||||
|
||||
void
|
||||
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
||||
isc_dscp_t **dscpsp, uint32_t count);
|
||||
isc_dscp_t **dscpsp, uint32_t count);
|
||||
|
||||
isc_result_t
|
||||
named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
|
||||
@@ -64,17 +65,17 @@ named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
|
||||
|
||||
isc_result_t
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
|
||||
|
||||
isc_result_t
|
||||
named_config_getport(const cfg_obj_t *config, in_port_t *portp);
|
||||
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||
uint16_t *digestbits);
|
||||
uint16_t *digestbits);
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||
unsigned int *typep, uint16_t *digestbits);
|
||||
unsigned int *typep, uint16_t *digestbits);
|
||||
|
||||
isc_result_t
|
||||
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp);
|
||||
|
||||
@@ -19,56 +19,57 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isccc/types.h>
|
||||
|
||||
#include <isccfg/aclconf.h>
|
||||
|
||||
#include <isccc/types.h>
|
||||
#include <named/types.h>
|
||||
|
||||
#define NAMED_CONTROL_PORT 953
|
||||
#define NAMED_CONTROL_PORT 953
|
||||
|
||||
#define NAMED_COMMAND_STOP "stop"
|
||||
#define NAMED_COMMAND_HALT "halt"
|
||||
#define NAMED_COMMAND_RELOAD "reload"
|
||||
#define NAMED_COMMAND_RECONFIG "reconfig"
|
||||
#define NAMED_COMMAND_REFRESH "refresh"
|
||||
#define NAMED_COMMAND_RETRANSFER "retransfer"
|
||||
#define NAMED_COMMAND_DUMPSTATS "stats"
|
||||
#define NAMED_COMMAND_QUERYLOG "querylog"
|
||||
#define NAMED_COMMAND_DUMPDB "dumpdb"
|
||||
#define NAMED_COMMAND_SECROOTS "secroots"
|
||||
#define NAMED_COMMAND_TRACE "trace"
|
||||
#define NAMED_COMMAND_NOTRACE "notrace"
|
||||
#define NAMED_COMMAND_FLUSH "flush"
|
||||
#define NAMED_COMMAND_FLUSHNAME "flushname"
|
||||
#define NAMED_COMMAND_FLUSHTREE "flushtree"
|
||||
#define NAMED_COMMAND_STATUS "status"
|
||||
#define NAMED_COMMAND_TSIGLIST "tsig-list"
|
||||
#define NAMED_COMMAND_TSIGDELETE "tsig-delete"
|
||||
#define NAMED_COMMAND_FREEZE "freeze"
|
||||
#define NAMED_COMMAND_UNFREEZE "unfreeze"
|
||||
#define NAMED_COMMAND_THAW "thaw"
|
||||
#define NAMED_COMMAND_TIMERPOKE "timerpoke"
|
||||
#define NAMED_COMMAND_RECURSING "recursing"
|
||||
#define NAMED_COMMAND_NULL "null"
|
||||
#define NAMED_COMMAND_NOTIFY "notify"
|
||||
#define NAMED_COMMAND_VALIDATION "validation"
|
||||
#define NAMED_COMMAND_SCAN "scan"
|
||||
#define NAMED_COMMAND_SIGN "sign"
|
||||
#define NAMED_COMMAND_LOADKEYS "loadkeys"
|
||||
#define NAMED_COMMAND_ADDZONE "addzone"
|
||||
#define NAMED_COMMAND_MODZONE "modzone"
|
||||
#define NAMED_COMMAND_DELZONE "delzone"
|
||||
#define NAMED_COMMAND_SHOWZONE "showzone"
|
||||
#define NAMED_COMMAND_SYNC "sync"
|
||||
#define NAMED_COMMAND_SIGNING "signing"
|
||||
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
|
||||
#define NAMED_COMMAND_NTA "nta"
|
||||
#define NAMED_COMMAND_TESTGEN "testgen"
|
||||
#define NAMED_COMMAND_MKEYS "managed-keys"
|
||||
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
|
||||
#define NAMED_COMMAND_DNSTAP "dnstap"
|
||||
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
|
||||
#define NAMED_COMMAND_SERVESTALE "serve-stale"
|
||||
#define NAMED_COMMAND_STOP "stop"
|
||||
#define NAMED_COMMAND_HALT "halt"
|
||||
#define NAMED_COMMAND_RELOAD "reload"
|
||||
#define NAMED_COMMAND_RECONFIG "reconfig"
|
||||
#define NAMED_COMMAND_REFRESH "refresh"
|
||||
#define NAMED_COMMAND_RETRANSFER "retransfer"
|
||||
#define NAMED_COMMAND_DUMPSTATS "stats"
|
||||
#define NAMED_COMMAND_QUERYLOG "querylog"
|
||||
#define NAMED_COMMAND_DUMPDB "dumpdb"
|
||||
#define NAMED_COMMAND_SECROOTS "secroots"
|
||||
#define NAMED_COMMAND_TRACE "trace"
|
||||
#define NAMED_COMMAND_NOTRACE "notrace"
|
||||
#define NAMED_COMMAND_FLUSH "flush"
|
||||
#define NAMED_COMMAND_FLUSHNAME "flushname"
|
||||
#define NAMED_COMMAND_FLUSHTREE "flushtree"
|
||||
#define NAMED_COMMAND_STATUS "status"
|
||||
#define NAMED_COMMAND_TSIGLIST "tsig-list"
|
||||
#define NAMED_COMMAND_TSIGDELETE "tsig-delete"
|
||||
#define NAMED_COMMAND_FREEZE "freeze"
|
||||
#define NAMED_COMMAND_UNFREEZE "unfreeze"
|
||||
#define NAMED_COMMAND_THAW "thaw"
|
||||
#define NAMED_COMMAND_TIMERPOKE "timerpoke"
|
||||
#define NAMED_COMMAND_RECURSING "recursing"
|
||||
#define NAMED_COMMAND_NULL "null"
|
||||
#define NAMED_COMMAND_NOTIFY "notify"
|
||||
#define NAMED_COMMAND_VALIDATION "validation"
|
||||
#define NAMED_COMMAND_SCAN "scan"
|
||||
#define NAMED_COMMAND_SIGN "sign"
|
||||
#define NAMED_COMMAND_LOADKEYS "loadkeys"
|
||||
#define NAMED_COMMAND_ADDZONE "addzone"
|
||||
#define NAMED_COMMAND_MODZONE "modzone"
|
||||
#define NAMED_COMMAND_DELZONE "delzone"
|
||||
#define NAMED_COMMAND_SHOWZONE "showzone"
|
||||
#define NAMED_COMMAND_SYNC "sync"
|
||||
#define NAMED_COMMAND_SIGNING "signing"
|
||||
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
|
||||
#define NAMED_COMMAND_NTA "nta"
|
||||
#define NAMED_COMMAND_TESTGEN "testgen"
|
||||
#define NAMED_COMMAND_MKEYS "managed-keys"
|
||||
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
|
||||
#define NAMED_COMMAND_DNSTAP "dnstap"
|
||||
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
|
||||
#define NAMED_COMMAND_SERVESTALE "serve-stale"
|
||||
|
||||
isc_result_t
|
||||
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
|
||||
|
||||
@@ -16,142 +16,146 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/rwlock.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/netmgr.h>
|
||||
#include <isc/rwlock.h>
|
||||
|
||||
#include <dns/acl.h>
|
||||
#include <dns/zone.h>
|
||||
|
||||
#include <isccfg/aclconf.h>
|
||||
#include <isccfg/cfg.h>
|
||||
|
||||
#include <dns/acl.h>
|
||||
#include <dns/zone.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#include <named/fuzz.h>
|
||||
|
||||
#include <named/types.h>
|
||||
#include <named/fuzz.h>
|
||||
|
||||
#undef EXTERN
|
||||
#undef INIT
|
||||
#ifdef NAMED_MAIN
|
||||
#define EXTERN
|
||||
#define INIT(v) = (v)
|
||||
#else /* ifdef NAMED_MAIN */
|
||||
#define INIT(v) = (v)
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#define INIT(v)
|
||||
#endif /* ifdef NAMED_MAIN */
|
||||
#endif
|
||||
|
||||
#ifndef NAMED_RUN_PID_DIR
|
||||
#define NAMED_RUN_PID_DIR 1
|
||||
#endif /* ifndef NAMED_RUN_PID_DIR */
|
||||
#endif
|
||||
|
||||
EXTERN isc_mem_t *named_g_mctx INIT(NULL);
|
||||
EXTERN unsigned int named_g_cpus INIT(0);
|
||||
EXTERN unsigned int named_g_udpdisp INIT(0);
|
||||
EXTERN isc_taskmgr_t *named_g_taskmgr INIT(NULL);
|
||||
EXTERN dns_dispatchmgr_t *named_g_dispatchmgr INIT(NULL);
|
||||
EXTERN unsigned int named_g_cpus_detected INIT(1);
|
||||
EXTERN isc_mem_t * named_g_mctx INIT(NULL);
|
||||
EXTERN unsigned int named_g_cpus INIT(0);
|
||||
EXTERN unsigned int named_g_udpdisp INIT(0);
|
||||
EXTERN isc_taskmgr_t * named_g_taskmgr INIT(NULL);
|
||||
EXTERN dns_dispatchmgr_t * named_g_dispatchmgr INIT(NULL);
|
||||
EXTERN unsigned int named_g_cpus_detected INIT(1);
|
||||
|
||||
#ifdef ENABLE_AFL
|
||||
EXTERN bool named_g_run_done INIT(false);
|
||||
#endif /* ifdef ENABLE_AFL */
|
||||
EXTERN bool named_g_run_done INIT(false);
|
||||
#endif
|
||||
/*
|
||||
* XXXRTH We're going to want multiple timer managers eventually. One
|
||||
* for really short timers, another for client timers, and one
|
||||
* for zone timers.
|
||||
*/
|
||||
EXTERN isc_timermgr_t *named_g_timermgr INIT(NULL);
|
||||
EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL);
|
||||
EXTERN isc_nm_t *named_g_nm INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_parser INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
|
||||
EXTERN const char *named_g_version INIT(VERSION);
|
||||
EXTERN const char *named_g_product INIT(PRODUCT);
|
||||
EXTERN const char *named_g_description INIT(DESCRIPTION);
|
||||
EXTERN const char *named_g_srcid INIT(SRCID);
|
||||
EXTERN const char *named_g_configargs INIT(CONFIGARGS);
|
||||
EXTERN const char *named_g_builder INIT(BUILDER);
|
||||
EXTERN in_port_t named_g_port INIT(0);
|
||||
EXTERN isc_dscp_t named_g_dscp INIT(-1);
|
||||
EXTERN isc_timermgr_t * named_g_timermgr INIT(NULL);
|
||||
EXTERN isc_socketmgr_t * named_g_socketmgr INIT(NULL);
|
||||
EXTERN isc_nm_t * named_g_nm INIT(NULL);
|
||||
EXTERN cfg_parser_t * named_g_parser INIT(NULL);
|
||||
EXTERN cfg_parser_t * named_g_addparser INIT(NULL);
|
||||
EXTERN const char * named_g_version INIT(VERSION);
|
||||
EXTERN const char * named_g_product INIT(PRODUCT);
|
||||
EXTERN const char * named_g_description INIT(DESCRIPTION);
|
||||
EXTERN const char * named_g_srcid INIT(SRCID);
|
||||
EXTERN const char * named_g_configargs INIT(CONFIGARGS);
|
||||
EXTERN const char * named_g_builder INIT(BUILDER);
|
||||
EXTERN in_port_t named_g_port INIT(0);
|
||||
EXTERN isc_dscp_t named_g_dscp INIT(-1);
|
||||
|
||||
EXTERN named_server_t *named_g_server INIT(NULL);
|
||||
EXTERN named_server_t * named_g_server INIT(NULL);
|
||||
|
||||
/*
|
||||
* Logging.
|
||||
*/
|
||||
EXTERN isc_log_t *named_g_lctx INIT(NULL);
|
||||
EXTERN isc_logcategory_t *named_g_categories INIT(NULL);
|
||||
EXTERN isc_logmodule_t *named_g_modules INIT(NULL);
|
||||
EXTERN unsigned int named_g_debuglevel INIT(0);
|
||||
EXTERN isc_log_t * named_g_lctx INIT(NULL);
|
||||
EXTERN isc_logcategory_t * named_g_categories INIT(NULL);
|
||||
EXTERN isc_logmodule_t * named_g_modules INIT(NULL);
|
||||
EXTERN unsigned int named_g_debuglevel INIT(0);
|
||||
|
||||
/*
|
||||
* Current configuration information.
|
||||
*/
|
||||
EXTERN cfg_obj_t *named_g_config INIT(NULL);
|
||||
EXTERN const cfg_obj_t *named_g_defaults INIT(NULL);
|
||||
EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
|
||||
EXTERN const char *named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR "/bind.keys");
|
||||
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
|
||||
EXTERN cfg_obj_t * named_g_config INIT(NULL);
|
||||
EXTERN const cfg_obj_t * named_g_defaults INIT(NULL);
|
||||
EXTERN const char * named_g_conffile INIT(NAMED_SYSCONFDIR
|
||||
"/named.conf");
|
||||
EXTERN const char * named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR
|
||||
"/bind.keys");
|
||||
EXTERN const char * named_g_keyfile INIT(NAMED_SYSCONFDIR
|
||||
"/rndc.key");
|
||||
|
||||
EXTERN dns_tsigkey_t *named_g_sessionkey INIT(NULL);
|
||||
EXTERN dns_name_t named_g_sessionkeyname;
|
||||
EXTERN bool named_g_conffileset INIT(false);
|
||||
EXTERN cfg_aclconfctx_t *named_g_aclconfctx INIT(NULL);
|
||||
EXTERN dns_tsigkey_t * named_g_sessionkey INIT(NULL);
|
||||
EXTERN dns_name_t named_g_sessionkeyname;
|
||||
EXTERN bool named_g_conffileset INIT(false);
|
||||
EXTERN cfg_aclconfctx_t * named_g_aclconfctx INIT(NULL);
|
||||
|
||||
/*
|
||||
* Initial resource limits.
|
||||
*/
|
||||
EXTERN isc_resourcevalue_t named_g_initstacksize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initdatasize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initcoresize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initstacksize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initdatasize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initcoresize INIT(0);
|
||||
EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0);
|
||||
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
EXTERN bool named_g_coreok INIT(true);
|
||||
EXTERN const char *named_g_chrootdir INIT(NULL);
|
||||
EXTERN bool named_g_foreground INIT(false);
|
||||
EXTERN bool named_g_logstderr INIT(false);
|
||||
EXTERN bool named_g_nosyslog INIT(false);
|
||||
EXTERN const char *named_g_logfile INIT(NULL);
|
||||
EXTERN bool named_g_coreok INIT(true);
|
||||
EXTERN const char * named_g_chrootdir INIT(NULL);
|
||||
EXTERN bool named_g_foreground INIT(false);
|
||||
EXTERN bool named_g_logstderr INIT(false);
|
||||
EXTERN bool named_g_nosyslog INIT(false);
|
||||
EXTERN const char * named_g_logfile INIT(NULL);
|
||||
|
||||
EXTERN const char *named_g_defaultsessionkeyfile INIT(NAMED_LOCALSTATEDIR
|
||||
"/run/named/"
|
||||
"session.key");
|
||||
EXTERN const char *named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR "/run/"
|
||||
"named/"
|
||||
"named."
|
||||
"lock");
|
||||
EXTERN bool named_g_forcelock INIT(false);
|
||||
EXTERN const char * named_g_defaultsessionkeyfile
|
||||
INIT(NAMED_LOCALSTATEDIR "/run/named/"
|
||||
"session.key");
|
||||
EXTERN const char * named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR
|
||||
"/run/named/"
|
||||
"named.lock");
|
||||
EXTERN bool named_g_forcelock INIT(false);
|
||||
|
||||
#if NAMED_RUN_PID_DIR
|
||||
EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/named/"
|
||||
"named.pid");
|
||||
#else /* if NAMED_RUN_PID_DIR */
|
||||
EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/"
|
||||
"named.pid");
|
||||
#endif /* if NAMED_RUN_PID_DIR */
|
||||
EXTERN const char * named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR
|
||||
"/run/named/"
|
||||
"named.pid");
|
||||
#else
|
||||
EXTERN const char * named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR
|
||||
"/run/named.pid");
|
||||
#endif
|
||||
|
||||
EXTERN const char *named_g_username INIT(NULL);
|
||||
EXTERN const char * named_g_username INIT(NULL);
|
||||
|
||||
EXTERN const char *named_g_engine INIT(NULL);
|
||||
EXTERN const char * named_g_engine INIT(NULL);
|
||||
|
||||
EXTERN isc_time_t named_g_boottime;
|
||||
EXTERN isc_time_t named_g_configtime;
|
||||
EXTERN bool named_g_memstatistics INIT(false);
|
||||
EXTERN bool named_g_keepstderr INIT(false);
|
||||
EXTERN isc_time_t named_g_boottime;
|
||||
EXTERN isc_time_t named_g_configtime;
|
||||
EXTERN bool named_g_memstatistics INIT(false);
|
||||
EXTERN bool named_g_keepstderr INIT(false);
|
||||
|
||||
EXTERN unsigned int named_g_tat_interval INIT(24 * 3600);
|
||||
EXTERN unsigned int named_g_tat_interval INIT(24*3600);
|
||||
|
||||
#if defined(HAVE_GEOIP2)
|
||||
EXTERN dns_geoip_databases_t *named_g_geoip INIT(NULL);
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
EXTERN dns_geoip_databases_t *named_g_geoip INIT(NULL);
|
||||
#endif
|
||||
|
||||
EXTERN const char *named_g_fuzz_addr INIT(NULL);
|
||||
EXTERN isc_fuzztype_t named_g_fuzz_type INIT(isc_fuzz_none);
|
||||
EXTERN const char * named_g_fuzz_addr INIT(NULL);
|
||||
EXTERN isc_fuzztype_t named_g_fuzz_type INIT(isc_fuzz_none);
|
||||
|
||||
EXTERN dns_acl_t *named_g_mapped INIT(NULL);
|
||||
EXTERN dns_acl_t * named_g_mapped INIT(NULL);
|
||||
|
||||
#undef EXTERN
|
||||
#undef INIT
|
||||
|
||||
@@ -19,19 +19,19 @@
|
||||
|
||||
#include <dns/log.h>
|
||||
|
||||
#include <named/globals.h> /* Required for named_g_(categories|modules). */
|
||||
#include <named/globals.h> /* Required for named_g_(categories|modules). */
|
||||
|
||||
/* Unused slot 0. */
|
||||
#define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
|
||||
#define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
|
||||
|
||||
/*
|
||||
* Backwards compatibility.
|
||||
*/
|
||||
#define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
|
||||
#define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
|
||||
|
||||
#define NAMED_LOGMODULE_MAIN (&named_g_modules[0])
|
||||
#define NAMED_LOGMODULE_SERVER (&named_g_modules[1])
|
||||
#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
|
||||
#define NAMED_LOGMODULE_MAIN (&named_g_modules[0])
|
||||
#define NAMED_LOGMODULE_SERVER (&named_g_modules[1])
|
||||
#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
|
||||
|
||||
isc_result_t
|
||||
named_log_init(bool safe);
|
||||
@@ -45,7 +45,7 @@ named_log_init(bool safe);
|
||||
* as root.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
named_log_setdefaultchannels(isc_logconfig_t *lcfg);
|
||||
/*%
|
||||
* Set up logging channels according to the named defaults, which
|
||||
@@ -53,7 +53,7 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg);
|
||||
* this just means setting up default_debug.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
named_log_setsafechannels(isc_logconfig_t *lcfg);
|
||||
/*%
|
||||
* Like named_log_setdefaultchannels(), but omits any logging to files.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NAMED_LOGCONF_H
|
||||
#define NAMED_LOGCONF_H 1
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#ifdef ISC_MAIN_HOOK
|
||||
#define main(argc, argv) bindmain(argc, argv)
|
||||
#endif /* ifdef ISC_MAIN_HOOK */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Commandline arguments for named; also referenced in win32/ntservice.c
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
named_main_earlyfatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
named_main_earlywarning(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
@@ -35,85 +35,80 @@
|
||||
|
||||
#include <named/types.h>
|
||||
|
||||
#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
|
||||
#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
|
||||
#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
|
||||
#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
|
||||
#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
|
||||
#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
|
||||
|
||||
/*%
|
||||
* Name server state. Better here than in lots of separate global variables.
|
||||
*/
|
||||
struct named_server {
|
||||
unsigned int magic;
|
||||
isc_mem_t * mctx;
|
||||
unsigned int magic;
|
||||
isc_mem_t * mctx;
|
||||
|
||||
ns_server_t *sctx;
|
||||
ns_server_t * sctx;
|
||||
|
||||
isc_task_t *task;
|
||||
isc_task_t * task;
|
||||
|
||||
char *statsfile; /*%< Statistics file name */
|
||||
char *dumpfile; /*%< Dump file name */
|
||||
char *secrootsfile; /*%< Secroots file name */
|
||||
char *bindkeysfile; /*%< bind.keys file name
|
||||
* */
|
||||
char *recfile; /*%< Recursive file name */
|
||||
bool version_set; /*%< User has set version
|
||||
* */
|
||||
char *version; /*%< User-specified version */
|
||||
bool hostname_set; /*%< User has set hostname
|
||||
* */
|
||||
char *hostname; /*%< User-specified hostname
|
||||
* */
|
||||
char * statsfile; /*%< Statistics file name */
|
||||
char * dumpfile; /*%< Dump file name */
|
||||
char * secrootsfile; /*%< Secroots file name */
|
||||
char * bindkeysfile; /*%< bind.keys file name */
|
||||
char * recfile; /*%< Recursive file name */
|
||||
bool version_set; /*%< User has set version */
|
||||
char * version; /*%< User-specified version */
|
||||
bool hostname_set; /*%< User has set hostname */
|
||||
char * hostname; /*%< User-specified hostname */
|
||||
|
||||
/* Server data structures. */
|
||||
dns_loadmgr_t * loadmgr;
|
||||
dns_zonemgr_t * zonemgr;
|
||||
dns_viewlist_t viewlist;
|
||||
dns_kasplist_t kasplist;
|
||||
ns_interfacemgr_t *interfacemgr;
|
||||
dns_db_t * in_roothints;
|
||||
dns_loadmgr_t * loadmgr;
|
||||
dns_zonemgr_t * zonemgr;
|
||||
dns_viewlist_t viewlist;
|
||||
dns_kasplist_t kasplist;
|
||||
ns_interfacemgr_t * interfacemgr;
|
||||
dns_db_t * in_roothints;
|
||||
|
||||
isc_timer_t *interface_timer;
|
||||
isc_timer_t *heartbeat_timer;
|
||||
isc_timer_t *pps_timer;
|
||||
isc_timer_t *tat_timer;
|
||||
isc_timer_t * interface_timer;
|
||||
isc_timer_t * heartbeat_timer;
|
||||
isc_timer_t * pps_timer;
|
||||
isc_timer_t * tat_timer;
|
||||
|
||||
uint32_t interface_interval;
|
||||
uint32_t heartbeat_interval;
|
||||
uint32_t interface_interval;
|
||||
uint32_t heartbeat_interval;
|
||||
|
||||
isc_mutex_t reload_event_lock;
|
||||
isc_event_t * reload_event;
|
||||
named_reload_t reload_status;
|
||||
isc_mutex_t reload_event_lock;
|
||||
isc_event_t * reload_event;
|
||||
named_reload_t reload_status;
|
||||
|
||||
bool flushonshutdown;
|
||||
bool flushonshutdown;
|
||||
|
||||
named_cachelist_t cachelist; /*%< Possibly shared caches
|
||||
* */
|
||||
isc_stats_t *zonestats; /*% Zone management stats */
|
||||
isc_stats_t *resolverstats; /*% Resolver stats */
|
||||
isc_stats_t *sockstats; /*%< Socket stats */
|
||||
named_cachelist_t cachelist; /*%< Possibly shared caches */
|
||||
isc_stats_t * zonestats; /*% Zone management stats */
|
||||
isc_stats_t * resolverstats; /*% Resolver stats */
|
||||
isc_stats_t * sockstats; /*%< Socket stats */
|
||||
|
||||
named_controls_t * controls; /*%< Control channels */
|
||||
unsigned int dispatchgen;
|
||||
named_dispatchlist_t dispatches;
|
||||
named_controls_t * controls; /*%< Control channels */
|
||||
unsigned int dispatchgen;
|
||||
named_dispatchlist_t dispatches;
|
||||
|
||||
named_statschannellist_t statschannels;
|
||||
|
||||
dns_tsigkey_t *sessionkey;
|
||||
char * session_keyfile;
|
||||
dns_name_t * session_keyname;
|
||||
unsigned int session_keyalg;
|
||||
uint16_t session_keybits;
|
||||
bool interface_auto;
|
||||
unsigned char secret[32]; /*%< Server Cookie Secret */
|
||||
ns_cookiealg_t cookiealg;
|
||||
dns_tsigkey_t *sessionkey;
|
||||
char *session_keyfile;
|
||||
dns_name_t *session_keyname;
|
||||
unsigned int session_keyalg;
|
||||
uint16_t session_keybits;
|
||||
bool interface_auto;
|
||||
unsigned char secret[32]; /*%< Server Cookie Secret */
|
||||
ns_cookiealg_t cookiealg;
|
||||
|
||||
dns_dtenv_t *dtenv; /*%< Dnstap environment */
|
||||
dns_dtenv_t *dtenv; /*%< Dnstap environment */
|
||||
|
||||
char *lockfile;
|
||||
char * lockfile;
|
||||
};
|
||||
|
||||
#define NAMED_SERVER_MAGIC ISC_MAGIC('S', 'V', 'E', 'R')
|
||||
#define NAMED_SERVER_VALID(s) ISC_MAGIC_VALID(s, NAMED_SERVER_MAGIC)
|
||||
#define NAMED_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
|
||||
#define NAMED_SERVER_VALID(s) ISC_MAGIC_VALID(s, NAMED_SERVER_MAGIC)
|
||||
|
||||
void
|
||||
named_server_create(isc_mem_t *mctx, named_server_t **serverp);
|
||||
@@ -153,7 +148,7 @@ named_server_flushonshutdown(named_server_t *server, bool flush);
|
||||
|
||||
isc_result_t
|
||||
named_server_reloadcommand(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
/*%<
|
||||
* Act on a "reload" command from the command channel.
|
||||
*/
|
||||
@@ -166,21 +161,21 @@ named_server_reconfigcommand(named_server_t *server);
|
||||
|
||||
isc_result_t
|
||||
named_server_notifycommand(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
/*%<
|
||||
* Act on a "notify" command from the command channel.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
named_server_refreshcommand(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
/*%<
|
||||
* Act on a "refresh" command from the command channel.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
/*%<
|
||||
* Act on a "retransfer" command from the command channel.
|
||||
*/
|
||||
@@ -222,7 +217,7 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex,
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_dumpsecroots(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Change or increment the server debug level.
|
||||
@@ -242,7 +237,8 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex);
|
||||
* flush all the names under the specified name.
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_flushnode(named_server_t *server, isc_lex_t *lex, bool tree);
|
||||
named_server_flushnode(named_server_t *server, isc_lex_t *lex,
|
||||
bool tree);
|
||||
|
||||
/*%
|
||||
* Report the server's status.
|
||||
@@ -261,14 +257,14 @@ named_server_tsiglist(named_server_t *server, isc_buffer_t **text);
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_tsigdelete(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Enable or disable updates for a zone.
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
named_server_freeze(named_server_t *server, bool freeze,
|
||||
isc_lex_t *lex, isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Dump zone updates to disk, optionally removing the journal file
|
||||
@@ -346,8 +342,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
|
||||
* duration, in a particular view if specified, or in all views.
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_nta(named_server_t *server, isc_lex_t *lex, bool readonly,
|
||||
isc_buffer_t **text);
|
||||
named_server_nta(named_server_t *server, isc_lex_t *lex,
|
||||
bool readonly, isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Generates a test sequence that is only for use in system tests. The
|
||||
|
||||
@@ -19,19 +19,17 @@
|
||||
#ifdef NAMED_MAIN
|
||||
#define EXTERN
|
||||
#define INIT(v) = (v)
|
||||
#else /* ifdef NAMED_MAIN */
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#define INIT(v)
|
||||
#endif /* ifdef NAMED_MAIN */
|
||||
#endif
|
||||
|
||||
EXTERN unsigned int named_smf_got_instance INIT(0);
|
||||
EXTERN unsigned int named_smf_chroot INIT(0);
|
||||
EXTERN unsigned int named_smf_want_disable INIT(0);
|
||||
EXTERN unsigned int named_smf_got_instance INIT(0);
|
||||
EXTERN unsigned int named_smf_chroot INIT(0);
|
||||
EXTERN unsigned int named_smf_want_disable INIT(0);
|
||||
|
||||
isc_result_t
|
||||
named_smf_add_message(isc_buffer_t **text);
|
||||
isc_result_t
|
||||
named_smf_get_instance(char **name, int debug, isc_mem_t *mctx);
|
||||
isc_result_t named_smf_add_message(isc_buffer_t **text);
|
||||
isc_result_t named_smf_get_instance(char **name, int debug, isc_mem_t *mctx);
|
||||
|
||||
#undef EXTERN
|
||||
#undef INIT
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
* The statistics channels built-in the name server.
|
||||
*/
|
||||
|
||||
#include <isccc/types.h>
|
||||
|
||||
#include <isccfg/aclconf.h>
|
||||
|
||||
#include <isccc/types.h>
|
||||
#include <named/types.h>
|
||||
|
||||
#define NAMED_STATSCHANNEL_HTTPPORT 80
|
||||
#define NAMED_STATSCHANNEL_HTTPPORT 80
|
||||
|
||||
isc_result_t
|
||||
named_statschannels_configure(named_server_t *server, const cfg_obj_t *config,
|
||||
@@ -37,6 +38,7 @@ named_statschannels_configure(named_server_t *server, const cfg_obj_t *config,
|
||||
* and create a new one.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
named_statschannels_shutdown(named_server_t *server);
|
||||
/*%<
|
||||
@@ -49,4 +51,4 @@ named_stats_dump(named_server_t *server, FILE *fp);
|
||||
* Dump statistics counters managed by the server to the file fp.
|
||||
*/
|
||||
|
||||
#endif /* NAMED_STATSCHANNEL_H */
|
||||
#endif /* NAMED_STATSCHANNEL_H */
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <isc/types.h>
|
||||
#include <isc/lang.h>
|
||||
|
||||
#include <isccfg/cfg.h>
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <isc/types.h>
|
||||
#include <isc/lang.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
#include <dns/types.h>
|
||||
|
||||
typedef struct named_cache named_cache_t;
|
||||
typedef ISC_LIST(named_cache_t) named_cachelist_t;
|
||||
typedef struct named_server named_server_t;
|
||||
typedef struct named_xmld named_xmld_t;
|
||||
typedef struct named_xmldmgr named_xmldmgr_t;
|
||||
typedef struct named_controls named_controls_t;
|
||||
typedef struct named_dispatch named_dispatch_t;
|
||||
typedef ISC_LIST(named_dispatch_t) named_dispatchlist_t;
|
||||
typedef struct named_statschannel named_statschannel_t;
|
||||
typedef ISC_LIST(named_statschannel_t) named_statschannellist_t;
|
||||
typedef struct named_cache named_cache_t;
|
||||
typedef ISC_LIST(named_cache_t) named_cachelist_t;
|
||||
typedef struct named_server named_server_t;
|
||||
typedef struct named_xmld named_xmld_t;
|
||||
typedef struct named_xmldmgr named_xmldmgr_t;
|
||||
typedef struct named_controls named_controls_t;
|
||||
typedef struct named_dispatch named_dispatch_t;
|
||||
typedef ISC_LIST(named_dispatch_t) named_dispatchlist_t;
|
||||
typedef struct named_statschannel named_statschannel_t;
|
||||
typedef ISC_LIST(named_statschannel_t) named_statschannellist_t;
|
||||
|
||||
/*%
|
||||
* Used for server->reload_status as printed by `rndc status`
|
||||
|
||||
@@ -27,7 +27,7 @@ ISC_LANG_BEGINDECLS
|
||||
isc_result_t
|
||||
named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
const cfg_obj_t *zconfig, cfg_aclconfctx_t *ac,
|
||||
dns_kasplist_t *kasplist, dns_zone_t *zone,
|
||||
dns_kasplist_t* kasplist, dns_zone_t *zone,
|
||||
dns_zone_t *raw);
|
||||
/*%<
|
||||
* Configure or reconfigure a zone according to the named.conf
|
||||
@@ -52,8 +52,10 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
|
||||
dns_rdataclass_t rdclass, dns_name_t *name);
|
||||
named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase,
|
||||
dns_zone_t *zone,
|
||||
dns_rdataclass_t rdclass,
|
||||
dns_name_t *name);
|
||||
/*%>
|
||||
* configure a DLZ zone, setting up the database methods and calling
|
||||
* postload to load the origin values
|
||||
|
||||
+90
-50
@@ -15,31 +15,36 @@
|
||||
|
||||
#include <dns/log.h>
|
||||
|
||||
#include <isccfg/log.h>
|
||||
|
||||
#include <ns/log.h>
|
||||
|
||||
#include <isccfg/log.h>
|
||||
|
||||
#include <named/log.h>
|
||||
|
||||
#ifndef ISC_FACILITY
|
||||
#define ISC_FACILITY LOG_DAEMON
|
||||
#endif /* ifndef ISC_FACILITY */
|
||||
#endif
|
||||
|
||||
/*%
|
||||
* When adding a new category, be sure to add the appropriate
|
||||
* \#define to <named/log.h> and to update the list in
|
||||
* bin/check/check-tool.c.
|
||||
*/
|
||||
static isc_logcategory_t categories[] = { { "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 } };
|
||||
static isc_logcategory_t categories[] = {
|
||||
{ "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/*%
|
||||
* When adding a new module, be sure to add the appropriate
|
||||
* \#define to <dns/log.h>.
|
||||
*/
|
||||
static isc_logmodule_t modules[] = {
|
||||
{ "main", 0 }, { "server", 0 }, { "control", 0 }, { NULL, 0 }
|
||||
{ "main", 0 },
|
||||
{ "server", 0 },
|
||||
{ "control", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
isc_result_t
|
||||
@@ -53,7 +58,9 @@ named_log_init(bool safe) {
|
||||
/*
|
||||
* Setup a logging context.
|
||||
*/
|
||||
isc_log_create(named_g_mctx, &named_g_lctx, &lcfg);
|
||||
result = isc_log_create(named_g_mctx, &named_g_lctx, &lcfg);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
/*
|
||||
* named-checktool.c:setup_logging() needs to be kept in sync.
|
||||
@@ -67,20 +74,20 @@ named_log_init(bool safe) {
|
||||
ns_log_init(named_g_lctx);
|
||||
ns_log_setcontext(named_g_lctx);
|
||||
|
||||
if (safe) {
|
||||
named_log_setsafechannels(lcfg);
|
||||
} else {
|
||||
named_log_setdefaultchannels(lcfg);
|
||||
}
|
||||
if (safe)
|
||||
result = named_log_setsafechannels(lcfg);
|
||||
else
|
||||
result = named_log_setdefaultchannels(lcfg);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
|
||||
result = named_log_setdefaultcategory(lcfg);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
isc_log_destroy(&named_g_lctx);
|
||||
isc_log_setcontext(NULL);
|
||||
dns_log_setcontext(NULL);
|
||||
@@ -88,8 +95,9 @@ cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
|
||||
isc_result_t result;
|
||||
isc_logdestination_t destination;
|
||||
|
||||
/*
|
||||
@@ -97,14 +105,19 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
|
||||
* stderr. In BIND, we want to override this and log to named.run
|
||||
* instead, unless the -g option was given.
|
||||
*/
|
||||
if (!named_g_logstderr) {
|
||||
if (! named_g_logstderr) {
|
||||
destination.file.stream = NULL;
|
||||
destination.file.name = "named.run";
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC, &destination,
|
||||
ISC_LOG_PRINTTIME | ISC_LOG_DEBUGONLY);
|
||||
result = isc_log_createchannel(lcfg, "default_debug",
|
||||
ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTIME|
|
||||
ISC_LOG_DEBUGONLY);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (named_g_logfile != NULL) {
|
||||
@@ -112,32 +125,49 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
|
||||
destination.file.name = named_g_logfile;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(lcfg, "default_logfile", ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC, &destination,
|
||||
ISC_LOG_PRINTTIME |
|
||||
ISC_LOG_PRINTCATEGORY |
|
||||
ISC_LOG_PRINTLEVEL);
|
||||
result = isc_log_createchannel(lcfg, "default_logfile",
|
||||
ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTIME|
|
||||
ISC_LOG_PRINTCATEGORY|
|
||||
ISC_LOG_PRINTLEVEL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#if ISC_FACILITY != LOG_DAEMON
|
||||
destination.facility = ISC_FACILITY;
|
||||
isc_log_createchannel(lcfg, "default_syslog", ISC_LOG_TOSYSLOG,
|
||||
ISC_LOG_INFO, &destination, 0);
|
||||
#endif /* if ISC_FACILITY != LOG_DAEMON */
|
||||
result = isc_log_createchannel(lcfg, "default_syslog",
|
||||
ISC_LOG_TOSYSLOG, ISC_LOG_INFO,
|
||||
&destination, 0);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the initial debug level.
|
||||
*/
|
||||
isc_log_setdebuglevel(named_g_lctx, named_g_debuglevel);
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
named_log_setsafechannels(isc_logconfig_t *lcfg) {
|
||||
isc_result_t result;
|
||||
isc_logdestination_t destination;
|
||||
|
||||
if (!named_g_logstderr) {
|
||||
isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TONULL,
|
||||
ISC_LOG_DYNAMIC, NULL, 0);
|
||||
if (! named_g_logstderr) {
|
||||
result = isc_log_createchannel(lcfg, "default_debug",
|
||||
ISC_LOG_TONULL,
|
||||
ISC_LOG_DYNAMIC,
|
||||
NULL, 0);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
|
||||
/*
|
||||
* Setting the debug level to zero should get the output
|
||||
@@ -153,18 +183,30 @@ named_log_setsafechannels(isc_logconfig_t *lcfg) {
|
||||
destination.file.name = named_g_logfile;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(lcfg, "default_logfile", ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC, &destination,
|
||||
ISC_LOG_PRINTTIME |
|
||||
ISC_LOG_PRINTCATEGORY |
|
||||
ISC_LOG_PRINTLEVEL);
|
||||
result = isc_log_createchannel(lcfg, "default_logfile",
|
||||
ISC_LOG_TOFILE,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTIME|
|
||||
ISC_LOG_PRINTCATEGORY|
|
||||
ISC_LOG_PRINTLEVEL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#if ISC_FACILITY != LOG_DAEMON
|
||||
destination.facility = ISC_FACILITY;
|
||||
isc_log_createchannel(lcfg, "default_syslog", ISC_LOG_TOSYSLOG,
|
||||
ISC_LOG_INFO, &destination, 0);
|
||||
#endif /* if ISC_FACILITY != LOG_DAEMON */
|
||||
result = isc_log_createchannel(lcfg, "default_syslog",
|
||||
ISC_LOG_TOSYSLOG, ISC_LOG_INFO,
|
||||
&destination, 0);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
#endif
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -173,23 +215,21 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
|
||||
|
||||
result = isc_log_usechannel(lcfg, "default_debug",
|
||||
ISC_LOGCATEGORY_DEFAULT, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!named_g_logstderr) {
|
||||
if (named_g_logfile != NULL) {
|
||||
if (! named_g_logstderr) {
|
||||
if (named_g_logfile != NULL)
|
||||
result = isc_log_usechannel(lcfg, "default_logfile",
|
||||
ISC_LOGCATEGORY_DEFAULT,
|
||||
NULL);
|
||||
} else if (!named_g_nosyslog) {
|
||||
else if (! named_g_nosyslog)
|
||||
result = isc_log_usechannel(lcfg, "default_syslog",
|
||||
ISC_LOGCATEGORY_DEFAULT,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -197,8 +237,8 @@ isc_result_t
|
||||
named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
|
||||
isc_result_t result;
|
||||
|
||||
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
|
||||
NULL);
|
||||
result = isc_log_usechannel(lcfg, "null",
|
||||
NAMED_LOGCATEGORY_UNMATCHED, NULL);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
+62
-88
@@ -29,11 +29,9 @@
|
||||
#include <named/log.h>
|
||||
#include <named/logconf.h>
|
||||
|
||||
#define CHECK(op) \
|
||||
do { \
|
||||
result = (op); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
#define CHECK(op) \
|
||||
do { result = (op); \
|
||||
if (result != ISC_R_SUCCESS) goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
/*%
|
||||
@@ -53,21 +51,22 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
|
||||
category = isc_log_categorybyname(named_g_lctx, catname);
|
||||
if (category == NULL) {
|
||||
cfg_obj_log(ccat, named_g_lctx, ISC_LOG_ERROR,
|
||||
"unknown logging category '%s' ignored", catname);
|
||||
"unknown logging category '%s' ignored",
|
||||
catname);
|
||||
/*
|
||||
* Allow further processing by returning success.
|
||||
*/
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (logconfig == NULL) {
|
||||
if (logconfig == NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
module = NULL;
|
||||
|
||||
destinations = cfg_tuple_get(ccat, "destinations");
|
||||
for (element = cfg_list_first(destinations); element != NULL;
|
||||
for (element = cfg_list_first(destinations);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *channel = cfg_listelt_value(element);
|
||||
@@ -92,7 +91,7 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
|
||||
*/
|
||||
static isc_result_t
|
||||
channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc_result_t result;
|
||||
isc_logdestination_t dest;
|
||||
unsigned int type;
|
||||
unsigned int flags = 0;
|
||||
@@ -113,24 +112,19 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
(void)cfg_map_get(channel, "stderr", &stderrobj);
|
||||
|
||||
i = 0;
|
||||
if (fileobj != NULL) {
|
||||
if (fileobj != NULL)
|
||||
i++;
|
||||
}
|
||||
if (syslogobj != NULL) {
|
||||
if (syslogobj != NULL)
|
||||
i++;
|
||||
}
|
||||
if (nullobj != NULL) {
|
||||
if (nullobj != NULL)
|
||||
i++;
|
||||
}
|
||||
if (stderrobj != NULL) {
|
||||
if (stderrobj != NULL)
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i != 1) {
|
||||
cfg_obj_log(channel, named_g_lctx, ISC_LOG_ERROR,
|
||||
"channel '%s': exactly one of file, syslog, "
|
||||
"null, and stderr must be present",
|
||||
channelname);
|
||||
"channel '%s': exactly one of file, syslog, "
|
||||
"null, and stderr must be present", channelname);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
@@ -139,9 +133,10 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
if (fileobj != NULL) {
|
||||
const cfg_obj_t *pathobj = cfg_tuple_get(fileobj, "file");
|
||||
const cfg_obj_t *sizeobj = cfg_tuple_get(fileobj, "size");
|
||||
const cfg_obj_t *versionsobj = cfg_tuple_get(fileobj,
|
||||
"versions");
|
||||
const cfg_obj_t *suffixobj = cfg_tuple_get(fileobj, "suffix");
|
||||
const cfg_obj_t *versionsobj =
|
||||
cfg_tuple_get(fileobj, "versions");
|
||||
const cfg_obj_t *suffixobj =
|
||||
cfg_tuple_get(fileobj, "suffix");
|
||||
int32_t versions = ISC_LOG_ROLLNEVER;
|
||||
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
|
||||
isc_offset_t size = 0;
|
||||
@@ -165,25 +160,18 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
|
||||
type = ISC_LOG_TOFILE;
|
||||
|
||||
if (versionsobj != NULL && cfg_obj_isuint32(versionsobj)) {
|
||||
if (versionsobj != NULL && cfg_obj_isuint32(versionsobj))
|
||||
versions = cfg_obj_asuint32(versionsobj);
|
||||
} else if (versionsobj != NULL &&
|
||||
cfg_obj_isstring(versionsobj) &&
|
||||
strcasecmp(cfg_obj_asstring(versionsobj),
|
||||
"unlimited") == 0)
|
||||
{
|
||||
else if (versionsobj != NULL && cfg_obj_isstring(versionsobj) &&
|
||||
strcasecmp(cfg_obj_asstring(versionsobj), "unlimited") == 0)
|
||||
versions = ISC_LOG_ROLLINFINITE;
|
||||
}
|
||||
if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
|
||||
if (sizeobj != NULL &&
|
||||
cfg_obj_isuint64(sizeobj) &&
|
||||
cfg_obj_asuint64(sizeobj) < maxoffset)
|
||||
{
|
||||
size = (isc_offset_t)cfg_obj_asuint64(sizeobj);
|
||||
}
|
||||
if (suffixobj != NULL && cfg_obj_isstring(suffixobj) &&
|
||||
strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
|
||||
{
|
||||
suffix = isc_log_rollsuffix_timestamp;
|
||||
}
|
||||
|
||||
dest.file.stream = NULL;
|
||||
dest.file.name = cfg_obj_asstring(pathobj);
|
||||
@@ -224,27 +212,22 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
(void)cfg_map_get(channel, "print-time", &printtime);
|
||||
(void)cfg_map_get(channel, "buffered", &buffered);
|
||||
|
||||
if (printcat != NULL && cfg_obj_asboolean(printcat)) {
|
||||
if (printcat != NULL && cfg_obj_asboolean(printcat))
|
||||
flags |= ISC_LOG_PRINTCATEGORY;
|
||||
}
|
||||
if (printsev != NULL && cfg_obj_asboolean(printsev)) {
|
||||
if (printsev != NULL && cfg_obj_asboolean(printsev))
|
||||
flags |= ISC_LOG_PRINTLEVEL;
|
||||
}
|
||||
if (buffered != NULL && cfg_obj_asboolean(buffered)) {
|
||||
if (buffered != NULL && cfg_obj_asboolean(buffered))
|
||||
flags |= ISC_LOG_BUFFERED;
|
||||
}
|
||||
if (printtime != NULL && cfg_obj_isboolean(printtime)) {
|
||||
if (cfg_obj_asboolean(printtime)) {
|
||||
if (cfg_obj_asboolean(printtime))
|
||||
flags |= ISC_LOG_PRINTTIME;
|
||||
}
|
||||
} else if (printtime != NULL) { /* local/iso8601/iso8601-utc */
|
||||
} else if (printtime != NULL) { /* local/iso8601/iso8601-utc */
|
||||
const char *s = cfg_obj_asstring(printtime);
|
||||
flags |= ISC_LOG_PRINTTIME;
|
||||
if (strcasecmp(s, "iso8601") == 0) {
|
||||
if (strcasecmp(s, "iso8601") == 0)
|
||||
flags |= ISC_LOG_ISO8601;
|
||||
} else if (strcasecmp(s, "iso8601-utc") == 0) {
|
||||
else if (strcasecmp(s, "iso8601-utc") == 0)
|
||||
flags |= ISC_LOG_ISO8601 | ISC_LOG_UTC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,37 +235,36 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
if (cfg_map_get(channel, "severity", &severity) == ISC_R_SUCCESS) {
|
||||
if (cfg_obj_isstring(severity)) {
|
||||
const char *str = cfg_obj_asstring(severity);
|
||||
if (strcasecmp(str, "critical") == 0) {
|
||||
if (strcasecmp(str, "critical") == 0)
|
||||
level = ISC_LOG_CRITICAL;
|
||||
} else if (strcasecmp(str, "error") == 0) {
|
||||
else if (strcasecmp(str, "error") == 0)
|
||||
level = ISC_LOG_ERROR;
|
||||
} else if (strcasecmp(str, "warning") == 0) {
|
||||
else if (strcasecmp(str, "warning") == 0)
|
||||
level = ISC_LOG_WARNING;
|
||||
} else if (strcasecmp(str, "notice") == 0) {
|
||||
else if (strcasecmp(str, "notice") == 0)
|
||||
level = ISC_LOG_NOTICE;
|
||||
} else if (strcasecmp(str, "info") == 0) {
|
||||
else if (strcasecmp(str, "info") == 0)
|
||||
level = ISC_LOG_INFO;
|
||||
} else if (strcasecmp(str, "dynamic") == 0) {
|
||||
else if (strcasecmp(str, "dynamic") == 0)
|
||||
level = ISC_LOG_DYNAMIC;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
/* debug */
|
||||
level = cfg_obj_asuint32(severity);
|
||||
}
|
||||
}
|
||||
|
||||
if (logconfig != NULL) {
|
||||
isc_log_createchannel(logconfig, channelname, type, level,
|
||||
&dest, flags);
|
||||
}
|
||||
if (logconfig == NULL)
|
||||
result = ISC_R_SUCCESS;
|
||||
else
|
||||
result = isc_log_createchannel(logconfig, channelname,
|
||||
type, level, &dest, flags);
|
||||
|
||||
if (type == ISC_LOG_TOFILE) {
|
||||
if (result == ISC_R_SUCCESS && type == ISC_LOG_TOFILE) {
|
||||
FILE *fp;
|
||||
|
||||
/*
|
||||
* Test to make sure that file is a plain file.
|
||||
* Fix defect #22771
|
||||
*/
|
||||
*/
|
||||
result = isc_file_isplainfile(dest.file.name);
|
||||
if (result == ISC_R_SUCCESS || result == ISC_R_FILENOTFOUND) {
|
||||
/*
|
||||
@@ -292,31 +274,27 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
*/
|
||||
result = isc_stdio_open(dest.file.name, "a", &fp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (logconfig != NULL && !named_g_nosyslog) {
|
||||
if (logconfig != NULL && !named_g_nosyslog)
|
||||
syslog(LOG_ERR,
|
||||
"isc_stdio_open '%s' failed: "
|
||||
"%s",
|
||||
dest.file.name,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
"isc_stdio_open '%s' failed: "
|
||||
"%s", dest.file.name,
|
||||
isc_result_totext(result));
|
||||
fprintf(stderr,
|
||||
"isc_stdio_open '%s' failed: %s\n",
|
||||
dest.file.name,
|
||||
isc_result_totext(result));
|
||||
} else {
|
||||
} else
|
||||
(void)isc_stdio_close(fp);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if (logconfig != NULL && !named_g_nosyslog) {
|
||||
if (logconfig != NULL && !named_g_nosyslog)
|
||||
syslog(LOG_ERR, "isc_file_isplainfile '%s' failed: %s",
|
||||
dest.file.name, isc_result_totext(result));
|
||||
}
|
||||
fprintf(stderr, "isc_file_isplainfile '%s' failed: %s\n",
|
||||
dest.file.name, isc_result_totext(result));
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -330,12 +308,12 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
|
||||
bool unmatched_set = false;
|
||||
const cfg_obj_t *catname;
|
||||
|
||||
if (logconfig != NULL) {
|
||||
named_log_setdefaultchannels(logconfig);
|
||||
}
|
||||
if (logconfig != NULL)
|
||||
CHECK(named_log_setdefaultchannels(logconfig));
|
||||
|
||||
(void)cfg_map_get(logstmt, "channel", &channels);
|
||||
for (element = cfg_list_first(channels); element != NULL;
|
||||
for (element = cfg_list_first(channels);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *channel = cfg_listelt_value(element);
|
||||
@@ -343,36 +321,32 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
|
||||
}
|
||||
|
||||
(void)cfg_map_get(logstmt, "category", &categories);
|
||||
for (element = cfg_list_first(categories); element != NULL;
|
||||
for (element = cfg_list_first(categories);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *category = cfg_listelt_value(element);
|
||||
CHECK(category_fromconf(category, logconfig));
|
||||
if (!default_set) {
|
||||
catname = cfg_tuple_get(category, "name");
|
||||
if (strcmp(cfg_obj_asstring(catname), "default") == 0) {
|
||||
if (strcmp(cfg_obj_asstring(catname), "default") == 0)
|
||||
default_set = true;
|
||||
}
|
||||
}
|
||||
if (!unmatched_set) {
|
||||
catname = cfg_tuple_get(category, "name");
|
||||
if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0)
|
||||
{
|
||||
unmatched_set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (logconfig != NULL && !default_set) {
|
||||
if (logconfig != NULL && !default_set)
|
||||
CHECK(named_log_setdefaultcategory(logconfig));
|
||||
}
|
||||
|
||||
if (logconfig != NULL && !unmatched_set) {
|
||||
if (logconfig != NULL && !unmatched_set)
|
||||
CHECK(named_log_setunmatchedcategory(logconfig));
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
+320
-313
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -187,7 +187,7 @@ Allow
|
||||
\fBnamed\fR
|
||||
to use up to
|
||||
\fI#max\-socks\fR
|
||||
sockets\&. The default value is 21000 on systems built with default configuration options, and 4096 on systems built with "configure \-\-with\-tuning=small"\&.
|
||||
sockets\&. The default value is 4096 on systems built with default configuration options, and 21000 on systems built with "configure \-\-with\-tuning=large"\&.
|
||||
.if n \{\
|
||||
.sp
|
||||
.\}
|
||||
|
||||
+32
-35
@@ -10,12 +10,12 @@
|
||||
.\" Title: named.conf
|
||||
.\" Author:
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" Date: 2020-02-07
|
||||
.\" Date: 2019-08-12
|
||||
.\" Manual: BIND9
|
||||
.\" Source: ISC
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "NAMED\&.CONF" "5" "2020\-02\-07" "ISC" "BIND9"
|
||||
.TH "NAMED\&.CONF" "5" "2019\-08\-12" "ISC" "BIND9"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
@@ -97,31 +97,6 @@ dlz \fIstring\fR {
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.SH "DNSSEC-POLICY"
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
dnssec\-policy \fIstring\fR {
|
||||
dnskey\-ttl \fIduration\fR;
|
||||
keys { ( csk | ksk | zsk ) ( key\-directory ) lifetime ( \fIduration\fR | unlimited )
|
||||
algorithm \fIinteger\fR [ \fIinteger\fR ]; \&.\&.\&. };
|
||||
max\-zone\-ttl \fIduration\fR;
|
||||
parent\-ds\-ttl \fIduration\fR;
|
||||
parent\-propagation\-delay \fIduration\fR;
|
||||
parent\-registration\-delay \fIduration\fR;
|
||||
publish\-safety \fIduration\fR;
|
||||
retire\-safety \fIduration\fR;
|
||||
signatures\-refresh \fIduration\fR;
|
||||
signatures\-validity \fIduration\fR;
|
||||
signatures\-validity\-dnskey \fIduration\fR;
|
||||
zone\-propagation\-delay \fIduration\fR;
|
||||
};
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.SH "DYNDB"
|
||||
.sp
|
||||
.if n \{\
|
||||
@@ -175,7 +150,7 @@ logging {
|
||||
.\}
|
||||
.SH "MANAGED-KEYS"
|
||||
.PP
|
||||
Deprecated \- see DNSSEC\-KEYS\&.
|
||||
Deprecated \- see TRUST\-ANCHORS\&.
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
@@ -287,7 +262,6 @@ options {
|
||||
dnssec\-dnskey\-kskonly \fIboolean\fR;
|
||||
dnssec\-loadkeys\-interval \fIinteger\fR;
|
||||
dnssec\-must\-be\-secure \fIstring\fR \fIboolean\fR;
|
||||
dnssec\-policy \fIstring\fR;
|
||||
dnssec\-secure\-to\-insecure \fIboolean\fR;
|
||||
dnssec\-update\-mode ( maintain | no\-resign );
|
||||
dnssec\-validation ( yes | no | auto );
|
||||
@@ -437,8 +411,8 @@ options {
|
||||
\fIinteger\fR;
|
||||
response\-policy { zone \fIstring\fR [ add\-soa \fIboolean\fR ] [ log
|
||||
\fIboolean\fR ] [ max\-policy\-ttl \fIduration\fR ] [ min\-update\-interval
|
||||
\fIduration\fR ] [ policy ( cname | disabled | drop | given | no\-op
|
||||
| nodata | nxdomain | passthru | tcp\-only \fIquoted_string\fR ) ] [
|
||||
\fIduration\fR ] [ policy ( cname | disabled | drop | given | no\-op |
|
||||
nodata | nxdomain | passthru | tcp\-only \fIquoted_string\fR ) ] [
|
||||
recursive\-only \fIboolean\fR ] [ nsip\-enable \fIboolean\fR ] [
|
||||
nsdname\-enable \fIboolean\fR ]; \&.\&.\&. } [ add\-soa \fIboolean\fR ] [
|
||||
break\-dnssec \fIboolean\fR ] [ max\-policy\-ttl \fIduration\fR ] [
|
||||
@@ -593,7 +567,7 @@ trust\-anchors { \fIstring\fR ( static\-key |
|
||||
.\}
|
||||
.SH "TRUSTED-KEYS"
|
||||
.PP
|
||||
Deprecated \- see DNSSEC\-KEYS\&.
|
||||
Deprecated \- see TRUST\-ANCHORS\&.
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
@@ -683,7 +657,6 @@ view \fIstring\fR [ \fIclass\fR ] {
|
||||
dnssec\-dnskey\-kskonly \fIboolean\fR;
|
||||
dnssec\-loadkeys\-interval \fIinteger\fR;
|
||||
dnssec\-must\-be\-secure \fIstring\fR \fIboolean\fR;
|
||||
dnssec\-policy \fIstring\fR;
|
||||
dnssec\-secure\-to\-insecure \fIboolean\fR;
|
||||
dnssec\-update\-mode ( maintain | no\-resign );
|
||||
dnssec\-validation ( yes | no | auto );
|
||||
@@ -807,8 +780,8 @@ view \fIstring\fR [ \fIclass\fR ] {
|
||||
\fIinteger\fR;
|
||||
response\-policy { zone \fIstring\fR [ add\-soa \fIboolean\fR ] [ log
|
||||
\fIboolean\fR ] [ max\-policy\-ttl \fIduration\fR ] [ min\-update\-interval
|
||||
\fIduration\fR ] [ policy ( cname | disabled | drop | given | no\-op
|
||||
| nodata | nxdomain | passthru | tcp\-only \fIquoted_string\fR ) ] [
|
||||
\fIduration\fR ] [ policy ( cname | disabled | drop | given | no\-op |
|
||||
nodata | nxdomain | passthru | tcp\-only \fIquoted_string\fR ) ] [
|
||||
recursive\-only \fIboolean\fR ] [ nsip\-enable \fIboolean\fR ] [
|
||||
nsdname\-enable \fIboolean\fR ]; \&.\&.\&. } [ add\-soa \fIboolean\fR ] [
|
||||
break\-dnssec \fIboolean\fR ] [ max\-policy\-ttl \fIduration\fR ] [
|
||||
@@ -1094,6 +1067,30 @@ zone \fIstring\fR [ \fIclass\fR ] {
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.SH "DNSSEC-POLICY"
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
dnssec\-policy \fIstring\fR {
|
||||
dnskey\-ttl \fIduration\fR;
|
||||
keys { ( csk | ksk | zsk ) key\-directory lifetime \fIduration\fR algorithm \fIinteger\fR [ \fIinteger\fR ] ; \&.\&.\&. };
|
||||
parent\-ds\-ttl \fIduration\fR;
|
||||
parent\-propagation\-delay \fIduration\fR;
|
||||
parent\-registration\-delay \fIduration\fR;
|
||||
publish\-safety \fIduration\fR;
|
||||
retire\-safety \fIduration\fR;
|
||||
signatures\-refresh \fIduration\fR;
|
||||
signatures\-validity \fIduration\fR;
|
||||
signatures\-validity\-dnskey \fIduration\fR;
|
||||
zone\-max\-ttl \fIduration\fR;
|
||||
zone\-propagation\-delay \fIduration\fR;
|
||||
};
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.SH "FILES"
|
||||
.PP
|
||||
/etc/named\&.conf
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.named.conf">
|
||||
<info>
|
||||
<date>2020-02-07</date>
|
||||
<date>2019-08-12</date>
|
||||
</info>
|
||||
<refentryinfo>
|
||||
<corpname>ISC</corpname>
|
||||
@@ -111,26 +111,6 @@ dlz <replaceable>string</replaceable> {
|
||||
</literallayout>
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>DNSSEC-POLICY</title></info>
|
||||
<literallayout class="normal">
|
||||
dnssec-policy <replaceable>string</replaceable> {
|
||||
dnskey-ttl <replaceable>duration</replaceable>;
|
||||
keys { ( csk | ksk | zsk ) ( key-directory ) lifetime ( <replaceable>duration</replaceable> | unlimited )
|
||||
algorithm <replaceable>integer</replaceable> [ <replaceable>integer</replaceable> ]; ... };
|
||||
max-zone-ttl <replaceable>duration</replaceable>;
|
||||
parent-ds-ttl <replaceable>duration</replaceable>;
|
||||
parent-propagation-delay <replaceable>duration</replaceable>;
|
||||
parent-registration-delay <replaceable>duration</replaceable>;
|
||||
publish-safety <replaceable>duration</replaceable>;
|
||||
retire-safety <replaceable>duration</replaceable>;
|
||||
signatures-refresh <replaceable>duration</replaceable>;
|
||||
signatures-validity <replaceable>duration</replaceable>;
|
||||
signatures-validity-dnskey <replaceable>duration</replaceable>;
|
||||
zone-propagation-delay <replaceable>duration</replaceable>;
|
||||
};
|
||||
</literallayout>
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>DYNDB</title></info>
|
||||
<literallayout class="normal">
|
||||
dyndb <replaceable>string</replaceable> <replaceable>quoted_string</replaceable> {
|
||||
@@ -168,7 +148,7 @@ logging {
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>MANAGED-KEYS</title></info>
|
||||
<para>Deprecated - see DNSSEC-KEYS.</para>
|
||||
<para>Deprecated - see TRUST-ANCHORS.</para>
|
||||
<literallayout class="normal">
|
||||
managed-keys { <replaceable>string</replaceable> ( static-key
|
||||
| initial-key | static-ds |
|
||||
@@ -266,7 +246,6 @@ options {
|
||||
dnssec-dnskey-kskonly <replaceable>boolean</replaceable>;
|
||||
dnssec-loadkeys-interval <replaceable>integer</replaceable>;
|
||||
dnssec-must-be-secure <replaceable>string</replaceable> <replaceable>boolean</replaceable>;
|
||||
dnssec-policy <replaceable>string</replaceable>;
|
||||
dnssec-secure-to-insecure <replaceable>boolean</replaceable>;
|
||||
dnssec-update-mode ( maintain | no-resign );
|
||||
dnssec-validation ( yes | no | auto );
|
||||
@@ -416,8 +395,8 @@ options {
|
||||
<replaceable>integer</replaceable>;
|
||||
response-policy { zone <replaceable>string</replaceable> [ add-soa <replaceable>boolean</replaceable> ] [ log
|
||||
<replaceable>boolean</replaceable> ] [ max-policy-ttl <replaceable>duration</replaceable> ] [ min-update-interval
|
||||
<replaceable>duration</replaceable> ] [ policy ( cname | disabled | drop | given | no-op
|
||||
| nodata | nxdomain | passthru | tcp-only <replaceable>quoted_string</replaceable> ) ] [
|
||||
<replaceable>duration</replaceable> ] [ policy ( cname | disabled | drop | given | no-op |
|
||||
nodata | nxdomain | passthru | tcp-only <replaceable>quoted_string</replaceable> ) ] [
|
||||
recursive-only <replaceable>boolean</replaceable> ] [ nsip-enable <replaceable>boolean</replaceable> ] [
|
||||
nsdname-enable <replaceable>boolean</replaceable> ]; ... } [ add-soa <replaceable>boolean</replaceable> ] [
|
||||
break-dnssec <replaceable>boolean</replaceable> ] [ max-policy-ttl <replaceable>duration</replaceable> ] [
|
||||
@@ -550,7 +529,7 @@ trust-anchors { <replaceable>string</replaceable> ( static-key |
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>TRUSTED-KEYS</title></info>
|
||||
<para>Deprecated - see DNSSEC-KEYS.</para>
|
||||
<para>Deprecated - see TRUST-ANCHORS.</para>
|
||||
<literallayout class="normal">
|
||||
trusted-keys { <replaceable>string</replaceable> <replaceable>integer</replaceable>
|
||||
<replaceable>integer</replaceable> <replaceable>integer</replaceable>
|
||||
@@ -631,7 +610,6 @@ view <replaceable>string</replaceable> [ <replaceable>class</replaceable> ] {
|
||||
dnssec-dnskey-kskonly <replaceable>boolean</replaceable>;
|
||||
dnssec-loadkeys-interval <replaceable>integer</replaceable>;
|
||||
dnssec-must-be-secure <replaceable>string</replaceable> <replaceable>boolean</replaceable>;
|
||||
dnssec-policy <replaceable>string</replaceable>;
|
||||
dnssec-secure-to-insecure <replaceable>boolean</replaceable>;
|
||||
dnssec-update-mode ( maintain | no-resign );
|
||||
dnssec-validation ( yes | no | auto );
|
||||
@@ -755,8 +733,8 @@ view <replaceable>string</replaceable> [ <replaceable>class</replaceable> ] {
|
||||
<replaceable>integer</replaceable>;
|
||||
response-policy { zone <replaceable>string</replaceable> [ add-soa <replaceable>boolean</replaceable> ] [ log
|
||||
<replaceable>boolean</replaceable> ] [ max-policy-ttl <replaceable>duration</replaceable> ] [ min-update-interval
|
||||
<replaceable>duration</replaceable> ] [ policy ( cname | disabled | drop | given | no-op
|
||||
| nodata | nxdomain | passthru | tcp-only <replaceable>quoted_string</replaceable> ) ] [
|
||||
<replaceable>duration</replaceable> ] [ policy ( cname | disabled | drop | given | no-op |
|
||||
nodata | nxdomain | passthru | tcp-only <replaceable>quoted_string</replaceable> ) ] [
|
||||
recursive-only <replaceable>boolean</replaceable> ] [ nsip-enable <replaceable>boolean</replaceable> ] [
|
||||
nsdname-enable <replaceable>boolean</replaceable> ]; ... } [ add-soa <replaceable>boolean</replaceable> ] [
|
||||
break-dnssec <replaceable>boolean</replaceable> ] [ max-policy-ttl <replaceable>duration</replaceable> ] [
|
||||
@@ -1036,6 +1014,26 @@ zone <replaceable>string</replaceable> [ <replaceable>class</replaceable> ] {
|
||||
</literallayout>
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>DNSSEC-POLICY</title></info>
|
||||
|
||||
<literallayout class="normal">
|
||||
dnssec-policy <replaceable>string</replaceable> {
|
||||
dnskey-ttl <replaceable>duration</replaceable>;
|
||||
keys { ( csk | ksk | zsk ) key-directory lifetime <replaceable>duration</replaceable> algorithm <replaceable>integer</replaceable> [ <replaceable>integer</replaceable> ] ; ... };
|
||||
parent-ds-ttl <replaceable>duration</replaceable>;
|
||||
parent-propagation-delay <replaceable>duration</replaceable>;
|
||||
parent-registration-delay <replaceable>duration</replaceable>;
|
||||
publish-safety <replaceable>duration</replaceable>;
|
||||
retire-safety <replaceable>duration</replaceable>;
|
||||
signatures-refresh <replaceable>duration</replaceable>;
|
||||
signatures-validity <replaceable>duration</replaceable>;
|
||||
signatures-validity-dnskey <replaceable>duration</replaceable>;
|
||||
zone-max-ttl <replaceable>duration</replaceable>;
|
||||
zone-propagation-delay <replaceable>duration</replaceable>;
|
||||
};
|
||||
</literallayout>
|
||||
</refsection>
|
||||
|
||||
<refsection><info><title>FILES</title></info>
|
||||
|
||||
<para><filename>/etc/named.conf</filename>
|
||||
|
||||
+40
-42
@@ -92,28 +92,7 @@ dlz
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.11"></a><h2>DNSSEC-POLICY</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
dnssec-policy <em class="replaceable"><code>string</code></em> {<br>
|
||||
dnskey-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
keys { ( csk | ksk | zsk ) ( key-directory ) lifetime ( <em class="replaceable"><code>duration</code></em> | unlimited )<br>
|
||||
algorithm <em class="replaceable"><code>integer</code></em> [ <em class="replaceable"><code>integer</code></em> ]; ... };<br>
|
||||
max-zone-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
parent-ds-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
parent-propagation-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
parent-registration-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
publish-safety <em class="replaceable"><code>duration</code></em>;<br>
|
||||
retire-safety <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-refresh <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-validity <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-validity-dnskey <em class="replaceable"><code>duration</code></em>;<br>
|
||||
zone-propagation-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
};<br>
|
||||
</p></div>
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.12"></a><h2>DYNDB</h2>
|
||||
<a name="id-1.11"></a><h2>DYNDB</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
dyndb <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>quoted_string</code></em> {<br>
|
||||
<em class="replaceable"><code>unspecified-text</code></em> };<br>
|
||||
@@ -121,7 +100,7 @@ dyndb
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.13"></a><h2>KEY</h2>
|
||||
<a name="id-1.12"></a><h2>KEY</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
key <em class="replaceable"><code>string</code></em> {<br>
|
||||
algorithm <em class="replaceable"><code>string</code></em>;<br>
|
||||
@@ -131,7 +110,7 @@ key
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.14"></a><h2>LOGGING</h2>
|
||||
<a name="id-1.13"></a><h2>LOGGING</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
logging {<br>
|
||||
category <em class="replaceable"><code>string</code></em> { <em class="replaceable"><code>string</code></em>; ... };<br>
|
||||
@@ -152,8 +131,8 @@ logging
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.15"></a><h2>MANAGED-KEYS</h2>
|
||||
<p>Deprecated - see DNSSEC-KEYS.</p>
|
||||
<a name="id-1.14"></a><h2>MANAGED-KEYS</h2>
|
||||
<p>Deprecated - see TRUST-ANCHORS.</p>
|
||||
<div class="literallayout"><p><br>
|
||||
managed-keys { <em class="replaceable"><code>string</code></em> ( static-key<br>
|
||||
| initial-key | static-ds |<br>
|
||||
@@ -163,7 +142,7 @@ managed-keys
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.16"></a><h2>MASTERS</h2>
|
||||
<a name="id-1.15"></a><h2>MASTERS</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
masters <em class="replaceable"><code>string</code></em> [ port <em class="replaceable"><code>integer</code></em> ] [ dscp<br>
|
||||
<em class="replaceable"><code>integer</code></em> ] { ( <em class="replaceable"><code>masters</code></em> | <em class="replaceable"><code>ipv4_address</code></em> [<br>
|
||||
@@ -173,7 +152,7 @@ masters
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.17"></a><h2>OPTIONS</h2>
|
||||
<a name="id-1.16"></a><h2>OPTIONS</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
options {<br>
|
||||
allow-new-zones <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
@@ -253,7 +232,6 @@ options
|
||||
dnssec-dnskey-kskonly <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-loadkeys-interval <em class="replaceable"><code>integer</code></em>;<br>
|
||||
dnssec-must-be-secure <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-policy <em class="replaceable"><code>string</code></em>;<br>
|
||||
dnssec-secure-to-insecure <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-update-mode ( maintain | no-resign );<br>
|
||||
dnssec-validation ( yes | no | auto );<br>
|
||||
@@ -403,8 +381,8 @@ options
|
||||
<em class="replaceable"><code>integer</code></em>;<br>
|
||||
response-policy { zone <em class="replaceable"><code>string</code></em> [ add-soa <em class="replaceable"><code>boolean</code></em> ] [ log<br>
|
||||
<em class="replaceable"><code>boolean</code></em> ] [ max-policy-ttl <em class="replaceable"><code>duration</code></em> ] [ min-update-interval<br>
|
||||
<em class="replaceable"><code>duration</code></em> ] [ policy ( cname | disabled | drop | given | no-op<br>
|
||||
| nodata | nxdomain | passthru | tcp-only <em class="replaceable"><code>quoted_string</code></em> ) ] [<br>
|
||||
<em class="replaceable"><code>duration</code></em> ] [ policy ( cname | disabled | drop | given | no-op |<br>
|
||||
nodata | nxdomain | passthru | tcp-only <em class="replaceable"><code>quoted_string</code></em> ) ] [<br>
|
||||
recursive-only <em class="replaceable"><code>boolean</code></em> ] [ nsip-enable <em class="replaceable"><code>boolean</code></em> ] [<br>
|
||||
nsdname-enable <em class="replaceable"><code>boolean</code></em> ]; ... } [ add-soa <em class="replaceable"><code>boolean</code></em> ] [<br>
|
||||
break-dnssec <em class="replaceable"><code>boolean</code></em> ] [ max-policy-ttl <em class="replaceable"><code>duration</code></em> ] [<br>
|
||||
@@ -473,7 +451,7 @@ options
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.18"></a><h2>PLUGIN</h2>
|
||||
<a name="id-1.17"></a><h2>PLUGIN</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
plugin ( query ) <em class="replaceable"><code>string</code></em> [ { <em class="replaceable"><code>unspecified-text</code></em><br>
|
||||
} ];<br>
|
||||
@@ -481,7 +459,7 @@ plugin
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.19"></a><h2>SERVER</h2>
|
||||
<a name="id-1.18"></a><h2>SERVER</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
server <em class="replaceable"><code>netprefix</code></em> {<br>
|
||||
bogus <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
@@ -519,7 +497,7 @@ server
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.20"></a><h2>STATISTICS-CHANNELS</h2>
|
||||
<a name="id-1.19"></a><h2>STATISTICS-CHANNELS</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
statistics-channels {<br>
|
||||
inet ( <em class="replaceable"><code>ipv4_address</code></em> | <em class="replaceable"><code>ipv6_address</code></em> |<br>
|
||||
@@ -531,7 +509,7 @@ statistics-channels
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.21"></a><h2>TRUST-ANCHORS</h2>
|
||||
<a name="id-1.20"></a><h2>TRUST-ANCHORS</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
trust-anchors { <em class="replaceable"><code>string</code></em> ( static-key |<br>
|
||||
initial-key | static-ds | initial-ds )<br>
|
||||
@@ -541,8 +519,8 @@ trust-anchors
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.22"></a><h2>TRUSTED-KEYS</h2>
|
||||
<p>Deprecated - see DNSSEC-KEYS.</p>
|
||||
<a name="id-1.21"></a><h2>TRUSTED-KEYS</h2>
|
||||
<p>Deprecated - see TRUST-ANCHORS.</p>
|
||||
<div class="literallayout"><p><br>
|
||||
trusted-keys { <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>integer</code></em><br>
|
||||
<em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>integer</code></em><br>
|
||||
@@ -551,7 +529,7 @@ trusted-keys
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.23"></a><h2>VIEW</h2>
|
||||
<a name="id-1.22"></a><h2>VIEW</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
view <em class="replaceable"><code>string</code></em> [ <em class="replaceable"><code>class</code></em> ] {<br>
|
||||
allow-new-zones <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
@@ -624,7 +602,6 @@ view
|
||||
dnssec-dnskey-kskonly <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-loadkeys-interval <em class="replaceable"><code>integer</code></em>;<br>
|
||||
dnssec-must-be-secure <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-policy <em class="replaceable"><code>string</code></em>;<br>
|
||||
dnssec-secure-to-insecure <em class="replaceable"><code>boolean</code></em>;<br>
|
||||
dnssec-update-mode ( maintain | no-resign );<br>
|
||||
dnssec-validation ( yes | no | auto );<br>
|
||||
@@ -748,8 +725,8 @@ view
|
||||
<em class="replaceable"><code>integer</code></em>;<br>
|
||||
response-policy { zone <em class="replaceable"><code>string</code></em> [ add-soa <em class="replaceable"><code>boolean</code></em> ] [ log<br>
|
||||
<em class="replaceable"><code>boolean</code></em> ] [ max-policy-ttl <em class="replaceable"><code>duration</code></em> ] [ min-update-interval<br>
|
||||
<em class="replaceable"><code>duration</code></em> ] [ policy ( cname | disabled | drop | given | no-op<br>
|
||||
| nodata | nxdomain | passthru | tcp-only <em class="replaceable"><code>quoted_string</code></em> ) ] [<br>
|
||||
<em class="replaceable"><code>duration</code></em> ] [ policy ( cname | disabled | drop | given | no-op |<br>
|
||||
nodata | nxdomain | passthru | tcp-only <em class="replaceable"><code>quoted_string</code></em> ) ] [<br>
|
||||
recursive-only <em class="replaceable"><code>boolean</code></em> ] [ nsip-enable <em class="replaceable"><code>boolean</code></em> ] [<br>
|
||||
nsdname-enable <em class="replaceable"><code>boolean</code></em> ]; ... } [ add-soa <em class="replaceable"><code>boolean</code></em> ] [<br>
|
||||
break-dnssec <em class="replaceable"><code>boolean</code></em> ] [ max-policy-ttl <em class="replaceable"><code>duration</code></em> ] [<br>
|
||||
@@ -931,7 +908,7 @@ view
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.24"></a><h2>ZONE</h2>
|
||||
<a name="id-1.23"></a><h2>ZONE</h2>
|
||||
<div class="literallayout"><p><br>
|
||||
zone <em class="replaceable"><code>string</code></em> [ <em class="replaceable"><code>class</code></em> ] {<br>
|
||||
allow-notify { <em class="replaceable"><code>address_match_element</code></em>; ... };<br>
|
||||
@@ -1030,6 +1007,27 @@ zone
|
||||
</p></div>
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.24"></a><h2>DNSSEC-POLICY</h2>
|
||||
|
||||
<div class="literallayout"><p><br>
|
||||
dnssec-policy <em class="replaceable"><code>string</code></em> {<br>
|
||||
dnskey-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
keys { ( csk | ksk | zsk ) key-directory lifetime <em class="replaceable"><code>duration</code></em> algorithm <em class="replaceable"><code>integer</code></em> [ <em class="replaceable"><code>integer</code></em> ] ; ... };<br>
|
||||
parent-ds-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
parent-propagation-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
parent-registration-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
publish-safety <em class="replaceable"><code>duration</code></em>;<br>
|
||||
retire-safety <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-refresh <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-validity <em class="replaceable"><code>duration</code></em>;<br>
|
||||
signatures-validity-dnskey <em class="replaceable"><code>duration</code></em>;<br>
|
||||
zone-max-ttl <em class="replaceable"><code>duration</code></em>;<br>
|
||||
zone-propagation-delay <em class="replaceable"><code>duration</code></em>;<br>
|
||||
};<br>
|
||||
</p></div>
|
||||
</div>
|
||||
|
||||
<div class="refsection">
|
||||
<a name="id-1.25"></a><h2>FILES</h2>
|
||||
|
||||
|
||||
@@ -294,9 +294,9 @@
|
||||
<para>
|
||||
Allow <command>named</command> to use up to
|
||||
<replaceable class="parameter">#max-socks</replaceable> sockets.
|
||||
The default value is 21000 on systems built with default
|
||||
configuration options, and 4096 on systems built with
|
||||
"configure --with-tuning=small".
|
||||
The default value is 4096 on systems built with default
|
||||
configuration options, and 21000 on systems built with
|
||||
"configure --with-tuning=large".
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user