Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78959765da | ||
|
|
1e9e0402d3 | ||
|
|
689692493e | ||
|
|
5e7cc35fd7 | ||
|
|
a09e1cdd98 |
+1
-3
@@ -78,6 +78,4 @@ PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
|
||||
RemoveParentheses: ReturnStatement
|
||||
RemoveSemicolon: true
|
||||
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE' ]
|
||||
|
||||
@@ -78,5 +78,3 @@ PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
RemoveParentheses: ReturnStatement
|
||||
RemoveSemicolon: true
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@
|
||||
;; libtest
|
||||
(expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "tests/include"))
|
||||
|
||||
|
||||
;; bin
|
||||
(expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "bin/check"))
|
||||
@@ -61,7 +61,7 @@
|
||||
(expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "bin/confgen"))
|
||||
(expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
|
||||
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
|
||||
(expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "bin/dig/include"))
|
||||
(expand-file-name
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
(expand-file-name "/usr/include/libxml2")
|
||||
(expand-file-name "/usr/include/json-c")
|
||||
|
||||
|
||||
(expand-file-name "/usr/local/opt/openssl@1.1/include")
|
||||
(expand-file-name "/usr/local/opt/libxml2/include/libxml2")
|
||||
(expand-file-name "/usr/local/opt/json-c/include/json-c/")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[*.sh{,.in}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
binary_next_line = true
|
||||
switch_case_indent = true
|
||||
@@ -1526,25 +1526,3 @@ ffaab41a01621c0e02196e225f9269daf8b2ec8f
|
||||
ffac31097d25039951063bbb9f864e223a46ad1b
|
||||
# update copyright notice / whitespace
|
||||
ffbe6b95371c99b7fb05e6de17a8d6b7bf4f629f
|
||||
# remove trailing whitespace
|
||||
5893debf46ce1b5fbe793114a59da28fac4cccb7
|
||||
# arithmetic expansion in system tests
|
||||
4d42bdc245a1db1654abb502a52a5a8a3a570881
|
||||
# arithmetic expansion in system tests
|
||||
1436025e20ae13cfe55df14d62f5812c0cea2ee9
|
||||
# subshell notation in system tests
|
||||
05baf7206b7baaf91cb8e049ad13e413c52cdf3f
|
||||
# reformat shell scripts with shfmt
|
||||
4cb8b13987b930952238cc88e84272b8cf911933
|
||||
# Reformat sources with up-to-date clang-format-17
|
||||
79d93600116faabd89798522817ad95a69684fff
|
||||
# Reformat sources with up-to-date clang-format-18
|
||||
b7de2c7cb959fa35099d72c3f9b13938348c74e6
|
||||
# Reformat sources with up-to-date clang-format-19
|
||||
0aeefb974197ccf05c3f25c20506b4e8b97ded5d
|
||||
# Reformat sources with up-to-date clang-format-19
|
||||
f2fa1b7d63100564dc55463a05bdeed893f83d86
|
||||
# Remove redundant semicolons after the closing braces of functions
|
||||
c22176c0f9a71217be9bfab00573f8f0265499af
|
||||
# Remove redundant parentheses from the return statement
|
||||
58a15d38c2c321fac75abef389a48ff82deaccf0
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@
|
||||
/util/** export-ignore
|
||||
/util/bindkeys.pl -export-ignore
|
||||
/util/check-make-install.in -export-ignore
|
||||
/util/dtrace.sh -export-ignore
|
||||
/util/mksymtbl.pl -export-ignore
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
contrib/gitchangelog/changelog.rc.py
|
||||
@@ -5,7 +5,6 @@
|
||||
*.la
|
||||
*.lo
|
||||
*.log
|
||||
*.log.txt
|
||||
*.o
|
||||
*.orig
|
||||
*.plist/ # ccc-analyzer store its results in .plist directories
|
||||
@@ -75,7 +74,6 @@ doc/man/dnssec-importkey.8in
|
||||
doc/man/dnssec-keyfromlabel.8in
|
||||
doc/man/dnssec-keygen.8in
|
||||
doc/man/dnssec-keymgr.8in
|
||||
doc/man/dnssec-ksr.8in
|
||||
doc/man/dnssec-revoke.8in
|
||||
doc/man/dnssec-settime.8in
|
||||
doc/man/dnssec-signzone.8in
|
||||
@@ -96,7 +94,6 @@ doc/man/pkcs11-tokens.8in
|
||||
/GPATH
|
||||
/GRTAGS
|
||||
/GTAGS
|
||||
TAGS
|
||||
# Emacs specific files
|
||||
\.dir-locals-2.el
|
||||
/emacs.desktop
|
||||
|
||||
+547
-741
File diff suppressed because it is too large
Load Diff
@@ -2,62 +2,45 @@
|
||||
If the bug you are reporting is potentially security-related - for example,
|
||||
if it involves an assertion failure or other crash in `named` that can be
|
||||
triggered repeatedly - then please make sure that you make the new issue
|
||||
confidential by clicking the checkbox at the bottom!
|
||||
confidential!
|
||||
-->
|
||||
|
||||
### Summary
|
||||
|
||||
<!-- Concisely summarize the bug encountered. -->
|
||||
(Summarize the bug encountered concisely.)
|
||||
|
||||
### BIND version affected
|
||||
<!--
|
||||
Make sure you are testing with the **latest** supported version of BIND
|
||||
for a given branch. Many bugs have been fixed over time!
|
||||
### BIND version used
|
||||
|
||||
See https://kb.isc.org/docs/supported-platforms for the current list.
|
||||
The latest source is available from https://www.isc.org/download/#BIND
|
||||
|
||||
Paste the output of `named -V` here.
|
||||
-->
|
||||
(Paste the output of `named -V`.)
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!--
|
||||
This is extremely important! Be precise and use itemized lists, please.
|
||||
|
||||
Even if a default configuration is affected, please include the full configuration
|
||||
files _you were testing with_.
|
||||
|
||||
Example:
|
||||
1. Use _attached_ configuration file
|
||||
2. Start BIND server with command: `named -g -c named.conf ...`
|
||||
3. Simulate legitimate clients using command `dnsperf -S1 -d legit-queries ...`
|
||||
4. Simulate attack traffic using command `dnsperf -S1 -d attack-queries ...`
|
||||
-->
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
(How one can reproduce the issue - this is very important.)
|
||||
|
||||
### What is the current *bug* behavior?
|
||||
|
||||
<!-- What actually happens. -->
|
||||
(What actually happens.)
|
||||
|
||||
### What is the expected *correct* behavior?
|
||||
|
||||
<!-- What you should see instead. -->
|
||||
(What you should see instead.)
|
||||
|
||||
### Relevant configuration files
|
||||
|
||||
<!-- Paste any relevant configuration files here - please use code blocks (```)
|
||||
(Paste any relevant configuration files - please use code blocks (```)
|
||||
to format console output. If submitting the contents of your
|
||||
configuration file in a non-confidential issue, it is advisable to
|
||||
obscure key secrets; this can be done automatically by using
|
||||
`named-checkconf -px`. -->
|
||||
configuration file in a non-confidential Issue, it is advisable to
|
||||
obscure key secrets: this can be done automatically by using
|
||||
`named-checkconf -px`.)
|
||||
|
||||
### Relevant logs
|
||||
### Relevant logs and/or screenshots
|
||||
|
||||
<!-- Paste any relevant logs here - please use code blocks (```) to format console
|
||||
output, logs, and code, as it's very hard to read otherwise. -->
|
||||
(Paste any relevant logs - please use code blocks (```) to format console
|
||||
output, logs, and code, as it's very hard to read otherwise.)
|
||||
|
||||
/label ~Bug
|
||||
### Possible fixes
|
||||
|
||||
(If you can, link to the line of code that might be responsible for the
|
||||
problem.)
|
||||
|
||||
/label ~bug
|
||||
|
||||
@@ -16,9 +16,11 @@ confidential!
|
||||
| Mattermost Channel: | [CVE-YYYY-NNNN][mattermost_url] |
|
||||
| Support Ticket: | [URL] |
|
||||
| Release Checklist: | #NNNN |
|
||||
| Post-mortem Etherpad: | [postmortem-YYYY-MM][postmortem_url] |
|
||||
|
||||
[cvss_score]: https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:X/AC:X/PR:X/UI:X/S:X/C:X/I:X/A:X&version=3.1
|
||||
[mattermost_url]:
|
||||
[postmortem_url]:
|
||||
|
||||
:bulb: **Click [here][checklist_explanations] (internal resource) for general information about the security incident handling process.**
|
||||
|
||||
@@ -28,14 +30,14 @@ confidential!
|
||||
|
||||
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
|
||||
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
|
||||
- [ ] [:link:][step_etherpad] **(IM)** Create an Etherpad for post-mortem
|
||||
- [ ] [:link:][step_public_mrs] **(SwEng)** Ensure there are no public merge requests which inadvertently disclose the issue
|
||||
- [ ] [:link:][step_assign_cve_id] **(IM)** Assign a CVE identifier
|
||||
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier and the CVSS score
|
||||
- [ ] [:link:][step_versions_affected] **(SwEng)** Determine the range of product versions affected (including the Subscription Edition)
|
||||
- [ ] [:link:][step_workarounds] **(SwEng)** Determine whether workarounds for the problem exist
|
||||
- [ ] [:link:][step_coordinate] **(SwEng)** If necessary, coordinate with other parties
|
||||
- [ ] [:link:][step_earliest_prepare] **(Support)** Prepare "earliest" notification text and hand it off to Marketing
|
||||
- [ ] [:link:][step_earliest_send] **(Marketing)** Update "earliest" notification document in SF portal and send bulk email to earliest customers
|
||||
- [ ] [:link:][step_earliest] **(Support)** Prepare and send out "earliest" notifications
|
||||
- [ ] [:link:][step_advisory_mr] **(Support)** Create a merge request for the Security Advisory and include all readily available information in it
|
||||
- [ ] [:link:][step_reproducer_mr] **(SwEng)** Prepare a private merge request containing a system test reproducing the problem
|
||||
- [ ] [:link:][step_notify_support] **(SwEng)** Notify Support when a reproducer is ready
|
||||
@@ -46,48 +48,53 @@ confidential!
|
||||
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
|
||||
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
|
||||
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
|
||||
- [ ] [:link:][step_changes] **(QA)** (BIND 9 only) Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
|
||||
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
|
||||
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
|
||||
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
|
||||
|
||||
### At T-5
|
||||
|
||||
- [ ] [:link:][step_asn_documents] **(Marketing)** Update the text on the T-5 (from the Printing Press project) and "earliest" ASN documents in the SF portal
|
||||
- [ ] [:link:][step_asn_links] **(Marketing)** (BIND 9 only) Update the BIND -S information document in SF with download links to the new versions
|
||||
- [ ] [:link:][step_asn_send] **(Marketing)** Bulk email eligible customers to check the SF portal
|
||||
- [ ] [:link:][step_preannouncement] **(Marketing)** (BIND 9 only) Send a pre-announcement email to the *bind-announce* mailing list to alert users that the upcoming release will include security fixes
|
||||
- [ ] [:link:][step_send_asn] **(Support)** Send ASN to eligible customers
|
||||
- [ ] [:link:][step_preannouncement] **(Support)** (BIND 9 only) Send a pre-announcement email to the *bind-announce* mailing list to alert users that the upcoming release will include security fixes
|
||||
|
||||
### At T-4
|
||||
|
||||
- [ ] [:link:][step_verify_asn] **(Support)** Verify that all ASN-eligible customers have received the notification email
|
||||
|
||||
### At T-1
|
||||
|
||||
- [ ] [:link:][step_check_customers] **(Support)** Verify that any new or reinstated customers have received the notification email
|
||||
- [ ] [:link:][step_packager_emails] **(First IM)** Send notifications to OS packagers
|
||||
|
||||
### On the Day of Public Disclosure
|
||||
|
||||
- [ ] [:link:][step_clearance] **(IM)** Grant QA & Marketing clearance to proceed with public release
|
||||
- [ ] [:link:][step_publish] **(QA/Marketing)** Publish the releases (as outlined in the release checklist)
|
||||
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Add the new CVEs to the vulnerability matrix in the Knowledge Base
|
||||
- [ ] [:link:][step_clearance] **(IM)** Grant Support clearance to proceed with public release
|
||||
- [ ] [:link:][step_publish] **(Support)** Publish the releases (as outlined in the release checklist)
|
||||
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Update vulnerability matrix in the Knowledge Base
|
||||
- [ ] [:link:][step_publish_advisory] **(Support)** Bump Document Version for the Security Advisory and publish it in the Knowledge Base
|
||||
- [ ] [:link:][step_notifications] **(First IM)** Send notification emails to third parties
|
||||
- [ ] [:link:][step_mitre] **(First IM)** Advise MITRE about the disclosed CVEs
|
||||
- [ ] [:link:][step_merge_advisory] **(First IM)** Merge the Security Advisory merge request
|
||||
- [ ] [:link:][step_embargo_end] **(IM)** Inform original reporter (if external) that the security disclosure process is complete
|
||||
- [ ] [:link:][step_asn_clear] **(Marketing)** Update the SF portal to clear the ASN
|
||||
- [ ] [:link:][step_customers] **(Marketing)** Email ASN recipients that the embargo is lifted
|
||||
- [ ] [:link:][step_customers] **(Support)** Inform customers a fix has been released
|
||||
|
||||
### After Public Disclosure
|
||||
|
||||
- [ ] [:link:][step_postmortem] **(First IM)** Organize post-mortem meeting and make sure it happens
|
||||
- [ ] [:link:][step_tickets] **(Support)** Close support tickets
|
||||
- [ ] [:link:][step_regression] **(QA)** Merge a regression test reproducing the bug into all affected (and still maintained) branches
|
||||
|
||||
[step_deputy]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#pick-a-deputy-incident-manager
|
||||
[step_respond]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#respond-to-the-bug-reporter
|
||||
[step_etherpad]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-an-etherpad-for-post-mortem
|
||||
[step_public_mrs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-there-are-no-public-merge-requests-which-inadvertently-disclose-the-issue
|
||||
[step_assign_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#assign-a-cve-identifier
|
||||
[step_note_cve_info]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-this-issue-with-the-assigned-cve-identifier-and-the-cvss-score
|
||||
[step_versions_affected]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-the-range-of-product-versions-affected-including-the-subscription-edition
|
||||
[step_workarounds]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-whether-workarounds-for-the-problem-exist
|
||||
[step_coordinate]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#if-necessary-coordinate-with-other-parties
|
||||
[step_earliest_prepare]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-earliest-notification-text-and-hand-it-off-to-marketing
|
||||
[step_earliest_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-earliest-notification-document-in-sf-portal-and-send-bulk-email-to-earliest-customers
|
||||
[step_earliest]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-and-send-out-earliest-notifications
|
||||
[step_advisory_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-a-merge-request-for-the-security-advisory-and-include-all-readily-available-information-in-it
|
||||
[step_reproducer_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-containing-a-system-test-reproducing-the-problem
|
||||
[step_notify_support]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-support-when-a-reproducer-is-ready
|
||||
@@ -102,21 +109,20 @@ confidential!
|
||||
[step_merge_fixes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-cve-fixes-in-cve-identifier-order
|
||||
[step_patches]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-standalone-patch-for-the-last-stable-release-of-each-affected-and-still-maintained-product-branch
|
||||
[step_asn_releases]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-asn-releases-as-outlined-in-the-release-checklist
|
||||
[step_asn_documents]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-text-on-the-t-5-from-the-printing-press-project-and-earliest-asn-documents-in-the-sf-portal
|
||||
[step_asn_links]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-the-bind-s-information-document-in-sf-with-download-links-to-the-new-versions
|
||||
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bulk-email-eligible-customers-to-check-the-sf-portal
|
||||
[step_send_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-asn-to-eligible-customers
|
||||
[step_preannouncement]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-send-a-pre-announcement-email-to-the-bind-announce-mailing-list-to-alert-users-that-the-upcoming-release-will-include-security-fixes
|
||||
[step_verify_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-all-asn-eligible-customers-have-received-the-notification-email
|
||||
[step_check_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-any-new-or-reinstated-customers-have-received-the-notification-email
|
||||
[step_packager_emails]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notifications-to-os-packagers
|
||||
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-qa-marketing-clearance-to-proceed-with-public-release
|
||||
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-support-clearance-to-proceed-with-public-release
|
||||
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
|
||||
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-add-the-new-cves-to-the-vulnerability-matrix-in-the-knowledge-base
|
||||
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-vulnerability-matrix-in-the-knowledge-base
|
||||
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-and-publish-it-in-the-knowledge-base
|
||||
[step_notifications]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notification-emails-to-third-parties
|
||||
[step_mitre]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#advise-mitre-about-the-disclosed-cves
|
||||
[step_merge_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-security-advisory-merge-request
|
||||
[step_embargo_end]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-original-reporter-if-external-that-the-security-disclosure-process-is-complete
|
||||
[step_asn_clear]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-sf-portal-to-clear-the-asn
|
||||
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#email-asn-recipients-that-the-embargo-is-lifted
|
||||
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-customers-a-fix-has-been-released
|
||||
[step_postmortem]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#organize-post-mortem-meeting-and-make-sure-it-happens
|
||||
[step_tickets]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#close-support-tickets
|
||||
[step_regression]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-a-regression-test-reproducing-the-bug-into-all-affected-and-still-maintained-branches
|
||||
|
||||
/confidential
|
||||
@@ -1,8 +0,0 @@
|
||||
Hi and thanks for filing an issue! It will be read with care by human beings.
|
||||
|
||||
It would be a tremendous help if you could follow these steps first:
|
||||
- [ ] Search the existing issues in GitLab (both open and closed) to see if your report might be a duplicate. We have a large database here and many issues have already been fixed in the latest versions!
|
||||
- [ ] Make sure this is **not** a support question. If you have specific trouble configuring or debugging your setup, please use the bind-users mailing list: https://lists.isc.org/mailman/listinfo/bind-users
|
||||
- [ ] You have read and understood the "out in the open" support policy: https://blog.powerdns.com/2016/01/18/open-source-support-out-in-the-open/ . Even though it was written by the PowerDNS folks, we follow it as well!
|
||||
|
||||
Before continuing, **please select the appropriate issue template in the drop-down menu above, under the heading _Description_**.
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
### Links / references
|
||||
|
||||
/label ~Feature
|
||||
/label ~"feature request"
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
## Release Schedule
|
||||
|
||||
**Code Freeze:**
|
||||
|
||||
**Tagging Deadline:**
|
||||
|
||||
**Public Release:**
|
||||
|
||||
## Documentation Review Links
|
||||
|
||||
**Closed issues assigned to the milestone without a release note:**
|
||||
|
||||
- []()
|
||||
- []()
|
||||
- []()
|
||||
|
||||
**Merge requests merged into the milestone without a release note:**
|
||||
|
||||
- []()
|
||||
- []()
|
||||
- []()
|
||||
|
||||
**Merge requests merged into the milestone without a `CHANGES` entry:**
|
||||
|
||||
- []()
|
||||
- []()
|
||||
- []()
|
||||
|
||||
## Release Checklist
|
||||
|
||||
### Before the Code Freeze
|
||||
|
||||
- [ ] ***(QA)*** Rebase -S editions on top of current open-source versions: `git checkout bind-9.18-sub && git rebase origin/bind-9.18`
|
||||
- [ ] ***(QA)*** [Inform](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/inform_supp_marketing.py) Support and Marketing of impending release (and give estimated release dates).
|
||||
- [ ] ***(QA)*** Ensure there are no permanent test failures on any platform. Check [public](https://gitlab.isc.org/isc-projects/bind9/-/pipelines?scope=all&source=schedule) and [private](https://gitlab.isc.org/isc-private/bind9/-/pipelines?scope=all&source=schedule) scheduled pipelines.
|
||||
- [ ] ***(QA)*** Check [Perflab](https://perflab.isc.org/) to ensure there has been no unexplained drop in performance for the versions being released.
|
||||
- [ ] ***(QA)*** Check whether all issues assigned to the release milestone are resolved[^1].
|
||||
- [ ] ***(QA)*** Ensure that there are no outstanding [merge requests in the private repository](https://gitlab.isc.org/isc-private/bind9/-/merge_requests/)[^1] (Subscription Edition only).
|
||||
- [ ] ***(QA)*** [Ensure](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/check_backports.py) all merge requests marked for backporting have been indeed backported.
|
||||
- [ ] ***(QA)*** [Announce](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/inform_code_freeze.py) (on Mattermost) that the code freeze is in effect.
|
||||
|
||||
### Before the Tagging Deadline
|
||||
|
||||
- [ ] ***(QA)*** Ensure release notes are correct, ask Support and Marketing to check them as well. [Example](https://gitlab.isc.org/isc-private/bind9/-/merge_requests/510)
|
||||
- [ ] ***(QA)*** Add a release marker to `CHANGES`. Examples: [9.18](https://gitlab.isc.org/isc-projects/bind9/-/commit/f14d8ad78c0506fd4247187f2177f8eceeb6b3b9), [9.16](https://gitlab.isc.org/isc-projects/bind9/-/commit/1bcdf21874f99a00da389d723e0ad07dfd70f9f1)
|
||||
- [ ] ***(QA)*** Add a release marker to `CHANGES.SE` (Subscription Edition only). [Example](https://gitlab.isc.org/isc-private/bind9/-/commit/0f03d5737bcbdaa1bf713c6db1887b14938c3421)
|
||||
- [ ] ***(QA)*** Update BIND 9 version in `configure.ac` ([9.18+](https://gitlab.isc.org/isc-projects/bind9/-/commit/3c85ab7f4c35e6d8acef1393606002a0a8730100)) or `version` ([9.16](https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7692/diffs?commit_id=1bcdf21874f99a00da389d723e0ad07dfd70f9f1)).
|
||||
- [ ] ***(QA)*** Rebuild `configure` using Autoconf on `docs.isc.org` (9.16).
|
||||
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to disallow merging to them: [public](https://gitlab.isc.org/isc-projects/bind9/-/settings/repository), [private](https://gitlab.isc.org/isc-private/bind9/-/settings/repository)
|
||||
- [ ] ***(QA)*** Tag the releases in the private repository (`git tag -s -m "BIND 9.x.y" v9.x.y`).
|
||||
|
||||
### Before the ASN Deadline (for ASN Releases) or the Public Release Date (for Regular Releases)
|
||||
|
||||
- [ ] ***(QA)*** Check that the formatting is correct for HTML and PDF versions of release notes.
|
||||
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
|
||||
- [ ] ***(QA)*** Verify GitLab CI results [for the tags](https://gitlab.isc.org/isc-private/bind9/-/pipelines?scope=tags) created and sign off on the releases to be published.
|
||||
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to allow merging to them again: [public](https://gitlab.isc.org/isc-projects/bind9/-/settings/repository), [private](https://gitlab.isc.org/isc-private/bind9/-/settings/repository)
|
||||
- [ ] ***(QA)*** Prepare and merge MRs resetting the release notes and updating the version string for each maintained branch: [9.16](https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7652/diffs) and [newer](https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7651/diffs)
|
||||
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
|
||||
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums. Ask [signers on Mattermost](https://mattermost.isc.org/isc/channels/bind-9-qa).
|
||||
- [ ] ***(Signers)*** Ensure that the contents of tarballs and tags are identical.
|
||||
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
|
||||
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again: Run `publish_bind.sh` on repo.isc.org to pre-publish.
|
||||
- [ ] ***(Support)*** Pre-publish ASN and/or Subscription Edition tarballs so that packages can be built.
|
||||
- [ ] ***(QA)*** Build and test ASN and/or Subscription Edition packages (in [cloudsmith branch in private repo](https://gitlab.isc.org/isc-private/rpms/bind/-/tree/cloudsmith)). [Example](https://gitlab.isc.org/isc-private/rpms/bind/-/commit/e2512f4cfaf991827a635e374e7e93b27a5f38ba)
|
||||
- [ ] ***(QA)*** Prepare the `patches/` subdirectory for each security release (if applicable).
|
||||
- [ ] ***(QA)*** Notify Support that the releases have been prepared.
|
||||
- [ ] ***(Support)*** Send out ASNs (if applicable).
|
||||
|
||||
### On the Day of Public Release
|
||||
|
||||
- [ ] ***(Support)*** Wait for clearance from Security Officer to proceed with the public release (if applicable).
|
||||
- [ ] ***(Support)*** Place tarballs in public location on FTP site.
|
||||
- [ ] ***(Support)*** Publish links to downloads on ISC website. [Example](https://gitlab.isc.org/website/theme-staging-site/-/commit/1ac7b30b73cb03228df4cd5651fa4e774ac35625)
|
||||
- [ ] ***(Support)*** Write release email to *bind-announce*. [Example](https://lists.isc.org/pipermail/bind-announce/2023-March/001231.html)
|
||||
- [ ] ***(Support)*** Write email to *bind-users* (if a major release). [Example](https://lists.isc.org/pipermail/bind-users/2022-January/105624.html)
|
||||
- [ ] ***(Support)*** Send eligible customers updated links to the Subscription Edition (update the -S edition delivery tickets, even if those links were provided earlier via an ASN ticket).
|
||||
- [ ] ***(Support)*** Update tickets in case of waiting support customers.
|
||||
- [ ] ***(QA)*** Build and test any outstanding private packages in [private repo](https://gitlab.isc.org/isc-private/rpms/bind/-/tree/cloudsmith). [Example](https://gitlab.isc.org/isc-private/rpms/bind/-/commit/2007d566db81dd9dfd79e571e2f600a3bc284da4)
|
||||
- [ ] ***(QA)*** Build [public RPMs](https://gitlab.isc.org/isc-packages/rpms/bind). [Example commit](https://gitlab.isc.org/isc-packages/rpms/bind/-/commit/3b5e851ea7c4e3570371a4878b5461f02a44f8cc) which triggers [Copr builds](https://copr.fedorainfracloud.org/coprs/isc/) automatically
|
||||
- [ ] ***(SwEng)*** Build Debian/Ubuntu packages.
|
||||
- [ ] ***(SwEng)*** Update Docker files [here](https://gitlab.isc.org/isc-projects/bind9-docker/-/branches) and make sure push is synchronized to [GitHub](https://github.com/isc-projects/bind9-docker). [Docker Hub](https://hub.docker.com/r/internetsystemsconsortium/bind9) should pick it up automatically. [Example](https://gitlab.isc.org/isc-projects/bind9-docker/-/commit/cada7e10e9af951595c98bfffc4bd42512faac05)
|
||||
- [ ] ***(QA)*** Inform Marketing of the release.
|
||||
- [ ] ***(Marketing)*** Post short note to Twitter.
|
||||
- [ ] ***(Marketing)*** Update [Wikipedia entry for BIND](https://en.wikipedia.org/wiki/BIND).
|
||||
- [ ] ***(Marketing)*** Write blog article (if a major release).
|
||||
- [ ] ***(QA)*** Ensure all new tags are annotated and signed. `git show --show-signature v9.19.12`
|
||||
- [ ] ***(QA)*** Push tags for the published releases to the public repository.
|
||||
- [ ] ***(QA)*** Merge published release tags (non-linearly) back into the their relevant development/maintenance branches. [Step 7 of the new workflow](https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6124#new-workflow)
|
||||
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to the current release milestone and do not describe a security vulnerability, then make them public.
|
||||
- [ ] ***(QA)*** Sanitize [confidential issues](https://gitlab.isc.org/isc-projects/bind9/-/issues/?sort=milestone_due_desc&state=opened&confidential=yes) which are assigned to older release milestones and describe security vulnerabilities, then make them public if appropriate[^2].
|
||||
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Black, PyLint, Sphinx) by modifying the relevant [`Dockerfile`](https://gitlab.isc.org/isc-projects/images/-/merge_requests/228/diffs).
|
||||
- [ ] ***(QA)*** Run a pipeline to rebuild all [images](https://gitlab.isc.org/isc-projects/images) used in GitLab CI.
|
||||
- [ ] ***(QA)*** Update [`metadata.json`](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/metadata.json) with the upcoming release information.
|
||||
|
||||
[^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]: As a rule of thumb, security vulnerabilities which have reproducers merged to the public repository are considered okay for full disclosure.
|
||||
@@ -1,139 +0,0 @@
|
||||
### Summary
|
||||
<!--
|
||||
Concisely summarize the bug encountered,
|
||||
preferably in one paragraph or less.
|
||||
-->
|
||||
|
||||
### BIND versions affected
|
||||
<!--
|
||||
Make sure you are testing with the **latest** supported version of BIND.
|
||||
See https://kb.isc.org/docs/supported-platforms for the current list.
|
||||
The latest source is available from https://www.isc.org/download/#BIND
|
||||
|
||||
Paste the output of `named -V` here.
|
||||
-->
|
||||
|
||||
### Preconditions and assumptions
|
||||
<!--
|
||||
Is a specific setup needed?
|
||||
|
||||
Please check the BIND Security Assumptions chapter in the ARM:
|
||||
https://bind9.readthedocs.io/en/latest/chapter7.html#security-assumptions
|
||||
|
||||
E.g. DNSSEC validation must be disabled, etc.
|
||||
E.g. Resolver must be configured to forward to attacker's server via DNS-over-TLS, etc.
|
||||
E.g. Authoritative server must be configured to transfer specific primary zone.
|
||||
E.g. Attacker must be in posession of a key authorized to modify at least one zone.
|
||||
E.g. Attacker can affect system clock on the server running BIND.
|
||||
-->
|
||||
|
||||
### Attacker's abilities
|
||||
<!--
|
||||
What resources does an attacker need to have under their control to mount this attack?
|
||||
|
||||
E.g. If attacking an authoritative server, does the attacked have to have prior
|
||||
relationship with it? "The authoritative server under attack needs to
|
||||
transfer a malicious zone from attacker's authoritative server via TLS."
|
||||
|
||||
E.g. If attacking a resolver, does the attacker need the ability to send
|
||||
arbitrary queries to the resolver under attack? Do they need to _also_ control
|
||||
an authoritative server at the same time?
|
||||
-->
|
||||
|
||||
|
||||
### Impact
|
||||
<!--
|
||||
Who or what is the victim of the attack and what is the impact?
|
||||
|
||||
Is a third party receiving many packets generated by a reflection attack?
|
||||
|
||||
If the affected party is the BIND server itself, please quantify the impact
|
||||
on legitimate clients:
|
||||
E.g. After launching the attack, the answers-per-second metric for legitimate
|
||||
traffic drops to 1/1000 within the first minute of the attack.
|
||||
-->
|
||||
|
||||
|
||||
### Steps to reproduce
|
||||
<!--
|
||||
This is extremely important! Be precise and use itemized lists, please.
|
||||
|
||||
Even if a default configuration is affected, please include the full configuration
|
||||
files _you were testing with_.
|
||||
|
||||
Example:
|
||||
1. Use the _attached_ configuration file
|
||||
2. Start the BIND server with command: `named -g -c named.conf ...`
|
||||
3. Simulate legitimate clients using the command `dnsperf -S1 -d legit-queries ...`
|
||||
4. Simulate attack traffic using the command `dnsperf -S1 -d attack-queries ...`
|
||||
-->
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### What is the current *bug* behavior?
|
||||
|
||||
<!--
|
||||
Examples:
|
||||
Legitimate QPS drops 1000x.
|
||||
Memory consumption increases out of bounds and the server crashes.
|
||||
The server crashes immediately.
|
||||
-->
|
||||
|
||||
### What is the expected *correct* behavior?
|
||||
|
||||
<!--
|
||||
If the attack causes resource exhaustion, what do you think the correct
|
||||
behavior should be? Should BIND refuse to process more requests?
|
||||
|
||||
What heuristic do you propose to distinguish legitimate and attack traffic?
|
||||
-->
|
||||
|
||||
### Relevant logs
|
||||
<!--
|
||||
Please provide log files from your testing. Include full named logs and also
|
||||
the output from any testing tools (e.g. dnsperf, DNS Shotgun, kxdpgun, etc.)
|
||||
|
||||
If multiple log files are needed, make sure all the files have matching timestamps
|
||||
so we can correlate log events across log files.
|
||||
|
||||
In the case of resource exhaustion attacks, please _also_ include system monitoring
|
||||
data. You can use https://gitlab.isc.org/isc-projects/resource-monitor/ to
|
||||
gather system-wide statistics.
|
||||
-->
|
||||
|
||||
### Coordination
|
||||
- Does this issue affect multiple implementations?
|
||||
<!--
|
||||
Issues affecting multiple implementations require very careful coordination. We
|
||||
have to make sure the information does not leak to the public until vendors are ready to
|
||||
release fixed versions. If it is a multi-vendor issue, we need to know about the situation
|
||||
as soon as possible to start the (confidential!) coordination process within
|
||||
DNS-OARC and other suitable fora.
|
||||
|
||||
Please list implementations you have tested.
|
||||
-->
|
||||
|
||||
- Have you shared the information with anyone else?
|
||||
<!--
|
||||
Have you informed other affected vendors? Or maybe submitted a paper for
|
||||
review?
|
||||
-->
|
||||
|
||||
- What is your plan to publicize this issue?
|
||||
<!--
|
||||
E.g. we plan to go public during conference XYZ on 20XX-XX-XX
|
||||
-->
|
||||
|
||||
### Acknowledgements
|
||||
<!--
|
||||
Please specify whether and how you would like to be publicly credited with
|
||||
discovering the issue. We normally use the format:
|
||||
First_name Last_name, Company_or_Team.
|
||||
-->
|
||||
|
||||
<!-- DO NOT modify the following two lines. -->
|
||||
|
||||
/label ~Bug ~Security
|
||||
/confidential
|
||||
@@ -1,27 +0,0 @@
|
||||
Alan Clegg <aclegg@isc.org>
|
||||
Alessio Podda <alessio@isc.org>
|
||||
Aram Sargsyan <aram@isc.org>
|
||||
Artem Boldariev <artem@isc.org> <artem@boldariev.com>
|
||||
Curtis Blackburn <ckb@isc.org> <ckb@freebsd11.local>
|
||||
Curtis Blackburn <ckb@isc.org> <ckb@isc.org>
|
||||
Diego Fronza <diego@isc.org>
|
||||
Evan Hunt <each@isc.org> Evan Hunt <fanf@isc.org>
|
||||
Håvard Eidnes <he@uninett.no>
|
||||
Jeremy C. Reed <jreed@isc.org> <jreed@docs.lab.isc.org>
|
||||
Jeremy C. Reed <jreed@isc.org> <jreed@ISC.org>
|
||||
Joey Salazar <joey@isc.org>
|
||||
John H. DuBois III <johnd>
|
||||
Mark Andrews <marka@isc.org>
|
||||
Mark Andrews <marka@isc.org> <marka@daemon.lab.isc.org>
|
||||
Mark Andrews <marka@isc.org> <marka@newdocs.lab.isc.org>
|
||||
Matthijs Mekking <matthijs@isc.org> <github@pletterpet.nl>
|
||||
Nicki Křížek <nicki@isc.org> <tkrizek@isc.org>
|
||||
Ondřej Surý <ondrej@isc.org>
|
||||
Ondřej Surý <ondrej@isc.org> <ondrej@openbsd-6-9.home.sury.org>
|
||||
Ondřej Surý <ondrej@isc.org> <ondrej@sury.org>
|
||||
Petr Menšík <pemensik@redhat.com>
|
||||
Petr Menšík <pemensik@redhat.com> <pmensik@redhat.com>
|
||||
Robert Edmonds <edmonds>
|
||||
Tatuya JINMEI 神明達哉 <jinmei@isc.org>
|
||||
Witold Kręcicki <wpk@isc.org>
|
||||
Witold Kręcicki <wpk@isc.org> <wpk@culm.net>
|
||||
@@ -1,28 +1,9 @@
|
||||
[IMPORTS]
|
||||
|
||||
deprecated-modules=
|
||||
dns.resolver,
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
[MASTER]
|
||||
disable=
|
||||
C0103, # invalid-name
|
||||
C0114, # missing-module-docstring
|
||||
C0115, # missing-class-docstring
|
||||
C0116, # missing-function-docstring
|
||||
C0209, # consider-using-f-string
|
||||
C0301, # line-too-long, handled better by black
|
||||
C0302, # too-many-lines
|
||||
C0415, # import-outside-toplevel
|
||||
R0801, # duplicate-code
|
||||
R0901, # too-many-ancestors
|
||||
R0902, # too-many-instance-attributes
|
||||
R0903, # too-few-public-methods
|
||||
R0904, # too-many-public-methods
|
||||
R0911, # too-many-return-statements
|
||||
R0912, # too-many-branches
|
||||
R0913, # too-many-arguments
|
||||
R0914, # too-many-locals
|
||||
R0915, # too-many-statements
|
||||
R0916, # too-many-boolean-expressions
|
||||
R0917, # too-many-positional-arguments
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
version: 2
|
||||
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.11"
|
||||
jobs:
|
||||
pre_build:
|
||||
- python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
|
||||
|
||||
# Build documentation in doc/arm/ with Sphinx
|
||||
sphinx:
|
||||
configuration: doc/arm/conf.py
|
||||
|
||||
# Build all formats
|
||||
formats: all
|
||||
+5
-36
@@ -24,8 +24,8 @@ Files: **/*.after*
|
||||
**/testdata/*
|
||||
.github/*
|
||||
.gitlab/*
|
||||
.mailmap
|
||||
AUTHORS
|
||||
CHANGES
|
||||
COPYRIGHT
|
||||
Makefile
|
||||
Makefile.*
|
||||
@@ -38,31 +38,15 @@ Files: **/*.after*
|
||||
bin/tests/system/doth/CA/index.txt
|
||||
bin/tests/system/doth/CA/index.txt.attr
|
||||
bin/tests/system/doth/CA/serial
|
||||
bin/tests/system/formerr/badnsec3owner
|
||||
bin/tests/system/formerr/badrecordname
|
||||
bin/tests/system/formerr/dupans
|
||||
bin/tests/system/formerr/dupquestion
|
||||
bin/tests/system/formerr/keyclass
|
||||
bin/tests/system/formerr/malformeddeltype
|
||||
bin/tests/system/formerr/malformedrrsig
|
||||
bin/tests/system/notify/ns4/named.port.in
|
||||
bin/tests/system/formerr/nametoolong
|
||||
bin/tests/system/formerr/noquestions
|
||||
bin/tests/system/formerr/optwrongname
|
||||
bin/tests/system/formerr/qtypeasanswer
|
||||
bin/tests/system/formerr/questionclass
|
||||
bin/tests/system/formerr/shortquestion
|
||||
bin/tests/system/formerr/shortrecord
|
||||
bin/tests/system/formerr/tsignotlast
|
||||
bin/tests/system/formerr/tsigwrongclass
|
||||
bin/tests/system/formerr/twoquestionnames
|
||||
bin/tests/system/formerr/twoquestiontypes
|
||||
bin/tests/system/formerr/wrongclass
|
||||
bin/tests/system/formerr/twoquestions
|
||||
bin/tests/system/forward/CA/CA.cfg
|
||||
bin/tests/system/forward/CA/README
|
||||
bin/tests/system/forward/CA/index.txt
|
||||
bin/tests/system/forward/CA/index.txt.attr
|
||||
bin/tests/system/forward/CA/serial
|
||||
bin/tests/system/isctest/vars/.ac_vars/*
|
||||
bin/tests/system/journal/ns1/managed-keys.bind.in
|
||||
bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
|
||||
bin/tests/system/journal/ns2/managed-keys.bind.in
|
||||
@@ -70,15 +54,6 @@ Files: **/*.after*
|
||||
bin/tests/system/keepalive/expected
|
||||
bin/tests/system/legacy/ns6/edns512.db.signed
|
||||
bin/tests/system/legacy/ns7/edns512-notcp.db.signed
|
||||
bin/tests/system/masterfile/knowngood.include
|
||||
bin/tests/system/masterfile/knowngood.ttl1
|
||||
bin/tests/system/masterfile/knowngood.ttl2
|
||||
bin/tests/system/notify/CA/CA.cfg
|
||||
bin/tests/system/notify/CA/README
|
||||
bin/tests/system/notify/CA/index.txt
|
||||
bin/tests/system/notify/CA/index.txt.attr
|
||||
bin/tests/system/notify/CA/serial
|
||||
bin/tests/system/notify/ns4/named.port.in
|
||||
bin/tests/system/nsupdate/CA/CA.cfg
|
||||
bin/tests/system/nsupdate/CA/README
|
||||
bin/tests/system/nsupdate/CA/index.txt
|
||||
@@ -106,10 +81,7 @@ Files: **/*.after*
|
||||
bin/tests/system/unknown/large.out
|
||||
bin/tests/system/xfer/ans5/badkeydata
|
||||
bin/tests/system/xfer/ans5/badmessageid
|
||||
bin/tests/system/xfer/ans5/ednsformerr
|
||||
bin/tests/system/xfer/ans5/ednsnotimp
|
||||
bin/tests/system/xfer/ans5/goodaxfr
|
||||
bin/tests/system/xfer/ans5/ixfrnotimp
|
||||
bin/tests/system/xfer/ans5/partial
|
||||
bin/tests/system/xfer/ans5/soamismatch
|
||||
bin/tests/system/xfer/ans5/unknownkey
|
||||
@@ -123,6 +95,7 @@ Files: **/*.after*
|
||||
doc/arm/*.dia
|
||||
doc/arm/*.png
|
||||
doc/arm/isc-logo.pdf
|
||||
doc/arm/requirements.txt
|
||||
doc/man/*.1in
|
||||
doc/man/*.5in
|
||||
doc/man/*.8in
|
||||
@@ -184,23 +157,19 @@ Files: **/.clang-format
|
||||
.clang-format
|
||||
.clang-format.headers
|
||||
.dir-locals.el
|
||||
.editorconfig
|
||||
.git-blame-ignore-revs
|
||||
.gitattributes
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
.lgtm.yml
|
||||
.pylintrc
|
||||
.readthedocs.yaml
|
||||
.tsan-suppress
|
||||
.tsan-suppress-extra
|
||||
.uncrustify.cfg
|
||||
contrib/gitchangelog/changelog.rc.py
|
||||
contrib/gitchangelog/relnotes.rc.py
|
||||
doc/misc/*.zoneopt
|
||||
doc/misc/options
|
||||
doc/misc/rndc.grammar
|
||||
sonar-project.properties
|
||||
tests/bench/names.csv
|
||||
Copyright: Internet Systems Consortium, Inc. ("ISC")
|
||||
License: CC0-1.0
|
||||
|
||||
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
# Uninstrumented libraries
|
||||
called_from_lib:libfstrm.so
|
||||
race:dummyrpz
|
||||
# be more selective with liburcu
|
||||
race:rcu_barrier
|
||||
race:rcu_*_barrier
|
||||
thread:*
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Uninstrumented libraries
|
||||
called_from_lib:libfstrm.so
|
||||
called_from_lib:libdummyrpz.so
|
||||
# be more selective with liburcu
|
||||
race:rcu_barrier
|
||||
race:rcu_memb_barrier
|
||||
thread:*
|
||||
+28
-14
@@ -11,7 +11,7 @@ See the COPYRIGHT file distributed with this work for additional
|
||||
information regarding copyright ownership.
|
||||
-->
|
||||
## BIND 9 Source Access and Contributor Guidelines
|
||||
*Nov 26, 2024*
|
||||
*May 28, 2020*
|
||||
|
||||
### Contents
|
||||
|
||||
@@ -72,13 +72,13 @@ To clone the repository, use:
|
||||
> $ git clone https://gitlab.isc.org/isc-projects/bind9.git
|
||||
|
||||
Release branch names are of the form `bind-9.X`, where X represents the second
|
||||
number in the BIND 9 version number. So, to check out the BIND 9.20
|
||||
number in the BIND 9 version number. So, to check out the BIND 9.18
|
||||
branch, use:
|
||||
|
||||
> $ git checkout bind-9.20
|
||||
> $ git checkout bind-9.18
|
||||
|
||||
Whenever a branch is ready for publication, a tag is placed of the
|
||||
form `v9.X.Y`. The 9.20.0 release, for instance, is tagged as `v9.20.0`.
|
||||
form `v9.X.Y`. The 9.18.0 release, for instance, is tagged as `v9.18.0`.
|
||||
|
||||
The branch in which the next major release is being developed is called
|
||||
`main`.
|
||||
@@ -102,7 +102,22 @@ Twitter, or Facebook.
|
||||
|
||||
### Reporting possible security issues
|
||||
|
||||
See `SECURITY.md`.
|
||||
If you think you may be seeing a potential security vulnerability in BIND
|
||||
(for example, a crash with REQUIRE, INSIST, or ASSERT failure), please
|
||||
report it immediately by emailing to security-officer@isc.org. Plain-text
|
||||
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/pgpkey/).
|
||||
|
||||
Do not discuss undisclosed security vulnerabilities on any public mailing list.
|
||||
ISC has a long history of handling reported vulnerabilities promptly and
|
||||
effectively and we respect and acknowledge responsible reporters.
|
||||
|
||||
ISC's Security Vulnerability Disclosure Policy is documented at
|
||||
[https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
|
||||
|
||||
If you have a crash, you may want to consult
|
||||
["What to do if your BIND or DHCP server has crashed."](https://kb.isc.org/docs/aa-00340)
|
||||
|
||||
### <a name="contrib"></a>Contributing code
|
||||
|
||||
@@ -121,9 +136,8 @@ patch will be applied.
|
||||
#### <a name="bind"></a>BIND code
|
||||
|
||||
Patches for BIND may be submitted directly via merge requests in
|
||||
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source repository for
|
||||
BIND. Please contact ISC and provide your GitLab username in order to be allowed
|
||||
to fork the project and submit merge requests.
|
||||
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source
|
||||
repository for BIND.
|
||||
|
||||
Patches can also be submitted as diffs against a specific version of
|
||||
BIND -- preferably the current top of the `main` branch. Diffs may
|
||||
@@ -145,8 +159,8 @@ we're busy with other work, it may take us a long time to get to it.
|
||||
To ensure your patch is acted on as promptly as possible, please:
|
||||
|
||||
* Try to adhere to the [BIND 9 coding style](doc/dev/style.md).
|
||||
* Run unit and system tests to ensure your change hasn't caused any
|
||||
functional regressions (these can be checked in the CI pipeline).
|
||||
* Run `make check` to ensure your change hasn't caused any
|
||||
functional regressions.
|
||||
* Document your work, both in the patch itself and in the
|
||||
accompanying email.
|
||||
* In patches that make non-trivial functional changes, include system
|
||||
@@ -157,12 +171,12 @@ To ensure your patch is acted on as promptly as possible, please:
|
||||
##### Changes to `configure`
|
||||
|
||||
If you need to make changes to `configure`, you should not edit it
|
||||
directly; instead, edit `configure.ac`, then run `autoconf`. Similarly,
|
||||
instead of editing `config.h.in` directly, edit `configure.ac` and run
|
||||
directly; instead, edit `configure.in`, then run `autoconf`. Similarly,
|
||||
instead of editing `config.h.in` directly, edit `configure.in` and run
|
||||
`autoheader`.
|
||||
|
||||
When submitting a patch as a diff, it's fine to omit the `configure`
|
||||
diffs to save space. Just send the `configure.ac` diffs and we'll
|
||||
diffs to save space. Just send the `configure.in` diffs and we'll
|
||||
generate the new `configure` during the review process.
|
||||
|
||||
##### Documentation
|
||||
@@ -174,7 +188,7 @@ of documentation in the BIND source tree:
|
||||
they document, in files ending in `.rst`: for example, the
|
||||
`named` man page is `bin/named/named.rst`.
|
||||
* The *BIND 9 Administrator Reference Manual* is in the .rst files in
|
||||
`doc/arm/`; the HTML version is automatically generated from
|
||||
`doc/arm/`; the PDF and HTML versions are automatically generated from
|
||||
the `.rst` files.
|
||||
* API documentation is in the header file describing the API, in
|
||||
Doxygen-formatted comments.
|
||||
|
||||
@@ -133,7 +133,7 @@ modification, are permitted provided that the following conditions are met:
|
||||
3. Neither the name of the University nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -149,35 +149,35 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan
|
||||
(Royal Institute of Technology, Stockholm, Sweden).
|
||||
All rights reserved.
|
||||
(Royal Institute of Technology, Stockholm, Sweden).
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Institute nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
3. Neither the name of the Institute nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+3
-3
@@ -8,8 +8,8 @@ SUBDIRS += tests
|
||||
# run fuzz tests before system tests
|
||||
SUBDIRS += fuzz bin
|
||||
|
||||
BUILT_SOURCES += bind.keys.h
|
||||
CLEANFILES += bind.keys.h
|
||||
BUILT_SOURCES = bind.keys.h
|
||||
CLEANFILES = bind.keys.h
|
||||
|
||||
bind.keys.h: bind.keys Makefile
|
||||
${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
|
||||
@@ -19,8 +19,8 @@ bind.keys.h: bind.keys Makefile
|
||||
EXTRA_DIST = \
|
||||
bind.keys \
|
||||
util/bindkeys.pl \
|
||||
util/dtrace.sh \
|
||||
contrib \
|
||||
CHANGES \
|
||||
COPYRIGHT \
|
||||
LICENSE \
|
||||
*.md
|
||||
|
||||
@@ -25,8 +25,11 @@ common_SPHINXOPTS = \
|
||||
-a \
|
||||
$(SPHINX_V)
|
||||
|
||||
# The "today" variable set below is not directly used in the ARM, but its value
|
||||
# is implicitly inserted on the title page of the PDF file produced by Sphinx.
|
||||
ALLSPHINXOPTS = \
|
||||
$(common_SPHINXOPTS) \
|
||||
-D today="$(RELEASE_DATE)" \
|
||||
-D rst_epilog="$$(printf "$${RST_EPILOG}")" \
|
||||
$(SPHINXOPTS) \
|
||||
$(srcdir)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Hey Emacs, this is -*- makefile-automake -*- file!
|
||||
# vim: filetype=automake
|
||||
|
||||
AM_V_DTRACE = $(AM_V_DTRACE_@AM_V@)
|
||||
AM_V_DTRACE_ = $(AM_V_DTRACE_@AM_DEFAULT_V@)
|
||||
AM_V_DTRACE_0 = @echo " DTRACE $@";
|
||||
|
||||
BUILT_SOURCES += probes.h
|
||||
CLEANFILES += probes.h probes.o
|
||||
|
||||
probes.h: Makefile probes.d
|
||||
$(AM_V_DTRACE)$(DTRACE) -s $(srcdir)/probes.d -h -o $@
|
||||
probes.lo: Makefile probes.d $(DTRACE_DEPS)
|
||||
$(AM_V_DTRACE)$(LIBTOOL) --mode=compile --tag=CC $(DTRACE) -s $(srcdir)/probes.d -G -o $@ $(DTRACE_OBJS)
|
||||
|
||||
if HAVE_DTRACE
|
||||
if !HOST_MACOS
|
||||
DTRACE_LIBADD = probes.lo
|
||||
endif
|
||||
endif
|
||||
@@ -21,8 +21,3 @@ AM_CPPFLAGS += \
|
||||
LDADD += \
|
||||
$(top_builddir)/tests/libtest/libtest.la \
|
||||
$(CMOCKA_LIBS)
|
||||
|
||||
if HAVE_JEMALLOC
|
||||
AM_CFLAGS += $(JEMALLOC_CFLAGS)
|
||||
LDADD += $(JEMALLOC_LIBS)
|
||||
endif
|
||||
|
||||
+2
-22
@@ -15,31 +15,17 @@ AM_LDFLAGS = \
|
||||
$(STD_LDFLAGS)
|
||||
LDADD =
|
||||
|
||||
BUILT_SOURCES =
|
||||
CLEANFILES =
|
||||
|
||||
if HOST_MACOS
|
||||
AM_LDFLAGS += \
|
||||
-Wl,-flat_namespace
|
||||
endif HOST_MACOS
|
||||
|
||||
if HAVE_JEMALLOC
|
||||
LIBISC_CFLAGS = $(JEMALLOC_CFLAGS)
|
||||
LIBISC_LIBS = $(JEMALLOC_LIBS)
|
||||
else
|
||||
LIBISC_CFLAGS =
|
||||
LIBISC_LIBS =
|
||||
endif
|
||||
|
||||
LIBISC_CFLAGS += \
|
||||
LIBISC_CFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/lib/isc/include \
|
||||
-I$(top_builddir)/lib/isc/include
|
||||
|
||||
LIBISC_LIBS += $(top_builddir)/lib/isc/libisc.la
|
||||
if HAVE_DTRACE
|
||||
LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
|
||||
endif
|
||||
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
|
||||
|
||||
LIBDNS_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/dns/include \
|
||||
@@ -47,18 +33,12 @@ LIBDNS_CFLAGS = \
|
||||
|
||||
LIBDNS_LIBS = \
|
||||
$(top_builddir)/lib/dns/libdns.la
|
||||
if HAVE_DTRACE
|
||||
LIBDNS_DTRACE = $(top_builddir)/lib/dns/probes.lo
|
||||
endif
|
||||
|
||||
LIBNS_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/ns/include
|
||||
|
||||
LIBNS_LIBS = \
|
||||
$(top_builddir)/lib/ns/libns.la
|
||||
if HAVE_DTRACE
|
||||
LIBNS_DTRACE = $(top_builddir)/lib/ns/probes.lo
|
||||
endif
|
||||
|
||||
LIBISCCFG_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/isccfg/include
|
||||
|
||||
@@ -20,6 +20,7 @@ information regarding copyright ownership.
|
||||
1. [Building BIND](#build)
|
||||
1. [Automated testing](#testing)
|
||||
1. [Documentation](#doc)
|
||||
1. [Change log](#changes)
|
||||
1. [Acknowledgments](#ack)
|
||||
|
||||
### <a name="intro"/> Introduction
|
||||
@@ -48,7 +49,8 @@ ongoing maintenance and improvement. BIND is open source software
|
||||
licensed under the terms of the Mozilla Public License, version 2.0.
|
||||
|
||||
For a detailed list of changes made throughout the history of BIND 9, see
|
||||
the [changelog](doc/arm/changelog.rst).
|
||||
the file [CHANGES](CHANGES). See [below](#changes) for details on the
|
||||
CHANGES file format.
|
||||
|
||||
For up-to-date versions and release notes, see
|
||||
[https://www.isc.org/download/](https://www.isc.org/download/).
|
||||
@@ -72,9 +74,17 @@ contents of your configuration file in a non-confidential issue, it is
|
||||
advisable to obscure key secrets; this can be done automatically by
|
||||
using `named-checkconf -px`.
|
||||
|
||||
For information about ISC's Security Vulnerability Disclosure Policy and
|
||||
information about reporting potential security issues, please see
|
||||
`SECURITY.md`.
|
||||
If you are reporting a bug that 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.
|
||||
|
||||
For a general overview of ISC security policies, read the Knowledgebase
|
||||
article at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
|
||||
|
||||
Professional support and training for BIND are available from
|
||||
ISC. Contact us at [https://www.isc.org/contact](https://www.isc.org/contact)
|
||||
@@ -126,7 +136,7 @@ multiple servers to run locally and communicate with each other). These
|
||||
IP addresses can be configured by running the command
|
||||
`bin/tests/system/ifconfig.sh up` as root.
|
||||
|
||||
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::IP` modules,
|
||||
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::INET6` modules,
|
||||
and are skipped if these are not available. Some tests require Python
|
||||
and the `dnspython` module and are skipped if these are not available.
|
||||
See bin/tests/system/README for further details.
|
||||
@@ -139,18 +149,9 @@ parallel test driver; unit tests are also run by `make check`.
|
||||
|
||||
The *BIND 9 Administrator Reference Manual* (ARM) is included with the source
|
||||
distribution, and in .rst format, in the `doc/arm`
|
||||
directory. The HTML version is automatically generated and can
|
||||
directory. HTML and PDF versions are automatically generated and can
|
||||
be viewed at [https://bind9.readthedocs.io/en/latest/index.html](https://bind9.readthedocs.io/en/latest/index.html).
|
||||
|
||||
The PDF version can be built by running:
|
||||
|
||||
cd doc/arm/
|
||||
sphinx-build -b latex . pdf/
|
||||
make -C pdf/ all-pdf
|
||||
|
||||
The above requires TeX Live in order to work. The PDF will be written to
|
||||
`doc/arm/pdf/Bv9ARM.pdf`.
|
||||
|
||||
Man pages for some of the programs in the BIND 9 distribution
|
||||
are also included in the BIND ARM.
|
||||
|
||||
@@ -161,9 +162,38 @@ can be found in the ISC Knowledgebase at
|
||||
Additional information on various subjects can be found in other
|
||||
`README` files throughout the source tree.
|
||||
|
||||
### <a name="changes"/> Change log
|
||||
|
||||
A detailed list of all changes that have been made throughout the
|
||||
development of BIND 9 is included in the file CHANGES, with the most recent
|
||||
changes listed first. Change notes include tags indicating the category of
|
||||
the change that was made; these categories are:
|
||||
|
||||
|Category |Description |
|
||||
|-------------- |-----------------------------------------------|
|
||||
| [func] | New feature |
|
||||
| [bug] | General bug fix |
|
||||
| [security] | Fix for a significant security flaw |
|
||||
| [experimental] | Used for new features when the syntax or other aspects of the design are still in flux and may change |
|
||||
| [port] | Portability enhancement |
|
||||
| [maint] | Updates to built-in data such as root server addresses and keys |
|
||||
| [tuning] | Changes to built-in configuration defaults and constants to improve performance |
|
||||
| [performance] | Other changes to improve server performance |
|
||||
| [protocol] | Updates to the DNS protocol such as new RR types |
|
||||
| [test] | Changes to the automatic tests, not affecting server functionality |
|
||||
| [cleanup] | Minor corrections and refactoring |
|
||||
| [doc] | Documentation |
|
||||
| [contrib] | Changes to the contributed tools and libraries in the 'contrib' subdirectory |
|
||||
| [placeholder] | Used in the main development branch to reserve change numbers for use in other branches, e.g., when fixing a bug that only exists in older releases |
|
||||
|
||||
In general, [func] and [experimental] tags only appear in new-feature
|
||||
releases (i.e., those with version numbers ending in zero). Some new
|
||||
functionality may be backported to older releases on a case-by-case basis.
|
||||
All other change types may be applied to all currently supported releases.
|
||||
|
||||
#### Bug report identifiers
|
||||
|
||||
Most notes in the ARM Changelog appendix include a reference to a bug report or
|
||||
Most notes in the CHANGES file include a reference to a bug report or
|
||||
issue number. Prior to 2018, these were usually of the form `[RT #NNN]`
|
||||
and referred to entries in the "bind9-bugs" RT database, which was not open
|
||||
to the public. More recent entries use the form `[GL #NNN]` or, less often,
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
<!--
|
||||
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
See the COPYRIGHT file distributed with this work for additional
|
||||
information regarding copyright ownership.
|
||||
-->
|
||||
# Security Policy
|
||||
|
||||
ISC's Security Vulnerability Disclosure Policy is documented in the
|
||||
relevant [ISC Knowledgebase article][1].
|
||||
|
||||
## Reporting possible security issues
|
||||
|
||||
If you think you may be seeing a potential security vulnerability in
|
||||
BIND (for example, a crash with a REQUIRE, INSIST, or ASSERT failure),
|
||||
please report it immediately by [opening a confidential GitLab issue][2]
|
||||
(preferred) or emailing bind-security@isc.org.
|
||||
|
||||
Please do not discuss undisclosed security vulnerabilities on any public
|
||||
mailing list. ISC has a long history of handling reported
|
||||
vulnerabilities promptly and effectively and we respect and acknowledge
|
||||
responsible reporters.
|
||||
|
||||
If you have a crash, you may want to consult the Knowledgebase article
|
||||
entitled ["What to do if your BIND or DHCP server has crashed"][3].
|
||||
|
||||
[1]: https://kb.isc.org/docs/aa-00861
|
||||
[2]: https://gitlab.isc.org/isc-projects/bind9/-/issues/new?issue[confidential]=true&issuable_template=Bug
|
||||
[3]: https://kb.isc.org/docs/aa-00340
|
||||
+19
-20
@@ -73,7 +73,7 @@
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
|
||||
static const char *dbtype[] = { ZONEDB_DEFAULT };
|
||||
static const char *dbtype[] = { "rbt" };
|
||||
|
||||
int debug = 0;
|
||||
const char *journal = NULL;
|
||||
@@ -88,7 +88,6 @@ bool dochecksrv = false;
|
||||
bool docheckns = false;
|
||||
#endif /* if CHECK_LOCAL */
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
|
||||
DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF |
|
||||
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
|
||||
DNS_ZONEOPT_CHECKINTEGRITY |
|
||||
#if CHECK_SIBLING
|
||||
@@ -146,14 +145,14 @@ logged(char *key, int value) {
|
||||
isc_result_t result;
|
||||
|
||||
if (symtab == NULL) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
result = isc_symtab_lookup(symtab, key, value, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -177,7 +176,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
aaaa->type == dns_rdatatype_aaaa);
|
||||
|
||||
if (a == NULL || aaaa == NULL) {
|
||||
return answer;
|
||||
return (answer);
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
@@ -234,7 +233,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
return true;
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -243,7 +242,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -371,7 +370,7 @@ checkmissing:
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
return answer;
|
||||
return (answer);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -434,7 +433,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
return answer;
|
||||
return (answer);
|
||||
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
@@ -448,7 +447,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
return true;
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -457,7 +456,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +520,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
return answer;
|
||||
return (answer);
|
||||
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
@@ -535,7 +534,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
return true;
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -544,7 +543,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +572,7 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
*logp = log;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*% load the zone */
|
||||
@@ -596,7 +595,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
zonename, filename, classname);
|
||||
}
|
||||
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
CHECK(dns_zone_create(&zone, mctx, 0));
|
||||
|
||||
dns_zone_settype(zone, dns_zone_primary);
|
||||
|
||||
@@ -648,7 +647,7 @@ cleanup:
|
||||
if (zone != NULL) {
|
||||
dns_zone_detach(&zone);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*% dump the zone */
|
||||
@@ -679,7 +678,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
"could not open output "
|
||||
"file \"%s\" for writing\n",
|
||||
filename);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,5 +688,5 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
(void)isc_stdio_close(output);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
+29
-31
@@ -63,7 +63,7 @@ usage(void) {
|
||||
"usage: %s [-achijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n",
|
||||
program);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*% directory callback */
|
||||
@@ -86,10 +86,10 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
|
||||
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
|
||||
"change directory to '%s' failed: %s\n", directory,
|
||||
isc_result_totext(result));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -97,10 +97,10 @@ 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) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
checknames = NULL;
|
||||
result = cfg_map_get(maps[i], "check-names", &checknames);
|
||||
@@ -125,7 +125,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||
}
|
||||
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
||||
*obj = checknames;
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
for (element = cfg_list_first(checknames); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
@@ -139,7 +139,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||
continue;
|
||||
}
|
||||
*obj = cfg_tuple_get(value, "mode");
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,23 +152,23 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
||||
isc_textregion_t r;
|
||||
|
||||
if (zfile == NULL) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
r.base = UNCONST(zclass);
|
||||
r.length = strlen(zclass);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_rootns_create(mctx, rdclass, zfile, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_db_detach(&db);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*% configure the zone */
|
||||
@@ -224,33 +224,31 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
|
||||
}
|
||||
if (inviewobj != NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "type", &typeobj);
|
||||
if (typeobj == NULL) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (list) {
|
||||
const char *ztype = cfg_obj_asstring(typeobj);
|
||||
printf("%s %s %s %s\n", zname, zclass, view, ztype);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip checks when using an alternate data source.
|
||||
*/
|
||||
cfg_map_get(zoptions, "database", &dbobj);
|
||||
if (dbobj != NULL &&
|
||||
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
|
||||
{
|
||||
return ISC_R_SUCCESS;
|
||||
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "dlz", &dlzobj);
|
||||
if (dlzobj != NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "file", &fileobj);
|
||||
@@ -264,12 +262,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
* master and redirect
|
||||
*/
|
||||
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
|
||||
return configure_hint(zfile, zclass, mctx);
|
||||
return (configure_hint(zfile, zclass, mctx));
|
||||
} else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
|
||||
(strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
|
||||
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
|
||||
{
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -282,12 +280,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
}
|
||||
|
||||
if (primariesobj != NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if (zfile == NULL) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
@@ -465,7 +463,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*% configure a view */
|
||||
@@ -500,7 +498,7 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -510,11 +508,11 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
*classp = defclass;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
r.base = UNCONST(cfg_obj_asstring(classobj));
|
||||
r.length = strlen(r.base);
|
||||
return dns_rdataclass_fromtext(classp, &r);
|
||||
return (dns_rdataclass_fromtext(classp, &r));
|
||||
}
|
||||
|
||||
/*% load zones from the configuration */
|
||||
@@ -572,7 +570,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -593,7 +591,7 @@ main(int argc, char **argv) {
|
||||
const char *conffile = NULL;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
bool cleanup_dst = false;
|
||||
bool cleanup_dst = true;
|
||||
bool load_zones = false;
|
||||
bool list_zones = false;
|
||||
bool print = false;
|
||||
@@ -769,5 +767,5 @@ cleanup:
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
||||
return result == ISC_R_SUCCESS ? 0 : 1;
|
||||
return (result == ISC_R_SUCCESS ? 0 : 1);
|
||||
}
|
||||
|
||||
+29
-26
@@ -79,7 +79,7 @@ usage(void) {
|
||||
"%s zonename [ (filename|-) ]\n",
|
||||
prog_name,
|
||||
progmode == progmode_check ? "[-o filename]" : "-o filename");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -147,12 +147,15 @@ main(int argc, char **argv) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
/* When compiling, disable checks by default */
|
||||
/* Compilation specific defaults */
|
||||
if (progmode == progmode_compile) {
|
||||
zone_options = 0;
|
||||
docheckmx = false;
|
||||
docheckns = false;
|
||||
dochecksrv = false;
|
||||
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);
|
||||
}
|
||||
|
||||
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
|
||||
@@ -206,7 +209,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -i: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -240,7 +243,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -k: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -251,7 +254,7 @@ main(int argc, char **argv) {
|
||||
if (*endp != '\0') {
|
||||
fprintf(stderr, "source serial number "
|
||||
"must be numeric");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -262,7 +265,7 @@ main(int argc, char **argv) {
|
||||
if (*endp != '\0') {
|
||||
fprintf(stderr, "maximum TTL "
|
||||
"must be numeric");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -279,7 +282,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -n: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -296,7 +299,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -m: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -321,7 +324,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -r: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -334,7 +337,7 @@ main(int argc, char **argv) {
|
||||
fprintf(stderr,
|
||||
"unknown or unsupported style: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -344,13 +347,13 @@ main(int argc, char **argv) {
|
||||
fprintf(stderr, "isc_dir_chroot: %s: %s\n",
|
||||
isc_commandline_argument,
|
||||
isc_result_totext(result));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf("%s\n", PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
|
||||
case 'w':
|
||||
workdir = isc_commandline_argument;
|
||||
@@ -364,7 +367,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -C: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -385,7 +388,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -M: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -402,7 +405,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -S: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -414,7 +417,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -T: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -438,7 +441,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +450,7 @@ main(int argc, char **argv) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
|
||||
isc_result_totext(result));
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +466,7 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
fprintf(stderr, "unknown file format: %s\n",
|
||||
inputformatstr);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,12 +484,12 @@ main(int argc, char **argv) {
|
||||
rawversion > 1U)
|
||||
{
|
||||
fprintf(stderr, "unknown raw format version\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "unknown file format: %s\n",
|
||||
outputformatstr);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,5 +574,5 @@ main(int argc, char **argv) {
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (result == ISC_R_SUCCESS) ? 0 : 1;
|
||||
return ((result == ISC_R_SUCCESS) ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -30,16 +30,10 @@ Description
|
||||
|
||||
:program:`named-compilezone` checks the syntax and integrity of a zone file,
|
||||
and dumps the zone contents to a specified file in a specified format.
|
||||
|
||||
Unlike :program:`named-checkzone`, zone contents are not strictly checked
|
||||
by default. If the output is to be used as an actual zone file to be loaded
|
||||
by :iscman:`named`, then the check levels should be manually configured to
|
||||
be at least as strict as those specified in the :iscman:`named` configuration
|
||||
file.
|
||||
|
||||
Running :program:`named-checkzone` on the input prior to compiling will
|
||||
ensure that the zone compiles with the default requirements of
|
||||
:iscman:`named`.
|
||||
It applies strict check levels by default, since the
|
||||
dump output is used as an actual zone file loaded by :iscman:`named`.
|
||||
When manually specified otherwise, the check levels must at least be as
|
||||
strict as those specified in the :iscman:`named` configuration file.
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
@@ -83,13 +77,13 @@ Options
|
||||
|
||||
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
|
||||
records and ``check-svcb:ignore`` disables these checks. The
|
||||
default is ``check-svcb:ignore``.
|
||||
default is ``check-svcb:fail``.
|
||||
|
||||
.. option:: -i mode
|
||||
|
||||
This option performs post-load zone integrity checks. Possible modes are
|
||||
``full``, ``full-sibling``, ``local``,
|
||||
``local-sibling``, and ``none`` (the default).
|
||||
``full`` (the default), ``full-sibling``, ``local``,
|
||||
``local-sibling``, and ``none``.
|
||||
|
||||
Mode ``full`` checks that MX records refer to A or AAAA records
|
||||
(both in-zone and out-of-zone hostnames). Mode ``local`` only
|
||||
@@ -133,7 +127,7 @@ Options
|
||||
.. option:: -k mode
|
||||
|
||||
This option performs ``check-names`` checks with the specified failure mode.
|
||||
Possible modes are ``fail``, ``warn``, and ``ignore`` (the default).
|
||||
Possible modes are ``fail`` (the default), ``warn``, and ``ignore``.
|
||||
|
||||
.. option:: -l ttl
|
||||
|
||||
@@ -150,19 +144,19 @@ Options
|
||||
.. option:: -m mode
|
||||
|
||||
This option specifies whether MX records should be checked to see if they are
|
||||
addresses. Possible modes are ``fail``, ``warn``, and
|
||||
``ignore`` (the default).
|
||||
addresses. Possible modes are ``fail``, ``warn`` (the default), and
|
||||
``ignore``.
|
||||
|
||||
.. option:: -M mode
|
||||
|
||||
This option checks whether a MX record refers to a CNAME. Possible modes are
|
||||
``fail``, ``warn``, and ``ignore`` (the default).
|
||||
``fail``, ``warn`` (the default), and ``ignore``.
|
||||
|
||||
.. option:: -n mode
|
||||
|
||||
This option specifies whether NS records should be checked to see if they are
|
||||
addresses. Possible modes are ``fail``, ``warn``, and
|
||||
``ignore`` (the default).
|
||||
addresses. Possible modes are ``fail`` (the default), ``warn``, and
|
||||
``ignore``.
|
||||
|
||||
.. option:: -o filename
|
||||
|
||||
@@ -173,7 +167,7 @@ Options
|
||||
|
||||
This option checks for records that are treated as different by DNSSEC but are
|
||||
semantically equal in plain DNS. Possible modes are ``fail``,
|
||||
``warn``, and ``ignore`` (the default).
|
||||
``warn`` (the default), and ``ignore``.
|
||||
|
||||
.. option:: -s style
|
||||
|
||||
@@ -186,7 +180,7 @@ Options
|
||||
.. option:: -S mode
|
||||
|
||||
This option checks whether an SRV record refers to a CNAME. Possible modes are
|
||||
``fail``, ``warn``, and ``ignore`` (the default).
|
||||
``fail``, ``warn`` (the default), and ``ignore``.
|
||||
|
||||
.. option:: -t directory
|
||||
|
||||
@@ -198,7 +192,7 @@ Options
|
||||
|
||||
This option checks whether Sender Policy Framework (SPF) records exist and issues a
|
||||
warning if an SPF-formatted TXT record is not also present. Possible
|
||||
modes are ``warn`` and ``ignore`` (the default).
|
||||
modes are ``warn`` (the default) and ``ignore``.
|
||||
|
||||
.. option:: -w directory
|
||||
|
||||
@@ -216,7 +210,7 @@ Options
|
||||
This option specifies whether to check for non-terminal wildcards. Non-terminal
|
||||
wildcards are almost always the result of a failure to understand the
|
||||
wildcard matching algorithm (:rfc:`4592`). Possible modes are ``warn``
|
||||
and ``ignore`` (the default).
|
||||
(the default) and ``ignore``.
|
||||
|
||||
.. option:: zonename
|
||||
|
||||
|
||||
+15
-15
@@ -44,24 +44,24 @@ alg_fromtext(const char *name) {
|
||||
}
|
||||
|
||||
if (strcasecmp(p, "md5") == 0) {
|
||||
return DST_ALG_HMACMD5;
|
||||
return (DST_ALG_HMACMD5);
|
||||
}
|
||||
if (strcasecmp(p, "sha1") == 0) {
|
||||
return DST_ALG_HMACSHA1;
|
||||
return (DST_ALG_HMACSHA1);
|
||||
}
|
||||
if (strcasecmp(p, "sha224") == 0) {
|
||||
return DST_ALG_HMACSHA224;
|
||||
return (DST_ALG_HMACSHA224);
|
||||
}
|
||||
if (strcasecmp(p, "sha256") == 0) {
|
||||
return DST_ALG_HMACSHA256;
|
||||
return (DST_ALG_HMACSHA256);
|
||||
}
|
||||
if (strcasecmp(p, "sha384") == 0) {
|
||||
return DST_ALG_HMACSHA384;
|
||||
return (DST_ALG_HMACSHA384);
|
||||
}
|
||||
if (strcasecmp(p, "sha512") == 0) {
|
||||
return DST_ALG_HMACSHA512;
|
||||
return (DST_ALG_HMACSHA512);
|
||||
}
|
||||
return DST_ALG_UNKNOWN;
|
||||
return (DST_ALG_UNKNOWN);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -71,19 +71,19 @@ int
|
||||
alg_bits(dns_secalg_t alg) {
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
return 128;
|
||||
return (128);
|
||||
case DST_ALG_HMACSHA1:
|
||||
return 160;
|
||||
return (160);
|
||||
case DST_ALG_HMACSHA224:
|
||||
return 224;
|
||||
return (224);
|
||||
case DST_ALG_HMACSHA256:
|
||||
return 256;
|
||||
return (256);
|
||||
case DST_ALG_HMACSHA384:
|
||||
return 384;
|
||||
return (384);
|
||||
case DST_ALG_HMACSHA512:
|
||||
return 512;
|
||||
return (512);
|
||||
default:
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
|
||||
DO("generate key",
|
||||
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
|
||||
dns_rdataclass_in, NULL, mctx, &key, NULL));
|
||||
dns_rdataclass_in, mctx, &key, NULL));
|
||||
|
||||
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ set_user(FILE *fd, const char *user) {
|
||||
pw = getpwnam(user);
|
||||
if (pw == NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
return fchown(fileno(fd), pw->pw_uid, -1);
|
||||
return (fchown(fileno(fd), pw->pw_uid, -1));
|
||||
}
|
||||
|
||||
@@ -146,8 +146,7 @@ main(int argc, char **argv) {
|
||||
keyfile = isc_commandline_argument;
|
||||
break;
|
||||
case 'h':
|
||||
usage(EXIT_SUCCESS);
|
||||
break;
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y': /* Compatible with rndc -y. */
|
||||
keyname = isc_commandline_argument;
|
||||
@@ -193,15 +192,15 @@ main(int argc, char **argv) {
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
} else {
|
||||
usage(EXIT_SUCCESS);
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +209,7 @@ main(int argc, char **argv) {
|
||||
POST(argv);
|
||||
|
||||
if (argc > 0) {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
|
||||
if (alg == DST_ALG_HMACMD5) {
|
||||
@@ -290,5 +289,5 @@ options {\n\
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
+11
-11
@@ -138,13 +138,13 @@ main(int argc, char **argv) {
|
||||
keysize = alg_bits(alg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(EXIT_SUCCESS);
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y':
|
||||
if (progmode == progmode_confgen) {
|
||||
keyname = isc_commandline_argument;
|
||||
} else {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
@@ -157,7 +157,7 @@ main(int argc, char **argv) {
|
||||
if (progmode == progmode_confgen) {
|
||||
quiet = true;
|
||||
} else {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
@@ -167,29 +167,29 @@ main(int argc, char **argv) {
|
||||
if (progmode == progmode_confgen) {
|
||||
self_domain = isc_commandline_argument;
|
||||
} else {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (progmode == progmode_confgen) {
|
||||
zone = isc_commandline_argument;
|
||||
} else {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
} else {
|
||||
usage(EXIT_SUCCESS);
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,11 +200,11 @@ main(int argc, char **argv) {
|
||||
POST(argv);
|
||||
|
||||
if (self_domain != NULL && zone != NULL) {
|
||||
usage(EXIT_FAILURE); /* -s and -z cannot coexist */
|
||||
usage(1); /* -s and -z cannot coexist */
|
||||
}
|
||||
|
||||
if (argc > isc_commandline_index) {
|
||||
usage(EXIT_FAILURE);
|
||||
usage(1);
|
||||
}
|
||||
|
||||
/* Use canonical algorithm name */
|
||||
@@ -296,5 +296,5 @@ nsupdate -k <keyfile>\n");
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,9 @@ Synopsis
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
|
||||
:program:`tsig-keygen` is an utility that generates keys for use with TSIG
|
||||
(Transaction Signatures) as defined in :rfc:`2845`. The resulting keys can be used,
|
||||
for example, to secure dynamic DNS updates to a zone, or for the :iscman:`rndc`
|
||||
command channel.
|
||||
:program:`tsig-keygen` is an utility that generates keys for use in TSIG signing.
|
||||
The resulting keys can be used, for example, to secure dynamic DNS updates
|
||||
to a zone, or for the :iscman:`rndc` command channel.
|
||||
|
||||
A domain name can be specified on the command line to be used as the name
|
||||
of the generated key. If no name is specified, the default is ``tsig-key``.
|
||||
|
||||
+3
-4
@@ -13,16 +13,14 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include "util.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/tls.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
extern bool verbose;
|
||||
extern const char *progname;
|
||||
|
||||
@@ -47,5 +45,6 @@ fatal(const char *format, ...) {
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
_exit(EXIT_FAILURE);
|
||||
isc__tls_setfatalmode();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
$(LIBISCCFG_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DSYSCONFDIR=\"${sysconfdir}\"
|
||||
|
||||
+74
-151
@@ -88,10 +88,6 @@
|
||||
|
||||
#define MAXNAME (DNS_NAME_MAXTEXT + 1)
|
||||
|
||||
#define MAX_QUERIES 50
|
||||
#define MAX_TOTAL 200
|
||||
#define MAX_RESTARTS 11
|
||||
|
||||
/* Variables used internally by delv. */
|
||||
char *progname = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
@@ -134,10 +130,6 @@ static bool showcomments = true, showdnssec = true, showtrust = true,
|
||||
multiline = false, short_form = false, print_unknown_format = false,
|
||||
yaml = false, fulltrace = false;
|
||||
|
||||
static uint32_t maxqueries = MAX_QUERIES;
|
||||
static uint32_t maxtotal = MAX_TOTAL;
|
||||
static uint32_t restarts = MAX_RESTARTS;
|
||||
|
||||
static bool resolve_trace = false, validator_trace = false,
|
||||
message_trace = false, send_trace = false;
|
||||
|
||||
@@ -255,7 +247,7 @@ usage(void) {
|
||||
"process)\n"
|
||||
" +[no]yaml (Present the results as "
|
||||
"YAML)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
noreturn static void
|
||||
@@ -271,7 +263,8 @@ fatal(const char *format, ...) {
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
_exit(EXIT_FAILURE);
|
||||
isc__tls_setfatalmode();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -608,7 +601,7 @@ setup_style(void) {
|
||||
48, 80, 8, splitwidth, mctx);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -629,11 +622,11 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
delv_log(ISC_LOG_ERROR, "failed to convert name %s: %s", text,
|
||||
isc_result_totext(result));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
*name = n;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -666,7 +659,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
|
||||
CHECK(convert_name(&fkeyname, &keyname, keynamestr));
|
||||
|
||||
if (!root_validation) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (anchor_name) {
|
||||
@@ -674,11 +667,11 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
|
||||
}
|
||||
|
||||
if (!match_root) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (!root_validation) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
delv_log(ISC_LOG_DEBUG(3), "adding trust anchor %s", trust_anchor);
|
||||
@@ -831,7 +824,7 @@ cleanup:
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -856,7 +849,7 @@ cleanup:
|
||||
if (result == DST_R_NOCRYPTO) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -869,7 +862,7 @@ setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) {
|
||||
cfg_obj_t *bindkeys = NULL;
|
||||
|
||||
if (!root_validation) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (trust_anchor == NULL) {
|
||||
@@ -936,7 +929,7 @@ cleanup:
|
||||
delv_log(ISC_LOG_ERROR, "setup_dnsseckeys: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -983,7 +976,7 @@ addserver(dns_client_t *client) {
|
||||
if (gaierror != 0) {
|
||||
delv_log(ISC_LOG_ERROR, "getaddrinfo failed: %s",
|
||||
gai_strerror(gaierror));
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
@@ -1019,7 +1012,7 @@ cleanup:
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1088,7 +1081,7 @@ cleanup:
|
||||
if (resconf != NULL) {
|
||||
irs_resconf_destroy(&resconf);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1101,10 +1094,10 @@ parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("invalid %s '%s': %s\n", desc, value,
|
||||
isc_result_totext(result));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
*uip = n;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1170,7 +1163,7 @@ plus_option(char *option) {
|
||||
if (state) {
|
||||
fprintf(stderr, "Invalid option: "
|
||||
"+dlv is obsolete\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'n': /* dnssec */
|
||||
@@ -1199,47 +1192,6 @@ plus_option(char *option) {
|
||||
break;
|
||||
case 'm':
|
||||
switch (cmd[1]) {
|
||||
case 'a':
|
||||
switch (cmd[3]) {
|
||||
case 'q': /* maxqueries */
|
||||
FULLCHECK("maxqueries");
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
if (!state) {
|
||||
goto invalid_option;
|
||||
}
|
||||
result = parse_uint(&maxqueries, value,
|
||||
UINT_MAX, "maxqueries");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse maxqueries");
|
||||
}
|
||||
if (maxqueries == 0) {
|
||||
fatal("maxqueries must be nonzero");
|
||||
}
|
||||
break;
|
||||
case 't': /* maxtotalqueries */
|
||||
FULLCHECK("maxtotalqueries");
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
if (!state) {
|
||||
goto invalid_option;
|
||||
}
|
||||
result = parse_uint(&maxtotal, value, UINT_MAX,
|
||||
"maxtotalqueries");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse maxtotalqueries");
|
||||
}
|
||||
if (maxtotal == 0) {
|
||||
fatal("maxtotalqueries must be "
|
||||
"nonzero");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
case 't': /* mtrace */
|
||||
FULLCHECK("mtrace");
|
||||
message_trace = state;
|
||||
@@ -1292,22 +1244,6 @@ plus_option(char *option) {
|
||||
break;
|
||||
case 'r':
|
||||
switch (cmd[1]) {
|
||||
case 'e': /* restarts */
|
||||
FULLCHECK("restarts");
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
if (!state) {
|
||||
goto invalid_option;
|
||||
}
|
||||
result = parse_uint(&restarts, value, 255, "restarts");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse restarts");
|
||||
}
|
||||
if (restarts == 0) {
|
||||
fatal("restarts must be between 1..255");
|
||||
}
|
||||
break;
|
||||
case 'o': /* root */
|
||||
FULLCHECK("root");
|
||||
if (state && no_sigs) {
|
||||
@@ -1435,10 +1371,17 @@ plus_option(char *option) {
|
||||
break;
|
||||
default:
|
||||
invalid_option:
|
||||
need_value:
|
||||
/*
|
||||
* We can also add a "need_value:" case here if we ever
|
||||
* add a plus-option that requires a specified value
|
||||
*/
|
||||
fprintf(stderr, "Invalid option: +%s\n", option);
|
||||
usage();
|
||||
}
|
||||
|
||||
if (qmin && !fulltrace) {
|
||||
fatal("'+qmin' cannot be used without '+ns'");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1491,7 +1434,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
case 'i':
|
||||
no_sigs = true;
|
||||
root_validation = false;
|
||||
@@ -1501,14 +1444,14 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
break;
|
||||
case 'v':
|
||||
printf("delv %s\n", PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (strlen(option) > 1U) {
|
||||
option = &option[1];
|
||||
} else {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
opt = option[0];
|
||||
@@ -1525,7 +1468,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
anchorfile = isc_mem_strdup(mctx, value);
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'b':
|
||||
hash = strchr(value, '#');
|
||||
if (hash != NULL) {
|
||||
@@ -1562,7 +1505,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
if (hash != NULL) {
|
||||
*hash = '#';
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'c':
|
||||
if (classset) {
|
||||
warn("extra query class");
|
||||
@@ -1580,28 +1523,28 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
} else {
|
||||
warn("ignoring invalid class");
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'd':
|
||||
result = parse_uint(&num, value, 99, "debug level");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse debug level");
|
||||
}
|
||||
loglevel = num;
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'p':
|
||||
port = value;
|
||||
result = parse_uint(&destport, port, 0xffff, "port");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse port number");
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'q':
|
||||
if (curqname != NULL) {
|
||||
warn("extra query name");
|
||||
isc_mem_free(mctx, curqname);
|
||||
}
|
||||
curqname = isc_mem_strdup(mctx, value);
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 't':
|
||||
*open_type_class = false;
|
||||
tr.base = value;
|
||||
@@ -1622,7 +1565,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
} else {
|
||||
warn("ignoring invalid type");
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'x':
|
||||
result = get_reverse(textname, sizeof(textname), value, false);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
@@ -1638,16 +1581,16 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
typeset = true;
|
||||
} else {
|
||||
fprintf(stderr, "Invalid IP address %s\n", value);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
invalid_option:
|
||||
default:
|
||||
fprintf(stderr, "Invalid option: -%s\n", option);
|
||||
usage();
|
||||
}
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1787,11 +1730,6 @@ parse_args(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
/* check consistency */
|
||||
if (qmin && !fulltrace) {
|
||||
fatal("'+qmin' cannot be used without '+ns'");
|
||||
}
|
||||
|
||||
/*
|
||||
* If no qname or qtype specified, search for root/NS
|
||||
* If no qtype specified, use A
|
||||
@@ -1814,11 +1752,11 @@ parse_args(int argc, char **argv) {
|
||||
static isc_result_t
|
||||
append_str(const char *text, int len, char **p, char *end) {
|
||||
if (len > end - *p) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
memmove(*p, text, len);
|
||||
*p += len;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1829,17 +1767,17 @@ reverse_octets(const char *in, char **p, char *end) {
|
||||
isc_result_t result;
|
||||
result = reverse_octets(dot + 1, p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
result = append_str(".", 1, p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
len = (int)(dot - in);
|
||||
} else {
|
||||
len = strlen(in);
|
||||
}
|
||||
return append_str(in, len, p, end);
|
||||
return (append_str(in, len, p, end));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1858,10 +1796,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
|
||||
name = dns_fixedname_initname(&fname);
|
||||
result = dns_byaddr_createptrname(&addr, name);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
dns_name_format(name, reverse, (unsigned int)len);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
/*
|
||||
* Not a valid IPv6 address. Assume IPv4.
|
||||
@@ -1874,17 +1812,17 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
|
||||
char *p = reverse;
|
||||
char *end = reverse + len;
|
||||
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
|
||||
return DNS_R_BADDOTTEDQUAD;
|
||||
return (DNS_R_BADDOTTEDQUAD);
|
||||
}
|
||||
result = reverse_octets(value, &p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
result = append_str(".in-addr.arpa.", 15, &p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1960,8 +1898,6 @@ run_resolve(void *arg) {
|
||||
/* Create client */
|
||||
CHECK(dns_client_create(mctx, loopmgr, netmgr, 0, tlsctx_client_cache,
|
||||
&client, srcaddr4, srcaddr6));
|
||||
dns_client_setmaxrestarts(client, restarts);
|
||||
dns_client_setmaxqueries(client, maxtotal);
|
||||
|
||||
/* Set the nameserver */
|
||||
if (server != NULL) {
|
||||
@@ -1991,7 +1927,6 @@ cleanup:
|
||||
static void
|
||||
shutdown_server(void) {
|
||||
if (requestmgr != NULL) {
|
||||
dns_requestmgr_shutdown(requestmgr);
|
||||
dns_requestmgr_detach(&requestmgr);
|
||||
}
|
||||
if (interfacemgr != NULL) {
|
||||
@@ -2023,8 +1958,7 @@ recvresponse(void *arg) {
|
||||
fatal("request event result: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTPARSE,
|
||||
&response);
|
||||
dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response);
|
||||
|
||||
result = dns_request_getresponse(request, response,
|
||||
DNS_MESSAGEPARSE_PRESERVEORDER);
|
||||
@@ -2122,7 +2056,7 @@ accept_cb(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
||||
UNUSED(handle);
|
||||
UNUSED(arg);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2139,8 +2073,7 @@ sendquery(void *arg) {
|
||||
/* Construct query message */
|
||||
CHECK(convert_name(&qfn, &query_name, qname));
|
||||
|
||||
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTRENDER,
|
||||
&message);
|
||||
dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &message);
|
||||
message->opcode = dns_opcode_query;
|
||||
message->flags = DNS_MESSAGEFLAG_RD | DNS_MESSAGEFLAG_AD;
|
||||
if (cdflag) {
|
||||
@@ -2162,13 +2095,14 @@ sendquery(void *arg) {
|
||||
NULL, 0));
|
||||
CHECK(dns_message_setopt(message, opt));
|
||||
|
||||
CHECK(dns_requestmgr_create(mctx, loopmgr, dispatchmgr, NULL, NULL,
|
||||
CHECK(dns_requestmgr_create(mctx, dispatchmgr, NULL, NULL,
|
||||
&requestmgr));
|
||||
|
||||
dns_view_attach(view, &(dns_view_t *){ NULL });
|
||||
CHECK(dns_request_create(requestmgr, message, NULL, &peer, NULL, NULL,
|
||||
DNS_REQUESTOPT_TCP, NULL, 1, 0, 0, isc_loop(),
|
||||
recvresponse, message, &request));
|
||||
DNS_REQUESTOPT_TCP, NULL, 1, 0, 0,
|
||||
isc_loop_current(loopmgr), recvresponse,
|
||||
message, &request));
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
@@ -2181,23 +2115,16 @@ cleanup:
|
||||
|
||||
static isc_result_t
|
||||
matchview(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr,
|
||||
dns_message_t *message, dns_aclenv_t *env, ns_server_t *lsctx,
|
||||
isc_loop_t *loop, isc_job_cb cb, void *cbarg,
|
||||
isc_result_t *sigresultp, isc_result_t *viewpatchresultp,
|
||||
dns_message_t *message, dns_aclenv_t *env, isc_result_t *sigresultp,
|
||||
dns_view_t **viewp) {
|
||||
UNUSED(srcaddr);
|
||||
UNUSED(destaddr);
|
||||
UNUSED(message);
|
||||
UNUSED(env);
|
||||
UNUSED(lsctx);
|
||||
UNUSED(loop);
|
||||
UNUSED(cb);
|
||||
UNUSED(cbarg);
|
||||
UNUSED(sigresultp);
|
||||
|
||||
*viewp = view;
|
||||
*viewpatchresultp = ISC_R_SUCCESS;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2212,22 +2139,19 @@ run_server(void *arg) {
|
||||
RUNTIME_CHECK(inet_pton(AF_INET, "127.0.0.1", &in));
|
||||
isc_sockaddr_fromin(&addr, &in, 0);
|
||||
|
||||
ns_server_create(mctx, matchview, &sctx);
|
||||
CHECK(ns_server_create(mctx, matchview, &sctx));
|
||||
|
||||
CHECK(dns_dispatchmgr_create(mctx, loopmgr, netmgr, &dispatchmgr));
|
||||
CHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
|
||||
isc_sockaddr_any(&any);
|
||||
CHECK(dns_dispatch_createudp(dispatchmgr, &any, &dispatch));
|
||||
CHECK(ns_interfacemgr_create(mctx, sctx, loopmgr, netmgr, dispatchmgr,
|
||||
NULL, &interfacemgr));
|
||||
NULL, false, &interfacemgr));
|
||||
|
||||
CHECK(dns_view_create(mctx, loopmgr, dispatchmgr, dns_rdataclass_in,
|
||||
"_default", &view));
|
||||
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", mctx, &cache));
|
||||
CHECK(dns_view_create(mctx, dns_rdataclass_in, "_default", &view));
|
||||
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", &cache));
|
||||
dns_view_setcache(view, cache, false);
|
||||
dns_cache_detach(&cache);
|
||||
dns_view_setdstport(view, destport);
|
||||
dns_view_setmaxrestarts(view, restarts);
|
||||
dns_view_setmaxqueries(view, maxtotal);
|
||||
|
||||
CHECK(dns_rootns_create(mctx, dns_rdataclass_in, hintfile, &roothints));
|
||||
dns_view_sethints(view, roothints);
|
||||
@@ -2236,18 +2160,18 @@ run_server(void *arg) {
|
||||
view->qminimization = qmin;
|
||||
view->qmin_strict = qmin_strict;
|
||||
|
||||
dns_view_initsecroots(view);
|
||||
CHECK(dns_view_initsecroots(view, mctx));
|
||||
CHECK(setup_dnsseckeys(NULL, view));
|
||||
|
||||
CHECK(dns_view_createresolver(view, netmgr, 0, tlsctx_client_cache,
|
||||
dispatch, NULL));
|
||||
dns_resolver_setmaxqueries(view->resolver, maxqueries);
|
||||
dns_view_setdispatchmgr(view, dispatchmgr);
|
||||
CHECK(dns_view_createresolver(view, loopmgr, 1, netmgr, 0,
|
||||
tlsctx_client_cache, dispatch, NULL));
|
||||
|
||||
isc_stats_create(mctx, &resstats, dns_resstatscounter_max);
|
||||
CHECK(isc_stats_create(mctx, &resstats, dns_resstatscounter_max));
|
||||
dns_resolver_setstats(view->resolver, resstats);
|
||||
isc_stats_detach(&resstats);
|
||||
|
||||
dns_rdatatypestats_create(mctx, &resquerystats);
|
||||
CHECK(dns_rdatatypestats_create(mctx, &resquerystats));
|
||||
dns_resolver_setquerystats(view->resolver, resquerystats);
|
||||
dns_stats_detach(&resquerystats);
|
||||
|
||||
@@ -2257,10 +2181,9 @@ run_server(void *arg) {
|
||||
|
||||
CHECK(isc_nm_listenstreamdns(netmgr, ISC_NM_LISTEN_ONE, &addr,
|
||||
ns_client_request, ifp, accept_cb, ifp, 10,
|
||||
NULL, NULL, ISC_NM_PROXY_NONE,
|
||||
&ifp->tcplistensocket));
|
||||
NULL, NULL, &ifp->tcplistensocket));
|
||||
ifp->flags |= NS_INTERFACEFLAG_LISTENING;
|
||||
isc_async_current(sendquery, ifp->tcplistensocket);
|
||||
isc_async_current(loopmgr, sendquery, ifp->tcplistensocket);
|
||||
|
||||
return;
|
||||
|
||||
@@ -2338,5 +2261,5 @@ cleanup:
|
||||
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
+1
-18
@@ -293,7 +293,7 @@ assign values to options like the timeout interval. They have the form
|
||||
|
||||
This option toggles logging of messages sent. This produces a detailed
|
||||
dump of the queries sent by :program:`delv` in the process of carrying
|
||||
out the resolution and validation process. Turning on this option
|
||||
out the resolution and validation process. Turning on this option
|
||||
also activates ``+mtrace``.
|
||||
|
||||
This is equivalent to setting the debug level to 11 for the "packets"
|
||||
@@ -337,23 +337,6 @@ assign values to options like the timeout interval. They have the form
|
||||
they are replaced by the string ``[omitted]`` or, in the DNSKEY case, the
|
||||
key ID is displayed as the replacement, e.g. ``[ key id = value ]``.
|
||||
|
||||
.. option:: +restarts
|
||||
|
||||
When name server mode (``delv +ns``) is in use, this option sets the
|
||||
maximum number of CNAME queries to follow before terminating resolution.
|
||||
This prevents ``delv`` from hanging in the event of a CNAME loop.
|
||||
The default is 11.
|
||||
|
||||
.. option:: +maxqueries
|
||||
|
||||
This option specifies the maximum number of queries to send to resolve
|
||||
a name before giving up. The default is 50.
|
||||
|
||||
.. option:: +maxtotalqueries
|
||||
|
||||
This option specifies the maximum number of queries to send to resolve
|
||||
a client request before giving up. The default is 200.
|
||||
|
||||
.. option:: +trust, +notrust
|
||||
|
||||
This option controls whether to display the trust level when printing a record.
|
||||
|
||||
+1
-2
@@ -5,8 +5,7 @@ AM_CPPFLAGS += \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBIDN2_CFLAGS) \
|
||||
$(LIBUV_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
$(LIBUV_CFLAGS)
|
||||
|
||||
LDADD += \
|
||||
libdighost.la \
|
||||
|
||||
+92
-475
@@ -89,9 +89,9 @@ rcode_totext(dns_rcode_t rcode) {
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
if (strspn(buf + 1, "0123456789") == strlen(buf + 1)) {
|
||||
buf[0] = '?';
|
||||
return buf;
|
||||
return (buf);
|
||||
}
|
||||
return buf + 1;
|
||||
return (buf + 1);
|
||||
}
|
||||
|
||||
/*% print usage */
|
||||
@@ -119,7 +119,7 @@ usage(void) {
|
||||
print_usage(stderr);
|
||||
fprintf(stderr, "\nUse \"dig -h\" (or \"dig -h | more\") "
|
||||
"for complete list of options\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
#endif /* if TARGET_OS_IPHONE */
|
||||
|
||||
@@ -225,7 +225,7 @@ help(void) {
|
||||
" +[no]http-plain[=###] (DNS over plain HTTP "
|
||||
"mode) "
|
||||
"[/]\n"
|
||||
" +[no]http-plain-get (Use GET instead of "
|
||||
" +[no]https-plain-get (Use GET instead of "
|
||||
"default POST method while using plain HTTP)\n"
|
||||
" +[no]identify (ID responders in short "
|
||||
"answers)\n"
|
||||
@@ -252,14 +252,6 @@ help(void) {
|
||||
"request)\n"
|
||||
" +padding=### (Set padding block size "
|
||||
"[0])\n"
|
||||
" "
|
||||
"+[no]proxy[=src_addr[#src_port]-dst_addr[#dst_port]] "
|
||||
"(Add PROXYv2 headers to the queries. If addresses are omitted, "
|
||||
"LOCAL PROXYv2 headers are added)\n"
|
||||
" "
|
||||
"+[no]proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port]] "
|
||||
"(The same as '+[no]proxy', but send PROXYv2 headers ahead of "
|
||||
"any encryption if an encrypted transport is used)\n"
|
||||
" +qid=### (Specify the query ID to "
|
||||
"use when sending queries)\n"
|
||||
" +[no]qr (Print question before "
|
||||
@@ -284,7 +276,6 @@ help(void) {
|
||||
" form of answers - global "
|
||||
"option)\n"
|
||||
" +[no]showbadcookie (Show BADCOOKIE message)\n"
|
||||
" +[no]showbadvers (Show BADVERS message)\n"
|
||||
" +[no]showsearch (Search with intermediate "
|
||||
"results)\n"
|
||||
" +[no]split=## (Split hex/base64 fields "
|
||||
@@ -307,7 +298,8 @@ help(void) {
|
||||
" +[no]tls-keyfile=file (Load client TLS "
|
||||
"private key from file)\n"
|
||||
" +[no]trace (Trace delegation down "
|
||||
"from root [implies +dnssec])\n"
|
||||
"from root "
|
||||
"[+dnssec])\n"
|
||||
" +tries=### (Set number of UDP "
|
||||
"attempts) [3]\n"
|
||||
" +[no]ttlid (Control display of ttls "
|
||||
@@ -373,39 +365,6 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
}
|
||||
printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->userarg,
|
||||
proto);
|
||||
|
||||
if (query->lookup->proxy_mode) {
|
||||
printf(";; CLIENT PROXY HEADER");
|
||||
|
||||
if ((dig_lookup_is_tls(query->lookup) ||
|
||||
(query->lookup->https_mode &&
|
||||
!query->lookup->http_plain)) &&
|
||||
query->lookup->proxy_plain)
|
||||
{
|
||||
printf(" (plain)");
|
||||
}
|
||||
|
||||
printf(": ");
|
||||
|
||||
if (!query->lookup->proxy_local) {
|
||||
char src_buf[ISC_SOCKADDR_FORMATSIZE] = { 0 };
|
||||
char dst_buf[ISC_SOCKADDR_FORMATSIZE] = { 0 };
|
||||
|
||||
isc_sockaddr_format(
|
||||
&query->lookup->proxy_src_addr, src_buf,
|
||||
sizeof(src_buf));
|
||||
|
||||
isc_sockaddr_format(
|
||||
&query->lookup->proxy_dst_addr, dst_buf,
|
||||
sizeof(dst_buf));
|
||||
printf("source: %s, destination: %s", src_buf,
|
||||
dst_buf);
|
||||
} else {
|
||||
printf("LOCAL");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
time(&tnow);
|
||||
(void)localtime_r(&tnow, &tmnow);
|
||||
|
||||
@@ -474,7 +433,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
||||
if (query->lookup->trace || query->lookup->ns_search_only) {
|
||||
result = dns_rdatatype_totext(rdata->type, buf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
ADD_STRING(buf, " ");
|
||||
}
|
||||
@@ -495,7 +454,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
||||
result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, splitwidth,
|
||||
" ", buf);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
check_result(result, "dns_rdata_totext");
|
||||
if (query->lookup->identify) {
|
||||
@@ -512,7 +471,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
||||
ADD_STRING(buf, store);
|
||||
}
|
||||
ADD_STRING(buf, "\n");
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -528,22 +487,21 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
|
||||
size_t i, count = 10;
|
||||
|
||||
name = dns_fixedname_initname(&fixed);
|
||||
result = dns_name_fromstring(name, "ipv4only.arpa", dns_rootname, 0,
|
||||
NULL);
|
||||
result = dns_name_fromstring(name, "ipv4only.arpa", 0, NULL);
|
||||
check_result(result, "dns_name_fromstring");
|
||||
|
||||
result = dns_message_findname(msg, DNS_SECTION_ANSWER, name,
|
||||
dns_rdatatype_aaaa, dns_rdatatype_none,
|
||||
NULL, &rdataset);
|
||||
if (result == DNS_R_NXDOMAIN || result == DNS_R_NXRRSET) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_dns64_findprefix(rdataset, prefix, &count);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
if (count > 10) {
|
||||
count = 10;
|
||||
@@ -551,15 +509,15 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
|
||||
for (i = 0; i < count; i++) {
|
||||
result = isc_netaddr_totext(&prefix[i].addr, buf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
result = isc_buffer_printf(buf, "/%u\n", prefix[i].prefixlen);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -579,9 +537,9 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
|
||||
dns_name_init(&empty_name, NULL);
|
||||
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -596,7 +554,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
result = say_message(&rdata, query, buf);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
check_result(result, "say_message");
|
||||
loopresult = dns_rdataset_next(rdataset);
|
||||
@@ -607,11 +565,11 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -629,10 +587,10 @@ isdotlocal(dns_message_t *msg) {
|
||||
dns_name_t *name = NULL;
|
||||
dns_message_currentname(msg, DNS_SECTION_QUESTION, &name);
|
||||
if (dns_name_issubdomain(name, &local)) {
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,7 +707,8 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
char *hash;
|
||||
int pf;
|
||||
|
||||
printf("- type: MESSAGE\n");
|
||||
printf("-\n");
|
||||
printf(" type: MESSAGE\n");
|
||||
printf(" message:\n");
|
||||
|
||||
if (isquery) {
|
||||
@@ -1025,7 +984,7 @@ repopulate_buffer:
|
||||
|
||||
dig_idnsetup(query->lookup, false);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -1092,323 +1051,6 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
||||
goto invalid_option; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Parse source and destination addresses in the same format as used by "kdig":
|
||||
*
|
||||
* SRC_ADDR[#SRC_PORT]-DST_ADDR[#DST_PORT]
|
||||
*
|
||||
* This can be described (pretty closely for our purpose) using the
|
||||
* following EBNF grammar:
|
||||
*
|
||||
* S = proxy-addrs. (* start rule *)
|
||||
* proxy-addrs = addr "-" addr EOF.
|
||||
* addr = addr-char { addr-char } ["#" port ].
|
||||
* port = digit { digit }.
|
||||
* addr-char = <aby but "#", "-", EOF >.
|
||||
* EOF = '\0'.
|
||||
*/
|
||||
#define MATCH(ch) (st->str[0] == (ch))
|
||||
#define MATCH_DIGIT() isdigit((unsigned char)(st->str[0]))
|
||||
#define ADVANCE() st->str++
|
||||
#define GETP() (st->str)
|
||||
|
||||
typedef struct isc_proxy_addrs_parser_state {
|
||||
const char *str;
|
||||
|
||||
const char *last_addr_start;
|
||||
size_t last_addr_len;
|
||||
|
||||
const char *last_port_start;
|
||||
size_t last_port_len;
|
||||
|
||||
const char *src_addr_start;
|
||||
size_t src_addr_len;
|
||||
|
||||
const char *src_port_start;
|
||||
size_t src_port_len;
|
||||
|
||||
const char *dst_addr_start;
|
||||
size_t dst_addr_len;
|
||||
|
||||
const char *dst_port_start;
|
||||
size_t dst_port_len;
|
||||
} isc_proxy_addrs_parser_state_t;
|
||||
|
||||
static bool
|
||||
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st);
|
||||
|
||||
static bool
|
||||
rule_addr(isc_proxy_addrs_parser_state_t *st);
|
||||
|
||||
static bool
|
||||
rule_port(isc_proxy_addrs_parser_state_t *st);
|
||||
|
||||
static bool
|
||||
rule_addr_char(isc_proxy_addrs_parser_state_t *st);
|
||||
|
||||
static void
|
||||
proxy_handle_port_string(const char *port_start, const size_t port_len,
|
||||
in_port_t *pport) {
|
||||
char buf[512] = { 0 }; /* max */
|
||||
size_t string_size = 0, max_string_bytes = 0;
|
||||
unsigned int tmp;
|
||||
isc_result_t result;
|
||||
|
||||
string_size = port_len + 1;
|
||||
max_string_bytes = string_size > sizeof(buf) ? sizeof(buf)
|
||||
: string_size;
|
||||
|
||||
(void)strlcpy(buf, port_start, max_string_bytes);
|
||||
result = parse_uint(&tmp, buf, MAXPORT, "port number");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Couldn't parse port number");
|
||||
}
|
||||
*pport = tmp;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
proxy_handle_addr_string(const char *addr_start, const size_t addr_len,
|
||||
const in_port_t addr_port, isc_sockaddr_t *addr) {
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
char buf[512] = { 0 }; /* max */
|
||||
size_t string_size = 0, max_string_bytes = 0;
|
||||
struct in_addr ipv4 = { 0 };
|
||||
struct in6_addr ipv6 = { 0 };
|
||||
int ret = 0;
|
||||
|
||||
string_size = addr_len + 1;
|
||||
max_string_bytes = string_size > sizeof(buf) ? sizeof(buf)
|
||||
: string_size;
|
||||
|
||||
(void)strlcpy(buf, addr_start, max_string_bytes);
|
||||
|
||||
ret = inet_pton(AF_INET, buf, &ipv4);
|
||||
if (ret == 1) {
|
||||
isc_sockaddr_fromin(addr, &ipv4, addr_port);
|
||||
result = ISC_R_SUCCESS;
|
||||
} else {
|
||||
ret = inet_pton(AF_INET6, buf, &ipv6);
|
||||
if (ret == 1) {
|
||||
isc_sockaddr_fromin6(addr, &ipv6, addr_port);
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
|
||||
isc_sockaddr_t *pdst) {
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
isc_sockaddr_t src = { 0 }, dst = { 0 };
|
||||
isc_proxy_addrs_parser_state_t st = { 0 };
|
||||
in_port_t src_port = 0, dst_port = 53; /* Follow kdig footsteps */
|
||||
|
||||
REQUIRE(addrs != NULL && *addrs != '\0');
|
||||
REQUIRE(psrc != NULL);
|
||||
REQUIRE(pdst != NULL);
|
||||
|
||||
st.str = addrs;
|
||||
|
||||
/* start syntax analysis and verification */
|
||||
if (!rule_proxy_addrs(&st)) {
|
||||
warn("PROXY source and destination addresses cannot be parsed");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* get port numeric values */
|
||||
if (st.src_port_len > 0) {
|
||||
INSIST(st.src_port_start != NULL);
|
||||
proxy_handle_port_string(st.src_port_start, st.src_port_len,
|
||||
&src_port);
|
||||
}
|
||||
|
||||
if (st.dst_port_len > 0) {
|
||||
INSIST(st.dst_port_start != NULL);
|
||||
proxy_handle_port_string(st.dst_port_start, st.dst_port_len,
|
||||
&dst_port);
|
||||
}
|
||||
|
||||
/* get addresses */
|
||||
INSIST(st.src_addr_len > 0);
|
||||
INSIST(st.src_addr_start != NULL);
|
||||
INSIST(st.dst_addr_len > 0);
|
||||
INSIST(st.dst_addr_start != NULL);
|
||||
|
||||
result = proxy_handle_addr_string(st.src_addr_start, st.src_addr_len,
|
||||
src_port, &src);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
warn("Cannot get PROXY source address: %s",
|
||||
isc_result_totext(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
result = proxy_handle_addr_string(st.dst_addr_start, st.dst_addr_len,
|
||||
dst_port, &dst);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
warn("Cannot get PROXY destination address: %s",
|
||||
isc_result_totext(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* addresses should be of the same type */
|
||||
if (isc_sockaddr_pf(&src) != isc_sockaddr_pf(&dst)) {
|
||||
warn("PROXY source and destination addresses must be of the "
|
||||
"same type");
|
||||
return false;
|
||||
}
|
||||
|
||||
*psrc = src;
|
||||
*pdst = dst;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
|
||||
if (!rule_addr(st)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
st->src_addr_start = st->last_addr_start;
|
||||
st->src_addr_len = st->last_addr_len;
|
||||
st->src_port_start = st->last_port_start;
|
||||
st->src_port_len = st->last_port_len;
|
||||
|
||||
if (!MATCH('-')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ADVANCE();
|
||||
|
||||
if (!rule_addr(st)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
st->dst_addr_start = st->last_addr_start;
|
||||
st->dst_addr_len = st->last_addr_len;
|
||||
st->dst_port_start = st->last_port_start;
|
||||
st->dst_port_len = st->last_port_len;
|
||||
|
||||
if (!MATCH('\0')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
rule_addr(isc_proxy_addrs_parser_state_t *st) {
|
||||
const char *start = GETP();
|
||||
if (!rule_addr_char(st)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (rule_addr_char(st)) {
|
||||
/* skip */
|
||||
}
|
||||
|
||||
st->last_addr_start = start;
|
||||
st->last_addr_len = GETP() - start;
|
||||
|
||||
if (MATCH('#')) {
|
||||
ADVANCE();
|
||||
|
||||
if (!rule_port(st)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
rule_port(isc_proxy_addrs_parser_state_t *st) {
|
||||
const char *start = GETP();
|
||||
if (!MATCH_DIGIT()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ADVANCE();
|
||||
|
||||
while (MATCH_DIGIT()) {
|
||||
ADVANCE();
|
||||
}
|
||||
|
||||
st->last_port_start = start;
|
||||
st->last_port_len = GETP() - start;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
rule_addr_char(isc_proxy_addrs_parser_state_t *st) {
|
||||
if (MATCH('#') || MATCH('-') || MATCH('\0')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ADVANCE();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef GETP
|
||||
#undef ADVANCE
|
||||
#undef MATCH_DIGIT
|
||||
#undef MATCH
|
||||
|
||||
static bool
|
||||
plus_proxy_handle_addresses(const char *value, const bool state,
|
||||
dig_lookup_t *lookup) {
|
||||
lookup->proxy_mode = state;
|
||||
if (!state) {
|
||||
/*
|
||||
* We are not interested in the option value in that
|
||||
* case
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value == NULL || *value == '\0') {
|
||||
lookup->proxy_local = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!parse_proxy_addresses(value, &lookup->proxy_src_addr,
|
||||
&lookup->proxy_dst_addr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
plus_proxy_options(const char *cmd, const char *value, const bool state,
|
||||
dig_lookup_t *lookup) {
|
||||
switch (cmd[5]) {
|
||||
case '-':
|
||||
FULLCHECK("proxy-plain");
|
||||
lookup->proxy_plain = state;
|
||||
if (!plus_proxy_handle_addresses(value, state, lookup)) {
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
FULLCHECK("proxy");
|
||||
if (!plus_proxy_handle_addresses(value, state, lookup)) {
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
return true;
|
||||
|
||||
invalid_option:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
plus_tls_options(const char *cmd, const char *value, const bool state,
|
||||
dig_lookup_t *lookup) {
|
||||
@@ -1526,7 +1168,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
|
||||
if ((cmd = strtok_r(option, "=", &last)) == NULL) {
|
||||
printf(";; Invalid option %s\n", option);
|
||||
return lookup;
|
||||
return (lookup);
|
||||
}
|
||||
if (strncasecmp(cmd, "no", 2) == 0) {
|
||||
cmd += 2;
|
||||
@@ -1675,8 +1317,6 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
switch (cmd[1]) {
|
||||
case 'e': /* defname */
|
||||
FULLCHECK("defname");
|
||||
fprintf(stderr, ";; +[no]defname option is "
|
||||
"deprecated; use +[no]search\n");
|
||||
if (!lookup->trace) {
|
||||
usesearch = state;
|
||||
}
|
||||
@@ -1762,8 +1402,6 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
FULLCHECK("edns");
|
||||
if (!state) {
|
||||
lookup->edns = -1;
|
||||
lookup->original_edns =
|
||||
-1;
|
||||
break;
|
||||
}
|
||||
if (value == NULL) {
|
||||
@@ -1780,7 +1418,6 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
goto exit_or_usage;
|
||||
}
|
||||
lookup->edns = num;
|
||||
lookup->original_edns = num;
|
||||
break;
|
||||
case 'f':
|
||||
FULLCHECK("ednsflags");
|
||||
@@ -1800,10 +1437,6 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
"ednsflags");
|
||||
goto exit_or_usage;
|
||||
}
|
||||
if (lookup->edns == -1) {
|
||||
lookup->edns =
|
||||
DEFAULT_EDNS_VERSION;
|
||||
}
|
||||
lookup->ednsflags = num;
|
||||
break;
|
||||
case 'n':
|
||||
@@ -1828,12 +1461,9 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
"specified");
|
||||
goto exit_or_usage;
|
||||
}
|
||||
extra = strtok_r(NULL, "",
|
||||
extra = strtok_r(NULL, "\0",
|
||||
&last);
|
||||
save_opt(lookup, code, extra);
|
||||
if (extra != NULL) {
|
||||
extra[-1] = ':';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
@@ -2061,11 +1691,12 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
case 'm': /* multiline */
|
||||
switch (cmd[1]) {
|
||||
case 'a':
|
||||
FULLCHECK("mapped");
|
||||
fatal("+mapped option no longer supported");
|
||||
fprintf(stderr, ";; +mapped option is deprecated");
|
||||
break;
|
||||
case 'u':
|
||||
FULLCHECK("multiline");
|
||||
lookup->multiline = state;
|
||||
@@ -2165,30 +1796,19 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
switch (cmd[1]) {
|
||||
case 'a':
|
||||
FULLCHECK("padding");
|
||||
if (state && lookup->edns == -1) {
|
||||
lookup->edns = DEFAULT_EDNS_VERSION;
|
||||
}
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
result = parse_uint(&num, value, 512, "padding");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
warn("Couldn't parse padding");
|
||||
goto exit_or_usage;
|
||||
}
|
||||
lookup->padding = (uint16_t)num;
|
||||
break;
|
||||
case 'r':
|
||||
if (!plus_proxy_options(cmd, value, state, lookup)) {
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
FULLCHECK("padding");
|
||||
if (state && lookup->edns == -1) {
|
||||
lookup->edns = DEFAULT_EDNS_VERSION;
|
||||
}
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
result = parse_uint(&num, value, 512, "padding");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
warn("Couldn't parse padding");
|
||||
goto exit_or_usage;
|
||||
}
|
||||
lookup->padding = (uint16_t)num;
|
||||
break;
|
||||
case 'q':
|
||||
switch (cmd[1]) {
|
||||
@@ -2299,18 +1919,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
case 'w': /* showsearch */
|
||||
switch (cmd[4]) {
|
||||
case 'b':
|
||||
switch (cmd[7]) {
|
||||
case 'c':
|
||||
FULLCHECK("showbadcookie");
|
||||
lookup->showbadcookie = state;
|
||||
break;
|
||||
case 'v':
|
||||
FULLCHECK("showbadvers");
|
||||
lookup->showbadvers = state;
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
FULLCHECK("showbadcookie");
|
||||
lookup->showbadcookie = state;
|
||||
break;
|
||||
case 's':
|
||||
FULLCHECK("showsearch");
|
||||
@@ -2329,7 +1939,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
break;
|
||||
case 'i': /* sigchase */
|
||||
FULLCHECK("sigchase");
|
||||
fatal("+sigchase option no longer supported");
|
||||
fprintf(stderr, ";; +sigchase option is deprecated");
|
||||
break;
|
||||
case 'p': /* split */
|
||||
FULLCHECK("split");
|
||||
if (value != NULL && !state) {
|
||||
@@ -2453,7 +2064,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
break;
|
||||
case 'o':
|
||||
FULLCHECK("topdown");
|
||||
fatal("+topdown option no longer supported");
|
||||
fprintf(stderr, ";; +topdown option is deprecated");
|
||||
break;
|
||||
case 'r':
|
||||
switch (cmd[2]) {
|
||||
case 'a': /* trace */
|
||||
@@ -2494,8 +2106,9 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
break;
|
||||
case 'u': /* trusted-key */
|
||||
FULLCHECK("trusted-key");
|
||||
fatal("+trusted-key option "
|
||||
"no longer supported");
|
||||
fprintf(stderr, ";; +trusted-key option is "
|
||||
"deprecated");
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
@@ -2532,8 +2145,9 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
switch (cmd[2]) {
|
||||
case 'e':
|
||||
FULLCHECK("unexpected");
|
||||
fatal("+unexpected option "
|
||||
"no longer supported");
|
||||
fprintf(stderr, ";; +unexpected option "
|
||||
"is deprecated");
|
||||
break;
|
||||
case 'k':
|
||||
FULLCHECK("unknownformat");
|
||||
lookup->print_unknown_format = state;
|
||||
@@ -2541,7 +2155,11 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'v':
|
||||
FULLCHECK("vc");
|
||||
@@ -2572,10 +2190,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
|
||||
fprintf(stderr, "Invalid option: +%s\n", option);
|
||||
usage();
|
||||
}
|
||||
if (value != NULL) {
|
||||
value[-1] = '=';
|
||||
}
|
||||
return lookup;
|
||||
return (lookup);
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
exit_or_usage:
|
||||
@@ -2621,7 +2236,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
} else {
|
||||
fatal("can't find IPv4 networking");
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
break;
|
||||
case '6':
|
||||
@@ -2631,7 +2246,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
} else {
|
||||
fatal("can't find IPv6 networking");
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
@@ -2640,22 +2255,24 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
cmd = option;
|
||||
FULLCHECK("debug");
|
||||
debugging = true;
|
||||
return false;
|
||||
return (false);
|
||||
} else {
|
||||
debugging = true;
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
help();
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
break;
|
||||
case 'i':
|
||||
fatal("-%c removed", option[0]);
|
||||
/* deprecated */
|
||||
break;
|
||||
case 'm': /* memdebug */
|
||||
/* memdebug is handled in preparse_args() */
|
||||
break;
|
||||
case 'n':
|
||||
fatal("-%c removed", option[0]);
|
||||
/* deprecated */
|
||||
break;
|
||||
case 'r':
|
||||
debug("digrc (late)");
|
||||
digrc = false;
|
||||
@@ -2665,13 +2282,13 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
break;
|
||||
case 'v':
|
||||
printf("DiG %s\n", PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
if (strlen(option) > 1U) {
|
||||
option = &option[1];
|
||||
} else {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
opt = option[0];
|
||||
@@ -2715,7 +2332,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
*hash = '#';
|
||||
}
|
||||
specified_source = true;
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'c':
|
||||
if ((*lookup)->rdclassset) {
|
||||
fprintf(stderr, ";; Warning, extra class option\n");
|
||||
@@ -2734,13 +2351,13 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
"invalid class %s\n",
|
||||
value);
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'f':
|
||||
batchname = value;
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'k':
|
||||
strlcpy(keyfile, value, sizeof(keyfile));
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'p':
|
||||
result = parse_uint(&num, value, MAXPORT, "port number");
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -2748,7 +2365,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
}
|
||||
port = num;
|
||||
port_set = true;
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'q':
|
||||
if (!config_only) {
|
||||
if (*need_clone) {
|
||||
@@ -2767,7 +2384,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
ISC_LIST_APPEND(lookup_list, (*lookup), link);
|
||||
debug("looking up %s", (*lookup)->textname);
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 't':
|
||||
*open_type_class = false;
|
||||
if (strncasecmp(value, "ixfr=", 5) == 0) {
|
||||
@@ -2825,7 +2442,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
"invalid type %s\n",
|
||||
value);
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'y':
|
||||
if ((ptr = strtok_r(value, ":", &last)) == NULL) {
|
||||
usage();
|
||||
@@ -2834,23 +2451,19 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
* secret */
|
||||
usage();
|
||||
}
|
||||
if ((ptr3 = strtok_r(NULL, "", &last)) != NULL) { /* secret or
|
||||
* NULL */
|
||||
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or
|
||||
* NULL */
|
||||
parse_hmac(ptr);
|
||||
ptr = ptr2;
|
||||
ptr2 = ptr3;
|
||||
} else {
|
||||
hmac_alg = DST_ALG_HMACMD5;
|
||||
hmacname = DNS_TSIG_HMACMD5_NAME;
|
||||
digestbits = 0;
|
||||
}
|
||||
/* XXXONDREJ: FIXME */
|
||||
strlcpy(keynametext, ptr, sizeof(keynametext));
|
||||
strlcpy(keysecret, ptr2, sizeof(keysecret));
|
||||
if (ptr3 != NULL) {
|
||||
ptr[-1] = ':';
|
||||
}
|
||||
ptr2[-1] = ':';
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
case 'x':
|
||||
if (*need_clone) {
|
||||
*lookup = clone_lookup(default_lookup, true);
|
||||
@@ -2878,16 +2491,16 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||
ISC_LIST_APPEND(lookup_list, *lookup, link);
|
||||
} else {
|
||||
fprintf(stderr, "Invalid IP address %s\n", value);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
return value_from_next;
|
||||
return (value_from_next);
|
||||
invalid_option:
|
||||
default:
|
||||
fprintf(stderr, "Invalid option: -%s\n", option);
|
||||
usage();
|
||||
}
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2981,7 +2594,7 @@ split_batchline(char *batchline, char **bargv, int len, const char *msg) {
|
||||
{
|
||||
debug("%s %d: %s", msg, bargc, bargv[bargc]);
|
||||
}
|
||||
return bargc;
|
||||
return (bargc);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3329,7 +2942,8 @@ dig_error(const char *format, ...) {
|
||||
va_list args;
|
||||
|
||||
if (yaml) {
|
||||
printf("- type: DIG_ERROR\n");
|
||||
printf("-\n");
|
||||
printf(" type: DIG_ERROR\n");
|
||||
|
||||
/*
|
||||
* Print an indent before a literal block quote.
|
||||
@@ -3346,7 +2960,10 @@ dig_error(const char *format, ...) {
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n"); /* We get the error without a newline */
|
||||
|
||||
if (!yaml) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3442,5 +3059,5 @@ main(int argc, char **argv) {
|
||||
dig_startup();
|
||||
dig_shutdown();
|
||||
|
||||
return exitcode;
|
||||
return (exitcode);
|
||||
}
|
||||
|
||||
+23
-55
@@ -507,44 +507,6 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
|
||||
mandatory. Responses to padded queries may also be padded, but only
|
||||
if the query uses TCP or DNS COOKIE.
|
||||
|
||||
.. option:: +proxy[=src_addr[#src_port]-dst_addr[#dst_port]], +noproxy
|
||||
|
||||
When this option is set, :program:`dig` adds PROXYv2 headers to the
|
||||
queries. When source and destination addresses are specified, the
|
||||
headers contain them and use the ``PROXY`` command. It means for
|
||||
the remote peer that the queries were sent on behalf of another
|
||||
node and that the PROXYv2 header reflects the original connection
|
||||
endpoints. The default source port is ``0`` and destination port is
|
||||
`53`.
|
||||
|
||||
For encrypted DNS transports, to prevent accidental information
|
||||
leakage, encryption is applied to the PROXYv2 headers: the headers
|
||||
are sent right after the handshake process has been completed.
|
||||
|
||||
For plain DNS transports, no encryption is applied to the PROXYv2
|
||||
headers.
|
||||
|
||||
If the addressees are omitted, PROXYv2 headers, that use the
|
||||
``LOCAL`` command set, are added instead. For the remote peer, that
|
||||
means that the queries were sent on purpose without being relayed,
|
||||
so the real connection endpoint addresses must be used.
|
||||
|
||||
.. option:: +proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port], +noproxy-plain
|
||||
|
||||
The same as ``+[no]proxy``, but instructs ``dig`` to send PROXYv2
|
||||
headers ahead of any encryption, before any handshake messages are
|
||||
sent. That makes :program:`dig` behave exactly how it is described
|
||||
in the PROXY protocol specification, but not all software expects
|
||||
such behaviour.
|
||||
|
||||
Please consult the software documentation to find out if you need
|
||||
this option. (for example, ``dnsdist`` expects encrypted PROXYv2
|
||||
headers sent over TLS when encryption is used, while ``HAProxy``
|
||||
and many other software packages expect plain ones).
|
||||
|
||||
For plain DNS transports the option is effectively an alias for the
|
||||
``+[no]proxy`` described above.
|
||||
|
||||
.. option:: +qid=value
|
||||
|
||||
This option specifies the query ID to use when sending queries.
|
||||
@@ -610,16 +572,15 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
|
||||
BADCOOKIE rcode before retrying the request or not. The default
|
||||
is to not show the messages.
|
||||
|
||||
.. option:: +showbadvers, +noshowbadvers
|
||||
|
||||
This option toggles whether to show the message containing the
|
||||
BADVERS rcode before retrying the request or not. The default
|
||||
is to not show the messages.
|
||||
|
||||
.. option:: +showsearch, +noshowsearch
|
||||
|
||||
This option performs [or does not perform] a search showing intermediate results.
|
||||
|
||||
.. option:: +sigchase, +nosigchase
|
||||
|
||||
This feature is now obsolete and has been removed; use :iscman:`delv`
|
||||
instead.
|
||||
|
||||
.. option:: +split=W
|
||||
|
||||
This option splits long hex- or base64-formatted fields in resource records into
|
||||
@@ -689,23 +650,25 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
|
||||
server TLS certificate verification. Otherwise, the DNS server name
|
||||
is used. This option has no effect if :option:`+tls-ca` is not specified.
|
||||
|
||||
.. option:: +topdown, +notopdown
|
||||
|
||||
This feature is related to :option:`dig +sigchase`, which is obsolete and
|
||||
has been removed. Use :iscman:`delv` instead.
|
||||
|
||||
.. option:: +trace, +notrace
|
||||
|
||||
This option toggles tracing of the delegation path from the root name
|
||||
servers for the name being looked up. Tracing is disabled by default.
|
||||
When tracing is enabled, :program:`dig` makes iterative queries to
|
||||
resolve the name being looked up. It follows referrals from the root
|
||||
servers, showing the answer from each server that was used to resolve
|
||||
the lookup.
|
||||
This option toggles tracing of the delegation path from the root name servers for
|
||||
the name being looked up. Tracing is disabled by default. When
|
||||
tracing is enabled, :program:`dig` makes iterative queries to resolve the
|
||||
name being looked up. It follows referrals from the root servers,
|
||||
showing the answer from each server that was used to resolve the
|
||||
lookup.
|
||||
|
||||
If ``@server`` is also specified, it affects only the initial query for
|
||||
the root zone name servers.
|
||||
|
||||
:option:`+dnssec` is set when :option:`+trace` is set, to better
|
||||
emulate the default queries from a name server.
|
||||
|
||||
Note that the ``delv +ns`` option can also be used for tracing the
|
||||
resolution of a name from the root (see :iscman:`delv`).
|
||||
:option:`+dnssec` is also set when :option:`+trace` is set, to better emulate the
|
||||
default queries from a name server.
|
||||
|
||||
.. option:: +tries=T
|
||||
|
||||
@@ -713,6 +676,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
|
||||
instead of the default, 3. If ``T`` is less than or equal to zero,
|
||||
the number of tries is silently rounded up to 1.
|
||||
|
||||
.. option:: +trusted-key=####
|
||||
|
||||
This option formerly specified trusted keys for use with :option:`dig +sigchase`. This
|
||||
feature is now obsolete and has been removed; use :iscman:`delv` instead.
|
||||
|
||||
.. option:: +ttlid, +nottlid
|
||||
|
||||
This option displays [or does not display] the TTL when printing the record.
|
||||
|
||||
+140
-210
@@ -60,7 +60,6 @@
|
||||
#include <isc/xml.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/ede.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/message.h>
|
||||
@@ -139,7 +138,7 @@ char keyfile[MXNAME] = "";
|
||||
char keysecret[MXNAME] = "";
|
||||
unsigned char cookie_secret[33];
|
||||
unsigned char cookie[8];
|
||||
dst_algorithm_t hmac_alg = DST_ALG_UNKNOWN;
|
||||
const dns_name_t *hmacname = NULL;
|
||||
unsigned int digestbits = 0;
|
||||
isc_buffer_t *namebuf = NULL;
|
||||
dns_tsigkey_t *tsigkey = NULL;
|
||||
@@ -237,7 +236,7 @@ count_dots(char *string) {
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return i;
|
||||
return (i);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -285,11 +284,11 @@ hex_dump(isc_buffer_t *b) {
|
||||
static isc_result_t
|
||||
append(const char *text, size_t len, char **p, char *end) {
|
||||
if (*p + len > end) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
memmove(*p, text, len);
|
||||
*p += len;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -300,17 +299,17 @@ reverse_octets(const char *in, char **p, char *end) {
|
||||
isc_result_t result;
|
||||
result = reverse_octets(dot + 1, p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
result = append(".", 1, p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
len = (int)(dot - in);
|
||||
} else {
|
||||
len = (int)strlen(in);
|
||||
}
|
||||
return append(in, len, p, end);
|
||||
return (append(in, len, p, end));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -329,10 +328,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
|
||||
name = dns_fixedname_initname(&fname);
|
||||
result = dns_byaddr_createptrname(&addr, name);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
dns_name_format(name, reverse, (unsigned int)len);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
/*
|
||||
* Not a valid IPv6 address. Assume IPv4.
|
||||
@@ -345,21 +344,23 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
|
||||
char *p = reverse;
|
||||
char *end = reverse + len;
|
||||
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
|
||||
return DNS_R_BADDOTTEDQUAD;
|
||||
return (DNS_R_BADDOTTEDQUAD);
|
||||
}
|
||||
result = reverse_octets(value, &p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
/* Append .in-addr.arpa. and a terminating NUL. */
|
||||
result = append(".in-addr.arpa.", 15, &p, end);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
void (*dighost_pre_exit_hook)(void) = NULL;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
void
|
||||
warn(const char *format, ...) {
|
||||
@@ -392,7 +393,10 @@ digexit(void) {
|
||||
exitcode = 10;
|
||||
}
|
||||
if (fatalexit != 0) {
|
||||
_exit(fatalexit);
|
||||
exitcode = fatalexit;
|
||||
}
|
||||
if (dighost_pre_exit_hook != NULL) {
|
||||
dighost_pre_exit_hook();
|
||||
}
|
||||
exit(exitcode);
|
||||
}
|
||||
@@ -407,11 +411,7 @@ fatal(const char *format, ...) {
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
if (fatalexit == 0 && exitcode != 0) {
|
||||
fatalexit = exitcode;
|
||||
} else if (fatalexit == 0) {
|
||||
fatalexit = EXIT_FAILURE;
|
||||
}
|
||||
isc__tls_setfatalmode();
|
||||
digexit();
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ make_server(const char *servname, const char *userarg) {
|
||||
strlcpy(srv->servername, servname, MXNAME);
|
||||
strlcpy(srv->userarg, userarg, MXNAME);
|
||||
ISC_LINK_INIT(srv, link);
|
||||
return srv;
|
||||
return (srv);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -608,7 +608,6 @@ make_empty_lookup(void) {
|
||||
.idnout = idnout,
|
||||
.udpsize = -1,
|
||||
.edns = -1,
|
||||
.original_edns = -1,
|
||||
.recurse = true,
|
||||
.retries = tries,
|
||||
.comments = true,
|
||||
@@ -634,7 +633,7 @@ make_empty_lookup(void) {
|
||||
debug("make_empty_lookup() = %p->references = %" PRIuFAST32, looknew,
|
||||
isc_refcount_current(&looknew->references));
|
||||
|
||||
return looknew;
|
||||
return (looknew);
|
||||
}
|
||||
|
||||
#define EDNSOPT_OPTIONS 100U
|
||||
@@ -742,7 +741,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
}
|
||||
|
||||
looknew->showbadcookie = lookold->showbadcookie;
|
||||
looknew->showbadvers = lookold->showbadvers;
|
||||
looknew->sendcookie = lookold->sendcookie;
|
||||
looknew->seenbadcookie = lookold->seenbadcookie;
|
||||
looknew->badcookie = lookold->badcookie;
|
||||
@@ -768,7 +766,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
looknew->idnout = lookold->idnout;
|
||||
looknew->udpsize = lookold->udpsize;
|
||||
looknew->edns = lookold->edns;
|
||||
looknew->original_edns = lookold->original_edns;
|
||||
looknew->recurse = lookold->recurse;
|
||||
looknew->aaonly = lookold->aaonly;
|
||||
looknew->adflag = lookold->adflag;
|
||||
@@ -797,11 +794,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
looknew->rrcomments = lookold->rrcomments;
|
||||
looknew->fuzzing = lookold->fuzzing;
|
||||
looknew->fuzztime = lookold->fuzztime;
|
||||
looknew->proxy_mode = lookold->proxy_mode;
|
||||
looknew->proxy_plain = lookold->proxy_plain;
|
||||
looknew->proxy_local = lookold->proxy_local;
|
||||
looknew->proxy_src_addr = lookold->proxy_src_addr;
|
||||
looknew->proxy_dst_addr = lookold->proxy_dst_addr;
|
||||
|
||||
if (lookold->ecs_addr != NULL) {
|
||||
looknew->ecs_addr = isc_mem_get(mctx,
|
||||
@@ -827,7 +819,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
|
||||
looknew->magic = DIG_LOOKUP_MAGIC;
|
||||
|
||||
return looknew;
|
||||
return (looknew);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -857,7 +849,7 @@ requeue_lookup(dig_lookup_t *lookold, bool servers) {
|
||||
ISC_LIST_PREPEND(lookup_list, looknew, link);
|
||||
debug("after insertion, init -> %p, new = %p, new -> %p", lookold,
|
||||
looknew, looknew->link.next);
|
||||
return looknew;
|
||||
return (looknew);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -882,7 +874,7 @@ setup_text_key(void) {
|
||||
|
||||
secretsize = isc_buffer_usedlength(&secretbuf);
|
||||
|
||||
if (hmac_alg == DST_ALG_UNKNOWN) {
|
||||
if (hmacname == NULL) {
|
||||
result = DST_R_UNSUPPORTEDALG;
|
||||
goto failure;
|
||||
}
|
||||
@@ -892,8 +884,9 @@ setup_text_key(void) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
result = dns_tsigkey_create(&keyname, hmac_alg, secretstore,
|
||||
(int)secretsize, mctx, &tsigkey);
|
||||
result = dns_tsigkey_create(&keyname, hmacname, secretstore,
|
||||
(int)secretsize, false, false, NULL, 0, 0,
|
||||
mctx, NULL, &tsigkey);
|
||||
failure:
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf(";; Couldn't create key %s: %s\n", keynametext,
|
||||
@@ -918,20 +911,20 @@ parse_uint_helper(uint32_t *uip, const char *value, uint32_t max,
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("invalid %s '%s': %s\n", desc, value,
|
||||
isc_result_totext(result));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
*uip = n;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
|
||||
return parse_uint_helper(uip, value, max, desc, 10);
|
||||
return (parse_uint_helper(uip, value, max, desc, 10));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
|
||||
return parse_uint_helper(uip, value, max, desc, 0);
|
||||
return (parse_uint_helper(uip, value, max, desc, 0));
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
@@ -944,7 +937,7 @@ parse_bits(char *arg, const char *desc, uint32_t max) {
|
||||
fatal("couldn't parse digest bits");
|
||||
}
|
||||
tmp = (tmp + 7) & ~0x7U;
|
||||
return tmp;
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -1022,57 +1015,57 @@ done:
|
||||
sa->length = prefix_length;
|
||||
*sap = sa;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse HMAC algorithm specification
|
||||
*/
|
||||
void
|
||||
parse_hmac(const char *algname) {
|
||||
parse_hmac(const char *hmac) {
|
||||
char buf[20];
|
||||
size_t len;
|
||||
|
||||
REQUIRE(algname != NULL);
|
||||
REQUIRE(hmac != NULL);
|
||||
|
||||
len = strlen(algname);
|
||||
len = strlen(hmac);
|
||||
if (len >= sizeof(buf)) {
|
||||
fatal("unknown key type '%.*s'", (int)len, algname);
|
||||
fatal("unknown key type '%.*s'", (int)len, hmac);
|
||||
}
|
||||
strlcpy(buf, algname, sizeof(buf));
|
||||
strlcpy(buf, hmac, sizeof(buf));
|
||||
|
||||
digestbits = 0;
|
||||
|
||||
if (strcasecmp(buf, "hmac-md5") == 0) {
|
||||
hmac_alg = DST_ALG_HMACMD5;
|
||||
hmacname = DNS_TSIG_HMACMD5_NAME;
|
||||
} else if (strncasecmp(buf, "hmac-md5-", 9) == 0) {
|
||||
hmac_alg = DST_ALG_HMACMD5;
|
||||
hmacname = DNS_TSIG_HMACMD5_NAME;
|
||||
digestbits = parse_bits(&buf[9], "digest-bits [0..128]", 128);
|
||||
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA1;
|
||||
hmacname = DNS_TSIG_HMACSHA1_NAME;
|
||||
digestbits = 0;
|
||||
} else if (strncasecmp(buf, "hmac-sha1-", 10) == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA1;
|
||||
hmacname = DNS_TSIG_HMACSHA1_NAME;
|
||||
digestbits = parse_bits(&buf[10], "digest-bits [0..160]", 160);
|
||||
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA224;
|
||||
hmacname = DNS_TSIG_HMACSHA224_NAME;
|
||||
} else if (strncasecmp(buf, "hmac-sha224-", 12) == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA224;
|
||||
hmacname = DNS_TSIG_HMACSHA224_NAME;
|
||||
digestbits = parse_bits(&buf[12], "digest-bits [0..224]", 224);
|
||||
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA256;
|
||||
hmacname = DNS_TSIG_HMACSHA256_NAME;
|
||||
} else if (strncasecmp(buf, "hmac-sha256-", 12) == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA256;
|
||||
hmacname = DNS_TSIG_HMACSHA256_NAME;
|
||||
digestbits = parse_bits(&buf[12], "digest-bits [0..256]", 256);
|
||||
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA384;
|
||||
hmacname = DNS_TSIG_HMACSHA384_NAME;
|
||||
} else if (strncasecmp(buf, "hmac-sha384-", 12) == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA384;
|
||||
hmacname = DNS_TSIG_HMACSHA384_NAME;
|
||||
digestbits = parse_bits(&buf[12], "digest-bits [0..384]", 384);
|
||||
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA512;
|
||||
hmacname = DNS_TSIG_HMACSHA512_NAME;
|
||||
} else if (strncasecmp(buf, "hmac-sha512-", 12) == 0) {
|
||||
hmac_alg = DST_ALG_HMACSHA512;
|
||||
hmacname = DNS_TSIG_HMACSHA512_NAME;
|
||||
digestbits = parse_bits(&buf[12], "digest-bits [0..512]", 512);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
@@ -1098,7 +1091,7 @@ read_confkey(void) {
|
||||
isc_result_t result;
|
||||
|
||||
if (!isc_file_exists(keyfile)) {
|
||||
return ISC_R_FILENOTFOUND;
|
||||
return (ISC_R_FILENOTFOUND);
|
||||
}
|
||||
|
||||
result = cfg_parser_create(mctx, NULL, &pctx);
|
||||
@@ -1139,7 +1132,7 @@ cleanup:
|
||||
cfg_parser_destroy(&pctx);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1173,29 +1166,38 @@ setup_file_key(void) {
|
||||
|
||||
switch (dst_key_alg(dstkey)) {
|
||||
case DST_ALG_HMACMD5:
|
||||
hmacname = DNS_TSIG_HMACMD5_NAME;
|
||||
break;
|
||||
case DST_ALG_HMACSHA1:
|
||||
hmacname = DNS_TSIG_HMACSHA1_NAME;
|
||||
break;
|
||||
case DST_ALG_HMACSHA224:
|
||||
hmacname = DNS_TSIG_HMACSHA224_NAME;
|
||||
break;
|
||||
case DST_ALG_HMACSHA256:
|
||||
hmacname = DNS_TSIG_HMACSHA256_NAME;
|
||||
break;
|
||||
case DST_ALG_HMACSHA384:
|
||||
hmacname = DNS_TSIG_HMACSHA384_NAME;
|
||||
break;
|
||||
case DST_ALG_HMACSHA512:
|
||||
hmac_alg = dst_key_alg(dstkey);
|
||||
hmacname = DNS_TSIG_HMACSHA512_NAME;
|
||||
break;
|
||||
default:
|
||||
dst_key_attach(dstkey, &sig0key);
|
||||
dst_key_free(&dstkey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dstkey != NULL) {
|
||||
if (hmacname != NULL) {
|
||||
result = dns_tsigkey_createfromkey(
|
||||
dst_key_name(dstkey), hmac_alg, dstkey, false, false,
|
||||
NULL, 0, 0, mctx, &tsigkey);
|
||||
dst_key_name(dstkey), hmacname, dstkey, false, false,
|
||||
NULL, 0, 0, mctx, NULL, &tsigkey);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf(";; Couldn't create key %s: %s\n", keynametext,
|
||||
isc_result_totext(result));
|
||||
goto failure;
|
||||
}
|
||||
} else {
|
||||
dst_key_attach(dstkey, &sig0key);
|
||||
dst_key_free(&dstkey);
|
||||
}
|
||||
|
||||
failure:
|
||||
if (dstkey != NULL) {
|
||||
dst_key_free(&dstkey);
|
||||
@@ -1209,7 +1211,7 @@ make_searchlist_entry(char *domain) {
|
||||
strlcpy(search->origin, domain, MXNAME);
|
||||
search->origin[MXNAME - 1] = 0;
|
||||
ISC_LINK_INIT(search, link);
|
||||
return search;
|
||||
return (search);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1391,7 +1393,6 @@ typedef struct dig_ednsoptname {
|
||||
|
||||
dig_ednsoptname_t optnames[] = {
|
||||
{ 1, "LLQ" }, /* draft-sekar-dns-llq */
|
||||
{ 2, "UL" }, /* draft-ietf-dnssd-update-lease */
|
||||
{ 3, "NSID" }, /* RFC 5001 */
|
||||
{ 5, "DAU" }, /* RFC 6975 */
|
||||
{ 6, "DHU" }, /* RFC 6975 */
|
||||
@@ -1553,13 +1554,13 @@ check_if_queries_done(dig_lookup_t *l, dig_query_t *except_q) {
|
||||
if (!q->started || isc_refcount_current(&q->references) > 1) {
|
||||
if (!q->canceled && q != except_q) {
|
||||
debug("there is a pending query %p", q);
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
q = ISC_LIST_NEXT(q, link);
|
||||
}
|
||||
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1869,7 +1870,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
|
||||
result = dns_message_findtype(name, dns_rdatatype_soa,
|
||||
0, &rdataset);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
rdataset = NULL;
|
||||
@@ -1948,7 +1949,6 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
|
||||
}
|
||||
domain = dns_fixedname_name(&lookup->fdomain);
|
||||
dns_name_copy(name, domain);
|
||||
lookup->edns = lookup->original_edns;
|
||||
}
|
||||
debug("adding server %s", namestr);
|
||||
num = getaddresses(lookup, namestr, &lresult);
|
||||
@@ -1973,7 +1973,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
|
||||
if (lookup == NULL && section == DNS_SECTION_ANSWER &&
|
||||
(query->lookup->trace || query->lookup->ns_search_only))
|
||||
{
|
||||
return followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
|
||||
return (followup_lookup(msg, query, DNS_SECTION_AUTHORITY));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2005,7 +2005,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
|
||||
link);
|
||||
}
|
||||
|
||||
return numLookups;
|
||||
return (numLookups);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2032,26 +2032,26 @@ next_origin(dig_lookup_t *oldlookup) {
|
||||
* We're not using a search list, so don't even think
|
||||
* about finding the next entry.
|
||||
*/
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a absolute name or ndots being met.
|
||||
*/
|
||||
name = dns_fixedname_initname(&fixed);
|
||||
result = dns_name_fromstring(name, oldlookup->textname, NULL, 0, NULL);
|
||||
result = dns_name_fromstring2(name, oldlookup->textname, NULL, 0, NULL);
|
||||
if (result == ISC_R_SUCCESS &&
|
||||
(dns_name_isabsolute(name) ||
|
||||
(int)dns_name_countlabels(name) > ndots))
|
||||
{
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (oldlookup->origin == NULL && !oldlookup->need_search) {
|
||||
/*
|
||||
* Then we just did rootorg; there's nothing left.
|
||||
*/
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
if (oldlookup->origin == NULL && oldlookup->need_search) {
|
||||
newlookup = requeue_lookup(oldlookup, true);
|
||||
@@ -2060,13 +2060,13 @@ next_origin(dig_lookup_t *oldlookup) {
|
||||
} else {
|
||||
search = ISC_LIST_NEXT(oldlookup->origin, link);
|
||||
if (search == NULL && oldlookup->done_as_is) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
newlookup = requeue_lookup(oldlookup, true);
|
||||
newlookup->origin = search;
|
||||
}
|
||||
cancel_lookup(oldlookup);
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2169,7 +2169,7 @@ _new_query(dig_lookup_t *lookup, char *servname, char *userarg,
|
||||
ISC_LINK_INIT(query, link);
|
||||
|
||||
query->magic = DIG_QUERY_MAGIC;
|
||||
return query;
|
||||
return (query);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2202,8 +2202,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
|
||||
debug("setup_lookup(%p)", lookup);
|
||||
|
||||
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTRENDER,
|
||||
&lookup->sendmsg);
|
||||
dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &lookup->sendmsg);
|
||||
|
||||
if (lookup->new_search) {
|
||||
debug("resetting lookup counter.");
|
||||
@@ -2303,7 +2302,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
dns_message_puttempname(lookup->sendmsg,
|
||||
&lookup->oname);
|
||||
if (result == DNS_R_NAMETOOLONG) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
fatal("'%s' is not in legal name syntax (%s)",
|
||||
lookup->textname,
|
||||
@@ -2330,7 +2329,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
isc_result_totext(result));
|
||||
#if TARGET_OS_IPHONE
|
||||
clear_current_lookup();
|
||||
return false;
|
||||
return (false);
|
||||
#else /* if TARGET_OS_IPHONE */
|
||||
cleanup_openssl_refs();
|
||||
digexit();
|
||||
@@ -2474,8 +2473,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
lookup->udpsize = DEFAULT_EDNS_BUFSIZE;
|
||||
}
|
||||
if (lookup->edns < 0) {
|
||||
lookup->original_edns = lookup->edns =
|
||||
DEFAULT_EDNS_VERSION;
|
||||
lookup->edns = DEFAULT_EDNS_VERSION;
|
||||
}
|
||||
|
||||
if (lookup->nsid) {
|
||||
@@ -2664,7 +2662,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
ISC_LIST_ENQUEUE(lookup->q, query, link);
|
||||
}
|
||||
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2791,12 +2789,6 @@ _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
|
||||
check_if_done();
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
get_tls_sni_hostname(dig_query_t *query) {
|
||||
return query->lookup->tls_hostname_set ? query->lookup->tls_hostname
|
||||
: query->userarg;
|
||||
}
|
||||
|
||||
static isc_tlsctx_t *
|
||||
get_create_tls_context(dig_query_t *query, const bool is_https,
|
||||
isc_tlsctx_client_session_cache_t **psess_cache) {
|
||||
@@ -2815,7 +2807,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
|
||||
|
||||
if (query->lookup->tls_key_file_set != query->lookup->tls_cert_file_set)
|
||||
{
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
isc_sockaddr_format(&query->sockaddr, tlsctxname, sizeof(tlsctxname));
|
||||
@@ -2843,7 +2835,10 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
|
||||
}
|
||||
|
||||
if (store != NULL) {
|
||||
const char *hostname = get_tls_sni_hostname(query);
|
||||
const char *hostname =
|
||||
query->lookup->tls_hostname_set
|
||||
? query->lookup->tls_hostname
|
||||
: query->userarg;
|
||||
/*
|
||||
* According to RFC 8310, Subject field MUST NOT be
|
||||
* inspected when verifying hostname for DoT. Only
|
||||
@@ -2891,7 +2886,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
|
||||
INSIST(*psess_cache == NULL);
|
||||
*psess_cache = sess_cache;
|
||||
}
|
||||
return ctx;
|
||||
return (ctx);
|
||||
}
|
||||
|
||||
if (psess_cache != NULL) {
|
||||
@@ -2900,7 +2895,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
|
||||
}
|
||||
|
||||
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
|
||||
return found_ctx;
|
||||
return (found_ctx);
|
||||
failure:
|
||||
if (ctx != NULL) {
|
||||
isc_tlsctx_free(&ctx);
|
||||
@@ -2915,7 +2910,7 @@ failure:
|
||||
if (store != NULL && store != found_store) {
|
||||
isc_tls_cert_store_free(&store);
|
||||
}
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2935,9 +2930,6 @@ start_tcp(dig_query_t *query) {
|
||||
bool tls_mode = false;
|
||||
isc_tlsctx_client_session_cache_t *sess_cache = NULL;
|
||||
int local_timeout;
|
||||
isc_nm_proxy_type_t proxy_type = ISC_NM_PROXY_NONE;
|
||||
isc_nm_proxyheader_info_t proxy_info = { 0 };
|
||||
isc_nm_proxyheader_info_t *ppi = NULL;
|
||||
|
||||
REQUIRE(DIG_VALID_QUERY(query));
|
||||
|
||||
@@ -3029,22 +3021,6 @@ start_tcp(dig_query_t *query) {
|
||||
}
|
||||
}
|
||||
|
||||
if (query->lookup->proxy_mode) {
|
||||
proxy_type = ISC_NM_PROXY_PLAIN;
|
||||
if ((tls_mode || (query->lookup->https_mode &&
|
||||
!query->lookup->http_plain)) &&
|
||||
!query->lookup->proxy_plain)
|
||||
{
|
||||
proxy_type = ISC_NM_PROXY_ENCRYPTED;
|
||||
}
|
||||
if (!query->lookup->proxy_local) {
|
||||
isc_nm_proxyheader_info_init(
|
||||
&proxy_info, &query->lookup->proxy_src_addr,
|
||||
&query->lookup->proxy_dst_addr, NULL);
|
||||
ppi = &proxy_info;
|
||||
}
|
||||
}
|
||||
|
||||
REQUIRE(query != NULL);
|
||||
|
||||
query_attach(query, &connectquery);
|
||||
@@ -3057,9 +3033,7 @@ start_tcp(dig_query_t *query) {
|
||||
}
|
||||
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
|
||||
tcp_connected, connectquery,
|
||||
local_timeout, tlsctx,
|
||||
get_tls_sni_hostname(query), sess_cache,
|
||||
proxy_type, ppi);
|
||||
local_timeout, tlsctx, sess_cache);
|
||||
#if HAVE_LIBNGHTTP2
|
||||
} else if (query->lookup->https_mode) {
|
||||
char uri[4096] = { 0 };
|
||||
@@ -3078,15 +3052,13 @@ start_tcp(dig_query_t *query) {
|
||||
|
||||
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr, uri,
|
||||
!query->lookup->https_get, tcp_connected,
|
||||
connectquery, tlsctx,
|
||||
get_tls_sni_hostname(query), sess_cache,
|
||||
local_timeout, proxy_type, ppi);
|
||||
connectquery, tlsctx, sess_cache,
|
||||
local_timeout);
|
||||
#endif
|
||||
} else {
|
||||
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
|
||||
tcp_connected, connectquery,
|
||||
local_timeout, NULL, NULL, NULL,
|
||||
proxy_type, ppi);
|
||||
local_timeout, NULL, NULL);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -3242,7 +3214,6 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
start_udp(next);
|
||||
check_if_done();
|
||||
} else {
|
||||
dighost_error("no servers could be reached");
|
||||
clear_current_lookup();
|
||||
}
|
||||
|
||||
@@ -3299,10 +3270,6 @@ start_udp(dig_query_t *query) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!port_set) {
|
||||
port = 53;
|
||||
}
|
||||
|
||||
result = get_address(query->servname, port, &query->sockaddr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* This servname doesn't have an address. */
|
||||
@@ -3340,24 +3307,9 @@ start_udp(dig_query_t *query) {
|
||||
}
|
||||
|
||||
query_attach(query, &connectquery);
|
||||
if (query->lookup->proxy_mode) {
|
||||
isc_nm_proxyheader_info_t proxy_info = { 0 };
|
||||
isc_nm_proxyheader_info_t *ppi = NULL;
|
||||
if (!query->lookup->proxy_local) {
|
||||
isc_nm_proxyheader_info_init(
|
||||
&proxy_info, &query->lookup->proxy_src_addr,
|
||||
&query->lookup->proxy_dst_addr, NULL);
|
||||
ppi = &proxy_info;
|
||||
}
|
||||
isc_nm_proxyudpconnect(netmgr, &localaddr, &query->sockaddr,
|
||||
udp_ready, connectquery,
|
||||
(timeout ? timeout : UDP_TIMEOUT) * 1000,
|
||||
ppi);
|
||||
} else {
|
||||
isc_nm_udpconnect(netmgr, &localaddr, &query->sockaddr,
|
||||
udp_ready, connectquery,
|
||||
(timeout ? timeout : UDP_TIMEOUT) * 1000);
|
||||
}
|
||||
isc_nm_udpconnect(netmgr, &localaddr, &query->sockaddr, udp_ready,
|
||||
connectquery,
|
||||
(timeout ? timeout : UDP_TIMEOUT) * 1000);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -3371,12 +3323,12 @@ try_next_server(dig_lookup_t *lookup) {
|
||||
|
||||
current_query = lookup->current_query;
|
||||
if (current_query == NULL || !ISC_LINK_LINKED(current_query, link)) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
next_query = ISC_LIST_NEXT(current_query, link);
|
||||
if (next_query == NULL) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
debug("trying next server...");
|
||||
@@ -3387,7 +3339,7 @@ try_next_server(dig_lookup_t *lookup) {
|
||||
start_udp(next_query);
|
||||
}
|
||||
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3438,10 +3390,10 @@ force_next(dig_query_t *query) {
|
||||
isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr);
|
||||
isc_netaddr_format(&netaddr, buf, sizeof(buf));
|
||||
|
||||
dighost_error("no response from %s", buf);
|
||||
dighost_error("no response from %s\n", buf);
|
||||
} else {
|
||||
printf("%s", l->cmdline);
|
||||
dighost_error("no servers could be reached");
|
||||
dighost_error("no servers could be reached\n");
|
||||
}
|
||||
|
||||
if (exitcode < 9) {
|
||||
@@ -3581,12 +3533,6 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
debug("tcp_connected(%p, %s, %p)", handle, isc_result_totext(eresult),
|
||||
query);
|
||||
|
||||
if (eresult == ISC_R_SHUTTINGDOWN) {
|
||||
query_detach(&query);
|
||||
cancel_all();
|
||||
return;
|
||||
}
|
||||
|
||||
lookup_attach(query->lookup, &l);
|
||||
|
||||
if (eresult == ISC_R_CANCELED || eresult == ISC_R_TLSBADPEERCERT ||
|
||||
@@ -3665,7 +3611,6 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
start_tcp(next);
|
||||
check_if_done();
|
||||
} else {
|
||||
dighost_error("no servers could be reached");
|
||||
clear_current_lookup();
|
||||
}
|
||||
|
||||
@@ -3726,7 +3671,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
|
||||
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
puts("; Transfer failed.");
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
do {
|
||||
dns_name_t *name;
|
||||
@@ -3752,7 +3697,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
|
||||
{
|
||||
puts("; Transfer failed. "
|
||||
"Didn't start with SOA answer.");
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
if ((!query->second_rr_rcvd) &&
|
||||
(rdata.type != dns_rdatatype_soa))
|
||||
@@ -3832,10 +3777,10 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
|
||||
isc_nmhandle_detach(&query->readhandle);
|
||||
launch_next_query(query);
|
||||
query_detach(&query);
|
||||
return false;
|
||||
return (false);
|
||||
doexit:
|
||||
dighost_received(len, peer, query);
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3929,7 +3874,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
|
||||
|
||||
static int
|
||||
ednsvers(dns_rdataset_t *opt) {
|
||||
return (opt->ttl >> 16) & 0xff;
|
||||
return ((opt->ttl >> 16) & 0xff);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -3972,9 +3917,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
{
|
||||
debug("recv_done: cancel");
|
||||
isc_nmhandle_detach(&query->readhandle);
|
||||
if (eresult == ISC_R_SHUTTINGDOWN) {
|
||||
cancel_all();
|
||||
} else if (!query->canceled) {
|
||||
if (!query->canceled) {
|
||||
cancel_lookup(l);
|
||||
}
|
||||
query_detach(&query);
|
||||
@@ -4118,7 +4061,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
* and cancel the lookup.
|
||||
*/
|
||||
printf("%s", l->cmdline);
|
||||
dighost_error("no servers could be reached");
|
||||
dighost_error("no servers could be reached\n");
|
||||
|
||||
if (exitcode < 9) {
|
||||
exitcode = 9;
|
||||
@@ -4143,7 +4086,8 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
if (l->tcp_mode) {
|
||||
bool fail = true;
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (!query->first_soa_rcvd || query->warn_id) {
|
||||
if ((!query->first_soa_rcvd || query->warn_id))
|
||||
{
|
||||
dighost_warning("%s: ID mismatch: "
|
||||
"expected ID %u, got "
|
||||
"%u",
|
||||
@@ -4190,7 +4134,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
goto keep_query;
|
||||
}
|
||||
|
||||
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTPARSE, &msg);
|
||||
dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
|
||||
|
||||
if (tsigkey != NULL) {
|
||||
if (l->querysig == NULL) {
|
||||
@@ -4251,15 +4195,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
goto keep_query;
|
||||
}
|
||||
|
||||
if (msg->counts[DNS_SECTION_QUESTION] == 0) {
|
||||
if (l->doing_xfr) {
|
||||
if (query->msg_count == 0) {
|
||||
dighost_warning("missing question section");
|
||||
}
|
||||
} else if (!l->header_only && msg->opcode == dns_opcode_query) {
|
||||
dighost_warning("missing question section");
|
||||
}
|
||||
} else {
|
||||
if (msg->counts[DNS_SECTION_QUESTION] != 0) {
|
||||
match = true;
|
||||
for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
|
||||
result == ISC_R_SUCCESS && match;
|
||||
@@ -4319,11 +4255,6 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
if (msg->rcode == dns_rcode_badvers && msg->opt != NULL &&
|
||||
(newedns = ednsvers(msg->opt)) < l->edns && l->ednsneg)
|
||||
{
|
||||
if (l->showbadvers) {
|
||||
dighost_printmessage(query, &b, msg, true);
|
||||
dighost_received(isc_buffer_usedlength(&b), &peer,
|
||||
query);
|
||||
}
|
||||
/*
|
||||
* Add minimum EDNS version required checks here if needed.
|
||||
*/
|
||||
@@ -4381,32 +4312,29 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
if ((msg->rcode == dns_rcode_servfail && !l->servfail_stops) ||
|
||||
(check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 && l->recurse))
|
||||
{
|
||||
const char *err = (msg->rcode == dns_rcode_servfail &&
|
||||
!l->servfail_stops)
|
||||
? "SERVFAIL reply"
|
||||
: "recursion not available";
|
||||
dig_query_t *next = ISC_LIST_NEXT(query, link);
|
||||
if (l->current_query == query) {
|
||||
query_detach(&l->current_query);
|
||||
}
|
||||
if (next != NULL && (!l->ns_search_only || l->trace_root)) {
|
||||
dighost_comments(l,
|
||||
"Got %s from %s, trying next server",
|
||||
err, query->servname);
|
||||
if (next != NULL) {
|
||||
debug("sending query %p", next);
|
||||
if (l->tcp_mode) {
|
||||
start_tcp(next);
|
||||
} else {
|
||||
start_udp(next);
|
||||
}
|
||||
dighost_comments(l,
|
||||
"Got %s from %s, trying next "
|
||||
"server",
|
||||
msg->rcode == dns_rcode_servfail
|
||||
? "SERVFAIL reply"
|
||||
: "recursion not available",
|
||||
query->servname);
|
||||
if (check_if_queries_done(l, query)) {
|
||||
goto cancel_lookup;
|
||||
}
|
||||
|
||||
goto detach_query;
|
||||
} else {
|
||||
dighost_comments(l, "Got %s from %s", err,
|
||||
query->servname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4604,12 +4532,12 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
|
||||
result = isc_getaddresses(host, myport, sockaddr, 1, &count);
|
||||
isc_loopmgr_nonblocking(loopmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
INSIST(count == 1);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -4625,13 +4553,15 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
|
||||
result = isc_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
|
||||
&count);
|
||||
isc_loopmgr_nonblocking(loopmgr);
|
||||
SET_IF_NOT_NULL(resultp, result);
|
||||
if (resultp != NULL) {
|
||||
*resultp = result;
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (resultp == NULL) {
|
||||
fatal("couldn't get address for '%s': %s", host,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
@@ -4641,7 +4571,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
|
||||
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
|
||||
}
|
||||
|
||||
return count;
|
||||
return (count);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -4823,7 +4753,7 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
|
||||
}
|
||||
resetlocale(LC_ALL);
|
||||
if (res != IDN2_OK) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4831,14 +4761,14 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
|
||||
*/
|
||||
dstlen = strlen(dst);
|
||||
if (isc_buffer_length(buffer) < start + dstlen) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_subtract(buffer, srclen);
|
||||
memmove(isc_buffer_used(buffer), dst, dstlen);
|
||||
isc_buffer_add(buffer, dstlen);
|
||||
|
||||
idn2_free(dst);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -4904,8 +4834,8 @@ dig_idnsetup(dig_lookup_t *lookup, bool active) {
|
||||
bool
|
||||
dig_lookup_is_tls(const dig_lookup_t *lookup) {
|
||||
if (lookup->tls_mode || (lookup->tls_ca_set && !lookup->https_mode)) {
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
+5
-13
@@ -121,9 +121,9 @@ struct dig_lookup {
|
||||
section_answer, section_authority, section_question,
|
||||
seenbadcookie, sendcookie, servfail_stops,
|
||||
setqid, /*% use a speciied query ID */
|
||||
showbadcookie, showbadvers, stats, tcflag, tcp_keepalive,
|
||||
tcp_mode, tcp_mode_set, tls_mode, /*% connect using TLS */
|
||||
trace, /*% dig +trace */
|
||||
showbadcookie, stats, tcflag, tcp_keepalive, tcp_mode,
|
||||
tcp_mode_set, tls_mode, /*% connect using TLS */
|
||||
trace, /*% dig +trace */
|
||||
trace_root, /*% initial query for either +trace or +nssearch */
|
||||
ttlunits, use_usec, waiting_connect, zflag;
|
||||
char textname[MXNAME]; /*% Name we're going to be looking up */
|
||||
@@ -154,7 +154,6 @@ struct dig_lookup {
|
||||
int nsfound;
|
||||
int16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t original_edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
@@ -188,13 +187,6 @@ struct dig_lookup {
|
||||
char *tls_key_file;
|
||||
isc_tlsctx_cache_t *tls_ctx_cache;
|
||||
};
|
||||
struct {
|
||||
bool proxy_mode;
|
||||
bool proxy_plain;
|
||||
bool proxy_local;
|
||||
isc_sockaddr_t proxy_src_addr;
|
||||
isc_sockaddr_t proxy_dst_addr;
|
||||
};
|
||||
isc_stdtime_t fuzztime;
|
||||
};
|
||||
|
||||
@@ -267,7 +259,7 @@ extern isc_sockaddr_t localaddr;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern dst_algorithm_t hmac_alg;
|
||||
extern const dns_name_t *hmacname;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t *tsigkey;
|
||||
extern bool validated;
|
||||
@@ -349,7 +341,7 @@ isc_result_t
|
||||
parse_netprefix(isc_sockaddr_t **sap, const char *value);
|
||||
|
||||
void
|
||||
parse_hmac(const char *algname);
|
||||
parse_hmac(const char *hmacstr);
|
||||
|
||||
dig_lookup_t *
|
||||
requeue_lookup(dig_lookup_t *lookold, bool servers);
|
||||
|
||||
+18
-30
@@ -80,7 +80,6 @@ struct rtype rtypes[] = { { 1, "has address" },
|
||||
{ 25, "has key" },
|
||||
{ 28, "has IPv6 address" },
|
||||
{ 29, "location" },
|
||||
{ dns_rdatatype_https, "has HTTP service bindings" },
|
||||
{ 0, NULL } };
|
||||
|
||||
static char *
|
||||
@@ -97,7 +96,7 @@ rcode_totext(dns_rcode_t rcode) {
|
||||
} else {
|
||||
totext.consttext = rcodetext[rcode];
|
||||
}
|
||||
return totext.deconsttext;
|
||||
return (totext.deconsttext);
|
||||
}
|
||||
|
||||
noreturn static void
|
||||
@@ -133,7 +132,7 @@ show_usage(void) {
|
||||
" -W specifies how long to wait for a reply\n"
|
||||
" -4 use IPv4 query transport only\n"
|
||||
" -6 use IPv6 query transport only\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -184,7 +183,6 @@ retry:
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
isc_buffer_free(&b);
|
||||
INSIST(bufsize <= (UINT_MAX / 2));
|
||||
bufsize *= 2;
|
||||
goto retry;
|
||||
}
|
||||
@@ -223,9 +221,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
|
||||
result = dns_message_firstname(msg, sectionid);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -263,7 +261,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
print_name, false,
|
||||
no_rdata, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
#ifdef USEINITALWS
|
||||
if (first) {
|
||||
@@ -318,11 +316,11 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -342,12 +340,12 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
||||
|
||||
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_usedregion(&target, &r);
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -424,7 +422,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
: query->lookup->textname,
|
||||
msg->rcode, rcode_totext(msg->rcode));
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
@@ -458,16 +456,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
lookup->retries = tries;
|
||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||
}
|
||||
lookup = clone_lookup(query->lookup, false);
|
||||
if (lookup != NULL) {
|
||||
strlcpy(lookup->textname, namestr,
|
||||
sizeof(lookup->textname));
|
||||
lookup->rdtype = dns_rdatatype_https;
|
||||
lookup->rdtypeset = true;
|
||||
lookup->origin = NULL;
|
||||
lookup->retries = tries;
|
||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||
}
|
||||
}
|
||||
|
||||
if (!short_form) {
|
||||
@@ -528,7 +516,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
@@ -538,7 +526,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
|
||||
!short_form, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +537,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
|
||||
@@ -559,7 +547,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if ((tsig != NULL) && !short_form) {
|
||||
@@ -567,7 +555,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
|
||||
true);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!short_form) {
|
||||
@@ -585,7 +573,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
printf("%s has no %s record\n", namestr, typestr);
|
||||
}
|
||||
seen_error = force_error;
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
|
||||
@@ -666,7 +654,7 @@ pre_parse_args(int argc, char **argv) {
|
||||
break;
|
||||
case 'V':
|
||||
printf("host %s\n", PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
break;
|
||||
case 'w':
|
||||
break;
|
||||
@@ -928,5 +916,5 @@ main(int argc, char **argv) {
|
||||
cancel_all();
|
||||
destroy_libs();
|
||||
|
||||
return (seen_error == 0) ? 0 : 1;
|
||||
return ((seen_error == 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ Options
|
||||
CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
|
||||
|
||||
When no query type is specified, :program:`host` automatically selects an
|
||||
appropriate query type. By default, it looks for A, AAAA, MX, and HTTPS
|
||||
appropriate query type. By default, it looks for A, AAAA, and MX
|
||||
records. If the :option:`-C` option is given, queries are made for SOA
|
||||
records. If ``name`` is a dotted-decimal IPv4 address or
|
||||
colon-delimited IPv6 address, :program:`host` queries for PTR records.
|
||||
|
||||
+18
-19
@@ -128,7 +128,7 @@ rcode_totext(dns_rcode_t rcode) {
|
||||
} else {
|
||||
totext.consttext = rcodetext[rcode];
|
||||
}
|
||||
return totext.deconsttext;
|
||||
return (totext.deconsttext);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -189,7 +189,6 @@ printrdata(dns_rdata_t *rdata) {
|
||||
check_result(result, "dns_rdata_totext");
|
||||
}
|
||||
isc_buffer_free(&b);
|
||||
INSIST(size <= (UINT_MAX / 2));
|
||||
size *= 2;
|
||||
}
|
||||
}
|
||||
@@ -210,9 +209,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
@@ -256,10 +255,10 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -294,9 +293,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
@@ -338,10 +337,10 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -424,7 +423,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
|
||||
/* the lookup failed */
|
||||
print_error |= 1;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
@@ -478,7 +477,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
|
||||
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -537,10 +536,10 @@ testtype(char *typetext) {
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return true;
|
||||
return (true);
|
||||
} else {
|
||||
printf("unknown query type: %s\n", typetext);
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,10 +553,10 @@ testclass(char *typetext) {
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return true;
|
||||
return (true);
|
||||
} else {
|
||||
printf("unknown query class: %s\n", typetext);
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,7 +849,7 @@ usage(void) {
|
||||
"'host' using default server\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
|
||||
"'host' using 'server'\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -863,7 +862,7 @@ parse_args(int argc, char **argv) {
|
||||
if (argv[0][0] == '-') {
|
||||
if (strncasecmp(argv[0], "-ver", 4) == 0) {
|
||||
printf("nslookup %s\n", PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
} else if (argv[0][1] != 0) {
|
||||
setoption(&argv[0][1]);
|
||||
} else {
|
||||
@@ -975,5 +974,5 @@ main(int argc, char **argv) {
|
||||
cancel_all();
|
||||
destroy_libs();
|
||||
|
||||
return query_error | print_error;
|
||||
return (query_error | print_error);
|
||||
}
|
||||
|
||||
+3
-3
@@ -48,10 +48,10 @@ readline(const char *prompt) {
|
||||
line = fgets(buf, RL_MAXCMD, stdin);
|
||||
if (line == NULL) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
return (buf);
|
||||
};
|
||||
|
||||
#define add_history(line)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ dnssec-cds
|
||||
dnssec-dsfromkey
|
||||
dnssec-keyfromlabel
|
||||
dnssec-keygen
|
||||
dnssec-ksr
|
||||
dnssec-makekeyset
|
||||
dnssec-revoke
|
||||
dnssec-settime
|
||||
|
||||
@@ -2,7 +2,6 @@ include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
@@ -13,7 +12,6 @@ noinst_LTLIBRARIES = libdnssectool.la
|
||||
LDADD += \
|
||||
libdnssectool.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
@@ -23,7 +21,6 @@ bin_PROGRAMS = \
|
||||
dnssec-importkey \
|
||||
dnssec-keyfromlabel \
|
||||
dnssec-keygen \
|
||||
dnssec-ksr \
|
||||
dnssec-revoke \
|
||||
dnssec-settime \
|
||||
dnssec-signzone \
|
||||
@@ -35,16 +32,20 @@ libdnssectool_la_SOURCES = \
|
||||
|
||||
dnssec_keygen_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
|
||||
dnssec_keygen_LDADD = \
|
||||
$(LDADD) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
dnssec_signzone_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
|
||||
dnssec_signzone_LDADD = \
|
||||
$(LDADD) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
+32
-33
@@ -247,8 +247,8 @@ static void
|
||||
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
|
||||
isc_result_t result;
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, 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,
|
||||
@@ -395,7 +395,7 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
isc_buffer_putuint8(buf, 0);
|
||||
return buf;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -505,14 +505,14 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
vbprintf(1, "found matching %s %d %d %d\n",
|
||||
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
|
||||
ds.digest_type);
|
||||
return true;
|
||||
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);
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
|
||||
ki->tag, ki->algo);
|
||||
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -537,7 +537,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
|
||||
nkey = dns_rdataset_count(keyset);
|
||||
|
||||
keytable = isc_mem_cget(mctx, nkey, sizeof(keytable[0]));
|
||||
keytable = isc_mem_getx(mctx, sizeof(keytable[0]) * nkey, ISC_MEM_ZERO);
|
||||
|
||||
for (result = dns_rdataset_first(keyset), i = 0, ki = keytable;
|
||||
result == ISC_R_SUCCESS;
|
||||
@@ -575,7 +575,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
}
|
||||
}
|
||||
|
||||
return keytable;
|
||||
return (keytable);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -593,7 +593,7 @@ free_keytable(keyinfo_t **keytable_p) {
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_cput(mctx, keytable, nkey, sizeof(keytable[0]));
|
||||
isc_mem_put(mctx, keytable, sizeof(keytable[0]) * nkey);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -614,7 +614,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
|
||||
REQUIRE(keytbl != NULL);
|
||||
|
||||
algo = isc_mem_cget(mctx, nkey, sizeof(algo[0]));
|
||||
algo = isc_mem_getx(mctx, nkey * sizeof(algo[0]), ISC_MEM_ZERO);
|
||||
|
||||
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(sigset))
|
||||
@@ -681,7 +681,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
}
|
||||
}
|
||||
|
||||
return algo;
|
||||
return (algo);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -697,8 +697,8 @@ signed_loose(dns_secalg_t *algo) {
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
|
||||
return ok;
|
||||
isc_mem_put(mctx, algo, nkey * sizeof(algo[0]));
|
||||
return (ok);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -739,8 +739,8 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
|
||||
return all_ok;
|
||||
isc_mem_put(mctx, algo, nkey);
|
||||
return (all_ok);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -761,10 +761,10 @@ ds_from_cds(isc_buffer_t *buf, dns_rdata_t *rds, dns_dsdigest_t dt,
|
||||
ds.common.rdtype = dns_rdatatype_ds;
|
||||
|
||||
if (ds.digest_type != dt) {
|
||||
return ISC_R_IGNORE;
|
||||
return (ISC_R_IGNORE);
|
||||
}
|
||||
|
||||
return dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf);
|
||||
return (dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -777,7 +777,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
|
||||
|
||||
isc_buffer_availableregion(buf, &r);
|
||||
if (r.length < DNS_DS_BUFFERSIZE) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
|
||||
result = dns_ds_buildrdata(name, cdnskey, dt, r.base, ds);
|
||||
@@ -785,7 +785,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
|
||||
isc_buffer_add(buf, DNS_DS_BUFFERSIZE);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -816,14 +816,14 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
|
||||
continue;
|
||||
case ISC_R_NOSPACE:
|
||||
isc_mem_put(mctx, ds, sizeof(*ds));
|
||||
return result;
|
||||
return (result);
|
||||
default:
|
||||
isc_mem_put(mctx, ds, sizeof(*ds));
|
||||
check_result(result, "ds_from_rdata()");
|
||||
}
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -868,8 +868,8 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
|
||||
|
||||
static int
|
||||
rdata_cmp(const void *rdata1, const void *rdata2) {
|
||||
return dns_rdata_compare((const dns_rdata_t *)rdata1,
|
||||
(const dns_rdata_t *)rdata2);
|
||||
return (dns_rdata_compare((const dns_rdata_t *)rdata1,
|
||||
(const dns_rdata_t *)rdata2));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -894,7 +894,7 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
|
||||
n = dns_rdataset_count(dsset);
|
||||
|
||||
arrdata = isc_mem_cget(mctx, n, sizeof(dns_rdata_t));
|
||||
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
||||
|
||||
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset), i++)
|
||||
@@ -908,7 +908,7 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
/*
|
||||
* Convert sorted arrdata to more accessible format
|
||||
*/
|
||||
ds = isc_mem_cget(mctx, n, sizeof(dns_rdata_ds_t));
|
||||
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
|
||||
@@ -947,10 +947,10 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
/*
|
||||
* Done!
|
||||
*/
|
||||
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
|
||||
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
|
||||
isc_mem_put(mctx, ds, n * sizeof(dns_rdata_ds_t));
|
||||
isc_mem_put(mctx, arrdata, n * sizeof(dns_rdata_t));
|
||||
|
||||
return match;
|
||||
return (match);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -979,8 +979,8 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
|
||||
dns_rdataset_t diffset;
|
||||
uint32_t save;
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &update_db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &update_db);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_newversion(update_db, &update_version);
|
||||
@@ -1056,7 +1056,7 @@ usage(void) {
|
||||
" -T <ttl> TTL of DS records\n"
|
||||
" -V print version\n"
|
||||
" -v <verbosity>\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1354,6 +1354,5 @@ main(int argc, char *argv[]) {
|
||||
cleanup:
|
||||
print_mem_stats = true;
|
||||
cleanup();
|
||||
|
||||
return 0;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static uint32_t ttl;
|
||||
static bool emitttl = false;
|
||||
static unsigned int split_width = 0;
|
||||
|
||||
static isc_result_t
|
||||
initname(char *setname) {
|
||||
@@ -66,7 +65,7 @@ initname(char *setname) {
|
||||
isc_buffer_init(&buf, setname, strlen(setname));
|
||||
isc_buffer_add(&buf, strlen(setname));
|
||||
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -101,8 +100,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't create database");
|
||||
}
|
||||
@@ -138,7 +137,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
if (db != NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -153,7 +152,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
if (dirname != NULL) {
|
||||
/* allow room for a trailing slash */
|
||||
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putstr(&buf, dirname);
|
||||
if (dirname[strlen(dirname) - 1] != '/') {
|
||||
@@ -162,18 +161,18 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
if (isc_buffer_availablelength(&buf) < 7) {
|
||||
return ISC_R_NOSPACE;
|
||||
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) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, 0);
|
||||
|
||||
return loadset(filename, rdataset);
|
||||
return (loadset(filename, rdataset));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -275,13 +274,13 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
fatal("can't build record");
|
||||
}
|
||||
|
||||
result = dns_name_totext(name, 0, &nameb);
|
||||
result = dns_name_totext(name, false, &nameb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't print name");
|
||||
}
|
||||
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
|
||||
"", &textb);
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
|
||||
&textb);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't print rdata");
|
||||
@@ -348,14 +347,13 @@ usage(void) {
|
||||
" -f zonefile: read keys from a zone file\n"
|
||||
" -h: print help information\n"
|
||||
" -K directory: where to find key or keyset files\n"
|
||||
" -w split base64 rdata text into chunks\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(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -382,7 +380,7 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
|
||||
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
|
||||
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
|
||||
switch (ch) {
|
||||
case '1':
|
||||
@@ -434,9 +432,6 @@ main(int argc, char **argv) {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'w':
|
||||
split_width = UINT_MAX;
|
||||
break;
|
||||
case 'F':
|
||||
/* Reserved for FIPS mode */
|
||||
FALLTHROUGH;
|
||||
@@ -457,7 +452,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,8 +553,8 @@ main(int argc, char **argv) {
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "write error\n");
|
||||
return 1;
|
||||
return (1);
|
||||
} else {
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ initname(char *setname) {
|
||||
isc_buffer_init(&buf, setname, strlen(setname));
|
||||
isc_buffer_add(&buf, strlen(setname));
|
||||
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -103,8 +103,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't create database");
|
||||
}
|
||||
@@ -141,7 +141,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
if (db != NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -289,7 +289,7 @@ usage(void) {
|
||||
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -395,7 +395,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,8 +468,8 @@ main(int argc, char **argv) {
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "write error\n");
|
||||
return 1;
|
||||
return (1);
|
||||
} else {
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
|
||||
const char *program = "dnssec-keyfromlabel";
|
||||
|
||||
static uint16_t tag_min = 0, tag_max = 0xffff;
|
||||
|
||||
noreturn static void
|
||||
usage(void);
|
||||
|
||||
@@ -72,7 +70,6 @@ usage(void) {
|
||||
"key files\n");
|
||||
fprintf(stderr, " -k: generate a TYPE=KEY key\n");
|
||||
fprintf(stderr, " -L ttl: default key TTL\n");
|
||||
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
|
||||
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | "
|
||||
"OTHER\n");
|
||||
fprintf(stderr, " (DNSKEY generation defaults to ZONE\n");
|
||||
@@ -105,7 +102,7 @@ usage(void) {
|
||||
fprintf(stderr, " K<name>+<alg>+<id>.key, "
|
||||
"K<name>+<alg>+<id>.private\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -163,7 +160,7 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:M:n:P:p:R:S:t:v:Vy"
|
||||
#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) {
|
||||
case '3':
|
||||
@@ -210,20 +207,6 @@ main(int argc, char **argv) {
|
||||
case 'l':
|
||||
label = isc_mem_strdup(mctx, isc_commandline_argument);
|
||||
break;
|
||||
case 'M': {
|
||||
unsigned long ul;
|
||||
tag_min = ul = strtoul(isc_commandline_argument, &endp,
|
||||
10);
|
||||
if (*endp != ':' || ul > 0xffff) {
|
||||
fatal("-M range invalid");
|
||||
}
|
||||
tag_max = ul = strtoul(endp + 1, &endp, 10);
|
||||
if (*endp != '\0' || ul > 0xffff || tag_max <= tag_min)
|
||||
{
|
||||
fatal("-M range invalid");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'n':
|
||||
nametype = isc_commandline_argument;
|
||||
break;
|
||||
@@ -348,7 +331,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +606,7 @@ main(int argc, char **argv) {
|
||||
fatal("failed to get key %s/%s: %s", namestr, algstr,
|
||||
isc_result_totext(ret));
|
||||
UNREACHABLE();
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -703,8 +686,7 @@ main(int argc, char **argv) {
|
||||
* is a risk of ID collision due to this key or another key
|
||||
* being revoked.
|
||||
*/
|
||||
if (key_collision(key, name, directory, mctx, tag_min, tag_max, &exact))
|
||||
{
|
||||
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) {
|
||||
@@ -761,5 +743,5 @@ main(int argc, char **argv) {
|
||||
free(freeit);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ dnssec-keyfromlabel - DNSSEC key generation tool
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-M** tag_min:tag_max] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
|
||||
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
@@ -133,18 +133,6 @@ Options
|
||||
place, in which case the existing TTL would take precedence. Setting
|
||||
the default TTL to ``0`` or ``none`` removes it.
|
||||
|
||||
.. option:: -M tag_min:tag_max
|
||||
|
||||
This option sets the range of key tag values
|
||||
that ``dnssec-keyfromlabel`` will accept. If the key tag of the new
|
||||
key or the key tag of the revoked version of the new key is
|
||||
outside this range, the new key will be rejected. This is
|
||||
designed to be used when generating keys in a multi-signer
|
||||
scenario, where each operator is given a range of key tags to
|
||||
prevent collisions among different operators. The valid
|
||||
values for ``tag_min`` and ``tag_max`` are [0..65535]. The
|
||||
default allows all key tag values to be accepted.
|
||||
|
||||
.. option:: -p protocol
|
||||
|
||||
This option sets the protocol value for the key. The protocol is a number between
|
||||
|
||||
+86
-94
@@ -56,13 +56,19 @@
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <isccfg/cfg.h>
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/kaspconf.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
#define MAX_RSA 4096 /* should be long enough... */
|
||||
#define MAX_DH 4096 /* should be long enough... */
|
||||
|
||||
const char *program = "dnssec-keygen";
|
||||
|
||||
/*
|
||||
@@ -85,22 +91,18 @@ struct keygen_ctx {
|
||||
const char *policy;
|
||||
const char *configfile;
|
||||
const char *directory;
|
||||
dns_keystore_t *keystore;
|
||||
char *algname;
|
||||
char *nametype;
|
||||
char *type;
|
||||
int protocol;
|
||||
int size;
|
||||
uint16_t tag_min;
|
||||
uint16_t tag_max;
|
||||
int signatory;
|
||||
dns_rdataclass_t rdclass;
|
||||
int options;
|
||||
int dbits;
|
||||
dns_ttl_t ttl;
|
||||
bool wantzsk;
|
||||
bool wantksk;
|
||||
bool wantrev;
|
||||
uint16_t kskflag;
|
||||
uint16_t revflag;
|
||||
dns_secalg_t alg;
|
||||
/* timing data */
|
||||
int prepub;
|
||||
@@ -180,10 +182,9 @@ usage(void) {
|
||||
fprintf(stderr, " -d <digest bits> (0 => max, default)\n");
|
||||
fprintf(stderr, " -E <engine>:\n");
|
||||
fprintf(stderr, " name of an OpenSSL engine to use\n");
|
||||
fprintf(stderr, " -f <keyflag>: ZSK | KSK | REVOKE\n");
|
||||
fprintf(stderr, " -f <keyflag>: KSK | REVOKE\n");
|
||||
fprintf(stderr, " -F: FIPS mode\n");
|
||||
fprintf(stderr, " -L <ttl>: default key TTL\n");
|
||||
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
|
||||
fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n");
|
||||
fprintf(stderr, " -s <strength>: strength value this key signs DNS "
|
||||
"records with (default: 0)\n");
|
||||
@@ -194,7 +195,7 @@ usage(void) {
|
||||
"(default: AUTHCONF)\n");
|
||||
fprintf(stderr, " -h: print usage and exit\n");
|
||||
fprintf(stderr, " -m <memory debugging mode>:\n");
|
||||
fprintf(stderr, " usage | trace | record\n");
|
||||
fprintf(stderr, " usage | trace | record | size | mctx\n");
|
||||
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
fprintf(stderr, "Timing options:\n");
|
||||
@@ -224,7 +225,7 @@ usage(void) {
|
||||
fprintf(stderr, " K<name>+<alg>+<id>.key, "
|
||||
"K<name>+<alg>+<id>.private\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -251,6 +252,53 @@ progress(int p) {
|
||||
(void)fflush(stderr);
|
||||
}
|
||||
|
||||
static void
|
||||
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
|
||||
dns_kasp_t **kaspp) {
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *kasps = NULL;
|
||||
dns_kasp_t *kasp = NULL, *kasp_next;
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
dns_kasplist_t kasplist;
|
||||
|
||||
ISC_LIST_INIT(kasplist);
|
||||
|
||||
(void)cfg_map_get(config, "dnssec-policy", &kasps);
|
||||
for (element = cfg_list_first(kasps); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
cfg_obj_t *kconfig = cfg_listelt_value(element);
|
||||
kasp = NULL;
|
||||
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
|
||||
name) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result = cfg_kasp_fromconfig(kconfig, NULL, true, mctx, lctx,
|
||||
&kasplist, &kasp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to configure dnssec-policy '%s': %s",
|
||||
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
|
||||
isc_result_totext(result));
|
||||
}
|
||||
INSIST(kasp != NULL);
|
||||
dns_kasp_freeze(kasp);
|
||||
break;
|
||||
}
|
||||
|
||||
*kaspp = kasp;
|
||||
|
||||
/*
|
||||
* Cleanup kasp list.
|
||||
*/
|
||||
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
|
||||
kasp_next = ISC_LIST_NEXT(kasp, link);
|
||||
ISC_LIST_UNLINK(kasplist, kasp, link);
|
||||
dns_kasp_detach(&kasp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
char filename[255];
|
||||
@@ -558,12 +606,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
flags |= ctx->signatory;
|
||||
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
|
||||
if (ctx->ksk || ctx->wantksk) {
|
||||
flags |= DNS_KEYFLAG_KSK;
|
||||
}
|
||||
if (ctx->wantrev) {
|
||||
flags |= DNS_KEYFLAG_REVOKE;
|
||||
}
|
||||
flags |= ctx->kskflag;
|
||||
flags |= ctx->revflag;
|
||||
}
|
||||
|
||||
if (ctx->protocol == -1) {
|
||||
@@ -610,27 +654,16 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
|
||||
if (!ctx->quiet && show_progress) {
|
||||
fprintf(stderr, "Generating key pair.");
|
||||
}
|
||||
|
||||
if (ctx->keystore != NULL && ctx->policy != NULL) {
|
||||
ret = dns_keystore_keygen(
|
||||
ctx->keystore, name, ctx->policy, ctx->rdclass,
|
||||
mctx, ctx->alg, ctx->size, flags, &key);
|
||||
} else if (!ctx->quiet && show_progress) {
|
||||
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
|
||||
flags, ctx->protocol,
|
||||
ctx->rdclass, NULL, mctx, &key,
|
||||
ctx->rdclass, mctx, &key,
|
||||
&progress);
|
||||
putc('\n', stderr);
|
||||
fflush(stderr);
|
||||
} else {
|
||||
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
|
||||
flags, ctx->protocol,
|
||||
ctx->rdclass, NULL, mctx, &key,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!ctx->quiet && show_progress) {
|
||||
putc('\n', stderr);
|
||||
fflush(stderr);
|
||||
ctx->rdclass, mctx, &key, NULL);
|
||||
}
|
||||
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
@@ -686,7 +719,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (ctx->setrev) {
|
||||
if (!ctx->wantksk) {
|
||||
if (ctx->kskflag == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is "
|
||||
"not flagged as a KSK, but -R "
|
||||
@@ -761,9 +794,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
* if there is a risk of ID collision due to this key
|
||||
* or another key being revoked.
|
||||
*/
|
||||
if (key_collision(key, name, ctx->directory, mctx, ctx->tag_min,
|
||||
ctx->tag_max, NULL))
|
||||
{
|
||||
if (key_collision(key, name, ctx->directory, mctx, NULL)) {
|
||||
conflict = true;
|
||||
if (null_key) {
|
||||
dst_key_free(&key);
|
||||
@@ -828,18 +859,6 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_keystore_options(keygen_ctx_t *ctx) {
|
||||
ctx->directory = dns_keystore_directory(ctx->keystore, NULL);
|
||||
if (ctx->directory != NULL) {
|
||||
isc_result_t ret = try_dir(ctx->directory);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("cannot open directory %s: %s", ctx->directory,
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *algname = NULL, *freeit = NULL;
|
||||
@@ -873,8 +892,8 @@ main(int argc, char **argv) {
|
||||
/*
|
||||
* Process memory debugging argument first.
|
||||
*/
|
||||
#define CMDLINE_FLAGS \
|
||||
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:M:m:n:P:p:qR:r:S:s:" \
|
||||
#define CMDLINE_FLAGS \
|
||||
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:m:n:P:p:qR:r:S:s:" \
|
||||
"T:t:v:V"
|
||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (ch) {
|
||||
@@ -932,11 +951,9 @@ main(int argc, char **argv) {
|
||||
case 'f':
|
||||
c = (unsigned char)(isc_commandline_argument[0]);
|
||||
if (toupper(c) == 'K') {
|
||||
ctx.wantksk = true;
|
||||
} else if (toupper(c) == 'Z') {
|
||||
ctx.wantzsk = true;
|
||||
ctx.kskflag = DNS_KEYFLAG_KSK;
|
||||
} else if (toupper(c) == 'R') {
|
||||
ctx.wantrev = true;
|
||||
ctx.revflag = DNS_KEYFLAG_REVOKE;
|
||||
} else {
|
||||
fatal("unknown flag '%s'",
|
||||
isc_commandline_argument);
|
||||
@@ -963,21 +980,6 @@ main(int argc, char **argv) {
|
||||
case 'n':
|
||||
ctx.nametype = isc_commandline_argument;
|
||||
break;
|
||||
case 'M': {
|
||||
unsigned long ul;
|
||||
ctx.tag_min = ul = strtoul(isc_commandline_argument,
|
||||
&endp, 10);
|
||||
if (*endp != ':' || ul > 0xffff) {
|
||||
fatal("-M range invalid");
|
||||
}
|
||||
ctx.tag_max = ul = strtoul(endp + 1, &endp, 10);
|
||||
if (*endp != '\0' || ul > 0xffff ||
|
||||
ctx.tag_max <= ctx.tag_min)
|
||||
{
|
||||
fatal("-M range invalid");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
break;
|
||||
case 'p':
|
||||
@@ -1132,7 +1134,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,13 +1146,11 @@ main(int argc, char **argv) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
@@ -1225,8 +1225,8 @@ main(int argc, char **argv) {
|
||||
if (ctx.size != -1) {
|
||||
fatal("-k and -b cannot be used together");
|
||||
}
|
||||
if (ctx.wantrev) {
|
||||
fatal("-k and -fR cannot be used together");
|
||||
if (ctx.kskflag || ctx.revflag) {
|
||||
fatal("-k and -f cannot be used together");
|
||||
}
|
||||
if (ctx.options & DST_TYPE_KEY) {
|
||||
fatal("-k and -T KEY cannot be used together");
|
||||
@@ -1241,13 +1241,12 @@ main(int argc, char **argv) {
|
||||
ctx.use_nsec3 = false;
|
||||
ctx.alg = DST_ALG_ECDSA256;
|
||||
ctx.size = 0;
|
||||
ctx.kskflag = DNS_KEYFLAG_KSK;
|
||||
ctx.ttl = 3600;
|
||||
ctx.setttl = true;
|
||||
ctx.ksk = true;
|
||||
ctx.zsk = true;
|
||||
ctx.lifetime = 0;
|
||||
ctx.tag_min = 0;
|
||||
ctx.tag_max = 0xffff;
|
||||
|
||||
keygen(&ctx, mctx, argc, argv);
|
||||
} else {
|
||||
@@ -1267,8 +1266,7 @@ main(int argc, char **argv) {
|
||||
ctx.policy, ctx.configfile);
|
||||
}
|
||||
|
||||
kasp_from_conf(config, mctx, lctx, ctx.policy,
|
||||
ctx.directory, engine, &kasp);
|
||||
kasp_from_conf(config, mctx, ctx.policy, &kasp);
|
||||
if (kasp == NULL) {
|
||||
fatal("failed to load dnssec-policy '%s'",
|
||||
ctx.policy);
|
||||
@@ -1282,28 +1280,22 @@ main(int argc, char **argv) {
|
||||
ctx.ttl = dns_kasp_dnskeyttl(kasp);
|
||||
ctx.setttl = true;
|
||||
|
||||
for (kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
|
||||
kaspkey != NULL;
|
||||
kaspkey = ISC_LIST_NEXT(kaspkey, link))
|
||||
{
|
||||
kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
|
||||
|
||||
while (kaspkey != NULL) {
|
||||
ctx.use_nsec3 = false;
|
||||
ctx.alg = dns_kasp_key_algorithm(kaspkey);
|
||||
ctx.size = dns_kasp_key_size(kaspkey);
|
||||
ctx.kskflag = dns_kasp_key_ksk(kaspkey)
|
||||
? DNS_KEYFLAG_KSK
|
||||
: 0;
|
||||
ctx.ksk = dns_kasp_key_ksk(kaspkey);
|
||||
ctx.zsk = dns_kasp_key_zsk(kaspkey);
|
||||
ctx.lifetime = dns_kasp_key_lifetime(kaspkey);
|
||||
ctx.keystore = dns_kasp_key_keystore(kaspkey);
|
||||
if (ctx.keystore != NULL) {
|
||||
check_keystore_options(&ctx);
|
||||
}
|
||||
ctx.tag_min = dns_kasp_key_tagmin(kaspkey);
|
||||
ctx.tag_max = dns_kasp_key_tagmax(kaspkey);
|
||||
if ((ctx.ksk && !ctx.wantksk && ctx.wantzsk) ||
|
||||
(ctx.zsk && !ctx.wantzsk && ctx.wantksk))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
keygen(&ctx, mctx, argc, argv);
|
||||
|
||||
kaspkey = ISC_LIST_NEXT(kaspkey, link);
|
||||
}
|
||||
|
||||
dns_kasp_detach(&kasp);
|
||||
@@ -1333,5 +1325,5 @@ main(int argc, char **argv) {
|
||||
free(freeit);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,15 @@ dnssec-keygen: DNSSEC key generation tool
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-n** nametype] [**-M** tag_min:tag_max] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
|
||||
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
|
||||
:program:`dnssec-keygen` generates keys for DNSSEC (Secure DNS), as defined in
|
||||
:rfc:`2535` and :rfc:`4034`.
|
||||
:rfc:`2535` and :rfc:`4034`. It can also generate keys for use with TSIG
|
||||
(Transaction Signatures) as defined in :rfc:`2845`, or TKEY (Transaction
|
||||
Key) as defined in :rfc:`2930`.
|
||||
|
||||
The ``name`` of the key is specified on the command line. For DNSSEC
|
||||
keys, this must match the name of the zone for which the key is being
|
||||
@@ -105,13 +107,7 @@ Options
|
||||
.. option:: -f flag
|
||||
|
||||
This option sets the specified flag in the flag field of the KEY/DNSKEY record.
|
||||
The only recognized flags are ZSK (Zone-Signing Key), KSK (Key-Signing Key)
|
||||
and REVOKE.
|
||||
|
||||
Note that ZSK is not a physical flag in the DNSKEY record, it is merely used
|
||||
to explicitly tell that you want to create a ZSK. Setting :option:`-f` in
|
||||
conjunction with :option:`-k` will result in generating keys that only
|
||||
match the given role set with this option.
|
||||
The only recognized flags are KSK (Key-Signing Key) and REVOKE.
|
||||
|
||||
.. option:: -F
|
||||
|
||||
@@ -158,19 +154,6 @@ Options
|
||||
This option provides a configuration file that contains a ``dnssec-policy`` statement
|
||||
(matching the policy set with :option:`-k`).
|
||||
|
||||
.. option:: -M tag_min:tag_max
|
||||
|
||||
This option sets the range of acceptable key tag values that ``dnssec-keygen``
|
||||
will produce. If the key tag of the new key or the key tag of
|
||||
the revoked version of the new key is outside this range,
|
||||
the new key will be rejected and another new key will be generated.
|
||||
This is designed to be used when generating keys in a multi-signer
|
||||
scenario, where each operator is given a range of key tags to
|
||||
prevent collisions among different operators. The valid values
|
||||
for ``tag_min`` and ``tag_max`` are [0..65535]. The default allows all
|
||||
key tag values to be produced. This option is ignored when ``-k policy``
|
||||
is specified.
|
||||
|
||||
.. option:: -n nametype
|
||||
|
||||
This option specifies the owner type of the key. The value of ``nametype`` must
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,172 +0,0 @@
|
||||
.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
..
|
||||
.. SPDX-License-Identifier: MPL-2.0
|
||||
..
|
||||
.. This Source Code Form is subject to the terms of the Mozilla Public
|
||||
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
..
|
||||
.. See the COPYRIGHT file distributed with this work for additional
|
||||
.. information regarding copyright ownership.
|
||||
|
||||
.. highlight: console
|
||||
|
||||
.. iscman:: dnssec-ksr
|
||||
.. program:: dnssec-ksr
|
||||
.. _man_dnssec-ksr:
|
||||
|
||||
dnssec-ksr - Create signed key response (SKR) files for offline KSK setups
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`dnssec-ksr` [**-E** engine] [**-e** date/offset] [**-F**] [**-f** file] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-o**] [**-V**] [**-v** level] {command} {zone}
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
|
||||
The :program:`dnssec-ksr` can be used to issue several commands that are needed
|
||||
to generate presigned RRsets for a zone where the private key file of the Key
|
||||
Signing Key (KSK) is typically offline. This requires Zone Signing Keys
|
||||
(ZSKs) to be pregenerated, and the DNSKEY, CDNSKEY, and CDS RRsets to be
|
||||
already signed in advance.
|
||||
|
||||
The latter is done by creating Key Signing Requests (KSRs) that can be imported
|
||||
to the environment where the KSK is available. Once there, this program can
|
||||
create Signed Key Responses (SKRs) that can be loaded by an authoritative DNS
|
||||
server.
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. option:: -E engine
|
||||
|
||||
This option specifies the cryptographic hardware to use, when applicable.
|
||||
|
||||
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
|
||||
engine identifier that drives the cryptographic accelerator or
|
||||
hardware service module (usually ``pkcs11``).
|
||||
|
||||
.. option:: -e date/offset
|
||||
|
||||
This option sets the end date for which keys or SKRs need to be generated
|
||||
(depending on the command).
|
||||
|
||||
.. option:: -F
|
||||
|
||||
This options turns on FIPS (US Federal Information Processing Standards)
|
||||
mode if the underlying crytographic library supports running in FIPS
|
||||
mode.
|
||||
|
||||
.. option:: -f
|
||||
|
||||
This option sets the SKR file to be signed when issuing a ``sign`` command.
|
||||
|
||||
.. option:: -h
|
||||
|
||||
This option prints a short summary of the options and arguments to
|
||||
:program:`dnssec-ksr`.
|
||||
|
||||
.. option:: -i date/offset
|
||||
|
||||
This option sets the start date for which keys or SKRs need to be generated
|
||||
(depending on the command).
|
||||
|
||||
.. option:: -K directory
|
||||
|
||||
This option sets the directory in which the key files are to be read or
|
||||
written (depending on the command).
|
||||
|
||||
.. option:: -k policy
|
||||
|
||||
This option sets the specific ``dnssec-policy`` for which keys need to
|
||||
be generated, or signed.
|
||||
|
||||
.. option:: -l file
|
||||
|
||||
This option provides a configuration file that contains a ``dnssec-policy``
|
||||
statement (matching the policy set with :option:`-k`).
|
||||
|
||||
.. option:: -o
|
||||
|
||||
Normally when pregenerating keys, ZSKs are created. When this option is
|
||||
set, create KSKs instead.
|
||||
|
||||
.. option:: -V
|
||||
|
||||
This option prints version information.
|
||||
|
||||
.. option:: -v level
|
||||
|
||||
This option sets the debugging level. Level 1 is intended to be usefully
|
||||
verbose for general users; higher levels are intended for developers.
|
||||
|
||||
``command``
|
||||
|
||||
The KSR command to be executed. See below for the available commands.
|
||||
|
||||
``zone``
|
||||
|
||||
The name of the zone for which the KSR command is being executed.
|
||||
|
||||
Commands
|
||||
~~~~~~~~
|
||||
|
||||
.. option:: keygen
|
||||
|
||||
Pregenerate a number of keys, given a DNSSEC policy and an interval. The
|
||||
number of generated keys depends on the interval and the key lifetime.
|
||||
|
||||
.. option:: request
|
||||
|
||||
Create a Key Signing Request (KSR), given a DNSSEC policy and an interval.
|
||||
This will generate a file with a number of key bundles, where each bundle
|
||||
contains the currently published ZSKs (according to the timing metadata).
|
||||
|
||||
.. option:: sign
|
||||
|
||||
Sign a Key Signing Request (KSR), given a DNSSEC policy and an interval,
|
||||
creating a Signed Key Response (SKR). This will add the corresponding DNSKEY,
|
||||
CDS, and CDNSKEY records for the KSK that is being used for signing.
|
||||
|
||||
Exit Status
|
||||
~~~~~~~~~~~
|
||||
|
||||
The :program:`dnssec-ksr` command exits 0 on success, or non-zero if an error
|
||||
occurred.
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
When you need to generate ZSKs for the zone "example.com" for the next year,
|
||||
given a ``dnssec-policy`` named "mypolicy":
|
||||
|
||||
::
|
||||
|
||||
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf keygen example.com
|
||||
|
||||
Creating a KSR for the same zone and period can be done with:
|
||||
|
||||
::
|
||||
|
||||
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf request example.com > ksr.txt
|
||||
|
||||
Typically you would now transfer the KSR to the system that has access to
|
||||
the KSK.
|
||||
|
||||
Signing the KSR created above can be done with:
|
||||
|
||||
::
|
||||
|
||||
dnssec-ksr -i now -e +1y -k kskpolicy -l named.conf -f ksr.txt sign example.com
|
||||
|
||||
Make sure that the DNSSEC parameters in ``kskpolicy`` match those
|
||||
in ``mypolicy``.
|
||||
|
||||
See Also
|
||||
~~~~~~~~
|
||||
|
||||
:iscman:`dnssec-keygen(8) <dnssec-keygen>`,
|
||||
:iscman:`dnssec-signzone(8) <dnssec-signzone>`,
|
||||
BIND 9 Administrator Reference Manual.
|
||||
@@ -58,7 +58,7 @@ usage(void) {
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -130,7 +130,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,5 +257,5 @@ cleanup:
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ usage(void) {
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -536,7 +536,7 @@ main(int argc, char **argv) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,5 +960,5 @@ main(int argc, char **argv) {
|
||||
isc_mem_free(mctx, directory);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ All these formats are case-insensitive.
|
||||
.. option:: -A date/offset
|
||||
|
||||
This option sets the date on which the key is to be activated. After that date,
|
||||
the key is included in the zone and used to sign it.
|
||||
the key is included in the zone and used to sign it.
|
||||
|
||||
.. option:: -R date/offset
|
||||
|
||||
|
||||
+94
-115
@@ -89,7 +89,6 @@
|
||||
|
||||
#include <dst/dst.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
@@ -106,7 +105,7 @@ static int nsec_datatype = dns_rdatatype_nsec;
|
||||
"dns_dbiterator_current()")
|
||||
|
||||
#define IS_NSEC3 (nsec_datatype == dns_rdatatype_nsec3)
|
||||
#define OPTOUT(x) (((x) & DNS_NSEC3FLAG_OPTOUT) != 0)
|
||||
#define OPTOUT(x) (((x)&DNS_NSEC3FLAG_OPTOUT) != 0)
|
||||
|
||||
#define REVOKE(x) ((dst_key_flags(x) & DNS_KEYFLAG_REVOKE) != 0)
|
||||
|
||||
@@ -140,10 +139,10 @@ static dns_masterformat_t inputformat = dns_masterformat_text;
|
||||
static dns_masterformat_t outputformat = dns_masterformat_text;
|
||||
static uint32_t rawversion = 1, serialnum = 0;
|
||||
static bool snset = false;
|
||||
static atomic_uint_fast32_t nsigned = 0, nretained = 0, ndropped = 0;
|
||||
static atomic_uint_fast32_t nverified = 0, nverifyfailed = 0;
|
||||
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
|
||||
static unsigned int nverified = 0, nverifyfailed = 0;
|
||||
static const char *directory = NULL, *dsdir = NULL;
|
||||
static isc_mutex_t namelock;
|
||||
static isc_mutex_t namelock, statslock;
|
||||
static isc_nm_t *netmgr = NULL;
|
||||
static isc_loopmgr_t *loopmgr = NULL;
|
||||
static dns_db_t *gdb; /* The database */
|
||||
@@ -182,9 +181,11 @@ static dns_ttl_t maxttl = 0;
|
||||
static bool no_max_check = false;
|
||||
static const char *sync_records = "cdnskey,cds:sha-256";
|
||||
|
||||
#define INCSTAT(counter) \
|
||||
if (printstats) { \
|
||||
atomic_fetch_add_relaxed(&counter, 1); \
|
||||
#define INCSTAT(counter) \
|
||||
if (printstats) { \
|
||||
LOCK(&statslock); \
|
||||
counter++; \
|
||||
UNLOCK(&statslock); \
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -197,7 +198,7 @@ savezonecut(dns_fixedname_t *fzonecut, dns_name_t *name) {
|
||||
result = dns_fixedname_initname(fzonecut);
|
||||
dns_name_copy(name, result);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -326,28 +327,28 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
|
||||
|
||||
static bool
|
||||
issigningkey(dns_dnsseckey_t *key) {
|
||||
return key->force_sign || key->hint_sign;
|
||||
return (key->force_sign || key->hint_sign);
|
||||
}
|
||||
|
||||
static bool
|
||||
ispublishedkey(dns_dnsseckey_t *key) {
|
||||
return (key->force_publish || key->hint_publish) && !key->hint_remove;
|
||||
return ((key->force_publish || key->hint_publish) && !key->hint_remove);
|
||||
}
|
||||
|
||||
static bool
|
||||
iszonekey(dns_dnsseckey_t *key) {
|
||||
return dns_name_equal(dst_key_name(key->key), gorigin) &&
|
||||
dst_key_iszonekey(key->key);
|
||||
return (dns_name_equal(dst_key_name(key->key), gorigin) &&
|
||||
dst_key_iszonekey(key->key));
|
||||
}
|
||||
|
||||
static bool
|
||||
isksk(dns_dnsseckey_t *key) {
|
||||
return key->ksk;
|
||||
return (key->ksk);
|
||||
}
|
||||
|
||||
static bool
|
||||
iszsk(dns_dnsseckey_t *key) {
|
||||
return ignore_kskflag || !key->ksk;
|
||||
return (ignore_kskflag || !key->ksk);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -367,10 +368,10 @@ keythatsigned_unlocked(dns_rdata_rrsig_t *rrsig) {
|
||||
rrsig->algorithm == dst_key_alg(key->key) &&
|
||||
dns_name_equal(&rrsig->signer, dst_key_name(key->key)))
|
||||
{
|
||||
return key;
|
||||
return (key);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -387,7 +388,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
|
||||
key = keythatsigned_unlocked(rrsig);
|
||||
RWUNLOCK(&keylist_lock, isc_rwlocktype_read);
|
||||
if (key != NULL) {
|
||||
return key;
|
||||
return (key);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -401,7 +402,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
|
||||
key = keythatsigned_unlocked(rrsig);
|
||||
if (key != NULL) {
|
||||
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
|
||||
return key;
|
||||
return (key);
|
||||
}
|
||||
|
||||
result = dst_key_fromfile(&rrsig->signer, rrsig->keyid,
|
||||
@@ -409,7 +410,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
|
||||
mctx, &pubkey);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
result = dst_key_fromfile(
|
||||
@@ -420,14 +421,15 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
|
||||
dns_dnsseckey_create(mctx, &privkey, &key);
|
||||
} else {
|
||||
dns_dnsseckey_create(mctx, &pubkey, &key);
|
||||
key->pubkey = true;
|
||||
}
|
||||
|
||||
key->force_publish = false;
|
||||
key->force_sign = false;
|
||||
key->index = keycount++;
|
||||
ISC_LIST_APPEND(keylist, key, link);
|
||||
|
||||
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
|
||||
return key;
|
||||
return (key);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -449,11 +451,11 @@ expecttofindkey(dns_name_t *name) {
|
||||
case ISC_R_SUCCESS:
|
||||
case DNS_R_NXDOMAIN:
|
||||
case DNS_R_NXRRSET:
|
||||
return true;
|
||||
return (true);
|
||||
case DNS_R_DELEGATION:
|
||||
case DNS_R_CNAME:
|
||||
case DNS_R_DNAME:
|
||||
return false;
|
||||
return (false);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -461,7 +463,7 @@ expecttofindkey(dns_name_t *name) {
|
||||
fatal("failure looking for '%s DNSKEY' in database: %s", namestr,
|
||||
isc_result_totext(result));
|
||||
UNREACHABLE();
|
||||
return false; /* removes a warning */
|
||||
return (false); /* removes a warning */
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -471,10 +473,10 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
|
||||
result = dns_dnssec_verify(name, set, key, false, 0, mctx, rrsig, NULL);
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
|
||||
INCSTAT(nverified);
|
||||
return true;
|
||||
return (true);
|
||||
} else {
|
||||
INCSTAT(nverifyfailed);
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,8 +528,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
if (!nosigs) {
|
||||
arraysize += dns_rdataset_count(&sigset);
|
||||
}
|
||||
wassignedby = isc_mem_cget(mctx, arraysize, sizeof(bool));
|
||||
nowsignedby = isc_mem_cget(mctx, arraysize, sizeof(bool));
|
||||
wassignedby = isc_mem_get(mctx, arraysize * sizeof(bool));
|
||||
nowsignedby = isc_mem_get(mctx, arraysize * sizeof(bool));
|
||||
|
||||
for (i = 0; i < arraysize; i++) {
|
||||
wassignedby[i] = nowsignedby[i] = false;
|
||||
@@ -540,7 +542,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
}
|
||||
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
bool expired, refresh, future, offline;
|
||||
bool expired, future;
|
||||
bool keep = false, resign = false;
|
||||
|
||||
dns_rdataset_current(&sigset, &sigrdata);
|
||||
@@ -551,10 +553,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
future = isc_serial_lt(now, rrsig.timesigned);
|
||||
|
||||
key = keythatsigned(&rrsig);
|
||||
offline = (key != NULL) ? key->pubkey : false;
|
||||
sig_format(&rrsig, sigstr, sizeof(sigstr));
|
||||
expired = isc_serial_gt(now, rrsig.timeexpire);
|
||||
refresh = isc_serial_gt(now + cycle, rrsig.timeexpire);
|
||||
expired = isc_serial_gt(now + cycle, rrsig.timeexpire);
|
||||
|
||||
if (isc_serial_gt(rrsig.timesigned, rrsig.timeexpire)) {
|
||||
/* rrsig is dropped and not replaced */
|
||||
@@ -583,21 +583,15 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
} else if (issigningkey(key)) {
|
||||
wassignedby[key->index] = true;
|
||||
|
||||
if (!refresh && rrsig.originalttl == set->ttl &&
|
||||
if (!expired && rrsig.originalttl == set->ttl &&
|
||||
setverifies(name, set, key->key, &sigrdata))
|
||||
{
|
||||
vbprintf(2, "\trrsig by %s retained\n", sigstr);
|
||||
keep = true;
|
||||
} else if (offline) {
|
||||
vbprintf(2,
|
||||
"\trrsig by %s retained - private key "
|
||||
"missing\n",
|
||||
sigstr);
|
||||
keep = true;
|
||||
} else {
|
||||
vbprintf(2, "\trrsig by %s dropped - %s\n",
|
||||
sigstr,
|
||||
refresh ? "refresh"
|
||||
expired ? "expired"
|
||||
: rrsig.originalttl != set->ttl
|
||||
? "ttl change"
|
||||
: "failed to "
|
||||
@@ -610,32 +604,25 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
} else if (iszonekey(key)) {
|
||||
wassignedby[key->index] = true;
|
||||
|
||||
if (!refresh && rrsig.originalttl == set->ttl &&
|
||||
if (!expired && rrsig.originalttl == set->ttl &&
|
||||
setverifies(name, set, key->key, &sigrdata))
|
||||
{
|
||||
vbprintf(2, "\trrsig by %s retained\n", sigstr);
|
||||
keep = true;
|
||||
} else if (offline) {
|
||||
vbprintf(2,
|
||||
"\trrsig by %s retained - private key "
|
||||
"missing\n",
|
||||
sigstr);
|
||||
keep = true;
|
||||
} else {
|
||||
vbprintf(2, "\trrsig by %s dropped - %s\n",
|
||||
sigstr,
|
||||
refresh ? "refresh"
|
||||
expired ? "expired"
|
||||
: rrsig.originalttl != set->ttl
|
||||
? "ttl change"
|
||||
: "failed to "
|
||||
"verify");
|
||||
}
|
||||
} else if (!refresh) {
|
||||
} else if (!expired) {
|
||||
vbprintf(2, "\trrsig by %s retained\n", sigstr);
|
||||
keep = true;
|
||||
} else {
|
||||
vbprintf(2, "\trrsig by %s %s\n", sigstr,
|
||||
expired ? "expired" : "needs refresh");
|
||||
vbprintf(2, "\trrsig by %s expired\n", sigstr);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
@@ -692,10 +679,6 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
for (key = ISC_LIST_HEAD(keylist); key != NULL;
|
||||
key = ISC_LIST_NEXT(key, link))
|
||||
{
|
||||
if (REVOKE(key->key) && set->type != dns_rdatatype_dnskey) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nowsignedby[key->index]) {
|
||||
continue;
|
||||
}
|
||||
@@ -798,8 +781,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_cput(mctx, wassignedby, arraysize, sizeof(bool));
|
||||
isc_mem_cput(mctx, nowsignedby, arraysize, sizeof(bool));
|
||||
isc_mem_put(mctx, wassignedby, arraysize * sizeof(bool));
|
||||
isc_mem_put(mctx, nowsignedby, arraysize * sizeof(bool));
|
||||
}
|
||||
|
||||
struct hashlist {
|
||||
@@ -878,7 +861,7 @@ hashlist_add_dns_name(hashlist_t *l,
|
||||
|
||||
static int
|
||||
hashlist_comp(const void *a, const void *b) {
|
||||
return memcmp(a, b, hash_length + 1);
|
||||
return (memcmp(a, b, hash_length + 1));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -910,11 +893,11 @@ hashlist_hasdup(hashlist_t *l) {
|
||||
continue;
|
||||
}
|
||||
if (isc_safe_memequal(current, next, l->length - 1)) {
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
static const unsigned char *
|
||||
@@ -936,16 +919,16 @@ hashlist_findnext(const hashlist_t *l,
|
||||
}
|
||||
} while (entries-- > 1U);
|
||||
INSIST(entries != 0U);
|
||||
return next;
|
||||
return (next);
|
||||
}
|
||||
|
||||
static bool
|
||||
hashlist_exists(const hashlist_t *l,
|
||||
const unsigned char hash[NSEC3_MAX_HASH_LENGTH]) {
|
||||
if (bsearch(hash, l->hashbuf, l->entries, l->length, hashlist_comp)) {
|
||||
return true;
|
||||
return (true);
|
||||
} else {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,8 +997,8 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
|
||||
}
|
||||
isc_buffer_putuint8(&b, 0);
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
|
||||
dns_dbtype_zone, rdclass, 0, NULL, dbp);
|
||||
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, dbp);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_load(*dbp, filename, inputformat, DNS_MASTER_HINT);
|
||||
@@ -1054,7 +1037,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
|
||||
vbprintf(2, "found DS records\n");
|
||||
dsset->ttl = ttl;
|
||||
dns_db_detach(&db);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
dns_db_detach(&db);
|
||||
@@ -1063,13 +1046,13 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
|
||||
/* No DS records found; try again, looking for DNSKEY records */
|
||||
opendb("keyset-", name, gclass, &db);
|
||||
if (db == NULL) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
result = dns_db_findnode(db, name, false, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_detach(&db);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_rdataset_init(&keyset);
|
||||
@@ -1078,7 +1061,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_detachnode(db, &node);
|
||||
dns_db_detach(&db);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
vbprintf(2, "found DNSKEY records\n");
|
||||
|
||||
@@ -1115,7 +1098,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
|
||||
dns_rdataset_disassociate(&keyset);
|
||||
dns_db_detachnode(db, &node);
|
||||
dns_db_detach(&db);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1124,7 +1107,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
|
||||
isc_result_t result;
|
||||
|
||||
if (dns_name_equal(name, gorigin)) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
dns_rdataset_init(&dsset);
|
||||
@@ -1134,7 +1117,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
|
||||
dns_rdataset_disassociate(&dsset);
|
||||
}
|
||||
|
||||
return result == ISC_R_SUCCESS;
|
||||
return (result == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1144,7 +1127,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
|
||||
isc_result_t result;
|
||||
|
||||
if (dns_name_equal(name, origin)) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
dns_rdataset_init(&nsset);
|
||||
@@ -1157,7 +1140,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
|
||||
dns_rdataset_disassociate(&nsset);
|
||||
}
|
||||
|
||||
return result == ISC_R_SUCCESS;
|
||||
return ((result == ISC_R_SUCCESS));
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -1176,14 +1159,14 @@ has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) {
|
||||
dns_rdataset_disassociate(&dnameset);
|
||||
}
|
||||
|
||||
return result == ISC_R_SUCCESS;
|
||||
return ((result == ISC_R_SUCCESS));
|
||||
}
|
||||
|
||||
/*%
|
||||
* Signs all records at a name.
|
||||
*/
|
||||
static void
|
||||
signname(dns_dbnode_t *node, bool apex, dns_name_t *name) {
|
||||
signname(dns_dbnode_t *node, dns_name_t *name) {
|
||||
isc_result_t result;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdatasetiter_t *rdsiter;
|
||||
@@ -1234,10 +1217,6 @@ signname(dns_dbnode_t *node, bool apex, dns_name_t *name) {
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
fatal("'%s': found DS RRset without NS RRset\n",
|
||||
namebuf);
|
||||
} else if (rdataset.type == dns_rdatatype_dnskey && !apex) {
|
||||
char namebuf[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
fatal("'%s': Non-apex DNSKEY RRset\n", namebuf);
|
||||
}
|
||||
|
||||
signset(&del, &add, node, name, &rdataset);
|
||||
@@ -1394,7 +1373,7 @@ active_node(dns_dbnode_t *node) {
|
||||
}
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
|
||||
return active;
|
||||
return (active);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -1443,7 +1422,7 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
|
||||
|
||||
result = dns_db_getoriginnode(gdb, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
@@ -1517,7 +1496,7 @@ cleanup:
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -1557,7 +1536,7 @@ signapex(void) {
|
||||
check_result(result, "dns_dbiterator_seek()");
|
||||
result = dns_dbiterator_current(gdbiter, &node, name);
|
||||
check_dns_dbiterator_current(result);
|
||||
signname(node, true, name);
|
||||
signname(node, name);
|
||||
dumpnode(name, node);
|
||||
dns_db_detachnode(gdb, &node);
|
||||
result = dns_dbiterator_first(gdbiter);
|
||||
@@ -1686,7 +1665,7 @@ assignwork(void *arg) {
|
||||
|
||||
UNLOCK(&namelock);
|
||||
|
||||
signname(node, false, dns_fixedname_name(&fname));
|
||||
signname(node, dns_fixedname_name(&fname));
|
||||
|
||||
/*%
|
||||
* Write a node to the output file, and restart the worker task.
|
||||
@@ -1694,7 +1673,7 @@ assignwork(void *arg) {
|
||||
lock_and_dumpnode(dns_fixedname_name(&fname), node);
|
||||
dns_db_detachnode(gdb, &node);
|
||||
|
||||
isc_async_current(assignwork, NULL);
|
||||
isc_async_current(loopmgr, assignwork, NULL);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -2592,8 +2571,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, 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);
|
||||
@@ -2659,7 +2638,7 @@ loadzonekeys(bool preserve_keys, bool load_public) {
|
||||
|
||||
/* Load keys corresponding to the existing DNSKEY RRset. */
|
||||
result = dns_dnssec_keylistfromrdataset(
|
||||
gorigin, NULL, directory, mctx, &rdataset, &keysigs, &soasigs,
|
||||
gorigin, directory, mctx, &rdataset, &keysigs, &soasigs,
|
||||
preserve_keys, load_public, &keylist);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to load the zone keys: %s",
|
||||
@@ -2850,8 +2829,8 @@ findkeys:
|
||||
/*
|
||||
* Find keys that match this zone in the key repository.
|
||||
*/
|
||||
result = dns_dnssec_findmatchingkeys(gorigin, NULL, directory, NULL,
|
||||
now, mctx, &matchkeys);
|
||||
result = dns_dnssec_findmatchingkeys(gorigin, directory, now, mctx,
|
||||
&matchkeys);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
@@ -3182,8 +3161,8 @@ writeset(const char *prefix, dns_rdatatype_t type) {
|
||||
dns_diff_append(&diff, &tuple);
|
||||
}
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
|
||||
dns_dbtype_zone, gclass, 0, NULL, &db);
|
||||
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
|
||||
gclass, 0, NULL, &db);
|
||||
check_result(result, "dns_db_create");
|
||||
|
||||
result = dns_db_newversion(db, &dbversion);
|
||||
@@ -3320,7 +3299,7 @@ usage(void) {
|
||||
fprintf(stderr, "(default: all zone keys that have private keys)\n");
|
||||
fprintf(stderr, "\tkeyfile (Kname+alg+tag)\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3338,24 +3317,21 @@ print_stats(isc_time_t *timer_start, isc_time_t *timer_finish,
|
||||
uint64_t sig_ms; /* Signatures per millisecond */
|
||||
FILE *out = output_stdout ? stderr : stdout;
|
||||
|
||||
fprintf(out, "Signatures generated: %10" PRIuFAST32 "\n",
|
||||
atomic_load(&nsigned));
|
||||
fprintf(out, "Signatures retained: %10" PRIuFAST32 "\n",
|
||||
atomic_load(&nretained));
|
||||
fprintf(out, "Signatures dropped: %10" PRIuFAST32 "\n",
|
||||
atomic_load(&ndropped));
|
||||
fprintf(out, "Signatures successfully verified: %10" PRIuFAST32 "\n",
|
||||
atomic_load(&nverified));
|
||||
fprintf(out, "Signatures unsuccessfully verified: %10" PRIuFAST32 "\n",
|
||||
atomic_load(&nverifyfailed));
|
||||
fprintf(out, "Signatures generated: %10u\n", nsigned);
|
||||
fprintf(out, "Signatures retained: %10u\n", nretained);
|
||||
fprintf(out, "Signatures dropped: %10u\n", ndropped);
|
||||
fprintf(out, "Signatures successfully verified: %10u\n", nverified);
|
||||
fprintf(out,
|
||||
"Signatures unsuccessfully "
|
||||
"verified: %10u\n",
|
||||
nverifyfailed);
|
||||
|
||||
time_us = isc_time_microdiff(sign_finish, sign_start);
|
||||
time_ms = time_us / 1000;
|
||||
fprintf(out, "Signing time in seconds: %7u.%03u\n",
|
||||
(unsigned int)(time_ms / 1000), (unsigned int)(time_ms % 1000));
|
||||
if (time_us > 0) {
|
||||
sig_ms = ((uint64_t)atomic_load(&nsigned) * 1000000000) /
|
||||
time_us;
|
||||
sig_ms = ((uint64_t)nsigned * 1000000000) / time_us;
|
||||
fprintf(out, "Signatures per second: %7u.%03u\n",
|
||||
(unsigned int)sig_ms / 1000,
|
||||
(unsigned int)sig_ms % 1000);
|
||||
@@ -3517,7 +3493,7 @@ main(int argc, char *argv[]) {
|
||||
set_iter = true;
|
||||
/* too-many is NOT DOCUMENTED */
|
||||
if (strcmp(isc_commandline_argument, "too-many") == 0) {
|
||||
nsec3iter = 51;
|
||||
nsec3iter = 151;
|
||||
no_max_check = true;
|
||||
break;
|
||||
}
|
||||
@@ -3573,7 +3549,7 @@ main(int argc, char *argv[]) {
|
||||
if (*endp != '\0') {
|
||||
fprintf(stderr, "source serial number "
|
||||
"must be numeric");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3588,7 +3564,7 @@ main(int argc, char *argv[]) {
|
||||
if (*endp != '\0') {
|
||||
fprintf(stderr, "maximum TTL "
|
||||
"must be numeric");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3712,7 +3688,7 @@ main(int argc, char *argv[]) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3761,13 +3737,11 @@ main(int argc, char *argv[]) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
@@ -3841,7 +3815,7 @@ main(int argc, char *argv[]) {
|
||||
rawversion > 1U)
|
||||
{
|
||||
fprintf(stderr, "unknown raw format version\n");
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
fatal("unknown file format: %s", outputformatstr);
|
||||
@@ -4066,6 +4040,10 @@ main(int argc, char *argv[]) {
|
||||
|
||||
isc_mutex_init(&namelock);
|
||||
|
||||
if (printstats) {
|
||||
isc_mutex_init(&statslock);
|
||||
}
|
||||
|
||||
presign();
|
||||
sign_start = isc_time_now();
|
||||
signapex();
|
||||
@@ -4172,8 +4150,9 @@ main(int argc, char *argv[]) {
|
||||
timer_finish = isc_time_now();
|
||||
print_stats(&timer_start, &timer_finish, &sign_start,
|
||||
&sign_finish);
|
||||
isc_mutex_destroy(&statslock);
|
||||
}
|
||||
isc_mutex_destroy(&namelock);
|
||||
|
||||
return vresult == ISC_R_SUCCESS ? 0 : 1;
|
||||
return (vresult == ISC_R_SUCCESS ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ dnssec-signzone - DNSSEC zone signing tool
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-J** filename] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
|
||||
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
@@ -89,11 +89,6 @@ Options
|
||||
where ``digest-type`` is an allowed algorithm such as SHA-256 (2), or SHA-384 (4).
|
||||
Only works in combination with smart signing (``-S``).
|
||||
|
||||
.. option:: -J filename
|
||||
|
||||
This option tells :program:`dnssec-signzone` to read the journal from the given file
|
||||
when loading the zone file.
|
||||
|
||||
.. option:: -K directory
|
||||
|
||||
This option specifies the directory to search for DNSSEC keys. If not
|
||||
@@ -183,11 +178,6 @@ Options
|
||||
days. Therefore, if any existing RRSIG records are due to expire in
|
||||
less than 7.5 days, they are replaced.
|
||||
|
||||
Note that the calculation of cycle interval is based upon the validity
|
||||
period of the replacement signatures that would be generated by
|
||||
``dnssec-signzone``, not on the valid lifetimes of the input RRSIGs being
|
||||
considered for pre-expiry replacement.
|
||||
|
||||
.. option:: -I input-format
|
||||
|
||||
This option sets the format of the input zone file. Possible formats are
|
||||
@@ -283,7 +273,7 @@ Options
|
||||
with cached copies of the old DNSKEY RRset. The :option:`-Q` option forces
|
||||
:program:`dnssec-signzone` to remove signatures from keys that are no longer
|
||||
active. This enables ZSK rollover using the procedure described in
|
||||
:rfc:`6781#section-4.1.1.1` ("Pre-Publish Zone Signing Key Rollover").
|
||||
:rfc:`4641#4.2.1.1` ("Pre-Publish Key Rollover").
|
||||
|
||||
.. option:: -q
|
||||
|
||||
@@ -300,7 +290,7 @@ Options
|
||||
This option is similar to :option:`-Q`, except it forces
|
||||
:program:`dnssec-signzone` to remove signatures from keys that are no longer
|
||||
published. This enables ZSK rollover using the procedure described in
|
||||
:rfc:`6781#section-4.1.1.2` ("Double Signature Zone Signing Key
|
||||
:rfc:`4641#4.2.1.2` ("Double Signature Zone Signing Key
|
||||
Rollover").
|
||||
|
||||
.. option:: -S
|
||||
@@ -369,12 +359,15 @@ Options
|
||||
.. option:: -x
|
||||
|
||||
This option indicates that BIND 9 should only sign the DNSKEY, CDNSKEY, and CDS RRsets with key-signing keys,
|
||||
and should omit signatures from zone-signing keys.
|
||||
and should omit signatures from zone-signing keys. (This is similar to the
|
||||
``dnssec-dnskey-kskonly yes;`` zone option in :iscman:`named`.)
|
||||
|
||||
.. option:: -z
|
||||
|
||||
This option indicates that BIND 9 should ignore the KSK flag on keys when determining what to sign. This causes
|
||||
KSK-flagged keys to sign all records, not just the DNSKEY RRset.
|
||||
(This is similar to the ``update-check-ksk no;`` zone option in
|
||||
:iscman:`named`.)
|
||||
|
||||
.. option:: -3 salt
|
||||
|
||||
@@ -384,7 +377,6 @@ Options
|
||||
|
||||
.. note::
|
||||
``-3 -`` is the recommended configuration. Adding salt provides no practical benefits.
|
||||
See :rfc:`9276`.
|
||||
|
||||
.. option:: -H iterations
|
||||
|
||||
@@ -393,7 +385,6 @@ Options
|
||||
|
||||
.. warning::
|
||||
Values greater than 0 cause interoperability issues and also increase the risk of CPU-exhausting DoS attacks.
|
||||
See :rfc:`9276`.
|
||||
|
||||
.. option:: -A
|
||||
|
||||
@@ -402,7 +393,6 @@ Options
|
||||
|
||||
.. warning::
|
||||
Do not use this option unless all its implications are fully understood. This option is intended only for extremely large zones (comparable to ``com.``) with sparse secure delegations.
|
||||
See :rfc:`9276`.
|
||||
|
||||
.. option:: -AA
|
||||
|
||||
@@ -456,4 +446,4 @@ See Also
|
||||
~~~~~~~~
|
||||
|
||||
:iscman:`dnssec-keygen(8) <dnssec-keygen>`, BIND 9 Administrator Reference Manual, :rfc:`4033`,
|
||||
:rfc:`6781`.
|
||||
:rfc:`4641`.
|
||||
|
||||
@@ -109,8 +109,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_create(mctx, ZONEDB_DEFAULT, 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);
|
||||
@@ -162,7 +162,7 @@ usage(void) {
|
||||
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
|
||||
"not ZSKs\n");
|
||||
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -271,7 +271,7 @@ main(int argc, char *argv[]) {
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,5 +342,5 @@ main(int argc, char *argv[]) {
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return result == ISC_R_SUCCESS ? 0 : 1;
|
||||
return (result == ISC_R_SUCCESS ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ dnssec-verify - DNSSEC zone verification tool
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-J** filename] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
|
||||
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
@@ -53,11 +53,6 @@ Options
|
||||
format containing updates can be verified independently.
|
||||
This option is not useful for non-dynamic zones.
|
||||
|
||||
.. option:: -J filename
|
||||
|
||||
This option tells :program:`dnssec-verify` to read the journal from the given file
|
||||
when loading the zone file.
|
||||
|
||||
.. option:: -o origin
|
||||
|
||||
This option indicates the zone origin. If not specified, the name of the zone file is
|
||||
|
||||
+42
-137
@@ -20,7 +20,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/base32.h>
|
||||
#include <isc/buffer.h>
|
||||
@@ -84,7 +83,8 @@ fatal(const char *format, ...) {
|
||||
if (fatalcallback != NULL) {
|
||||
(*fatalcallback)();
|
||||
}
|
||||
_exit(EXIT_FAILURE);
|
||||
isc__tls_setfatalmode();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -114,7 +114,7 @@ vbprintf(int level, const char *fmt, ...) {
|
||||
void
|
||||
version(const char *name) {
|
||||
printf("%s %s\n", name, PACKAGE_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -202,16 +202,16 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
|
||||
switch (suffix[0]) {
|
||||
case 'Y':
|
||||
case 'y':
|
||||
return offset * (365 * 24 * 3600);
|
||||
return (offset * (365 * 24 * 3600));
|
||||
case 'M':
|
||||
case 'm':
|
||||
switch (suffix[1]) {
|
||||
case 'O':
|
||||
case 'o':
|
||||
return offset * (30 * 24 * 3600);
|
||||
return (offset * (30 * 24 * 3600));
|
||||
case 'I':
|
||||
case 'i':
|
||||
return offset * 60;
|
||||
return (offset * 60);
|
||||
case '\0':
|
||||
fatal("'%s' ambiguous: use 'mi' for minutes "
|
||||
"or 'mo' for months",
|
||||
@@ -223,29 +223,29 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
return offset * (7 * 24 * 3600);
|
||||
return (offset * (7 * 24 * 3600));
|
||||
case 'D':
|
||||
case 'd':
|
||||
return offset * (24 * 3600);
|
||||
return (offset * (24 * 3600));
|
||||
case 'H':
|
||||
case 'h':
|
||||
return offset * 3600;
|
||||
return (offset * 3600);
|
||||
case 'S':
|
||||
case 's':
|
||||
case '\0':
|
||||
return offset;
|
||||
return (offset);
|
||||
default:
|
||||
fatal("time value %s is invalid", str);
|
||||
}
|
||||
UNREACHABLE();
|
||||
return 0; /* silence compiler warning */
|
||||
return (0); /* silence compiler warning */
|
||||
}
|
||||
|
||||
static bool
|
||||
isnone(const char *str) {
|
||||
return (strcasecmp(str, "none") == 0) ||
|
||||
(strcasecmp(str, "never") == 0) ||
|
||||
(strcasecmp(str, "unset") == 0);
|
||||
return ((strcasecmp(str, "none") == 0) ||
|
||||
(strcasecmp(str, "never") == 0) ||
|
||||
(strcasecmp(str, "unset") == 0));
|
||||
}
|
||||
|
||||
dns_ttl_t
|
||||
@@ -255,7 +255,7 @@ strtottl(const char *str) {
|
||||
char *endp;
|
||||
|
||||
if (isnone(str)) {
|
||||
return (dns_ttl_t)0;
|
||||
return ((dns_ttl_t)0);
|
||||
}
|
||||
|
||||
ttl = strtol(str, &endp, 0);
|
||||
@@ -263,19 +263,19 @@ strtottl(const char *str) {
|
||||
fatal("TTL must be numeric");
|
||||
}
|
||||
ttl = time_units(ttl, endp, orig);
|
||||
return ttl;
|
||||
return (ttl);
|
||||
}
|
||||
|
||||
dst_key_state_t
|
||||
strtokeystate(const char *str) {
|
||||
if (isnone(str)) {
|
||||
return DST_KEY_STATE_NA;
|
||||
return (DST_KEY_STATE_NA);
|
||||
}
|
||||
|
||||
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
|
||||
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
|
||||
{
|
||||
return (dst_key_state_t)i;
|
||||
return ((dst_key_state_t)i);
|
||||
}
|
||||
}
|
||||
fatal("unknown key state %s", str);
|
||||
@@ -291,14 +291,18 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
struct tm tm;
|
||||
|
||||
if (isnone(str)) {
|
||||
SET_IF_NOT_NULL(setp, false);
|
||||
return (isc_stdtime_t)0;
|
||||
if (setp != NULL) {
|
||||
*setp = false;
|
||||
}
|
||||
return ((isc_stdtime_t)0);
|
||||
}
|
||||
|
||||
SET_IF_NOT_NULL(setp, true);
|
||||
if (setp != NULL) {
|
||||
*setp = true;
|
||||
}
|
||||
|
||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
|
||||
return (isc_stdtime_t)0;
|
||||
return ((isc_stdtime_t)0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -347,7 +351,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
}
|
||||
|
||||
if (str[0] == '\0') {
|
||||
return (isc_stdtime_t)base;
|
||||
return ((isc_stdtime_t)base);
|
||||
} else if (str[0] == '+') {
|
||||
offset = strtol(str + 1, &endp, 0);
|
||||
offset = time_units((isc_stdtime_t)offset, endp, orig);
|
||||
@@ -360,7 +364,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
fatal("time value %s is invalid", orig);
|
||||
}
|
||||
|
||||
return (isc_stdtime_t)val;
|
||||
return ((isc_stdtime_t)val);
|
||||
}
|
||||
|
||||
dns_rdataclass_t
|
||||
@@ -370,7 +374,7 @@ strtoclass(const char *str) {
|
||||
isc_result_t result;
|
||||
|
||||
if (str == NULL) {
|
||||
return dns_rdataclass_in;
|
||||
return (dns_rdataclass_in);
|
||||
}
|
||||
r.base = UNCONST(str);
|
||||
r.length = strlen(str);
|
||||
@@ -378,7 +382,7 @@ strtoclass(const char *str) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("unknown class %s", str);
|
||||
}
|
||||
return rdclass;
|
||||
return (rdclass);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
@@ -393,14 +397,14 @@ strtodsdigest(const char *str) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("unknown DS algorithm %s", str);
|
||||
}
|
||||
return alg;
|
||||
return (alg);
|
||||
}
|
||||
|
||||
static int
|
||||
cmp_dtype(const void *ap, const void *bp) {
|
||||
int a = *(const uint8_t *)ap;
|
||||
int b = *(const uint8_t *)bp;
|
||||
return a - b;
|
||||
return (a - b);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -432,7 +436,7 @@ try_dir(const char *dirname) {
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_dir_close(&d);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -479,7 +483,7 @@ set_keyversion(dst_key_t *key) {
|
||||
|
||||
bool
|
||||
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact) {
|
||||
isc_mem_t *mctx, bool *exact) {
|
||||
isc_result_t result;
|
||||
bool conflict = false;
|
||||
dns_dnsseckeylist_t matchkeys;
|
||||
@@ -489,32 +493,18 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
dns_secalg_t alg;
|
||||
isc_stdtime_t now = isc_stdtime_now();
|
||||
|
||||
SET_IF_NOT_NULL(exact, false);
|
||||
if (exact != NULL) {
|
||||
*exact = false;
|
||||
}
|
||||
|
||||
id = dst_key_id(dstkey);
|
||||
rid = dst_key_rid(dstkey);
|
||||
alg = dst_key_alg(dstkey);
|
||||
|
||||
if (min != max) {
|
||||
if (id < min || id > max) {
|
||||
fprintf(stderr, "Key ID %d outside of [%u..%u]\n", id,
|
||||
min, max);
|
||||
return true;
|
||||
}
|
||||
if (rid < min || rid > max) {
|
||||
fprintf(stderr,
|
||||
"Revoked Key ID %d (for tag %d) outside of "
|
||||
"[%u..%u]\n",
|
||||
rid, id, min, max);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ISC_LIST_INIT(matchkeys);
|
||||
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
|
||||
&matchkeys);
|
||||
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
|
||||
@@ -558,7 +548,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
dns_dnsseckey_destroy(mctx, &key);
|
||||
}
|
||||
|
||||
return conflict;
|
||||
return (conflict);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -573,9 +563,9 @@ isoptarg(const char *arg, char **argv, void (*usage)(void)) {
|
||||
isc_commandline_argument = argv[isc_commandline_index];
|
||||
/* skip to next argument */
|
||||
isc_commandline_index++;
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -615,88 +605,3 @@ loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *file) {
|
||||
cleanup:
|
||||
dns_journal_destroy(&jnl);
|
||||
}
|
||||
|
||||
void
|
||||
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, isc_log_t *lctx,
|
||||
const char *name, const char *keydir, const char *engine,
|
||||
dns_kasp_t **kaspp) {
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *kasps = NULL;
|
||||
dns_kasp_t *kasp = NULL, *kasp_next;
|
||||
dns_kasplist_t kasplist;
|
||||
const cfg_obj_t *keystores = NULL;
|
||||
dns_keystore_t *ks = NULL, *ks_next;
|
||||
dns_keystorelist_t kslist;
|
||||
|
||||
ISC_LIST_INIT(kasplist);
|
||||
ISC_LIST_INIT(kslist);
|
||||
|
||||
(void)cfg_map_get(config, "key-store", &keystores);
|
||||
for (element = cfg_list_first(keystores); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
cfg_obj_t *kconfig = cfg_listelt_value(element);
|
||||
ks = NULL;
|
||||
result = cfg_keystore_fromconfig(kconfig, mctx, lctx, engine,
|
||||
&kslist, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to configure key-store '%s': %s",
|
||||
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
/* Default key-directory key store. */
|
||||
ks = NULL;
|
||||
(void)cfg_keystore_fromconfig(NULL, mctx, lctx, engine, &kslist, &ks);
|
||||
INSIST(ks != NULL);
|
||||
if (keydir != NULL) {
|
||||
/* '-K keydir' takes priority */
|
||||
dns_keystore_setdirectory(ks, keydir);
|
||||
}
|
||||
dns_keystore_detach(&ks);
|
||||
|
||||
(void)cfg_map_get(config, "dnssec-policy", &kasps);
|
||||
for (element = cfg_list_first(kasps); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
cfg_obj_t *kconfig = cfg_listelt_value(element);
|
||||
kasp = NULL;
|
||||
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
|
||||
name) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result = cfg_kasp_fromconfig(kconfig, NULL, true, mctx, lctx,
|
||||
&kslist, &kasplist, &kasp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to configure dnssec-policy '%s': %s",
|
||||
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
|
||||
isc_result_totext(result));
|
||||
}
|
||||
INSIST(kasp != NULL);
|
||||
dns_kasp_freeze(kasp);
|
||||
break;
|
||||
}
|
||||
|
||||
*kaspp = kasp;
|
||||
|
||||
/*
|
||||
* Cleanup kasp list.
|
||||
*/
|
||||
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
|
||||
kasp_next = ISC_LIST_NEXT(kasp, link);
|
||||
ISC_LIST_UNLINK(kasplist, kasp, link);
|
||||
dns_kasp_detach(&kasp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup keystore list.
|
||||
*/
|
||||
for (ks = ISC_LIST_HEAD(kslist); ks != NULL; ks = ks_next) {
|
||||
ks_next = ISC_LIST_NEXT(ks, link);
|
||||
ISC_LIST_UNLINK(kslist, ks, link);
|
||||
dns_keystore_detach(&ks);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-14
@@ -20,18 +20,10 @@
|
||||
#include <isc/log.h>
|
||||
#include <isc/stdtime.h>
|
||||
|
||||
#include <dns/kasp.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <isccfg/cfg.h>
|
||||
#include <isccfg/kaspconf.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#define MAX_RSA 4096 /* should be long enough... */
|
||||
#define MAX_DH 4096 /* should be long enough... */
|
||||
|
||||
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
|
||||
*/
|
||||
extern int verbose;
|
||||
@@ -109,15 +101,10 @@ set_keyversion(dst_key_t *key);
|
||||
|
||||
bool
|
||||
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
|
||||
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact);
|
||||
isc_mem_t *mctx, bool *exact);
|
||||
|
||||
bool
|
||||
isoptarg(const char *arg, char **argv, void (*usage)(void));
|
||||
|
||||
void
|
||||
loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *journal);
|
||||
|
||||
void
|
||||
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, isc_log_t *lctx,
|
||||
const char *name, const char *keydir, const char *engine,
|
||||
dns_kasp_t **kaspp);
|
||||
|
||||
@@ -38,8 +38,8 @@ AM_CPPFLAGS += \
|
||||
sbin_PROGRAMS = named
|
||||
|
||||
nodist_named_SOURCES = xsl.c
|
||||
BUILT_SOURCES += xsl.c
|
||||
CLEANFILES += xsl.c
|
||||
BUILT_SOURCES = xsl.c
|
||||
CLEANFILES = xsl.c
|
||||
|
||||
EXTRA_DIST = bind9.xsl
|
||||
|
||||
|
||||
@@ -303,7 +303,6 @@
|
||||
<a href="/xml/v3/status">Status</a>,
|
||||
<a href="/xml/v3/server">Server</a>,
|
||||
<a href="/xml/v3/zones">Zones</a>,
|
||||
<a href="/xml/v3/xfrins">Incoming Zone Transfers</a>,
|
||||
<a href="/xml/v3/net">Network</a>,
|
||||
<a href="/xml/v3/mem">Memory</a> and
|
||||
<a href="/xml/v3/traffic">Traffic Size</a></p>
|
||||
@@ -908,65 +907,6 @@
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
<xsl:if test="views/view/xfrins/xfrin">
|
||||
<xsl:for-each select="views/view">
|
||||
<h3>Incoming Zone Transfers for View <xsl:value-of select="@name"/></h3>
|
||||
<table class="xfrins">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone Name</th>
|
||||
<th>Zone Type</th>
|
||||
<th>Local Serial</th>
|
||||
<th>Remote Serial</th>
|
||||
<th>IXFR</th>
|
||||
<th>First Refresh</th>
|
||||
<th>State</th>
|
||||
<th>Additional Refresh Queued</th>
|
||||
<th>Local Address</th>
|
||||
<th>Remote Address</th>
|
||||
<th>SOA Transport</th>
|
||||
<th>Transport</th>
|
||||
<th>TSIG Key Name</th>
|
||||
<th>Duration (s)</th>
|
||||
<th>Messages Received</th>
|
||||
<th>Records Received</th>
|
||||
<th>Bytes Received</th>
|
||||
<th>Transfer Rate (B/s)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="xfrins/xfrin">
|
||||
<xsl:variable name="css-class16">
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() mod 2 = 0">even</xsl:when>
|
||||
<xsl:otherwise>odd</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<tr class="{$css-class16}">
|
||||
<td><xsl:value-of select="@name"/></td>
|
||||
<td><xsl:value-of select="type"/></td>
|
||||
<td><xsl:value-of select="serial"/></td>
|
||||
<td><xsl:value-of select="remoteserial"/></td>
|
||||
<td><xsl:value-of select="ixfr"/></td>
|
||||
<td><xsl:value-of select="firstrefresh"/></td>
|
||||
<td><xsl:value-of select="state"/></td>
|
||||
<td><xsl:value-of select="refreshqueued"/></td>
|
||||
<td><xsl:value-of select="localaddr"/></td>
|
||||
<td><xsl:value-of select="remoteaddr"/></td>
|
||||
<td><xsl:value-of select="soatransport"/></td>
|
||||
<td><xsl:value-of select="transport"/></td>
|
||||
<td><xsl:value-of select="tsigkeyname"/></td>
|
||||
<td><xsl:value-of select="duration"/></td>
|
||||
<td><xsl:value-of select="nmsg"/></td>
|
||||
<td><xsl:value-of select="nrecs"/></td>
|
||||
<td><xsl:value-of select="nbytes"/></td>
|
||||
<td><xsl:value-of select="rate"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
<xsl:if test="memory/summary">
|
||||
<h2>Memory Usage Summary</h2>
|
||||
<table class="counters">
|
||||
|
||||
+91
-94
@@ -120,7 +120,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
|
||||
rdatalist->ttl = ttl;
|
||||
ISC_LIST_APPEND(node->lists, rdatalist, link);
|
||||
} else if (rdatalist->ttl != ttl) {
|
||||
return DNS_R_BADTTL;
|
||||
return (DNS_R_BADTTL);
|
||||
}
|
||||
|
||||
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
||||
@@ -136,7 +136,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
|
||||
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
|
||||
ISC_LIST_APPEND(node->buffers, rdatabuf, link);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -159,7 +159,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
|
||||
isc_constregion_t r = { .base = type, .length = strlen(type) };
|
||||
result = dns_rdatatype_fromtext(&typeval, (isc_textregion_t *)&r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_lex_create(mctx, 64, &lex);
|
||||
@@ -170,7 +170,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
|
||||
|
||||
result = isc_lex_openbuffer(lex, &b);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_buffer_allocate(mctx, &rb, DNS_RDATA_MAXLENGTH);
|
||||
@@ -185,7 +185,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
|
||||
|
||||
isc_buffer_free(&rb);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Reasonable default SOA values */
|
||||
@@ -207,9 +207,9 @@ putsoa(bdbnode_t *node, const char *mname, const char *rname, uint32_t serial) {
|
||||
serial, DEFAULT_REFRESH, DEFAULT_RETRY, DEFAULT_EXPIRE,
|
||||
DEFAULT_MINIMUM);
|
||||
if (n >= (int)sizeof(str) || n < 0) {
|
||||
return ISC_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
return putrr(node, "SOA", DEFAULT_TTL, str);
|
||||
return (putrr(node, "SOA", DEFAULT_TTL, str));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -222,7 +222,7 @@ puttxt(bdbnode_t *node, const char *text) {
|
||||
}
|
||||
buf[0] = len;
|
||||
memmove(&buf[1], text, len);
|
||||
return putrdata(node, dns_rdatatype_txt, 0, buf, len + 1);
|
||||
return (putrdata(node, dns_rdatatype_txt, 0, buf, len + 1));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -279,7 +279,7 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
|
||||
}
|
||||
}
|
||||
memmove(&rdata[j], "\07in-addr\04arpa", 14);
|
||||
return j + 14;
|
||||
return (j + 14);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -301,7 +301,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
zlen = zone->length;
|
||||
nlen = name->length;
|
||||
if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -320,11 +320,11 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
while (j != 0U) {
|
||||
INSIST((i / 2) < sizeof(v));
|
||||
if (ndata[0] != 1) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
n = hex16[ndata[1] & 0xff];
|
||||
if (n == 1) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
v[i / 2] = n | (v[i / 2] >> 4);
|
||||
j -= 2;
|
||||
@@ -346,14 +346,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 16U && v[(nlen - 1) / 4 - 4] != 0) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 8, rdata);
|
||||
break;
|
||||
@@ -363,14 +363,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 12U && v[(nlen - 1) / 4 - 3] != 0) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 6, rdata);
|
||||
break;
|
||||
@@ -380,14 +380,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 8U && v[(nlen - 1) / 4 - 2] != 0) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 5, rdata);
|
||||
break;
|
||||
@@ -397,14 +397,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (nlen > 4U && v[(nlen - 1) / 4 - 1] != 0) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 4, rdata);
|
||||
break;
|
||||
@@ -414,14 +414,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* to exist in the zone.
|
||||
*/
|
||||
if (v[(nlen - 1) / 4] != 0) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
/*
|
||||
* If the total length is not 74 then this is a empty node
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 3, rdata);
|
||||
break;
|
||||
@@ -431,7 +431,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* so return success.
|
||||
*/
|
||||
if (nlen + zlen != 74U) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
len = dns64_rdata(v, 0, rdata);
|
||||
break;
|
||||
@@ -440,7 +440,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
* This should never be reached unless someone adds a
|
||||
* zone declaration with this internal type to named.conf.
|
||||
*/
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -449,22 +449,22 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
|
||||
if ((v[0] == 170 || v[0] == 171) && v[1] == 0 && v[2] == 0 &&
|
||||
v[3] == 192)
|
||||
{
|
||||
return putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
|
||||
sizeof(ipv4only));
|
||||
return (putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
|
||||
sizeof(ipv4only)));
|
||||
}
|
||||
|
||||
return putrdata(node, dns_rdatatype_cname, 600, rdata,
|
||||
(unsigned int)len);
|
||||
return (putrdata(node, dns_rdatatype_cname, 600, rdata,
|
||||
(unsigned int)len));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
builtin_lookup(bdb_t *bdb, const dns_name_t *name, bdbnode_t *node) {
|
||||
if (name->labels == 0 && name->length == 0) {
|
||||
return bdb->lookup(node);
|
||||
return (bdb->lookup(node));
|
||||
} else if ((node->bdb->implementation->flags & BDB_DNS64) != 0) {
|
||||
return dns64_cname(&bdb->common.origin, name, node);
|
||||
return (dns64_cname(&bdb->common.origin, name, node));
|
||||
} else {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,27 +483,27 @@ builtin_authority(bdb_t *bdb, bdbnode_t *node) {
|
||||
|
||||
result = putsoa(node, server, contact, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
result = putrr(node, "NS", 0, server);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
version_lookup(bdbnode_t *node) {
|
||||
if (named_g_server->version_set) {
|
||||
if (named_g_server->version == NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
return puttxt(node, named_g_server->version);
|
||||
return (puttxt(node, named_g_server->version));
|
||||
}
|
||||
} else {
|
||||
return puttxt(node, PACKAGE_VERSION);
|
||||
return (puttxt(node, PACKAGE_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,16 +511,16 @@ static isc_result_t
|
||||
hostname_lookup(bdbnode_t *node) {
|
||||
if (named_g_server->hostname_set) {
|
||||
if (named_g_server->hostname == NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
return puttxt(node, named_g_server->hostname);
|
||||
return (puttxt(node, named_g_server->hostname));
|
||||
}
|
||||
} else {
|
||||
char buf[256];
|
||||
if (gethostname(buf, sizeof(buf)) != 0) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
return puttxt(node, buf);
|
||||
return (puttxt(node, buf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,33 +529,29 @@ authors_lookup(bdbnode_t *node) {
|
||||
isc_result_t result;
|
||||
const char **p = NULL;
|
||||
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", "Aydin Mercan",
|
||||
"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) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
for (p = authors; *p != NULL; p++) {
|
||||
result = puttxt(node, *p);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -563,13 +559,13 @@ id_lookup(bdbnode_t *node) {
|
||||
if (named_g_server->sctx->usehostname) {
|
||||
char buf[256];
|
||||
if (gethostname(buf, sizeof(buf)) != 0) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
return puttxt(node, buf);
|
||||
return (puttxt(node, buf));
|
||||
} else if (named_g_server->sctx->server_id != NULL) {
|
||||
return puttxt(node, named_g_server->sctx->server_id);
|
||||
return (puttxt(node, named_g_server->sctx->server_id));
|
||||
} else {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,7 +573,7 @@ static isc_result_t
|
||||
empty_lookup(bdbnode_t *node) {
|
||||
UNUSED(node);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -588,10 +584,10 @@ ipv4only_lookup(bdbnode_t *node) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
result = putrdata(node, dns_rdatatype_a, 3600, data[i], 4);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -600,7 +596,7 @@ ipv4reverse_lookup(bdbnode_t *node) {
|
||||
|
||||
result = putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
|
||||
sizeof(ipv4only));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -612,7 +608,7 @@ ipv4reverse_lookup(bdbnode_t *node) {
|
||||
*/
|
||||
static void
|
||||
disassociate(dns_rdataset_t *rdataset DNS__DB_FLARG) {
|
||||
dns_dbnode_t *node = rdataset->rdlist.node;
|
||||
dns_dbnode_t *node = rdataset->private5;
|
||||
bdbnode_t *bdbnode = (bdbnode_t *)node;
|
||||
dns_db_t *db = (dns_db_t *)bdbnode->bdb;
|
||||
|
||||
@@ -622,12 +618,13 @@ disassociate(dns_rdataset_t *rdataset DNS__DB_FLARG) {
|
||||
|
||||
static void
|
||||
rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target DNS__DB_FLARG) {
|
||||
dns_dbnode_t *node = source->rdlist.node;
|
||||
dns_dbnode_t *node = source->private5;
|
||||
bdbnode_t *bdbnode = (bdbnode_t *)node;
|
||||
dns_db_t *db = (dns_db_t *)bdbnode->bdb;
|
||||
|
||||
dns_rdatalist_clone(source, target DNS__DB_FLARG_PASS);
|
||||
attachnode(db, node, &target->rdlist.node DNS__DB_FLARG_PASS);
|
||||
attachnode(db, node,
|
||||
(dns_dbnode_t **)&target->private5 DNS__DB_FLARG_PASS);
|
||||
}
|
||||
|
||||
static dns_rdatasetmethods_t bdb_rdataset_methods = {
|
||||
@@ -647,7 +644,7 @@ new_rdataset(dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node,
|
||||
dns_rdatalist_tordataset(rdatalist, rdataset);
|
||||
|
||||
rdataset->methods = &bdb_rdataset_methods;
|
||||
dns_db_attachnode(db, node, &rdataset->rdlist.node);
|
||||
dns_db_attachnode(db, node, &rdataset->private5);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -670,10 +667,10 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
|
||||
bdbnode_t *bdbnode = (bdbnode_t *)iterator->node;
|
||||
|
||||
if (ISC_LIST_EMPTY(bdbnode->lists)) {
|
||||
return ISC_R_NOMORE;
|
||||
return (ISC_R_NOMORE);
|
||||
}
|
||||
bdbiterator->current = ISC_LIST_HEAD(bdbnode->lists);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -682,9 +679,9 @@ rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
|
||||
|
||||
bdbiterator->current = ISC_LIST_NEXT(bdbiterator->current, link);
|
||||
if (bdbiterator->current == NULL) {
|
||||
return ISC_R_NOMORE;
|
||||
return (ISC_R_NOMORE);
|
||||
} else {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,7 +784,7 @@ createnode(bdb_t *bdb, bdbnode_t **nodep) {
|
||||
node->magic = BDBNODE_MAGIC;
|
||||
|
||||
*nodep = node;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -844,23 +841,23 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
|
||||
|
||||
result = createnode(bdb, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = builtin_lookup(bdb, name, node);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
|
||||
destroynode(node);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = builtin_authority(bdb, node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
destroynode(node);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
*nodep = node;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -887,26 +884,26 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
|
||||
|
||||
result = createnode(bdb, &node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = builtin_lookup(bdb, name, node);
|
||||
if (result != ISC_R_SUCCESS && (!isorigin || result != ISC_R_NOTFOUND))
|
||||
{
|
||||
destroynode(node);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
if (isorigin) {
|
||||
result = builtin_authority(bdb, node);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
destroynode(node);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
*nodep = node;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -928,7 +925,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
||||
REQUIRE(version == NULL || version == (void *)&dummy);
|
||||
|
||||
if (!dns_name_issubdomain(name, &db->origin)) {
|
||||
return DNS_R_NXDOMAIN;
|
||||
return (DNS_R_NXDOMAIN);
|
||||
}
|
||||
|
||||
olabels = dns_name_countlabels(&db->origin);
|
||||
@@ -954,13 +951,13 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
||||
* No data at zone apex?
|
||||
*/
|
||||
if (i == olabels) {
|
||||
return DNS_R_BADDB;
|
||||
return (DNS_R_BADDB);
|
||||
}
|
||||
result = DNS_R_NXDOMAIN;
|
||||
continue;
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1069,7 +1066,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
||||
detachnode(db, &node DNS__DB_FLARG_PASS);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1117,7 +1114,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
UNUSED(sigrdataset);
|
||||
|
||||
if (type == dns_rdatatype_rrsig) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
list = ISC_LIST_HEAD(bdbnode->lists);
|
||||
@@ -1128,12 +1125,12 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
list = ISC_LIST_NEXT(list, link);
|
||||
}
|
||||
if (list == NULL) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
new_rdataset(list, db, node, rdataset);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1158,7 +1155,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
|
||||
*iteratorp = (dns_rdatasetiter_t *)iterator;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static dns_dbmethods_t bdb_methods = {
|
||||
@@ -1186,7 +1183,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
||||
REQUIRE(implementation != NULL);
|
||||
|
||||
if (type != dns_dbtype_zone) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
bdb = isc_mem_get(mctx, sizeof(*bdb));
|
||||
@@ -1241,7 +1238,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
||||
|
||||
*dbp = (dns_db_t *)bdb;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
dns_name_free(&bdb->common.origin, mctx);
|
||||
@@ -1253,7 +1250,7 @@ cleanup:
|
||||
}
|
||||
|
||||
isc_mem_putanddetach(&bdb->common.mctx, bdb, sizeof(bdb_t));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1269,17 +1266,17 @@ named_builtin_init(void) {
|
||||
result = dns_db_register("_builtin", create, &builtin, named_g_mctx,
|
||||
&builtin.dbimp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_db_register("_dns64", create, &dns64, named_g_mctx,
|
||||
&dns64.dbimp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_unregister(&builtin.dbimp);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+132
-93
@@ -67,6 +67,7 @@ options {\n\
|
||||
interface-interval 60;\n\
|
||||
listen-on {any;};\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\
|
||||
@@ -96,12 +97,10 @@ options {\n\
|
||||
#endif
|
||||
"\
|
||||
prefetch 2 9;\n\
|
||||
# querylog <boolean>;\n\
|
||||
recursing-file \"named.recursing\";\n\
|
||||
recursive-clients 1000;\n\
|
||||
request-nsid false;\n\
|
||||
resolver-query-timeout 10;\n\
|
||||
# responselog <boolean>;\n\
|
||||
rrset-order { order random; };\n\
|
||||
secroots-file \"named.secroots\";\n\
|
||||
send-cookie true;\n\
|
||||
@@ -111,9 +110,6 @@ options {\n\
|
||||
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
|
||||
session-keyname local-ddns;\n\
|
||||
startup-notify-rate 20;\n\
|
||||
sig0checks-quota 1;\n\
|
||||
sig0key-checks-limit 16;\n\
|
||||
sig0message-checks-limit 2;\n\
|
||||
statistics-file \"named.stats\";\n\
|
||||
tcp-advertised-timeout 300;\n\
|
||||
tcp-clients 150;\n\
|
||||
@@ -137,8 +133,6 @@ options {\n\
|
||||
/* view */\n\
|
||||
allow-new-zones no;\n\
|
||||
allow-notify {none;};\n\
|
||||
allow-proxy {none;};\n\
|
||||
allow-proxy-on {any;};\n\
|
||||
allow-query-cache { localnets; localhost; };\n\
|
||||
allow-query-cache-on { any; };\n\
|
||||
allow-recursion { localnets; localhost; };\n\
|
||||
@@ -174,9 +168,7 @@ options {\n\
|
||||
max-clients-per-query 100;\n\
|
||||
max-ncache-ttl 10800; /* 3 hours */\n\
|
||||
max-recursion-depth 7;\n\
|
||||
max-recursion-queries 50;\n\
|
||||
max-query-count 200;\n\
|
||||
max-query-restarts 11;\n\
|
||||
max-recursion-queries 100;\n\
|
||||
max-stale-ttl 86400; /* 1 day */\n\
|
||||
message-compression yes;\n\
|
||||
min-ncache-ttl 0; /* 0 hours */\n\
|
||||
@@ -196,6 +188,8 @@ options {\n\
|
||||
request-expire true;\n\
|
||||
request-ixfr true;\n\
|
||||
require-server-cookie no;\n\
|
||||
resolver-nonbackoff-tries 3;\n\
|
||||
resolver-retry-interval 800; /* in milliseconds */\n\
|
||||
root-key-sentinel yes;\n\
|
||||
servfail-ttl 1;\n\
|
||||
# sortlist <none>\n\
|
||||
@@ -207,14 +201,13 @@ options {\n\
|
||||
synth-from-dnssec yes;\n\
|
||||
# topology <none>\n\
|
||||
transfer-format many-answers;\n\
|
||||
resolver-use-dns64 false;\n\
|
||||
v6-bias 50;\n\
|
||||
zero-no-soa-ttl-cache no;\n\
|
||||
\n\
|
||||
/* zone */\n\
|
||||
allow-query {any;};\n\
|
||||
allow-query-on {any;};\n\
|
||||
allow-transfer {none;};\n\
|
||||
allow-transfer {any;};\n\
|
||||
# also-notify <none>\n\
|
||||
check-integrity yes;\n\
|
||||
check-mx-cname warn;\n\
|
||||
@@ -222,24 +215,23 @@ options {\n\
|
||||
check-srv-cname warn;\n\
|
||||
check-wildcard yes;\n\
|
||||
dialup no;\n\
|
||||
dnssec-dnskey-kskonly yes;\n\
|
||||
dnssec-loadkeys-interval 60;\n\
|
||||
dnssec-update-mode maintain;\n\
|
||||
# forward <none>\n\
|
||||
# forwarders <none>\n\
|
||||
# inline-signing no;\n\
|
||||
ixfr-from-differences false;\n\
|
||||
max-journal-size default;\n\
|
||||
max-records 0;\n\
|
||||
max-records-per-type 100;\n\
|
||||
max-refresh-time 2419200; /* 4 weeks */\n\
|
||||
max-retry-time 1209600; /* 2 weeks */\n\
|
||||
max-types-per-name 100;\n\
|
||||
max-transfer-idle-in 60;\n\
|
||||
max-transfer-idle-out 60;\n\
|
||||
max-transfer-time-in 120;\n\
|
||||
max-transfer-time-out 120;\n\
|
||||
min-refresh-time 300;\n\
|
||||
min-retry-time 500;\n\
|
||||
min-transfer-rate-in 10240 5;\n\
|
||||
multi-master no;\n\
|
||||
notify yes;\n\
|
||||
notify-delay 5;\n\
|
||||
@@ -248,9 +240,12 @@ options {\n\
|
||||
sig-signing-nodes 100;\n\
|
||||
sig-signing-signatures 10;\n\
|
||||
sig-signing-type 65534;\n\
|
||||
sig-validity-interval 30; /* days */\n\
|
||||
dnskey-sig-validity 0; /* default: sig-validity-interval */\n\
|
||||
transfer-source *;\n\
|
||||
transfer-source-v6 *;\n\
|
||||
try-tcp-refresh yes; /* BIND 8 compat */\n\
|
||||
update-check-ksk yes;\n\
|
||||
zero-no-soa-ttl yes;\n\
|
||||
zone-statistics terse;\n\
|
||||
};\n\
|
||||
@@ -304,12 +299,9 @@ dnssec-policy \"default\" {\n\
|
||||
cdnskey yes;\n\
|
||||
cds-digest-types { 2; };\n\
|
||||
dnskey-ttl " DNS_KASP_KEY_TTL ";\n\
|
||||
inline-signing yes;\n\
|
||||
offline-ksk no;\n\
|
||||
publish-safety " DNS_KASP_PUBLISH_SAFETY "; \n\
|
||||
retire-safety " DNS_KASP_RETIRE_SAFETY "; \n\
|
||||
purge-keys " DNS_KASP_PURGE_KEYS "; \n\
|
||||
signatures-jitter " DNS_KASP_SIG_JITTER "; \n\
|
||||
signatures-refresh " DNS_KASP_SIG_REFRESH "; \n\
|
||||
signatures-validity " DNS_KASP_SIG_VALIDITY "; \n\
|
||||
signatures-validity-dnskey " DNS_KASP_SIG_VALIDITY_DNSKEY "; \n\
|
||||
@@ -320,9 +312,7 @@ dnssec-policy \"default\" {\n\
|
||||
};\n\
|
||||
\n\
|
||||
dnssec-policy \"insecure\" {\n\
|
||||
max-zone-ttl 0; \n\
|
||||
keys { };\n\
|
||||
inline-signing yes;\n\
|
||||
};\n\
|
||||
\n\
|
||||
"
|
||||
@@ -338,15 +328,15 @@ dnssec-policy \"insecure\" {\n\
|
||||
|
||||
"# END TRUST ANCHORS\n\
|
||||
\n\
|
||||
remote-servers " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
|
||||
2801:1b8:10::b; # b.root-servers.net\n\
|
||||
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
|
||||
2001:500:200::b; # b.root-servers.net\n\
|
||||
2001:500:2::c; # c.root-servers.net\n\
|
||||
2001:500:2f::f; # f.root-servers.net\n\
|
||||
2001:500:12::d0d; # g.root-servers.net\n\
|
||||
2001:7fd::1; # k.root-servers.net\n\
|
||||
2620:0:2830:202::132; # xfr.cjr.dns.icann.org\n\
|
||||
2620:0:2d0:202::132; # xfr.lax.dns.icann.org\n\
|
||||
170.247.170.2; # b.root-servers.net\n\
|
||||
199.9.14.201; # b.root-servers.net\n\
|
||||
192.33.4.12; # c.root-servers.net\n\
|
||||
192.5.5.241; # f.root-servers.net\n\
|
||||
192.112.36.4; # g.root-servers.net\n\
|
||||
@@ -362,15 +352,13 @@ 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,
|
||||
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
|
||||
CFG_PCTX_NOEXPERIMENTAL,
|
||||
conf);
|
||||
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
|
||||
CFG_PCTX_NODEPRECATED, conf));
|
||||
}
|
||||
|
||||
const char *
|
||||
named_config_getdefault(void) {
|
||||
return defaultconf;
|
||||
return (defaultconf);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -380,10 +368,10 @@ named_config_get(cfg_obj_t const *const *maps, const char *name,
|
||||
|
||||
for (i = 0; maps[i] != NULL; i++) {
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -409,7 +397,7 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
|
||||
*/
|
||||
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
||||
*obj = checknames;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
for (element = cfg_list_first(checknames);
|
||||
element != NULL; element = cfg_list_next(element))
|
||||
@@ -423,13 +411,13 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
|
||||
{
|
||||
*obj = cfg_tuple_get(value,
|
||||
"mode");
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -441,7 +429,7 @@ named_config_listcount(const cfg_obj_t *list) {
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
return (i);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -452,7 +440,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
*classp = defclass;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
r.base = UNCONST(cfg_obj_asstring(classobj));
|
||||
r.length = strlen(r.base);
|
||||
@@ -461,7 +449,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
cfg_obj_log(classobj, named_g_lctx, ISC_LOG_ERROR,
|
||||
"unknown class '%s'", r.base);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -472,7 +460,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
|
||||
|
||||
if (!cfg_obj_isstring(typeobj)) {
|
||||
*typep = deftype;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
r.base = UNCONST(cfg_obj_asstring(typeobj));
|
||||
r.length = strlen(r.base);
|
||||
@@ -481,7 +469,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
|
||||
cfg_obj_log(typeobj, named_g_lctx, ISC_LOG_ERROR,
|
||||
"unknown type '%s'", r.base);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_zonetype_t
|
||||
@@ -507,12 +495,12 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
return ztype;
|
||||
return (ztype);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
|
||||
const char *name, const cfg_obj_t **ret) {
|
||||
static isc_result_t
|
||||
getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
|
||||
const cfg_obj_t **ret) {
|
||||
isc_result_t result;
|
||||
const cfg_obj_t *obj = NULL;
|
||||
const cfg_listelt_t *elt;
|
||||
@@ -523,7 +511,7 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
|
||||
|
||||
result = cfg_map_get(cctx, list, &obj);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
elt = cfg_list_first(obj);
|
||||
while (elt != NULL) {
|
||||
@@ -532,11 +520,28 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
|
||||
name) == 0)
|
||||
{
|
||||
*ret = obj;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
elt = cfg_list_next(elt);
|
||||
}
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
|
||||
const char *name, const cfg_obj_t **ret) {
|
||||
isc_result_t result;
|
||||
|
||||
if (strcmp(list, "parental-agents") == 0) {
|
||||
return (getremotesdef(cctx, list, name, ret));
|
||||
} else if (strcmp(list, "primaries") == 0) {
|
||||
result = getremotesdef(cctx, list, name, ret);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = getremotesdef(cctx, "masters", name, ret);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -551,7 +556,7 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
|
||||
|
||||
if (!cfg_obj_isstring(obj)) {
|
||||
*namep = NULL;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
*namep = isc_mem_get(mctx, sizeof(**namep));
|
||||
@@ -566,33 +571,35 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, *namep, sizeof(**namep));
|
||||
*namep = NULL;
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
dns_name_dup(dns_fixedname_name(&fname), mctx, *namep);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
#define grow_array(mctx, array, newlen, oldlen) \
|
||||
if (newlen >= oldlen) { \
|
||||
array = isc_mem_creget(mctx, array, oldlen, newlen + 16, \
|
||||
sizeof(array[0])); \
|
||||
oldlen = newlen + 16; \
|
||||
#define grow_array(mctx, array, newlen, oldlen) \
|
||||
if (newlen >= oldlen) { \
|
||||
size_t newsize = (newlen + 16) * sizeof(array[0]); \
|
||||
size_t oldsize = oldlen * sizeof(array[0]); \
|
||||
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
|
||||
ISC_MEM_ZERO); \
|
||||
oldlen = newlen + 16; \
|
||||
}
|
||||
|
||||
#define shrink_array(mctx, array, newlen, oldlen) \
|
||||
if (newlen < oldlen) { \
|
||||
array = isc_mem_creget(mctx, array, oldlen, newlen, \
|
||||
sizeof(array[0])); \
|
||||
oldlen = newlen; \
|
||||
#define shrink_array(mctx, array, newlen, oldlen) \
|
||||
if (newlen < oldlen) { \
|
||||
size_t newsize = newlen * sizeof(array[0]); \
|
||||
size_t oldsize = oldlen * sizeof(array[0]); \
|
||||
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
|
||||
ISC_MEM_ZERO); \
|
||||
oldlen = newlen; \
|
||||
}
|
||||
|
||||
static const char *remotesnames[4] = { "remote-servers", "parental-agents",
|
||||
"primaries", "masters" };
|
||||
|
||||
isc_result_t
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
|
||||
const cfg_obj_t *list, isc_mem_t *mctx,
|
||||
dns_ipkeylist_t *ipkl) {
|
||||
uint32_t addrcount = 0, srccount = 0;
|
||||
uint32_t keycount = 0, tlscount = 0;
|
||||
uint32_t listcount = 0, l = 0, i = 0;
|
||||
@@ -675,6 +682,8 @@ newlist:
|
||||
isc_sockaddr_any6(&src6);
|
||||
}
|
||||
|
||||
result = ISC_R_NOMEMORY;
|
||||
|
||||
element = cfg_list_first(addrlist);
|
||||
resume:
|
||||
for (; element != NULL; element = cfg_list_next(element)) {
|
||||
@@ -705,22 +714,17 @@ resume:
|
||||
continue;
|
||||
}
|
||||
list = NULL;
|
||||
tresult = ISC_R_NOTFOUND;
|
||||
for (size_t n = 0; n < ARRAY_SIZE(remotesnames); n++) {
|
||||
tresult = named_config_getremotesdef(
|
||||
config, remotesnames[n], listname,
|
||||
&list);
|
||||
if (tresult == ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tresult = named_config_getremotesdef(config, listtype,
|
||||
listname, &list);
|
||||
if (tresult == ISC_R_NOTFOUND) {
|
||||
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
|
||||
"remote-servers \"%s\" not found",
|
||||
"%s \"%s\" not found", listtype,
|
||||
listname);
|
||||
|
||||
result = tresult;
|
||||
goto cleanup;
|
||||
}
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
goto cleanup;
|
||||
}
|
||||
lists[l++].name = listname;
|
||||
@@ -806,10 +810,10 @@ resume:
|
||||
shrink_array(mctx, sources, i, srccount);
|
||||
|
||||
if (lists != NULL) {
|
||||
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
|
||||
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
|
||||
}
|
||||
if (stack != NULL) {
|
||||
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
|
||||
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
|
||||
}
|
||||
|
||||
INSIST(keycount == addrcount);
|
||||
@@ -823,11 +827,11 @@ resume:
|
||||
ipkl->count = addrcount;
|
||||
ipkl->allocated = addrcount;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (addrs != NULL) {
|
||||
isc_mem_cput(mctx, addrs, addrcount, sizeof(addrs[0]));
|
||||
isc_mem_put(mctx, addrs, addrcount * sizeof(addrs[0]));
|
||||
}
|
||||
if (keys != NULL) {
|
||||
for (size_t j = 0; j < i; j++) {
|
||||
@@ -839,7 +843,7 @@ cleanup:
|
||||
}
|
||||
isc_mem_put(mctx, keys[j], sizeof(*keys[j]));
|
||||
}
|
||||
isc_mem_cput(mctx, keys, keycount, sizeof(keys[0]));
|
||||
isc_mem_put(mctx, keys, keycount * sizeof(keys[0]));
|
||||
}
|
||||
if (tlss != NULL) {
|
||||
for (size_t j = 0; j < i; j++) {
|
||||
@@ -851,18 +855,18 @@ cleanup:
|
||||
}
|
||||
isc_mem_put(mctx, tlss[j], sizeof(*tlss[j]));
|
||||
}
|
||||
isc_mem_cput(mctx, tlss, tlscount, sizeof(tlss[0]));
|
||||
isc_mem_put(mctx, tlss, tlscount * sizeof(tlss[0]));
|
||||
}
|
||||
if (sources != NULL) {
|
||||
isc_mem_cput(mctx, sources, srccount, sizeof(sources[0]));
|
||||
isc_mem_put(mctx, sources, srccount * sizeof(sources[0]));
|
||||
}
|
||||
if (lists != NULL) {
|
||||
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
|
||||
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
|
||||
}
|
||||
if (stack != NULL) {
|
||||
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
|
||||
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -888,10 +892,10 @@ named_config_getport(const cfg_obj_t *config, const char *type,
|
||||
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
||||
"port '%u' out of range",
|
||||
cfg_obj_asuint32(portobj));
|
||||
return ISC_R_RANGE;
|
||||
return (ISC_R_RANGE);
|
||||
}
|
||||
*portp = (in_port_t)cfg_obj_asuint32(portobj);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
struct keyalgorithms {
|
||||
@@ -918,8 +922,14 @@ struct keyalgorithms {
|
||||
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 } };
|
||||
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
|
||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||
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) {
|
||||
int i;
|
||||
size_t len = 0;
|
||||
uint16_t bits;
|
||||
@@ -935,22 +945,51 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
|
||||
}
|
||||
}
|
||||
if (algorithms[i].str == NULL) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
if (str[len] == '-') {
|
||||
result = isc_parse_uint16(&bits, str + len + 1, 10);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
if (bits > algorithms[i].size) {
|
||||
return ISC_R_RANGE;
|
||||
return (ISC_R_RANGE);
|
||||
}
|
||||
} else if (algorithms[i].size == 0) {
|
||||
bits = 128;
|
||||
} else {
|
||||
bits = algorithms[i].size;
|
||||
}
|
||||
SET_IF_NOT_NULL(typep, algorithms[i].type);
|
||||
SET_IF_NOT_NULL(digestbits, bits);
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
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;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
if (typep != NULL) {
|
||||
*typep = algorithms[i].type;
|
||||
}
|
||||
if (digestbits != NULL) {
|
||||
*digestbits = bits;
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
+10
-21
@@ -43,23 +43,23 @@ getcommand(isc_lex_t *lex, char **cmdp) {
|
||||
|
||||
result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_lex_ungettoken(lex, &token);
|
||||
|
||||
if (token.type != isc_tokentype_string) {
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
*cmdp = token.value.as_textregion.base;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static bool
|
||||
command_compare(const char *str, const char *command) {
|
||||
return strcasecmp(str, command) == 0;
|
||||
return (strcasecmp(str, command) == 0);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -85,7 +85,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
/*
|
||||
* No data section.
|
||||
*/
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
result = isccc_cc_lookupstring(data, "type", &cmdline);
|
||||
@@ -93,7 +93,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
/*
|
||||
* We have no idea what this is.
|
||||
*/
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
|
||||
@@ -177,7 +177,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
/* Do not flush master files */
|
||||
named_server_flushonshutdown(named_g_server, false);
|
||||
named_os_shutdownmsg(cmdline, *text);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
} else if (command_compare(command, NAMED_COMMAND_STOP)) {
|
||||
/*
|
||||
@@ -195,7 +194,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
named_server_flushonshutdown(named_g_server, true);
|
||||
named_os_shutdownmsg(cmdline, *text);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
} else if (command_compare(command, NAMED_COMMAND_ADDZONE) ||
|
||||
command_compare(command, NAMED_COMMAND_MODZONE))
|
||||
@@ -210,7 +208,8 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
{
|
||||
result = named_server_dnstap(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
|
||||
result = named_server_dumpdb(named_g_server, lex, text);
|
||||
named_server_dumpdb(named_g_server, lex, text);
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
|
||||
result = named_server_dumpstats(named_g_server);
|
||||
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {
|
||||
@@ -223,14 +222,10 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
result = named_server_flushnode(named_g_server, lex, true);
|
||||
} 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_SKR)) {
|
||||
result = named_server_skr(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_LOADKEYS) ||
|
||||
command_compare(command, NAMED_COMMAND_SIGN))
|
||||
{
|
||||
result = named_server_rekey(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_MEMPROF)) {
|
||||
result = named_server_togglememprof(lex);
|
||||
} else if (command_compare(command, NAMED_COMMAND_MKEYS)) {
|
||||
result = named_server_mkeys(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_NOTIFY)) {
|
||||
@@ -244,9 +239,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
} else if (command_compare(command, NAMED_COMMAND_NULL)) {
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NAMED_COMMAND_QUERYLOG)) {
|
||||
result = named_server_setortoggle(named_g_server,
|
||||
"query logging",
|
||||
NS_SERVER_LOGQUERIES, lex);
|
||||
result = named_server_togglequerylog(named_g_server, lex);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RECONFIG)) {
|
||||
result = named_server_reconfigcommand(named_g_server);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RECURSING)) {
|
||||
@@ -255,10 +248,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
||||
result = named_server_refreshcommand(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RELOAD)) {
|
||||
result = named_server_reloadcommand(named_g_server, lex, text);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RESPONSELOG)) {
|
||||
result = named_server_setortoggle(named_g_server,
|
||||
"response logging",
|
||||
NS_SERVER_LOGRESPONSES, lex);
|
||||
} else if (command_compare(command, NAMED_COMMAND_RETRANSFER)) {
|
||||
result = named_server_retransfercommand(named_g_server, lex,
|
||||
text);
|
||||
@@ -303,5 +292,5 @@ cleanup:
|
||||
isc_lex_destroy(&lex);
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
+255
-170
@@ -49,7 +49,7 @@
|
||||
#include <named/main.h>
|
||||
#include <named/server.h>
|
||||
|
||||
/* Add -DNAMED_CONTROLCONF_TRACE=1 to CFLAGS for detailed reference tracing */
|
||||
#undef NAMED_CONTROLCONF_TRACE
|
||||
|
||||
typedef struct controlkey controlkey_t;
|
||||
typedef ISC_LIST(controlkey_t) controlkeylist_t;
|
||||
@@ -91,9 +91,10 @@ struct controllistener {
|
||||
isc_sockaddr_t address;
|
||||
isc_nmsocket_t *sock;
|
||||
dns_acl_t *acl;
|
||||
bool shuttingdown;
|
||||
bool exiting;
|
||||
isc_refcount_t references;
|
||||
controlkeylist_t keys;
|
||||
isc_mutex_t connections_lock;
|
||||
controlconnectionlist_t connections;
|
||||
isc_socktype_t type;
|
||||
uint32_t perm;
|
||||
@@ -119,8 +120,6 @@ static void
|
||||
conn_cleanup(controlconnection_t *conn);
|
||||
static void
|
||||
conn_free(controlconnection_t *conn);
|
||||
static void
|
||||
conn_shutdown(controlconnection_t *conn);
|
||||
|
||||
#if NAMED_CONTROLCONF_TRACE
|
||||
#define controllistener_ref(ptr) \
|
||||
@@ -149,14 +148,6 @@ ISC_REFCOUNT_DECL(controlconnection);
|
||||
|
||||
#define CLOCKSKEW 300
|
||||
|
||||
#define CHECK(x) \
|
||||
{ \
|
||||
result = (x); \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
|
||||
static void
|
||||
free_controlkey(controlkey_t *key, isc_mem_t *mctx) {
|
||||
if (key->keyname != NULL) {
|
||||
@@ -179,8 +170,11 @@ free_controlkeylist(controlkeylist_t *keylist, isc_mem_t *mctx) {
|
||||
|
||||
static void
|
||||
free_listener(controllistener_t *listener) {
|
||||
REQUIRE(listener->shuttingdown);
|
||||
REQUIRE(ISC_LIST_EMPTY(listener->connections));
|
||||
INSIST(listener->exiting);
|
||||
INSIST(ISC_LIST_EMPTY(listener->connections));
|
||||
|
||||
isc_refcount_destroy(&listener->references);
|
||||
|
||||
REQUIRE(listener->sock == NULL);
|
||||
|
||||
free_controlkeylist(&listener->keys, listener->mctx);
|
||||
@@ -188,6 +182,7 @@ free_listener(controllistener_t *listener) {
|
||||
if (listener->acl != NULL) {
|
||||
dns_acl_detach(&listener->acl);
|
||||
}
|
||||
isc_mutex_destroy(&listener->connections_lock);
|
||||
|
||||
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
|
||||
}
|
||||
@@ -202,32 +197,32 @@ ISC_REFCOUNT_IMPL(controlconnection, conn_free);
|
||||
|
||||
static void
|
||||
shutdown_listener(controllistener_t *listener) {
|
||||
controlconnection_t *conn = NULL;
|
||||
controlconnection_t *next = NULL;
|
||||
if (!listener->exiting) {
|
||||
char socktext[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
/* Don't shutdown the same listener twice */
|
||||
if (listener->shuttingdown) {
|
||||
return;
|
||||
for (controlconnection_t *conn =
|
||||
ISC_LIST_HEAD(listener->connections);
|
||||
conn != NULL; conn = ISC_LIST_HEAD(listener->connections))
|
||||
{
|
||||
control_recvmessage(conn->ccmsg.handle,
|
||||
ISC_R_SHUTTINGDOWN, conn);
|
||||
}
|
||||
|
||||
ISC_LIST_UNLINK(listener->controls->listeners, listener, link);
|
||||
|
||||
isc_sockaddr_format(&listener->address, socktext,
|
||||
sizeof(socktext));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
|
||||
"stopping command channel on %s", socktext);
|
||||
#if 0
|
||||
/* XXX: no unix domain socket support */
|
||||
if (listener->type == isc_socktype_unix) {
|
||||
isc_socket_cleanunix(&listener->address, true);
|
||||
}
|
||||
#endif
|
||||
listener->exiting = true;
|
||||
}
|
||||
listener->shuttingdown = true;
|
||||
|
||||
for (conn = ISC_LIST_HEAD(listener->connections); conn != NULL;
|
||||
conn = next)
|
||||
{
|
||||
/*
|
||||
* 'conn' is likely to be freed by the conn_shutdown() call.
|
||||
*/
|
||||
next = ISC_LIST_NEXT(conn, link);
|
||||
conn_shutdown(conn);
|
||||
}
|
||||
|
||||
ISC_LIST_UNLINK(listener->controls->listeners, listener, link);
|
||||
|
||||
char socktext[ISC_SOCKADDR_FORMATSIZE];
|
||||
isc_sockaddr_format(&listener->address, socktext, sizeof(socktext));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
|
||||
"stopping command channel on %s", socktext);
|
||||
|
||||
isc_nm_stoplistening(listener->sock);
|
||||
isc_nmsocket_close(&listener->sock);
|
||||
@@ -242,46 +237,48 @@ address_ok(isc_sockaddr_t *sockaddr, controllistener_t *listener) {
|
||||
isc_result_t result;
|
||||
int match;
|
||||
|
||||
/* ACL doesn't apply to unix domain sockets */
|
||||
if (listener->type != isc_socktype_tcp) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
|
||||
|
||||
result = dns_acl_match(&netaddr, NULL, listener->acl, env, &match,
|
||||
NULL);
|
||||
return result == ISC_R_SUCCESS && match > 0;
|
||||
return (result == ISC_R_SUCCESS && match > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
control_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
||||
controlconnection_t *conn = (controlconnection_t *)arg;
|
||||
controllistener_t *listener = conn->listener;
|
||||
isc_sockaddr_t peeraddr = isc_nmhandle_peeraddr(handle);
|
||||
|
||||
if (conn->shuttingdown) {
|
||||
/* The connection is shuttingdown */
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
if (conn->result == ISC_R_SHUTTINGDOWN) {
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
goto cleanup_sendhandle;
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
/* Everything is peachy, continue reading from the socket */
|
||||
isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage,
|
||||
conn);
|
||||
/* Detach the sending reference */
|
||||
controlconnection_detach(&conn);
|
||||
return;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SHUTTINGDOWN) {
|
||||
if (listener->controls->shuttingdown || result == ISC_R_SHUTTINGDOWN) {
|
||||
goto cleanup_sendhandle;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
char socktext[ISC_SOCKADDR_FORMATSIZE];
|
||||
isc_sockaddr_t peeraddr = isc_nmhandle_peeraddr(handle);
|
||||
|
||||
isc_sockaddr_format(&peeraddr, socktext, sizeof(socktext));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
|
||||
"error sending command response to %s: %s",
|
||||
socktext, isc_result_totext(result));
|
||||
goto cleanup_sendhandle;
|
||||
}
|
||||
|
||||
/* Shutdown the reading */
|
||||
conn_shutdown(conn);
|
||||
isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage, conn);
|
||||
|
||||
/* Detach the sending reference */
|
||||
cleanup_sendhandle:
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
control_recvmessage(handle, result, conn);
|
||||
}
|
||||
controlconnection_detach(&conn);
|
||||
}
|
||||
|
||||
@@ -388,7 +385,6 @@ control_respond(controlconnection_t *conn) {
|
||||
r.base = conn->buffer->base;
|
||||
r.length = conn->buffer->used;
|
||||
|
||||
/* Attach the sending reference */
|
||||
controlconnection_ref(conn);
|
||||
isccc_ccmsg_sendmessage(&conn->ccmsg, &r, control_senddone, conn);
|
||||
|
||||
@@ -399,33 +395,13 @@ cleanup:
|
||||
static void
|
||||
control_command(void *arg) {
|
||||
controlconnection_t *conn = (controlconnection_t *)arg;
|
||||
controllistener_t *listener = conn->listener;
|
||||
|
||||
/* Don't run the command if we already started the shutdown */
|
||||
if (!conn->shuttingdown) {
|
||||
if (!listener->controls->shuttingdown) {
|
||||
conn->result = named_control_docommand(
|
||||
conn->request, conn->listener->readonly, &conn->text);
|
||||
conn->request, listener->readonly, &conn->text);
|
||||
control_respond(conn);
|
||||
}
|
||||
|
||||
/* Detach the control command reference */
|
||||
controlconnection_detach(&conn);
|
||||
}
|
||||
|
||||
static void
|
||||
conn_shutdown(controlconnection_t *conn) {
|
||||
/* Don't shutdown the same controlconnection twice */
|
||||
if (conn->shuttingdown) {
|
||||
return;
|
||||
}
|
||||
conn->shuttingdown = true;
|
||||
|
||||
/*
|
||||
* Close the TCP connection to make sure that no read callback will be
|
||||
* called for it ever again.
|
||||
*/
|
||||
isccc_ccmsg_disconnect(&conn->ccmsg);
|
||||
|
||||
/* Detach the reading reference */
|
||||
controlconnection_detach(&conn);
|
||||
}
|
||||
|
||||
@@ -439,7 +415,21 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
isccc_time_t exp;
|
||||
uint32_t nonce;
|
||||
|
||||
if (conn->shuttingdown) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Is the server shutting down? */
|
||||
if (listener->controls->shuttingdown) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SHUTTINGDOWN) {
|
||||
listener->controls->shuttingdown = true;
|
||||
} else if (result != ISC_R_EOF) {
|
||||
log_invalid(&conn->ccmsg, result);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -465,13 +455,13 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
}
|
||||
|
||||
if (key == NULL) {
|
||||
result = ISCCC_R_BADAUTH;
|
||||
log_invalid(&conn->ccmsg, ISCCC_R_BADAUTH);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* We shouldn't be getting a reply. */
|
||||
if (isccc_cc_isreply(conn->request)) {
|
||||
result = ISC_R_FAILURE;
|
||||
log_invalid(&conn->ccmsg, ISC_R_FAILURE);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -482,7 +472,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
*/
|
||||
conn->ctrl = isccc_alist_lookup(conn->request, "_ctrl");
|
||||
if (!isccc_alist_alistp(conn->ctrl)) {
|
||||
result = ISC_R_FAILURE;
|
||||
log_invalid(&conn->ccmsg, ISC_R_FAILURE);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -490,11 +480,11 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
if ((sent + CLOCKSKEW) < conn->now ||
|
||||
(sent - CLOCKSKEW) > conn->now)
|
||||
{
|
||||
result = ISCCC_R_CLOCKSKEW;
|
||||
log_invalid(&conn->ccmsg, ISCCC_R_CLOCKSKEW);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
result = ISC_R_FAILURE;
|
||||
log_invalid(&conn->ccmsg, ISC_R_FAILURE);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -504,7 +494,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS &&
|
||||
conn->now > exp)
|
||||
{
|
||||
result = ISCCC_R_EXPIRED;
|
||||
log_invalid(&conn->ccmsg, ISCCC_R_EXPIRED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -520,6 +510,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
if (result == ISC_R_EXISTS) {
|
||||
result = ISCCC_R_DUPLICATE;
|
||||
}
|
||||
log_invalid(&conn->ccmsg, result);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -528,7 +519,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
ISC_R_SUCCESS ||
|
||||
conn->nonce != nonce))
|
||||
{
|
||||
result = ISCCC_R_BADAUTH;
|
||||
log_invalid(&conn->ccmsg, ISCCC_R_BADAUTH);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -546,48 +537,40 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Attach the command reference */
|
||||
/*
|
||||
* Trigger the command.
|
||||
*/
|
||||
controlconnection_ref(conn);
|
||||
|
||||
/* Trigger the command asynchronously. */
|
||||
isc_async_run(named_g_mainloop, control_command, conn);
|
||||
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
switch (result) {
|
||||
case ISC_R_SHUTTINGDOWN:
|
||||
case ISC_R_EOF:
|
||||
break;
|
||||
default:
|
||||
log_invalid(&conn->ccmsg, result);
|
||||
}
|
||||
|
||||
conn_shutdown(conn);
|
||||
conn->shuttingdown = true;
|
||||
controlconnection_detach(&conn);
|
||||
}
|
||||
|
||||
static void
|
||||
conn_free(controlconnection_t *conn) {
|
||||
/* Make sure that the connection was shutdown first */
|
||||
REQUIRE(conn->shuttingdown);
|
||||
|
||||
controllistener_t *listener = conn->listener;
|
||||
|
||||
isccc_ccmsg_invalidate(&conn->ccmsg);
|
||||
|
||||
conn_cleanup(conn);
|
||||
|
||||
if (conn->buffer != NULL) {
|
||||
isc_buffer_free(&conn->buffer);
|
||||
}
|
||||
|
||||
LOCK(&listener->connections_lock);
|
||||
ISC_LIST_UNLINK(listener->connections, conn, link);
|
||||
UNLOCK(&listener->connections_lock);
|
||||
#ifdef ENABLE_AFL
|
||||
if (named_g_fuzz_type == isc_fuzz_rndc) {
|
||||
named_fuzz_notify();
|
||||
}
|
||||
#endif /* ifdef ENABLE_AFL */
|
||||
|
||||
isccc_ccmsg_invalidate(&conn->ccmsg);
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_DEBUG(3),
|
||||
"freeing control connection");
|
||||
@@ -599,26 +582,15 @@ conn_free(controlconnection_t *conn) {
|
||||
|
||||
static void
|
||||
newconnection(controllistener_t *listener, isc_nmhandle_t *handle) {
|
||||
/* Don't create new connection if we are shutting down */
|
||||
if (listener->shuttingdown) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_DEBUG(3),
|
||||
"rejected new control connection: %s",
|
||||
isc_result_totext(ISC_R_SHUTTINGDOWN));
|
||||
return;
|
||||
}
|
||||
|
||||
controlconnection_t *conn = isc_mem_get(listener->mctx, sizeof(*conn));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_DEBUG(3),
|
||||
"allocate new control connection");
|
||||
|
||||
*conn = (controlconnection_t){
|
||||
.alg = DST_ALG_UNKNOWN,
|
||||
.references = ISC_REFCOUNT_INITIALIZER(1),
|
||||
.listener = controllistener_ref(listener),
|
||||
.link = ISC_LINK_INITIALIZER,
|
||||
};
|
||||
*conn = (controlconnection_t){ .alg = DST_ALG_UNKNOWN };
|
||||
|
||||
isc_refcount_init(&conn->references, 1);
|
||||
controllistener_attach(listener, &conn->listener);
|
||||
|
||||
/* isccc_ccmsg_init() attaches to the handle */
|
||||
isccc_ccmsg_init(listener->mctx, handle, &conn->ccmsg);
|
||||
@@ -626,9 +598,10 @@ newconnection(controllistener_t *listener, isc_nmhandle_t *handle) {
|
||||
/* Set a 32 KiB upper limit on incoming message. */
|
||||
isccc_ccmsg_setmaxsize(&conn->ccmsg, 32768);
|
||||
|
||||
ISC_LIST_APPEND(listener->connections, conn, link);
|
||||
LOCK(&listener->connections_lock);
|
||||
ISC_LIST_INITANDAPPEND(listener->connections, conn, link);
|
||||
UNLOCK(&listener->connections_lock);
|
||||
|
||||
/* The reading reference has been initialized in the initializer */
|
||||
isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage, conn);
|
||||
}
|
||||
|
||||
@@ -641,7 +614,7 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
||||
if (result == ISC_R_SHUTTINGDOWN) {
|
||||
shutdown_listener(listener);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
peeraddr = isc_nmhandle_peeraddr(handle);
|
||||
@@ -652,11 +625,11 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
|
||||
"rejected command channel message from %s",
|
||||
socktext);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
newconnection(listener, handle);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -668,7 +641,8 @@ controls_shutdown(named_controls_t *controls) {
|
||||
listener = next)
|
||||
{
|
||||
/*
|
||||
* As listeners shut down, they will call their callbacks.
|
||||
* This is asynchronous. As listeners shut down, they will
|
||||
* call their callbacks.
|
||||
*/
|
||||
next = ISC_LIST_NEXT(listener, link);
|
||||
shutdown_listener(listener);
|
||||
@@ -677,20 +651,8 @@ controls_shutdown(named_controls_t *controls) {
|
||||
|
||||
void
|
||||
named_controls_shutdown(named_controls_t *controls) {
|
||||
/*
|
||||
* Don't ever shutdown the controls twice.
|
||||
*
|
||||
* NOTE: This functions is called when the server is shutting down, but
|
||||
* controls_shutdown() can and will be called multiple times - on each
|
||||
* reconfiguration, the listeners will be torn down and recreated again,
|
||||
* see named_controls_configure() for details.
|
||||
*/
|
||||
if (controls->shuttingdown) {
|
||||
return;
|
||||
}
|
||||
controls->shuttingdown = true;
|
||||
|
||||
controls_shutdown(controls);
|
||||
controls->shuttingdown = true;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -710,11 +672,11 @@ cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
|
||||
}
|
||||
}
|
||||
if (element == NULL) {
|
||||
return ISC_R_NOTFOUND;
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
obj = cfg_listelt_value(element);
|
||||
*objp = obj;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -780,8 +742,8 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
||||
algstr = cfg_obj_asstring(algobj);
|
||||
secretstr = cfg_obj_asstring(secretobj);
|
||||
|
||||
result = named_config_getkeyalgorithm(algstr, &algtype,
|
||||
NULL);
|
||||
result = named_config_getkeyalgorithm2(algstr, NULL,
|
||||
&algtype, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
cfg_obj_log(control, named_g_lctx,
|
||||
ISC_LOG_WARNING,
|
||||
@@ -819,6 +781,14 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK(x) \
|
||||
do { \
|
||||
result = (x); \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static isc_result_t
|
||||
get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
||||
isc_result_t result;
|
||||
@@ -838,7 +808,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_INFO,
|
||||
"configuring command channel from '%s'", named_g_keyfile);
|
||||
if (!isc_file_exists(named_g_keyfile)) {
|
||||
return ISC_R_FILENOTFOUND;
|
||||
return (ISC_R_FILENOTFOUND);
|
||||
}
|
||||
|
||||
CHECK(cfg_parser_create(mctx, named_g_lctx, &pctx));
|
||||
@@ -866,7 +836,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
||||
algstr = cfg_obj_asstring(algobj);
|
||||
secretstr = cfg_obj_asstring(secretobj);
|
||||
|
||||
result = named_config_getkeyalgorithm(algstr, &algtype, NULL);
|
||||
result = named_config_getkeyalgorithm2(algstr, NULL, &algtype, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
cfg_obj_log(key, named_g_lctx, ISC_LOG_WARNING,
|
||||
"unsupported algorithm '%s' in "
|
||||
@@ -904,7 +874,7 @@ cleanup:
|
||||
if (pctx != NULL) {
|
||||
cfg_parser_destroy(&pctx);
|
||||
}
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1061,6 +1031,33 @@ update_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
socktext, isc_result_totext(result));
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* XXX: no unix socket support yet */
|
||||
if (result == ISC_R_SUCCESS && type == isc_socktype_unix) {
|
||||
uint32_t perm, owner, group;
|
||||
perm = cfg_obj_asuint32(cfg_tuple_get(control, "perm"));
|
||||
owner = cfg_obj_asuint32(cfg_tuple_get(control, "owner"));
|
||||
group = cfg_obj_asuint32(cfg_tuple_get(control, "group"));
|
||||
result = ISC_R_SUCCESS;
|
||||
if (listener->perm != perm || listener->owner != owner ||
|
||||
listener->group != group)
|
||||
{
|
||||
result = isc_socket_permunix(&listener->address, perm,
|
||||
owner, group);
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
listener->perm = perm;
|
||||
listener->owner = owner;
|
||||
listener->group = group;
|
||||
} else if (control != NULL) {
|
||||
cfg_obj_log(control, named_g_lctx, ISC_LOG_WARNING,
|
||||
"couldn't update ownership/permission for "
|
||||
"command channel %s",
|
||||
socktext);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
*listenerp = listener;
|
||||
}
|
||||
|
||||
@@ -1078,17 +1075,12 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
int pf;
|
||||
|
||||
/* Don't create new listener if we are shutting down */
|
||||
if (cp->shuttingdown) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
goto shuttingdown;
|
||||
}
|
||||
|
||||
listener = isc_mem_get(mctx, sizeof(*listener));
|
||||
*listener = (controllistener_t){ .controls = cp,
|
||||
.address = *addr,
|
||||
.type = type };
|
||||
isc_mem_attach(mctx, &listener->mctx);
|
||||
isc_mutex_init(&listener->connections_lock);
|
||||
ISC_LINK_INIT(listener, link);
|
||||
ISC_LIST_INIT(listener->keys);
|
||||
ISC_LIST_INIT(listener->connections);
|
||||
@@ -1137,14 +1129,35 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
|
||||
pf = isc_sockaddr_pf(&listener->address);
|
||||
if ((pf == AF_INET && isc_net_probeipv4() != ISC_R_SUCCESS) ||
|
||||
(pf == AF_UNIX && isc_net_probeunix() != ISC_R_SUCCESS) ||
|
||||
(pf == AF_INET6 && isc_net_probeipv6() != ISC_R_SUCCESS))
|
||||
{
|
||||
CHECK(ISC_R_FAMILYNOSUPPORT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* XXX: no unix socket support yet */
|
||||
if (type == isc_socktype_unix) {
|
||||
isc_socket_cleanunix(&listener->address, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
CHECK(isc_nm_listentcp(named_g_netmgr, ISC_NM_LISTEN_ONE,
|
||||
&listener->address, control_newconn, listener, 5,
|
||||
NULL, &listener->sock));
|
||||
#if 0
|
||||
/* XXX: no unix socket support yet */
|
||||
if (type == isc_socktype_unix) {
|
||||
listener->perm =
|
||||
cfg_obj_asuint32(cfg_tuple_get(control, "perm"));
|
||||
listener->owner =
|
||||
cfg_obj_asuint32(cfg_tuple_get(control, "owner"));
|
||||
listener->group =
|
||||
cfg_obj_asuint32(cfg_tuple_get(control, "group"));
|
||||
result = isc_socket_permunix(&listener->address, listener->perm,
|
||||
listener->owner, listener->group);
|
||||
}
|
||||
#endif
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
|
||||
@@ -1154,10 +1167,9 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
|
||||
cleanup:
|
||||
isc_refcount_decrement(&listener->references);
|
||||
listener->shuttingdown = true;
|
||||
listener->exiting = true;
|
||||
free_listener(listener);
|
||||
|
||||
shuttingdown:
|
||||
if (control != NULL) {
|
||||
cfg_obj_log(control, named_g_lctx, ISC_LOG_WARNING,
|
||||
"couldn't add command channel %s: %s", socktext,
|
||||
@@ -1202,19 +1214,8 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
||||
{
|
||||
const cfg_obj_t *controls = NULL;
|
||||
const cfg_obj_t *inetcontrols = NULL;
|
||||
const cfg_obj_t *unixcontrols = NULL;
|
||||
|
||||
controls = cfg_listelt_value(element);
|
||||
|
||||
(void)cfg_map_get(controls, "unix", &unixcontrols);
|
||||
if (unixcontrols != NULL) {
|
||||
cfg_obj_log(controls, named_g_lctx,
|
||||
ISC_LOG_ERROR,
|
||||
"UNIX domain sockets are not "
|
||||
"supported");
|
||||
return ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
(void)cfg_map_get(controls, "inet", &inetcontrols);
|
||||
if (inetcontrols == NULL) {
|
||||
continue;
|
||||
@@ -1230,8 +1231,8 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
||||
|
||||
/*
|
||||
* The parser handles BIND 8 configuration file
|
||||
* syntax, so it allows inet phrases with no
|
||||
* keys{} clause.
|
||||
* syntax, so it allows unix phrases as well
|
||||
* inet phrases with no keys{} clause.
|
||||
*/
|
||||
control = cfg_listelt_value(element2);
|
||||
|
||||
@@ -1279,6 +1280,91 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
||||
}
|
||||
}
|
||||
}
|
||||
for (element = cfg_list_first(controlslist); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *controls = NULL;
|
||||
const cfg_obj_t *unixcontrols = NULL;
|
||||
|
||||
controls = cfg_listelt_value(element);
|
||||
(void)cfg_map_get(controls, "unix", &unixcontrols);
|
||||
if (unixcontrols == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cfg_obj_log(controls, named_g_lctx, ISC_LOG_ERROR,
|
||||
"UNIX domain sockets not yet supported");
|
||||
return (ISC_R_FAILURE);
|
||||
|
||||
#if 0
|
||||
/* XXX: no unix domain socket support in netmgr */
|
||||
for (element2 = cfg_list_first(unixcontrols);
|
||||
element2 != NULL;
|
||||
element2 = cfg_list_next(element2))
|
||||
{
|
||||
const cfg_obj_t *control = NULL;
|
||||
const cfg_obj_t *path = NULL;
|
||||
isc_sockaddr_t addr;
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
* The parser handles BIND 8 configuration file
|
||||
* syntax, so it allows unix phrases as well
|
||||
* inet phrases with no keys{} clause.
|
||||
*/
|
||||
control = cfg_listelt_value(element2);
|
||||
|
||||
path = cfg_tuple_get(control, "path");
|
||||
result = isc_sockaddr_frompath(
|
||||
&addr, cfg_obj_asstring(path));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(
|
||||
named_g_lctx,
|
||||
NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL,
|
||||
ISC_LOG_DEBUG(9),
|
||||
"control channel '%s': %s",
|
||||
cfg_obj_asstring(path),
|
||||
isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
|
||||
isc_log_write(named_g_lctx,
|
||||
NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_CONTROL,
|
||||
ISC_LOG_DEBUG(9),
|
||||
"processing control channel '%s'",
|
||||
cfg_obj_asstring(path));
|
||||
|
||||
update_listener(cp, &listener, control, config,
|
||||
&addr, aclconfctx,
|
||||
cfg_obj_asstring(path),
|
||||
isc_socktype_unix);
|
||||
|
||||
if (listener != NULL) {
|
||||
/*
|
||||
* Remove the listener from the old
|
||||
* list, so it won't be shut down.
|
||||
*/
|
||||
ISC_LIST_UNLINK(cp->listeners, listener,
|
||||
link);
|
||||
} else {
|
||||
/*
|
||||
* This is a new listener.
|
||||
*/
|
||||
add_listener(cp, &listener, control,
|
||||
config, &addr, aclconfctx,
|
||||
cfg_obj_asstring(path),
|
||||
isc_socktype_unix);
|
||||
}
|
||||
|
||||
if (listener != NULL) {
|
||||
ISC_LIST_APPEND(new_listeners, listener,
|
||||
link);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
int i;
|
||||
|
||||
@@ -1341,7 +1427,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
||||
* down will be taken care of by listen_done().
|
||||
*/
|
||||
ISC_LIST_APPENDLIST(cp->listeners, new_listeners, link);
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -1364,10 +1450,10 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mutex_destroy(&controls->symtab_lock);
|
||||
isc_mem_put(server->mctx, controls, sizeof(*controls));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
*ctrlsp = controls;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1375,7 +1461,6 @@ named_controls_destroy(named_controls_t **ctrlsp) {
|
||||
named_controls_t *controls = *ctrlsp;
|
||||
*ctrlsp = NULL;
|
||||
|
||||
REQUIRE(controls->shuttingdown);
|
||||
REQUIRE(ISC_LIST_EMPTY(controls->listeners));
|
||||
|
||||
LOCK(&controls->symtab_lock);
|
||||
|
||||
@@ -98,13 +98,13 @@ dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_allnodes == NULL) {
|
||||
return ISC_R_NOPERM;
|
||||
return (ISC_R_NOPERM);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -116,13 +116,13 @@ dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_allowzonexfr == NULL) {
|
||||
return ISC_R_NOPERM;
|
||||
return (ISC_R_NOPERM);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -134,13 +134,13 @@ dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_authority == NULL) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_authority(zone, cd->dbdata, lookup);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -155,7 +155,7 @@ dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_findzonedb(cd->dbdata, name, methods, clientinfo);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -172,7 +172,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
||||
result = cd->dlz_lookup(zone, name, cd->dbdata, lookup, methods,
|
||||
clientinfo);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -195,7 +195,7 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -219,7 +219,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
"dlz_dlopen driver for '%s' needs a path to "
|
||||
"the shared library",
|
||||
dlzname);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
@@ -319,14 +319,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
|
||||
*dbdata = cd;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
failed:
|
||||
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
|
||||
|
||||
dlopen_dlz_destroy(NULL, cd);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -363,13 +363,13 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_newversion == NULL) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_newversion(zone, cd->dbdata, versionp);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -404,7 +404,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_configure == NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
@@ -413,7 +413,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
|
||||
cd->in_configure = false;
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -429,7 +429,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_ssumatch == NULL) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
@@ -437,7 +437,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
keydata, cd->dbdata);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -452,14 +452,14 @@ dlopen_dlz_addrdataset(const char *name, const char *rdatastr, void *driverarg,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_addrdataset == NULL) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -474,14 +474,14 @@ dlopen_dlz_subrdataset(const char *name, const char *rdatastr, void *driverarg,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_subrdataset == NULL) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -496,14 +496,14 @@ dlopen_dlz_delrdataset(const char *name, const char *type, void *driverarg,
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_delrdataset == NULL) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static dns_sdlzmethods_t dlz_dlopen_methods = {
|
||||
@@ -535,7 +535,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
result = ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+5
-5
@@ -127,7 +127,7 @@ fuzz_thread_client(void *arg) {
|
||||
named_server_flushonshutdown(named_g_server,
|
||||
false);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
raise(SIGSTOP);
|
||||
goto next;
|
||||
@@ -161,7 +161,7 @@ fuzz_thread_client(void *arg) {
|
||||
named_server_flushonshutdown(named_g_server, false);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -375,7 +375,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
named_server_flushonshutdown(named_g_server,
|
||||
false);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
raise(SIGSTOP);
|
||||
continue;
|
||||
@@ -587,7 +587,7 @@ fuzz_thread_resolver(void *arg) {
|
||||
__AFL_LOOP(0);
|
||||
#endif /* ifdef __AFL_LOOP */
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -718,7 +718,7 @@ fuzz_thread_tcp(void *arg) {
|
||||
named_server_flushonshutdown(named_g_server, false);
|
||||
isc_loopmgr_shutdown(named_g_loopmgr);
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_AFL */
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||
"GeoIP2 database '%s/%s': path too long", dir,
|
||||
dbfile);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ret = MMDB_open(pathbuf, MMDB_MODE_MMAP, mmdb);
|
||||
@@ -51,7 +51,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"opened GeoIP2 database '%s'", pathbuf);
|
||||
return mmdb;
|
||||
return (mmdb);
|
||||
}
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
@@ -59,7 +59,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
|
||||
"unable to open GeoIP2 database '%s' (status %d)",
|
||||
pathbuf, ret);
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* HAVE_GEOIP2 */
|
||||
|
||||
|
||||
@@ -57,13 +57,17 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
|
||||
const char *name, const cfg_obj_t **ret);
|
||||
|
||||
isc_result_t
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
|
||||
const cfg_obj_t *list, isc_mem_t *mctx,
|
||||
dns_ipkeylist_t *ipkl);
|
||||
|
||||
isc_result_t
|
||||
named_config_getport(const cfg_obj_t *config, const char *type,
|
||||
in_port_t *portp);
|
||||
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
|
||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||
uint16_t *digestbits);
|
||||
isc_result_t
|
||||
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||
unsigned int *typep, uint16_t *digestbits);
|
||||
|
||||
@@ -28,51 +28,48 @@
|
||||
|
||||
#define NAMED_CONTROL_PORT 953
|
||||
|
||||
#define NAMED_COMMAND_ADDZONE "addzone"
|
||||
#define NAMED_COMMAND_DELZONE "delzone"
|
||||
#define NAMED_COMMAND_DNSSEC "dnssec"
|
||||
#define NAMED_COMMAND_DNSTAP "dnstap"
|
||||
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
|
||||
#define NAMED_COMMAND_DUMPDB "dumpdb"
|
||||
#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_FETCHLIMIT "fetchlimit"
|
||||
#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_FREEZE "freeze"
|
||||
#define NAMED_COMMAND_HALT "halt"
|
||||
#define NAMED_COMMAND_LOADKEYS "loadkeys"
|
||||
#define NAMED_COMMAND_MEMPROF "memprof"
|
||||
#define NAMED_COMMAND_MKEYS "managed-keys"
|
||||
#define NAMED_COMMAND_MODZONE "modzone"
|
||||
#define NAMED_COMMAND_NOTIFY "notify"
|
||||
#define NAMED_COMMAND_NOTRACE "notrace"
|
||||
#define NAMED_COMMAND_NTA "nta"
|
||||
#define NAMED_COMMAND_NULL "null"
|
||||
#define NAMED_COMMAND_QUERYLOG "querylog"
|
||||
#define NAMED_COMMAND_RECONFIG "reconfig"
|
||||
#define NAMED_COMMAND_RECURSING "recursing"
|
||||
#define NAMED_COMMAND_REFRESH "refresh"
|
||||
#define NAMED_COMMAND_RELOAD "reload"
|
||||
#define NAMED_COMMAND_RESPONSELOG "responselog"
|
||||
#define NAMED_COMMAND_RETRANSFER "retransfer"
|
||||
#define NAMED_COMMAND_SCAN "scan"
|
||||
#define NAMED_COMMAND_SECROOTS "secroots"
|
||||
#define NAMED_COMMAND_SERVESTALE "serve-stale"
|
||||
#define NAMED_COMMAND_SHOWZONE "showzone"
|
||||
#define NAMED_COMMAND_SIGN "sign"
|
||||
#define NAMED_COMMAND_SIGNING "signing"
|
||||
#define NAMED_COMMAND_SKR "skr"
|
||||
#define NAMED_COMMAND_STATUS "status"
|
||||
#define NAMED_COMMAND_STOP "stop"
|
||||
#define NAMED_COMMAND_SYNC "sync"
|
||||
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
|
||||
#define NAMED_COMMAND_TESTGEN "testgen"
|
||||
#define NAMED_COMMAND_THAW "thaw"
|
||||
#define NAMED_COMMAND_TRACE "trace"
|
||||
#define NAMED_COMMAND_FREEZE "freeze"
|
||||
#define NAMED_COMMAND_UNFREEZE "unfreeze"
|
||||
#define NAMED_COMMAND_THAW "thaw"
|
||||
#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_DNSSEC "dnssec"
|
||||
#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_FETCHLIMIT "fetchlimit"
|
||||
|
||||
isc_result_t
|
||||
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
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_loop_t *named_g_mainloop INIT(NULL);
|
||||
EXTERN isc_loopmgr_t *named_g_loopmgr INIT(NULL);
|
||||
EXTERN bool named_g_loopmgr_running INIT(false);
|
||||
@@ -100,6 +101,8 @@ EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
|
||||
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
|
||||
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);
|
||||
|
||||
@@ -116,6 +119,11 @@ 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);
|
||||
|
||||
#if NAMED_RUN_PID_DIR
|
||||
EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/named/"
|
||||
|
||||
@@ -39,13 +39,10 @@ void
|
||||
named_os_inituserinfo(const char *username);
|
||||
|
||||
void
|
||||
named_os_changeuser(bool permanent);
|
||||
|
||||
void
|
||||
named_os_restoreuser(void);
|
||||
named_os_changeuser(void);
|
||||
|
||||
uid_t
|
||||
named_os_uid(void);
|
||||
ns_os_uid(void);
|
||||
|
||||
void
|
||||
named_os_adjustnofile(void);
|
||||
@@ -59,6 +56,9 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user);
|
||||
void
|
||||
named_os_writepidfile(const char *filename, bool first_time);
|
||||
|
||||
bool
|
||||
named_os_issingleton(const char *filename);
|
||||
|
||||
void
|
||||
named_os_shutdown(void);
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ struct named_server {
|
||||
dns_zonemgr_t *zonemgr;
|
||||
dns_viewlist_t viewlist;
|
||||
dns_kasplist_t kasplist;
|
||||
dns_keystorelist_t keystorelist;
|
||||
ns_interfacemgr_t *interfacemgr;
|
||||
dns_db_t *in_roothints;
|
||||
|
||||
@@ -93,7 +92,7 @@ struct named_server {
|
||||
|
||||
named_statschannellist_t statschannels;
|
||||
|
||||
dst_key_t *sessionkey;
|
||||
dns_tsigkey_t *sessionkey;
|
||||
char *session_keyfile;
|
||||
dns_name_t *session_keyname;
|
||||
unsigned int session_keyalg;
|
||||
@@ -104,6 +103,8 @@ struct named_server {
|
||||
|
||||
dns_dtenv_t *dtenv; /*%< Dnstap environment */
|
||||
|
||||
char *lockfile;
|
||||
|
||||
isc_tlsctx_cache_t *tlsctx_server_cache;
|
||||
isc_tlsctx_cache_t *tlsctx_client_cache;
|
||||
|
||||
@@ -184,20 +185,10 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
named_server_setortoggle(named_server_t *server, const char *optname,
|
||||
unsigned int option, isc_lex_t *lex);
|
||||
named_server_togglequerylog(named_server_t *server, isc_lex_t *lex);
|
||||
/*%<
|
||||
* Enable/disable, or toggle, a server option via the command channel.
|
||||
* 'option' is the option value to be changed (for example,
|
||||
* NS_SERVER_LOGQUERIES or NS_SERVER_LOGRESPOSNES) and 'optname' is the
|
||||
* option's human-readable name for logging purposes ("query logging"
|
||||
* or "response logging").
|
||||
*
|
||||
* If an explicit argument to enable the option was provided
|
||||
* (i.e., "on", "enable", "true", or "yes") or an explicit argument
|
||||
* to disable it ("off", "disable", "false", or "no"), it will be used.
|
||||
*
|
||||
* If no argument is provided, the option's current state will be reversed.
|
||||
* Enable/disable logging of queries. (Takes "yes" or "no" argument,
|
||||
* but can also be used as a toggle for backward comptibility.)
|
||||
*/
|
||||
|
||||
/*%
|
||||
@@ -385,21 +376,3 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex,
|
||||
isc_result_t
|
||||
named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
|
||||
isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Import SKR file for offline KSK signing.
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_skr(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
|
||||
|
||||
/*%
|
||||
* Toggle memory profiling if supported.
|
||||
*/
|
||||
isc_result_t
|
||||
named_server_togglememprof(isc_lex_t *lex);
|
||||
|
||||
/*%
|
||||
* Get status of memory profiling.
|
||||
*/
|
||||
const char *
|
||||
named_server_getmemprof(void);
|
||||
|
||||
@@ -22,7 +22,7 @@ ISC_LANG_BEGINDECLS
|
||||
|
||||
isc_result_t
|
||||
named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
isc_mem_t *mctx, dns_tsigkeyring_t **ringp);
|
||||
isc_mem_t *mctx, dns_tsig_keyring_t **ringp);
|
||||
/*%<
|
||||
* Create a TSIG key ring and configure it according to the 'key'
|
||||
* statements in the global and view configuration objects.
|
||||
|
||||
@@ -28,8 +28,8 @@ 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_keystorelist_t *keystores,
|
||||
dns_zone_t *zone, dns_zone_t *raw);
|
||||
dns_kasplist_t *kasplist, dns_zone_t *zone,
|
||||
dns_zone_t *raw);
|
||||
/*%<
|
||||
* Configure or reconfigure a zone according to the named.conf
|
||||
* data.
|
||||
@@ -44,9 +44,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
*/
|
||||
|
||||
bool
|
||||
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
|
||||
const cfg_obj_t *vconfig, const cfg_obj_t *config,
|
||||
dns_kasplist_t *kasplist);
|
||||
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
|
||||
/*%<
|
||||
* If 'zone' can be safely reconfigured according to the configuration
|
||||
* data in 'zconfig', return true. If the configuration data is so
|
||||
@@ -55,12 +53,10 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
|
||||
*/
|
||||
|
||||
bool
|
||||
named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
|
||||
const cfg_obj_t *config, dns_kasplist_t *kasplist);
|
||||
named_zone_inlinesigning(const cfg_obj_t *zconfig);
|
||||
/*%<
|
||||
* Determine if zone uses inline-signing. This is true if inline-signing
|
||||
* is set to yes, in the zone clause or in the zone's dnssec-policy clause.
|
||||
* By default, dnssec-policy uses inline-signing.
|
||||
* is set to yes.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
|
||||
+4
-4
@@ -89,14 +89,14 @@ named_log_init(bool safe) {
|
||||
|
||||
named_log_setdefaultsslkeylogfile(lcfg);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
isc_log_destroy(&named_g_lctx);
|
||||
isc_log_setcontext(NULL);
|
||||
dns_log_setcontext(NULL);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -237,7 +237,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -246,7 +246,7 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
|
||||
|
||||
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
|
||||
NULL);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+8
-8
@@ -57,11 +57,11 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
|
||||
/*
|
||||
* Allow further processing by returning success.
|
||||
*/
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (logconfig == NULL) {
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
module = NULL;
|
||||
@@ -80,10 +80,10 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||
"logging channel '%s': %s", channelname,
|
||||
isc_result_totext(result));
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -131,7 +131,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
"channel '%s': exactly one of file, syslog, "
|
||||
"null, and stderr must be present",
|
||||
channelname);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
type = ISC_LOG_TONULL;
|
||||
@@ -310,7 +310,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -365,8 +365,8 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
|
||||
CHECK(named_log_setunmatchedcategory(logconfig));
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
+40
-89
@@ -89,7 +89,6 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBXML2
|
||||
@@ -103,14 +102,6 @@
|
||||
#include <nghttp2/nghttp2.h>
|
||||
#endif
|
||||
|
||||
/* On DragonFly BSD the header does not provide jemalloc API */
|
||||
#if defined(HAVE_MALLOC_NP_H) && !defined(__DragonFly__)
|
||||
#include <malloc_np.h>
|
||||
#include <sys/malloc.h> /* For M_VERSION */
|
||||
#elif defined(HAVE_JEMALLOC)
|
||||
#include <jemalloc/jemalloc.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include header files for database drivers here.
|
||||
*/
|
||||
@@ -131,7 +122,6 @@ static int maxudp = 0;
|
||||
/*
|
||||
* -T options:
|
||||
*/
|
||||
static bool cookiealwaysvalid = false;
|
||||
static bool dropedns = false;
|
||||
static bool ednsformerr = false;
|
||||
static bool ednsnotimp = false;
|
||||
@@ -195,7 +185,7 @@ named_main_earlyfatal(const char *format, ...) {
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
_exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
noreturn static void
|
||||
@@ -234,7 +224,7 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
|
||||
if (named_g_coreok) {
|
||||
abort();
|
||||
}
|
||||
_exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
noreturn static void
|
||||
@@ -274,7 +264,7 @@ library_fatal_error(const char *file, int line, const char *func,
|
||||
if (named_g_coreok) {
|
||||
abort();
|
||||
}
|
||||
_exit(EXIT_FAILURE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -313,8 +303,8 @@ usage(void) {
|
||||
"[-p port] [-s]\n"
|
||||
" [-S sockets] [-t chrootdir] [-u "
|
||||
"username] [-U listeners]\n"
|
||||
" [-m "
|
||||
"{usage|trace|record}]\n"
|
||||
" [-X lockfile] [-m "
|
||||
"{usage|trace|record|size|mctx}]\n"
|
||||
" [-M fill|nofill]\n"
|
||||
"usage: named [-v|-V|-C]\n");
|
||||
}
|
||||
@@ -407,7 +397,7 @@ parse_int(char *arg, const char *desc) {
|
||||
if (tmp < 0 || tmp != ltmp) {
|
||||
named_main_earlyfatal("%s '%s' out of range", desc, arg);
|
||||
}
|
||||
return tmp;
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
static struct flag_def {
|
||||
@@ -494,9 +484,6 @@ list_hmac_algorithms(isc_buffer_t *b) {
|
||||
for (dst_algorithm_t i = DST_ALG_HMAC_FIRST; i <= DST_ALG_HMAC_LAST;
|
||||
i++)
|
||||
{
|
||||
if (i == DST_ALG_GSSAPI) {
|
||||
continue;
|
||||
}
|
||||
if (dst_algorithm_supported(i)) {
|
||||
isc_buffer_putstr(b, " ");
|
||||
isc_buffer_putstr(b, dst_hmac_algorithm_totext(i));
|
||||
@@ -605,13 +592,6 @@ printversion(bool verbose) {
|
||||
UV_VERSION_MINOR, UV_VERSION_PATCH);
|
||||
printf("linked to libuv version: %s\n", uv_version_string());
|
||||
printf("compiled with %s version: %s\n", RCU_FLAVOR, RCU_VERSION);
|
||||
#if defined(JEMALLOC_VERSION)
|
||||
printf("compiled with jemalloc version: %u.%u.%u\n",
|
||||
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
|
||||
JEMALLOC_VERSION_BUGFIX);
|
||||
#elif defined(M_VERSION)
|
||||
printf("compiled with system jemalloc version: %u\n", M_VERSION);
|
||||
#endif
|
||||
#if HAVE_LIBNGHTTP2
|
||||
nghttp2_info *nginfo = NULL;
|
||||
printf("compiled with libnghttp2 version: %s\n", NGHTTP2_VERSION);
|
||||
@@ -672,6 +652,7 @@ printversion(bool verbose) {
|
||||
printf(" rndc configuration: %s\n", rndcconf);
|
||||
printf(" nsupdate session key: %s\n", named_g_defaultsessionkeyfile);
|
||||
printf(" named PID file: %s\n", named_g_defaultpidfile);
|
||||
printf(" named lock file: %s\n", named_g_defaultlockfile);
|
||||
#if defined(HAVE_GEOIP2)
|
||||
#define RTC(x) RUNTIME_CHECK((x) == ISC_R_SUCCESS)
|
||||
RTC(cfg_parser_create(mctx, named_g_lctx, &parser));
|
||||
@@ -718,9 +699,7 @@ parse_T_opt(char *option) {
|
||||
* force the server to behave (or misbehave) in
|
||||
* specified ways for testing purposes.
|
||||
*/
|
||||
if (!strcmp(option, "cookiealwaysvalid")) {
|
||||
cookiealwaysvalid = true;
|
||||
} else if (!strcmp(option, "dropedns")) {
|
||||
if (!strcmp(option, "dropedns")) {
|
||||
dropedns = true;
|
||||
} else if (!strcmp(option, "ednsformerr")) {
|
||||
ednsformerr = true;
|
||||
@@ -895,7 +874,7 @@ parse_command_line(int argc, char *argv[]) {
|
||||
printf("# Built-in default values. "
|
||||
"This is NOT the run-time configuration!\n");
|
||||
printf("%s", named_config_getdefault());
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
case 'd':
|
||||
named_g_debuglevel = parse_int(isc_commandline_argument,
|
||||
"debug "
|
||||
@@ -951,37 +930,41 @@ parse_command_line(int argc, char *argv[]) {
|
||||
parse_T_opt(isc_commandline_argument);
|
||||
break;
|
||||
case 'U':
|
||||
/* Obsolete. No longer in use. Ignore. */
|
||||
named_main_earlywarning("option '-U' has been removed");
|
||||
named_g_udpdisp = parse_int(isc_commandline_argument,
|
||||
"number of UDP listeners "
|
||||
"per interface");
|
||||
break;
|
||||
case 'u':
|
||||
named_g_username = isc_commandline_argument;
|
||||
break;
|
||||
case 'v':
|
||||
printversion(false);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
case 'V':
|
||||
printversion(true);
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
case 'x':
|
||||
/* Obsolete. No longer in use. Ignore. */
|
||||
break;
|
||||
case 'X':
|
||||
/* Obsolete. No longer in use. Abort. */
|
||||
named_main_earlyfatal("option '-X' has been removed");
|
||||
named_g_forcelock = true;
|
||||
if (strcasecmp(isc_commandline_argument, "none") != 0) {
|
||||
named_g_defaultlockfile =
|
||||
isc_commandline_argument;
|
||||
} else {
|
||||
named_g_defaultlockfile = NULL;
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
named_main_earlyfatal(
|
||||
"Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
named_main_earlyfatal(
|
||||
"Failed to load base provider");
|
||||
}
|
||||
@@ -997,7 +980,7 @@ parse_command_line(int argc, char *argv[]) {
|
||||
case '?':
|
||||
usage();
|
||||
if (isc_commandline_option == '?') {
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(0);
|
||||
}
|
||||
p = strchr(NAMED_MAIN_ARGS, isc_commandline_option);
|
||||
if (p == NULL || *++p != ':') {
|
||||
@@ -1040,13 +1023,23 @@ create_managers(void) {
|
||||
ISC_LOG_INFO, "found %u CPU%s, using %u worker thread%s",
|
||||
named_g_cpus_detected, named_g_cpus_detected == 1 ? "" : "s",
|
||||
named_g_cpus, named_g_cpus == 1 ? "" : "s");
|
||||
if (named_g_udpdisp == 0) {
|
||||
named_g_udpdisp = named_g_cpus_detected;
|
||||
}
|
||||
if (named_g_udpdisp > named_g_cpus) {
|
||||
named_g_udpdisp = named_g_cpus;
|
||||
}
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"using %u UDP listener%s per interface", named_g_udpdisp,
|
||||
named_g_udpdisp == 1 ? "" : "s");
|
||||
|
||||
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
|
||||
&named_g_netmgr);
|
||||
|
||||
isc_nm_maxudp(named_g_netmgr, maxudp);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1182,30 +1175,6 @@ setup(void) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"linked to libuv version: %s", uv_version_string());
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"compiled with %s version: %s", RCU_FLAVOR, RCU_VERSION);
|
||||
#if defined(JEMALLOC_VERSION)
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"compiled with jemalloc version: %u.%u.%u",
|
||||
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
|
||||
JEMALLOC_VERSION_BUGFIX);
|
||||
#elif defined(M_VERSION)
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"compiled with system jemalloc version: %u", M_VERSION);
|
||||
#endif
|
||||
#if HAVE_LIBNGHTTP2
|
||||
nghttp2_info *nginfo = NULL;
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"compiled with libnghttp2 version: %s", NGHTTP2_VERSION);
|
||||
nginfo = nghttp2_version(1);
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"linked to libnghttp2 version: %s", nginfo->version_str);
|
||||
#endif
|
||||
#ifdef HAVE_LIBXML2
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
@@ -1231,21 +1200,6 @@ setup(void) {
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"linked to zlib version: %s", zlibVersion());
|
||||
#endif /* if defined(HAVE_ZLIB) && defined(ZLIB_VERSION) */
|
||||
#if defined(HAVE_GEOIP2)
|
||||
/* Unfortunately, no version define on link time */
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"linked to maxminddb version: %s", MMDB_lib_version());
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
#if defined(HAVE_DNSTAP)
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"compiled with protobuf-c version: %s",
|
||||
PROTOBUF_C_VERSION);
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"linked to protobuf-c version: %s", protobuf_c_version());
|
||||
#endif /* if defined(HAVE_DNSTAP) */
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"----------------------------------------------------");
|
||||
@@ -1328,9 +1282,6 @@ setup(void) {
|
||||
/*
|
||||
* Modify server context according to command line options
|
||||
*/
|
||||
if (cookiealwaysvalid) {
|
||||
ns_server_setoption(sctx, NS_SERVER_COOKIEALWAYSVALID, true);
|
||||
}
|
||||
if (disable4) {
|
||||
ns_server_setoption(sctx, NS_SERVER_DISABLE4, true);
|
||||
}
|
||||
@@ -1443,7 +1394,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
|
||||
UNEXPECTED_ERROR("scf_handle_create() failed: %s",
|
||||
scf_strerror(scf_error()));
|
||||
}
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (scf_handle_bind(h) == -1) {
|
||||
@@ -1452,7 +1403,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
|
||||
scf_strerror(scf_error()));
|
||||
}
|
||||
scf_handle_destroy(h);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if ((namelen = scf_myname(h, NULL, 0)) == -1) {
|
||||
@@ -1461,7 +1412,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
|
||||
scf_strerror(scf_error()));
|
||||
}
|
||||
scf_handle_destroy(h);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if ((instance = isc_mem_allocate(mctx, namelen + 1)) == NULL) {
|
||||
@@ -1469,7 +1420,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
|
||||
"allocation failed: %s",
|
||||
isc_result_totext(ISC_R_NOMEMORY));
|
||||
scf_handle_destroy(h);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (scf_myname(h, instance, namelen + 1) == -1) {
|
||||
@@ -1479,12 +1430,12 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
|
||||
}
|
||||
scf_handle_destroy(h);
|
||||
isc_mem_free(mctx, instance);
|
||||
return ISC_R_FAILURE;
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
scf_handle_destroy(h);
|
||||
*ins_name = instance;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
#endif /* HAVE_LIBSCF */
|
||||
|
||||
@@ -1641,5 +1592,5 @@ main(int argc, char *argv[]) {
|
||||
ProfilerStop();
|
||||
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
+14
-4
@@ -21,7 +21,7 @@ named - Internet domain name server
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-C**] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-u** user] [**-v**] [**-V**] ]
|
||||
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-C**] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file]
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
@@ -117,7 +117,7 @@ Options
|
||||
.. option:: -m flag
|
||||
|
||||
This option turns on memory usage debugging flags. Possible flags are ``usage``,
|
||||
``trace`` and ``record``. These correspond to the
|
||||
``trace``, ``record``, ``size``, and ``mctx``. These correspond to the
|
||||
``ISC_MEM_DEBUGXXXX`` flags described in ``<isc/mem.h>``.
|
||||
|
||||
.. option:: -n #cpus
|
||||
@@ -163,7 +163,14 @@ Options
|
||||
|
||||
.. option:: -U #listeners
|
||||
|
||||
This option has been removed. Attempts to use it now result in a warning.
|
||||
This option tells :program:`named` the number of ``#listeners`` worker threads to listen on, for incoming UDP packets on
|
||||
each address. If not specified, :program:`named` calculates a default
|
||||
value based on the number of detected CPUs: 1 for 1 CPU, and the
|
||||
number of detected CPUs minus one for machines with more than 1 CPU.
|
||||
This cannot be increased to a value higher than the number of CPUs.
|
||||
If :option:`-n` has been set to a higher value than the number of detected
|
||||
CPUs, then :option:`-U` may be increased as high as that value, but no
|
||||
higher.
|
||||
|
||||
.. option:: -u user
|
||||
|
||||
@@ -191,7 +198,10 @@ Options
|
||||
|
||||
.. option:: -X lock-file
|
||||
|
||||
This option has been removed and using it will cause a fatal error.
|
||||
This option acquires a lock on the specified file at runtime; this helps to
|
||||
prevent duplicate :program:`named` instances from running simultaneously.
|
||||
Use of this option overrides the ``lock-file`` option in
|
||||
:iscman:`named.conf`. If set to ``none``, the lock file check is disabled.
|
||||
|
||||
Signals
|
||||
~~~~~~~
|
||||
|
||||
+220
-53
@@ -51,7 +51,9 @@
|
||||
#endif /* ifdef HAVE_LIBSCF */
|
||||
|
||||
static char *pidfile = NULL;
|
||||
static char *lockfile = NULL;
|
||||
static int devnullfd = -1;
|
||||
static int singletonfd = -1;
|
||||
|
||||
#ifndef ISC_FACILITY
|
||||
#define ISC_FACILITY LOG_DAEMON
|
||||
@@ -61,9 +63,6 @@ static struct passwd *runas_pw = NULL;
|
||||
static bool done_setuid = false;
|
||||
static int dfd[2] = { -1, -1 };
|
||||
|
||||
static uid_t saved_uid = (uid_t)-1;
|
||||
static gid_t saved_gid = (gid_t)-1;
|
||||
|
||||
#if HAVE_LIBCAP
|
||||
|
||||
static bool non_root = false;
|
||||
@@ -252,6 +251,115 @@ linux_keepcaps(void) {
|
||||
|
||||
#endif /* HAVE_LIBCAP */
|
||||
|
||||
/*
|
||||
* First define compatibility shims if {set,get}res{uid,gid} are not available
|
||||
*/
|
||||
|
||||
#if !HAVE_GETRESGID
|
||||
static int
|
||||
getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) {
|
||||
*rgid = -1;
|
||||
*egid = getegid();
|
||||
*sgid = -1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* !HAVE_GETRESGID */
|
||||
|
||||
#if !HAVE_SETRESGID
|
||||
static int
|
||||
setresgid(gid_t rgid, gid_t egid, gid_t sgid) {
|
||||
REQUIRE(rgid == (gid_t)-1);
|
||||
REQUIRE(sgid == (gid_t)-1);
|
||||
|
||||
#if HAVE_SETREGID
|
||||
return (setregid(rgid, egid));
|
||||
#else /* HAVE_SETREGID */
|
||||
return (setegid(egid));
|
||||
#endif /* HAVE_SETREGID */
|
||||
}
|
||||
#endif /* !HAVE_SETRESGID */
|
||||
|
||||
#if !HAVE_GETRESUID
|
||||
static int
|
||||
getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
|
||||
*ruid = -1;
|
||||
*euid = geteuid();
|
||||
*suid = -1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* !HAVE_GETRESUID */
|
||||
|
||||
#if !HAVE_SETRESUID
|
||||
static int
|
||||
setresuid(uid_t ruid, uid_t euid, uid_t suid) {
|
||||
REQUIRE(ruid == (uid_t)-1);
|
||||
REQUIRE(suid == (uid_t)-1);
|
||||
|
||||
#if HAVE_SETREGID
|
||||
return (setregid(ruid, euid));
|
||||
#else /* HAVE_SETREGID */
|
||||
return (setegid(euid));
|
||||
#endif /* HAVE_SETREGID */
|
||||
}
|
||||
#endif /* !HAVE_SETRESUID */
|
||||
|
||||
static int
|
||||
set_effective_gid(gid_t gid) {
|
||||
gid_t oldgid;
|
||||
|
||||
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (oldgid == gid) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (setresgid(-1, gid, -1) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (oldgid != gid) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
set_effective_uid(uid_t uid) {
|
||||
uid_t olduid;
|
||||
|
||||
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (olduid == uid) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (setresuid(-1, uid, -1) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (olduid != uid) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Success */
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
setperms(uid_t uid, gid_t gid) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -260,13 +368,13 @@ setperms(uid_t uid, gid_t gid) {
|
||||
* Drop the gid privilege first, because in some cases the gid privilege
|
||||
* cannot be dropped after the uid privilege has been dropped.
|
||||
*/
|
||||
if (setegid(gid) == -1) {
|
||||
if (set_effective_gid(gid) == -1) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlywarning("unable to set effective gid to %d: %s",
|
||||
gid, strbuf);
|
||||
}
|
||||
|
||||
if (seteuid(uid) == -1) {
|
||||
if (set_effective_uid(uid) == -1) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlywarning("unable to set effective uid to %d: %s",
|
||||
uid, strbuf);
|
||||
@@ -322,10 +430,10 @@ named_os_daemonize(void) {
|
||||
char buf;
|
||||
n = read(dfd[0], &buf, 1);
|
||||
if (n == 1) {
|
||||
_exit(EXIT_SUCCESS);
|
||||
_exit(0);
|
||||
}
|
||||
} while (n == -1 && errno == EINTR);
|
||||
_exit(EXIT_FAILURE);
|
||||
_exit(1);
|
||||
}
|
||||
(void)close(dfd[0]);
|
||||
|
||||
@@ -400,15 +508,15 @@ named_os_closedevnull(void) {
|
||||
static bool
|
||||
all_digits(const char *s) {
|
||||
if (*s == '\0') {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
while (*s != '\0') {
|
||||
if (!isdigit((unsigned char)(*s))) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -464,41 +572,20 @@ named_os_inituserinfo(const char *username) {
|
||||
}
|
||||
|
||||
void
|
||||
named_os_restoreuser(void) {
|
||||
if (runas_pw == NULL || done_setuid) {
|
||||
return;
|
||||
}
|
||||
|
||||
REQUIRE(saved_uid != (uid_t)-1);
|
||||
REQUIRE(saved_gid != (gid_t)-1);
|
||||
|
||||
setperms(saved_uid, saved_gid);
|
||||
}
|
||||
|
||||
void
|
||||
named_os_changeuser(bool permanent) {
|
||||
named_os_changeuser(void) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
if (runas_pw == NULL || done_setuid) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!permanent) {
|
||||
saved_uid = getuid();
|
||||
saved_gid = getgid();
|
||||
|
||||
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
done_setuid = true;
|
||||
|
||||
if (setgid(runas_pw->pw_gid) == -1) {
|
||||
if (setgid(runas_pw->pw_gid) < 0) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlyfatal("setgid(): %s", strbuf);
|
||||
}
|
||||
|
||||
if (setuid(runas_pw->pw_uid) == -1) {
|
||||
if (setuid(runas_pw->pw_uid) < 0) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlyfatal("setuid(): %s", strbuf);
|
||||
}
|
||||
@@ -519,11 +606,11 @@ named_os_changeuser(bool permanent) {
|
||||
}
|
||||
|
||||
uid_t
|
||||
named_os_uid(void) {
|
||||
ns_os_uid(void) {
|
||||
if (runas_pw == NULL) {
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
return runas_pw->pw_uid;
|
||||
return (runas_pw->pw_uid);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -575,7 +662,7 @@ void
|
||||
named_os_minprivs(void) {
|
||||
#if HAVE_LIBCAP
|
||||
linux_keepcaps();
|
||||
named_os_changeuser(true);
|
||||
named_os_changeuser();
|
||||
linux_minprivs();
|
||||
#endif /* HAVE_LIBCAP */
|
||||
}
|
||||
@@ -587,22 +674,22 @@ safe_open(const char *filename, mode_t mode, bool append) {
|
||||
|
||||
if (stat(filename, &sb) == -1) {
|
||||
if (errno != ENOENT) {
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
} else if ((sb.st_mode & S_IFREG) == 0) {
|
||||
errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (append) {
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, mode);
|
||||
} else {
|
||||
if (unlink(filename) < 0 && errno != ENOENT) {
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, mode);
|
||||
}
|
||||
return fd;
|
||||
return (fd);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -618,6 +705,24 @@ cleanup_pidfile(void) {
|
||||
pidfile = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_lockfile(void) {
|
||||
if (singletonfd != -1) {
|
||||
close(singletonfd);
|
||||
singletonfd = -1;
|
||||
}
|
||||
|
||||
if (lockfile != NULL) {
|
||||
int n = unlink(lockfile);
|
||||
if (n == -1 && errno != ENOENT) {
|
||||
named_main_earlywarning("unlink '%s': failed",
|
||||
lockfile);
|
||||
}
|
||||
free(lockfile);
|
||||
lockfile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure that a directory exists.
|
||||
* NOTE: This function overwrites the '/' characters in 'filename' with
|
||||
@@ -650,7 +755,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
|
||||
!strcmp(slash + 1, ".."))
|
||||
{
|
||||
*slash = '/';
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
mode = S_IRUSR | S_IWUSR | S_IXUSR; /* u=rwx */
|
||||
mode |= S_IRGRP | S_IXGRP; /* g=rx */
|
||||
@@ -672,11 +777,11 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
|
||||
}
|
||||
*slash = '/';
|
||||
}
|
||||
return 0;
|
||||
return (0);
|
||||
|
||||
error:
|
||||
*slash = '/';
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
FILE *
|
||||
@@ -693,25 +798,28 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlywarning("couldn't strdup() '%s': %s", filename,
|
||||
strbuf);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
if (mkdirpath(f, named_main_earlywarning) == -1) {
|
||||
free(f);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
free(f);
|
||||
|
||||
if (switch_user && runas_pw != NULL) {
|
||||
uid_t olduid = getuid();
|
||||
gid_t oldgid = getgid();
|
||||
|
||||
/*
|
||||
* Temporarily set UID/GID to the one we'll be running with
|
||||
* Set UID/GID to the one we'll be running with
|
||||
* eventually.
|
||||
*/
|
||||
named_os_changeuser(false);
|
||||
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
|
||||
|
||||
fd = safe_open(filename, mode, false);
|
||||
|
||||
/* Restore UID/GID to previous uid/gid */
|
||||
named_os_restoreuser();
|
||||
setperms(olduid, oldgid);
|
||||
|
||||
if (fd == -1) {
|
||||
fd = safe_open(filename, mode, false);
|
||||
@@ -737,7 +845,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlywarning("could not open file '%s': %s",
|
||||
filename, strbuf);
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
fp = fdopen(fd, "w");
|
||||
@@ -747,7 +855,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
||||
filename, strbuf);
|
||||
}
|
||||
|
||||
return fp;
|
||||
return (fp);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -798,10 +906,69 @@ named_os_writepidfile(const char *filename, bool first_time) {
|
||||
(void)fclose(fh);
|
||||
}
|
||||
|
||||
bool
|
||||
named_os_issingleton(const char *filename) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
struct flock lock;
|
||||
|
||||
if (singletonfd != -1) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (strcasecmp(filename, "none") == 0) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the containing directory if it doesn't exist.
|
||||
*/
|
||||
lockfile = strdup(filename);
|
||||
if (lockfile == NULL) {
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlyfatal("couldn't allocate memory for '%s': %s",
|
||||
filename, strbuf);
|
||||
} else {
|
||||
int ret = mkdirpath(lockfile, named_main_earlywarning);
|
||||
if (ret == -1) {
|
||||
named_main_earlywarning("couldn't create '%s'",
|
||||
filename);
|
||||
cleanup_lockfile();
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* named_os_openfile() uses safeopen() which removes any existing
|
||||
* files. We can't use that here.
|
||||
*/
|
||||
singletonfd = open(filename, O_WRONLY | O_CREAT,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
if (singletonfd == -1) {
|
||||
cleanup_lockfile();
|
||||
return (false);
|
||||
}
|
||||
|
||||
memset(&lock, 0, sizeof(lock));
|
||||
lock.l_type = F_WRLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 1;
|
||||
|
||||
/* Non-blocking (does not wait for lock) */
|
||||
if (fcntl(singletonfd, F_SETLK, &lock) == -1) {
|
||||
close(singletonfd);
|
||||
singletonfd = -1;
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
void
|
||||
named_os_shutdown(void) {
|
||||
closelog();
|
||||
cleanup_pidfile();
|
||||
cleanup_lockfile();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -863,5 +1030,5 @@ named_os_uname(void) {
|
||||
if (unamep == NULL) {
|
||||
getuname();
|
||||
}
|
||||
return unamep;
|
||||
return (unamep);
|
||||
}
|
||||
|
||||
+1034
-1714
File diff suppressed because it is too large
Load Diff
+118
-728
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
|
||||
|
||||
result = dns_tkeyctx_create(mctx, &tctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
@@ -91,9 +91,9 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
|
||||
}
|
||||
|
||||
*tctxp = tctx;
|
||||
return ISC_R_SUCCESS;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
failure:
|
||||
dns_tkeyctx_destroy(&tctx);
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user