Replace custom isc_boolean_t with C standard bool type
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
@@ -128,12 +128,12 @@ create_tables() {
|
||||
|
||||
/* Add a normal key */
|
||||
create_key(257, 3, 5, "example.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
/* Add an initializing managed key */
|
||||
create_key(257, 3, 5, "managed.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key),
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
/* Add a null key */
|
||||
@@ -145,7 +145,7 @@ create_tables() {
|
||||
isc_stdtime_get(&now);
|
||||
ATF_REQUIRE_EQ(dns_ntatable_add(ntatable,
|
||||
str2name("insecure.example"),
|
||||
ISC_FALSE, now, 3600),
|
||||
false, now, 3600),
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ ATF_TC_BODY(add, tc) {
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/*
|
||||
@@ -192,7 +192,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* nextkeynode() should still return NOTFOUND.
|
||||
*/
|
||||
create_key(257, 3, 5, "example.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
@@ -200,7 +200,7 @@ ATF_TC_BODY(add, tc) {
|
||||
/* Add another key (different keydata) */
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
create_key(257, 3, 5, "example.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("example.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -219,9 +219,9 @@ ATF_TC_BODY(add, tc) {
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true);
|
||||
dns_keynode_trust(keynode);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
|
||||
/*
|
||||
@@ -230,13 +230,13 @@ ATF_TC_BODY(add, tc) {
|
||||
* ISC_R_NOTFOUND and that the added key is an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "managed.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true);
|
||||
dns_keytable_detachkeynode(keytable, &next_keynode);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
|
||||
@@ -247,17 +247,17 @@ ATF_TC_BODY(add, tc) {
|
||||
* nodes for managed.com, both containing non-initializing keys.
|
||||
*/
|
||||
create_key(257, 3, 5, "managed.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_SUCCESS);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
keynode = next_keynode;
|
||||
next_keynode = NULL;
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
@@ -268,13 +268,13 @@ ATF_TC_BODY(add, tc) {
|
||||
* that the added key is an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
|
||||
/*
|
||||
@@ -283,13 +283,13 @@ ATF_TC_BODY(add, tc) {
|
||||
* ISC_R_NOTFOUND and that the added key is not an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
dns_keytable_detachkeynode(keytable, &next_keynode);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
|
||||
@@ -300,17 +300,17 @@ ATF_TC_BODY(add, tc) {
|
||||
* nodes for two.com, both containing non-initializing keys.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_SUCCESS);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
keynode = next_keynode;
|
||||
next_keynode = NULL;
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
@@ -322,7 +322,7 @@ ATF_TC_BODY(add, tc) {
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"),
|
||||
&null_keynode), ISC_R_SUCCESS);
|
||||
create_key(257, 3, 5, "null.example", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -360,7 +360,7 @@ ATF_TC_HEAD(delete, tc) {
|
||||
ATF_TC_BODY(delete, tc) {
|
||||
UNUSED(tc);
|
||||
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/* dns_keytable_delete requires exact match */
|
||||
@@ -393,7 +393,7 @@ ATF_TC_BODY(deletekeynode, tc) {
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/* key name doesn't match */
|
||||
@@ -454,7 +454,7 @@ ATF_TC_BODY(find, tc) {
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/*
|
||||
@@ -481,11 +481,11 @@ ATF_TC_BODY(find, tc) {
|
||||
ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable,
|
||||
str2name("example.com"),
|
||||
name), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), true);
|
||||
ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable,
|
||||
str2name("s.example.com"),
|
||||
name), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), true);
|
||||
ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable,
|
||||
str2name("example.org"),
|
||||
name), ISC_R_NOTFOUND);
|
||||
@@ -493,7 +493,7 @@ ATF_TC_BODY(find, tc) {
|
||||
str2name("null.example"),
|
||||
name), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_name_equal(name, str2name("null.example")),
|
||||
ISC_TRUE);
|
||||
true);
|
||||
|
||||
/*
|
||||
* dns_keytable_findkeynode() requires exact name, algorithm, keytag
|
||||
@@ -535,13 +535,13 @@ ATF_TC_HEAD(issecuredomain, tc) {
|
||||
atf_tc_set_md_var(tc, "descr", "check issecuredomain()");
|
||||
}
|
||||
ATF_TC_BODY(issecuredomain, tc) {
|
||||
isc_boolean_t issecure;
|
||||
bool issecure;
|
||||
const char **n;
|
||||
const char *names[] = {"example.com", "sub.example.com",
|
||||
"null.example", "sub.null.example", NULL};
|
||||
|
||||
UNUSED(tc);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/*
|
||||
@@ -556,7 +556,7 @@ ATF_TC_BODY(issecuredomain, tc) {
|
||||
NULL,
|
||||
&issecure),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(issecure, ISC_TRUE);
|
||||
ATF_REQUIRE_EQ(issecure, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -568,7 +568,7 @@ ATF_TC_BODY(issecuredomain, tc) {
|
||||
NULL,
|
||||
&issecure),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(issecure, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(issecure, false);
|
||||
|
||||
destroy_tables();
|
||||
dns_test_end();
|
||||
@@ -581,7 +581,7 @@ ATF_TC_HEAD(dump, tc) {
|
||||
ATF_TC_BODY(dump, tc) {
|
||||
UNUSED(tc);
|
||||
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS);
|
||||
create_tables();
|
||||
|
||||
/*
|
||||
@@ -601,13 +601,13 @@ ATF_TC_HEAD(nta, tc) {
|
||||
ATF_TC_BODY(nta, tc) {
|
||||
isc_result_t result;
|
||||
dst_key_t *key = NULL;
|
||||
isc_boolean_t issecure, covered;
|
||||
bool issecure, covered;
|
||||
dns_view_t *myview = NULL;
|
||||
isc_stdtime_t now;
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
result = dns_test_begin(NULL, ISC_TRUE);
|
||||
result = dns_test_begin(NULL, true);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_test_makeview("view", &myview);
|
||||
@@ -627,26 +627,26 @@ ATF_TC_BODY(nta, tc) {
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
create_key(257, 3, 5, "example", keystr1, &key);
|
||||
result = dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key);
|
||||
result = dns_keytable_add(keytable, false, false, &key);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
result = dns_ntatable_add(ntatable,
|
||||
str2name("insecure.example"),
|
||||
ISC_FALSE, now, 1);
|
||||
false, now, 1);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
/* Should be secure */
|
||||
result = dns_view_issecuredomain(myview,
|
||||
str2name("test.secure.example"),
|
||||
now, ISC_TRUE, &issecure);
|
||||
now, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(issecure);
|
||||
|
||||
/* Should not be secure */
|
||||
result = dns_view_issecuredomain(myview,
|
||||
str2name("test.insecure.example"),
|
||||
now, ISC_TRUE, &issecure);
|
||||
now, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(!issecure);
|
||||
|
||||
@@ -663,22 +663,22 @@ ATF_TC_BODY(nta, tc) {
|
||||
/* As of now + 2, the NTA should be clear */
|
||||
result = dns_view_issecuredomain(myview,
|
||||
str2name("test.insecure.example"),
|
||||
now + 2, ISC_TRUE, &issecure);
|
||||
now + 2, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(issecure);
|
||||
|
||||
/* Now check deletion */
|
||||
result = dns_view_issecuredomain(myview, str2name("test.new.example"),
|
||||
now, ISC_TRUE, &issecure);
|
||||
now, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(issecure);
|
||||
|
||||
result = dns_ntatable_add(ntatable, str2name("new.example"),
|
||||
ISC_FALSE, now, 3600);
|
||||
false, now, 3600);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_view_issecuredomain(myview, str2name("test.new.example"),
|
||||
now, ISC_TRUE, &issecure);
|
||||
now, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(!issecure);
|
||||
|
||||
@@ -686,7 +686,7 @@ ATF_TC_BODY(nta, tc) {
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_view_issecuredomain(myview, str2name("test.new.example"),
|
||||
now, ISC_TRUE, &issecure);
|
||||
now, true, &issecure);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK(issecure);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user