Compare commits
517
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa2a1e92d | ||
|
|
93c3fb4a4c | ||
|
|
b10ae62dcd | ||
|
|
adbfa35035 | ||
|
|
0183c73540 | ||
|
|
b25280bc1c | ||
|
|
8044869bfb | ||
|
|
6900c4554f | ||
|
|
c0d6db2712 | ||
|
|
e0c6a2e4cb | ||
|
|
22fc347de9 | ||
|
|
94b9cd38d7 | ||
|
|
8af5d33768 | ||
|
|
8456eab898 | ||
|
|
e4dacc0a04 | ||
|
|
50260a2ea0 | ||
|
|
b4492c7e8d | ||
|
|
abdc739c02 | ||
|
|
9e296bb2b4 | ||
|
|
f9f50ee667 | ||
|
|
7bd96b9c24 | ||
|
|
4926c232cd | ||
|
|
7624ae6af8 | ||
|
|
f0972d5bbd | ||
|
|
863f33f3eb | ||
|
|
bb2dec1697 | ||
|
|
4f9e0936f0 | ||
|
|
01646805bb | ||
|
|
777ad343cc | ||
|
|
c6f73b5d0c | ||
|
|
11a0d771f9 | ||
|
|
d133acc8bb | ||
|
|
5aa1222cdf | ||
|
|
bfdd704889 | ||
|
|
36987a98d1 | ||
|
|
ab2676f74e | ||
|
|
19be2e7efa | ||
|
|
0dfa6afa09 | ||
|
|
e09e5cd7f5 | ||
|
|
d6777801a3 | ||
|
|
e60ea71ec1 | ||
|
|
eed269270e | ||
|
|
32d00479e6 | ||
|
|
85c2f8dab5 | ||
|
|
4880224a6a | ||
|
|
1b9df6779d | ||
|
|
777fb6a6f2 | ||
|
|
8d0360474c | ||
|
|
25496b2299 | ||
|
|
887244ae86 | ||
|
|
649fe9be35 | ||
|
|
a16d99d3fe | ||
|
|
f6546a2466 | ||
|
|
829b461c54 | ||
|
|
99a019eb06 | ||
|
|
cdef20bb66 | ||
|
|
c646c20e79 | ||
|
|
2e55baddd8 | ||
|
|
6270e602ea | ||
|
|
29696e495f | ||
|
|
932d618a13 | ||
|
|
d75b945a30 | ||
|
|
241c7e91fe | ||
|
|
e177963906 | ||
|
|
db3ce9c0a9 | ||
|
|
5eded8d66e | ||
|
|
cac3c8e6fb | ||
|
|
c931d8e417 | ||
|
|
dbe15330fe | ||
|
|
b833064648 | ||
|
|
118692e949 | ||
|
|
a0349b18e0 | ||
|
|
677aa65aad | ||
|
|
dd2830eb97 | ||
|
|
c380e32e9a | ||
|
|
c209ec90f3 | ||
|
|
f16738bae2 | ||
|
|
c38752b07c | ||
|
|
de16ce0581 | ||
|
|
bc539d48e7 | ||
|
|
a133239698 | ||
|
|
d3843161ab | ||
|
|
b43f5e0238 | ||
|
|
3116a1c2f1 | ||
|
|
c7866acbf7 | ||
|
|
c72d37f3d5 | ||
|
|
33fa3d5eb1 | ||
|
|
a5c87d9d18 | ||
|
|
497c797762 | ||
|
|
bc1d4c9cb4 | ||
|
|
b97d003033 | ||
|
|
d4f7603af2 | ||
|
|
21bb9fa77f | ||
|
|
e557894717 | ||
|
|
a5e90f2aa7 | ||
|
|
95483951ce | ||
|
|
e9bc2c865a | ||
|
|
d708370db4 | ||
|
|
d72845f01c | ||
|
|
41fe9b7a14 | ||
|
|
de92c24b56 | ||
|
|
341840c026 | ||
|
|
0dfec4eef7 | ||
|
|
fea8b5eae6 | ||
|
|
1e4773f121 | ||
|
|
ec95bc6f2c | ||
|
|
0d5ec0c7dc | ||
|
|
059b16b991 | ||
|
|
879c63b573 | ||
|
|
5db8ae931c | ||
|
|
a8a2c06cf2 | ||
|
|
09e061aef7 | ||
|
|
6504e7da95 | ||
|
|
58aa084edc | ||
|
|
8c0db909ee | ||
|
|
ae6bf1979d | ||
|
|
2733edb2a6 | ||
|
|
9dc630016e | ||
|
|
f862b974b1 | ||
|
|
e97313b44d | ||
|
|
b6eb28f629 | ||
|
|
b9862397ca | ||
|
|
e378241324 | ||
|
|
64c7bb3552 | ||
|
|
9371bad268 | ||
|
|
8ea60d63c7 | ||
|
|
e8bf82efc6 | ||
|
|
98d5109e82 | ||
|
|
550bbee427 | ||
|
|
5ab80ff7ca | ||
|
|
d77cad8a41 | ||
|
|
737501b0d3 | ||
|
|
be159f5565 | ||
|
|
7fae1ef12b | ||
|
|
2f694f0b77 | ||
|
|
67d245d965 | ||
|
|
e6c5ecd698 | ||
|
|
aea824f16e | ||
|
|
a9a9aa7fd8 | ||
|
|
b378d0371f | ||
|
|
a787bc0b14 | ||
|
|
be3a11029a | ||
|
|
5214f24d7b | ||
|
|
7f0fcb8a3e | ||
|
|
dd6598f391 | ||
|
|
891f24fa57 | ||
|
|
fccf65a585 | ||
|
|
bf7a99a3c1 | ||
|
|
7ba1af0280 | ||
|
|
714594d468 | ||
|
|
44b08521ef | ||
|
|
0312e73e16 | ||
|
|
d64921848d | ||
|
|
2e189bb053 | ||
|
|
1b1a94ea6d | ||
|
|
8456b5627d | ||
|
|
e4d08c0232 | ||
|
|
b6c3a2f172 | ||
|
|
1efc7550a3 | ||
|
|
5fc9efba30 | ||
|
|
aa101260d9 | ||
|
|
0be2dc9f22 | ||
|
|
331b74d6bf | ||
|
|
a038f77d92 | ||
|
|
d162bbcceb | ||
|
|
a9bd6f6ea6 | ||
|
|
9943c5dce5 | ||
|
|
2c0c333d16 | ||
|
|
830d40b36e | ||
|
|
7135ef78ee | ||
|
|
37b41ff693 | ||
|
|
3079956ff7 | ||
|
|
59a1e5564d | ||
|
|
99ed3a0e13 | ||
|
|
a9c1fffba0 | ||
|
|
b8be29fee6 | ||
|
|
2868eafc46 | ||
|
|
c00def343f | ||
|
|
05ae2e48ab | ||
|
|
478e4ac201 | ||
|
|
bb65e57297 | ||
|
|
d6de520bd1 | ||
|
|
704b9ee9d0 | ||
|
|
c65c06301c | ||
|
|
f17b9b8dd1 | ||
|
|
7b948c7335 | ||
|
|
6c2e138d7a | ||
|
|
668a972d1e | ||
|
|
dfd96e1aa5 | ||
|
|
7a002c7ece | ||
|
|
fc4e44bd37 | ||
|
|
8745043a86 | ||
|
|
dba0163dac | ||
|
|
9f6e0dc945 | ||
|
|
c73e5866c4 | ||
|
|
d5f682a00b | ||
|
|
4459745ff2 | ||
|
|
9286548c7e | ||
|
|
5eb3f71a3e | ||
|
|
33328871a7 | ||
|
|
de123a67d6 | ||
|
|
1248f05ae8 | ||
|
|
8ceaf28442 | ||
|
|
2ec5b852df | ||
|
|
02c2fc5ad3 | ||
|
|
7c0d9dac9f | ||
|
|
d159fdf25d | ||
|
|
68a360772f | ||
|
|
379949cce4 | ||
|
|
272a31f758 | ||
|
|
279f6b01de | ||
|
|
a09c464a20 | ||
|
|
f91b3a69ce | ||
|
|
0adb4b25d3 | ||
|
|
77332eb2c8 | ||
|
|
a8836b381f | ||
|
|
4f9bfe1460 | ||
|
|
7b0ba6eb10 | ||
|
|
6adcd739ca | ||
|
|
0147acd7b6 | ||
|
|
e48b2424aa | ||
|
|
784e64f238 | ||
|
|
ed52ffba38 | ||
|
|
9b6df37303 | ||
|
|
4a992c7a18 | ||
|
|
a1a5559a8a | ||
|
|
f3f7b7df5d | ||
|
|
7443bd5cc7 | ||
|
|
c6ba51cfc4 | ||
|
|
82c418abfa | ||
|
|
b3f06729e5 | ||
|
|
a2254f01c4 | ||
|
|
42e1fb8322 | ||
|
|
7417b79c7a | ||
|
|
85555f29d7 | ||
|
|
754f7588c6 | ||
|
|
20b446cdc3 | ||
|
|
1f3502f564 | ||
|
|
b5cfc1c056 | ||
|
|
43279de8e6 | ||
|
|
7a605b4d05 | ||
|
|
5b448996e5 | ||
|
|
9643a62dd5 | ||
|
|
7c3f419d66 | ||
|
|
8b159c33ac | ||
|
|
9e6f6156f7 | ||
|
|
8648b7cdb2 | ||
|
|
796b38fe0c | ||
|
|
78a6b2689b | ||
|
|
741bc11bdb | ||
|
|
4a26f7d149 | ||
|
|
27a9be3034 | ||
|
|
bb061abbb9 | ||
|
|
63b702d0d0 | ||
|
|
1beba0fa59 | ||
|
|
e1c4a69197 | ||
|
|
684a44b469 | ||
|
|
0cd10c7763 | ||
|
|
4227b7969b | ||
|
|
ccf7bbab5d | ||
|
|
3b1bd3f48b | ||
|
|
aafb804eb8 | ||
|
|
05c6a29c87 | ||
|
|
6d8d06e82e | ||
|
|
fd8788eb94 | ||
|
|
42f0e25a4c | ||
|
|
8d6dc8613a | ||
|
|
dcc0835a3a | ||
|
|
f75a9e32be | ||
|
|
16908ec3d9 | ||
|
|
402f067fc0 | ||
|
|
938fc81493 | ||
|
|
df709dcf8a | ||
|
|
05f2ba973f | ||
|
|
9c5547b118 | ||
|
|
451484b870 | ||
|
|
aac8736998 | ||
|
|
05f2241fcb | ||
|
|
48989e9426 | ||
|
|
1af6de6b62 | ||
|
|
95c76e537f | ||
|
|
e19819457b | ||
|
|
8b9a3314b1 | ||
|
|
fa04c87578 | ||
|
|
6a1c41143f | ||
|
|
4c1adf96de | ||
|
|
eda4300bbb | ||
|
|
0d637b5985 | ||
|
|
1bee87a364 | ||
|
|
525c583145 | ||
|
|
0cf47ed363 | ||
|
|
ea7cc30f7c | ||
|
|
493b6a9f33 | ||
|
|
1639dc8dca | ||
|
|
fc36798a81 | ||
|
|
72b3b458d3 | ||
|
|
6799a222d1 | ||
|
|
2d249ebeae | ||
|
|
678e2d3cfa | ||
|
|
b984a4b647 | ||
|
|
7fdf40770f | ||
|
|
21d3f66f1c | ||
|
|
8f902a72ff | ||
|
|
fc9c7025bc | ||
|
|
4f74e75632 | ||
|
|
3000f14eba | ||
|
|
4d1e3b1e10 | ||
|
|
ede2208d96 | ||
|
|
c4aec79079 | ||
|
|
49976947ab | ||
|
|
a910b0a839 | ||
|
|
64e2331843 | ||
|
|
6afa99362a | ||
|
|
e711b0304f | ||
|
|
7c3e342935 | ||
|
|
9ce3254a1b | ||
|
|
7dfc092f06 | ||
|
|
5208505f03 | ||
|
|
fbf9856f43 | ||
|
|
4643ee04bd | ||
|
|
b665ce2a96 | ||
|
|
6ee1461cc3 | ||
|
|
0d4d65e7f2 | ||
|
|
b3c1b2a869 | ||
|
|
649a34d628 | ||
|
|
5e74550740 | ||
|
|
6ad0133156 | ||
|
|
c3ed086cf0 | ||
|
|
5234a8e00a | ||
|
|
90a1dabe74 | ||
|
|
80a5c9f5c8 | ||
|
|
a4ec0ccb91 | ||
|
|
7a7b09fee6 | ||
|
|
20c077afc5 | ||
|
|
e38004457c | ||
|
|
67c1ca9a79 | ||
|
|
c6c0a9fdba | ||
|
|
ab1adcca98 | ||
|
|
3526c73062 | ||
|
|
7787de80ca | ||
|
|
aa96ec25c8 | ||
|
|
ec8334fb74 | ||
|
|
8797d8ad08 | ||
|
|
72f0e01f5d | ||
|
|
423a627946 | ||
|
|
42384f367a | ||
|
|
6056efc3ce | ||
|
|
2eaab4042b | ||
|
|
c17783b99e | ||
|
|
343c6d357c | ||
|
|
933df7b31c | ||
|
|
136dcfd692 | ||
|
|
98136164aa | ||
|
|
afc4867e99 | ||
|
|
4f7d1298a8 | ||
|
|
84b557e7cb | ||
|
|
5b600c2cd8 | ||
|
|
b1b1bae9c1 | ||
|
|
bebf353eb5 | ||
|
|
6acbd31bd4 | ||
|
|
ea7bddb4ca | ||
|
|
423eee834a | ||
|
|
640dd566e9 | ||
|
|
fb2f98a9a1 | ||
|
|
17deac8b8e | ||
|
|
91e1981988 | ||
|
|
255134166c | ||
|
|
3bce0c2c20 | ||
|
|
2dc4d72fa9 | ||
|
|
cd17b773b1 | ||
|
|
13fa80ede8 | ||
|
|
e3d8732548 | ||
|
|
05aa45c602 | ||
|
|
9bd6720f58 | ||
|
|
46982b414b | ||
|
|
2c38dd5474 | ||
|
|
935a2ae33f | ||
|
|
db9ad43294 | ||
|
|
6a94e6ba73 | ||
|
|
fc0fe4c5a7 | ||
|
|
56f388cae1 | ||
|
|
b2f3eaf188 | ||
|
|
2d00143ab1 | ||
|
|
996c1d3727 | ||
|
|
2df13f79ef | ||
|
|
993633ad96 | ||
|
|
848c1c8b8b | ||
|
|
7278f2529a | ||
|
|
39780ae54f | ||
|
|
d26e125438 | ||
|
|
bff83b9480 | ||
|
|
6012479419 | ||
|
|
9d8f9cc8f2 | ||
|
|
dafb1eb8bb | ||
|
|
41d827893e | ||
|
|
3352a38da4 | ||
|
|
b218bf5227 | ||
|
|
f8ec2140be | ||
|
|
2f2bc03b2d | ||
|
|
85f3476894 | ||
|
|
e6d7384c0d | ||
|
|
0b7339ac6e | ||
|
|
17d25dbf47 | ||
|
|
c2421a1ec3 | ||
|
|
5746172da3 | ||
|
|
de42a7aa9f | ||
|
|
67bac2bcd9 | ||
|
|
e088272172 | ||
|
|
a3dc02103a | ||
|
|
8c48c4f738 | ||
|
|
114520425c | ||
|
|
ed9853e739 | ||
|
|
ead7b3dc53 | ||
|
|
74082abba0 | ||
|
|
d5b6db3b09 | ||
|
|
d35739d516 | ||
|
|
6f3fdf36b4 | ||
|
|
62abb6aa82 | ||
|
|
a6f2d6191e | ||
|
|
ad12c2f3b0 | ||
|
|
80c476721c | ||
|
|
cf48e8eb32 | ||
|
|
8536d740f1 | ||
|
|
c428479d6d | ||
|
|
448ada561d | ||
|
|
b6960da6c8 | ||
|
|
7ee4ff6182 | ||
|
|
7aa77038bd | ||
|
|
94bddd2ce3 | ||
|
|
e792d01e00 | ||
|
|
53858d4afd | ||
|
|
88497a59cc | ||
|
|
b0f7351820 | ||
|
|
922a2ae44a | ||
|
|
5a4a6b5e91 | ||
|
|
2b1c8c54d1 | ||
|
|
12564928a7 | ||
|
|
8d56749046 | ||
|
|
c0be772ebc | ||
|
|
925ecb0aae | ||
|
|
eee162257c | ||
|
|
075613aea4 | ||
|
|
48ece3bb9d | ||
|
|
0ee0580fc9 | ||
|
|
37fe7c5269 | ||
|
|
13aaeaa06f | ||
|
|
5589748eca | ||
|
|
03ed64c251 | ||
|
|
1fa0deb4ea | ||
|
|
71fe7d3c25 | ||
|
|
3248de7785 | ||
|
|
977f334648 | ||
|
|
fd52417f71 | ||
|
|
ac564683cf | ||
|
|
2ee7ff23ce | ||
|
|
dbbfcdc1f7 | ||
|
|
52773e226a | ||
|
|
ec80c7b576 | ||
|
|
ccd44b69e5 | ||
|
|
01481dee1c | ||
|
|
83e54f906d | ||
|
|
31b3980ef0 | ||
|
|
8c0792723d | ||
|
|
35679aef9b | ||
|
|
a34ced776e | ||
|
|
86a847314a | ||
|
|
b804d3a395 | ||
|
|
b0779cc429 | ||
|
|
ef2dff5c7a | ||
|
|
c7b86d1cac | ||
|
|
3e66b7ba1c | ||
|
|
23ab349bbd | ||
|
|
0bf74ac792 | ||
|
|
b05194160b | ||
|
|
8c5aaacbef | ||
|
|
5a65ec0aff | ||
|
|
bc5aae1579 | ||
|
|
09c2dbffb5 | ||
|
|
c6efc0e50f | ||
|
|
176b23b6cd | ||
|
|
23e29b17db | ||
|
|
eb8007a5ba | ||
|
|
2a65a47f39 | ||
|
|
fb03edacd8 | ||
|
|
0e15cbb092 | ||
|
|
10f4cd066f | ||
|
|
64df488e1e | ||
|
|
12578b9e96 | ||
|
|
8885fd6966 | ||
|
|
9e8cd3ccc5 | ||
|
|
6ff780db5b | ||
|
|
2e7cb4978f | ||
|
|
910a7a56bc | ||
|
|
bd4035900a | ||
|
|
2e4273b55a | ||
|
|
cfaa631f65 | ||
|
|
6b4a17ef7c | ||
|
|
edd6a084f0 | ||
|
|
4b66c0ebf4 | ||
|
|
0f9d45a5b8 | ||
|
|
a339a6df48 | ||
|
|
6f096f5245 | ||
|
|
8120088ec7 | ||
|
|
fe31fedc31 | ||
|
|
4dd9ec8919 | ||
|
|
1334daaec0 | ||
|
|
dd6f9391c3 | ||
|
|
34fb70b17c | ||
|
|
d8905b7a9c | ||
|
|
3c3085be3c | ||
|
|
bf3eeac067 | ||
|
|
b4d37878f6 | ||
|
|
b0916bba41 | ||
|
|
26ee43da1b | ||
|
|
9dfa33050b | ||
|
|
60fa5fc760 | ||
|
|
8fd8404e16 |
@@ -0,0 +1,61 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterEnum: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterControlStatement: MultiLine
|
||||
AfterFunction: false # should also be MultiLine, but not yet supported
|
||||
AfterExternBlock: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakAfterReturnType: All
|
||||
Cpp11BracedListStyle: false
|
||||
ColumnLimit: 80
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
AlignEscapedNewlines: Left
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
PointerBindsToType: false
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<isc/'
|
||||
Priority: 2
|
||||
- Regex: '^<dns/'
|
||||
Priority: 3
|
||||
- Regex: '^<iscccc/'
|
||||
Priority: 4
|
||||
- Regex: '^<isccfg/'
|
||||
Priority: 5
|
||||
- Regex: '^<ns/'
|
||||
Priority: 6
|
||||
- Regex: '^<bind9/)'
|
||||
Priority: 7
|
||||
- Regex: '^(<[^/]*)/)'
|
||||
Priority: 8
|
||||
- Regex: '<[[:alnum:].]+>'
|
||||
Priority: 1
|
||||
- Regex: '".*"'
|
||||
Priority: 9
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
@@ -0,0 +1,61 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterEnum: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterControlStatement: MultiLine
|
||||
AfterFunction: false # should also be MultiLine, but not yet supported
|
||||
AfterExternBlock: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakAfterReturnType: All
|
||||
Cpp11BracedListStyle: false
|
||||
ColumnLimit: 80
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignConsecutiveMacros: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
AlignEscapedNewlines: Left
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
PointerBindsToType: false
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<isc/'
|
||||
Priority: 2
|
||||
- Regex: '^<dns/'
|
||||
Priority: 3
|
||||
- Regex: '^<iscccc/'
|
||||
Priority: 4
|
||||
- Regex: '^<isccfg/'
|
||||
Priority: 5
|
||||
- Regex: '^<ns/'
|
||||
Priority: 6
|
||||
- Regex: '^<bind9/)'
|
||||
Priority: 7
|
||||
- Regex: '^(<[^/]*)/)'
|
||||
Priority: 8
|
||||
- Regex: '<[[:alnum:].]+>'
|
||||
Priority: 1
|
||||
- Regex: '".*"'
|
||||
Priority: 9
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 80
|
||||
PenaltyExcessCharacter: 100
|
||||
Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
@@ -1,2 +1,10 @@
|
||||
*.sln.in eol=crlf
|
||||
*.vcxproj.* eol=crlf
|
||||
|
||||
.gitignore export-ignore
|
||||
/conftools export-ignore
|
||||
/doc/design export-ignore
|
||||
/doc/dev export-ignore
|
||||
/util/** export-ignore
|
||||
/util/bindkeys.pl -export-ignore
|
||||
/util/mksymtbl.pl -export-ignore
|
||||
|
||||
@@ -60,3 +60,4 @@ timestamp
|
||||
/compile_commands.json
|
||||
/cppcheck_html/
|
||||
/cppcheck.results
|
||||
/tsan
|
||||
|
||||
+457
-101
@@ -17,10 +17,20 @@ variables:
|
||||
|
||||
MAKE: make
|
||||
CONFIGURE: ./configure
|
||||
CLANG: clang-9
|
||||
SCAN_BUILD: scan-build-9
|
||||
SYMBOLIZER: /usr/lib/llvm-9/bin/llvm-symbolizer
|
||||
ASAN_SYMBOLIZER_PATH: "$SYMBOLIZER"
|
||||
CLANG_FORMAT: clang-format-10
|
||||
|
||||
CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra
|
||||
|
||||
# Pass run-time flags to AddressSanitizer to get core dumps on error.
|
||||
ASAN_OPTIONS_COMMON: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1
|
||||
|
||||
TARBALL_COMPRESSOR: xz
|
||||
TARBALL_EXTENSION: xz
|
||||
|
||||
stages:
|
||||
- precheck
|
||||
- build
|
||||
@@ -29,6 +39,7 @@ stages:
|
||||
- docs
|
||||
- push
|
||||
- postcheck
|
||||
- release
|
||||
|
||||
### Runner Tag Templates
|
||||
|
||||
@@ -44,6 +55,11 @@ stages:
|
||||
- linux
|
||||
- amd64
|
||||
|
||||
.linux-arm64: &linux_arm64
|
||||
tags:
|
||||
- linux
|
||||
- arm64
|
||||
|
||||
.linux-i386: &linux_i386
|
||||
tags:
|
||||
- linux
|
||||
@@ -51,15 +67,15 @@ stages:
|
||||
|
||||
.openbsd-amd64: &openbsd_amd64
|
||||
tags:
|
||||
- openbsd
|
||||
- libvirt
|
||||
- amd64
|
||||
|
||||
### Docker Image Templates
|
||||
|
||||
# Alpine Linux
|
||||
|
||||
.alpine-3.10-amd64: &alpine_3_10_amd64_image
|
||||
image: "$CI_REGISTRY_IMAGE:alpine-3.10-amd64"
|
||||
.alpine-3.11-amd64: &alpine_3_11_amd64_image
|
||||
image: "$CI_REGISTRY_IMAGE:alpine-3.11-amd64"
|
||||
<<: *linux_amd64
|
||||
|
||||
# CentOS
|
||||
@@ -98,14 +114,24 @@ stages:
|
||||
image: "$CI_REGISTRY_IMAGE:debian-sid-amd64"
|
||||
<<: *linux_amd64
|
||||
|
||||
.debian-sid-arm64: &debian_sid_arm64_image
|
||||
image: "$CI_REGISTRY_IMAGE:debian-sid-arm64"
|
||||
<<: *linux_arm64
|
||||
|
||||
.debian-sid-i386: &debian_sid_i386_image
|
||||
image: "$CI_REGISTRY_IMAGE:debian-sid-i386"
|
||||
<<: *linux_i386
|
||||
|
||||
# openSUSE Tumbleweed
|
||||
|
||||
.tumbleweed-latest-amd64: &tumbleweed_latest_amd64_image
|
||||
image: "$CI_REGISTRY_IMAGE:tumbleweed-latest-amd64"
|
||||
<<: *linux_amd64
|
||||
|
||||
# Fedora
|
||||
|
||||
.fedora-30-amd64: &fedora_30_amd64_image
|
||||
image: "$CI_REGISTRY_IMAGE:fedora-30-amd64"
|
||||
.fedora-31-amd64: &fedora_31_amd64_image
|
||||
image: "$CI_REGISTRY_IMAGE:fedora-31-amd64"
|
||||
<<: *linux_amd64
|
||||
|
||||
# Ubuntu
|
||||
@@ -133,12 +159,14 @@ stages:
|
||||
- merge_requests
|
||||
- tags
|
||||
- web
|
||||
- schedules
|
||||
|
||||
.release-branch-triggering-rules: &release_branch_triggering_rules
|
||||
only:
|
||||
- merge_requests
|
||||
- tags
|
||||
- web
|
||||
- schedules
|
||||
- master@isc-projects/bind9
|
||||
- /^v9_[1-9][0-9]$/@isc-projects/bind9
|
||||
|
||||
@@ -159,7 +187,7 @@ stages:
|
||||
- configure
|
||||
- ltmain.sh
|
||||
- m4/libtool.m4
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
|
||||
.configure: &configure |
|
||||
${CONFIGURE} \
|
||||
@@ -174,12 +202,13 @@ stages:
|
||||
--without-make-clean \
|
||||
$EXTRA_CONFIGURE \
|
||||
|| cat config.log
|
||||
|
||||
|
||||
.build: &build_job
|
||||
<<: *default_triggering_rules
|
||||
stage: build
|
||||
before_script:
|
||||
- test -w "${CCACHE_DIR}" && export PATH="/usr/lib/ccache:${PATH}"
|
||||
- test -n "${OOT_BUILD_WORKSPACE}" && mkdir "${OOT_BUILD_WORKSPACE}" && cd "${OOT_BUILD_WORKSPACE}"
|
||||
script:
|
||||
- *configure
|
||||
- ${MAKE} -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
|
||||
@@ -190,7 +219,37 @@ stages:
|
||||
- autoreconf:sid:amd64
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
|
||||
.windows_build: &windows_build_job
|
||||
stage: build
|
||||
tags:
|
||||
- windows
|
||||
- amd64
|
||||
script:
|
||||
- 'Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build"'
|
||||
- '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
|
||||
- 'Pop-Location'
|
||||
- 'Set-Location win32utils'
|
||||
- '& "C:/Strawberry/perl/bin/perl.exe" Configure
|
||||
"with-tools-version=15.0"
|
||||
"with-platform-toolset=v141"
|
||||
"with-platform-version=10.0.17763.0"
|
||||
"with-vcredist=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Redist/MSVC/14.16.27012/vcredist_x64.exe"
|
||||
"with-openssl=C:/OpenSSL"
|
||||
"with-libxml2=C:/libxml2"
|
||||
"with-libuv=C:/libuv"
|
||||
"without-python"
|
||||
"with-system-tests"
|
||||
x64'
|
||||
- 'Set-Item -path "Env:CL" -value "/MP$([Math]::Truncate($BUILD_PARALLEL_JOBS/2))"'
|
||||
- '& msbuild.exe /maxCpuCount:2 /t:Build /p:Configuration=$VSCONF bind9.sln'
|
||||
dependencies: []
|
||||
needs:
|
||||
- autoreconf:sid:amd64
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 day"
|
||||
|
||||
.setup_interfaces: &setup_interfaces |
|
||||
if [ "$(id -u)" -eq "0" ]; then
|
||||
@@ -200,7 +259,7 @@ stages:
|
||||
fi
|
||||
|
||||
.setup_softhsm: &setup_softhsm |
|
||||
sh -x util/prepare-softhsm2.sh
|
||||
sh -x bin/tests/prepare-softhsm2.sh
|
||||
|
||||
.system_test: &system_test_job
|
||||
<<: *default_triggering_rules
|
||||
@@ -213,7 +272,7 @@ stages:
|
||||
- test -s bin/tests/system/systests.output
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
|
||||
.kyua_report: &kyua_report_html |
|
||||
@@ -223,6 +282,30 @@ stages:
|
||||
--results-filter "" \
|
||||
--output kyua_html
|
||||
|
||||
.windows_system_test: &windows_system_test_job
|
||||
stage: system
|
||||
tags:
|
||||
- windows
|
||||
- amd64
|
||||
script:
|
||||
- 'Push-Location bin/tests/system'
|
||||
- '$ifIndex = Get-NetIPInterface -AddressFamily IPv4 -InterfaceMetric 75 | Select-Object -ExpandProperty ifIndex'
|
||||
- '& C:/tools/cygwin/bin/sed.exe -i "s/^exit.*/netsh interface ipv4 set dnsservers $ifIndex dhcp/; s/\(name\|interface\)=Loopback/$ifIndex/;" ifconfig.bat'
|
||||
- '& C:/tools/cygwin/bin/sed.exe -i "s/kill -f/kill -W/;" conf.sh stop.pl'
|
||||
- '& cmd.exe /C ifconfig.bat up; ""'
|
||||
- 'Start-Sleep 2'
|
||||
- '$Env:Path = "C:/tools/cygwin/bin;$Env:Path"'
|
||||
- '& sh.exe runall.sh $TEST_PARALLEL_JOBS'
|
||||
- 'If (Test-Path C:/CrashDumps/*) { dir C:/CrashDumps; Throw }'
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
only:
|
||||
- schedules
|
||||
- tags
|
||||
- web
|
||||
|
||||
.unit_test: &unit_test_job
|
||||
<<: *default_triggering_rules
|
||||
stage: unit
|
||||
@@ -237,7 +320,7 @@ stages:
|
||||
- kyua.log
|
||||
- kyua.results
|
||||
- kyua_html/
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
|
||||
.cppcheck_args: &run_cppcheck |
|
||||
@@ -275,7 +358,7 @@ stages:
|
||||
- compile_commands.json
|
||||
- cppcheck.results
|
||||
- cppcheck_html/
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
|
||||
### Job Definitions
|
||||
@@ -292,8 +375,11 @@ misc:sid:amd64:
|
||||
- sh util/checklibs.sh > checklibs.out
|
||||
- sh util/tabify-changes < CHANGES > CHANGES.tmp
|
||||
- diff -urNap CHANGES CHANGES.tmp
|
||||
- rm CHANGES.tmp
|
||||
- perl util/check-changes CHANGES
|
||||
- test ! -f CHANGES.SE || sh util/tabify-changes < CHANGES.SE > CHANGES.tmp
|
||||
- test ! -f CHANGES.SE || diff -urNap CHANGES.SE CHANGES.tmp
|
||||
- test ! -f CHANGES.SE || perl util/check-changes master=0 CHANGES.SE
|
||||
- rm CHANGES.tmp
|
||||
- perl -w util/merge_copyrights
|
||||
- diff -urNap util/copyrights util/newcopyrights
|
||||
- rm util/newcopyrights
|
||||
@@ -306,9 +392,15 @@ misc:sid:amd64:
|
||||
paths:
|
||||
- util/newcopyrights
|
||||
- checklibs.out
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
|
||||
💾:sid:amd64:
|
||||
<<: *precheck_job
|
||||
script:
|
||||
- if [ -r .clang-format ]; then "${CLANG_FORMAT}" -i -style=file $(git ls-files '*.c' '*.h'); fi
|
||||
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
|
||||
|
||||
🐞:sid:amd64:
|
||||
<<: *precheck_job
|
||||
<<: *debian_buster_amd64_image
|
||||
@@ -316,6 +408,23 @@ misc:sid:amd64:
|
||||
- util/check-cocci
|
||||
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
|
||||
|
||||
tarball-create:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
stage: precheck
|
||||
script:
|
||||
- source version
|
||||
- export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
|
||||
- git archive --prefix="${BIND_DIRECTORY}/" --output="${BIND_DIRECTORY}.tar" HEAD
|
||||
- mkdir "${BIND_DIRECTORY}"
|
||||
- echo "SRCID=$(git rev-list --max-count=1 HEAD | cut -b1-7)" > "${BIND_DIRECTORY}/srcid"
|
||||
- tar --append --file="${BIND_DIRECTORY}.tar" "${BIND_DIRECTORY}/srcid"
|
||||
- ${TARBALL_COMPRESSOR} "${BIND_DIRECTORY}.tar"
|
||||
artifacts:
|
||||
paths:
|
||||
- bind-*.tar.${TARBALL_EXTENSION}
|
||||
only:
|
||||
- tags
|
||||
|
||||
# Jobs for doc builds on Debian Sid (amd64)
|
||||
|
||||
docs:sid:amd64:
|
||||
@@ -345,29 +454,29 @@ push:docs:sid:amd64:
|
||||
- master@isc-projects/bind9
|
||||
- /^v9_[1-9][0-9]$/@isc-projects/bind9
|
||||
|
||||
# Jobs for regular GCC builds on Alpine Linux 3.10 (amd64)
|
||||
# Jobs for regular GCC builds on Alpine Linux 3.11 (amd64)
|
||||
|
||||
gcc:alpine3.10:amd64:
|
||||
gcc:alpine3.11:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
EXTRA_CONFIGURE: "--enable-dnstap"
|
||||
<<: *alpine_3_10_amd64_image
|
||||
<<: *alpine_3_11_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
system:gcc:alpine3.10:amd64:
|
||||
<<: *alpine_3_10_amd64_image
|
||||
system:gcc:alpine3.11:amd64:
|
||||
<<: *alpine_3_11_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- gcc:alpine3.10:amd64
|
||||
needs: ["gcc:alpine3.10:amd64"]
|
||||
- gcc:alpine3.11:amd64
|
||||
needs: ["gcc:alpine3.11:amd64"]
|
||||
|
||||
unit:gcc:alpine3.10:amd64:
|
||||
<<: *alpine_3_10_amd64_image
|
||||
unit:gcc:alpine3.11:amd64:
|
||||
<<: *alpine_3_11_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- gcc:alpine3.10:amd64
|
||||
needs: ["gcc:alpine3.10:amd64"]
|
||||
- gcc:alpine3.11:amd64
|
||||
needs: ["gcc:alpine3.11:amd64"]
|
||||
|
||||
# Jobs for regular GCC builds on CentOS 6 (amd64)
|
||||
|
||||
@@ -526,7 +635,7 @@ scan-build:buster:amd64:
|
||||
<<: *debian_buster_amd64_image
|
||||
stage: postcheck
|
||||
variables:
|
||||
CC: clang-9
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
CONFIGURE: "${SCAN_BUILD} ./configure"
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
@@ -540,7 +649,7 @@ scan-build:buster:amd64:
|
||||
artifacts:
|
||||
paths:
|
||||
- scan-build.reports/
|
||||
expire_in: "1 week"
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
|
||||
# Jobs for regular GCC builds on Debian Sid (amd64)
|
||||
@@ -576,6 +685,94 @@ cppcheck:gcc:sid:amd64:
|
||||
- gcc:sid:amd64
|
||||
needs: ["gcc:sid:amd64"]
|
||||
|
||||
# Job for out-of-tree GCC build on Debian Sid (amd64)
|
||||
|
||||
oot:sid:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -O3"
|
||||
CONFIGURE: ../configure
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
RUN_MAKE_INSTALL: 1
|
||||
OOT_BUILD_WORKSPACE: workspace
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
# Jobs for tarball GCC builds on Debian Sid (amd64)
|
||||
|
||||
tarball:sid:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
RUN_MAKE_INSTALL: 1
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *build_job
|
||||
before_script:
|
||||
- tar --extract --file bind-*.tar.${TARBALL_EXTENSION}
|
||||
- rm -f bind-*.tar.${TARBALL_EXTENSION}
|
||||
- cd bind-*
|
||||
dependencies:
|
||||
- tarball-create:sid:amd64
|
||||
needs: ["tarball-create:sid:amd64"]
|
||||
only:
|
||||
- tags
|
||||
|
||||
system:tarball:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *system_test_job
|
||||
before_script:
|
||||
- cd bind-*
|
||||
- *setup_interfaces
|
||||
dependencies:
|
||||
- tarball:sid:amd64
|
||||
needs: ["tarball:sid:amd64"]
|
||||
only:
|
||||
- tags
|
||||
|
||||
unit:tarball:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *unit_test_job
|
||||
before_script:
|
||||
- cd bind-*
|
||||
dependencies:
|
||||
- tarball:sid:amd64
|
||||
needs: ["tarball:sid:amd64"]
|
||||
only:
|
||||
- tags
|
||||
|
||||
# Jobs for regular GCC builds on Debian Sid (arm64)
|
||||
|
||||
gcc:sid:arm64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -O3"
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
RUN_MAKE_INSTALL: 1
|
||||
MAKE: bear make
|
||||
<<: *debian_sid_arm64_image
|
||||
<<: *build_job
|
||||
|
||||
system:gcc:sid:arm64:
|
||||
<<: *debian_sid_arm64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- gcc:sid:arm64
|
||||
needs: ["gcc:sid:arm64"]
|
||||
|
||||
unit:gcc:sid:arm64:
|
||||
<<: *debian_sid_arm64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- gcc:sid:arm64
|
||||
needs: ["gcc:sid:arm64"]
|
||||
|
||||
cppcheck:gcc:sid:arm64:
|
||||
<<: *debian_sid_arm64_image
|
||||
<<: *cppcheck_job
|
||||
dependencies:
|
||||
- gcc:sid:arm64
|
||||
needs: ["gcc:sid:arm64"]
|
||||
|
||||
# Jobs for regular GCC builds on Debian Sid (i386)
|
||||
|
||||
gcc:sid:i386:
|
||||
@@ -600,29 +797,53 @@ unit:gcc:sid:i386:
|
||||
- gcc:sid:i386
|
||||
needs: ["gcc:sid:i386"]
|
||||
|
||||
# Jobs for regular GCC builds on Fedora 30 (amd64)
|
||||
# Jobs for regular GCC builds on openSUSE Tumbleweed (amd64)
|
||||
|
||||
gcc:fedora30:amd64:
|
||||
gcc:tumbleweed:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
EXTRA_CONFIGURE: "--with-libidn2"
|
||||
<<: *tumbleweed_latest_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
system:gcc:tumbleweed:amd64:
|
||||
<<: *tumbleweed_latest_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- gcc:tumbleweed:amd64
|
||||
needs: ["gcc:tumbleweed:amd64"]
|
||||
|
||||
unit:gcc:tumbleweed:amd64:
|
||||
<<: *tumbleweed_latest_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- gcc:tumbleweed:amd64
|
||||
needs: ["gcc:tumbleweed:amd64"]
|
||||
|
||||
# Jobs for regular GCC builds on Fedora 31 (amd64)
|
||||
|
||||
gcc:fedora31:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -O1"
|
||||
EXTRA_CONFIGURE: "--with-libidn2"
|
||||
<<: *fedora_30_amd64_image
|
||||
<<: *fedora_31_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
system:gcc:fedora30:amd64:
|
||||
<<: *fedora_30_amd64_image
|
||||
system:gcc:fedora31:amd64:
|
||||
<<: *fedora_31_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- gcc:fedora30:amd64
|
||||
needs: ["gcc:fedora30:amd64"]
|
||||
- gcc:fedora31:amd64
|
||||
needs: ["gcc:fedora31:amd64"]
|
||||
|
||||
unit:gcc:fedora30:amd64:
|
||||
<<: *fedora_30_amd64_image
|
||||
unit:gcc:fedora31:amd64:
|
||||
<<: *fedora_31_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- gcc:fedora30:amd64
|
||||
needs: ["gcc:fedora30:amd64"]
|
||||
- gcc:fedora31:amd64
|
||||
needs: ["gcc:fedora31:amd64"]
|
||||
|
||||
# Jobs for regular GCC builds on Ubuntu 16.04 Xenial Xerus (amd64)
|
||||
|
||||
@@ -684,6 +905,8 @@ asan:sid:amd64:
|
||||
<<: *build_job
|
||||
|
||||
system:asan:sid:amd64:
|
||||
variables:
|
||||
ASAN_OPTIONS: ${ASAN_OPTIONS_COMMON}
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
@@ -691,12 +914,71 @@ system:asan:sid:amd64:
|
||||
needs: ["asan:sid:amd64"]
|
||||
|
||||
unit:asan:sid:amd64:
|
||||
variables:
|
||||
ASAN_OPTIONS: ${ASAN_OPTIONS_COMMON}
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- asan:sid:amd64
|
||||
needs: ["asan:sid:amd64"]
|
||||
|
||||
# Jobs for GCC builds with TSAN enabled on Debian Sid (amd64)
|
||||
|
||||
tsan:buster:amd64:
|
||||
<<: *debian_buster_amd64_image
|
||||
<<: *build_job
|
||||
variables:
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0"
|
||||
LDFLAGS: "-fsanitize=thread"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock"
|
||||
|
||||
system:tsan:buster:amd64:
|
||||
variables:
|
||||
TSAN_OPTIONS: "second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan external_symbolizer_path=$SYMBOLIZER exitcode=0"
|
||||
before_script:
|
||||
- *setup_interfaces
|
||||
- echo $TSAN_OPTIONS
|
||||
<<: *debian_buster_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- tsan:buster:amd64
|
||||
needs: ["tsan:buster:amd64"]
|
||||
allow_failure: true
|
||||
after_script:
|
||||
- find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
|
||||
artifacts:
|
||||
expire_in: "1 day"
|
||||
paths:
|
||||
- bin/tests/system/*/tsan.*
|
||||
- bin/tests/system/*/*/tsan.*
|
||||
- tsan/
|
||||
when: on_failure
|
||||
|
||||
unit:tsan:buster:amd64:
|
||||
variables:
|
||||
TSAN_OPTIONS: "second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan external_symbolizer_path=$SYMBOLIZER"
|
||||
before_script:
|
||||
- echo $TSAN_OPTIONS
|
||||
- lib/isc/tests/result_test
|
||||
<<: *debian_buster_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- tsan:buster:amd64
|
||||
needs: ["tsan:buster:amd64"]
|
||||
allow_failure: true
|
||||
after_script:
|
||||
- find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
|
||||
artifacts:
|
||||
expire_in: "1 day"
|
||||
paths:
|
||||
- lib/*/tests/tsan.*
|
||||
- tsan/
|
||||
- kyua.log
|
||||
- kyua.results
|
||||
- kyua_html/
|
||||
when: on_failure
|
||||
|
||||
rwlock:sid:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
@@ -728,20 +1010,19 @@ mutexatomics:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
#system:mutexatomics:sid:amd64:
|
||||
# <<: *debian_sid_amd64_image
|
||||
# <<: *system_test_job
|
||||
# dependencies:
|
||||
# - mutexatomics:sid:amd64
|
||||
# - mutexatomics:sid:amd64
|
||||
# allow_failure: true
|
||||
system:mutexatomics:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *system_test_job
|
||||
dependencies:
|
||||
- mutexatomics:sid:amd64
|
||||
needs: ["mutexatomics:sid:amd64"]
|
||||
|
||||
#unit:mutexatomics:sid:amd64:
|
||||
# <<: *debian_sid_amd64_image
|
||||
# <<: *unit_test_job
|
||||
# dependencies:
|
||||
# - mutexatomics:sid:amd64
|
||||
# allow_failure: true
|
||||
unit:mutexatomics:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *unit_test_job
|
||||
dependencies:
|
||||
- mutexatomics:sid:amd64
|
||||
needs: ["mutexatomics:sid:amd64"]
|
||||
|
||||
# Jobs for Clang builds on Debian Stretch (amd64)
|
||||
|
||||
@@ -839,21 +1120,25 @@ unit:clang:freebsd12.0:amd64:
|
||||
- clang:freebsd12.0:amd64
|
||||
needs: ["clang:freebsd12.0:amd64"]
|
||||
|
||||
# Jobs for Clang builds on OpenBSD 6.5 (amd64)
|
||||
# Jobs for Clang builds on OpenBSD 6.6 (amd64)
|
||||
|
||||
clang:openbsd6.5:amd64:
|
||||
clang:openbsd6.6:amd64:
|
||||
variables:
|
||||
CC: clang
|
||||
USER: gitlab-runner
|
||||
<<: *openbsd_amd64
|
||||
<<: *build_job
|
||||
|
||||
system:clang:openbsd6.5:amd64:
|
||||
system:clang:openbsd6.6:amd64:
|
||||
<<: *openbsd_amd64
|
||||
<<: *system_test_job
|
||||
variables:
|
||||
USER: gitlab-runner
|
||||
dependencies:
|
||||
- clang:openbsd6.5:amd64
|
||||
needs: ["clang:openbsd6.5:amd64"]
|
||||
- clang:openbsd6.6:amd64
|
||||
needs: ["clang:openbsd6.6:amd64"]
|
||||
only:
|
||||
- schedules
|
||||
- tags
|
||||
- web
|
||||
|
||||
@@ -884,62 +1169,133 @@ unit:nolibtool:sid:amd64:
|
||||
# Jobs for Visual Studio 2017 builds on Windows (amd64)
|
||||
|
||||
msvc:windows:amd64:
|
||||
<<: *windows_build_job
|
||||
<<: *default_triggering_rules
|
||||
stage: build
|
||||
tags:
|
||||
- windows
|
||||
- amd64
|
||||
variables:
|
||||
VSCONF: Release
|
||||
script:
|
||||
- 'Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build"'
|
||||
- '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
|
||||
- 'Pop-Location'
|
||||
- 'Set-Location win32utils'
|
||||
- '& "C:/Strawberry/perl/bin/perl.exe" Configure
|
||||
"with-tools-version=15.0"
|
||||
"with-platform-toolset=v141"
|
||||
"with-platform-version=10.0.17763.0"
|
||||
"with-vcredist=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Redist/MSVC/14.16.27012/vcredist_x64.exe"
|
||||
"with-openssl=C:/OpenSSL"
|
||||
"with-libxml2=C:/libxml2"
|
||||
"with-libuv=C:/libuv"
|
||||
"without-python"
|
||||
"with-system-tests"
|
||||
x64'
|
||||
- 'Set-Item -path "Env:CL" -value "/MP$([Math]::Truncate($BUILD_PARALLEL_JOBS/2))"'
|
||||
- '& msbuild.exe /maxCpuCount:2 /t:Build /p:Configuration=$VSCONF bind9.sln'
|
||||
dependencies: []
|
||||
needs:
|
||||
- autoreconf:sid:amd64
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 week"
|
||||
|
||||
system:msvc:windows:amd64:
|
||||
stage: system
|
||||
tags:
|
||||
- windows
|
||||
- amd64
|
||||
<<: *windows_system_test_job
|
||||
variables:
|
||||
VSCONF: Release
|
||||
script:
|
||||
- 'Push-Location bin/tests/system'
|
||||
- '$ifIndex = Get-NetIPInterface -AddressFamily IPv4 -InterfaceMetric 75 | Select-Object -ExpandProperty ifIndex'
|
||||
- '& C:/tools/cygwin/bin/sed.exe -i "s/^exit.*/netsh interface ipv4 set dnsservers $ifIndex dhcp/; s/\(name\|interface\)=Loopback/$ifIndex/;" ifconfig.bat'
|
||||
- '& C:/tools/cygwin/bin/sed.exe -i "s/kill -f/kill -W/;" conf.sh stop.pl'
|
||||
- '& cmd.exe /C ifconfig.bat up; ""'
|
||||
- 'Start-Sleep 2'
|
||||
- '$Env:Path = "C:/tools/cygwin/bin;$Env:Path"'
|
||||
- '& sh.exe runall.sh $TEST_PARALLEL_JOBS'
|
||||
- 'If (Test-Path C:/CrashDumps/*) { dir C:/CrashDumps; Throw }'
|
||||
dependencies:
|
||||
- msvc:windows:amd64
|
||||
needs: ["msvc:windows:amd64"]
|
||||
|
||||
msvc-debug:windows:amd64:
|
||||
<<: *windows_build_job
|
||||
variables:
|
||||
VSCONF: Debug
|
||||
only:
|
||||
- schedules
|
||||
- tags
|
||||
- web
|
||||
|
||||
system:msvc-debug:windows:amd64:
|
||||
<<: *windows_system_test_job
|
||||
variables:
|
||||
VSCONF: Debug
|
||||
dependencies:
|
||||
- msvc-debug:windows:amd64
|
||||
needs: ["msvc-debug:windows:amd64"]
|
||||
|
||||
# Job producing a release tarball
|
||||
|
||||
release:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
stage: release
|
||||
script:
|
||||
# Determine BIND version
|
||||
- source version
|
||||
- export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
|
||||
# Remove redundant files and system test utilities from Windows build artifacts
|
||||
- find Build/Release/ -name "*.pdb" -print -delete
|
||||
- find Build/Debug/ \( -name "*.bsc" -o -name "*.idb" \) -print -delete
|
||||
- find Build/ -regextype posix-extended -regex "Build/.*/($(find bin/tests/ -type f | sed -nE "s|^bin/tests(/system)?/win32/(.*)\.vcxproj$|\2|p" | paste -d"|" -s))\..*" -print -delete
|
||||
# Create Windows zips
|
||||
- openssl dgst -sha256 "${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" | tee Build/Release/SHA256 Build/Debug/SHA256
|
||||
- ( cd Build/Release; zip "../../BIND${BIND_DIRECTORY#bind-}.x64.zip" * )
|
||||
- ( cd Build/Debug; zip "../../BIND${BIND_DIRECTORY#bind-}.debug.x64.zip" * )
|
||||
# Prepare release tarball contents (tarballs + zips + documentation)
|
||||
- mkdir -p release/doc/arm
|
||||
- pushd release
|
||||
- mv "../${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" ../BIND*.zip .
|
||||
- tar --extract --file="${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}"
|
||||
- mv "${BIND_DIRECTORY}"/{CHANGES*,COPYRIGHT,LICENSE,README,srcid} .
|
||||
- mv "${BIND_DIRECTORY}"/doc/arm/{Bv9ARM{*.html,.pdf},man.*,notes.{html,pdf,txt}} doc/arm/
|
||||
- rm -rf "${BIND_DIRECTORY}"
|
||||
- cp doc/arm/notes.html "RELEASE-NOTES-${BIND_DIRECTORY}.html"
|
||||
- cp doc/arm/notes.pdf "RELEASE-NOTES-${BIND_DIRECTORY}.pdf"
|
||||
- cp doc/arm/notes.txt "RELEASE-NOTES-${BIND_DIRECTORY}.txt"
|
||||
- popd
|
||||
# Create release tarball
|
||||
- tar --create --file="${CI_COMMIT_TAG}.tar.gz" --gzip release/
|
||||
dependencies:
|
||||
- tarball-create:sid:amd64
|
||||
- msvc:windows:amd64
|
||||
- msvc-debug:windows:amd64
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
untracked: true
|
||||
paths:
|
||||
- "*.tar.gz"
|
||||
expire_in: "1 day"
|
||||
|
||||
# Coverity Scan analysis upload
|
||||
|
||||
.coverity_cache_prep: &coverity_cache_prep |
|
||||
test -f cov-analysis-linux64.md5 && test -f cov-analysis-linux64.tgz || (
|
||||
curl --output cov-analysis-linux64.md5 https://scan.coverity.com/download/linux64 \
|
||||
--form project=$COVERITY_SCAN_PROJECT_NAME \
|
||||
--form token=$COVERITY_SCAN_TOKEN \
|
||||
--form md5=1
|
||||
curl --output cov-analysis-linux64.tgz https://scan.coverity.com/download/linux64 \
|
||||
--form project=$COVERITY_SCAN_PROJECT_NAME \
|
||||
--form token=$COVERITY_SCAN_TOKEN
|
||||
)
|
||||
test "$(md5sum cov-analysis-linux64.tgz | awk '{ print $1 }')" = "$(cat cov-analysis-linux64.md5)"
|
||||
tar --extract --gzip --file=cov-analysis-linux64.tgz
|
||||
test -d cov-analysis-linux64-2019.03
|
||||
|
||||
.coverity_build: &coverity_build |
|
||||
cov-analysis-linux64-2019.03/bin/cov-build --dir cov-int sh -c 'make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1'
|
||||
tar --create --gzip --file=cov-int.tar.gz cov-int/
|
||||
curl -v https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \
|
||||
--form token=$COVERITY_SCAN_TOKEN \
|
||||
--form email=bind-changes@isc.org \
|
||||
--form file=@cov-int.tar.gz \
|
||||
--form version="$(git rev-parse --short HEAD)" \
|
||||
--form description="$(git rev-parse --short HEAD) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID" 2>&1 \
|
||||
| tee curl-response.txt
|
||||
grep -q 'Build successfully submitted' curl-response.txt
|
||||
|
||||
build:coverity:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
stage: build
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -O3"
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
script:
|
||||
- *coverity_cache_prep
|
||||
- *configure
|
||||
- *coverity_build
|
||||
dependencies:
|
||||
- autoreconf:sid:amd64
|
||||
needs:
|
||||
- autoreconf:sid:amd64
|
||||
artifacts:
|
||||
paths:
|
||||
- curl-response.txt
|
||||
- cov-int.tar.gz
|
||||
expire_in: "1 week"
|
||||
when: on_failure
|
||||
only:
|
||||
- tags
|
||||
- web
|
||||
variables:
|
||||
- $COVERITY_SCAN_PROJECT_NAME
|
||||
- $COVERITY_SCAN_TOKEN
|
||||
cache:
|
||||
key: cov-analysis-linux64-2019.03
|
||||
paths:
|
||||
- cov-analysis-linux64.md5
|
||||
- cov-analysis-linux64.tgz
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
**Tagging Deadline:**
|
||||
|
||||
**ASN Deadline:**
|
||||
|
||||
**Public Release:**
|
||||
|
||||
## Release Checklist
|
||||
@@ -12,6 +10,7 @@
|
||||
|
||||
- [ ] ***(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[^1] (Subscription Edition only).
|
||||
- [ ] ***(QA)*** Ensure all merge requests marked for backporting have been indeed backported.
|
||||
|
||||
## Before the Tagging Deadline
|
||||
|
||||
@@ -33,21 +32,22 @@
|
||||
|
||||
## Before the ASN Deadline (for ASN Releases) or the Public Release Date (for Regular Releases)
|
||||
|
||||
- [ ] ***(QA)*** Run the `make release` Jenkins jobs to produce the tarballs and zips.
|
||||
- [ ] ***(QA)*** Verify the results of `make release` Jenkins jobs and prepare a QA report for the releases to be published.
|
||||
- [ ] ***(QA)*** Request signatures for the tarballs.
|
||||
- [ ] ***(Signers)*** Sign the tarballs.
|
||||
- [ ] ***(QA)*** Check tarball signatures.
|
||||
- [ ] ***(QA)*** Notify Support that the releases are ready for publication.
|
||||
- [ ] ***(QA)*** Verify GitLab CI results for the tags created and prepare a QA report for the releases to be published.
|
||||
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums.
|
||||
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
|
||||
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again.
|
||||
- [ ] ***(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.
|
||||
- [ ] ***(QA)*** Notify Support that the releases have been prepared.
|
||||
- [ ] ***(Support)*** Send out ASNs (if applicable).
|
||||
|
||||
## On the Day of Public Release
|
||||
|
||||
- [ ] ***(Support)*** Publish the releases according to the release schedule.
|
||||
- [ ] ***(Support)*** Write release email to *bind9-announce*.
|
||||
- [ ] ***(Support)*** Write email to *bind9-users* (if a major 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.
|
||||
- [ ] ***(Support)*** Write release email to *bind-announce*.
|
||||
- [ ] ***(Support)*** Write email to *bind-users* (if a major release).
|
||||
- [ ] ***(Support)*** Update tickets in case of waiting support customers.
|
||||
- [ ] ***(QA)*** Build and test any outstanding private packages.
|
||||
- [ ] ***(QA)*** Build public packages (`*.deb`, RPMs).
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ string_escape_char2 = 0 # number
|
||||
# Improvements to template detection may make this option obsolete.
|
||||
tok_split_gte = false # false/true
|
||||
|
||||
# Control what to do with the UTF-8 BOM (recommed 'remove')
|
||||
# Control what to do with the UTF-8 BOM (recommend 'remove')
|
||||
utf8_bom = ignore # ignore/add/remove/force
|
||||
|
||||
# If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8
|
||||
@@ -1352,7 +1352,7 @@ cmt_insert_func_header = "" # string
|
||||
# Will substitute $(class) with the class name.
|
||||
cmt_insert_class_header = "" # string
|
||||
|
||||
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment.
|
||||
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment.
|
||||
# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff.
|
||||
cmt_insert_oc_msg_header = "" # string
|
||||
|
||||
|
||||
@@ -1,5 +1,103 @@
|
||||
--- 9.16.0 released ---
|
||||
|
||||
5356. [func] Update dnssec-policy configuration statements:
|
||||
- Rename "zone-max-ttl" dnssec-policy option to
|
||||
"max-zone-ttl" for consistency with the existing
|
||||
zone option.
|
||||
- Allow for "lifetime unlimited" as a synonym for
|
||||
"lifetime PT0S".
|
||||
- Make "key-directory" optional.
|
||||
- Warn if specifying a key length does not make
|
||||
sense; fail if key length is out of range for
|
||||
the algorithm.
|
||||
- Allow use of mnemonics when specifying key
|
||||
algorithm (e.g. "rsasha256", "ecdsa384", etc.).
|
||||
- Make ISO 8601 durations case-insensitive.
|
||||
[GL #1598]
|
||||
|
||||
5355. [func] What was set with --with-tuning=large option in
|
||||
older BIND9 versions is now a default, and
|
||||
a --with-tuning=small option was added for small
|
||||
(e.g. OpenWRT) systems. [GL !2989]
|
||||
|
||||
5354. [bug] dnssec-policy created new KSK keys for zones in the
|
||||
initial stage of signing (with the DS not yet in the
|
||||
rumoured or omnipresent states). Fix by checking the
|
||||
key goals rather than the active state when determining
|
||||
whether new keys are needed. [GL #1593]
|
||||
|
||||
5353. [doc] Document port and dscp parameters in forwarders
|
||||
configuration option. [GL #914]
|
||||
|
||||
5352. [bug] Correctly handle catalog zone entries containing
|
||||
characters that aren't legal in filenames. [GL #1592]
|
||||
|
||||
5351. [bug] CDS / CDNSKEY consistency checks failed to handle
|
||||
removal records. [GL #1554]
|
||||
|
||||
5350. [bug] When a view was configured with class CHAOS, the
|
||||
server could crash while processing a query for a
|
||||
non-existent record. [GL #1540]
|
||||
|
||||
5349. [bug] Fix a race in task_pause/unpause. [GL #1571]
|
||||
|
||||
5348. [bug] dnssec-settime -Psync was not being honoured.
|
||||
[GL !2925]
|
||||
|
||||
--- 9.15.8 released ---
|
||||
|
||||
5347. [bug] Fixed a bug that could cause an intermittent crash
|
||||
in validator.c when validating a negative cache
|
||||
entry. [GL #1561]
|
||||
|
||||
5346. [bug] Make hazard pointer array allocations dynamic, fixing
|
||||
a bug that caused named to crash on machines with more
|
||||
than 40 cores. [GL #1493]
|
||||
|
||||
5345. [func] Key-style trust anchors and DS-style trust anchors
|
||||
can now both be used for the same name. [GL #1237]
|
||||
|
||||
5344. [bug] Handle accept() errors properly in netmgr. [GL !2880]
|
||||
|
||||
5343. [func] Add statistics counters to the netmgr. [GL #1311]
|
||||
|
||||
5342. [bug] Disable pktinfo for IPv6 and bind to each interface
|
||||
explicitly instead, because libuv doesn't support
|
||||
pktinfo control messages. [GL #1558]
|
||||
|
||||
5341. [func] Simplify passing the bound TCP socket to child
|
||||
threads by using isc_uv_export/import functions.
|
||||
[GL !2825]
|
||||
|
||||
5340. [bug] Don't deadlock when binding to a TCP socket fails.
|
||||
[GL #1499]
|
||||
|
||||
5339. [bug] With some libmaxminddb versions, named could erroneously
|
||||
match an IP address not belonging to any subnet defined
|
||||
in a given GeoIP2 database to one of the existing
|
||||
entries in that database. [GL #1552]
|
||||
|
||||
5338. [bug] Fix line spacing in `rndc secroots`.
|
||||
Thanks to Tony Finch. [GL !2478]
|
||||
|
||||
5337. [func] 'named -V' now reports maxminddb and protobuf-c
|
||||
versions. [GL !2686]
|
||||
|
||||
--- 9.15.7 released ---
|
||||
|
||||
5336. [bug] The TCP high-water statistic could report an
|
||||
incorrect value on startup. [GL #1392]
|
||||
|
||||
5335. [func] Make TCP listening code multithreaded. [GL !2659]
|
||||
|
||||
5334. [doc] Update documentation with dnssec-policy clarifications.
|
||||
Also change some defaults. [GL !2711]
|
||||
|
||||
5333. [bug] Fix duration printing on Solaris when value is not
|
||||
an ISO 8601 duration. [GL #1460]
|
||||
|
||||
5332. [func] Renamed "dnssec-keys" configuration statement
|
||||
to the more descriptive "trust-anchors".
|
||||
to the more descriptive "trust-anchors". [GL !2702]
|
||||
|
||||
5331. [func] Use compiler-provided mechanisms for thread local
|
||||
storage, and make the requirement for such mechanisms
|
||||
@@ -18,7 +116,7 @@
|
||||
dropped because the recursive-clients quota was
|
||||
exceeded. [GL #1399]
|
||||
|
||||
5326. [bug] Add python dependancy on 'distutils.core' to configure.
|
||||
5326. [bug] Add Python dependency on 'distutils.core' to configure.
|
||||
'distutils.core' is required for installation.
|
||||
[GL #1397]
|
||||
|
||||
@@ -28,7 +126,7 @@
|
||||
close all open sockets during shutdown. [GL #1312]
|
||||
|
||||
5324. [bug] Change the category of some log messages from general
|
||||
to the more appopriate catergory of xfer-in. [GL #1394]
|
||||
to the more appropriate catergory of xfer-in. [GL #1394]
|
||||
|
||||
5323. [bug] Fix a bug in DNSSEC trust anchor verification.
|
||||
[GL !2609]
|
||||
@@ -76,7 +174,7 @@
|
||||
|
||||
See the ARM for configuration details. [GL #1134]
|
||||
|
||||
5315. [bug] Apply the inital RRSIG expiration spread fixed
|
||||
5315. [bug] Apply the initial RRSIG expiration spread fixed
|
||||
to all dynamically created records in the zone
|
||||
including NSEC3. Also fix the signature clusters
|
||||
when the server has been offline for prolonged
|
||||
@@ -1289,7 +1387,7 @@
|
||||
4965. [func] Add support for marking options as deprecated.
|
||||
[GL #322]
|
||||
|
||||
4964. [bug] Reduce the probabilty of double signature when deleting
|
||||
4964. [bug] Reduce the probability of double signature when deleting
|
||||
a DNSKEY by checking if the node is otherwise signed
|
||||
by the algorithm of the key to be deleted. [GL #240]
|
||||
|
||||
@@ -1373,7 +1471,7 @@
|
||||
for unsigned zones since change 4596. [GL #209]
|
||||
|
||||
4945. [func] BIND can no longer be built without DNSSEC support.
|
||||
A cryptography provder (i.e., OpenSSL or a hardware
|
||||
A cryptography provider (i.e., OpenSSL or a hardware
|
||||
service module with PKCS#11 support) must be
|
||||
available. [GL #244]
|
||||
|
||||
@@ -1432,7 +1530,7 @@
|
||||
dig (+[no]raflag, +[no]tcflag). [GL #213]
|
||||
|
||||
4928. [func] The "dnskey-sig-validity" option allows
|
||||
"sig-validity-interval" to be overriden for signatures
|
||||
"sig-validity-interval" to be overridden for signatures
|
||||
covering DNSKEY RRsets. [GL #145]
|
||||
|
||||
4927. [placeholder]
|
||||
@@ -1771,7 +1869,7 @@
|
||||
[RT #46725]
|
||||
|
||||
4831. [bug] Convert the RRSIG expirytime to 64 bits for
|
||||
comparisions in diff.c:resign. [RT #46710]
|
||||
comparisons in diff.c:resign. [RT #46710]
|
||||
|
||||
4830. [bug] Failure to configure ATF when requested did not cause
|
||||
an error in top-level configure script. [RT #46655]
|
||||
@@ -1997,7 +2095,7 @@
|
||||
used to append a formatted string to the used region of
|
||||
a buffer. [RT #46201]
|
||||
|
||||
4766. [cleanup] Addresss Coverity warnings. [RT #46150]
|
||||
4766. [cleanup] Address Coverity warnings. [RT #46150]
|
||||
|
||||
4765. [bug] Address potential INSIST in dnssec-cds. [RT #46150]
|
||||
|
||||
@@ -2191,7 +2289,7 @@
|
||||
|
||||
4719. [bug] Address PVS static analyzer warnings. [RT #45946]
|
||||
|
||||
4718. [func] Avoid seaching for a owner name compression pointer
|
||||
4718. [func] Avoid searching for a owner name compression pointer
|
||||
more than once when writing out a RRset. [RT #45802]
|
||||
|
||||
4717. [bug] Treat replies with QCOUNT=0 as truncated if TC=1,
|
||||
@@ -6336,7 +6434,7 @@
|
||||
|
||||
3518. [bug] Increase the size of dns_rrl_key.s.rtype by one bit
|
||||
so that all dns_rrl_rtype_t enum values fit regardless
|
||||
of whether it is teated as signed or unsigned by
|
||||
of whether it is treated as signed or unsigned by
|
||||
the compiler. [RT #32792]
|
||||
|
||||
3517. [bug] Reorder destruction to avoid shutdown race. [RT #32777]
|
||||
@@ -7411,7 +7509,7 @@
|
||||
|
||||
--- 9.9.0b1 released ---
|
||||
|
||||
3186. [bug] Version/db mis-match in rpz code. [RT #26180]
|
||||
3186. [bug] Version/db mismatch in rpz code. [RT #26180]
|
||||
|
||||
3185. [func] New 'rndc signing' option for auto-dnssec zones:
|
||||
- 'rndc signing -list' displays the current
|
||||
@@ -8076,7 +8174,7 @@
|
||||
2998. [func] Add isc_task_beginexclusive and isc_task_endexclusive
|
||||
to the task api. [RT #22776]
|
||||
|
||||
2997. [func] named -V now reports the OpenSSL and libxml2 verions
|
||||
2997. [func] named -V now reports the OpenSSL and libxml2 versions
|
||||
it was compiled against. [RT #22687]
|
||||
|
||||
2996. [security] Temporarily disable SO_ACCEPTFILTER support.
|
||||
@@ -11059,7 +11157,7 @@
|
||||
2096. [bug] libbind: handle applications that fail to detect
|
||||
res_init() failures better.
|
||||
|
||||
2095. [port] libbind: alway prototype inet_cidr_ntop_ipv6() and
|
||||
2095. [port] libbind: always prototype inet_cidr_ntop_ipv6() and
|
||||
net_cidr_ntop_ipv6(). [RT #16388]
|
||||
|
||||
2094. [contrib] Update named-bootconf. [RT #16404]
|
||||
@@ -11115,7 +11213,7 @@
|
||||
2076. [bug] Several files were missing #include <config.h>
|
||||
causing build failures on OSF. [RT #16341]
|
||||
|
||||
2075. [bug] The spillat timer event hander could leak memory.
|
||||
2075. [bug] The spillat timer event handler could leak memory.
|
||||
[RT #16357]
|
||||
|
||||
2074. [bug] dns_request_createvia2(), dns_request_createvia3(),
|
||||
@@ -11877,7 +11975,7 @@
|
||||
|
||||
1831. [doc] Update named-checkzone documentation. [RT #13604]
|
||||
|
||||
1830. [bug] adb lame cache has sence of test reversed. [RT #13600]
|
||||
1830. [bug] adb lame cache has sense of test reversed. [RT #13600]
|
||||
|
||||
1829. [bug] win32: "pid-file none;" broken. [RT #13563]
|
||||
|
||||
@@ -11988,7 +12086,7 @@
|
||||
1796. [func] "rndc freeze/thaw" now freezes/thaws all zones.
|
||||
|
||||
1795. [bug] "rndc dumpdb" was not fully documented. Minor
|
||||
formating issues with "rndc dumpdb -all". [RT #13396]
|
||||
formatting issues with "rndc dumpdb -all". [RT #13396]
|
||||
|
||||
1794. [func] Named and named-checkzone can now both check for
|
||||
non-terminal wildcard records.
|
||||
@@ -13165,7 +13263,7 @@
|
||||
acl.
|
||||
|
||||
1393. [port] Bind to individual IPv6 interfaces if IPV6_IPV6ONLY
|
||||
is not available in the kernel to prevent accidently
|
||||
is not available in the kernel to prevent accidentally
|
||||
listening on IPv4 interfaces.
|
||||
|
||||
1392. [bug] named-checkzone: update usage.
|
||||
@@ -14893,7 +14991,7 @@
|
||||
839. [func] Dump packets for which there was no view or that the
|
||||
class could not be determined to category "unmatched".
|
||||
|
||||
838. [port] UnixWare 7.x.x is now suported by
|
||||
838. [port] UnixWare 7.x.x is now supported by
|
||||
bin/tests/system/ifconfig.sh.
|
||||
|
||||
837. [cleanup] Multi-threading is now enabled by default only on
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ e-mail is not a secure choice for communications concerning undisclosed
|
||||
security issues so please encrypt your communications to us if possible,
|
||||
using the ISC Security Officer public key.
|
||||
|
||||
Do not discuss undisclosed security vulnerabilites on any public mailing
|
||||
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.
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ e-mail is not a secure choice for communications concerning undisclosed
|
||||
security issues so please encrypt your communications to us if possible,
|
||||
using the [ISC Security Officer public key](https://www.isc.org/downloads/software-support-policy/openpgp-key/).
|
||||
|
||||
Do not discuss undisclosed security vulnerabilites on any public mailing list.
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 1996-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright (C) 1996-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
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
|
||||
|
||||
@@ -143,7 +143,7 @@ releases. New features include:
|
||||
* "rndc modzone" reconfigures a single zone, without requiring the
|
||||
entire server to be reconfigured.
|
||||
* "rndc showzone" displays the current configuration of a zone.
|
||||
* "rndc managed-keys" can be used to check the status of RFC 5001
|
||||
* "rndc managed-keys" can be used to check the status of RFC 5011
|
||||
managed trust anchors, or to force trust anchors to be refreshed.
|
||||
* "max-cache-size" can now be set to a percentage of available memory.
|
||||
The default is 90%.
|
||||
@@ -515,8 +515,8 @@ BIND 9.4.0
|
||||
* dig: report the number of extra bytes still left in the packet after
|
||||
processing all the records.
|
||||
* Support for IPSECKEY rdata type.
|
||||
* Raise the UDP recieve buffer size to 32k if it is less than 32k.
|
||||
* x86 and x86_64 now have seperate atomic locking implementations.
|
||||
* Raise the UDP receive buffer size to 32k if it is less than 32k.
|
||||
* x86 and x86_64 now have separate atomic locking implementations.
|
||||
* named-checkconf now validates update-policy entries.
|
||||
* Attempt to make the amount of work performed in a iteration self
|
||||
tuning. The covers nodes clean from the cache per iteration, nodes
|
||||
@@ -533,8 +533,8 @@ BIND 9.4.0
|
||||
* dig now warns if 'RA' is not set in the answer when 'RD' was set in
|
||||
the query. host/nslookup skip servers that fail to set 'RA' when 'RD'
|
||||
is set unless a server is explicitly set.
|
||||
* Integrate contibuted DLZ code into named.
|
||||
* Integrate contibuted IDN code from JPNIC.
|
||||
* Integrate contributed DLZ code into named.
|
||||
* Integrate contributed IDN code from JPNIC.
|
||||
* libbind: corresponds to that from BIND 8.4.7.
|
||||
|
||||
BIND 9.3.0
|
||||
|
||||
+5
-5
@@ -150,7 +150,7 @@ releases. New features include:
|
||||
- "rndc modzone" reconfigures a single zone, without requiring the entire
|
||||
server to be reconfigured.
|
||||
- "rndc showzone" displays the current configuration of a zone.
|
||||
- "rndc managed-keys" can be used to check the status of RFC 5001 managed
|
||||
- "rndc managed-keys" can be used to check the status of RFC 5011 managed
|
||||
trust anchors, or to force trust anchors to be refreshed.
|
||||
- "max-cache-size" can now be set to a percentage of available memory. The
|
||||
default is 90%.
|
||||
@@ -533,8 +533,8 @@ BIND 9.4.0
|
||||
- dig: report the number of extra bytes still left in the packet after
|
||||
processing all the records.
|
||||
- Support for IPSECKEY rdata type.
|
||||
- Raise the UDP recieve buffer size to 32k if it is less than 32k.
|
||||
- x86 and x86_64 now have seperate atomic locking implementations.
|
||||
- Raise the UDP receive buffer size to 32k if it is less than 32k.
|
||||
- x86 and x86_64 now have separate atomic locking implementations.
|
||||
- named-checkconf now validates update-policy entries.
|
||||
- Attempt to make the amount of work performed in a iteration self tuning.
|
||||
The covers nodes clean from the cache per iteration, nodes written to
|
||||
@@ -551,8 +551,8 @@ BIND 9.4.0
|
||||
- dig now warns if 'RA' is not set in the answer when 'RD' was set in the
|
||||
query. host/nslookup skip servers that fail to set 'RA' when 'RD' is set
|
||||
unless a server is explicitly set.
|
||||
- Integrate contibuted DLZ code into named.
|
||||
- Integrate contibuted IDN code from JPNIC.
|
||||
- Integrate contributed DLZ code into named.
|
||||
- Integrate contributed IDN code from JPNIC.
|
||||
- libbind: corresponds to that from BIND 8.4.7.
|
||||
|
||||
#### BIND 9.3.0
|
||||
|
||||
@@ -17,7 +17,7 @@ The following C11 features are used in BIND 9:
|
||||
the form of C11 _Thread_local/thread_local, the __thread GCC
|
||||
extension, or the __declspec(thread) MSVC extension on Windows.
|
||||
|
||||
BIND 9.15 requires a fairly recent version of libuv (at least 1.x). For
|
||||
BIND 9.16 requires a fairly recent version of libuv (at least 1.x). For
|
||||
some of the older systems listed below, you will have to install an
|
||||
updated libuv package from sources such as EPEL, PPA, or other native
|
||||
sources for updated packages. The other option is to build and install
|
||||
@@ -34,15 +34,15 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
Regularly tested platforms
|
||||
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
As of Feb 2020, BIND 9.16 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
* Ubuntu LTS 16.04, 18.04
|
||||
* Fedora 30
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* OpenBSD 6.6
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully
|
||||
@@ -86,7 +86,7 @@ platforms.
|
||||
|
||||
Unsupported platforms
|
||||
|
||||
These are platforms on which BIND 9.15 is known not to build or run:
|
||||
These are platforms on which BIND 9.16 is known not to build or run:
|
||||
|
||||
* Platforms without at least OpenSSL 1.0.2
|
||||
* Windows 10 / x86
|
||||
|
||||
+5
-5
@@ -25,7 +25,7 @@ The following C11 features are used in BIND 9:
|
||||
of C11 `_Thread_local`/`thread_local`, the `__thread` GCC extension, or
|
||||
the `__declspec(thread)` MSVC extension on Windows.
|
||||
|
||||
BIND 9.15 requires a fairly recent version of `libuv` (at least 1.x). For
|
||||
BIND 9.16 requires a fairly recent version of `libuv` (at least 1.x). For
|
||||
some of the older systems listed below, you will have to install an updated
|
||||
`libuv` package from sources such as EPEL, PPA, or other native sources for
|
||||
updated packages. The other option is to build and install `libuv` from
|
||||
@@ -42,15 +42,15 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
### Regularly tested platforms
|
||||
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
As of Feb 2020, BIND 9.16 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
* Ubuntu LTS 16.04, 18.04
|
||||
* Fedora 30
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* OpenBSD 6.6
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully supported.
|
||||
@@ -93,7 +93,7 @@ platforms.
|
||||
|
||||
## Unsupported platforms
|
||||
|
||||
These are platforms on which BIND 9.15 is known *not* to build or run:
|
||||
These are platforms on which BIND 9.16 is known *not* to build or run:
|
||||
|
||||
* Platforms without at least OpenSSL 1.0.2
|
||||
* Windows 10 / x86
|
||||
|
||||
@@ -7,7 +7,7 @@ Contents
|
||||
1. Introduction
|
||||
2. Reporting bugs and getting help
|
||||
3. Contributing to BIND
|
||||
4. BIND 9.15 features
|
||||
4. BIND 9.16 features
|
||||
5. Building BIND
|
||||
6. macOS
|
||||
7. Dependencies
|
||||
@@ -69,7 +69,10 @@ named-checkconf -px.
|
||||
|
||||
If the bug you are reporting is a potential security issue, such as an
|
||||
assertion failure or other crash in named, please do NOT use GitLab to
|
||||
report it. Instead, please send mail to security-officer@isc.org.
|
||||
report it. Instead, send mail to security-officer@isc.org using our
|
||||
OpenPGP key to secure your message. (Information about OpenPGP and links
|
||||
to our key can be found at https://www.isc.org/pgpkey.) Please do not
|
||||
discuss the bug on any public mailing list.
|
||||
|
||||
For a general overview of ISC security policies, read the Knowledge Base
|
||||
article at https://kb.isc.org/docs/aa-00861.
|
||||
@@ -106,18 +109,19 @@ If you prefer, you may also submit code by opening a GitLab Issue and
|
||||
including your patch as an attachment, preferably generated by git
|
||||
format-patch.
|
||||
|
||||
BIND 9.15 features
|
||||
BIND 9.16 features
|
||||
|
||||
BIND 9.15 is the newest development branch of BIND 9. It includes a number
|
||||
of changes from BIND 9.14 and earlier releases. New features include:
|
||||
BIND 9.16 is the current stable branch of BIND 9. It includes all changes
|
||||
from the 9.15 development branch, updating the previous stable branch,
|
||||
9.14. New features include:
|
||||
|
||||
* New "dnssec-policy" statement to configure a key and signing policy
|
||||
for zones, enabling automatic key regeneration and rollover.
|
||||
* New new network manager based on libuv.
|
||||
* Support for the new GeoIP2 geolocation API
|
||||
* Improved DNSSEC trust anchor configuration using dnssec-keys,
|
||||
permitting configuration of trust anchors in DS as well as DNSKEY
|
||||
format.
|
||||
* New dnssec-policy statement to configure a key and signing policy for
|
||||
zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on libuv.
|
||||
* Added support for the new GeoIP2 geolocation API, libmaxminddb.
|
||||
* Improved DNSSEC trust anchor configuration using the trust-anchors
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for dig, mdig, and delv.
|
||||
|
||||
Building BIND
|
||||
@@ -136,8 +140,8 @@ including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE, Slackware,
|
||||
Alpine, FreeBSD, NetBSD, OpenBSD, macOS, Solaris, OpenIndiana, OmniOS CE,
|
||||
HP-UX, and OpenWRT.
|
||||
|
||||
BIND is also available for Windows Server 2008 and higher. See win32utils/
|
||||
build.txt for details on building for Windows systems.
|
||||
BIND is also available for Windows Server 2012 R2 and higher. See
|
||||
win32utils/build.txt for details on building for Windows systems.
|
||||
|
||||
To build on a UNIX or Linux system, use:
|
||||
|
||||
@@ -148,7 +152,7 @@ If you're planning on making changes to the BIND 9 source, you should run
|
||||
make depend. If you're using Emacs, you might find make tags helpful.
|
||||
|
||||
Several environment variables that can be set before running configure
|
||||
will affect compilation:
|
||||
will affect compilation. Significant ones are:
|
||||
|
||||
Variable Description
|
||||
CC The C compiler to use. configure tries to figure out the
|
||||
@@ -170,19 +174,26 @@ BUILD_CPPFLAGS CPPFLAGS for the target system during cross-compiling.
|
||||
BUILD_LDFLAGS LDFLAGS for the target system during cross-compiling.
|
||||
BUILD_LIBS LIBS for the target system during cross-compiling.
|
||||
|
||||
Additional environment variables affecting the build are listed at the end
|
||||
of the configure help text, which can be obtained by running the command:
|
||||
|
||||
$ ./configure --help
|
||||
|
||||
macOS
|
||||
|
||||
Building on macOS assumes that the "Command Tools for Xcode" is installed.
|
||||
This can be downloaded from https://developer.apple.com/download/more/ or
|
||||
if you have Xcode already installed you can run xcode-select --install.
|
||||
This can be downloaded from https://developer.apple.com/download/more/ or,
|
||||
if you have Xcode already installed, you can run xcode-select --install.
|
||||
(Note that an Apple ID may be required to access the download page.)
|
||||
|
||||
Dependencies
|
||||
|
||||
Portions of BIND that are written in Python, including dnssec-keymgr,
|
||||
dnssec-coverage, dnssec-checkds, and some of the system tests, require the
|
||||
argparse and ply modules to be available. argparse is a standard module as
|
||||
of Python 2.7 and Python 3.2. ply is available from https://
|
||||
pypi.python.org/pypi/ply.
|
||||
argparse, ply and distutils.core modules to be available. argparse is a
|
||||
standard module as of Python 2.7 and Python 3.2. ply is available from
|
||||
https://pypi.python.org/pypi/ply. distutils.core is required for
|
||||
installation.
|
||||
|
||||
Compile-time options
|
||||
|
||||
@@ -226,12 +237,10 @@ github.com/farsightsec/fstrm and libprotobuf-c https://
|
||||
developers.google.com/protocol-buffers, and BIND must be configured with
|
||||
--enable-dnstap.
|
||||
|
||||
Certain compiled-in constants and default settings can be increased to
|
||||
values better suited to large servers with abundant memory resources (e.g,
|
||||
64-bit servers with 12G or more of memory) by specifying --with-tuning=
|
||||
large on the configure command line. This can improve performance on big
|
||||
servers, but will consume more memory and may degrade performance on
|
||||
smaller systems.
|
||||
Certain compiled-in constants and default settings can be decreased to
|
||||
values better suited to small machines, e.g. OpenWRT boxes, by specifying
|
||||
--with-tuning=small on the configure command line. This will decrease
|
||||
memory usage by using smaller structures, but will degrade performance.
|
||||
|
||||
On Linux, process capabilities are managed in user space using the libcap
|
||||
library, which can be installed on most Linux systems via the libcap-dev
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
1. [Introduction](#intro)
|
||||
1. [Reporting bugs and getting help](#help)
|
||||
1. [Contributing to BIND](#contrib)
|
||||
1. [BIND 9.15 features](#features)
|
||||
1. [BIND 9.16 features](#features)
|
||||
1. [Building BIND](#build)
|
||||
1. [macOS](#macos)
|
||||
1. [Dependencies](#dependencies)
|
||||
@@ -79,8 +79,12 @@ using `named-checkconf -px`.
|
||||
|
||||
If the bug you are reporting is a potential security issue, such as an
|
||||
assertion failure or other crash in `named`, please do *NOT* use GitLab to
|
||||
report it. Instead, please send mail to
|
||||
[security-officer@isc.org](mailto:security-officer@isc.org).
|
||||
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 Knowledge Base
|
||||
article at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
|
||||
@@ -121,16 +125,16 @@ If you prefer, you may also submit code by opening a
|
||||
including your patch as an attachment, preferably generated by
|
||||
`git format-patch`.
|
||||
|
||||
### <a name="features"/> BIND 9.15 features
|
||||
### <a name="features"/> BIND 9.16 features
|
||||
|
||||
BIND 9.15 is the newest development branch of BIND 9. It includes a
|
||||
number of changes from BIND 9.14 and earlier releases. New features
|
||||
include:
|
||||
BIND 9.16 is the current stable branch of BIND 9. It includes all
|
||||
changes from the 9.15 development branch, updating the previous stable
|
||||
branch, 9.14. New features include:
|
||||
|
||||
* New "dnssec-policy" statement to configure a key and signing policy
|
||||
* New `dnssec-policy` statement to configure a key and signing policy
|
||||
for zones, enabling automatic key regeneration and rollover.
|
||||
* New new network manager based on libuv.
|
||||
* Support for the new GeoIP2 geolocation API
|
||||
* New network manager based on `libuv`.
|
||||
* Added support for the new GeoIP2 geolocation API, `libmaxminddb`.
|
||||
* Improved DNSSEC trust anchor configuration using the `trust-anchors`
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
@@ -153,7 +157,7 @@ UNIX, including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE,
|
||||
Slackware, Alpine, FreeBSD, NetBSD, OpenBSD, macOS, Solaris,
|
||||
OpenIndiana, OmniOS CE, HP-UX, and OpenWRT.
|
||||
|
||||
BIND is also available for Windows Server 2008 and higher. See
|
||||
BIND is also available for Windows Server 2012 R2 and higher. See
|
||||
`win32utils/build.txt` for details on building for Windows
|
||||
systems.
|
||||
|
||||
@@ -166,7 +170,7 @@ If you're planning on making changes to the BIND 9 source, you should run
|
||||
`make depend`. If you're using Emacs, you might find `make tags` helpful.
|
||||
|
||||
Several environment variables that can be set before running `configure` will
|
||||
affect compilation:
|
||||
affect compilation. Significant ones are:
|
||||
|
||||
|Variable|Description |
|
||||
|--------------------|-----------------------------------------------|
|
||||
@@ -181,11 +185,20 @@ affect compilation:
|
||||
|`BUILD_LDFLAGS`|`LDFLAGS` for the target system during cross-compiling.|
|
||||
|`BUILD_LIBS`|`LIBS` for the target system during cross-compiling.|
|
||||
|
||||
Additional environment variables affecting the build are listed at the
|
||||
end of the `configure` help text, which can be obtained by running the
|
||||
command:
|
||||
|
||||
$ ./configure --help
|
||||
|
||||
#### <a name="macos"> macOS
|
||||
|
||||
Building on macOS assumes that the "Command Tools for Xcode" is installed.
|
||||
This can be downloaded from [https://developer.apple.com/download/more/](https://developer.apple.com/download/more/)
|
||||
or if you have Xcode already installed you can run `xcode-select --install`.
|
||||
This can be downloaded from
|
||||
[https://developer.apple.com/download/more/](https://developer.apple.com/download/more/)
|
||||
or, if you have Xcode already installed, you can run `xcode-select
|
||||
--install`. (Note that an Apple ID may be required to access the download
|
||||
page.)
|
||||
|
||||
### <a name="dependencies"/> Dependencies
|
||||
|
||||
@@ -241,12 +254,10 @@ and `libprotobuf-c`
|
||||
[https://developers.google.com/protocol-buffers](https://developers.google.com/protocol-buffers),
|
||||
and BIND must be configured with `--enable-dnstap`.
|
||||
|
||||
Certain compiled-in constants and default settings can be increased to
|
||||
values better suited to large servers with abundant memory resources (e.g,
|
||||
64-bit servers with 12G or more of memory) by specifying
|
||||
`--with-tuning=large` on the `configure` command line. This can improve
|
||||
performance on big servers, but will consume more memory and may degrade
|
||||
performance on smaller systems.
|
||||
Certain compiled-in constants and default settings can be decreased to
|
||||
values better suited to small machines, e.g. OpenWRT boxes, by specifying
|
||||
`--with-tuning=small` on the `configure` command line. This will decrease
|
||||
memory usage by using smaller structures, but will degrade performance.
|
||||
|
||||
On Linux, process capabilities are managed in user space using
|
||||
the `libcap` library, which can be installed on most Linux systems via
|
||||
|
||||
Vendored
+1
-1
@@ -100,7 +100,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
|
||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
dnl
|
||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
dnl only at the first occurence in configure.ac, so if the first place
|
||||
dnl only at the first occurrence in configure.ac, so if the first place
|
||||
dnl it's called might be skipped (such as if it is within an "if", you
|
||||
dnl have to call PKG_CHECK_EXISTS manually
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
|
||||
+161
-121
@@ -9,23 +9,21 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include "check-tool.h"
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netdb.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/netdb.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/stdio.h>
|
||||
@@ -52,29 +50,31 @@
|
||||
|
||||
#include <ns/log.h>
|
||||
|
||||
#include "check-tool.h"
|
||||
|
||||
#ifndef CHECK_SIBLING
|
||||
#define CHECK_SIBLING 1
|
||||
#endif
|
||||
#endif /* ifndef CHECK_SIBLING */
|
||||
|
||||
#ifndef CHECK_LOCAL
|
||||
#define CHECK_LOCAL 1
|
||||
#endif
|
||||
#endif /* ifndef CHECK_LOCAL */
|
||||
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_LOOKUP_FAILURE 3
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
|
||||
static const char *dbtype[] = { "rbt" };
|
||||
|
||||
@@ -85,31 +85,26 @@ bool nomerge = true;
|
||||
bool docheckmx = true;
|
||||
bool dochecksrv = true;
|
||||
bool docheckns = true;
|
||||
#else
|
||||
#else /* if CHECK_LOCAL */
|
||||
bool docheckmx = false;
|
||||
bool dochecksrv = false;
|
||||
bool docheckns = false;
|
||||
#endif
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_CHECKMX |
|
||||
DNS_ZONEOPT_MANYERRORS |
|
||||
DNS_ZONEOPT_CHECKNAMES |
|
||||
#endif /* if CHECK_LOCAL */
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
|
||||
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
|
||||
DNS_ZONEOPT_CHECKINTEGRITY |
|
||||
#if CHECK_SIBLING
|
||||
DNS_ZONEOPT_CHECKSIBLING |
|
||||
#endif
|
||||
#endif /* if CHECK_SIBLING */
|
||||
DNS_ZONEOPT_CHECKWILDCARD |
|
||||
DNS_ZONEOPT_WARNMXCNAME |
|
||||
DNS_ZONEOPT_WARNSRVCNAME;
|
||||
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
|
||||
|
||||
/*
|
||||
* This needs to match the list in bin/named/log.c.
|
||||
*/
|
||||
static isc_logcategory_t categories[] = {
|
||||
{ "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static isc_logcategory_t categories[] = { { "", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ NULL, 0 } };
|
||||
|
||||
static isc_symtab_t *symtab = NULL;
|
||||
static isc_mem_t *sym_mctx;
|
||||
@@ -133,8 +128,9 @@ add(char *key, int value) {
|
||||
if (symtab == NULL) {
|
||||
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
|
||||
false, &symtab);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
key = isc_mem_strdup(sym_mctx, key);
|
||||
@@ -142,27 +138,29 @@ add(char *key, int value) {
|
||||
symvalue.as_pointer = NULL;
|
||||
result = isc_symtab_define(symtab, key, value, symvalue,
|
||||
isc_symexists_reject);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_free(sym_mctx, key);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
logged(char *key, int value) {
|
||||
isc_result_t result;
|
||||
|
||||
if (symtab == NULL)
|
||||
if (symtab == NULL) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
result = isc_symtab_lookup(symtab, key, value, NULL);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
static bool
|
||||
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
||||
{
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa) {
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
@@ -180,8 +178,9 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
REQUIRE(aaaa == NULL || !dns_rdataset_isassociated(aaaa) ||
|
||||
aaaa->type == dns_rdatatype_aaaa);
|
||||
|
||||
if (a == NULL || aaaa == NULL)
|
||||
if (a == NULL || aaaa == NULL) {
|
||||
return (answer);
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -208,16 +207,17 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL)
|
||||
cur->ai_next != NULL) {
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0 &&
|
||||
!logged(namebuf, ERR_IS_CNAME)) {
|
||||
!logged(namebuf, ERR_IS_CNAME))
|
||||
{
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' (out of zone) "
|
||||
"is a CNAME '%s' (illegal)",
|
||||
ownerbuf, namebuf,
|
||||
cur->ai_canonname);
|
||||
ownerbuf, namebuf, cur->ai_canonname);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = false; */
|
||||
add(namebuf, ERR_IS_CNAME);
|
||||
@@ -226,7 +226,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' (out of zone) "
|
||||
@@ -240,8 +240,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -250,15 +250,17 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
/*
|
||||
* Check that all glue records really exist.
|
||||
*/
|
||||
if (!dns_rdataset_isassociated(a))
|
||||
if (!dns_rdataset_isassociated(a)) {
|
||||
goto checkaaaa;
|
||||
}
|
||||
result = dns_rdataset_first(a);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(a, &rdata);
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET)
|
||||
if (cur->ai_family != AF_INET) {
|
||||
continue;
|
||||
}
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = true;
|
||||
@@ -266,11 +268,12 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
}
|
||||
}
|
||||
if (!match && !logged(namebuf, ERR_EXTRA_A)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
"extra GLUE A record (%s)",
|
||||
ownerbuf, namebuf,
|
||||
inet_ntop(AF_INET, rdata.data,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
inet_ntop(AF_INET, rdata.data, addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_A);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = false; */
|
||||
@@ -279,28 +282,32 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
result = dns_rdataset_next(a);
|
||||
}
|
||||
|
||||
checkaaaa:
|
||||
if (!dns_rdataset_isassociated(aaaa))
|
||||
checkaaaa:
|
||||
if (!dns_rdataset_isassociated(aaaa)) {
|
||||
goto checkmissing;
|
||||
}
|
||||
result = dns_rdataset_first(aaaa);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(aaaa, &rdata);
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET6)
|
||||
if (cur->ai_family != AF_INET6) {
|
||||
continue;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||
}
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
|
||||
->sin6_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match && !logged(namebuf, ERR_EXTRA_AAAA)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
"extra GLUE AAAA record (%s)",
|
||||
ownerbuf, namebuf,
|
||||
inet_ntop(AF_INET6, rdata.data,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
inet_ntop(AF_INET6, rdata.data, addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_AAAA);
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = false; */
|
||||
@@ -309,7 +316,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
result = dns_rdataset_next(aaaa);
|
||||
}
|
||||
|
||||
checkmissing:
|
||||
checkmissing:
|
||||
/*
|
||||
* Check that all addresses appear in the glue.
|
||||
*/
|
||||
@@ -319,42 +326,50 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
switch (cur->ai_family) {
|
||||
case AF_INET:
|
||||
rdataset = a;
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))
|
||||
->sin_addr;
|
||||
type = "A";
|
||||
break;
|
||||
case AF_INET6:
|
||||
rdataset = aaaa;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
|
||||
->sin6_addr;
|
||||
type = "AAAA";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
match = false;
|
||||
if (dns_rdataset_isassociated(rdataset))
|
||||
if (dns_rdataset_isassociated(rdataset)) {
|
||||
result = dns_rdataset_first(rdataset);
|
||||
else
|
||||
} else {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
while (result == ISC_R_SUCCESS && !match) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
result = dns_rdataset_next(rdataset);
|
||||
}
|
||||
if (!match) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' "
|
||||
"missing GLUE %s record (%s)",
|
||||
ownerbuf, namebuf, type,
|
||||
inet_ntop(cur->ai_family, ptr,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
addrbuf,
|
||||
sizeof(addrbuf)));
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = false; */
|
||||
missing_glue = true;
|
||||
}
|
||||
}
|
||||
if (missing_glue)
|
||||
if (missing_glue) {
|
||||
add(namebuf, ERR_MISSING_GLUE);
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
return (answer);
|
||||
@@ -394,12 +409,15 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL)
|
||||
cur->ai_next != NULL) {
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0)
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0) {
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
if ((zone_options & DNS_ZONEOPT_IGNOREMXCNAME) == 0) {
|
||||
if (!logged(namebuf, ERR_IS_MXCNAME)) {
|
||||
dns_zone_log(zone, level,
|
||||
@@ -410,8 +428,9 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
cur->ai_canonname);
|
||||
add(namebuf, ERR_IS_MXCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR)
|
||||
if (level == ISC_LOG_ERROR) {
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -420,7 +439,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/MX '%s' (out of zone) "
|
||||
@@ -434,8 +453,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -476,23 +495,28 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
*/
|
||||
cur = ai;
|
||||
while (cur != NULL && cur->ai_canonname == NULL &&
|
||||
cur->ai_next != NULL)
|
||||
cur->ai_next != NULL) {
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0)
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0) {
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
if ((zone_options & DNS_ZONEOPT_IGNORESRVCNAME) == 0) {
|
||||
if (!logged(namebuf, ERR_IS_SRVCNAME)) {
|
||||
dns_zone_log(zone, level, "%s/SRV '%s'"
|
||||
dns_zone_log(zone, level,
|
||||
"%s/SRV '%s'"
|
||||
" (out of zone) is a "
|
||||
"CNAME '%s' (illegal)",
|
||||
ownerbuf, namebuf,
|
||||
cur->ai_canonname);
|
||||
add(namebuf, ERR_IS_SRVCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR)
|
||||
if (level == ISC_LOG_ERROR) {
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -501,7 +525,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
case EAI_NONAME:
|
||||
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
|
||||
case EAI_NODATA:
|
||||
#endif
|
||||
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
|
||||
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/SRV '%s' (out of zone) "
|
||||
@@ -515,8 +539,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"getaddrinfo(%s) failed: %s",
|
||||
namebuf, gai_strerror(result));
|
||||
"getaddrinfo(%s) failed: %s", namebuf,
|
||||
gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (true);
|
||||
@@ -542,11 +566,10 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
RUNTIME_CHECK(isc_log_createchannel(logconfig, "stderr",
|
||||
ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination, 0) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
|
||||
NULL, NULL) == ISC_R_SUCCESS);
|
||||
ISC_LOG_TOFILEDESC, ISC_LOG_DYNAMIC,
|
||||
&destination, 0) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
*logp = log;
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -573,18 +596,20 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
CHECK(dns_db_newversion(db, &version));
|
||||
CHECK(dns_db_createiterator(db, 0, &dbiter));
|
||||
|
||||
for (result = dns_dbiterator_first(dbiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_dbiterator_next(dbiter)) {
|
||||
for (result = dns_dbiterator_first(dbiter); result == ISC_R_SUCCESS;
|
||||
result = dns_dbiterator_next(dbiter))
|
||||
{
|
||||
result = dns_dbiterator_current(dbiter, &node, name);
|
||||
if (result == DNS_R_NEWORIGIN)
|
||||
if (result == DNS_R_NEWORIGIN) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
CHECK(result);
|
||||
|
||||
CHECK(dns_db_allrdatasets(db, node, version, 0, &rdsiter));
|
||||
for (result = dns_rdatasetiter_first(rdsiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdatasetiter_next(rdsiter)) {
|
||||
result = dns_rdatasetiter_next(rdsiter))
|
||||
{
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
if (rdataset.ttl > maxttl) {
|
||||
char nbuf[DNS_NAME_FORMATSIZE];
|
||||
@@ -607,28 +632,35 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
}
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
}
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
CHECK(result);
|
||||
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (node != NULL)
|
||||
cleanup:
|
||||
if (node != NULL) {
|
||||
dns_db_detachnode(db, &node);
|
||||
if (rdsiter != NULL)
|
||||
}
|
||||
if (rdsiter != NULL) {
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
if (dbiter != NULL)
|
||||
}
|
||||
if (dbiter != NULL) {
|
||||
dns_dbiterator_destroy(&dbiter);
|
||||
if (version != NULL)
|
||||
}
|
||||
if (version != NULL) {
|
||||
dns_db_closeversion(db, &version, false);
|
||||
if (db != NULL)
|
||||
}
|
||||
if (db != NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -637,8 +669,7 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
isc_result_t
|
||||
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
dns_masterformat_t fileformat, const char *classname,
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep)
|
||||
{
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep) {
|
||||
isc_result_t result;
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_textregion_t region;
|
||||
@@ -649,9 +680,10 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
|
||||
REQUIRE(zonep == NULL || *zonep == NULL);
|
||||
|
||||
if (debug)
|
||||
if (debug) {
|
||||
fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n",
|
||||
zonename, filename, classname);
|
||||
}
|
||||
|
||||
CHECK(dns_zone_create(&zone, mctx));
|
||||
|
||||
@@ -662,11 +694,12 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
origin = dns_fixedname_initname(&fixorigin);
|
||||
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
|
||||
CHECK(dns_zone_setorigin(zone, origin));
|
||||
dns_zone_setdbtype(zone, 1, (const char * const *) dbtype);
|
||||
dns_zone_setdbtype(zone, 1, (const char *const *)dbtype);
|
||||
CHECK(dns_zone_setfile(zone, filename, fileformat,
|
||||
&dns_master_style_default));
|
||||
if (journal != NULL)
|
||||
if (journal != NULL) {
|
||||
CHECK(dns_zone_setjournal(zone, journal));
|
||||
}
|
||||
|
||||
DE_CONST(classname, region.base);
|
||||
region.length = strlen(classname);
|
||||
@@ -678,12 +711,15 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
|
||||
dns_zone_setmaxttl(zone, maxttl);
|
||||
|
||||
if (docheckmx)
|
||||
if (docheckmx) {
|
||||
dns_zone_setcheckmx(zone, checkmx);
|
||||
if (docheckns)
|
||||
}
|
||||
if (docheckns) {
|
||||
dns_zone_setcheckns(zone, checkns);
|
||||
if (dochecksrv)
|
||||
}
|
||||
if (dochecksrv) {
|
||||
dns_zone_setchecksrv(zone, checksrv);
|
||||
}
|
||||
|
||||
CHECK(dns_zone_load(zone, false));
|
||||
|
||||
@@ -700,9 +736,10 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
zone = NULL;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (zone != NULL)
|
||||
cleanup:
|
||||
if (zone != NULL) {
|
||||
dns_zone_detach(&zone);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -710,8 +747,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
isc_result_t
|
||||
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
||||
const uint32_t rawversion)
|
||||
{
|
||||
const uint32_t rawversion) {
|
||||
isc_result_t result;
|
||||
FILE *output = stdout;
|
||||
const char *flags;
|
||||
@@ -719,27 +755,31 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
flags = (fileformat == dns_masterformat_text) ? "w" : "wb";
|
||||
|
||||
if (debug) {
|
||||
if (filename != NULL && strcmp(filename, "-") != 0)
|
||||
fprintf(stderr, "dumping \"%s\" to \"%s\"\n",
|
||||
zonename, filename);
|
||||
else
|
||||
if (filename != NULL && strcmp(filename, "-") != 0) {
|
||||
fprintf(stderr, "dumping \"%s\" to \"%s\"\n", zonename,
|
||||
filename);
|
||||
} else {
|
||||
fprintf(stderr, "dumping \"%s\"\n", zonename);
|
||||
}
|
||||
}
|
||||
|
||||
if (filename != NULL && strcmp(filename, "-") != 0) {
|
||||
result = isc_stdio_open(filename, flags, &output);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "could not open output "
|
||||
"file \"%s\" for writing\n", filename);
|
||||
fprintf(stderr,
|
||||
"could not open output "
|
||||
"file \"%s\" for writing\n",
|
||||
filename);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_zone_dumptostream(zone, output, fileformat, style,
|
||||
rawversion);
|
||||
if (output != stdout)
|
||||
if (output != stdout) {
|
||||
(void)isc_stdio_close(output);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -753,7 +793,7 @@ InitSockets(void) {
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "WSAStartup() failed: %d\n", err);
|
||||
exit(1);
|
||||
@@ -764,4 +804,4 @@ void
|
||||
DestroySockets(void) {
|
||||
WSACleanup();
|
||||
}
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CHECK_TOOL_H
|
||||
#define CHECK_TOOL_H
|
||||
|
||||
@@ -42,9 +41,11 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
const uint32_t rawversion);
|
||||
|
||||
#ifdef _WIN32
|
||||
void InitSockets(void);
|
||||
void DestroySockets(void);
|
||||
#endif
|
||||
void
|
||||
InitSockets(void);
|
||||
void
|
||||
DestroySockets(void);
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
extern int debug;
|
||||
extern const char *journal;
|
||||
@@ -56,4 +57,4 @@ extern dns_zoneopt_t zone_options;
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif
|
||||
#endif /* ifndef CHECK_TOOL_H */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -148,5 +148,5 @@ BIND 9 Administrator Reference Manual\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+125
-90
@@ -9,13 +9,12 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
@@ -27,11 +26,6 @@
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <isccfg/namedconf.h>
|
||||
#include <isccfg/grammar.h>
|
||||
|
||||
#include <bind9/check.h>
|
||||
|
||||
#include <dns/db.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/log.h>
|
||||
@@ -41,19 +35,24 @@
|
||||
#include <dns/rootns.h>
|
||||
#include <dns/zone.h>
|
||||
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#include "check-tool.h"
|
||||
|
||||
#include <bind9/check.h>
|
||||
|
||||
static const char *program = "named-checkconf";
|
||||
|
||||
static bool loadplugins = true;
|
||||
|
||||
isc_log_t *logc = NULL;
|
||||
|
||||
#define CHECK(r)\
|
||||
do { \
|
||||
result = (r); \
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
/*% usage */
|
||||
@@ -62,8 +61,10 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "usage: %s [-chijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n", program);
|
||||
fprintf(stderr,
|
||||
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n",
|
||||
program);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -85,8 +86,8 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
|
||||
result = isc_dir_chdir(directory);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
|
||||
"change directory to '%s' failed: %s\n",
|
||||
directory, isc_result_totext(result));
|
||||
"change directory to '%s' failed: %s\n", directory,
|
||||
isc_result_totext(result));
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -97,10 +98,12 @@ static bool
|
||||
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
|
||||
int i;
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL)
|
||||
if (maps[i] == NULL) {
|
||||
return (false);
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
|
||||
}
|
||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,25 +117,26 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||
int i;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (maps[i] == NULL)
|
||||
if (maps[i] == NULL) {
|
||||
return (false);
|
||||
}
|
||||
checknames = NULL;
|
||||
result = cfg_map_get(maps[i], "check-names", &checknames);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
||||
*obj = checknames;
|
||||
return (true);
|
||||
}
|
||||
for (element = cfg_list_first(checknames);
|
||||
element != NULL;
|
||||
element = cfg_list_next(element)) {
|
||||
for (element = cfg_list_first(checknames); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
value = cfg_listelt_value(element);
|
||||
type = cfg_tuple_get(value, "type");
|
||||
if ((strcasecmp(cfg_obj_asstring(type),
|
||||
"primary") != 0) &&
|
||||
(strcasecmp(cfg_obj_asstring(type),
|
||||
"master") != 0))
|
||||
if ((strcasecmp(cfg_obj_asstring(type), "primary") !=
|
||||
0) &&
|
||||
(strcasecmp(cfg_obj_asstring(type), "master") != 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -149,18 +153,21 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_textregion_t r;
|
||||
|
||||
if (zfile == NULL)
|
||||
if (zfile == NULL) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
DE_CONST(zclass, r.base);
|
||||
r.length = strlen(zclass);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_rootns_create(mctx, rdclass, zfile, &db);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_db_detach(&db);
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -168,10 +175,9 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
||||
|
||||
/*% configure the zone */
|
||||
static isc_result_t
|
||||
configure_zone(const char *vclass, const char *view,
|
||||
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
|
||||
const cfg_obj_t *config, isc_mem_t *mctx, bool list)
|
||||
{
|
||||
configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
|
||||
const cfg_obj_t *vconfig, const cfg_obj_t *config,
|
||||
isc_mem_t *mctx, bool list) {
|
||||
int i = 0;
|
||||
isc_result_t result;
|
||||
const char *zclass;
|
||||
@@ -195,19 +201,22 @@ configure_zone(const char *vclass, const char *view,
|
||||
|
||||
zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
|
||||
classobj = cfg_tuple_get(zconfig, "class");
|
||||
if (!cfg_obj_isstring(classobj))
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
zclass = vclass;
|
||||
else
|
||||
} else {
|
||||
zclass = cfg_obj_asstring(classobj);
|
||||
}
|
||||
|
||||
zoptions = cfg_tuple_get(zconfig, "options");
|
||||
maps[i++] = zoptions;
|
||||
if (vconfig != NULL)
|
||||
if (vconfig != NULL) {
|
||||
maps[i++] = cfg_tuple_get(vconfig, "options");
|
||||
}
|
||||
if (config != NULL) {
|
||||
cfg_map_get(config, "options", &obj);
|
||||
if (obj != NULL)
|
||||
if (obj != NULL) {
|
||||
maps[i++] = obj;
|
||||
}
|
||||
}
|
||||
maps[i] = NULL;
|
||||
|
||||
@@ -216,12 +225,14 @@ configure_zone(const char *vclass, const char *view,
|
||||
const char *inview = cfg_obj_asstring(inviewobj);
|
||||
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
|
||||
}
|
||||
if (inviewobj != NULL)
|
||||
if (inviewobj != NULL) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "type", &typeobj);
|
||||
if (typeobj == NULL)
|
||||
if (typeobj == NULL) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (list) {
|
||||
const char *ztype = cfg_obj_asstring(typeobj);
|
||||
@@ -233,18 +244,21 @@ configure_zone(const char *vclass, const char *view,
|
||||
* Skip checks when using an alternate data source.
|
||||
*/
|
||||
cfg_map_get(zoptions, "database", &dbobj);
|
||||
if (dbobj != NULL &&
|
||||
strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
|
||||
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
|
||||
strcmp("rbt64", cfg_obj_asstring(dbobj)) != 0)
|
||||
{
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "dlz", &dlzobj);
|
||||
if (dlzobj != NULL)
|
||||
if (dlzobj != NULL) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
cfg_map_get(zoptions, "file", &fileobj);
|
||||
if (fileobj != NULL)
|
||||
if (fileobj != NULL) {
|
||||
zfile = cfg_obj_asstring(fileobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check hints files for hint zones.
|
||||
@@ -265,12 +279,14 @@ configure_zone(const char *vclass, const char *view,
|
||||
*/
|
||||
if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) {
|
||||
cfg_map_get(zoptions, "masters", &mastersobj);
|
||||
if (mastersobj != NULL)
|
||||
if (mastersobj != NULL) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if (zfile == NULL)
|
||||
if (zfile == NULL) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-dup-records", &obj)) {
|
||||
@@ -314,12 +330,14 @@ configure_zone(const char *vclass, const char *view,
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-integrity", &obj)) {
|
||||
if (cfg_obj_asboolean(obj))
|
||||
if (cfg_obj_asboolean(obj)) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
else
|
||||
} else {
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-mx-cname", &obj)) {
|
||||
@@ -363,10 +381,11 @@ configure_zone(const char *vclass, const char *view,
|
||||
|
||||
obj = NULL;
|
||||
if (get_maps(maps, "check-sibling", &obj)) {
|
||||
if (cfg_obj_asboolean(obj))
|
||||
if (cfg_obj_asboolean(obj)) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
|
||||
else
|
||||
} else {
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
||||
}
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
@@ -399,8 +418,8 @@ configure_zone(const char *vclass, const char *view,
|
||||
ISC_UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMES;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMES;
|
||||
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
|
||||
}
|
||||
|
||||
masterformat = dns_masterformat_text;
|
||||
@@ -425,19 +444,19 @@ configure_zone(const char *vclass, const char *view,
|
||||
zone_options |= DNS_ZONEOPT_CHECKTTL;
|
||||
}
|
||||
|
||||
result = load_zone(mctx, zname, zfile, masterformat,
|
||||
zclass, maxttl, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = load_zone(mctx, zname, zfile, masterformat, zclass, maxttl,
|
||||
NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
|
||||
dns_result_totext(result));
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*% configure a view */
|
||||
static isc_result_t
|
||||
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list)
|
||||
{
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list) {
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *voptions;
|
||||
const cfg_obj_t *zonelist;
|
||||
@@ -445,32 +464,33 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||
isc_result_t tresult;
|
||||
|
||||
voptions = NULL;
|
||||
if (vconfig != NULL)
|
||||
if (vconfig != NULL) {
|
||||
voptions = cfg_tuple_get(vconfig, "options");
|
||||
}
|
||||
|
||||
zonelist = NULL;
|
||||
if (voptions != NULL)
|
||||
if (voptions != NULL) {
|
||||
(void)cfg_map_get(voptions, "zone", &zonelist);
|
||||
else
|
||||
} else {
|
||||
(void)cfg_map_get(config, "zone", &zonelist);
|
||||
}
|
||||
|
||||
for (element = cfg_list_first(zonelist);
|
||||
element != NULL;
|
||||
for (element = cfg_list_first(zonelist); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *zconfig = cfg_listelt_value(element);
|
||||
tresult = configure_zone(vclass, view, zconfig, vconfig,
|
||||
config, mctx, list);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
tresult = configure_zone(vclass, view, zconfig, vconfig, config,
|
||||
mctx, list);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
dns_rdataclass_t *classp)
|
||||
{
|
||||
dns_rdataclass_t *classp) {
|
||||
isc_textregion_t r;
|
||||
|
||||
if (!cfg_obj_isstring(classobj)) {
|
||||
@@ -485,8 +505,7 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
||||
/*% load zones from the configuration */
|
||||
static isc_result_t
|
||||
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
bool list_zones)
|
||||
{
|
||||
bool list_zones) {
|
||||
const cfg_listelt_t *element;
|
||||
const cfg_obj_t *views;
|
||||
const cfg_obj_t *vconfig;
|
||||
@@ -496,8 +515,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
views = NULL;
|
||||
|
||||
(void)cfg_map_get(config, "view", &views);
|
||||
for (element = cfg_list_first(views);
|
||||
element != NULL;
|
||||
for (element = cfg_list_first(views); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
const cfg_obj_t *classobj;
|
||||
@@ -506,28 +524,31 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||
char buf[sizeof("CLASS65535")];
|
||||
|
||||
vconfig = cfg_listelt_value(element);
|
||||
if (vconfig == NULL)
|
||||
if (vconfig == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
classobj = cfg_tuple_get(vconfig, "class");
|
||||
CHECK(config_getclass(classobj, dns_rdataclass_in,
|
||||
&viewclass));
|
||||
if (dns_rdataclass_ismeta(viewclass))
|
||||
CHECK(config_getclass(classobj, dns_rdataclass_in, &viewclass));
|
||||
if (dns_rdataclass_ismeta(viewclass)) {
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
dns_rdataclass_format(viewclass, buf, sizeof(buf));
|
||||
vname = cfg_obj_asstring(cfg_tuple_get(vconfig, "name"));
|
||||
tresult = configure_view(buf, vname, config, vconfig, mctx,
|
||||
list_zones);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
|
||||
if (views == NULL) {
|
||||
tresult = configure_view("IN", "_default", config, NULL, mctx,
|
||||
list_zones);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@@ -569,15 +590,23 @@ main(int argc, char **argv) {
|
||||
switch (c) {
|
||||
case 'm':
|
||||
if (strcasecmp(isc_commandline_argument, "record") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "trace") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "usage") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0)
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0)
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -641,16 +670,17 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
usage();
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -664,16 +694,19 @@ main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (isc_commandline_index + 1 < argc)
|
||||
if (isc_commandline_index + 1 < argc) {
|
||||
usage();
|
||||
if (argv[isc_commandline_index] != NULL)
|
||||
}
|
||||
if (argv[isc_commandline_index] != NULL) {
|
||||
conffile = argv[isc_commandline_index];
|
||||
if (conffile == NULL || conffile[0] == '\0')
|
||||
}
|
||||
if (conffile == NULL || conffile[0] == '\0') {
|
||||
conffile = NAMED_CONFFILE;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
InitSockets();
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
|
||||
|
||||
@@ -699,12 +732,14 @@ main(int argc, char **argv) {
|
||||
|
||||
if (result == ISC_R_SUCCESS && (load_zones || list_zones)) {
|
||||
result = load_zones_fromconfig(config, mctx, list_zones);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
exit_status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (print && exit_status == 0)
|
||||
if (print && exit_status == 0) {
|
||||
cfg_printx(config, flags, output, NULL);
|
||||
}
|
||||
cfg_obj_destroy(parser, &config);
|
||||
|
||||
cfg_parser_destroy(&parser);
|
||||
@@ -715,7 +750,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#ifdef _WIN32
|
||||
DestroySockets();
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
return (exit_status);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -325,5 +325,5 @@ BIND 9 Administrator Reference Manual\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2002, 2004-2007, 2009-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+69
-62
@@ -9,12 +9,11 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
@@ -53,14 +52,14 @@ static const char *prog_name = NULL;
|
||||
static const dns_master_style_t *outputstyle = NULL;
|
||||
static enum { progmode_check, progmode_compile } progmode;
|
||||
|
||||
#define ERRRET(result, function) \
|
||||
do { \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
if (!quiet) \
|
||||
fprintf(stderr, "%s() returned %s\n", \
|
||||
#define ERRRET(result, function) \
|
||||
do { \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
if (!quiet) \
|
||||
fprintf(stderr, "%s() returned %s\n", \
|
||||
function, dns_result_totext(result)); \
|
||||
return (result); \
|
||||
} \
|
||||
return (result); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -121,18 +120,21 @@ main(int argc, char **argv) {
|
||||
outputstyle = &dns_master_style_full;
|
||||
|
||||
prog_name = strrchr(argv[0], '/');
|
||||
if (prog_name == NULL)
|
||||
if (prog_name == NULL) {
|
||||
prog_name = strrchr(argv[0], '\\');
|
||||
if (prog_name != NULL)
|
||||
}
|
||||
if (prog_name != NULL) {
|
||||
prog_name++;
|
||||
else
|
||||
} else {
|
||||
prog_name = argv[0];
|
||||
}
|
||||
/*
|
||||
* Libtool doesn't preserve the program name prior to final
|
||||
* installation. Remove the libtool prefix ("lt-").
|
||||
*/
|
||||
if (strncmp(prog_name, "lt-", 3) == 0)
|
||||
if (strncmp(prog_name, "lt-", 3) == 0) {
|
||||
prog_name += 3;
|
||||
}
|
||||
|
||||
#define PROGCMP(X) \
|
||||
(strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0)
|
||||
@@ -148,24 +150,23 @@ main(int argc, char **argv) {
|
||||
|
||||
/* Compilation specific defaults */
|
||||
if (progmode == progmode_compile) {
|
||||
zone_options |= (DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_FATALNS |
|
||||
DNS_ZONEOPT_CHECKSPF |
|
||||
DNS_ZONEOPT_CHECKDUPRR |
|
||||
zone_options |= (DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_FATALNS |
|
||||
DNS_ZONEOPT_CHECKSPF | DNS_ZONEOPT_CHECKDUPRR |
|
||||
DNS_ZONEOPT_CHECKNAMES |
|
||||
DNS_ZONEOPT_CHECKNAMESFAIL |
|
||||
DNS_ZONEOPT_CHECKWILDCARD);
|
||||
} else
|
||||
zone_options |= (DNS_ZONEOPT_CHECKDUPRR |
|
||||
DNS_ZONEOPT_CHECKSPF);
|
||||
} else {
|
||||
zone_options |= (DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF);
|
||||
}
|
||||
|
||||
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv,
|
||||
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
|
||||
!= EOF) {
|
||||
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:"
|
||||
"M:S:T:W:")) != EOF)
|
||||
{
|
||||
switch (c) {
|
||||
case 'c':
|
||||
classname = isc_commandline_argument;
|
||||
@@ -269,16 +270,15 @@ main(int argc, char **argv) {
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
if (ARGCMP("ignore")) {
|
||||
zone_options &= ~(DNS_ZONEOPT_CHECKNS|
|
||||
zone_options &= ~(DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_FATALNS);
|
||||
} else if (ARGCMP("warn")) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS;
|
||||
zone_options &= ~DNS_ZONEOPT_FATALNS;
|
||||
} else if (ARGCMP("fail")) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS|
|
||||
zone_options |= DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_FATALNS;
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument to -n: %s\n",
|
||||
@@ -330,9 +330,9 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (ARGCMP("full"))
|
||||
if (ARGCMP("full")) {
|
||||
outputstyle = &dns_master_style_full;
|
||||
else if (ARGCMP("relative")) {
|
||||
} else if (ARGCMP("relative")) {
|
||||
outputstyle = &dns_master_style_default;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
@@ -411,23 +411,25 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
if (ARGCMP("warn"))
|
||||
if (ARGCMP("warn")) {
|
||||
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
|
||||
else if (ARGCMP("ignore"))
|
||||
} else if (ARGCMP("ignore")) {
|
||||
zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
|
||||
}
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
prog_name, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
usage();
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
prog_name, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -435,26 +437,26 @@ main(int argc, char **argv) {
|
||||
if (workdir != NULL) {
|
||||
result = isc_dir_chdir(workdir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "isc_dir_chdir: %s: %s\n",
|
||||
workdir, isc_result_totext(result));
|
||||
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (inputformatstr != NULL) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0)
|
||||
if (strcasecmp(inputformatstr, "text") == 0) {
|
||||
inputformat = dns_masterformat_text;
|
||||
else if (strcasecmp(inputformatstr, "raw") == 0)
|
||||
} else if (strcasecmp(inputformatstr, "raw") == 0) {
|
||||
inputformat = dns_masterformat_raw;
|
||||
else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
|
||||
} else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
|
||||
inputformat = dns_masterformat_raw;
|
||||
fprintf(stderr,
|
||||
"WARNING: input format raw, version ignored\n");
|
||||
fprintf(stderr, "WARNING: input format raw, version "
|
||||
"ignored\n");
|
||||
} else if (strcasecmp(inputformatstr, "map") == 0) {
|
||||
inputformat = dns_masterformat_map;
|
||||
} else {
|
||||
fprintf(stderr, "unknown file format: %s\n",
|
||||
inputformatstr);
|
||||
inputformatstr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -471,8 +473,7 @@ main(int argc, char **argv) {
|
||||
rawversion = strtol(outputformatstr + 4, &end, 10);
|
||||
if (end == outputformatstr + 4 || *end != '\0' ||
|
||||
rawversion > 1U) {
|
||||
fprintf(stderr,
|
||||
"unknown raw format version\n");
|
||||
fprintf(stderr, "unknown raw format version\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if (strcasecmp(outputformatstr, "map") == 0) {
|
||||
@@ -485,42 +486,45 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (progmode == progmode_compile) {
|
||||
dumpzone = 1; /* always dump */
|
||||
dumpzone = 1; /* always dump */
|
||||
logdump = !quiet;
|
||||
if (output_filename == NULL) {
|
||||
fprintf(stderr,
|
||||
"output file required, but not specified\n");
|
||||
fprintf(stderr, "output file required, but not "
|
||||
"specified\n");
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (output_filename != NULL)
|
||||
if (output_filename != NULL) {
|
||||
dumpzone = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are outputing to stdout then send the informational
|
||||
* If we are printing to stdout then send the informational
|
||||
* output to stderr.
|
||||
*/
|
||||
if (dumpzone &&
|
||||
(output_filename == NULL ||
|
||||
strcmp(output_filename, "-") == 0 ||
|
||||
(output_filename == NULL || strcmp(output_filename, "-") == 0 ||
|
||||
strcmp(output_filename, "/dev/fd/1") == 0 ||
|
||||
strcmp(output_filename, "/dev/stdout") == 0)) {
|
||||
strcmp(output_filename, "/dev/stdout") == 0))
|
||||
{
|
||||
errout = stderr;
|
||||
logdump = false;
|
||||
}
|
||||
|
||||
if (isc_commandline_index + 2 != argc)
|
||||
if (isc_commandline_index + 2 != argc) {
|
||||
usage();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
InitSockets();
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
if (!quiet)
|
||||
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
|
||||
== ISC_R_SUCCESS);
|
||||
if (!quiet) {
|
||||
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) ==
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_result_register();
|
||||
|
||||
@@ -541,20 +545,23 @@ main(int argc, char **argv) {
|
||||
fprintf(errout, "dump zone to %s...", output_filename);
|
||||
fflush(errout);
|
||||
}
|
||||
result = dump_zone(origin, zone, output_filename,
|
||||
outputformat, outputstyle, rawversion);
|
||||
if (logdump)
|
||||
result = dump_zone(origin, zone, output_filename, outputformat,
|
||||
outputstyle, rawversion);
|
||||
if (logdump) {
|
||||
fprintf(errout, "done\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet && result == ISC_R_SUCCESS)
|
||||
if (!quiet && result == ISC_R_SUCCESS) {
|
||||
fprintf(errout, "OK\n");
|
||||
}
|
||||
destroy();
|
||||
if (lctx != NULL)
|
||||
if (lctx != NULL) {
|
||||
isc_log_destroy(&lctx);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
#ifdef _WIN32
|
||||
DestroySockets();
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
return ((result == ISC_R_SUCCESS) ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -144,5 +144,5 @@ BIND 9 Administrator Reference Manual\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+56
-45
@@ -36,24 +36,24 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
#include "util.h"
|
||||
|
||||
#define KEYGEN_DEFAULT "tsig-key"
|
||||
#define CONFGEN_DEFAULT "ddns-key"
|
||||
#include <confgen/os.h>
|
||||
#include <dst/dst.h>
|
||||
|
||||
#define KEYGEN_DEFAULT "tsig-key"
|
||||
#define CONFGEN_DEFAULT "ddns-key"
|
||||
|
||||
static char program[256];
|
||||
const char *progname;
|
||||
static enum { progmode_keygen, progmode_confgen} progmode;
|
||||
static enum { progmode_keygen, progmode_confgen } progmode;
|
||||
bool verbose = false; /* needed by util.c but not used here */
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -70,16 +70,16 @@ Usage:\n\
|
||||
-s name: domain name to be updated using the created key\n\
|
||||
-z zone: name of the zone as it will be used in named.conf\n\
|
||||
-q: quiet mode: print the key, with no explanatory text\n",
|
||||
progname);
|
||||
progname);
|
||||
} else {
|
||||
fprintf(stderr, "\
|
||||
Usage:\n\
|
||||
%s [-a alg] [keyname]\n\
|
||||
-a alg: algorithm (default hmac-sha256)\n\n",
|
||||
progname);
|
||||
progname);
|
||||
}
|
||||
|
||||
exit (status);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -102,20 +102,22 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
result = isc_file_progname(*argv, program, sizeof(program));
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
memmove(program, "tsig-keygen", 11);
|
||||
}
|
||||
progname = program;
|
||||
|
||||
/*
|
||||
* Libtool doesn't preserve the program name prior to final
|
||||
* installation. Remove the libtool prefix ("lt-").
|
||||
*/
|
||||
if (strncmp(progname, "lt-", 3) == 0)
|
||||
if (strncmp(progname, "lt-", 3) == 0) {
|
||||
progname += 3;
|
||||
}
|
||||
|
||||
#define PROGCMP(X) \
|
||||
(strcasecmp(progname, X) == 0 || strcasecmp(progname, X ".exe") == 0)
|
||||
@@ -132,24 +134,26 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv,
|
||||
"a:hk:Mmr:qs:y:z:")) != -1) {
|
||||
while ((ch = isc_commandline_parse(argc, argv, "a:hk:Mmr:qs:y:z:")) !=
|
||||
-1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
algname = isc_commandline_argument;
|
||||
alg = alg_fromtext(algname);
|
||||
if (alg == DST_ALG_UNKNOWN)
|
||||
if (alg == DST_ALG_UNKNOWN) {
|
||||
fatal("Unsupported algorithm '%s'", algname);
|
||||
}
|
||||
keysize = alg_bits(alg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y':
|
||||
if (progmode == progmode_confgen)
|
||||
if (progmode == progmode_confgen) {
|
||||
keyname = isc_commandline_argument;
|
||||
else
|
||||
} else {
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
|
||||
@@ -158,51 +162,58 @@ main(int argc, char **argv) {
|
||||
show_final_mem = true;
|
||||
break;
|
||||
case 'q':
|
||||
if (progmode == progmode_confgen)
|
||||
if (progmode == progmode_confgen) {
|
||||
quiet = true;
|
||||
else
|
||||
} else {
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
fatal("The -r option has been deprecated.");
|
||||
break;
|
||||
case 's':
|
||||
if (progmode == progmode_confgen)
|
||||
if (progmode == progmode_confgen) {
|
||||
self_domain = isc_commandline_argument;
|
||||
else
|
||||
} else {
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (progmode == progmode_confgen)
|
||||
if (progmode == progmode_confgen) {
|
||||
zone = isc_commandline_argument;
|
||||
else
|
||||
} else {
|
||||
usage(1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(1);
|
||||
} else
|
||||
} else {
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (progmode == progmode_keygen)
|
||||
if (progmode == progmode_keygen) {
|
||||
keyname = argv[isc_commandline_index++];
|
||||
}
|
||||
|
||||
POST(argv);
|
||||
|
||||
if (self_domain != NULL && zone != NULL)
|
||||
usage(1); /* -s and -z cannot coexist */
|
||||
if (self_domain != NULL && zone != NULL) {
|
||||
usage(1); /* -s and -z cannot coexist */
|
||||
}
|
||||
|
||||
if (argc > isc_commandline_index)
|
||||
if (argc > isc_commandline_index) {
|
||||
usage(1);
|
||||
}
|
||||
|
||||
/* Use canonical algorithm name */
|
||||
algname = alg_totext(alg);
|
||||
@@ -212,18 +223,18 @@ main(int argc, char **argv) {
|
||||
if (keyname == NULL) {
|
||||
const char *suffix = NULL;
|
||||
|
||||
keyname = ((progmode == progmode_keygen)
|
||||
? KEYGEN_DEFAULT
|
||||
: CONFGEN_DEFAULT);
|
||||
if (self_domain != NULL)
|
||||
keyname = ((progmode == progmode_keygen) ? KEYGEN_DEFAULT
|
||||
: CONFGEN_DEFAULT);
|
||||
if (self_domain != NULL) {
|
||||
suffix = self_domain;
|
||||
else if (zone != NULL)
|
||||
} else if (zone != NULL) {
|
||||
suffix = zone;
|
||||
}
|
||||
if (suffix != NULL) {
|
||||
len = strlen(keyname) + strlen(suffix) + 2;
|
||||
keybuf = isc_mem_get(mctx, len);
|
||||
snprintf(keybuf, len, "%s.%s", keyname, suffix);
|
||||
keyname = (const char *) keybuf;
|
||||
keyname = (const char *)keybuf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,20 +242,19 @@ main(int argc, char **argv) {
|
||||
|
||||
generate_key(mctx, alg, keysize, &key_txtbuffer);
|
||||
|
||||
|
||||
if (!quiet)
|
||||
if (!quiet) {
|
||||
printf("\
|
||||
# To activate this key, place the following in named.conf, and\n\
|
||||
# in a separate keyfile on the system or systems from which nsupdate\n\
|
||||
# will be run:\n");
|
||||
}
|
||||
|
||||
printf("\
|
||||
key \"%s\" {\n\
|
||||
algorithm %s;\n\
|
||||
secret \"%.*s\";\n\
|
||||
};\n",
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
keyname, algname, (int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer));
|
||||
|
||||
if (!quiet) {
|
||||
@@ -282,14 +292,15 @@ update-policy {\n\
|
||||
# After the keyfile has been placed, the following command will\n\
|
||||
# execute nsupdate using this key:\n\
|
||||
nsupdate -k <keyfile>\n");
|
||||
|
||||
}
|
||||
|
||||
if (keybuf != NULL)
|
||||
if (keybuf != NULL) {
|
||||
isc_mem_put(mctx, keybuf, len);
|
||||
}
|
||||
|
||||
if (show_final_mem)
|
||||
if (show_final_mem) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2009, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
||||
@@ -9,18 +9,19 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#ifndef RNDC_OS_H
|
||||
#define RNDC_OS_H 1
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/lang.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
int set_user(FILE *fd, const char *user);
|
||||
int
|
||||
set_user(FILE *fd, const char *user);
|
||||
/*%<
|
||||
* Set the owner of the file referenced by 'fd' to 'user'.
|
||||
* Returns:
|
||||
@@ -30,4 +31,4 @@ int set_user(FILE *fd, const char *user);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif
|
||||
#endif /* ifndef RNDC_OS_H */
|
||||
|
||||
+85
-75
@@ -9,11 +9,12 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "keygen.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
@@ -23,16 +24,14 @@
|
||||
#include <isc/result.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
#include <pk11/site.h>
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/name.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
|
||||
#include <confgen/os.h>
|
||||
#include <dst/dst.h>
|
||||
#include <pk11/site.h>
|
||||
|
||||
/*%
|
||||
* Convert algorithm type to string.
|
||||
@@ -40,20 +39,20 @@
|
||||
const char *
|
||||
alg_totext(dns_secalg_t alg) {
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
return "hmac-md5";
|
||||
case DST_ALG_HMACSHA1:
|
||||
return "hmac-sha1";
|
||||
case DST_ALG_HMACSHA224:
|
||||
return "hmac-sha224";
|
||||
case DST_ALG_HMACSHA256:
|
||||
return "hmac-sha256";
|
||||
case DST_ALG_HMACSHA384:
|
||||
return "hmac-sha384";
|
||||
case DST_ALG_HMACSHA512:
|
||||
return "hmac-sha512";
|
||||
default:
|
||||
return "(unknown)";
|
||||
case DST_ALG_HMACMD5:
|
||||
return ("hmac-md5");
|
||||
case DST_ALG_HMACSHA1:
|
||||
return ("hmac-sha1");
|
||||
case DST_ALG_HMACSHA224:
|
||||
return ("hmac-sha224");
|
||||
case DST_ALG_HMACSHA256:
|
||||
return ("hmac-sha256");
|
||||
case DST_ALG_HMACSHA384:
|
||||
return ("hmac-sha384");
|
||||
case DST_ALG_HMACSHA512:
|
||||
return ("hmac-sha512");
|
||||
default:
|
||||
return ("(unknown)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,22 +62,29 @@ alg_totext(dns_secalg_t alg) {
|
||||
dns_secalg_t
|
||||
alg_fromtext(const char *name) {
|
||||
const char *p = name;
|
||||
if (strncasecmp(p, "hmac-", 5) == 0)
|
||||
if (strncasecmp(p, "hmac-", 5) == 0) {
|
||||
p = &name[5];
|
||||
}
|
||||
|
||||
if (strcasecmp(p, "md5") == 0)
|
||||
return DST_ALG_HMACMD5;
|
||||
if (strcasecmp(p, "sha1") == 0)
|
||||
return DST_ALG_HMACSHA1;
|
||||
if (strcasecmp(p, "sha224") == 0)
|
||||
return DST_ALG_HMACSHA224;
|
||||
if (strcasecmp(p, "sha256") == 0)
|
||||
return DST_ALG_HMACSHA256;
|
||||
if (strcasecmp(p, "sha384") == 0)
|
||||
return DST_ALG_HMACSHA384;
|
||||
if (strcasecmp(p, "sha512") == 0)
|
||||
return DST_ALG_HMACSHA512;
|
||||
return DST_ALG_UNKNOWN;
|
||||
if (strcasecmp(p, "md5") == 0) {
|
||||
return (DST_ALG_HMACMD5);
|
||||
}
|
||||
if (strcasecmp(p, "sha1") == 0) {
|
||||
return (DST_ALG_HMACSHA1);
|
||||
}
|
||||
if (strcasecmp(p, "sha224") == 0) {
|
||||
return (DST_ALG_HMACSHA224);
|
||||
}
|
||||
if (strcasecmp(p, "sha256") == 0) {
|
||||
return (DST_ALG_HMACSHA256);
|
||||
}
|
||||
if (strcasecmp(p, "sha384") == 0) {
|
||||
return (DST_ALG_HMACSHA384);
|
||||
}
|
||||
if (strcasecmp(p, "sha512") == 0) {
|
||||
return (DST_ALG_HMACSHA512);
|
||||
}
|
||||
return (DST_ALG_UNKNOWN);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -87,20 +93,20 @@ alg_fromtext(const char *name) {
|
||||
int
|
||||
alg_bits(dns_secalg_t alg) {
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
return 128;
|
||||
case DST_ALG_HMACSHA1:
|
||||
return 160;
|
||||
case DST_ALG_HMACSHA224:
|
||||
return 224;
|
||||
case DST_ALG_HMACSHA256:
|
||||
return 256;
|
||||
case DST_ALG_HMACSHA384:
|
||||
return 384;
|
||||
case DST_ALG_HMACSHA512:
|
||||
return 512;
|
||||
default:
|
||||
return 0;
|
||||
case DST_ALG_HMACMD5:
|
||||
return (128);
|
||||
case DST_ALG_HMACSHA1:
|
||||
return (160);
|
||||
case DST_ALG_HMACSHA224:
|
||||
return (224);
|
||||
case DST_ALG_HMACSHA256:
|
||||
return (256);
|
||||
case DST_ALG_HMACSHA384:
|
||||
return (384);
|
||||
case DST_ALG_HMACSHA512:
|
||||
return (512);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,30 +123,31 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
dst_key_t *key = NULL;
|
||||
|
||||
switch (alg) {
|
||||
case DST_ALG_HMACMD5:
|
||||
case DST_ALG_HMACSHA1:
|
||||
case DST_ALG_HMACSHA224:
|
||||
case DST_ALG_HMACSHA256:
|
||||
if (keysize < 1 || keysize > 512)
|
||||
case DST_ALG_HMACMD5:
|
||||
case DST_ALG_HMACSHA1:
|
||||
case DST_ALG_HMACSHA224:
|
||||
case DST_ALG_HMACSHA256:
|
||||
if (keysize < 1 || keysize > 512) {
|
||||
fatal("keysize %d out of range (must be 1-512)\n",
|
||||
keysize);
|
||||
}
|
||||
break;
|
||||
case DST_ALG_HMACSHA384:
|
||||
case DST_ALG_HMACSHA512:
|
||||
if (keysize < 1 || keysize > 1024)
|
||||
case DST_ALG_HMACSHA384:
|
||||
case DST_ALG_HMACSHA512:
|
||||
if (keysize < 1 || keysize > 1024) {
|
||||
fatal("keysize %d out of range (must be 1-1024)\n",
|
||||
keysize);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
fatal("unsupported algorithm %d\n", alg);
|
||||
}
|
||||
|
||||
DO("initialize dst library", dst_lib_init(mctx, NULL));
|
||||
|
||||
DO("generate key", dst_key_generate(dns_rootname, alg,
|
||||
keysize, 0, 0, DNS_KEYPROTO_ANY,
|
||||
dns_rdataclass_in, mctx, &key,
|
||||
NULL));
|
||||
DO("generate key",
|
||||
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
|
||||
dns_rdataclass_in, mctx, &key, NULL));
|
||||
|
||||
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
|
||||
|
||||
@@ -148,11 +155,12 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
|
||||
isc_buffer_usedregion(&key_rawbuffer, &key_rawregion);
|
||||
|
||||
DO("bsse64 encode secret", isc_base64_totext(&key_rawregion, -1, "",
|
||||
key_txtbuffer));
|
||||
DO("bsse64 encode secret",
|
||||
isc_base64_totext(&key_rawregion, -1, "", key_txtbuffer));
|
||||
|
||||
if (key != NULL)
|
||||
if (key != NULL) {
|
||||
dst_key_free(&key);
|
||||
}
|
||||
|
||||
dst_lib_destroy();
|
||||
}
|
||||
@@ -163,9 +171,8 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
* the name 'keyname' and the secret in the buffer 'secret'.
|
||||
*/
|
||||
void
|
||||
write_key_file(const char *keyfile, const char *user,
|
||||
const char *keyname, isc_buffer_t *secret,
|
||||
dns_secalg_t alg) {
|
||||
write_key_file(const char *keyfile, const char *user, const char *keyname,
|
||||
isc_buffer_t *secret, dns_secalg_t alg) {
|
||||
isc_result_t result;
|
||||
const char *algname = alg_totext(alg);
|
||||
FILE *fd = NULL;
|
||||
@@ -173,19 +180,22 @@ write_key_file(const char *keyfile, const char *user,
|
||||
DO("create keyfile", isc_file_safecreate(keyfile, &fd));
|
||||
|
||||
if (user != NULL) {
|
||||
if (set_user(fd, user) == -1)
|
||||
if (set_user(fd, user) == -1) {
|
||||
fatal("unable to set file owner\n");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd, "key \"%s\" {\n\talgorithm %s;\n"
|
||||
fprintf(fd,
|
||||
"key \"%s\" {\n\talgorithm %s;\n"
|
||||
"\tsecret \"%.*s\";\n};\n",
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(secret),
|
||||
keyname, algname, (int)isc_buffer_usedlength(secret),
|
||||
(char *)isc_buffer_base(secret));
|
||||
fflush(fd);
|
||||
if (ferror(fd))
|
||||
if (ferror(fd)) {
|
||||
fatal("write to %s failed\n", keyfile);
|
||||
if (fclose(fd))
|
||||
}
|
||||
if (fclose(fd)) {
|
||||
fatal("fclose(%s) failed\n", keyfile);
|
||||
}
|
||||
fprintf(stderr, "wrote key file \"%s\"\n", keyfile);
|
||||
}
|
||||
|
||||
+16
-9
@@ -9,26 +9,33 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RNDC_KEYGEN_H
|
||||
#define RNDC_KEYGEN_H 1
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/mem.h>
|
||||
|
||||
#include <dns/secalg.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
void generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
isc_buffer_t *key_txtbuffer);
|
||||
void
|
||||
generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
|
||||
isc_buffer_t *key_txtbuffer);
|
||||
|
||||
void write_key_file(const char *keyfile, const char *user,
|
||||
const char *keyname, isc_buffer_t *secret,
|
||||
dns_secalg_t alg);
|
||||
void
|
||||
write_key_file(const char *keyfile, const char *user, const char *keyname,
|
||||
isc_buffer_t *secret, dns_secalg_t alg);
|
||||
|
||||
const char *alg_totext(dns_secalg_t alg);
|
||||
dns_secalg_t alg_fromtext(const char *name);
|
||||
int alg_bits(dns_secalg_t alg);
|
||||
const char *
|
||||
alg_totext(dns_secalg_t alg);
|
||||
dns_secalg_t
|
||||
alg_fromtext(const char *name);
|
||||
int
|
||||
alg_bits(dns_secalg_t alg);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -206,5 +206,5 @@ BIND 9 Administrator Reference Manual\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2001, 2003-2005, 2007, 2009, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+40
-33
@@ -37,20 +37,19 @@
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <pk11/site.h>
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/name.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "keygen.h"
|
||||
#include "util.h"
|
||||
|
||||
#define DEFAULT_KEYNAME "rndc-key"
|
||||
#define DEFAULT_SERVER "127.0.0.1"
|
||||
#define DEFAULT_PORT 953
|
||||
#include <confgen/os.h>
|
||||
#include <dst/dst.h>
|
||||
#include <pk11/site.h>
|
||||
|
||||
#define DEFAULT_KEYNAME "rndc-key"
|
||||
#define DEFAULT_SERVER "127.0.0.1"
|
||||
#define DEFAULT_PORT 953
|
||||
|
||||
static char program[256];
|
||||
const char *progname;
|
||||
@@ -64,7 +63,6 @@ usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(int status) {
|
||||
|
||||
fprintf(stderr, "\
|
||||
Usage:\n\
|
||||
%s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] \
|
||||
@@ -78,9 +76,9 @@ Usage:\n\
|
||||
-s addr: the address to which rndc should connect\n\
|
||||
-t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\
|
||||
-u user: set the keyfile owner to \"user\" (requires -a)\n",
|
||||
progname, keydef);
|
||||
progname, keydef);
|
||||
|
||||
exit (status);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -108,8 +106,9 @@ main(int argc, char **argv) {
|
||||
keydef = keyfile = RNDC_KEYFILE;
|
||||
|
||||
result = isc_file_progname(*argv, program, sizeof(program));
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
memmove(program, "rndc-confgen", 13);
|
||||
}
|
||||
progname = program;
|
||||
|
||||
keyname = DEFAULT_KEYNAME;
|
||||
@@ -129,13 +128,15 @@ main(int argc, char **argv) {
|
||||
case 'A':
|
||||
algname = isc_commandline_argument;
|
||||
alg = alg_fromtext(algname);
|
||||
if (alg == DST_ALG_UNKNOWN)
|
||||
if (alg == DST_ALG_UNKNOWN) {
|
||||
fatal("Unsupported algorithm '%s'", algname);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
keysize = strtol(isc_commandline_argument, &p, 10);
|
||||
if (*p != '\0' || keysize < 0)
|
||||
if (*p != '\0' || keysize < 0) {
|
||||
fatal("-b requires a non-negative number");
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
keyfile = isc_commandline_argument;
|
||||
@@ -143,7 +144,7 @@ main(int argc, char **argv) {
|
||||
case 'h':
|
||||
usage(0);
|
||||
case 'k':
|
||||
case 'y': /* Compatible with rndc -y. */
|
||||
case 'y': /* Compatible with rndc -y. */
|
||||
keyname = isc_commandline_argument;
|
||||
break;
|
||||
case 'M':
|
||||
@@ -155,9 +156,10 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'p':
|
||||
port = strtol(isc_commandline_argument, &p, 10);
|
||||
if (*p != '\0' || port < 0 || port > 65535)
|
||||
if (*p != '\0' || port < 0 || port > 65535) {
|
||||
fatal("port '%s' out of range",
|
||||
isc_commandline_argument);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
fatal("The -r option has been deprecated.");
|
||||
@@ -166,7 +168,9 @@ main(int argc, char **argv) {
|
||||
serveraddr = isc_commandline_argument;
|
||||
if (inet_pton(AF_INET, serveraddr, &addr4_dummy) != 1 &&
|
||||
inet_pton(AF_INET6, serveraddr, &addr6_dummy) != 1)
|
||||
{
|
||||
fatal("-s should be an IPv4 or IPv6 address");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
chrootdir = isc_commandline_argument;
|
||||
@@ -182,12 +186,13 @@ main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
usage(1);
|
||||
} else
|
||||
} else {
|
||||
usage(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -196,17 +201,19 @@ main(int argc, char **argv) {
|
||||
argv += isc_commandline_index;
|
||||
POST(argv);
|
||||
|
||||
if (argc > 0)
|
||||
if (argc > 0) {
|
||||
usage(1);
|
||||
|
||||
if (alg == DST_ALG_HMACMD5) {
|
||||
fprintf(stderr,
|
||||
"warning: use of hmac-md5 for RNDC keys "
|
||||
"is deprecated; hmac-sha256 is now recommended.\n");
|
||||
}
|
||||
|
||||
if (keysize < 0)
|
||||
if (alg == DST_ALG_HMACMD5) {
|
||||
fprintf(stderr, "warning: use of hmac-md5 for RNDC keys "
|
||||
"is deprecated; hmac-sha256 is now "
|
||||
"recommended.\n");
|
||||
}
|
||||
|
||||
if (keysize < 0) {
|
||||
keysize = alg_bits(alg);
|
||||
}
|
||||
algname = alg_totext(alg);
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
@@ -256,16 +263,16 @@ options {\n\
|
||||
# End of named.conf\n",
|
||||
keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer),
|
||||
keyname, serveraddr, port,
|
||||
keyname, algname,
|
||||
(char *)isc_buffer_base(&key_txtbuffer), keyname,
|
||||
serveraddr, port, keyname, algname,
|
||||
(int)isc_buffer_usedlength(&key_txtbuffer),
|
||||
(char *)isc_buffer_base(&key_txtbuffer),
|
||||
serveraddr, port, serveraddr, keyname);
|
||||
(char *)isc_buffer_base(&key_txtbuffer), serveraddr,
|
||||
port, serveraddr, keyname);
|
||||
}
|
||||
|
||||
if (show_final_mem)
|
||||
if (show_final_mem) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -9,18 +9,17 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
set_user(FILE *fd, const char *user) {
|
||||
|
||||
+3
-4
@@ -9,18 +9,17 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
extern bool verbose;
|
||||
extern const char *progname;
|
||||
|
||||
|
||||
+9
-11
@@ -9,27 +9,25 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RNDC_UTIL_H
|
||||
#define RNDC_UTIL_H 1
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/formatcheck.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/platform.h>
|
||||
|
||||
#include <isc/formatcheck.h>
|
||||
|
||||
#define NS_CONTROL_PORT 953
|
||||
#define NS_CONTROL_PORT 953
|
||||
|
||||
#undef DO
|
||||
#define DO(name, function) \
|
||||
do { \
|
||||
result = function; \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
#define DO(name, function) \
|
||||
do { \
|
||||
result = function; \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
fatal("%s: %s", name, isc_result_totext(result)); \
|
||||
else \
|
||||
notify("%s", name); \
|
||||
else \
|
||||
notify("%s", name); \
|
||||
} while (0)
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
@@ -39,7 +37,7 @@ notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <confgen/os.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <confgen/os.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
set_user(FILE *fd, const char *user) {
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -144,7 +144,7 @@ options\&.
|
||||
Note: When reading the trust anchor file,
|
||||
\fBdelv\fR
|
||||
treats
|
||||
\fBdnssec\-keys\fR\fBinitial\-key\fR
|
||||
\fBtrust\-anchors\fR\fBinitial\-key\fR
|
||||
and
|
||||
\fBstatic\-key\fR
|
||||
entries identically\&. That is, even if a key is configured with
|
||||
@@ -433,5 +433,5 @@ RFC5155\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+361
-316
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
@@ -197,7 +197,7 @@
|
||||
</p>
|
||||
<p>
|
||||
Note: When reading the trust anchor file,
|
||||
<span class="command"><strong>delv</strong></span> treats <code class="option">dnssec-keys</code>
|
||||
<span class="command"><strong>delv</strong></span> treats <code class="option">trust-anchors</code>
|
||||
<code class="option">initial-key</code> and <code class="option">static-key</code>
|
||||
entries identically. That is, even if a key is configured
|
||||
with <span class="command"><strong>initial-key</strong></span>, indicating that it is
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2011, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2011, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -849,5 +849,5 @@ There are probably too many query options\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2011, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2011, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+622
-482
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2011, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2011, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
+598
-508
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -269,5 +269,5 @@ runs\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2002, 2004, 2005, 2007-2009, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+242
-223
@@ -12,21 +12,21 @@
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#endif /* ifdef HAVE_LOCALE_H */
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/fixedname.h>
|
||||
@@ -35,8 +35,8 @@
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
|
||||
@@ -49,83 +49,56 @@ static dns_rdatatype_t list_type = dns_rdatatype_a;
|
||||
static bool printed_server = false;
|
||||
static bool ipv4only = false, ipv6only = false;
|
||||
|
||||
static const char *opcodetext[] = {
|
||||
"QUERY",
|
||||
"IQUERY",
|
||||
"STATUS",
|
||||
"RESERVED3",
|
||||
"NOTIFY",
|
||||
"UPDATE",
|
||||
"RESERVED6",
|
||||
"RESERVED7",
|
||||
"RESERVED8",
|
||||
"RESERVED9",
|
||||
"RESERVED10",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15"
|
||||
};
|
||||
static const char *opcodetext[] = { "QUERY", "IQUERY", "STATUS",
|
||||
"RESERVED3", "NOTIFY", "UPDATE",
|
||||
"RESERVED6", "RESERVED7", "RESERVED8",
|
||||
"RESERVED9", "RESERVED10", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15" };
|
||||
|
||||
static const char *rcodetext[] = {
|
||||
"NOERROR",
|
||||
"FORMERR",
|
||||
"SERVFAIL",
|
||||
"NXDOMAIN",
|
||||
"NOTIMP",
|
||||
"REFUSED",
|
||||
"YXDOMAIN",
|
||||
"YXRRSET",
|
||||
"NXRRSET",
|
||||
"NOTAUTH",
|
||||
"NOTZONE",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15",
|
||||
"BADVERS"
|
||||
};
|
||||
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
|
||||
"NXDOMAIN", "NOTIMP", "REFUSED",
|
||||
"YXDOMAIN", "YXRRSET", "NXRRSET",
|
||||
"NOTAUTH", "NOTZONE", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15", "BADVERS" };
|
||||
|
||||
struct rtype {
|
||||
unsigned int type;
|
||||
const char *text;
|
||||
};
|
||||
|
||||
struct rtype rtypes[] = {
|
||||
{ 1, "has address" },
|
||||
{ 2, "name server" },
|
||||
{ 5, "is an alias for" },
|
||||
{ 11, "has well known services" },
|
||||
{ 12, "domain name pointer" },
|
||||
{ 13, "host information" },
|
||||
{ 15, "mail is handled by" },
|
||||
{ 16, "descriptive text" },
|
||||
{ 19, "x25 address" },
|
||||
{ 20, "ISDN address" },
|
||||
{ 24, "has signature" },
|
||||
{ 25, "has key" },
|
||||
{ 28, "has IPv6 address" },
|
||||
{ 29, "location" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
struct rtype rtypes[] = { { 1, "has address" },
|
||||
{ 2, "name server" },
|
||||
{ 5, "is an alias for" },
|
||||
{ 11, "has well known services" },
|
||||
{ 12, "domain name pointer" },
|
||||
{ 13, "host information" },
|
||||
{ 15, "mail is handled by" },
|
||||
{ 16, "descriptive text" },
|
||||
{ 19, "x25 address" },
|
||||
{ 20, "ISDN address" },
|
||||
{ 24, "has signature" },
|
||||
{ 25, "has key" },
|
||||
{ 28, "has IPv6 address" },
|
||||
{ 29, "location" },
|
||||
{ 0, NULL } };
|
||||
|
||||
static char *
|
||||
rcode_totext(dns_rcode_t rcode)
|
||||
{
|
||||
rcode_totext(dns_rcode_t rcode) {
|
||||
static char buf[sizeof("?65535")];
|
||||
union {
|
||||
const char *consttext;
|
||||
char *deconsttext;
|
||||
} totext;
|
||||
|
||||
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
|
||||
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
|
||||
snprintf(buf, sizeof(buf), "?%u", rcode);
|
||||
totext.deconsttext = buf;
|
||||
} else
|
||||
} else {
|
||||
totext.consttext = rcodetext[rcode];
|
||||
return totext.deconsttext;
|
||||
}
|
||||
return (totext.deconsttext);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
@@ -133,35 +106,37 @@ show_usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
show_usage(void) {
|
||||
fputs(
|
||||
"Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W time]\n"
|
||||
" [-R number] [-m flag] hostname [server]\n"
|
||||
" -a is equivalent to -v -t ANY\n"
|
||||
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
|
||||
" -c specifies query class for non-IN data\n"
|
||||
" -C compares SOA records on authoritative nameservers\n"
|
||||
" -d is equivalent to -v\n"
|
||||
" -l lists all hosts in a domain, using AXFR\n"
|
||||
" -m set memory debugging flag (trace|record|usage)\n"
|
||||
" -N changes the number of dots allowed before root lookup is done\n"
|
||||
" -r disables recursive processing\n"
|
||||
" -R specifies number of retries for UDP packets\n"
|
||||
" -s a SERVFAIL response should stop query\n"
|
||||
" -t specifies the query type\n"
|
||||
" -T enables TCP/IP mode\n"
|
||||
" -U enables UDP mode\n"
|
||||
" -v enables verbose output\n"
|
||||
" -V print version number and exit\n"
|
||||
" -w specifies to wait forever for a reply\n"
|
||||
" -W specifies how long to wait for a reply\n"
|
||||
" -4 use IPv4 query transport only\n"
|
||||
" -6 use IPv6 query transport only\n", stderr);
|
||||
fputs("Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W "
|
||||
"time]\n"
|
||||
" [-R number] [-m flag] hostname [server]\n"
|
||||
" -a is equivalent to -v -t ANY\n"
|
||||
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
|
||||
" -c specifies query class for non-IN data\n"
|
||||
" -C compares SOA records on authoritative nameservers\n"
|
||||
" -d is equivalent to -v\n"
|
||||
" -l lists all hosts in a domain, using AXFR\n"
|
||||
" -m set memory debugging flag (trace|record|usage)\n"
|
||||
" -N changes the number of dots allowed before root lookup "
|
||||
"is done\n"
|
||||
" -r disables recursive processing\n"
|
||||
" -R specifies number of retries for UDP packets\n"
|
||||
" -s a SERVFAIL response should stop query\n"
|
||||
" -t specifies the query type\n"
|
||||
" -T enables TCP/IP mode\n"
|
||||
" -U enables UDP mode\n"
|
||||
" -v enables verbose output\n"
|
||||
" -V print version number and exit\n"
|
||||
" -w specifies to wait forever for a reply\n"
|
||||
" -W specifies how long to wait for a reply\n"
|
||||
" -4 use IPv4 query transport only\n"
|
||||
" -6 use IPv6 query transport only\n",
|
||||
stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
host_shutdown(void) {
|
||||
(void) isc_app_shutdown();
|
||||
(void)isc_app_shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -173,9 +148,9 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
char fromtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
|
||||
TIME_NOW(&now);
|
||||
diff = (int) isc_time_microdiff(&now, &query->time_sent);
|
||||
printf("Received %u bytes from %s in %d ms\n",
|
||||
bytes, fromtext, diff/1000);
|
||||
diff = (int)isc_time_microdiff(&now, &query->time_sent);
|
||||
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
|
||||
diff / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,14 +158,14 @@ static void
|
||||
trying(char *frm, dig_lookup_t *lookup) {
|
||||
UNUSED(lookup);
|
||||
|
||||
if (!short_form)
|
||||
if (!short_form) {
|
||||
printf("Trying \"%s\"\n", frm);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
dig_query_t *query)
|
||||
{
|
||||
dig_query_t *query) {
|
||||
isc_buffer_t *b = NULL;
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
isc_region_t r;
|
||||
@@ -198,9 +173,8 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
unsigned int bufsize = BUFSIZ;
|
||||
|
||||
dns_name_format(name, namestr, sizeof(namestr));
|
||||
retry:
|
||||
result = isc_buffer_allocate(mctx, &b, bufsize);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
retry:
|
||||
isc_buffer_allocate(mctx, &b, bufsize);
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
isc_buffer_free(&b);
|
||||
@@ -210,11 +184,9 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
check_result(result, "dns_rdata_totext");
|
||||
isc_buffer_usedregion(b, &r);
|
||||
if (query->lookup->identify_previous_line) {
|
||||
printf("Nameserver %s:\n\t",
|
||||
query->servname);
|
||||
printf("Nameserver %s:\n\t", query->servname);
|
||||
}
|
||||
printf("%s %s %.*s", namestr,
|
||||
msg, (int)r.length, (char *)r.base);
|
||||
printf("%s %s %.*s", namestr, msg, (int)r.length, (char *)r.base);
|
||||
if (query->lookup->identify) {
|
||||
printf(" on server %s", query->servname);
|
||||
}
|
||||
@@ -224,9 +196,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
|
||||
static isc_result_t
|
||||
printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
const char *section_name, bool headers,
|
||||
dig_query_t *query)
|
||||
{
|
||||
const char *section_name, bool headers, dig_query_t *query) {
|
||||
dns_name_t *name, *print_name;
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
@@ -238,21 +208,24 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
bool first;
|
||||
bool no_rdata;
|
||||
|
||||
if (sectionid == DNS_SECTION_QUESTION)
|
||||
if (sectionid == DNS_SECTION_QUESTION) {
|
||||
no_rdata = true;
|
||||
else
|
||||
} else {
|
||||
no_rdata = false;
|
||||
}
|
||||
|
||||
if (headers)
|
||||
if (headers) {
|
||||
printf(";; %s SECTION:\n", section_name);
|
||||
}
|
||||
|
||||
dns_name_init(&empty_name, NULL);
|
||||
|
||||
result = dns_message_firstname(msg, sectionid);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return (ISC_R_SUCCESS);
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
@@ -262,9 +235,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
first = true;
|
||||
print_name = name;
|
||||
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
if (query->lookup->rdtype == dns_rdatatype_axfr &&
|
||||
!((!list_addresses &&
|
||||
(list_type == dns_rdatatype_any ||
|
||||
@@ -274,36 +247,39 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
rdataset->type == dns_rdatatype_aaaa ||
|
||||
rdataset->type == dns_rdatatype_ns ||
|
||||
rdataset->type == dns_rdatatype_ptr))))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (list_almost_all &&
|
||||
(rdataset->type == dns_rdatatype_rrsig ||
|
||||
rdataset->type == dns_rdatatype_nsec ||
|
||||
rdataset->type == dns_rdatatype_nsec3))
|
||||
(rdataset->type == dns_rdatatype_rrsig ||
|
||||
rdataset->type == dns_rdatatype_nsec ||
|
||||
rdataset->type == dns_rdatatype_nsec3))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!short_form) {
|
||||
result = dns_rdataset_totext(rdataset,
|
||||
print_name,
|
||||
false,
|
||||
no_rdata,
|
||||
&target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
print_name, false,
|
||||
no_rdata, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
#ifdef USEINITALWS
|
||||
if (first) {
|
||||
print_name = &empty_name;
|
||||
first = false;
|
||||
}
|
||||
#else
|
||||
#else /* ifdef USEINITALWS */
|
||||
UNUSED(first); /* Shut up compiler. */
|
||||
#endif
|
||||
#endif /* ifdef USEINITALWS */
|
||||
} else {
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
struct rtype *t;
|
||||
const char *rtt;
|
||||
char typebuf[DNS_RDATATYPE_FORMATSIZE];
|
||||
char typebuf2[DNS_RDATATYPE_FORMATSIZE
|
||||
+ 20];
|
||||
char typebuf2[DNS_RDATATYPE_FORMATSIZE +
|
||||
20];
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
||||
for (t = rtypes; t->text != NULL; t++) {
|
||||
@@ -320,8 +296,8 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
"has %s record", typebuf);
|
||||
rtt = typebuf2;
|
||||
found:
|
||||
say_message(print_name, rtt,
|
||||
&rdata, query);
|
||||
say_message(print_name, rtt, &rdata,
|
||||
query);
|
||||
dns_rdata_reset(&rdata);
|
||||
loopresult =
|
||||
dns_rdataset_next(rdataset);
|
||||
@@ -330,18 +306,19 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
}
|
||||
if (!short_form) {
|
||||
isc_buffer_usedregion(&target, &r);
|
||||
if (no_rdata)
|
||||
printf(";%.*s", (int)r.length,
|
||||
(char *)r.base);
|
||||
else
|
||||
if (no_rdata) {
|
||||
printf(";%.*s", (int)r.length, (char *)r.base);
|
||||
} else {
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_message_nextname(msg, sectionid);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -349,24 +326,23 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
|
||||
static isc_result_t
|
||||
printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
||||
const dns_name_t *owner, const char *set_name,
|
||||
bool headers)
|
||||
{
|
||||
const dns_name_t *owner, const char *set_name, bool headers) {
|
||||
isc_buffer_t target;
|
||||
isc_result_t result;
|
||||
isc_region_t r;
|
||||
char tbuf[4096];
|
||||
|
||||
UNUSED(msg);
|
||||
if (headers)
|
||||
if (headers) {
|
||||
printf(";; %s SECTION:\n", set_name);
|
||||
}
|
||||
|
||||
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
||||
|
||||
result = dns_rdataset_totext(rdataset, owner, false, false,
|
||||
&target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_usedregion(&target, &r);
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
|
||||
@@ -386,8 +362,9 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
|
||||
dns_rdatatype_cname, 0, NULL,
|
||||
&rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
result = dns_rdataset_first(rdataset);
|
||||
check_result(result, "dns_rdataset_first");
|
||||
dns_rdata_reset(&rdata);
|
||||
@@ -400,9 +377,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers)
|
||||
{
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
bool headers) {
|
||||
bool did_flag = false;
|
||||
dns_rdataset_t *opt, *tsig = NULL;
|
||||
const dns_name_t *tsigname;
|
||||
@@ -423,8 +399,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
|
||||
printf("Using domain server:\n");
|
||||
printf("Name: %s\n", query->userarg);
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr,
|
||||
sizeof(sockstr));
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
|
||||
printf("Address: %s\n", sockstr);
|
||||
printf("Aliases: \n\n");
|
||||
printed_server = true;
|
||||
@@ -434,17 +409,20 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
|
||||
|
||||
if (query->lookup->identify_previous_line)
|
||||
if (query->lookup->identify_previous_line) {
|
||||
printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
|
||||
query->servname,
|
||||
(msg->rcode != dns_rcode_nxdomain) ? namestr :
|
||||
query->lookup->textname, msg->rcode,
|
||||
rcode_totext(msg->rcode));
|
||||
else
|
||||
(msg->rcode != dns_rcode_nxdomain)
|
||||
? namestr
|
||||
: query->lookup->textname,
|
||||
msg->rcode, rcode_totext(msg->rcode));
|
||||
} else {
|
||||
printf("Host %s not found: %d(%s)\n",
|
||||
(msg->rcode != dns_rcode_nxdomain) ? namestr :
|
||||
query->lookup->textname, msg->rcode,
|
||||
rcode_totext(msg->rcode));
|
||||
(msg->rcode != dns_rcode_nxdomain)
|
||||
? namestr
|
||||
: query->lookup->textname,
|
||||
msg->rcode, rcode_totext(msg->rcode));
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -522,60 +500,70 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
msg->counts[DNS_SECTION_AUTHORITY],
|
||||
msg->counts[DNS_SECTION_ADDITIONAL]);
|
||||
opt = dns_message_getopt(msg);
|
||||
if (opt != NULL)
|
||||
if (opt != NULL) {
|
||||
printf(";; EDNS: version: %u, udp=%u\n",
|
||||
(unsigned int)((opt->ttl & 0x00ff0000) >> 16),
|
||||
(unsigned int)opt->rdclass);
|
||||
}
|
||||
tsigname = NULL;
|
||||
tsig = dns_message_gettsig(msg, &tsigname);
|
||||
if (tsig != NULL)
|
||||
if (tsig != NULL) {
|
||||
printf(";; PSEUDOSECTIONS: TSIG\n");
|
||||
}
|
||||
}
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) &&
|
||||
!short_form) {
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) && !short_form)
|
||||
{
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
if (!short_form)
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
if (!short_form) {
|
||||
printf("\n");
|
||||
}
|
||||
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
|
||||
!short_form, query);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
|
||||
!short_form) {
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
|
||||
!short_form) {
|
||||
printf("\n");
|
||||
result = printsection(msg, DNS_SECTION_ADDITIONAL,
|
||||
"ADDITIONAL", true, query);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
|
||||
true, query);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if ((tsig != NULL) && !short_form) {
|
||||
printf("\n");
|
||||
result = printrdata(msg, tsig, tsigname,
|
||||
"PSEUDOSECTION TSIG", true);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
|
||||
true);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
if (!short_form)
|
||||
if (!short_form) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (short_form && !default_lookups &&
|
||||
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
|
||||
{
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
char typestr[DNS_RDATATYPE_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
|
||||
@@ -587,7 +575,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
return (result);
|
||||
}
|
||||
|
||||
static const char * optstring = "46aAc:dilnm:rst:vVwCDN:R:TUW:";
|
||||
static const char *optstring = "46aAc:dilnm:rst:vVwCDN:R:TUW:";
|
||||
|
||||
/*% version */
|
||||
static void
|
||||
@@ -604,52 +592,75 @@ pre_parse_args(int argc, char **argv) {
|
||||
case 'm':
|
||||
memdebugging = true;
|
||||
if (strcasecmp("trace", isc_commandline_argument) == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
else if (strcasecmp("record",
|
||||
isc_commandline_argument) == 0)
|
||||
} else if (strcasecmp("record",
|
||||
isc_commandline_argument) == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
else if (strcasecmp("usage",
|
||||
isc_commandline_argument) == 0)
|
||||
} else if (strcasecmp("usage",
|
||||
isc_commandline_argument) == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
}
|
||||
break;
|
||||
|
||||
case '4':
|
||||
if (ipv6only)
|
||||
if (ipv6only) {
|
||||
fatal("only one of -4 and -6 allowed");
|
||||
}
|
||||
ipv4only = true;
|
||||
break;
|
||||
case '6':
|
||||
if (ipv4only)
|
||||
if (ipv4only) {
|
||||
fatal("only one of -4 and -6 allowed");
|
||||
}
|
||||
ipv6only = true;
|
||||
break;
|
||||
case 'a': break;
|
||||
case 'A': break;
|
||||
case 'c': break;
|
||||
case 'C': break;
|
||||
case 'd': break;
|
||||
case 'a':
|
||||
break;
|
||||
case 'A':
|
||||
break;
|
||||
case 'c':
|
||||
break;
|
||||
case 'C':
|
||||
break;
|
||||
case 'd':
|
||||
break;
|
||||
case 'D':
|
||||
if (debugging)
|
||||
if (debugging) {
|
||||
debugtiming = true;
|
||||
}
|
||||
debugging = true;
|
||||
break;
|
||||
case 'i': break;
|
||||
case 'l': break;
|
||||
case 'n': break;
|
||||
case 'N': break;
|
||||
case 'r': break;
|
||||
case 'R': break;
|
||||
case 's': break;
|
||||
case 't': break;
|
||||
case 'T': break;
|
||||
case 'U': break;
|
||||
case 'v': break;
|
||||
case 'i':
|
||||
break;
|
||||
case 'l':
|
||||
break;
|
||||
case 'n':
|
||||
break;
|
||||
case 'N':
|
||||
break;
|
||||
case 'r':
|
||||
break;
|
||||
case 'R':
|
||||
break;
|
||||
case 's':
|
||||
break;
|
||||
case 't':
|
||||
break;
|
||||
case 'T':
|
||||
break;
|
||||
case 'U':
|
||||
break;
|
||||
case 'v':
|
||||
break;
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
case 'w': break;
|
||||
case 'W': break;
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
case 'w':
|
||||
break;
|
||||
case 'W':
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
@@ -694,8 +705,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
lookup->recurse = false;
|
||||
break;
|
||||
case 't':
|
||||
if (strncasecmp(isc_commandline_argument,
|
||||
"ixfr=", 5) == 0) {
|
||||
if (strncasecmp(isc_commandline_argument, "ixfr=", 5) ==
|
||||
0) {
|
||||
rdtype = dns_rdatatype_ixfr;
|
||||
/* XXXMPA add error checking */
|
||||
serial = strtoul(isc_commandline_argument + 5,
|
||||
@@ -704,8 +715,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
} else {
|
||||
tr.base = isc_commandline_argument;
|
||||
tr.length = strlen(isc_commandline_argument);
|
||||
result = dns_rdatatype_fromtext(&rdtype,
|
||||
(isc_textregion_t *)&tr);
|
||||
result = dns_rdatatype_fromtext(
|
||||
&rdtype, (isc_textregion_t *)&tr);
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -714,8 +725,9 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
isc_commandline_argument);
|
||||
}
|
||||
if (!lookup->rdtypeset ||
|
||||
lookup->rdtype != dns_rdatatype_axfr)
|
||||
lookup->rdtype != dns_rdatatype_axfr) {
|
||||
lookup->rdtype = rdtype;
|
||||
}
|
||||
lookup->rdtypeset = true;
|
||||
if (rdtype == dns_rdatatype_axfr) {
|
||||
/* -l -t any -v */
|
||||
@@ -727,18 +739,20 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
lookup->tcp_mode = true;
|
||||
list_type = rdtype;
|
||||
} else if (rdtype == dns_rdatatype_any) {
|
||||
if (!lookup->tcp_mode_set)
|
||||
if (!lookup->tcp_mode_set) {
|
||||
lookup->tcp_mode = true;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
list_type = rdtype;
|
||||
}
|
||||
list_addresses = false;
|
||||
default_lookups = false;
|
||||
break;
|
||||
case 'c':
|
||||
tr.base = isc_commandline_argument;
|
||||
tr.length = strlen(isc_commandline_argument);
|
||||
result = dns_rdataclass_fromtext(&rdclass,
|
||||
(isc_textregion_t *)&tr);
|
||||
result = dns_rdataclass_fromtext(
|
||||
&rdclass, (isc_textregion_t *)&tr);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatalexit = 2;
|
||||
@@ -752,11 +766,12 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
break;
|
||||
case 'A':
|
||||
list_almost_all = true;
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'a':
|
||||
if (!lookup->rdtypeset ||
|
||||
lookup->rdtype != dns_rdatatype_axfr)
|
||||
lookup->rdtype != dns_rdatatype_axfr) {
|
||||
lookup->rdtype = dns_rdatatype_any;
|
||||
}
|
||||
list_type = dns_rdatatype_any;
|
||||
list_addresses = false;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -781,13 +796,15 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
break;
|
||||
case 'W':
|
||||
timeout = atoi(isc_commandline_argument);
|
||||
if (timeout < 1)
|
||||
if (timeout < 1) {
|
||||
timeout = 1;
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
tries = atoi(isc_commandline_argument) + 1;
|
||||
if (tries < 2)
|
||||
if (tries < 2) {
|
||||
tries = 2;
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
lookup->tcp_mode = true;
|
||||
@@ -809,8 +826,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
default_lookups = false;
|
||||
break;
|
||||
case 'N':
|
||||
debug("setting NDOTS to %s",
|
||||
isc_commandline_argument);
|
||||
debug("setting NDOTS to %s", isc_commandline_argument);
|
||||
ndots = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'D':
|
||||
@@ -830,21 +846,23 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
|
||||
lookup->retries = tries;
|
||||
|
||||
if (isc_commandline_index >= argc)
|
||||
if (isc_commandline_index >= argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
strlcpy(hostname, argv[isc_commandline_index], sizeof(hostname));
|
||||
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
set_nameserver(argv[isc_commandline_index+1]);
|
||||
debug("server is %s", argv[isc_commandline_index+1]);
|
||||
set_nameserver(argv[isc_commandline_index + 1]);
|
||||
debug("server is %s", argv[isc_commandline_index + 1]);
|
||||
listed_server = true;
|
||||
} else
|
||||
} else {
|
||||
check_ra = true;
|
||||
}
|
||||
|
||||
lookup->pending = false;
|
||||
if (get_reverse(store, sizeof(store), hostname, true)
|
||||
== ISC_R_SUCCESS) {
|
||||
if (get_reverse(store, sizeof(store), hostname, true) == ISC_R_SUCCESS)
|
||||
{
|
||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||
lookup->rdtype = dns_rdatatype_ptr;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -883,10 +901,11 @@ main(int argc, char **argv) {
|
||||
setup_libs();
|
||||
setup_system(ipv4only, ipv6only);
|
||||
parse_args(false, argc, argv);
|
||||
if (keyfile[0] != 0)
|
||||
if (keyfile[0] != 0) {
|
||||
setup_file_key();
|
||||
else if (keysecret[0] != 0)
|
||||
} else if (keysecret[0] != 0) {
|
||||
setup_text_key();
|
||||
}
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
|
||||
check_result(result, "isc_app_onrun");
|
||||
isc_app_run();
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
||||
+140
-192
@@ -17,10 +17,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dns/rdatalist.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/bufferlist.h>
|
||||
#include <isc/formatcheck.h>
|
||||
@@ -32,20 +28,24 @@
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/socket.h>
|
||||
|
||||
#include <dns/rdatalist.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
#endif /* ifdef __APPLE__ */
|
||||
|
||||
#define MXSERV 20
|
||||
#define MXNAME (DNS_NAME_MAXTEXT+1)
|
||||
#define MXRD 32
|
||||
#define MXNAME (DNS_NAME_MAXTEXT + 1)
|
||||
#define MXRD 32
|
||||
/*% Buffer Size */
|
||||
#define BUFSIZE 512
|
||||
#define BUFSIZE 512
|
||||
#define COMMSIZE 0xffff
|
||||
#ifndef RESOLV_CONF
|
||||
/*% location of resolve.conf */
|
||||
#define RESOLV_CONF "/etc/resolv.conf"
|
||||
#endif
|
||||
#endif /* ifndef RESOLV_CONF */
|
||||
/*% output buffer */
|
||||
#define OUTPUTBUF 32767
|
||||
/*% Max RR Limit */
|
||||
@@ -77,155 +77,111 @@
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef struct dig_lookup dig_lookup_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_server dig_server_t;
|
||||
typedef ISC_LIST(dig_server_t) dig_serverlist_t;
|
||||
typedef struct dig_searchlist dig_searchlist_t;
|
||||
|
||||
#define DIG_QUERY_MAGIC ISC_MAGIC('D','i','g','q')
|
||||
|
||||
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
|
||||
#define DIG_QUERY_MAGIC ISC_MAGIC('D', 'i', 'g', 'q')
|
||||
|
||||
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
|
||||
|
||||
/*% The dig_lookup structure */
|
||||
struct dig_lookup {
|
||||
bool
|
||||
pending, /*%< Pending a successful answer */
|
||||
waiting_connect,
|
||||
doing_xfr,
|
||||
ns_search_only, /*%< dig +nssearch, host -C */
|
||||
bool pending, /*%< Pending a successful answer */
|
||||
waiting_connect, doing_xfr, ns_search_only, /*%< dig
|
||||
* +nssearch,
|
||||
* host -C */
|
||||
identify, /*%< Append an "on server <foo>" message */
|
||||
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
|
||||
message, with newline and tab */
|
||||
ignore,
|
||||
recurse,
|
||||
aaonly,
|
||||
adflag,
|
||||
cdflag,
|
||||
raflag,
|
||||
tcflag,
|
||||
zflag,
|
||||
trace, /*% dig +trace */
|
||||
trace_root, /*% initial query for either +trace or +nssearch */
|
||||
tcp_mode,
|
||||
tcp_mode_set,
|
||||
comments,
|
||||
stats,
|
||||
section_question,
|
||||
section_answer,
|
||||
section_authority,
|
||||
section_additional,
|
||||
servfail_stops,
|
||||
new_search,
|
||||
need_search,
|
||||
done_as_is,
|
||||
besteffort,
|
||||
dnssec,
|
||||
expire,
|
||||
sendcookie,
|
||||
seenbadcookie,
|
||||
badcookie,
|
||||
nsid, /*% Name Server ID (RFC 5001) */
|
||||
tcp_keepalive,
|
||||
header_only,
|
||||
ednsneg,
|
||||
mapped,
|
||||
print_unknown_format,
|
||||
multiline,
|
||||
nottl,
|
||||
noclass,
|
||||
onesoa,
|
||||
use_usec,
|
||||
nocrypto,
|
||||
ttlunits,
|
||||
idnin,
|
||||
idnout,
|
||||
expandaaaa,
|
||||
qr,
|
||||
accept_reply_unexpected_src; /*% print replies from unexpected
|
||||
sources. */
|
||||
char textname[MXNAME]; /*% Name we're going to be looking up */
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
* message, with newline and tab */
|
||||
ignore, recurse, aaonly, adflag, cdflag, raflag, tcflag, zflag,
|
||||
trace, /*% dig +trace */
|
||||
trace_root, /*% initial query for either +trace or +nssearch
|
||||
* */
|
||||
tcp_mode, tcp_mode_set, comments, stats, section_question,
|
||||
section_answer, section_authority, section_additional,
|
||||
servfail_stops, new_search, need_search, done_as_is, besteffort,
|
||||
dnssec, expire, sendcookie, seenbadcookie, badcookie,
|
||||
nsid, /*% Name Server ID (RFC 5001) */
|
||||
tcp_keepalive, header_only, ednsneg, mapped,
|
||||
print_unknown_format, multiline, nottl, noclass, onesoa,
|
||||
use_usec, nocrypto, ttlunits, idnin, idnout, expandaaaa, qr,
|
||||
accept_reply_unexpected_src; /*% print replies from
|
||||
* unexpected
|
||||
* sources. */
|
||||
char textname[MXNAME]; /*% Name we're going to be
|
||||
* looking up */
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
dns_rdataclass_t rdclass;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char *sendspace;
|
||||
dns_name_t *name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t *sendmsg;
|
||||
dns_name_t *oname;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char * sendspace;
|
||||
dns_name_t * name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t * sendmsg;
|
||||
dns_name_t * oname;
|
||||
ISC_LINK(dig_lookup_t) link;
|
||||
ISC_LIST(dig_query_t) q;
|
||||
ISC_LIST(dig_query_t) connecting;
|
||||
dig_query_t *current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_query_t * current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_searchlist_t *origin;
|
||||
dig_query_t *xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t *tsigctx;
|
||||
isc_buffer_t *querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t *ecs_addr;
|
||||
char *cookie;
|
||||
dns_ednsopt_t *ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
dig_query_t * xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t * tsigctx;
|
||||
isc_buffer_t * querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t * ecs_addr;
|
||||
char * cookie;
|
||||
dns_ednsopt_t * ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
};
|
||||
|
||||
/*% The dig_query structure */
|
||||
struct dig_query {
|
||||
unsigned int magic;
|
||||
unsigned int magic;
|
||||
dig_lookup_t *lookup;
|
||||
bool waiting_connect,
|
||||
pending_free,
|
||||
waiting_senddone,
|
||||
first_pass,
|
||||
first_soa_rcvd,
|
||||
second_rr_rcvd,
|
||||
first_repeat_rcvd,
|
||||
recv_made,
|
||||
warn_id,
|
||||
timedout;
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char *servname;
|
||||
char *userarg;
|
||||
isc_buffer_t recvbuf,
|
||||
lengthbuf,
|
||||
tmpsendbuf,
|
||||
sendbuf;
|
||||
char *recvspace, *tmpsendspace,
|
||||
lengthspace[4];
|
||||
bool waiting_connect, pending_free, waiting_senddone, first_pass,
|
||||
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made,
|
||||
warn_id, timedout;
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char * servname;
|
||||
char * userarg;
|
||||
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
|
||||
char * recvspace, *tmpsendspace, lengthspace[4];
|
||||
isc_socket_t *sock;
|
||||
ISC_LINK(dig_query_t) link;
|
||||
ISC_LINK(dig_query_t) clink;
|
||||
isc_sockaddr_t sockaddr;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t *timer;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t * timer;
|
||||
};
|
||||
|
||||
struct dig_server {
|
||||
@@ -246,38 +202,38 @@ typedef ISC_LIST(dig_lookup_t) dig_lookuplist_t;
|
||||
* Externals from dighost.c
|
||||
*/
|
||||
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_searchlistlist_t search_list;
|
||||
extern unsigned int extrabytes;
|
||||
extern unsigned int extrabytes;
|
||||
|
||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source,
|
||||
usesearch, showsearch, yaml;
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t *mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch,
|
||||
showsearch, yaml;
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t * mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern const dns_name_t *hmacname;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t *tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t *taskmgr;
|
||||
extern isc_task_t *global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t * tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t * taskmgr;
|
||||
extern isc_task_t * global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
|
||||
extern char *progname;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
|
||||
/*
|
||||
* Routines in dighost.c.
|
||||
@@ -293,14 +249,13 @@ get_reverse(char *reverse, size_t len, char *value, bool strict);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
digexit(void)
|
||||
ISC_PLATFORM_NORETURN_POST;
|
||||
digexit(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
void
|
||||
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
@@ -333,12 +288,10 @@ void
|
||||
setup_system(bool ipv4only, bool ipv6only);
|
||||
|
||||
isc_result_t
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max,
|
||||
const char *desc);
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
|
||||
|
||||
isc_result_t
|
||||
parse_xint(uint32_t *uip, const char *value, uint32_t max,
|
||||
const char *desc);
|
||||
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
|
||||
|
||||
isc_result_t
|
||||
parse_netprefix(isc_sockaddr_t **sap, const char *value);
|
||||
@@ -365,8 +318,7 @@ void
|
||||
set_nameserver(char *opt);
|
||||
|
||||
void
|
||||
clone_server_list(dig_serverlist_t src,
|
||||
dig_serverlist_t *dest);
|
||||
clone_server_list(dig_serverlist_t src, dig_serverlist_t *dest);
|
||||
|
||||
void
|
||||
cancel_all(void);
|
||||
@@ -381,54 +333,50 @@ set_search_domain(char *domain);
|
||||
* Routines to be defined in dig.c, host.c, and nslookup.c. and
|
||||
* then assigned to the appropriate function pointer
|
||||
*/
|
||||
extern isc_result_t
|
||||
(*dighost_printmessage)(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers);
|
||||
extern isc_result_t (*dighost_printmessage)(dig_query_t * query,
|
||||
const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers);
|
||||
|
||||
/*
|
||||
* Print an error message in the appropriate format.
|
||||
*/
|
||||
extern void
|
||||
(*dighost_error)(const char *format, ...);
|
||||
extern void (*dighost_error)(const char *format, ...);
|
||||
|
||||
/*
|
||||
* Print a warning message in the appropriate format.
|
||||
*/
|
||||
extern void
|
||||
(*dighost_warning)(const char *format, ...);
|
||||
extern void (*dighost_warning)(const char *format, ...);
|
||||
|
||||
/*
|
||||
* Print a comment in the appropriate format.
|
||||
*/
|
||||
extern void
|
||||
(*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
|
||||
extern void (*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
|
||||
|
||||
/*%<
|
||||
* Print the final result of the lookup.
|
||||
*/
|
||||
|
||||
extern void
|
||||
(*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
|
||||
dig_query_t *query);
|
||||
extern void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
|
||||
dig_query_t *query);
|
||||
/*%<
|
||||
* Print a message about where and when the response
|
||||
* was received from, like the final comment in the
|
||||
* output of "dig".
|
||||
*/
|
||||
|
||||
extern void
|
||||
(*dighost_trying)(char *frm, dig_lookup_t *lookup);
|
||||
extern void (*dighost_trying)(char *frm, dig_lookup_t *lookup);
|
||||
|
||||
extern void
|
||||
(*dighost_shutdown)(void);
|
||||
extern void (*dighost_shutdown)(void);
|
||||
|
||||
extern void
|
||||
(*dighost_pre_exit_hook)(void);
|
||||
extern void (*dighost_pre_exit_hook)(void);
|
||||
|
||||
void save_opt(dig_lookup_t *lookup, char *code, char *value);
|
||||
void
|
||||
save_opt(dig_lookup_t *lookup, char *code, char *value);
|
||||
|
||||
void setup_file_key(void);
|
||||
void setup_text_key(void);
|
||||
void
|
||||
setup_file_key(void);
|
||||
void
|
||||
setup_text_key(void);
|
||||
|
||||
/*
|
||||
* Routines exported from dig.c for use by dig for iOS
|
||||
@@ -467,4 +415,4 @@ dig_shutdown(void);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif
|
||||
#endif /* ifndef DIG_H */
|
||||
|
||||
+6
-3
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2004-2007, 2010, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -233,7 +233,10 @@ Change the default TCP/UDP name server port to
|
||||
.RS 4
|
||||
Change the type of the information query\&.
|
||||
.sp
|
||||
(Default = A; abbreviations = q, ty)
|
||||
(Default = A and then AAAA; abbreviations = q, ty)
|
||||
.sp
|
||||
\fBNote:\fR
|
||||
It is only possible to specify one query type, only the default behavior looks up both when an alternative is not specified\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\fI[no]\fR\fR\fBrecurse\fR
|
||||
@@ -301,5 +304,5 @@ runs or when the standard output is not a tty\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2004-2007, 2010, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+223
-220
@@ -18,22 +18,22 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/event.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/parseint.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/message.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/byaddr.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
|
||||
@@ -42,25 +42,23 @@
|
||||
#include <edit/readline/readline.h>
|
||||
#if defined(HAVE_EDIT_READLINE_HISTORY_H)
|
||||
#include <edit/readline/history.h>
|
||||
#endif
|
||||
#endif /* if defined(HAVE_EDIT_READLINE_HISTORY_H) */
|
||||
#elif defined(HAVE_EDITLINE_READLINE_H)
|
||||
#include <editline/readline.h>
|
||||
#elif defined(HAVE_READLINE_READLINE_H)
|
||||
#include <readline/readline.h>
|
||||
#if defined (HAVE_READLINE_HISTORY_H)
|
||||
#if defined(HAVE_READLINE_HISTORY_H)
|
||||
#include <readline/history.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* if defined(HAVE_READLINE_HISTORY_H) */
|
||||
#endif /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
|
||||
#endif /* if defined(HAVE_READLINE) */
|
||||
|
||||
static bool short_form = true,
|
||||
tcpmode = false, tcpmode_set = false,
|
||||
identify = false, stats = true,
|
||||
comments = true, section_question = true,
|
||||
section_answer = true, section_authority = true,
|
||||
section_additional = true, recurse = true,
|
||||
aaonly = false, nofail = true,
|
||||
default_lookups = true, a_noanswer = false;
|
||||
static bool short_form = true, tcpmode = false, tcpmode_set = false,
|
||||
identify = false, stats = true, comments = true,
|
||||
section_question = true, section_answer = true,
|
||||
section_authority = true, section_additional = true, recurse = true,
|
||||
aaonly = false, nofail = true, default_lookups = true,
|
||||
a_noanswer = false;
|
||||
|
||||
static bool interactive;
|
||||
|
||||
@@ -72,91 +70,80 @@ static int query_error = 1, print_error = 0;
|
||||
|
||||
static char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
static const char *rcodetext[] = {
|
||||
"NOERROR",
|
||||
"FORMERR",
|
||||
"SERVFAIL",
|
||||
"NXDOMAIN",
|
||||
"NOTIMP",
|
||||
"REFUSED",
|
||||
"YXDOMAIN",
|
||||
"YXRRSET",
|
||||
"NXRRSET",
|
||||
"NOTAUTH",
|
||||
"NOTZONE",
|
||||
"RESERVED11",
|
||||
"RESERVED12",
|
||||
"RESERVED13",
|
||||
"RESERVED14",
|
||||
"RESERVED15",
|
||||
"BADVERS"
|
||||
};
|
||||
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
|
||||
"NXDOMAIN", "NOTIMP", "REFUSED",
|
||||
"YXDOMAIN", "YXRRSET", "NXRRSET",
|
||||
"NOTAUTH", "NOTZONE", "RESERVED11",
|
||||
"RESERVED12", "RESERVED13", "RESERVED14",
|
||||
"RESERVED15", "BADVERS" };
|
||||
|
||||
static const char *rtypetext[] = {
|
||||
"rtype_0 = ", /* 0 */
|
||||
"internet address = ", /* 1 */
|
||||
"nameserver = ", /* 2 */
|
||||
"md = ", /* 3 */
|
||||
"mf = ", /* 4 */
|
||||
"canonical name = ", /* 5 */
|
||||
"soa = ", /* 6 */
|
||||
"mb = ", /* 7 */
|
||||
"mg = ", /* 8 */
|
||||
"mr = ", /* 9 */
|
||||
"rtype_10 = ", /* 10 */
|
||||
"protocol = ", /* 11 */
|
||||
"name = ", /* 12 */
|
||||
"hinfo = ", /* 13 */
|
||||
"minfo = ", /* 14 */
|
||||
"mail exchanger = ", /* 15 */
|
||||
"text = ", /* 16 */
|
||||
"rp = ", /* 17 */
|
||||
"afsdb = ", /* 18 */
|
||||
"x25 address = ", /* 19 */
|
||||
"isdn address = ", /* 20 */
|
||||
"rt = ", /* 21 */
|
||||
"nsap = ", /* 22 */
|
||||
"nsap_ptr = ", /* 23 */
|
||||
"signature = ", /* 24 */
|
||||
"key = ", /* 25 */
|
||||
"px = ", /* 26 */
|
||||
"gpos = ", /* 27 */
|
||||
"has AAAA address ", /* 28 */
|
||||
"loc = ", /* 29 */
|
||||
"next = ", /* 30 */
|
||||
"rtype_31 = ", /* 31 */
|
||||
"rtype_32 = ", /* 32 */
|
||||
"service = ", /* 33 */
|
||||
"rtype_34 = ", /* 34 */
|
||||
"naptr = ", /* 35 */
|
||||
"kx = ", /* 36 */
|
||||
"cert = ", /* 37 */
|
||||
"v6 address = ", /* 38 */
|
||||
"dname = ", /* 39 */
|
||||
"rtype_40 = ", /* 40 */
|
||||
"optional = " /* 41 */
|
||||
"rtype_0 = ", /* 0 */
|
||||
"internet address = ", /* 1 */
|
||||
"nameserver = ", /* 2 */
|
||||
"md = ", /* 3 */
|
||||
"mf = ", /* 4 */
|
||||
"canonical name = ", /* 5 */
|
||||
"soa = ", /* 6 */
|
||||
"mb = ", /* 7 */
|
||||
"mg = ", /* 8 */
|
||||
"mr = ", /* 9 */
|
||||
"rtype_10 = ", /* 10 */
|
||||
"protocol = ", /* 11 */
|
||||
"name = ", /* 12 */
|
||||
"hinfo = ", /* 13 */
|
||||
"minfo = ", /* 14 */
|
||||
"mail exchanger = ", /* 15 */
|
||||
"text = ", /* 16 */
|
||||
"rp = ", /* 17 */
|
||||
"afsdb = ", /* 18 */
|
||||
"x25 address = ", /* 19 */
|
||||
"isdn address = ", /* 20 */
|
||||
"rt = ", /* 21 */
|
||||
"nsap = ", /* 22 */
|
||||
"nsap_ptr = ", /* 23 */
|
||||
"signature = ", /* 24 */
|
||||
"key = ", /* 25 */
|
||||
"px = ", /* 26 */
|
||||
"gpos = ", /* 27 */
|
||||
"has AAAA address ", /* 28 */
|
||||
"loc = ", /* 29 */
|
||||
"next = ", /* 30 */
|
||||
"rtype_31 = ", /* 31 */
|
||||
"rtype_32 = ", /* 32 */
|
||||
"service = ", /* 33 */
|
||||
"rtype_34 = ", /* 34 */
|
||||
"naptr = ", /* 35 */
|
||||
"kx = ", /* 36 */
|
||||
"cert = ", /* 37 */
|
||||
"v6 address = ", /* 38 */
|
||||
"dname = ", /* 39 */
|
||||
"rtype_40 = ", /* 40 */
|
||||
"optional = " /* 41 */
|
||||
};
|
||||
|
||||
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
|
||||
|
||||
static void flush_lookup_list(void);
|
||||
static void getinput(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
flush_lookup_list(void);
|
||||
static void
|
||||
getinput(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
static char *
|
||||
rcode_totext(dns_rcode_t rcode)
|
||||
{
|
||||
rcode_totext(dns_rcode_t rcode) {
|
||||
static char buf[sizeof("?65535")];
|
||||
union {
|
||||
const char *consttext;
|
||||
char *deconsttext;
|
||||
} totext;
|
||||
|
||||
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
|
||||
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
|
||||
snprintf(buf, sizeof(buf), "?%u", rcode);
|
||||
totext.deconsttext = buf;
|
||||
} else
|
||||
} else {
|
||||
totext.consttext = rcodetext[rcode];
|
||||
return totext.deconsttext;
|
||||
}
|
||||
return (totext.deconsttext);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -215,22 +202,22 @@ printrdata(dns_rdata_t *rdata) {
|
||||
unsigned int size = 1024;
|
||||
bool done = false;
|
||||
|
||||
if (rdata->type < N_KNOWN_RRTYPES)
|
||||
if (rdata->type < N_KNOWN_RRTYPES) {
|
||||
printf("%s", rtypetext[rdata->type]);
|
||||
else
|
||||
} else {
|
||||
printf("rdata_%d = ", rdata->type);
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
result = isc_buffer_allocate(mctx, &b, size);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &b, size);
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
printf("%.*s\n", (int)isc_buffer_usedlength(b),
|
||||
(char *)isc_buffer_base(b));
|
||||
done = true;
|
||||
} else if (result != ISC_R_NOSPACE)
|
||||
} else if (result != ISC_R_NOSPACE) {
|
||||
check_result(result, "dns_rdata_totext");
|
||||
}
|
||||
isc_buffer_free(&b);
|
||||
size *= 2;
|
||||
}
|
||||
@@ -251,25 +238,26 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
debug("printsection()");
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return (ISC_R_SUCCESS);
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
dns_message_currentname(msg, section,
|
||||
&name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
dns_message_currentname(msg, section, &name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
switch (rdata.type) {
|
||||
case dns_rdatatype_a:
|
||||
case dns_rdatatype_aaaa:
|
||||
if (section != DNS_SECTION_ANSWER)
|
||||
if (section != DNS_SECTION_ANSWER) {
|
||||
goto def_short_section;
|
||||
}
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("Name:\t%s\n", namebuf);
|
||||
@@ -294,9 +282,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
}
|
||||
result = dns_message_nextname(msg, section);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
else if (result != ISC_R_SUCCESS) {
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
@@ -305,7 +293,7 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
|
||||
static isc_result_t
|
||||
detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
dns_section_t section) {
|
||||
dns_section_t section) {
|
||||
isc_result_t result, loopresult;
|
||||
dns_name_t *name;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
@@ -334,36 +322,32 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
|
||||
result = dns_message_firstname(msg, section);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
return (ISC_R_SUCCESS);
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
for (;;) {
|
||||
name = NULL;
|
||||
dns_message_currentname(msg, section,
|
||||
&name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
||||
dns_message_currentname(msg, section, &name);
|
||||
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
if (section == DNS_SECTION_QUESTION) {
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
printf("\t%s, ", namebuf);
|
||||
dns_rdatatype_format(rdataset->type,
|
||||
namebuf,
|
||||
dns_rdatatype_format(rdataset->type, namebuf,
|
||||
sizeof(namebuf));
|
||||
printf("type = %s, ", namebuf);
|
||||
dns_rdataclass_format(rdataset->rdclass,
|
||||
namebuf,
|
||||
sizeof(namebuf));
|
||||
namebuf, sizeof(namebuf));
|
||||
printf("class = %s\n", namebuf);
|
||||
}
|
||||
loopresult = dns_rdataset_first(rdataset);
|
||||
while (loopresult == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
||||
dns_name_format(name, namebuf,
|
||||
sizeof(namebuf));
|
||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||
printf(" -> %s\n", namebuf);
|
||||
|
||||
switch (rdata.type) {
|
||||
@@ -380,9 +364,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
}
|
||||
result = dns_message_nextname(msg, section);
|
||||
if (result == ISC_R_NOMORE)
|
||||
if (result == ISC_R_NOMORE) {
|
||||
break;
|
||||
else if (result != ISC_R_SUCCESS) {
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
@@ -390,8 +374,7 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
}
|
||||
|
||||
static void
|
||||
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query)
|
||||
{
|
||||
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
UNUSED(bytes);
|
||||
UNUSED(from);
|
||||
UNUSED(query);
|
||||
@@ -414,9 +397,11 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
while (i-- > 0) {
|
||||
rdataset = NULL;
|
||||
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
|
||||
dns_rdatatype_cname, 0, NULL, &rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
dns_rdatatype_cname, 0, NULL,
|
||||
&rdataset);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
result = dns_rdataset_first(rdataset);
|
||||
check_result(result, "dns_rdataset_first");
|
||||
dns_rdata_reset(&rdata);
|
||||
@@ -429,9 +414,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers)
|
||||
{
|
||||
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
|
||||
bool headers) {
|
||||
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
UNUSED(msgbuf);
|
||||
@@ -441,7 +425,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
|
||||
debug("printmessage()");
|
||||
|
||||
if(!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
|
||||
if (!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
|
||||
isc_sockaddr_format(&query->sockaddr, servtext,
|
||||
sizeof(servtext));
|
||||
printf("Server:\t\t%s\n", query->userarg);
|
||||
@@ -462,10 +446,10 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
|
||||
if (msg->rcode != 0) {
|
||||
char nametext[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(query->lookup->name,
|
||||
nametext, sizeof(nametext));
|
||||
printf("** server can't find %s: %s\n",
|
||||
nametext, rcode_totext(msg->rcode));
|
||||
dns_name_format(query->lookup->name, nametext,
|
||||
sizeof(nametext));
|
||||
printf("** server can't find %s: %s\n", nametext,
|
||||
rcode_totext(msg->rcode));
|
||||
debug("returning with rcode == 0");
|
||||
|
||||
/* the lookup failed */
|
||||
@@ -473,7 +457,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if ( default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
dig_lookup_t *lookup;
|
||||
dns_fixedname_t fixed;
|
||||
@@ -497,29 +481,32 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
}
|
||||
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) == 0 &&
|
||||
( !default_lookups || query->lookup->rdtype == dns_rdatatype_a) )
|
||||
(!default_lookups || query->lookup->rdtype == dns_rdatatype_a))
|
||||
{
|
||||
puts("Non-authoritative answer:");
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
|
||||
printsection(query, msg, headers, DNS_SECTION_ANSWER);
|
||||
else {
|
||||
} else {
|
||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a)
|
||||
{
|
||||
a_noanswer = true;
|
||||
|
||||
else if (!default_lookups ||
|
||||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
||||
a_noanswer ) )
|
||||
} else if (!default_lookups ||
|
||||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
||||
a_noanswer))
|
||||
{
|
||||
printf("*** Can't find %s: No answer\n",
|
||||
query->lookup->textname);
|
||||
query->lookup->textname);
|
||||
}
|
||||
}
|
||||
|
||||
if (((msg->flags & DNS_MESSAGEFLAG_AA) == 0) &&
|
||||
(query->lookup->rdtype != dns_rdatatype_a) &&
|
||||
(query->lookup->rdtype != dns_rdatatype_aaaa) ) {
|
||||
(query->lookup->rdtype != dns_rdatatype_aaaa))
|
||||
{
|
||||
puts("\nAuthoritative answers can be found from:");
|
||||
printsection(query, msg, headers,
|
||||
DNS_SECTION_AUTHORITY);
|
||||
printsection(query, msg, headers,
|
||||
DNS_SECTION_ADDITIONAL);
|
||||
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
|
||||
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -540,32 +527,32 @@ show_settings(bool full, bool serv_only) {
|
||||
check_result(result, "get_address");
|
||||
|
||||
isc_sockaddr_format(&sockaddr, sockstr, sizeof(sockstr));
|
||||
printf("Default server: %s\nAddress: %s\n",
|
||||
srv->userarg, sockstr);
|
||||
if (!full)
|
||||
printf("Default server: %s\nAddress: %s\n", srv->userarg,
|
||||
sockstr);
|
||||
if (!full) {
|
||||
return;
|
||||
}
|
||||
srv = ISC_LIST_NEXT(srv, link);
|
||||
}
|
||||
if (serv_only)
|
||||
if (serv_only) {
|
||||
return;
|
||||
}
|
||||
printf("\nSet options:\n");
|
||||
printf(" %s\t\t\t%s\t\t%s\n",
|
||||
tcpmode ? "vc" : "novc",
|
||||
short_form ? "nodebug" : "debug",
|
||||
debugging ? "d2" : "nod2");
|
||||
printf(" %s\t\t%s\n",
|
||||
usesearch ? "search" : "nosearch",
|
||||
printf(" %s\t\t\t%s\t\t%s\n", tcpmode ? "vc" : "novc",
|
||||
short_form ? "nodebug" : "debug", debugging ? "d2" : "nod2");
|
||||
printf(" %s\t\t%s\n", usesearch ? "search" : "nosearch",
|
||||
recurse ? "recurse" : "norecurse");
|
||||
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n",
|
||||
timeout, tries, port, ndots);
|
||||
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n", timeout,
|
||||
tries, port, ndots);
|
||||
printf(" querytype = %-8s\tclass = %s\n", deftype, defclass);
|
||||
printf(" srchlist = ");
|
||||
for (listent = ISC_LIST_HEAD(search_list);
|
||||
listent != NULL;
|
||||
listent = ISC_LIST_NEXT(listent, link)) {
|
||||
printf("%s", listent->origin);
|
||||
if (ISC_LIST_NEXT(listent, link) != NULL)
|
||||
printf("/");
|
||||
for (listent = ISC_LIST_HEAD(search_list); listent != NULL;
|
||||
listent = ISC_LIST_NEXT(listent, link))
|
||||
{
|
||||
printf("%s", listent->origin);
|
||||
if (ISC_LIST_NEXT(listent, link) != NULL) {
|
||||
printf("/");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@@ -579,9 +566,9 @@ testtype(char *typetext) {
|
||||
tr.base = typetext;
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return (true);
|
||||
else {
|
||||
} else {
|
||||
printf("unknown query type: %s\n", typetext);
|
||||
return (false);
|
||||
}
|
||||
@@ -596,9 +583,9 @@ testclass(char *typetext) {
|
||||
tr.base = typetext;
|
||||
tr.length = strlen(typetext);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return (true);
|
||||
else {
|
||||
} else {
|
||||
printf("unknown query class: %s\n", typetext);
|
||||
return (false);
|
||||
}
|
||||
@@ -608,32 +595,36 @@ static void
|
||||
set_port(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, 65535, "port");
|
||||
if (result == ISC_R_SUCCESS)
|
||||
port = (uint16_t) n;
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
port = (uint16_t)n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_timeout(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
timeout = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_tries(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
tries = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_ndots(const char *value) {
|
||||
uint32_t n;
|
||||
isc_result_t result = parse_uint(&n, value, 128, "ndots");
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
ndots = n;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -651,11 +642,13 @@ setoption(char *opt) {
|
||||
if (CHECKOPT("all", 3)) {
|
||||
show_settings(true, false);
|
||||
} else if (strncasecmp(opt, "class=", 6) == 0) {
|
||||
if (testclass(&opt[6]))
|
||||
if (testclass(&opt[6])) {
|
||||
strlcpy(defclass, &opt[6], sizeof(defclass));
|
||||
}
|
||||
} else if (strncasecmp(opt, "cl=", 3) == 0) {
|
||||
if (testclass(&opt[3]))
|
||||
if (testclass(&opt[3])) {
|
||||
strlcpy(defclass, &opt[3], sizeof(defclass));
|
||||
}
|
||||
} else if (strncasecmp(opt, "type=", 5) == 0) {
|
||||
if (testtype(&opt[5])) {
|
||||
strlcpy(deftype, &opt[5], sizeof(deftype));
|
||||
@@ -737,9 +730,9 @@ setoption(char *opt) {
|
||||
} else if (CHECKOPT("sil", 3)) {
|
||||
/* deprecation_msg = false; */
|
||||
} else if (CHECKOPT("fail", 3)) {
|
||||
nofail=false;
|
||||
nofail = false;
|
||||
} else if (CHECKOPT("nofail", 5)) {
|
||||
nofail=true;
|
||||
nofail = true;
|
||||
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
|
||||
set_ndots(&opt[6]);
|
||||
} else {
|
||||
@@ -775,8 +768,7 @@ addlookup(char *opt) {
|
||||
rdclass = dns_rdataclass_in;
|
||||
}
|
||||
lookup = make_empty_lookup();
|
||||
if (get_reverse(store, sizeof(store), opt, true)
|
||||
== ISC_R_SUCCESS) {
|
||||
if (get_reverse(store, sizeof(store), opt, true) == ISC_R_SUCCESS) {
|
||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||
lookup->rdtype = dns_rdatatype_ptr;
|
||||
lookup->rdtypeset = true;
|
||||
@@ -796,18 +788,20 @@ addlookup(char *opt) {
|
||||
lookup->retries = tries;
|
||||
lookup->udpsize = 0;
|
||||
lookup->comments = comments;
|
||||
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
|
||||
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set) {
|
||||
lookup->tcp_mode = true;
|
||||
else
|
||||
} else {
|
||||
lookup->tcp_mode = tcpmode;
|
||||
}
|
||||
lookup->stats = stats;
|
||||
lookup->section_question = section_question;
|
||||
lookup->section_answer = section_answer;
|
||||
lookup->section_authority = section_authority;
|
||||
lookup->section_additional = section_additional;
|
||||
lookup->new_search = true;
|
||||
if (nofail)
|
||||
if (nofail) {
|
||||
lookup->servfail_stops = false;
|
||||
}
|
||||
ISC_LIST_INIT(lookup->q);
|
||||
ISC_LINK_INIT(lookup, link);
|
||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||
@@ -824,11 +818,11 @@ do_next_command(char *input) {
|
||||
return;
|
||||
}
|
||||
arg = strtok_r(NULL, " \t\r\n", &last);
|
||||
if ((strcasecmp(ptr, "set") == 0) &&
|
||||
(arg != NULL))
|
||||
if ((strcasecmp(ptr, "set") == 0) && (arg != NULL)) {
|
||||
setoption(arg);
|
||||
else if ((strcasecmp(ptr, "server") == 0) ||
|
||||
(strcasecmp(ptr, "lserver") == 0)) {
|
||||
} else if ((strcasecmp(ptr, "server") == 0) ||
|
||||
(strcasecmp(ptr, "lserver") == 0))
|
||||
{
|
||||
isc_app_block();
|
||||
set_nameserver(arg);
|
||||
check_ra = false;
|
||||
@@ -836,16 +830,16 @@ do_next_command(char *input) {
|
||||
show_settings(true, true);
|
||||
} else if (strcasecmp(ptr, "exit") == 0) {
|
||||
in_use = false;
|
||||
} else if (strcasecmp(ptr, "help") == 0 ||
|
||||
strcasecmp(ptr, "?") == 0) {
|
||||
} else if (strcasecmp(ptr, "help") == 0 || strcasecmp(ptr, "?") == 0) {
|
||||
printf("The '%s' command is not yet implemented.\n", ptr);
|
||||
} else if (strcasecmp(ptr, "finger") == 0 ||
|
||||
strcasecmp(ptr, "root") == 0 ||
|
||||
strcasecmp(ptr, "ls") == 0 ||
|
||||
strcasecmp(ptr, "view") == 0) {
|
||||
strcasecmp(ptr, "root") == 0 || strcasecmp(ptr, "ls") == 0 ||
|
||||
strcasecmp(ptr, "view") == 0)
|
||||
{
|
||||
printf("The '%s' command is not implemented.\n", ptr);
|
||||
} else
|
||||
} else {
|
||||
addlookup(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -859,24 +853,28 @@ get_next_command(void) {
|
||||
if (interactive) {
|
||||
#ifdef HAVE_READLINE
|
||||
ptr = readline("> ");
|
||||
if (ptr != NULL)
|
||||
if (ptr != NULL) {
|
||||
add_history(ptr);
|
||||
#else
|
||||
}
|
||||
#else /* ifdef HAVE_READLINE */
|
||||
fputs("> ", stderr);
|
||||
fflush(stderr);
|
||||
ptr = fgets(buf, COMMSIZE, stdin);
|
||||
#endif
|
||||
} else
|
||||
#endif /* ifdef HAVE_READLINE */
|
||||
} else {
|
||||
ptr = fgets(buf, COMMSIZE, stdin);
|
||||
}
|
||||
isc_app_unblock();
|
||||
if (ptr == NULL) {
|
||||
in_use = false;
|
||||
} else
|
||||
} else {
|
||||
do_next_command(ptr);
|
||||
}
|
||||
#ifdef HAVE_READLINE
|
||||
if (interactive)
|
||||
if (interactive) {
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
#endif /* ifdef HAVE_READLINE */
|
||||
isc_mem_free(mctx, buf);
|
||||
}
|
||||
|
||||
@@ -885,16 +883,16 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] # interactive mode using default server\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] - server # interactive mode using 'server'\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] host # just look up 'host' using default server\n");
|
||||
fprintf(stderr,
|
||||
" nslookup [-opt ...] host server # just look up 'host' using 'server'\n");
|
||||
exit(1);
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] # interactive mode "
|
||||
"using default server\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] - server # interactive mode "
|
||||
"using 'server'\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] host # just look up "
|
||||
"'host' using default server\n");
|
||||
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
|
||||
"'host' using 'server'\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -910,8 +908,9 @@ parse_args(int argc, char **argv) {
|
||||
exit(0);
|
||||
} else if (argv[0][1] != 0) {
|
||||
setoption(&argv[0][1]);
|
||||
} else
|
||||
} else {
|
||||
have_lookup = true;
|
||||
}
|
||||
} else {
|
||||
if (!have_lookup) {
|
||||
have_lookup = true;
|
||||
@@ -957,10 +956,10 @@ flush_lookup_list(void) {
|
||||
s = ISC_LIST_NEXT(s, link);
|
||||
ISC_LIST_DEQUEUE(l->my_server_list, sp, link);
|
||||
isc_mem_free(mctx, sp);
|
||||
|
||||
}
|
||||
if (l->sendmsg != NULL)
|
||||
if (l->sendmsg != NULL) {
|
||||
dns_message_destroy(&l->sendmsg);
|
||||
}
|
||||
lp = l;
|
||||
l = ISC_LIST_NEXT(l, link);
|
||||
ISC_LIST_DEQUEUE(lookup_list, lp, link);
|
||||
@@ -971,8 +970,9 @@ flush_lookup_list(void) {
|
||||
static void
|
||||
getinput(isc_task_t *task, isc_event_t *event) {
|
||||
UNUSED(task);
|
||||
if (global_event == NULL)
|
||||
if (global_event == NULL) {
|
||||
global_event = event;
|
||||
}
|
||||
while (in_use) {
|
||||
get_next_command();
|
||||
if (ISC_LIST_HEAD(lookup_list) != NULL) {
|
||||
@@ -1009,17 +1009,19 @@ main(int argc, char **argv) {
|
||||
|
||||
setup_system(false, false);
|
||||
parse_args(argc, argv);
|
||||
if (keyfile[0] != 0)
|
||||
if (keyfile[0] != 0) {
|
||||
setup_file_key();
|
||||
else if (keysecret[0] != 0)
|
||||
} else if (keysecret[0] != 0) {
|
||||
setup_text_key();
|
||||
if (domainopt[0] != '\0')
|
||||
}
|
||||
if (domainopt[0] != '\0') {
|
||||
set_search_domain(domainopt);
|
||||
if (in_use)
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback,
|
||||
NULL);
|
||||
else
|
||||
}
|
||||
if (in_use) {
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
|
||||
} else {
|
||||
result = isc_app_onrun(mctx, global_task, getinput, NULL);
|
||||
}
|
||||
check_result(result, "isc_app_onrun");
|
||||
in_use = !in_use;
|
||||
|
||||
@@ -1027,8 +1029,9 @@ main(int argc, char **argv) {
|
||||
|
||||
puts("");
|
||||
debug("done, and starting to shut down");
|
||||
if (global_event != NULL)
|
||||
if (global_event != NULL) {
|
||||
isc_event_free(&global_event);
|
||||
}
|
||||
cancel_all();
|
||||
destroy_libs();
|
||||
isc_app_finish();
|
||||
|
||||
+29
-22
@@ -72,6 +72,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@@ -307,7 +308,7 @@ nslookup -query=hinfo -timeout=10
|
||||
The class specifies the protocol group of the information.
|
||||
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = IN; abbreviation = cl)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -317,10 +318,10 @@ nslookup -query=hinfo -timeout=10
|
||||
<term><constant><replaceable><optional>no</optional></replaceable>debug</constant></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = nodebug; abbreviation = <optional>no</optional>deb)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -331,9 +332,9 @@ nslookup -query=hinfo -timeout=10
|
||||
<listitem>
|
||||
<para>
|
||||
Turn debugging mode on or off. This displays more about
|
||||
what nslookup is doing.
|
||||
what nslookup is doing.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = nod2)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -357,7 +358,7 @@ nslookup -query=hinfo -timeout=10
|
||||
names in the domain search list to the request until an
|
||||
answer is received.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = search)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -369,7 +370,7 @@ nslookup -query=hinfo -timeout=10
|
||||
<para>
|
||||
Change the default TCP/UDP name server port to <replaceable>value</replaceable>.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = 53; abbreviation = po)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -388,9 +389,15 @@ nslookup -query=hinfo -timeout=10
|
||||
<para>
|
||||
Change the type of the information query.
|
||||
</para>
|
||||
<para>
|
||||
(Default = A; abbreviations = q, ty)
|
||||
<para>
|
||||
(Default = A and then AAAA; abbreviations = q, ty)
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">Note:</emphasis> It is
|
||||
only possible to specify one query type, only
|
||||
the default behavior looks up both when an
|
||||
alternative is not specified.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -402,7 +409,7 @@ nslookup -query=hinfo -timeout=10
|
||||
have the
|
||||
information.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = recurse; abbreviation = [no]rec)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -412,9 +419,9 @@ nslookup -query=hinfo -timeout=10
|
||||
<term><constant>ndots=</constant><replaceable>number</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -445,7 +452,7 @@ nslookup -query=hinfo -timeout=10
|
||||
Always use a virtual circuit when sending requests to the
|
||||
server.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
(Default = novc)
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -455,15 +462,15 @@ nslookup -query=hinfo -timeout=10
|
||||
<term><constant><replaceable><optional>no</optional></replaceable>fail</constant></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</para>
|
||||
<para>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</para>
|
||||
<para>
|
||||
(Default = nofail)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
+28
-22
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2004-2007, 2010, 2013-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
@@ -229,17 +229,17 @@ nslookup -query=hinfo -timeout=10
|
||||
The class specifies the protocol group of the information.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = IN; abbreviation = cl)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>debug</code></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
Turn on or off the display of the full response packet and
|
||||
any intermediate response packets when searching.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = nodebug; abbreviation = [<span class="optional">no</span>]deb)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -247,9 +247,9 @@ nslookup -query=hinfo -timeout=10
|
||||
<dd>
|
||||
<p>
|
||||
Turn debugging mode on or off. This displays more about
|
||||
what nslookup is doing.
|
||||
what nslookup is doing.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = nod2)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -267,7 +267,7 @@ nslookup -query=hinfo -timeout=10
|
||||
names in the domain search list to the request until an
|
||||
answer is received.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = search)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -276,7 +276,7 @@ nslookup -query=hinfo -timeout=10
|
||||
<p>
|
||||
Change the default TCP/UDP name server port to <em class="replaceable"><code>value</code></em>.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = 53; abbreviation = po)
|
||||
</p>
|
||||
</dd>
|
||||
@@ -289,9 +289,15 @@ nslookup -query=hinfo -timeout=10
|
||||
<p>
|
||||
Change the type of the information query.
|
||||
</p>
|
||||
<p>
|
||||
(Default = A; abbreviations = q, ty)
|
||||
<p>
|
||||
(Default = A and then AAAA; abbreviations = q, ty)
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Note:</strong></span> It is
|
||||
only possible to specify one query type, only
|
||||
the default behavior looks up both when an
|
||||
alternative is not specified.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>recurse</code></span></dt>
|
||||
<dd>
|
||||
@@ -300,16 +306,16 @@ nslookup -query=hinfo -timeout=10
|
||||
have the
|
||||
information.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = recurse; abbreviation = [no]rec)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant">ndots=</code><em class="replaceable"><code>number</code></em></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
Set the number of dots (label separators) in a domain
|
||||
that will disable searching. Absolute names always
|
||||
stop searching.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant">retry=</code><em class="replaceable"><code>number</code></em></span></dt>
|
||||
@@ -331,21 +337,21 @@ nslookup -query=hinfo -timeout=10
|
||||
Always use a virtual circuit when sending requests to the
|
||||
server.
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
(Default = novc)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>fail</code></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</p>
|
||||
<p>
|
||||
Try the next nameserver if a nameserver responds with
|
||||
SERVFAIL or a referral (nofail) or terminate query
|
||||
(fail) on such a response.
|
||||
</p>
|
||||
<p>
|
||||
(Default = nofail)
|
||||
</p>
|
||||
</dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -60,7 +60,7 @@ file generated by
|
||||
.PP
|
||||
The
|
||||
\fBdnssec\-cds\fR
|
||||
command uses special DNSSEC validation logic specified by RFC 7344\&. It requires that the CDS and/or CDNSKEY records are validly signed by a key represented in the existing DS records\&. This will typicially be the pre\-existing key\-signing key (KSK)\&.
|
||||
command uses special DNSSEC validation logic specified by RFC 7344\&. It requires that the CDS and/or CDNSKEY records are validly signed by a key represented in the existing DS records\&. This will typically be the pre\-existing key\-signing key (KSK)\&.
|
||||
.PP
|
||||
For protection against replay attacks, the signatures on the child records must not be older than they were on a previous run of
|
||||
\fBdnssec\-cds\fR\&. This time is obtained from the modification time of the
|
||||
@@ -293,5 +293,5 @@ RFC 7344\&.
|
||||
.RE
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+117
-137
@@ -55,7 +55,7 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -75,9 +75,9 @@ static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static dns_rdataclass_t rdclass = dns_rdataclass_in;
|
||||
|
||||
static const char *startstr = NULL; /* from which we derive notbefore */
|
||||
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
||||
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
|
||||
static const char *startstr = NULL; /* from which we derive notbefore */
|
||||
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
||||
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
|
||||
|
||||
static int nkey; /* number of child zone DNSKEY records */
|
||||
|
||||
@@ -131,7 +131,7 @@ static dns_rdataset_t old_ds_set, new_ds_set;
|
||||
|
||||
static keyinfo_t *old_key_tbl, *new_key_tbl;
|
||||
|
||||
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
|
||||
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
|
||||
|
||||
static void
|
||||
verbose_time(int level, const char *msg, isc_stdtime_t time) {
|
||||
@@ -150,8 +150,7 @@ verbose_time(int level, const char *msg, isc_stdtime_t time) {
|
||||
if (verbose < 3) {
|
||||
vbprintf(level, "%s %s\n", msg, timestr);
|
||||
} else {
|
||||
vbprintf(level, "%s %s (%" PRIu32 ")\n",
|
||||
msg, timestr, time);
|
||||
vbprintf(level, "%s %s (%" PRIu32 ")\n", msg, timestr, time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,16 +172,15 @@ initname(char *setname) {
|
||||
|
||||
static void
|
||||
findset(dns_db_t *db, dns_dbnode_t *node, dns_rdatatype_t type,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
|
||||
isc_result_t result;
|
||||
|
||||
dns_rdataset_init(rdataset);
|
||||
if (sigrdataset != NULL) {
|
||||
dns_rdataset_init(sigrdataset);
|
||||
}
|
||||
result = dns_db_findrdataset(db, node, NULL, type, 0, 0,
|
||||
rdataset, sigrdataset);
|
||||
result = dns_db_findrdataset(db, node, NULL, type, 0, 0, rdataset,
|
||||
sigrdataset);
|
||||
if (result != ISC_R_NOTFOUND) {
|
||||
check_result(result, "dns_db_findrdataset()");
|
||||
}
|
||||
@@ -206,8 +204,7 @@ freelist(dns_rdataset_t *rdataset) {
|
||||
|
||||
dns_rdatalist_fromrdataset(rdataset, &rdlist);
|
||||
|
||||
for (rdata = ISC_LIST_HEAD(rdlist->rdata);
|
||||
rdata != NULL;
|
||||
for (rdata = ISC_LIST_HEAD(rdlist->rdata); rdata != NULL;
|
||||
rdata = ISC_LIST_HEAD(rdlist->rdata))
|
||||
{
|
||||
ISC_LIST_UNLINK(rdlist->rdata, rdata, link);
|
||||
@@ -236,15 +233,14 @@ static void
|
||||
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
|
||||
isc_result_t result;
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, dbp);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, dbp);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_load(*dbp, filename,
|
||||
dns_masterformat_text, DNS_MASTER_HINT);
|
||||
result = dns_db_load(*dbp, filename, dns_masterformat_text,
|
||||
DNS_MASTER_HINT);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
fatal("can't load %s: %s", filename, isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_findnode(*dbp, name, false, nodep);
|
||||
@@ -272,9 +268,8 @@ load_child_sets(const char *file) {
|
||||
}
|
||||
|
||||
static void
|
||||
get_dsset_name(char *filename, size_t size,
|
||||
const char *path, const char *suffix)
|
||||
{
|
||||
get_dsset_name(char *filename, size_t size, const char *path,
|
||||
const char *suffix) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t buf;
|
||||
size_t len;
|
||||
@@ -318,7 +313,7 @@ get_dsset_name(char *filename, size_t size,
|
||||
static void
|
||||
load_parent_set(const char *path) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_time_t modtime;
|
||||
char filename[PATH_MAX + 1];
|
||||
@@ -327,8 +322,8 @@ load_parent_set(const char *path) {
|
||||
|
||||
result = isc_file_getmodtime(filename, &modtime);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not get modification time of %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
fatal("could not get modification time of %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
notbefore = isc_time_seconds(&modtime);
|
||||
if (startstr != NULL) {
|
||||
@@ -342,8 +337,8 @@ load_parent_set(const char *path) {
|
||||
findset(db, node, dns_rdatatype_ds, &old_ds_set, NULL);
|
||||
|
||||
if (!dns_rdataset_isassociated(&old_ds_set)) {
|
||||
fatal("could not find DS records for %s in %s",
|
||||
namestr, filename);
|
||||
fatal("could not find DS records for %s in %s", namestr,
|
||||
filename);
|
||||
}
|
||||
|
||||
free_db(&db, &node);
|
||||
@@ -365,13 +360,11 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
* which just separates fields with spaces. The huge tab stop width
|
||||
* eliminates any tab characters.
|
||||
*/
|
||||
result = dns_master_stylecreate(&style, styleflags,
|
||||
0, 0, 0, 0, 0, 1000000, 0,
|
||||
mctx);
|
||||
result = dns_master_stylecreate(&style, styleflags, 0, 0, 0, 0, 0,
|
||||
1000000, 0, mctx);
|
||||
check_result(result, "dns_master_stylecreate2 failed");
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
check_result(result, "printing DS records");
|
||||
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
|
||||
|
||||
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
|
||||
@@ -388,9 +381,8 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
static void
|
||||
write_parent_set(const char *path, const char *inplace,
|
||||
bool nsupdate, dns_rdataset_t *rdataset)
|
||||
{
|
||||
write_parent_set(const char *path, const char *inplace, bool nsupdate,
|
||||
dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t *buf = NULL;
|
||||
isc_region_t r;
|
||||
@@ -441,8 +433,8 @@ write_parent_set(const char *path, const char *inplace,
|
||||
result = isc_file_settime(tmpname, &filetime);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_file_remove(tmpname);
|
||||
fatal("can't set modification time of %s: %s",
|
||||
tmpname, isc_result_totext(result));
|
||||
fatal("can't set modification time of %s: %s", tmpname,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (inplace[0] != '\0') {
|
||||
@@ -457,13 +449,11 @@ typedef enum { LOOSE, TIGHT } strictness_t;
|
||||
* Find out if any (C)DS record matches a particular (C)DNSKEY.
|
||||
*/
|
||||
static bool
|
||||
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||
{
|
||||
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
|
||||
isc_result_t result;
|
||||
unsigned char dsbuf[DNS_DS_BUFFERSIZE];
|
||||
|
||||
for (result = dns_rdataset_first(dsset);
|
||||
result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset))
|
||||
{
|
||||
dns_rdata_ds_t ds;
|
||||
@@ -482,7 +472,8 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||
result = dns_ds_buildrdata(name, &ki->rdata, ds.digest_type,
|
||||
dsbuf, &newdsrdata);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
vbprintf(3, "dns_ds_buildrdata("
|
||||
vbprintf(3,
|
||||
"dns_ds_buildrdata("
|
||||
"keytag=%d, algo=%d, digest=%d): %s\n",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type,
|
||||
dns_result_totext(result));
|
||||
@@ -493,23 +484,22 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||
dsrdata.type = dns_rdatatype_ds;
|
||||
if (dns_rdata_compare(&dsrdata, &newdsrdata) == 0) {
|
||||
vbprintf(1, "found matching %s %d %d %d\n",
|
||||
c ? "CDS" : "DS",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
|
||||
ds.digest_type);
|
||||
return (true);
|
||||
} else if (strictness == TIGHT) {
|
||||
vbprintf(0, "key does not match %s %d %d %d "
|
||||
"when it looks like it should\n",
|
||||
c ? "CDS" : "DS",
|
||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||
vbprintf(0,
|
||||
"key does not match %s %d %d %d "
|
||||
"when it looks like it should\n",
|
||||
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
|
||||
ds.digest_type);
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
vbprintf(1, "no matching %s for %s %d %d\n",
|
||||
dsset->type == dns_rdatatype_cds
|
||||
? "CDS" : "DS",
|
||||
ki->rdata.type == dns_rdatatype_cdnskey
|
||||
? "CDNSKEY" : "DNSKEY",
|
||||
dsset->type == dns_rdatatype_cds ? "CDS" : "DS",
|
||||
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
|
||||
ki->tag, ki->algo);
|
||||
|
||||
return (false);
|
||||
@@ -521,8 +511,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||
*/
|
||||
static keyinfo_t *
|
||||
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
strictness_t strictness)
|
||||
{
|
||||
strictness_t strictness) {
|
||||
isc_result_t result;
|
||||
keyinfo_t *keytable;
|
||||
int i;
|
||||
@@ -532,8 +521,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
|
||||
|
||||
for (result = dns_rdataset_first(keyset), i = 0;
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(keyset), i++)
|
||||
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
|
||||
{
|
||||
keyinfo_t *ki;
|
||||
dns_rdata_dnskey_t dnskey;
|
||||
@@ -559,13 +547,13 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
continue;
|
||||
}
|
||||
|
||||
result = dns_dnssec_keyfromrdata(name, keyrdata,
|
||||
mctx, &ki->dst);
|
||||
result = dns_dnssec_keyfromrdata(name, keyrdata, mctx,
|
||||
&ki->dst);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
vbprintf(3, "dns_dnssec_keyfromrdata("
|
||||
vbprintf(3,
|
||||
"dns_dnssec_keyfromrdata("
|
||||
"keytag=%d, algo=%d): %s\n",
|
||||
ki->tag, ki->algo,
|
||||
dns_result_totext(result));
|
||||
ki->tag, ki->algo, dns_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,6 +563,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
||||
static void
|
||||
free_keytable(keyinfo_t **keytable_p) {
|
||||
keyinfo_t *keytable = *keytable_p;
|
||||
*keytable_p = NULL;
|
||||
keyinfo_t *ki;
|
||||
int i;
|
||||
|
||||
@@ -586,7 +575,6 @@ free_keytable(keyinfo_t **keytable_p) {
|
||||
}
|
||||
|
||||
isc_mem_put(mctx, keytable, sizeof(keyinfo_t) * nkey);
|
||||
*keytable_p = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -600,8 +588,7 @@ free_keytable(keyinfo_t **keytable_p) {
|
||||
*/
|
||||
static dns_secalg_t *
|
||||
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
dns_rdataset_t *sigset)
|
||||
{
|
||||
dns_rdataset_t *sigset) {
|
||||
isc_result_t result;
|
||||
dns_secalg_t *algo;
|
||||
int i;
|
||||
@@ -609,8 +596,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
algo = isc_mem_get(mctx, nkey);
|
||||
memset(algo, 0, nkey);
|
||||
|
||||
for (result = dns_rdataset_first(sigset);
|
||||
result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(sigset))
|
||||
{
|
||||
dns_rdata_t sigrdata = DNS_RDATA_INIT;
|
||||
@@ -631,26 +617,27 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
|
||||
for (i = 0; i < nkey; i++) {
|
||||
keyinfo_t *ki = &keytbl[i];
|
||||
if (sig.keyid != ki->tag ||
|
||||
sig.algorithm != ki->algo ||
|
||||
if (sig.keyid != ki->tag || sig.algorithm != ki->algo ||
|
||||
!dns_name_equal(&sig.signer, name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (ki->dst == NULL) {
|
||||
vbprintf(1, "skip RRSIG by key %d:"
|
||||
vbprintf(1,
|
||||
"skip RRSIG by key %d:"
|
||||
" no matching (C)DS\n",
|
||||
sig.keyid);
|
||||
continue;
|
||||
}
|
||||
|
||||
result = dns_dnssec_verify(name, rdataset, ki->dst,
|
||||
false, 0, mctx,
|
||||
&sigrdata, NULL);
|
||||
false, 0, mctx, &sigrdata,
|
||||
NULL);
|
||||
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
result != DNS_R_FROMWILDCARD) {
|
||||
vbprintf(1, "skip RRSIG by key %d:"
|
||||
vbprintf(1,
|
||||
"skip RRSIG by key %d:"
|
||||
" verification failed: %s\n",
|
||||
sig.keyid, isc_result_totext(result));
|
||||
continue;
|
||||
@@ -664,8 +651,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||
* only after the signature has been verified
|
||||
*/
|
||||
if (oldestsig.timesigned == 0 ||
|
||||
isc_serial_lt(sig.timesigned,
|
||||
oldestsig.timesigned))
|
||||
isc_serial_lt(sig.timesigned, oldestsig.timesigned))
|
||||
{
|
||||
verbose_time(2, "this is the oldest so far",
|
||||
sig.timesigned);
|
||||
@@ -705,8 +691,7 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
|
||||
isc_result_t result;
|
||||
bool all_ok = true;
|
||||
|
||||
for (result = dns_rdataset_first(dsset);
|
||||
result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset))
|
||||
{
|
||||
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
||||
@@ -725,8 +710,10 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
|
||||
}
|
||||
}
|
||||
if (!ds_ok) {
|
||||
vbprintf(0, "missing signature for algorithm %d "
|
||||
"(key %d)\n", ds.algorithm, ds.key_tag);
|
||||
vbprintf(0,
|
||||
"missing signature for algorithm %d "
|
||||
"(key %d)\n",
|
||||
ds.algorithm, ds.key_tag);
|
||||
all_ok = false;
|
||||
}
|
||||
}
|
||||
@@ -773,20 +760,19 @@ ds_from_cds(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *cds) {
|
||||
check_result(result, "dns_rdata_tostruct(CDS)");
|
||||
ds.common.rdtype = dns_rdatatype_ds;
|
||||
|
||||
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds,
|
||||
&ds, buf);
|
||||
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds, &ds,
|
||||
buf);
|
||||
|
||||
return (rdata_put(result, dslist, rdata));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
||||
dns_rdata_t *cdnskey)
|
||||
{
|
||||
dns_rdata_t *cdnskey) {
|
||||
isc_result_t result;
|
||||
unsigned i, n;
|
||||
|
||||
n = sizeof(dtype)/sizeof(dtype[0]);
|
||||
n = sizeof(dtype) / sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] != 0) {
|
||||
dns_rdata_t *rdata;
|
||||
@@ -815,9 +801,8 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
||||
}
|
||||
|
||||
static void
|
||||
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
||||
uint32_t ttl, dns_rdataset_t *rdset)
|
||||
{
|
||||
make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
|
||||
dns_rdataset_t *rdset) {
|
||||
unsigned int size = 16;
|
||||
for (;;) {
|
||||
isc_result_t result;
|
||||
@@ -834,12 +819,10 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
||||
result = dns_rdatalist_tordataset(dslist, &new_ds_set);
|
||||
check_result(result, "dns_rdatalist_tordataset(dslist)");
|
||||
|
||||
result = isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
check_result(result, "building new DS records");
|
||||
isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
|
||||
for (result = dns_rdataset_first(rdset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdset))
|
||||
result == ISC_R_SUCCESS; result = dns_rdataset_next(rdset))
|
||||
{
|
||||
isc_result_t tresult;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
@@ -893,8 +876,7 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
|
||||
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
||||
|
||||
for (result = dns_rdataset_first(dsset), i = 0;
|
||||
result == ISC_R_SUCCESS;
|
||||
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(dsset), i++)
|
||||
{
|
||||
dns_rdata_init(&arrdata[i]);
|
||||
@@ -931,10 +913,10 @@ consistent_digests(dns_rdataset_t *dsset) {
|
||||
while (i < n) {
|
||||
key_tag = ds[i].key_tag;
|
||||
algorithm = ds[i].algorithm;
|
||||
for (j = 0; j < d && i+j < n; j++) {
|
||||
if (ds[i+j].key_tag != key_tag ||
|
||||
ds[i+j].algorithm != algorithm ||
|
||||
ds[i+j].digest_type != ds[j].digest_type)
|
||||
for (j = 0; j < d && i + j < n; j++) {
|
||||
if (ds[i + j].key_tag != key_tag ||
|
||||
ds[i + j].algorithm != algorithm ||
|
||||
ds[i + j].digest_type != ds[j].digest_type)
|
||||
{
|
||||
match = false;
|
||||
}
|
||||
@@ -971,9 +953,8 @@ print_diff(const char *cmd, dns_rdataset_t *rdataset) {
|
||||
}
|
||||
|
||||
static void
|
||||
update_diff(const char *cmd, uint32_t ttl,
|
||||
dns_rdataset_t *addset, dns_rdataset_t *delset)
|
||||
{
|
||||
update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
|
||||
dns_rdataset_t *delset) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db;
|
||||
dns_dbnode_t *node;
|
||||
@@ -982,8 +963,8 @@ update_diff(const char *cmd, uint32_t ttl,
|
||||
uint32_t save;
|
||||
|
||||
db = NULL;
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
ver = NULL;
|
||||
@@ -996,12 +977,11 @@ update_diff(const char *cmd, uint32_t ttl,
|
||||
|
||||
dns_rdataset_init(&diffset);
|
||||
|
||||
result = dns_db_addrdataset(db, node, ver, 0, addset,
|
||||
DNS_DBADD_MERGE, NULL);
|
||||
result = dns_db_addrdataset(db, node, ver, 0, addset, DNS_DBADD_MERGE,
|
||||
NULL);
|
||||
check_result(result, "dns_db_addrdataset()");
|
||||
|
||||
result = dns_db_subtractrdataset(db, node, ver, delset,
|
||||
0, &diffset);
|
||||
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
|
||||
if (result == DNS_R_UNCHANGED) {
|
||||
save = addset->ttl;
|
||||
addset->ttl = ttl;
|
||||
@@ -1047,18 +1027,22 @@ usage(void) {
|
||||
program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n"
|
||||
" -a <algorithm> digest algorithm (SHA-1 / SHA-256 / SHA-384)\n"
|
||||
" -c <class> of domain (default IN)\n"
|
||||
" -D prefer CDNSKEY records instead of CDS\n"
|
||||
" -d <file|dir> where to find parent dsset- file\n"
|
||||
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG records\n"
|
||||
" -i[extension] update dsset- file in place\n"
|
||||
" -s <start-time> oldest permitted child signatures\n"
|
||||
" -u emit nsupdate script\n"
|
||||
" -T <ttl> TTL of DS records\n"
|
||||
" -V print version\n"
|
||||
" -v <verbosity>\n"
|
||||
);
|
||||
" -a <algorithm> digest algorithm (SHA-1 / "
|
||||
"SHA-256 / SHA-384)\n"
|
||||
" -c <class> of domain (default IN)\n"
|
||||
" -D prefer CDNSKEY records instead "
|
||||
"of CDS\n"
|
||||
" -d <file|dir> where to find parent dsset- "
|
||||
"file\n"
|
||||
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG "
|
||||
"records\n"
|
||||
" -i[extension] update dsset- file in place\n"
|
||||
" -s <start-time> oldest permitted child "
|
||||
"signatures\n"
|
||||
" -u emit nsupdate script\n"
|
||||
" -T <ttl> TTL of DS records\n"
|
||||
" -V print version\n"
|
||||
" -v <verbosity>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1078,7 +1062,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -1107,8 +1091,7 @@ main(int argc, char *argv[]) {
|
||||
* so that it works just like sed(1).
|
||||
*/
|
||||
if (isc_commandline_argument ==
|
||||
argv[isc_commandline_index - 1])
|
||||
{
|
||||
argv[isc_commandline_index - 1]) {
|
||||
isc_commandline_index--;
|
||||
inplace = "";
|
||||
} else {
|
||||
@@ -1117,7 +1100,7 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
case 'm':
|
||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||
ISC_MEM_DEBUGRECORD;
|
||||
ISC_MEM_DEBUGRECORD;
|
||||
break;
|
||||
case 's':
|
||||
startstr = isc_commandline_argument;
|
||||
@@ -1200,8 +1183,7 @@ main(int argc, char *argv[]) {
|
||||
fatal("missing RRSIG CDNSKEY records for %s", namestr);
|
||||
}
|
||||
if (dns_rdataset_isassociated(&cds_set) &&
|
||||
!dns_rdataset_isassociated(&cds_sig))
|
||||
{
|
||||
!dns_rdataset_isassociated(&cds_sig)) {
|
||||
fatal("missing RRSIG CDS records for %s", namestr);
|
||||
}
|
||||
|
||||
@@ -1222,18 +1204,16 @@ main(int argc, char *argv[]) {
|
||||
|
||||
if (dns_rdataset_isassociated(&cdnskey_set)) {
|
||||
vbprintf(1, "verify CDNSKEY signature(s)\n");
|
||||
if (!signed_loose(matching_sigs(old_key_tbl,
|
||||
&cdnskey_set, &cdnskey_sig)))
|
||||
{
|
||||
if (!signed_loose(matching_sigs(old_key_tbl, &cdnskey_set,
|
||||
&cdnskey_sig))) {
|
||||
fatal("could not validate child CDNSKEY RRset for %s",
|
||||
namestr);
|
||||
}
|
||||
}
|
||||
if (dns_rdataset_isassociated(&cds_set)) {
|
||||
vbprintf(1, "verify CDS signature(s)\n");
|
||||
if (!signed_loose(matching_sigs(old_key_tbl,
|
||||
&cds_set, &cds_sig)))
|
||||
{
|
||||
if (!signed_loose(
|
||||
matching_sigs(old_key_tbl, &cds_set, &cds_sig))) {
|
||||
fatal("could not validate child CDS RRset for %s",
|
||||
namestr);
|
||||
}
|
||||
@@ -1250,12 +1230,11 @@ main(int argc, char *argv[]) {
|
||||
dns_rdatatype_format(oldestsig.covered, type, sizeof(type));
|
||||
verbose_time(1, "child signature inception time",
|
||||
oldestsig.timesigned);
|
||||
vbprintf(2, "from RRSIG %s by key %d\n",
|
||||
type, oldestsig.keyid);
|
||||
vbprintf(2, "from RRSIG %s by key %d\n", type, oldestsig.keyid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sucessfully do nothing if there's neither CDNSKEY nor CDS
|
||||
* Successfully do nothing if there's neither CDNSKEY nor CDS
|
||||
* RFC 7344 section 4.1 first paragraph
|
||||
*/
|
||||
if (!dns_rdataset_isassociated(&cdnskey_set) &&
|
||||
@@ -1288,16 +1267,17 @@ main(int argc, char *argv[]) {
|
||||
|
||||
if (!consistent_digests(&new_ds_set)) {
|
||||
fatal("CDS records at %s do not cover each key "
|
||||
"with the same set of digest types", namestr);
|
||||
"with the same set of digest types",
|
||||
namestr);
|
||||
}
|
||||
|
||||
vbprintf(1, "verify DNSKEY signature(s)\n");
|
||||
if (!signed_strict(&new_ds_set,
|
||||
matching_sigs(new_key_tbl,
|
||||
&dnskey_set, &dnskey_sig)))
|
||||
if (!signed_strict(&new_ds_set, matching_sigs(new_key_tbl, &dnskey_set,
|
||||
&dnskey_sig)))
|
||||
{
|
||||
fatal("could not validate child DNSKEY RRset "
|
||||
"with new DS records for %s", namestr);
|
||||
"with new DS records for %s",
|
||||
namestr);
|
||||
}
|
||||
|
||||
free_keytable(&new_key_tbl);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@@ -92,7 +93,7 @@
|
||||
The <command>dnssec-cds</command> command uses special DNSSEC
|
||||
validation logic specified by RFC 7344. It requires that the CDS
|
||||
and/or CDNSKEY records are validly signed by a key represented in the
|
||||
existing DS records. This will typicially be the pre-existing
|
||||
existing DS records. This will typically be the pre-existing
|
||||
key-signing key (KSK).
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
@@ -78,7 +78,7 @@
|
||||
The <span class="command"><strong>dnssec-cds</strong></span> command uses special DNSSEC
|
||||
validation logic specified by RFC 7344. It requires that the CDS
|
||||
and/or CDNSKEY records are validly signed by a key represented in the
|
||||
existing DS records. This will typicially be the pre-existing
|
||||
existing DS records. This will typically be the pre-existing
|
||||
key-signing key (KSK).
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2008-2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -222,5 +222,5 @@ RFC 7344
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2008-2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+126
-96
@@ -43,18 +43,18 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-dsfromkey";
|
||||
|
||||
static dns_rdataclass_t rdclass;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static uint32_t ttl;
|
||||
static bool emitttl = false;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static uint32_t ttl;
|
||||
static bool emitttl = false;
|
||||
|
||||
static isc_result_t
|
||||
initname(char *setname) {
|
||||
@@ -76,88 +76,101 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
|
||||
|
||||
dns_rdatacallbacks_init(&callbacks);
|
||||
result = dns_db_beginload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0,
|
||||
&callbacks, mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
|
||||
mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't load from input: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_endload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_endload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
char setname[DNS_NAME_FORMATSIZE];
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't create database");
|
||||
}
|
||||
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
db_load_from_stream(db, stdin);
|
||||
filename = "input";
|
||||
} else {
|
||||
result = dns_db_load(db, filename, dns_masterformat_text, 0);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_db_findnode(db, name, false, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't find %s node in %s", setname, filename);
|
||||
}
|
||||
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
|
||||
0, 0, rdataset, NULL);
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
|
||||
rdataset, NULL);
|
||||
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
fatal("no DNSKEY RR for %s in %s", setname, filename);
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_findrdataset");
|
||||
}
|
||||
|
||||
if (node != NULL)
|
||||
if (node != NULL) {
|
||||
dns_db_detachnode(db, &node);
|
||||
if (db != NULL)
|
||||
}
|
||||
if (db != NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
char filename[PATH_MAX + 1];
|
||||
isc_buffer_t buf;
|
||||
isc_result_t result;
|
||||
char filename[PATH_MAX + 1];
|
||||
isc_buffer_t buf;
|
||||
|
||||
dns_rdataset_init(rdataset);
|
||||
|
||||
isc_buffer_init(&buf, filename, sizeof(filename));
|
||||
if (dirname != NULL) {
|
||||
/* allow room for a trailing slash */
|
||||
if (strlen(dirname) >= isc_buffer_availablelength(&buf))
|
||||
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putstr(&buf, dirname);
|
||||
if (dirname[strlen(dirname) - 1] != '/')
|
||||
if (dirname[strlen(dirname) - 1] != '/') {
|
||||
isc_buffer_putstr(&buf, "/");
|
||||
}
|
||||
}
|
||||
|
||||
if (isc_buffer_availablelength(&buf) < 7)
|
||||
if (isc_buffer_availablelength(&buf) < 7) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putstr(&buf, "keyset-");
|
||||
|
||||
result = dns_name_tofilenametext(name, false, &buf);
|
||||
check_result(result, "dns_name_tofilenametext()");
|
||||
if (isc_buffer_availablelength(&buf) == 0)
|
||||
if (isc_buffer_availablelength(&buf) == 0) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, 0);
|
||||
|
||||
return (loadset(filename, rdataset));
|
||||
@@ -165,22 +178,22 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
||||
|
||||
static void
|
||||
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
dns_rdata_t *rdata)
|
||||
{
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
|
||||
dns_rdata_init(rdata);
|
||||
|
||||
isc_buffer_init(&keyb, key_buf, key_buf_size);
|
||||
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("can't load %s.key: %s",
|
||||
filename, isc_result_totext(result));
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't load %s.key: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (verbose > 2) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
@@ -190,12 +203,13 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
}
|
||||
|
||||
result = dst_key_todns(key, &keyb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't decode key");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&keyb, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key),
|
||||
dns_rdatatype_dnskey, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
|
||||
&r);
|
||||
|
||||
rdclass = dst_key_class(key);
|
||||
|
||||
@@ -208,15 +222,16 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
static void
|
||||
logkey(dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t buf;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
|
||||
isc_buffer_init(&buf, rdata->data, rdata->length);
|
||||
isc_buffer_add(&buf, rdata->length);
|
||||
result = dst_key_fromdns(name, rdclass, &buf, mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
@@ -243,35 +258,42 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
dns_rdata_init(&ds);
|
||||
|
||||
result = dns_rdata_tostruct(rdata, &dnskey, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't convert DNSKEY");
|
||||
}
|
||||
|
||||
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall)
|
||||
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = dns_ds_buildrdata(name, rdata, dt, buf, &ds);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't build record");
|
||||
}
|
||||
|
||||
result = dns_name_totext(name, false, &nameb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't print name");
|
||||
}
|
||||
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *) NULL, 0, 0, 0, "",
|
||||
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
|
||||
&textb);
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't print rdata");
|
||||
}
|
||||
|
||||
result = dns_rdataclass_totext(rdclass, &classb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't print class");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&nameb, &r);
|
||||
printf("%.*s ", (int)r.length, r.base);
|
||||
|
||||
if (emitttl)
|
||||
if (emitttl) {
|
||||
printf("%u ", ttl);
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&classb, &r);
|
||||
printf("%.*s", (int)r.length, r.base);
|
||||
@@ -290,7 +312,7 @@ static void
|
||||
emits(bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
unsigned i, n;
|
||||
|
||||
n = sizeof(dtype)/sizeof(dtype[0]);
|
||||
n = sizeof(dtype) / sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] != 0) {
|
||||
emit(dtype[i], showall, cds, rdata);
|
||||
@@ -304,43 +326,46 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] -f zonefile [zonename]\n\n", program);
|
||||
fprintf(stderr, " %s [options] -s dnsname\n\n", program);
|
||||
fprintf(stderr, " %s [-h|-V]\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n"
|
||||
" -1: digest algorithm SHA-1\n"
|
||||
" -2: digest algorithm SHA-256\n"
|
||||
" -a algorithm: digest algorithm (SHA-1, SHA-256 or SHA-384)\n"
|
||||
" -A: include all keys in DS set, not just KSKs (-f only)\n"
|
||||
" -c class: rdata class for DS set (default IN) (-f or -s only)\n"
|
||||
" -C: print CDS records\n"
|
||||
" -f zonefile: read keys from a zone file\n"
|
||||
" -h: print help information\n"
|
||||
" -K directory: where to find key or keyset files\n"
|
||||
" -s: read keys from keyset-<dnsname> file\n"
|
||||
" -T: TTL of output records (omitted by default)\n"
|
||||
" -v level: verbosity\n"
|
||||
" -V: print version information\n");
|
||||
" -1: digest algorithm SHA-1\n"
|
||||
" -2: digest algorithm SHA-256\n"
|
||||
" -a algorithm: digest algorithm (SHA-1, SHA-256 or "
|
||||
"SHA-384)\n"
|
||||
" -A: include all keys in DS set, not just KSKs (-f "
|
||||
"only)\n"
|
||||
" -c class: rdata class for DS set (default IN) (-f "
|
||||
"or -s only)\n"
|
||||
" -C: print CDS records\n"
|
||||
" -f zonefile: read keys from a zone file\n"
|
||||
" -h: print help information\n"
|
||||
" -K directory: where to find key or keyset files\n"
|
||||
" -s: read keys from keyset-<dnsname> file\n"
|
||||
" -T: TTL of output records (omitted by default)\n"
|
||||
" -v level: verbosity\n"
|
||||
" -V: print version information\n");
|
||||
fprintf(stderr, "Output: DS or CDS RRs\n");
|
||||
|
||||
exit (-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp, *arg1;
|
||||
int ch;
|
||||
bool cds = false;
|
||||
bool usekeyset = false;
|
||||
bool showall = false;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp, *arg1;
|
||||
int ch;
|
||||
bool cds = false;
|
||||
bool usekeyset = false;
|
||||
bool showall = false;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
|
||||
dns_rdata_init(&rdata);
|
||||
|
||||
@@ -352,7 +377,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -379,13 +404,16 @@ main(int argc, char **argv) {
|
||||
classname = isc_commandline_argument;
|
||||
break;
|
||||
case 'd':
|
||||
fprintf(stderr, "%s: the -d option is deprecated; "
|
||||
"use -K\n", program);
|
||||
/* fall through */
|
||||
fprintf(stderr,
|
||||
"%s: the -d option is deprecated; "
|
||||
"use -K\n",
|
||||
program);
|
||||
/* fall through */
|
||||
case 'K':
|
||||
dir = isc_commandline_argument;
|
||||
if (strlen(dir) == 0U)
|
||||
if (strlen(dir) == 0U) {
|
||||
fatal("directory must be non-empty string");
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
filename = isc_commandline_argument;
|
||||
@@ -402,17 +430,19 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -422,8 +452,8 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2008-2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2013-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2013-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -134,5 +134,5 @@ RFC 5011\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2013-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2013-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+134
-103
@@ -42,23 +42,23 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-importkey";
|
||||
|
||||
static dns_rdataclass_t rdclass;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static bool setpub = false, setdel = false;
|
||||
static bool setttl = false;
|
||||
static isc_stdtime_t pub = 0, del = 0;
|
||||
static dns_ttl_t ttl = 0;
|
||||
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
static bool setsyncadd = false;
|
||||
static bool setsyncdel = false;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_name_t *name = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static bool setpub = false, setdel = false;
|
||||
static bool setttl = false;
|
||||
static isc_stdtime_t pub = 0, del = 0;
|
||||
static dns_ttl_t ttl = 0;
|
||||
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
static bool setsyncadd = false;
|
||||
static bool setsyncdel = false;
|
||||
|
||||
static isc_result_t
|
||||
initname(char *setname) {
|
||||
@@ -80,32 +80,36 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
|
||||
|
||||
dns_rdatacallbacks_init(&callbacks);
|
||||
result = dns_db_beginload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0,
|
||||
&callbacks, mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
|
||||
mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't load from input: %s", isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_endload(db, &callbacks);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_endload failed: %s", isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
char setname[DNS_NAME_FORMATSIZE];
|
||||
|
||||
dns_name_format(name, setname, sizeof(setname));
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, &db);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, &db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't create database");
|
||||
}
|
||||
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
db_load_from_stream(db, stdin);
|
||||
@@ -113,48 +117,53 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
||||
} else {
|
||||
result = dns_db_load(db, filename, dns_masterformat_text,
|
||||
DNS_MASTER_NOTTL);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
fatal("can't load %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_db_findnode(db, name, false, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't find %s node in %s", setname, filename);
|
||||
}
|
||||
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
|
||||
0, 0, rdataset, NULL);
|
||||
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
|
||||
rdataset, NULL);
|
||||
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
fatal("no DNSKEY RR for %s in %s", setname, filename);
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
fatal("dns_db_findrdataset");
|
||||
}
|
||||
|
||||
if (node != NULL)
|
||||
if (node != NULL) {
|
||||
dns_db_detachnode(db, &node);
|
||||
if (db != NULL)
|
||||
}
|
||||
if (db != NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
dns_rdata_t *rdata)
|
||||
{
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
dns_rdata_t *rdata) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t keyb;
|
||||
isc_region_t r;
|
||||
|
||||
dns_rdata_init(rdata);
|
||||
|
||||
isc_buffer_init(&keyb, key_buf, key_buf_size);
|
||||
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("invalid keyfile name %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("invalid keyfile name %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (verbose > 2) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
@@ -164,12 +173,13 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
|
||||
}
|
||||
|
||||
result = dst_key_todns(key, &keyb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("can't decode key");
|
||||
}
|
||||
|
||||
isc_buffer_usedregion(&keyb, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key),
|
||||
dns_rdatatype_dnskey, &r);
|
||||
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
|
||||
&r);
|
||||
|
||||
rdclass = dst_key_class(key);
|
||||
|
||||
@@ -208,31 +218,35 @@ emit(const char *dir, dns_rdata_t *rdata) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dst_key_fromfile(dst_key_name(key), dst_key_id(key),
|
||||
dst_key_alg(key),
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
dir, mctx, &tmp);
|
||||
result = dst_key_fromfile(
|
||||
dst_key_name(key), dst_key_id(key), dst_key_alg(key),
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir, mctx, &tmp);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp))
|
||||
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp)) {
|
||||
fatal("Private key already exists in %s", priname);
|
||||
}
|
||||
dst_key_free(&tmp);
|
||||
}
|
||||
|
||||
dst_key_setexternal(key, true);
|
||||
if (setpub)
|
||||
if (setpub) {
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
||||
if (setdel)
|
||||
}
|
||||
if (setdel) {
|
||||
dst_key_settime(key, DST_TIME_DELETE, del);
|
||||
if (setsyncadd)
|
||||
}
|
||||
if (setsyncadd) {
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
if (setsyncdel)
|
||||
}
|
||||
if (setsyncdel) {
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
}
|
||||
|
||||
if (setttl)
|
||||
if (setttl) {
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
dir);
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
fatal("Failed to write key %s: %s", keystr,
|
||||
@@ -256,53 +270,54 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s options -f file [keyname]\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -f file: read key from zone file\n");
|
||||
fprintf(stderr, " -K <directory>: directory in which to store "
|
||||
"the key files\n");
|
||||
"the key files\n");
|
||||
fprintf(stderr, " -L ttl: set default key TTL\n");
|
||||
fprintf(stderr, " -v <verbose level>\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
fprintf(stderr, " -h: print usage and exit\n");
|
||||
fprintf(stderr, "Timing options:\n");
|
||||
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
|
||||
"publication date\n");
|
||||
"publication date\n");
|
||||
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
|
||||
"deletion date\n");
|
||||
"deletion date\n");
|
||||
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
|
||||
exit (-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp;
|
||||
int ch;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
isc_stdtime_t now;
|
||||
char *classname = NULL;
|
||||
char *filename = NULL, *dir = NULL, *namestr;
|
||||
char *endp;
|
||||
int ch;
|
||||
isc_result_t result;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata;
|
||||
isc_stdtime_t now;
|
||||
|
||||
dns_rdata_init(&rdata);
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
if (argc == 1)
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -313,26 +328,29 @@ main(int argc, char **argv) {
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (setsyncdel)
|
||||
if (setsyncdel) {
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel)
|
||||
if (setdel) {
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
del = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
del = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
break;
|
||||
case 'K':
|
||||
dir = isc_commandline_argument;
|
||||
if (strlen(dir) == 0U)
|
||||
if (strlen(dir) == 0U) {
|
||||
fatal("directory must be non-empty string");
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
ttl = strtottl(isc_commandline_argument);
|
||||
@@ -341,35 +359,39 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (setsyncadd)
|
||||
if (setsyncadd) {
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
break;
|
||||
}
|
||||
/* -Pdnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub)
|
||||
if (setpub) {
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
pub = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
pub = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
break;
|
||||
case 'f':
|
||||
filename = isc_commandline_argument;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -379,23 +401,26 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
rdclass = strtoclass(classname);
|
||||
|
||||
if (argc < isc_commandline_index + 1 && filename == NULL)
|
||||
if (argc < isc_commandline_index + 1 && filename == NULL) {
|
||||
fatal("the key file name was not specified");
|
||||
if (argc > isc_commandline_index + 1)
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
fatal("extraneous arguments");
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
setup_logging(mctx, &log);
|
||||
|
||||
@@ -405,23 +430,26 @@ main(int argc, char **argv) {
|
||||
if (argc < isc_commandline_index + 1) {
|
||||
/* using filename as zone name */
|
||||
namestr = filename;
|
||||
} else
|
||||
} else {
|
||||
namestr = argv[isc_commandline_index];
|
||||
}
|
||||
|
||||
result = initname(namestr);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not initialize name %s", namestr);
|
||||
}
|
||||
|
||||
result = loadset(filename, &rdataset);
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not load DNSKEY set: %s\n",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
for (result = dns_rdataset_first(&rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset)) {
|
||||
|
||||
result = dns_rdataset_next(&rdataset))
|
||||
{
|
||||
dns_rdata_init(&rdata);
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
emit(dir, &rdata);
|
||||
@@ -429,24 +457,27 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
unsigned char key_buf[DST_KEY_MAXSIZE];
|
||||
|
||||
loadkey(argv[isc_commandline_index], key_buf,
|
||||
DST_KEY_MAXSIZE, &rdata);
|
||||
loadkey(argv[isc_commandline_index], key_buf, DST_KEY_MAXSIZE,
|
||||
&rdata);
|
||||
|
||||
emit(dir, &rdata);
|
||||
}
|
||||
|
||||
if (dns_rdataset_isassociated(&rdataset))
|
||||
if (dns_rdataset_isassociated(&rdataset)) {
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
}
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10)
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "write error\n");
|
||||
return (1);
|
||||
} else
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2013-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2013-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2008-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2008-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -92,7 +92,7 @@ Specifies the label for a key pair in the crypto hardware\&.
|
||||
.sp
|
||||
When
|
||||
BIND
|
||||
9 is built with OpenSSL\-based PKCS#11 support, the label is an arbitrary string that identifies a particular key\&. It may be preceded by an optional OpenSSL engine name, followed by a colon, as in "pkcs11:\fIkeylabel\fR"\&.
|
||||
9 is built with OpenSSL\-based PKCS#11 support, the label is an arbitrary string that identifies a particular key\&.
|
||||
.sp
|
||||
When
|
||||
BIND
|
||||
@@ -307,5 +307,5 @@ The PKCS#11 URI Scheme (draft\-pechanec\-pkcs11uri\-13)\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2008-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2008-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+257
-187
@@ -19,13 +19,11 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <pk11/site.h>
|
||||
|
||||
#include <dns/dnssec.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/keyvalues.h>
|
||||
@@ -36,10 +34,11 @@
|
||||
#include <dns/secalg.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#include <pk11/site.h>
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -53,8 +52,7 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s -l label [options] name\n\n",
|
||||
program);
|
||||
fprintf(stderr, " %s -l label [options] name\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Required options:\n");
|
||||
fprintf(stderr, " -l label: label of the key pair\n");
|
||||
@@ -69,22 +67,25 @@ usage(void) {
|
||||
fprintf(stderr, " -c class (default: IN)\n");
|
||||
fprintf(stderr, " -E <engine>:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr, " path to PKCS#11 provider library "
|
||||
"(default is %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr,
|
||||
" path to PKCS#11 provider library "
|
||||
"(default is %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, " name of an OpenSSL engine to use\n");
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -f keyflag: KSK | REVOKE\n");
|
||||
fprintf(stderr, " -K directory: directory in which to place "
|
||||
"key files\n");
|
||||
fprintf(stderr, " -k: generate a TYPE=KEY key\n");
|
||||
fprintf(stderr, " -L ttl: default key TTL\n");
|
||||
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | OTHER\n");
|
||||
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | "
|
||||
"OTHER\n");
|
||||
fprintf(stderr, " (DNSKEY generation defaults to ZONE\n");
|
||||
fprintf(stderr, " -p protocol: default: 3 [dnssec]\n");
|
||||
fprintf(stderr, " -t type: "
|
||||
"AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF "
|
||||
"(default: AUTHCONF)\n");
|
||||
"AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF "
|
||||
"(default: AUTHCONF)\n");
|
||||
fprintf(stderr, " -y: permit keys that might collide\n");
|
||||
fprintf(stderr, " -v verbose level\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
@@ -102,72 +103,73 @@ usage(void) {
|
||||
fprintf(stderr, " -C: generate a backward-compatible key, omitting"
|
||||
" all dates\n");
|
||||
fprintf(stderr, " -S <key>: generate a successor to an existing "
|
||||
"key\n");
|
||||
"key\n");
|
||||
fprintf(stderr, " -i <interval>: prepublication interval for "
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<id>.key, "
|
||||
"K<name>+<alg>+<id>.private\n");
|
||||
|
||||
exit (-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *algname = NULL, *freeit = NULL;
|
||||
char *nametype = NULL, *type = NULL;
|
||||
const char *directory = NULL;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
const char *engine = NULL;
|
||||
char *classname = NULL;
|
||||
char *endp;
|
||||
dst_key_t *key = NULL;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||
dns_secalg_t alg;
|
||||
bool oldstyle = false;
|
||||
isc_mem_t *mctx = NULL;
|
||||
int ch;
|
||||
int protocol = -1, signatory = 0;
|
||||
isc_result_t ret;
|
||||
char *algname = NULL, *freeit = NULL;
|
||||
char *nametype = NULL, *type = NULL;
|
||||
const char *directory = NULL;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
const char *engine = NULL;
|
||||
char *classname = NULL;
|
||||
char *endp;
|
||||
dst_key_t *key = NULL;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||
dns_secalg_t alg;
|
||||
bool oldstyle = false;
|
||||
isc_mem_t *mctx = NULL;
|
||||
int ch;
|
||||
int protocol = -1, signatory = 0;
|
||||
isc_result_t ret;
|
||||
isc_textregion_t r;
|
||||
char filename[255];
|
||||
isc_buffer_t buf;
|
||||
isc_log_t *log = NULL;
|
||||
char filename[255];
|
||||
isc_buffer_t buf;
|
||||
isc_log_t *log = NULL;
|
||||
dns_rdataclass_t rdclass;
|
||||
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
||||
char *label = NULL;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool genonly = false;
|
||||
bool use_nsec3 = false;
|
||||
bool avoid_collisions = true;
|
||||
bool exact;
|
||||
unsigned char c;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
||||
char *label = NULL;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool genonly = false;
|
||||
bool use_nsec3 = false;
|
||||
bool avoid_collisions = true;
|
||||
bool exact;
|
||||
unsigned char c;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
|
||||
if (argc == 1)
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -176,7 +178,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
|
||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (ch) {
|
||||
switch (ch) {
|
||||
case '3':
|
||||
use_nsec3 = true;
|
||||
break;
|
||||
@@ -194,20 +196,22 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'f':
|
||||
c = (unsigned char)(isc_commandline_argument[0]);
|
||||
if (toupper(c) == 'K')
|
||||
if (toupper(c) == 'K') {
|
||||
kskflag = DNS_KEYFLAG_KSK;
|
||||
else if (toupper(c) == 'R')
|
||||
} else if (toupper(c) == 'R') {
|
||||
revflag = DNS_KEYFLAG_REVOKE;
|
||||
else
|
||||
} else {
|
||||
fatal("unknown flag '%s'",
|
||||
isc_commandline_argument);
|
||||
}
|
||||
break;
|
||||
case 'K':
|
||||
directory = isc_commandline_argument;
|
||||
ret = try_dir(directory);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("cannot open directory %s: %s",
|
||||
directory, isc_result_totext(ret));
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("cannot open directory %s: %s", directory,
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
options |= DST_TYPE_KEY;
|
||||
@@ -224,17 +228,19 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
case 'p':
|
||||
protocol = strtol(isc_commandline_argument, &endp, 10);
|
||||
if (*endp != '\0' || protocol < 0 || protocol > 255)
|
||||
if (*endp != '\0' || protocol < 0 || protocol > 255) {
|
||||
fatal("-p must be followed by a number "
|
||||
"[0..255]");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
type = isc_commandline_argument;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
avoid_collisions = false;
|
||||
@@ -245,67 +251,74 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncadd || setsyncadd)
|
||||
if (unsetsyncadd || setsyncadd) {
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
unsetsyncadd = !setsyncadd;
|
||||
break;
|
||||
}
|
||||
/* -Pdnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub || unsetpub)
|
||||
if (setpub || unsetpub) {
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
publish = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
publish = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
unsetpub = !setpub;
|
||||
break;
|
||||
case 'A':
|
||||
if (setact || unsetact)
|
||||
if (setact || unsetact) {
|
||||
fatal("-A specified more than once");
|
||||
}
|
||||
|
||||
activate = strtotime(isc_commandline_argument,
|
||||
now, now, &setact);
|
||||
activate = strtotime(isc_commandline_argument, now, now,
|
||||
&setact);
|
||||
unsetact = !setact;
|
||||
break;
|
||||
case 'R':
|
||||
if (setrev || unsetrev)
|
||||
if (setrev || unsetrev) {
|
||||
fatal("-R specified more than once");
|
||||
}
|
||||
|
||||
revoke = strtotime(isc_commandline_argument,
|
||||
now, now, &setrev);
|
||||
revoke = strtotime(isc_commandline_argument, now, now,
|
||||
&setrev);
|
||||
unsetrev = !setrev;
|
||||
break;
|
||||
case 'I':
|
||||
if (setinact || unsetinact)
|
||||
if (setinact || unsetinact) {
|
||||
fatal("-I specified more than once");
|
||||
}
|
||||
|
||||
inactive = strtotime(isc_commandline_argument,
|
||||
now, now, &setinact);
|
||||
inactive = strtotime(isc_commandline_argument, now, now,
|
||||
&setinact);
|
||||
unsetinact = !setinact;
|
||||
break;
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncdel || setsyncdel)
|
||||
if (unsetsyncdel || setsyncdel) {
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
unsetsyncdel = !setsyncdel;
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel || unsetdel)
|
||||
if (setdel || unsetdel) {
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
deltime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
deltime = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'S':
|
||||
@@ -315,13 +328,14 @@ main(int argc, char **argv) {
|
||||
prepub = strtottl(isc_commandline_argument);
|
||||
break;
|
||||
case 'F':
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
/* Reserved for FIPS mode */
|
||||
/* FALLTHROUGH */
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
@@ -331,36 +345,40 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = dst_lib_init(mctx, engine);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(ret));
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("could not initialize dst: %s", isc_result_totext(ret));
|
||||
}
|
||||
|
||||
setup_logging(mctx, &log);
|
||||
|
||||
if (predecessor == NULL) {
|
||||
if (label == NULL)
|
||||
if (label == NULL) {
|
||||
fatal("the key label was not specified");
|
||||
if (argc < isc_commandline_index + 1)
|
||||
}
|
||||
if (argc < isc_commandline_index + 1) {
|
||||
fatal("the key name was not specified");
|
||||
if (argc > isc_commandline_index + 1)
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
fatal("extraneous arguments");
|
||||
}
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
isc_buffer_init(&buf, argv[isc_commandline_index],
|
||||
strlen(argv[isc_commandline_index]));
|
||||
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
|
||||
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("invalid key name %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
|
||||
if (strchr(label, ':') == NULL) {
|
||||
char *l;
|
||||
@@ -402,29 +420,32 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
default:
|
||||
fatal("%s is incompatible with NSEC3; "
|
||||
"do not use the -3 option", algname);
|
||||
"do not use the -3 option",
|
||||
algname);
|
||||
}
|
||||
}
|
||||
|
||||
if (type != NULL && (options & DST_TYPE_KEY) != 0) {
|
||||
if (strcasecmp(type, "NOAUTH") == 0)
|
||||
if (strcasecmp(type, "NOAUTH") == 0) {
|
||||
flags |= DNS_KEYTYPE_NOAUTH;
|
||||
else if (strcasecmp(type, "NOCONF") == 0)
|
||||
} else if (strcasecmp(type, "NOCONF") == 0) {
|
||||
flags |= DNS_KEYTYPE_NOCONF;
|
||||
else if (strcasecmp(type, "NOAUTHCONF") == 0)
|
||||
} else if (strcasecmp(type, "NOAUTHCONF") == 0) {
|
||||
flags |= (DNS_KEYTYPE_NOAUTH |
|
||||
DNS_KEYTYPE_NOCONF);
|
||||
else if (strcasecmp(type, "AUTHCONF") == 0)
|
||||
/* nothing */;
|
||||
else
|
||||
} else if (strcasecmp(type, "AUTHCONF") == 0) {
|
||||
/* nothing */
|
||||
} else {
|
||||
fatal("invalid type %s", type);
|
||||
}
|
||||
}
|
||||
|
||||
if (!oldstyle && prepub > 0) {
|
||||
if (setpub && setact && (activate - prepub) < publish)
|
||||
if (setpub && setact && (activate - prepub) < publish) {
|
||||
fatal("Activation and publication dates "
|
||||
"are closer together than the\n\t"
|
||||
"prepublication interval.");
|
||||
}
|
||||
|
||||
if (!setpub && !setact) {
|
||||
setpub = setact = true;
|
||||
@@ -438,43 +459,55 @@ main(int argc, char **argv) {
|
||||
publish = activate - prepub;
|
||||
}
|
||||
|
||||
if ((activate - prepub) < now)
|
||||
if ((activate - prepub) < now) {
|
||||
fatal("Time until activation is shorter "
|
||||
"than the\n\tprepublication interval.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
isc_stdtime_t when;
|
||||
int major, minor;
|
||||
|
||||
if (prepub == -1)
|
||||
if (prepub == -1) {
|
||||
prepub = (30 * 86400);
|
||||
}
|
||||
|
||||
if (algname != NULL)
|
||||
if (algname != NULL) {
|
||||
fatal("-S and -a cannot be used together");
|
||||
if (nametype != NULL)
|
||||
}
|
||||
if (nametype != NULL) {
|
||||
fatal("-S and -n cannot be used together");
|
||||
if (type != NULL)
|
||||
}
|
||||
if (type != NULL) {
|
||||
fatal("-S and -t cannot be used together");
|
||||
if (setpub || unsetpub)
|
||||
}
|
||||
if (setpub || unsetpub) {
|
||||
fatal("-S and -P cannot be used together");
|
||||
if (setact || unsetact)
|
||||
}
|
||||
if (setact || unsetact) {
|
||||
fatal("-S and -A cannot be used together");
|
||||
if (use_nsec3)
|
||||
}
|
||||
if (use_nsec3) {
|
||||
fatal("-S and -3 cannot be used together");
|
||||
if (oldstyle)
|
||||
}
|
||||
if (oldstyle) {
|
||||
fatal("-S and -C cannot be used together");
|
||||
if (genonly)
|
||||
}
|
||||
if (genonly) {
|
||||
fatal("-S and -G cannot be used together");
|
||||
}
|
||||
|
||||
ret = dst_key_fromnamedfile(predecessor, directory,
|
||||
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
mctx, &prevkey);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
predecessor, isc_result_totext(ret));
|
||||
if (!dst_key_isprivate(prevkey))
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", predecessor,
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
if (!dst_key_isprivate(prevkey)) {
|
||||
fatal("%s is not a private key", predecessor);
|
||||
}
|
||||
|
||||
name = dst_key_name(prevkey);
|
||||
alg = dst_key_alg(prevkey);
|
||||
@@ -482,88 +515,106 @@ main(int argc, char **argv) {
|
||||
|
||||
dst_key_format(prevkey, keystr, sizeof(keystr));
|
||||
dst_key_getprivateformat(prevkey, &major, &minor);
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
fatal("Key %s has incompatible format version %d.%d\n\t"
|
||||
"It is not possible to generate a successor key.",
|
||||
keystr, major, minor);
|
||||
}
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &when);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("Key %s has no activation date.\n\t"
|
||||
"You must use dnssec-settime -A to set one "
|
||||
"before generating a successor.", keystr);
|
||||
"before generating a successor.",
|
||||
keystr);
|
||||
}
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_INACTIVE, &activate);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("Key %s has no inactivation date.\n\t"
|
||||
"You must use dnssec-settime -I to set one "
|
||||
"before generating a successor.", keystr);
|
||||
"before generating a successor.",
|
||||
keystr);
|
||||
}
|
||||
|
||||
publish = activate - prepub;
|
||||
if (publish < now)
|
||||
if (publish < now) {
|
||||
fatal("Key %s becomes inactive\n\t"
|
||||
"sooner than the prepublication period "
|
||||
"for the new key ends.\n\t"
|
||||
"Either change the inactivation date with "
|
||||
"dnssec-settime -I,\n\t"
|
||||
"or use the -i option to set a shorter "
|
||||
"prepublication interval.", keystr);
|
||||
"prepublication interval.",
|
||||
keystr);
|
||||
}
|
||||
|
||||
ret = dst_key_gettime(prevkey, DST_TIME_DELETE, &when);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s: WARNING: Key %s has no removal "
|
||||
"date;\n\t it will remain in the zone "
|
||||
"indefinitely after rollover.\n\t "
|
||||
"You can use dnssec-settime -D to "
|
||||
"change this.\n", program, keystr);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: Key %s has no removal "
|
||||
"date;\n\t it will remain in the zone "
|
||||
"indefinitely after rollover.\n\t "
|
||||
"You can use dnssec-settime -D to "
|
||||
"change this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
|
||||
setpub = setact = true;
|
||||
}
|
||||
|
||||
if (nametype == NULL) {
|
||||
if ((options & DST_TYPE_KEY) != 0) /* KEY */
|
||||
if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
fatal("no nametype specified");
|
||||
flags |= DNS_KEYOWNER_ZONE; /* DNSKEY */
|
||||
} else if (strcasecmp(nametype, "zone") == 0)
|
||||
}
|
||||
flags |= DNS_KEYOWNER_ZONE; /* DNSKEY */
|
||||
} else if (strcasecmp(nametype, "zone") == 0) {
|
||||
flags |= DNS_KEYOWNER_ZONE;
|
||||
else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
} else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
if (strcasecmp(nametype, "host") == 0 ||
|
||||
strcasecmp(nametype, "entity") == 0)
|
||||
strcasecmp(nametype, "entity") == 0) {
|
||||
flags |= DNS_KEYOWNER_ENTITY;
|
||||
else if (strcasecmp(nametype, "user") == 0)
|
||||
} else if (strcasecmp(nametype, "user") == 0) {
|
||||
flags |= DNS_KEYOWNER_USER;
|
||||
else
|
||||
} else {
|
||||
fatal("invalid KEY nametype %s", nametype);
|
||||
} else if (strcasecmp(nametype, "other") != 0) /* DNSKEY */
|
||||
}
|
||||
} else if (strcasecmp(nametype, "other") != 0) { /* DNSKEY */
|
||||
fatal("invalid DNSKEY nametype %s", nametype);
|
||||
}
|
||||
|
||||
rdclass = strtoclass(classname);
|
||||
|
||||
if (directory == NULL)
|
||||
if (directory == NULL) {
|
||||
directory = ".";
|
||||
}
|
||||
|
||||
if ((options & DST_TYPE_KEY) != 0) /* KEY */
|
||||
if ((options & DST_TYPE_KEY) != 0) { /* KEY */
|
||||
flags |= signatory;
|
||||
else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
|
||||
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
|
||||
flags |= kskflag;
|
||||
flags |= revflag;
|
||||
}
|
||||
|
||||
if (protocol == -1)
|
||||
if (protocol == -1) {
|
||||
protocol = DNS_KEYPROTO_DNSSEC;
|
||||
else if ((options & DST_TYPE_KEY) == 0 &&
|
||||
protocol != DNS_KEYPROTO_DNSSEC)
|
||||
} else if ((options & DST_TYPE_KEY) == 0 &&
|
||||
protocol != DNS_KEYPROTO_DNSSEC) {
|
||||
fatal("invalid DNSKEY protocol: %d", protocol);
|
||||
}
|
||||
|
||||
if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY) {
|
||||
if ((flags & DNS_KEYFLAG_SIGNATORYMASK) != 0)
|
||||
if ((flags & DNS_KEYFLAG_SIGNATORYMASK) != 0) {
|
||||
fatal("specified null key with signing authority");
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
|
||||
alg == DNS_KEYALG_DH)
|
||||
{
|
||||
fatal("a key with algorithm '%s' cannot be a zone key",
|
||||
algname);
|
||||
}
|
||||
|
||||
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
|
||||
|
||||
@@ -571,9 +622,9 @@ main(int argc, char **argv) {
|
||||
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass,
|
||||
#if USE_PKCS11
|
||||
"pkcs11",
|
||||
#else
|
||||
#else /* if USE_PKCS11 */
|
||||
engine,
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
label, NULL, mctx, &key);
|
||||
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
@@ -581,8 +632,8 @@ main(int argc, char **argv) {
|
||||
char algstr[DNS_SECALG_FORMATSIZE];
|
||||
dns_name_format(name, namestr, sizeof(namestr));
|
||||
dns_secalg_format(alg, algstr, sizeof(algstr));
|
||||
fatal("failed to get key %s/%s: %s",
|
||||
namestr, algstr, isc_result_totext(ret));
|
||||
fatal("failed to get key %s/%s: %s", namestr, algstr,
|
||||
isc_result_totext(ret));
|
||||
/* NOTREACHED */
|
||||
exit(-1);
|
||||
}
|
||||
@@ -596,48 +647,57 @@ main(int argc, char **argv) {
|
||||
if (!oldstyle) {
|
||||
dst_key_settime(key, DST_TIME_CREATED, now);
|
||||
|
||||
if (genonly && (setpub || setact))
|
||||
if (genonly && (setpub || setact)) {
|
||||
fatal("cannot use -G together with -P or -A options");
|
||||
}
|
||||
|
||||
if (setpub)
|
||||
if (setpub) {
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, publish);
|
||||
else if (setact)
|
||||
} else if (setact) {
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, activate);
|
||||
else if (!genonly && !unsetpub)
|
||||
} else if (!genonly && !unsetpub) {
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, now);
|
||||
}
|
||||
|
||||
if (setact)
|
||||
if (setact) {
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, activate);
|
||||
else if (!genonly && !unsetact)
|
||||
} else if (!genonly && !unsetact) {
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, now);
|
||||
}
|
||||
|
||||
if (setrev) {
|
||||
if (kskflag == 0)
|
||||
fprintf(stderr, "%s: warning: Key is "
|
||||
if (kskflag == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is "
|
||||
"not flagged as a KSK, but -R "
|
||||
"was used. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
}
|
||||
dst_key_settime(key, DST_TIME_REVOKE, revoke);
|
||||
}
|
||||
|
||||
if (setinact)
|
||||
if (setinact) {
|
||||
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
|
||||
}
|
||||
|
||||
if (setdel)
|
||||
if (setdel) {
|
||||
dst_key_settime(key, DST_TIME_DELETE, deltime);
|
||||
if (setsyncadd)
|
||||
}
|
||||
if (setsyncadd) {
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
if (setsyncdel)
|
||||
}
|
||||
if (setsyncdel) {
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
|
||||
}
|
||||
} else {
|
||||
if (setpub || setact || setrev || setinact ||
|
||||
setdel || unsetpub || unsetact ||
|
||||
unsetrev || unsetinact || unsetdel || genonly ||
|
||||
setsyncadd || setsyncdel)
|
||||
if (setpub || setact || setrev || setinact || setdel ||
|
||||
unsetpub || unsetact || unsetrev || unsetinact ||
|
||||
unsetdel || genonly || setsyncadd || setsyncdel)
|
||||
{
|
||||
fatal("cannot use -C together with "
|
||||
"-P, -A, -R, -I, -D, or -G options");
|
||||
}
|
||||
/*
|
||||
* Compatibility mode: Private-key-format
|
||||
* should be set to 1.2.
|
||||
@@ -646,8 +706,9 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
/* Set default key TTL */
|
||||
if (setttl)
|
||||
if (setttl) {
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not overwrite an existing key. Warn LOUDLY if there
|
||||
@@ -657,21 +718,26 @@ main(int argc, char **argv) {
|
||||
if (key_collision(key, name, directory, mctx, &exact)) {
|
||||
isc_buffer_clear(&buf);
|
||||
ret = dst_key_buildfilename(key, 0, directory, &buf);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("dst_key_buildfilename returned: %s\n",
|
||||
isc_result_totext(ret));
|
||||
if (exact)
|
||||
}
|
||||
if (exact) {
|
||||
fatal("%s: %s already exists\n", program, filename);
|
||||
}
|
||||
|
||||
if (avoid_collisions)
|
||||
if (avoid_collisions) {
|
||||
fatal("%s: %s could collide with another key upon "
|
||||
"revokation\n", program, filename);
|
||||
"revokation\n",
|
||||
program, filename);
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: WARNING: Key %s could collide with "
|
||||
"another key upon revokation. If you plan "
|
||||
"to revoke keys, destroy this key and "
|
||||
"generate a different one.\n",
|
||||
program, filename);
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: Key %s could collide with "
|
||||
"another key upon revokation. If you plan "
|
||||
"to revoke keys, destroy this key and "
|
||||
"generate a different one.\n",
|
||||
program, filename);
|
||||
}
|
||||
|
||||
ret = dst_key_tofile(key, options, directory);
|
||||
@@ -684,23 +750,27 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_buffer_clear(&buf);
|
||||
ret = dst_key_buildfilename(key, 0, NULL, &buf);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
fatal("dst_key_buildfilename returned: %s\n",
|
||||
isc_result_totext(ret));
|
||||
}
|
||||
printf("%s\n", filename);
|
||||
dst_key_free(&key);
|
||||
if (prevkey != NULL)
|
||||
if (prevkey != NULL) {
|
||||
dst_key_free(&prevkey);
|
||||
}
|
||||
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10)
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_free(mctx, label);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
if (freeit != NULL)
|
||||
if (freeit != NULL) {
|
||||
free(freeit);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@@ -172,9 +173,7 @@
|
||||
<para>
|
||||
When <acronym>BIND</acronym> 9 is built with OpenSSL-based
|
||||
PKCS#11 support, the label is an arbitrary string that
|
||||
identifies a particular key. It may be preceded by an
|
||||
optional OpenSSL engine name, followed by a colon, as in
|
||||
"pkcs11:<replaceable>keylabel</replaceable>".
|
||||
identifies a particular key.
|
||||
</para>
|
||||
<para>
|
||||
When <acronym>BIND</acronym> 9 is built with native PKCS#11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2008-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
@@ -146,9 +146,7 @@
|
||||
<p>
|
||||
When <acronym class="acronym">BIND</acronym> 9 is built with OpenSSL-based
|
||||
PKCS#11 support, the label is an arbitrary string that
|
||||
identifies a particular key. It may be preceded by an
|
||||
optional OpenSSL engine name, followed by a colon, as in
|
||||
"pkcs11:<em class="replaceable"><code>keylabel</code></em>".
|
||||
identifies a particular key.
|
||||
</p>
|
||||
<p>
|
||||
When <acronym class="acronym">BIND</acronym> 9 is built with native PKCS#11
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2005, 2007-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2005, 2007-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -374,5 +374,5 @@ RFC 4034\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2005, 2007-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2005, 2007-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+342
-257
File diff suppressed because it is too large
Load Diff
@@ -51,6 +51,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2005, 2007-2012, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2005, 2007-2012, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2009, 2011, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2009, 2011, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -99,5 +99,5 @@ RFC 5011\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2009, 2011, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2009, 2011, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+67
-51
@@ -32,13 +32,13 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-revoke";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
@@ -46,26 +46,28 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr, " -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr,
|
||||
" -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -f: force overwrite\n");
|
||||
fprintf(stderr, " -h: help\n");
|
||||
fprintf(stderr, " -K directory: use directory for key files\n");
|
||||
fprintf(stderr, " -r: remove old keyfiles after "
|
||||
"creating revoked version\n");
|
||||
"creating revoked version\n");
|
||||
fprintf(stderr, " -v level: set level of verbosity\n");
|
||||
fprintf(stderr, " -V: print version information\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit (-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -85,79 +87,85 @@ main(int argc, char **argv) {
|
||||
bool removefile = false;
|
||||
bool id = false;
|
||||
|
||||
if (argc == 1)
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
#if HAVE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if HAVE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
|
||||
switch (ch) {
|
||||
case 'E':
|
||||
case 'E':
|
||||
engine = isc_commandline_argument;
|
||||
break;
|
||||
case 'f':
|
||||
case 'f':
|
||||
force = true;
|
||||
break;
|
||||
case 'K':
|
||||
case 'K':
|
||||
/*
|
||||
* We don't have to copy it here, but do it to
|
||||
* simplify cleanup later
|
||||
*/
|
||||
dir = isc_mem_strdup(mctx, isc_commandline_argument);
|
||||
break;
|
||||
case 'r':
|
||||
case 'r':
|
||||
removefile = true;
|
||||
break;
|
||||
case 'R':
|
||||
case 'R':
|
||||
id = true;
|
||||
break;
|
||||
case 'v':
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
|
||||
case 'V':
|
||||
case 'V':
|
||||
/* Does not return. */
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < isc_commandline_index + 1 ||
|
||||
argv[isc_commandline_index] == NULL)
|
||||
argv[isc_commandline_index] == NULL) {
|
||||
fatal("The key file name was not specified");
|
||||
if (argc > isc_commandline_index + 1)
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
fatal("Extraneous arguments");
|
||||
}
|
||||
|
||||
if (dir != NULL) {
|
||||
filename = argv[isc_commandline_index];
|
||||
} else {
|
||||
result = isc_file_splitpath(mctx, argv[isc_commandline_index],
|
||||
&dir, &filename);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("cannot process filename %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (strcmp(dir, ".") == 0) {
|
||||
isc_mem_free(mctx, dir);
|
||||
dir = NULL;
|
||||
@@ -165,16 +173,17 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(filename, dir,
|
||||
DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
mctx, &key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile name %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
result = dst_key_fromnamedfile(
|
||||
filename, dir, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, mctx, &key);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile name %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (id) {
|
||||
fprintf(stdout, "%u\n", dst_key_rid(key));
|
||||
@@ -182,24 +191,27 @@ main(int argc, char **argv) {
|
||||
}
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
|
||||
if (verbose > 2)
|
||||
if (verbose > 2) {
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
}
|
||||
|
||||
if (force)
|
||||
if (force) {
|
||||
set_keyversion(key);
|
||||
else
|
||||
} else {
|
||||
check_keyversion(key, keystr);
|
||||
|
||||
}
|
||||
|
||||
flags = dst_key_flags(key);
|
||||
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
|
||||
isc_stdtime_t now;
|
||||
|
||||
if ((flags & DNS_KEYFLAG_KSK) == 0)
|
||||
fprintf(stderr, "%s: warning: Key is not flagged "
|
||||
"as a KSK. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
if ((flags & DNS_KEYFLAG_KSK) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is not flagged "
|
||||
"as a KSK. Revoking a ZSK is "
|
||||
"legal, but undefined.\n",
|
||||
program);
|
||||
}
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
dst_key_settime(key, DST_TIME_REVOKE, now);
|
||||
@@ -211,10 +223,11 @@ main(int argc, char **argv) {
|
||||
|
||||
if (access(newname, F_OK) == 0 && !force) {
|
||||
fatal("Key file %s already exists; "
|
||||
"use -f to force overwrite", newname);
|
||||
"use -f to force overwrite",
|
||||
newname);
|
||||
}
|
||||
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
|
||||
result = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
|
||||
dir);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
@@ -234,8 +247,9 @@ main(int argc, char **argv) {
|
||||
isc_buffer_init(&buf, oldname, sizeof(oldname));
|
||||
dst_key_setflags(key, flags & ~DNS_KEYFLAG_REVOKE);
|
||||
dst_key_buildfilename(key, DST_TYPE_PRIVATE, dir, &buf);
|
||||
if (strcmp(oldname, newname) == 0)
|
||||
if (strcmp(oldname, newname) == 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
(void)unlink(oldname);
|
||||
isc_buffer_clear(&buf);
|
||||
dst_key_buildfilename(key, DST_TYPE_PUBLIC, dir, &buf);
|
||||
@@ -249,10 +263,12 @@ main(int argc, char **argv) {
|
||||
cleanup:
|
||||
dst_key_free(&key);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10)
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
if (dir != NULL)
|
||||
}
|
||||
if (dir != NULL) {
|
||||
isc_mem_free(mctx, dir);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (0);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2009, 2011, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2009, 2011, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2009-2011, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2009-2011, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -251,5 +251,5 @@ RFC 5011\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2009-2011, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2009-2011, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+281
-215
@@ -11,12 +11,12 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
@@ -28,20 +28,20 @@
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-settime";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
@@ -49,20 +49,22 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "General options:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr, " -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n", PK11_LIB_LOCATION);
|
||||
fprintf(stderr,
|
||||
" -E engine: specify PKCS#11 provider "
|
||||
"(default: %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#elif defined(USE_PKCS11)
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine "
|
||||
"(default \"pkcs11\")\n");
|
||||
#else
|
||||
"(default \"pkcs11\")\n");
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
fprintf(stderr, " -f: force update of old-style "
|
||||
"keys\n");
|
||||
"keys\n");
|
||||
fprintf(stderr, " -K directory: set key file location\n");
|
||||
fprintf(stderr, " -L ttl: set default key TTL\n");
|
||||
fprintf(stderr, " -v level: set level of verbosity\n");
|
||||
@@ -70,61 +72,60 @@ usage(void) {
|
||||
fprintf(stderr, " -h: help\n");
|
||||
fprintf(stderr, "Timing options:\n");
|
||||
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
|
||||
"publication date\n");
|
||||
"publication date\n");
|
||||
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
"CDS and CDNSKEY publication date\n");
|
||||
fprintf(stderr, " -A date/[+-]offset/none: set/unset key "
|
||||
"activation date\n");
|
||||
"activation date\n");
|
||||
fprintf(stderr, " -R date/[+-]offset/none: set/unset key "
|
||||
"revocation date\n");
|
||||
"revocation date\n");
|
||||
fprintf(stderr, " -I date/[+-]offset/none: set/unset key "
|
||||
"inactivation date\n");
|
||||
"inactivation date\n");
|
||||
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
|
||||
"deletion date\n");
|
||||
"deletion date\n");
|
||||
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
"CDS and CDNSKEY deletion date\n");
|
||||
fprintf(stderr, " -S <key>: generate a successor to an existing "
|
||||
"key\n");
|
||||
"key\n");
|
||||
fprintf(stderr, " -i <interval>: prepublication interval for "
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
"successor key "
|
||||
"(default: 30 days)\n");
|
||||
fprintf(stderr, "Key state options:\n");
|
||||
fprintf(stderr, " -s: update key state file (default no)\n");
|
||||
fprintf(stderr, " -g state: set the goal state for this key\n");
|
||||
fprintf(stderr, " -d state date/[+-]offset: set the DS state\n");
|
||||
fprintf(stderr, " -k state date/[+-]offset: set the DNSKEY state\n");
|
||||
fprintf(stderr, " -r state date/[+-]offset: set the RRSIG (KSK) "
|
||||
"state\n");
|
||||
"state\n");
|
||||
fprintf(stderr, " -z state date/[+-]offset: set the RRSIG (ZSK) "
|
||||
"state\n");
|
||||
"state\n");
|
||||
fprintf(stderr, "Printing options:\n");
|
||||
fprintf(stderr, " -p C/P/Psync/A/R/I/D/Dsync/all: print a "
|
||||
"particular time value or values\n");
|
||||
"particular time value or values\n");
|
||||
fprintf(stderr, " -u: print times in unix epoch "
|
||||
"format\n");
|
||||
"format\n");
|
||||
fprintf(stderr, "Output:\n");
|
||||
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
"K<name>+<alg>+<new id>.private\n");
|
||||
|
||||
exit (-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
printtime(dst_key_t *key, int type, const char *tag, bool epoch,
|
||||
FILE *stream)
|
||||
{
|
||||
printtime(dst_key_t *key, int type, const char *tag, bool epoch, FILE *stream) {
|
||||
isc_result_t result;
|
||||
const char *output = NULL;
|
||||
isc_stdtime_t when;
|
||||
|
||||
if (tag != NULL)
|
||||
if (tag != NULL) {
|
||||
fprintf(stream, "%s: ", tag);
|
||||
}
|
||||
|
||||
result = dst_key_gettime(key, type, &when);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
fprintf(stream, "UNSET\n");
|
||||
} else if (epoch) {
|
||||
fprintf(stream, "%d\n", (int) when);
|
||||
fprintf(stream, "%d\n", (int)when);
|
||||
} else {
|
||||
time_t timet = when;
|
||||
output = ctime(&timet);
|
||||
@@ -133,13 +134,12 @@ printtime(dst_key_t *key, int type, const char *tag, bool epoch,
|
||||
}
|
||||
|
||||
static void
|
||||
writekey(dst_key_t *key, const char *directory, bool write_state)
|
||||
{
|
||||
writekey(dst_key_t *key, const char *directory, bool write_state) {
|
||||
char newname[1024];
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
isc_buffer_t buf;
|
||||
isc_result_t result;
|
||||
int options = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE;
|
||||
int options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE;
|
||||
|
||||
if (write_state) {
|
||||
options |= DST_TYPE_STATE;
|
||||
@@ -182,60 +182,61 @@ writekey(dst_key_t *key, const char *directory, bool write_state)
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
isc_result_t result;
|
||||
const char *engine = NULL;
|
||||
const char *filename = NULL;
|
||||
char *directory = NULL;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char *endp, *p;
|
||||
int ch;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
dns_secalg_t alg = 0;
|
||||
unsigned int size = 0;
|
||||
uint16_t flags = 0;
|
||||
int prepub = -1;
|
||||
int options;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t now;
|
||||
isc_stdtime_t dstime = 0, dnskeytime = 0;
|
||||
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
|
||||
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
||||
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
||||
dst_key_state_t goal = DST_KEY_STATE_NA;
|
||||
dst_key_state_t ds = DST_KEY_STATE_NA;
|
||||
dst_key_state_t dnskey = DST_KEY_STATE_NA;
|
||||
dst_key_state_t krrsig = DST_KEY_STATE_NA;
|
||||
dst_key_state_t zrrsig = DST_KEY_STATE_NA;
|
||||
bool setgoal = false, setds = false, setdnskey = false;
|
||||
bool setkrrsig = false, setzrrsig = false;
|
||||
bool setdstime = false, setdnskeytime = false;
|
||||
bool setkrrsigtime = false, setzrrsigtime = false;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool printcreate = false, printpub = false;
|
||||
bool printact = false, printrev = false;
|
||||
bool printinact = false, printdel = false;
|
||||
bool force = false;
|
||||
bool epoch = false;
|
||||
bool changed = false;
|
||||
bool write_state = false;
|
||||
isc_log_t *log = NULL;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
bool printsyncadd = false, printsyncdel = false;
|
||||
isc_result_t result;
|
||||
const char *engine = NULL;
|
||||
const char *filename = NULL;
|
||||
char *directory = NULL;
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
char *endp, *p;
|
||||
int ch;
|
||||
const char *predecessor = NULL;
|
||||
dst_key_t *prevkey = NULL;
|
||||
dst_key_t *key = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
dns_secalg_t alg = 0;
|
||||
unsigned int size = 0;
|
||||
uint16_t flags = 0;
|
||||
int prepub = -1;
|
||||
int options;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t now;
|
||||
isc_stdtime_t dstime = 0, dnskeytime = 0;
|
||||
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
|
||||
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
||||
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
||||
dst_key_state_t goal = DST_KEY_STATE_NA;
|
||||
dst_key_state_t ds = DST_KEY_STATE_NA;
|
||||
dst_key_state_t dnskey = DST_KEY_STATE_NA;
|
||||
dst_key_state_t krrsig = DST_KEY_STATE_NA;
|
||||
dst_key_state_t zrrsig = DST_KEY_STATE_NA;
|
||||
bool setgoal = false, setds = false, setdnskey = false;
|
||||
bool setkrrsig = false, setzrrsig = false;
|
||||
bool setdstime = false, setdnskeytime = false;
|
||||
bool setkrrsigtime = false, setzrrsigtime = false;
|
||||
bool setpub = false, setact = false;
|
||||
bool setrev = false, setinact = false;
|
||||
bool setdel = false, setttl = false;
|
||||
bool unsetpub = false, unsetact = false;
|
||||
bool unsetrev = false, unsetinact = false;
|
||||
bool unsetdel = false;
|
||||
bool printcreate = false, printpub = false;
|
||||
bool printact = false, printrev = false;
|
||||
bool printinact = false, printdel = false;
|
||||
bool force = false;
|
||||
bool epoch = false;
|
||||
bool changed = false;
|
||||
bool write_state = false;
|
||||
isc_log_t *log = NULL;
|
||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||
bool unsetsyncadd = false, setsyncadd = false;
|
||||
bool unsetsyncdel = false, setsyncdel = false;
|
||||
bool printsyncadd = false, printsyncdel = false;
|
||||
|
||||
options = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_STATE;
|
||||
options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
|
||||
|
||||
if (argc == 1)
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
@@ -243,7 +244,7 @@ main(int argc, char **argv) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -254,35 +255,38 @@ main(int argc, char **argv) {
|
||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
if (setact || unsetact)
|
||||
if (setact || unsetact) {
|
||||
fatal("-A specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
act = strtotime(isc_commandline_argument,
|
||||
now, now, &setact);
|
||||
act = strtotime(isc_commandline_argument, now, now,
|
||||
&setact);
|
||||
unsetact = !setact;
|
||||
break;
|
||||
case 'D':
|
||||
/* -Dsync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncdel || setsyncdel)
|
||||
if (unsetsyncdel || setsyncdel) {
|
||||
fatal("-D sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
syncdel = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncdel);
|
||||
now, now, &setsyncdel);
|
||||
unsetsyncdel = !setsyncdel;
|
||||
break;
|
||||
}
|
||||
/* -Ddnskey ? */
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setdel || unsetdel)
|
||||
if (setdel || unsetdel) {
|
||||
fatal("-D specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
del = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
del = strtotime(isc_commandline_argument, now, now,
|
||||
&setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'd':
|
||||
@@ -294,8 +298,8 @@ main(int argc, char **argv) {
|
||||
setds = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
dstime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdstime);
|
||||
dstime = strtotime(isc_commandline_argument, now, now,
|
||||
&setdstime);
|
||||
break;
|
||||
case 'E':
|
||||
engine = isc_commandline_argument;
|
||||
@@ -311,27 +315,30 @@ main(int argc, char **argv) {
|
||||
goal = strtokeystate(isc_commandline_argument);
|
||||
if (goal != DST_KEY_STATE_NA &&
|
||||
goal != DST_KEY_STATE_HIDDEN &&
|
||||
goal != DST_KEY_STATE_OMNIPRESENT) {
|
||||
goal != DST_KEY_STATE_OMNIPRESENT)
|
||||
{
|
||||
fatal("-g must be either none, hidden, or "
|
||||
"omnipresent");
|
||||
}
|
||||
setgoal = true;
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case 'h':
|
||||
/* Does not return. */
|
||||
usage();
|
||||
case 'I':
|
||||
if (setinact || unsetinact)
|
||||
if (setinact || unsetinact) {
|
||||
fatal("-I specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
inact = strtotime(isc_commandline_argument,
|
||||
now, now, &setinact);
|
||||
inact = strtotime(isc_commandline_argument, now, now,
|
||||
&setinact);
|
||||
unsetinact = !setinact;
|
||||
break;
|
||||
case 'i':
|
||||
@@ -354,8 +361,8 @@ main(int argc, char **argv) {
|
||||
setdnskey = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
dnskeytime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdnskeytime);
|
||||
dnskeytime = strtotime(isc_commandline_argument, now,
|
||||
now, &setdnskeytime);
|
||||
break;
|
||||
case 'L':
|
||||
ttl = strtottl(isc_commandline_argument);
|
||||
@@ -364,23 +371,25 @@ main(int argc, char **argv) {
|
||||
case 'P':
|
||||
/* -Psync ? */
|
||||
if (isoptarg("sync", argv, usage)) {
|
||||
if (unsetsyncadd || setsyncadd)
|
||||
if (unsetsyncadd || setsyncadd) {
|
||||
fatal("-P sync specified more than "
|
||||
"once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
syncadd = strtotime(isc_commandline_argument,
|
||||
now, now, &setsyncadd);
|
||||
now, now, &setsyncadd);
|
||||
unsetsyncadd = !setsyncadd;
|
||||
break;
|
||||
}
|
||||
(void)isoptarg("dnskey", argv, usage);
|
||||
if (setpub || unsetpub)
|
||||
if (setpub || unsetpub) {
|
||||
fatal("-P specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
pub = strtotime(isc_commandline_argument,
|
||||
now, now, &setpub);
|
||||
pub = strtotime(isc_commandline_argument, now, now,
|
||||
&setpub);
|
||||
unsetpub = !setpub;
|
||||
break;
|
||||
case 'p':
|
||||
@@ -436,12 +445,13 @@ main(int argc, char **argv) {
|
||||
} while (*p != '\0');
|
||||
break;
|
||||
case 'R':
|
||||
if (setrev || unsetrev)
|
||||
if (setrev || unsetrev) {
|
||||
fatal("-R specified more than once");
|
||||
}
|
||||
|
||||
changed = true;
|
||||
rev = strtotime(isc_commandline_argument,
|
||||
now, now, &setrev);
|
||||
rev = strtotime(isc_commandline_argument, now, now,
|
||||
&setrev);
|
||||
unsetrev = !setrev;
|
||||
break;
|
||||
case 'r':
|
||||
@@ -453,8 +463,8 @@ main(int argc, char **argv) {
|
||||
setkrrsig = true;
|
||||
/* time */
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
krrsigtime = strtotime(isc_commandline_argument,
|
||||
now, now, &setkrrsigtime);
|
||||
krrsigtime = strtotime(isc_commandline_argument, now,
|
||||
now, &setkrrsigtime);
|
||||
break;
|
||||
case 'S':
|
||||
predecessor = isc_commandline_argument;
|
||||
@@ -470,8 +480,9 @@ main(int argc, char **argv) {
|
||||
version(program);
|
||||
case 'v':
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("-v must be followed by a number");
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (setzrrsig) {
|
||||
@@ -481,52 +492,60 @@ main(int argc, char **argv) {
|
||||
zrrsig = strtokeystate(isc_commandline_argument);
|
||||
setzrrsig = true;
|
||||
(void)isoptarg(isc_commandline_argument, argv, usage);
|
||||
zrrsigtime = strtotime(isc_commandline_argument,
|
||||
now, now, &setzrrsigtime);
|
||||
zrrsigtime = strtotime(isc_commandline_argument, now,
|
||||
now, &setzrrsigtime);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < isc_commandline_index + 1 ||
|
||||
argv[isc_commandline_index] == NULL)
|
||||
argv[isc_commandline_index] == NULL) {
|
||||
fatal("The key file name was not specified");
|
||||
if (argc > isc_commandline_index + 1)
|
||||
}
|
||||
if (argc > isc_commandline_index + 1) {
|
||||
fatal("Extraneous arguments");
|
||||
}
|
||||
|
||||
if ((setgoal || setds || setdnskey || setkrrsig || setzrrsig) &&
|
||||
!write_state)
|
||||
{
|
||||
!write_state) {
|
||||
fatal("Options -g, -d, -k, -r and -z require -s to be set");
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (predecessor != NULL) {
|
||||
int major, minor;
|
||||
|
||||
if (prepub == -1)
|
||||
if (prepub == -1) {
|
||||
prepub = (30 * 86400);
|
||||
}
|
||||
|
||||
if (setpub || unsetpub)
|
||||
if (setpub || unsetpub) {
|
||||
fatal("-S and -P cannot be used together");
|
||||
if (setact || unsetact)
|
||||
}
|
||||
if (setact || unsetact) {
|
||||
fatal("-S and -A cannot be used together");
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(predecessor, directory, options,
|
||||
mctx, &prevkey);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (!dst_key_isprivate(prevkey) && !dst_key_isexternal(prevkey))
|
||||
{
|
||||
fatal("%s is not a private key", filename);
|
||||
}
|
||||
|
||||
name = dst_key_name(prevkey);
|
||||
alg = dst_key_alg(prevkey);
|
||||
@@ -535,57 +554,68 @@ main(int argc, char **argv) {
|
||||
|
||||
dst_key_format(prevkey, keystr, sizeof(keystr));
|
||||
dst_key_getprivateformat(prevkey, &major, &minor);
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
if (major != DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
fatal("Predecessor has incompatible format "
|
||||
"version %d.%d\n\t", major, minor);
|
||||
"version %d.%d\n\t",
|
||||
major, minor);
|
||||
}
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &prevact);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Predecessor has no activation date. "
|
||||
"You must set one before\n\t"
|
||||
"generating a successor.");
|
||||
}
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_INACTIVE,
|
||||
&previnact);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Predecessor has no inactivation date. "
|
||||
"You must set one before\n\t"
|
||||
"generating a successor.");
|
||||
}
|
||||
|
||||
pub = previnact - prepub;
|
||||
act = previnact;
|
||||
|
||||
if ((previnact - prepub) < now && prepub != 0)
|
||||
if ((previnact - prepub) < now && prepub != 0) {
|
||||
fatal("Time until predecessor inactivation is\n\t"
|
||||
"shorter than the prepublication interval. "
|
||||
"Either change\n\t"
|
||||
"predecessor inactivation date, or use the -i "
|
||||
"option to set\n\t"
|
||||
"a shorter prepublication interval.");
|
||||
}
|
||||
|
||||
result = dst_key_gettime(prevkey, DST_TIME_DELETE, &prevdel);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s: warning: Predecessor has no "
|
||||
"removal date;\n\t"
|
||||
"it will remain in the zone "
|
||||
"indefinitely after rollover.\n",
|
||||
program);
|
||||
else if (prevdel < previnact)
|
||||
fprintf(stderr, "%s: warning: Predecessor is "
|
||||
"scheduled to be deleted\n\t"
|
||||
"before it is scheduled to be "
|
||||
"inactive.\n", program);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Predecessor has no "
|
||||
"removal date;\n\t"
|
||||
"it will remain in the zone "
|
||||
"indefinitely after rollover.\n",
|
||||
program);
|
||||
} else if (prevdel < previnact) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Predecessor is "
|
||||
"scheduled to be deleted\n\t"
|
||||
"before it is scheduled to be "
|
||||
"inactive.\n",
|
||||
program);
|
||||
}
|
||||
|
||||
changed = setpub = setact = true;
|
||||
} else {
|
||||
if (prepub < 0)
|
||||
if (prepub < 0) {
|
||||
prepub = 0;
|
||||
}
|
||||
|
||||
if (prepub > 0) {
|
||||
if (setpub && setact && (act - prepub) < pub)
|
||||
if (setpub && setact && (act - prepub) < pub) {
|
||||
fatal("Activation and publication dates "
|
||||
"are closer together than the\n\t"
|
||||
"prepublication interval.");
|
||||
}
|
||||
|
||||
if (setpub && !setact) {
|
||||
setact = true;
|
||||
@@ -595,9 +625,10 @@ main(int argc, char **argv) {
|
||||
pub = act - prepub;
|
||||
}
|
||||
|
||||
if ((act - prepub) < now)
|
||||
if ((act - prepub) < now) {
|
||||
fatal("Time until activation is shorter "
|
||||
"than the\n\tprepublication interval.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,113 +637,137 @@ main(int argc, char **argv) {
|
||||
} else {
|
||||
result = isc_file_splitpath(mctx, argv[isc_commandline_index],
|
||||
&directory, &filename);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("cannot process filename %s: %s",
|
||||
argv[isc_commandline_index],
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
result = dst_key_fromnamedfile(filename, directory, options, mctx,
|
||||
&key);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Invalid keyfile %s: %s",
|
||||
filename, isc_result_totext(result));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("Invalid keyfile %s: %s", filename,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
if (!dst_key_isprivate(key) && !dst_key_isexternal(key))
|
||||
if (!dst_key_isprivate(key) && !dst_key_isexternal(key)) {
|
||||
fatal("%s is not a private key", filename);
|
||||
}
|
||||
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
|
||||
if (predecessor != NULL) {
|
||||
if (!dns_name_equal(name, dst_key_name(key)))
|
||||
if (!dns_name_equal(name, dst_key_name(key))) {
|
||||
fatal("Key name mismatch");
|
||||
if (alg != dst_key_alg(key))
|
||||
}
|
||||
if (alg != dst_key_alg(key)) {
|
||||
fatal("Key algorithm mismatch");
|
||||
if (size != dst_key_size(key))
|
||||
}
|
||||
if (size != dst_key_size(key)) {
|
||||
fatal("Key size mismatch");
|
||||
if (flags != dst_key_flags(key))
|
||||
}
|
||||
if (flags != dst_key_flags(key)) {
|
||||
fatal("Key flags mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
prevdel = previnact = 0;
|
||||
if ((setdel && setinact && del < inact) ||
|
||||
(dst_key_gettime(key, DST_TIME_INACTIVE,
|
||||
&previnact) == ISC_R_SUCCESS &&
|
||||
(dst_key_gettime(key, DST_TIME_INACTIVE, &previnact) ==
|
||||
ISC_R_SUCCESS &&
|
||||
setdel && !setinact && !unsetinact && del < previnact) ||
|
||||
(dst_key_gettime(key, DST_TIME_DELETE,
|
||||
&prevdel) == ISC_R_SUCCESS &&
|
||||
(dst_key_gettime(key, DST_TIME_DELETE, &prevdel) == ISC_R_SUCCESS &&
|
||||
setinact && !setdel && !unsetdel && prevdel < inact) ||
|
||||
(!setdel && !unsetdel && !setinact && !unsetinact &&
|
||||
prevdel != 0 && prevdel < previnact))
|
||||
fprintf(stderr, "%s: warning: Key is scheduled to "
|
||||
"be deleted before it is\n\t"
|
||||
"scheduled to be inactive.\n",
|
||||
(!setdel && !unsetdel && !setinact && !unsetinact && prevdel != 0 &&
|
||||
prevdel < previnact))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key is scheduled to "
|
||||
"be deleted before it is\n\t"
|
||||
"scheduled to be inactive.\n",
|
||||
program);
|
||||
}
|
||||
|
||||
if (force)
|
||||
if (force) {
|
||||
set_keyversion(key);
|
||||
else
|
||||
} else {
|
||||
check_keyversion(key, keystr);
|
||||
}
|
||||
|
||||
if (verbose > 2)
|
||||
if (verbose > 2) {
|
||||
fprintf(stderr, "%s: %s\n", program, keystr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set time values.
|
||||
*/
|
||||
if (setpub)
|
||||
if (setpub) {
|
||||
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
||||
else if (unsetpub)
|
||||
} else if (unsetpub) {
|
||||
dst_key_unsettime(key, DST_TIME_PUBLISH);
|
||||
}
|
||||
|
||||
if (setact)
|
||||
if (setact) {
|
||||
dst_key_settime(key, DST_TIME_ACTIVATE, act);
|
||||
else if (unsetact)
|
||||
} else if (unsetact) {
|
||||
dst_key_unsettime(key, DST_TIME_ACTIVATE);
|
||||
}
|
||||
|
||||
if (setrev) {
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is already "
|
||||
"revoked; changing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_KSK) == 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is not flagged as "
|
||||
"a KSK, but -R was used. Revoking a "
|
||||
"ZSK is legal, but undefined.\n",
|
||||
program, keystr);
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is already "
|
||||
"revoked; changing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_KSK) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is not flagged as "
|
||||
"a KSK, but -R was used. Revoking a "
|
||||
"ZSK is legal, but undefined.\n",
|
||||
program, keystr);
|
||||
}
|
||||
dst_key_settime(key, DST_TIME_REVOKE, rev);
|
||||
} else if (unsetrev) {
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0)
|
||||
fprintf(stderr, "%s: warning: Key %s is already "
|
||||
"revoked; removing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
if ((dst_key_flags(key) & DNS_KEYFLAG_REVOKE) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: warning: Key %s is already "
|
||||
"revoked; removing the revocation date "
|
||||
"will not affect this.\n",
|
||||
program, keystr);
|
||||
}
|
||||
dst_key_unsettime(key, DST_TIME_REVOKE);
|
||||
}
|
||||
|
||||
if (setinact)
|
||||
if (setinact) {
|
||||
dst_key_settime(key, DST_TIME_INACTIVE, inact);
|
||||
else if (unsetinact)
|
||||
} else if (unsetinact) {
|
||||
dst_key_unsettime(key, DST_TIME_INACTIVE);
|
||||
}
|
||||
|
||||
if (setdel)
|
||||
if (setdel) {
|
||||
dst_key_settime(key, DST_TIME_DELETE, del);
|
||||
else if (unsetdel)
|
||||
} else if (unsetdel) {
|
||||
dst_key_unsettime(key, DST_TIME_DELETE);
|
||||
}
|
||||
|
||||
if (setsyncadd)
|
||||
if (setsyncadd) {
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
else if (unsetsyncadd)
|
||||
} else if (unsetsyncadd) {
|
||||
dst_key_unsettime(key, DST_TIME_SYNCPUBLISH);
|
||||
}
|
||||
|
||||
if (setsyncdel)
|
||||
if (setsyncdel) {
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
|
||||
else if (unsetsyncdel)
|
||||
} else if (unsetsyncdel) {
|
||||
dst_key_unsettime(key, DST_TIME_SYNCDELETE);
|
||||
}
|
||||
|
||||
if (setttl)
|
||||
if (setttl) {
|
||||
dst_key_setttl(key, ttl);
|
||||
}
|
||||
|
||||
if (predecessor != NULL && prevkey != NULL) {
|
||||
dst_key_setnum(prevkey, DST_NUM_SUCCESSOR, dst_key_id(key));
|
||||
@@ -786,37 +841,46 @@ main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed && setttl)
|
||||
if (!changed && setttl) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out time values, if -p was used.
|
||||
*/
|
||||
if (printcreate)
|
||||
if (printcreate) {
|
||||
printtime(key, DST_TIME_CREATED, "Created", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printpub)
|
||||
if (printpub) {
|
||||
printtime(key, DST_TIME_PUBLISH, "Publish", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printact)
|
||||
if (printact) {
|
||||
printtime(key, DST_TIME_ACTIVATE, "Activate", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printrev)
|
||||
if (printrev) {
|
||||
printtime(key, DST_TIME_REVOKE, "Revoke", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printinact)
|
||||
if (printinact) {
|
||||
printtime(key, DST_TIME_INACTIVE, "Inactive", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printdel)
|
||||
if (printdel) {
|
||||
printtime(key, DST_TIME_DELETE, "Delete", epoch, stdout);
|
||||
}
|
||||
|
||||
if (printsyncadd)
|
||||
printtime(key, DST_TIME_SYNCPUBLISH, "SYNC Publish",
|
||||
epoch, stdout);
|
||||
if (printsyncadd) {
|
||||
printtime(key, DST_TIME_SYNCPUBLISH, "SYNC Publish", epoch,
|
||||
stdout);
|
||||
}
|
||||
|
||||
if (printsyncdel)
|
||||
printtime(key, DST_TIME_SYNCDELETE, "SYNC Delete",
|
||||
epoch, stdout);
|
||||
if (printsyncdel) {
|
||||
printtime(key, DST_TIME_SYNCDELETE, "SYNC Delete", epoch,
|
||||
stdout);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
writekey(key, directory, write_state);
|
||||
@@ -825,12 +889,14 @@ main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prevkey != NULL)
|
||||
if (prevkey != NULL) {
|
||||
dst_key_free(&prevkey);
|
||||
}
|
||||
dst_key_free(&key);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10)
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
cleanup_logging(&log);
|
||||
isc_mem_free(mctx, directory);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2009-2011, 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2009-2011, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2000-2009, 2011-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2009, 2011-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -239,7 +239,7 @@ Do not modify the SOA serial number\&.
|
||||
.PP
|
||||
\fB"increment"\fR
|
||||
.RS 4
|
||||
Increment the SOA serial number using RFC 1982 arithmetics\&.
|
||||
Increment the SOA serial number using RFC 1982 arithmetic\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB"unixtime"\fR
|
||||
@@ -470,5 +470,5 @@ RFC 4641\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2000-2009, 2011-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2000-2009, 2011-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+801
-645
File diff suppressed because it is too large
Load Diff
@@ -51,6 +51,7 @@
|
||||
<year>2017</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@@ -444,7 +445,7 @@
|
||||
<term><command>"increment"</command></term>
|
||||
<listitem>
|
||||
<para>Increment the SOA serial number using RFC 1982
|
||||
arithmetics.</para>
|
||||
arithmetic.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2000-2009, 2011-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2009, 2011-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
@@ -353,7 +353,7 @@
|
||||
<dt><span class="term"><span class="command"><strong>"increment"</strong></span></span></dt>
|
||||
<dd>
|
||||
<p>Increment the SOA serial number using RFC 1982
|
||||
arithmetics.</p>
|
||||
arithmetic.</p>
|
||||
</dd>
|
||||
<dt><span class="term"><span class="command"><strong>"unixtime"</strong></span></span></dt>
|
||||
<dd>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -120,5 +120,5 @@ RFC 4033\&.
|
||||
\fBInternet Systems Consortium, Inc\&.\fR
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Copyright \(co 2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
||||
+54
-38
@@ -47,9 +47,9 @@
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdatalist.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -71,10 +71,10 @@ const char *program = "dnssec-verify";
|
||||
static isc_stdtime_t now;
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static dns_masterformat_t inputformat = dns_masterformat_text;
|
||||
static dns_db_t *gdb; /* The database */
|
||||
static dns_dbversion_t *gversion; /* The database version */
|
||||
static dns_rdataclass_t gclass; /* The class */
|
||||
static dns_name_t *gorigin; /* The database origin */
|
||||
static dns_db_t *gdb; /* The database */
|
||||
static dns_dbversion_t *gversion; /* The database version */
|
||||
static dns_rdataclass_t gclass; /* The class */
|
||||
static dns_name_t *gorigin; /* The database origin */
|
||||
static bool ignore_kskflag = false;
|
||||
static bool keyset_kskonly = false;
|
||||
|
||||
@@ -105,12 +105,13 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("failed converting name '%s' to dns format: %s",
|
||||
origin, isc_result_totext(result));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed converting name '%s' to dns format: %s", origin,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
rdclass, 0, NULL, db);
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
|
||||
NULL, db);
|
||||
check_result(result, "dns_db_create()");
|
||||
|
||||
result = dns_db_load(*db, file, inputformat, 0);
|
||||
@@ -129,10 +130,10 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
"use -o to specify a different zone origin",
|
||||
origin, file);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
fatal("failed loading zone from '%s': %s",
|
||||
file, isc_result_totext(result));
|
||||
fatal("failed loading zone from '%s': %s", file,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +160,13 @@ usage(void) {
|
||||
fprintf(stderr, "\t-c class (IN)\n");
|
||||
fprintf(stderr, "\t-E engine:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr, "\t\tpath to PKCS#11 provider library "
|
||||
"(default is %s)\n", PK11_LIB_LOCATION);
|
||||
#else
|
||||
fprintf(stderr,
|
||||
"\t\tpath to PKCS#11 provider library "
|
||||
"(default is %s)\n",
|
||||
PK11_LIB_LOCATION);
|
||||
#else /* if USE_PKCS11 */
|
||||
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
|
||||
"not ZSKs\n");
|
||||
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
|
||||
@@ -182,8 +185,7 @@ main(int argc, char *argv[]) {
|
||||
char *endp;
|
||||
int ch;
|
||||
|
||||
#define CMDLINE_FLAGS \
|
||||
"c:E:hm:o:I:qv:Vxz"
|
||||
#define CMDLINE_FLAGS "c:E:hm:o:I:qv:Vxz"
|
||||
|
||||
/*
|
||||
* Process memory debugging argument first.
|
||||
@@ -192,15 +194,23 @@ main(int argc, char *argv[]) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
if (strcasecmp(isc_commandline_argument, "record") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "trace") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "usage") == 0)
|
||||
{
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0)
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0)
|
||||
}
|
||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -213,7 +223,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
#if USE_PKCS11
|
||||
pk11_result_register();
|
||||
#endif
|
||||
#endif /* if USE_PKCS11 */
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -242,8 +252,9 @@ main(int argc, char *argv[]) {
|
||||
case 'v':
|
||||
endp = NULL;
|
||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
if (*endp != '\0') {
|
||||
fatal("verbose level must be numeric");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
@@ -259,9 +270,10 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isc_commandline_option != '?')
|
||||
if (isc_commandline_option != '?') {
|
||||
fprintf(stderr, "%s: invalid argument -%c\n",
|
||||
program, isc_commandline_option);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 'h':
|
||||
@@ -273,16 +285,17 @@ main(int argc, char *argv[]) {
|
||||
version(program);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: unhandled option -%c\n",
|
||||
program, isc_commandline_option);
|
||||
fprintf(stderr, "%s: unhandled option -%c\n", program,
|
||||
isc_commandline_option);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
result = dst_lib_init(mctx, engine);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("could not initialize dst: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
@@ -293,8 +306,9 @@ main(int argc, char *argv[]) {
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
|
||||
if (argc < 1)
|
||||
if (argc < 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
file = argv[0];
|
||||
|
||||
@@ -304,16 +318,18 @@ main(int argc, char *argv[]) {
|
||||
POST(argc);
|
||||
POST(argv);
|
||||
|
||||
if (origin == NULL)
|
||||
if (origin == NULL) {
|
||||
origin = file;
|
||||
}
|
||||
|
||||
if (inputformatstr != NULL) {
|
||||
if (strcasecmp(inputformatstr, "text") == 0)
|
||||
if (strcasecmp(inputformatstr, "text") == 0) {
|
||||
inputformat = dns_masterformat_text;
|
||||
else if (strcasecmp(inputformatstr, "raw") == 0)
|
||||
} else if (strcasecmp(inputformatstr, "raw") == 0) {
|
||||
inputformat = dns_masterformat_raw;
|
||||
else
|
||||
} else {
|
||||
fatal("unknown file format: %s\n", inputformatstr);
|
||||
}
|
||||
}
|
||||
|
||||
gdb = NULL;
|
||||
@@ -326,20 +342,20 @@ main(int argc, char *argv[]) {
|
||||
result = dns_db_newversion(gdb, &gversion);
|
||||
check_result(result, "dns_db_newversion()");
|
||||
|
||||
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL,
|
||||
mctx, ignore_kskflag, keyset_kskonly,
|
||||
report);
|
||||
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL, mctx,
|
||||
ignore_kskflag, keyset_kskonly, report);
|
||||
|
||||
dns_db_closeversion(gdb, &gversion, false);
|
||||
dns_db_detach(&gdb);
|
||||
|
||||
cleanup_logging(&log);
|
||||
dst_lib_destroy();
|
||||
if (verbose > 10)
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
(void) isc_app_finish();
|
||||
(void)isc_app_finish();
|
||||
|
||||
return (result == ISC_R_SUCCESS ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<year>2016</year>
|
||||
<year>2018</year>
|
||||
<year>2019</year>
|
||||
<year>2020</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--
|
||||
- Copyright (C) 2012, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- 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
|
||||
|
||||
+113
-79
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <isc/base32.h>
|
||||
#include <isc/buffer.h>
|
||||
@@ -46,10 +46,10 @@
|
||||
#include <dns/name.h>
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdataclass.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/secalg.h>
|
||||
@@ -59,7 +59,10 @@
|
||||
|
||||
#define KEYSTATES_NVALUES 4
|
||||
static const char *keystates[KEYSTATES_NVALUES] = {
|
||||
"hidden", "rumoured", "omnipresent", "unretentive",
|
||||
"hidden",
|
||||
"rumoured",
|
||||
"omnipresent",
|
||||
"unretentive",
|
||||
};
|
||||
|
||||
int verbose = 0;
|
||||
@@ -77,8 +80,9 @@ fatal(const char *format, ...) {
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
if (fatalcallback != NULL)
|
||||
if (fatalcallback != NULL) {
|
||||
(*fatalcallback)();
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -89,15 +93,17 @@ setfatalcallback(fatalcallback_t *callback) {
|
||||
|
||||
void
|
||||
check_result(isc_result_t result, const char *message) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("%s: %s", message, isc_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vbprintf(int level, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
if (level > verbose)
|
||||
if (level > verbose) {
|
||||
return;
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", program);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
@@ -128,8 +134,9 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
|
||||
isc_log_t *log = NULL;
|
||||
int level;
|
||||
|
||||
if (verbose < 0)
|
||||
if (verbose < 0) {
|
||||
verbose = 0;
|
||||
}
|
||||
switch (verbose) {
|
||||
case 0:
|
||||
/*
|
||||
@@ -163,15 +170,13 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
result = isc_log_createchannel(logconfig, "stderr",
|
||||
ISC_LOG_TOFILEDESC,
|
||||
level,
|
||||
&destination,
|
||||
ISC_LOG_PRINTTAG|ISC_LOG_PRINTLEVEL);
|
||||
result = isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
|
||||
level, &destination,
|
||||
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
|
||||
check_result(result, "isc_log_createchannel()");
|
||||
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
|
||||
NULL, NULL) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
*logp = log;
|
||||
}
|
||||
@@ -185,8 +190,9 @@ cleanup_logging(isc_log_t **logp) {
|
||||
log = *logp;
|
||||
*logp = NULL;
|
||||
|
||||
if (log == NULL)
|
||||
if (log == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
isc_log_destroy(&log);
|
||||
isc_log_setcontext(NULL);
|
||||
@@ -196,35 +202,45 @@ cleanup_logging(isc_log_t **logp) {
|
||||
static isc_stdtime_t
|
||||
time_units(isc_stdtime_t offset, char *suffix, const char *str) {
|
||||
switch (suffix[0]) {
|
||||
case 'Y': case 'y':
|
||||
case 'Y':
|
||||
case 'y':
|
||||
return (offset * (365 * 24 * 3600));
|
||||
case 'M': case 'm':
|
||||
case 'M':
|
||||
case 'm':
|
||||
switch (suffix[1]) {
|
||||
case 'O': case 'o':
|
||||
case 'O':
|
||||
case 'o':
|
||||
return (offset * (30 * 24 * 3600));
|
||||
case 'I': case 'i':
|
||||
case 'I':
|
||||
case 'i':
|
||||
return (offset * 60);
|
||||
case '\0':
|
||||
case '\0':
|
||||
fatal("'%s' ambiguous: use 'mi' for minutes "
|
||||
"or 'mo' for months", str);
|
||||
default:
|
||||
"or 'mo' for months",
|
||||
str);
|
||||
default:
|
||||
fatal("time value %s is invalid", str);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
case 'W': case 'w':
|
||||
case 'W':
|
||||
case 'w':
|
||||
return (offset * (7 * 24 * 3600));
|
||||
case 'D': case 'd':
|
||||
case 'D':
|
||||
case 'd':
|
||||
return (offset * (24 * 3600));
|
||||
case 'H': case 'h':
|
||||
case 'H':
|
||||
case 'h':
|
||||
return (offset * 3600);
|
||||
case 'S': case 's': case '\0':
|
||||
case 'S':
|
||||
case 's':
|
||||
case '\0':
|
||||
return (offset);
|
||||
default:
|
||||
default:
|
||||
fatal("time value %s is invalid", str);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return(0); /* silence compiler warning */
|
||||
return (0); /* silence compiler warning */
|
||||
}
|
||||
|
||||
static inline bool
|
||||
@@ -239,12 +255,14 @@ strtottl(const char *str) {
|
||||
dns_ttl_t ttl;
|
||||
char *endp;
|
||||
|
||||
if (isnone(str))
|
||||
return ((dns_ttl_t) 0);
|
||||
if (isnone(str)) {
|
||||
return ((dns_ttl_t)0);
|
||||
}
|
||||
|
||||
ttl = strtol(str, &endp, 0);
|
||||
if (ttl == 0 && endp == str)
|
||||
if (ttl == 0 && endp == str) {
|
||||
fatal("TTL must be numeric");
|
||||
}
|
||||
ttl = time_units(ttl, endp, orig);
|
||||
return (ttl);
|
||||
}
|
||||
@@ -256,18 +274,16 @@ strtokeystate(const char *str) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
|
||||
if (keystates[i] != NULL &&
|
||||
strcasecmp(str, keystates[i]) == 0) {
|
||||
return (dst_key_state_t) i;
|
||||
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
|
||||
{
|
||||
return ((dst_key_state_t)i);
|
||||
}
|
||||
}
|
||||
fatal("unknown key state");
|
||||
}
|
||||
|
||||
isc_stdtime_t
|
||||
strtotime(const char *str, int64_t now, int64_t base,
|
||||
bool *setp)
|
||||
{
|
||||
strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
|
||||
int64_t val, offset;
|
||||
isc_result_t result;
|
||||
const char *orig = str;
|
||||
@@ -275,16 +291,19 @@ strtotime(const char *str, int64_t now, int64_t base,
|
||||
size_t n;
|
||||
|
||||
if (isnone(str)) {
|
||||
if (setp != NULL)
|
||||
if (setp != NULL) {
|
||||
*setp = false;
|
||||
return ((isc_stdtime_t) 0);
|
||||
}
|
||||
return ((isc_stdtime_t)0);
|
||||
}
|
||||
|
||||
if (setp != NULL)
|
||||
if (setp != NULL) {
|
||||
*setp = true;
|
||||
}
|
||||
|
||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0')
|
||||
return ((isc_stdtime_t) 0);
|
||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
|
||||
return ((isc_stdtime_t)0);
|
||||
}
|
||||
|
||||
/*
|
||||
* We accept times in the following formats:
|
||||
@@ -295,18 +314,19 @@ strtotime(const char *str, int64_t now, int64_t base,
|
||||
*/
|
||||
n = strspn(str, "0123456789");
|
||||
if ((n == 8u || n == 14u) &&
|
||||
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
|
||||
{
|
||||
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
|
||||
char timestr[15];
|
||||
|
||||
strlcpy(timestr, str, sizeof(timestr));
|
||||
timestr[n] = 0;
|
||||
if (n == 8u)
|
||||
if (n == 8u) {
|
||||
strlcat(timestr, "000000", sizeof(timestr));
|
||||
}
|
||||
result = dns_time64_fromtext(timestr, &val);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("time value %s is invalid: %s", orig,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
base = val;
|
||||
str += n;
|
||||
} else if (strncmp(str, "now", 3) == 0) {
|
||||
@@ -314,20 +334,21 @@ strtotime(const char *str, int64_t now, int64_t base,
|
||||
str += 3;
|
||||
}
|
||||
|
||||
if (str[0] == '\0')
|
||||
return ((isc_stdtime_t) base);
|
||||
else if (str[0] == '+') {
|
||||
if (str[0] == '\0') {
|
||||
return ((isc_stdtime_t)base);
|
||||
} else if (str[0] == '+') {
|
||||
offset = strtol(str + 1, &endp, 0);
|
||||
offset = time_units((isc_stdtime_t) offset, endp, orig);
|
||||
offset = time_units((isc_stdtime_t)offset, endp, orig);
|
||||
val = base + offset;
|
||||
} else if (str[0] == '-') {
|
||||
offset = strtol(str + 1, &endp, 0);
|
||||
offset = time_units((isc_stdtime_t) offset, endp, orig);
|
||||
offset = time_units((isc_stdtime_t)offset, endp, orig);
|
||||
val = base - offset;
|
||||
} else
|
||||
} else {
|
||||
fatal("time value %s is invalid", orig);
|
||||
}
|
||||
|
||||
return ((isc_stdtime_t) val);
|
||||
return ((isc_stdtime_t)val);
|
||||
}
|
||||
|
||||
dns_rdataclass_t
|
||||
@@ -336,13 +357,15 @@ strtoclass(const char *str) {
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_result_t result;
|
||||
|
||||
if (str == NULL)
|
||||
return dns_rdataclass_in;
|
||||
if (str == NULL) {
|
||||
return (dns_rdataclass_in);
|
||||
}
|
||||
DE_CONST(str, r.base);
|
||||
r.length = strlen(str);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("unknown class %s", str);
|
||||
}
|
||||
return (rdclass);
|
||||
}
|
||||
|
||||
@@ -355,8 +378,9 @@ strtodsdigest(const char *str) {
|
||||
DE_CONST(str, r.base);
|
||||
r.length = strlen(str);
|
||||
result = dns_dsdigest_fromtext(&alg, &r);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("unknown DS algorithm %s", str);
|
||||
}
|
||||
return (alg);
|
||||
}
|
||||
|
||||
@@ -372,14 +396,14 @@ add_dtype(unsigned int dt) {
|
||||
unsigned i, n;
|
||||
|
||||
/* ensure there is space for a zero terminator */
|
||||
n = sizeof(dtype)/sizeof(dtype[0]) - 1;
|
||||
n = sizeof(dtype) / sizeof(dtype[0]) - 1;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] == dt) {
|
||||
return;
|
||||
}
|
||||
if (dtype[i] == 0) {
|
||||
dtype[i] = dt;
|
||||
qsort(dtype, i+1, 1, cmp_dtype);
|
||||
qsort(dtype, i + 1, 1, cmp_dtype);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -408,14 +432,16 @@ check_keyversion(dst_key_t *key, char *keystr) {
|
||||
dst_key_getprivateformat(key, &major, &minor);
|
||||
INSIST(major <= DST_MAJOR_VERSION); /* invalid private key */
|
||||
|
||||
if (major < DST_MAJOR_VERSION || minor < DST_MINOR_VERSION)
|
||||
if (major < DST_MAJOR_VERSION || minor < DST_MINOR_VERSION) {
|
||||
fatal("Key %s has incompatible format version %d.%d, "
|
||||
"use -f to force upgrade to new version.",
|
||||
keystr, major, minor);
|
||||
if (minor > DST_MINOR_VERSION)
|
||||
}
|
||||
if (minor > DST_MINOR_VERSION) {
|
||||
fatal("Key %s has incompatible format version %d.%d, "
|
||||
"use -f to force downgrade to current version.",
|
||||
keystr, major, minor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -424,9 +450,10 @@ set_keyversion(dst_key_t *key) {
|
||||
dst_key_getprivateformat(key, &major, &minor);
|
||||
INSIST(major <= DST_MAJOR_VERSION);
|
||||
|
||||
if (major != DST_MAJOR_VERSION || minor != DST_MINOR_VERSION)
|
||||
if (major != DST_MAJOR_VERSION || minor != DST_MINOR_VERSION) {
|
||||
dst_key_setprivateformat(key, DST_MAJOR_VERSION,
|
||||
DST_MINOR_VERSION);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the key is from a version older than 1.3, set
|
||||
@@ -441,8 +468,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, bool *exact)
|
||||
{
|
||||
isc_mem_t *mctx, bool *exact) {
|
||||
isc_result_t result;
|
||||
bool conflict = false;
|
||||
dns_dnsseckeylist_t matchkeys;
|
||||
@@ -454,8 +480,9 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
isc_buffer_t fileb;
|
||||
isc_stdtime_t now;
|
||||
|
||||
if (exact != NULL)
|
||||
if (exact != NULL) {
|
||||
*exact = false;
|
||||
}
|
||||
|
||||
id = dst_key_id(dstkey);
|
||||
rid = dst_key_rid(dstkey);
|
||||
@@ -468,23 +495,26 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
*/
|
||||
if (alg == DST_ALG_DH) {
|
||||
isc_buffer_init(&fileb, filename, sizeof(filename));
|
||||
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE,
|
||||
dir, &fileb);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE, dir,
|
||||
&fileb);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (true);
|
||||
}
|
||||
return (isc_file_exists(filename));
|
||||
}
|
||||
|
||||
ISC_LIST_INIT(matchkeys);
|
||||
isc_stdtime_get(&now);
|
||||
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
|
||||
if (result == ISC_R_NOTFOUND)
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
|
||||
key = ISC_LIST_HEAD(matchkeys);
|
||||
if (dst_key_alg(key->key) != alg)
|
||||
if (dst_key_alg(key->key) != alg) {
|
||||
goto next;
|
||||
}
|
||||
|
||||
oldid = dst_key_id(key->key);
|
||||
roldid = dst_key_rid(key->key);
|
||||
@@ -492,20 +522,24 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
if (oldid == rid || roldid == id || id == oldid) {
|
||||
conflict = true;
|
||||
if (id != oldid) {
|
||||
if (verbose > 1)
|
||||
fprintf(stderr, "Key ID %d could "
|
||||
if (verbose > 1) {
|
||||
fprintf(stderr,
|
||||
"Key ID %d could "
|
||||
"collide with %d\n",
|
||||
id, oldid);
|
||||
}
|
||||
} else {
|
||||
if (exact != NULL)
|
||||
if (exact != NULL) {
|
||||
*exact = true;
|
||||
if (verbose > 1)
|
||||
}
|
||||
if (verbose > 1) {
|
||||
fprintf(stderr, "Key ID %d exists\n",
|
||||
id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
next:
|
||||
ISC_LIST_UNLINK(matchkeys, key, link);
|
||||
dns_dnsseckey_destroy(mctx, &key);
|
||||
}
|
||||
@@ -521,7 +555,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||
}
|
||||
|
||||
bool
|
||||
isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
||||
isoptarg(const char *arg, char **argv, void (*usage)(void)) {
|
||||
if (!strcasecmp(isc_commandline_argument, arg)) {
|
||||
if (argv[isc_commandline_index] == NULL) {
|
||||
fprintf(stderr, "%s: missing argument -%c %s\n",
|
||||
@@ -530,7 +564,7 @@ isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
||||
usage();
|
||||
}
|
||||
isc_commandline_argument = argv[isc_commandline_index];
|
||||
/* skip to next arguement */
|
||||
/* skip to next argument */
|
||||
isc_commandline_index++;
|
||||
return (true);
|
||||
}
|
||||
@@ -546,7 +580,7 @@ InitSockets(void) {
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "WSAStartup() failed: %d\n", err);
|
||||
exit(1);
|
||||
@@ -557,4 +591,4 @@ void
|
||||
DestroySockets(void) {
|
||||
WSACleanup();
|
||||
}
|
||||
#endif
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user