2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Merge branch '46-enforce-clang-format-rules' into 'master'

Start enforcing the clang-format rules on changed files

Closes #46

See merge request isc-projects/bind9!3063
This commit is contained in:
Ondřej Surý 2020-02-14 08:45:45 +00:00
commit a04cdde45d
308 changed files with 3083 additions and 2578 deletions

View File

@ -15,7 +15,7 @@ BraceWrapping:
SplitEmptyFunction: true SplitEmptyFunction: true
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false IndentCaseLabels: false
AlwaysBreakAfterReturnType: TopLevelDefinitions AlwaysBreakAfterReturnType: All
Cpp11BracedListStyle: false Cpp11BracedListStyle: false
ColumnLimit: 80 ColumnLimit: 80
AlignAfterOpenBracket: Align AlignAfterOpenBracket: Align

61
.clang-format.headers Normal file
View File

@ -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: 10
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8

View File

@ -17,9 +17,11 @@ variables:
MAKE: make MAKE: make
CONFIGURE: ./configure CONFIGURE: ./configure
CLANG: clang-9
SCAN_BUILD: scan-build-9 SCAN_BUILD: scan-build-9
SYMBOLIZER: /usr/lib/llvm-9/bin/llvm-symbolizer SYMBOLIZER: /usr/lib/llvm-9/bin/llvm-symbolizer
ASAN_SYMBOLIZER_PATH: "$SYMBOLIZER" ASAN_SYMBOLIZER_PATH: "$SYMBOLIZER"
CLANG_FORMAT: clang-format-11
CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra
@ -384,6 +386,12 @@ misc:sid:amd64:
expire_in: "1 day" expire_in: "1 day"
when: on_failure 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: 🐞:sid:amd64:
<<: *precheck_job <<: *precheck_job
<<: *debian_buster_amd64_image <<: *debian_buster_amd64_image
@ -618,7 +626,7 @@ scan-build:buster:amd64:
<<: *debian_buster_amd64_image <<: *debian_buster_amd64_image
stage: postcheck stage: postcheck
variables: variables:
CC: clang-9 CC: "${CLANG}"
CFLAGS: "${CFLAGS_COMMON}" CFLAGS: "${CFLAGS_COMMON}"
CONFIGURE: "${SCAN_BUILD} ./configure" CONFIGURE: "${SCAN_BUILD} ./configure"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2" EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
@ -878,7 +886,7 @@ tsan:buster:amd64:
<<: *debian_buster_amd64_image <<: *debian_buster_amd64_image
<<: *build_job <<: *build_job
variables: variables:
CC: clang-9 CC: "${CLANG}"
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0"
LDFLAGS: "-fsanitize=thread" LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock" EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock"

View File

@ -56,7 +56,8 @@ isc_log_t *logc = NULL;
} while (0) } while (0)
/*% usage */ /*% usage */
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -62,7 +62,8 @@ static enum { progmode_check, progmode_compile } progmode;
} \ } \
} while (0) } while (0)
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -127,11 +127,11 @@ static char anchortext[] = TRUST_ANCHORS;
/* /*
* Static function prototypes * Static function prototypes
*/ */
static isc_result_t get_reverse(char *reverse, size_t len, char *value, static isc_result_t
bool strict); get_reverse(char *reverse, size_t len, char *value, bool strict);
static isc_result_t parse_uint(uint32_t *uip, const char *value, uint32_t max, static isc_result_t
const char *desc); parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
static void static void
usage(void) { usage(void) {
@ -205,7 +205,8 @@ usage(void) {
exit(1); exit(1);
} }
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ...) ISC_PLATFORM_NORETURN_PRE static void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
static void static void
@ -221,7 +222,8 @@ fatal(const char *format, ...) {
exit(1); exit(1);
} }
static void warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
static void static void
warn(const char *format, ...) { warn(const char *format, ...) {
@ -241,7 +243,8 @@ static isc_logcategory_t categories[] = { { "delv", 0 }, { NULL, 0 } };
static isc_logmodule_t modules[] = { { "delv", 0 }, { NULL, 0 } }; static isc_logmodule_t modules[] = { { "delv", 0 }, { NULL, 0 } };
static void delv_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); static void
delv_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
static void static void
delv_log(int level, const char *fmt, ...) { delv_log(int level, const char *fmt, ...) {

View File

@ -107,7 +107,8 @@ usage(void) {
fprintf(stderr, "Press <Help> for complete list of options\n"); fprintf(stderr, "Press <Help> for complete list of options\n");
} }
#else /* if TARGET_OS_IPHONE */ #else /* if TARGET_OS_IPHONE */
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -122,10 +122,12 @@ int lookup_counter = 0;
static char servercookie[256]; static char servercookie[256];
#ifdef HAVE_LIBIDN2 #ifdef HAVE_LIBIDN2
static void idn_locale_to_ace(const char *src, char *dst, size_t dstlen); static void
static void idn_ace_to_locale(const char *src, char **dst); idn_locale_to_ace(const char *src, char *dst, size_t dstlen);
static isc_result_t idn_output_filter(isc_buffer_t *buffer, static void
unsigned int used_org); idn_ace_to_locale(const char *src, char **dst);
static isc_result_t
idn_output_filter(isc_buffer_t *buffer, unsigned int used_org);
#endif /* HAVE_LIBIDN2 */ #endif /* HAVE_LIBIDN2 */
isc_socket_t *keep = NULL; isc_socket_t *keep = NULL;
@ -227,19 +229,26 @@ void (*dighost_shutdown)(void);
/* forward declarations */ /* forward declarations */
static void cancel_lookup(dig_lookup_t *lookup); static void
cancel_lookup(dig_lookup_t *lookup);
static void recv_done(isc_task_t *task, isc_event_t *event); static void
recv_done(isc_task_t *task, isc_event_t *event);
static void send_udp(dig_query_t *query); static void
send_udp(dig_query_t *query);
static void connect_timeout(isc_task_t *task, isc_event_t *event); static void
connect_timeout(isc_task_t *task, isc_event_t *event);
static void launch_next_query(dig_query_t *query, bool include_question); static void
launch_next_query(dig_query_t *query, bool include_question);
static void check_next_lookup(dig_lookup_t *lookup); static void
check_next_lookup(dig_lookup_t *lookup);
static bool next_origin(dig_lookup_t *oldlookup); static bool
next_origin(dig_lookup_t *oldlookup);
static int static int
count_dots(char *string) { count_dots(char *string) {
@ -2718,7 +2727,8 @@ force_timeout(dig_query_t *query) {
} }
} }
static void connect_done(isc_task_t *task, isc_event_t *event); static void
connect_done(isc_task_t *task, isc_event_t *event);
/*% /*%
* Unlike send_udp, this can't be called multiple times with the same * Unlike send_udp, this can't be called multiple times with the same

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -124,8 +124,10 @@ static const char *rtypetext[] = {
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0])) #define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
static void flush_lookup_list(void); static void
static void getinput(isc_task_t *task, isc_event_t *event); flush_lookup_list(void);
static void
getinput(isc_task_t *task, isc_event_t *event);
static char * static char *
rcode_totext(dns_rcode_t rcode) { rcode_totext(dns_rcode_t rcode) {
@ -876,7 +878,8 @@ get_next_command(void) {
isc_mem_free(mctx, buf); isc_mem_free(mctx, buf);
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -121,8 +121,8 @@ typedef struct keyinfo {
} keyinfo_t; } keyinfo_t;
/* A replaceable function that can generate a DS RRset from some input */ /* A replaceable function that can generate a DS RRset from some input */
typedef isc_result_t ds_maker_func_t(dns_rdatalist_t *dslist, isc_buffer_t *buf, typedef isc_result_t
dns_rdata_t *rdata); ds_maker_func_t(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *rdata);
static dns_rdataset_t cdnskey_set, cdnskey_sig; static dns_rdataset_t cdnskey_set, cdnskey_sig;
static dns_rdataset_t cds_set, cds_sig; static dns_rdataset_t cds_set, cds_sig;
@ -1016,7 +1016,8 @@ nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
} }
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -320,7 +320,8 @@ emits(bool showall, bool cds, dns_rdata_t *rdata) {
} }
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -264,7 +264,8 @@ emit(const char *dir, dns_rdata_t *rdata) {
dst_key_free(&key); dst_key_free(&key);
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -46,7 +46,8 @@
const char *program = "dnssec-keyfromlabel"; const char *program = "dnssec-keyfromlabel";
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -69,9 +69,11 @@ const char *program = "dnssec-keygen";
isc_log_t *lctx = NULL; isc_log_t *lctx = NULL;
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void progress(int p); static void
progress(int p);
struct keygen_ctx { struct keygen_ctx {
const char *predecessor; const char *predecessor;

View File

@ -40,7 +40,8 @@ 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; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -43,7 +43,8 @@ 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; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -186,7 +186,8 @@ static dns_ttl_t maxttl = 0;
UNLOCK(&statslock); \ UNLOCK(&statslock); \
} }
static void sign(isc_task_t *task, isc_event_t *event); static void
sign(isc_task_t *task, isc_event_t *event);
/*% /*%
* Store a copy of 'name' in 'fzonecut' and return a pointer to that copy. * Store a copy of 'name' in 'fzonecut' and return a pointer to that copy.
@ -3123,7 +3124,8 @@ print_version(FILE *fp) {
fprintf(fp, "; dnssec_signzone version " VERSION "\n"); fprintf(fp, "; dnssec_signzone version " VERSION "\n");
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -137,7 +137,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
} }
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {

View File

@ -32,12 +32,18 @@
typedef struct builtin builtin_t; typedef struct builtin builtin_t;
static isc_result_t do_version_lookup(dns_sdblookup_t *lookup); static isc_result_t
static isc_result_t do_hostname_lookup(dns_sdblookup_t *lookup); do_version_lookup(dns_sdblookup_t *lookup);
static isc_result_t do_authors_lookup(dns_sdblookup_t *lookup); static isc_result_t
static isc_result_t do_id_lookup(dns_sdblookup_t *lookup); do_hostname_lookup(dns_sdblookup_t *lookup);
static isc_result_t do_empty_lookup(dns_sdblookup_t *lookup); static isc_result_t
static isc_result_t do_dns64_lookup(dns_sdblookup_t *lookup); do_authors_lookup(dns_sdblookup_t *lookup);
static isc_result_t
do_id_lookup(dns_sdblookup_t *lookup);
static isc_result_t
do_empty_lookup(dns_sdblookup_t *lookup);
static isc_result_t
do_dns64_lookup(dns_sdblookup_t *lookup);
/* /*
* We can't use function pointers as the db_data directly * We can't use function pointers as the db_data directly

View File

@ -107,8 +107,10 @@ struct named_controls {
isccc_symtab_t *symtab; isccc_symtab_t *symtab;
}; };
static void control_newconn(isc_task_t *task, isc_event_t *event); static void
static void control_recvmessage(isc_task_t *task, isc_event_t *event); control_newconn(isc_task_t *task, isc_event_t *event);
static void
control_recvmessage(isc_task_t *task, isc_event_t *event);
#define CLOCKSKEW 300 #define CLOCKSKEW 300

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -302,9 +302,9 @@ library_fatal_error(const char *file, int line, const char *format,
exit(1); exit(1);
} }
static void library_unexpected_error(const char *file, int line, static void
const char *format, va_list args) library_unexpected_error(const char *file, int line, const char *format,
ISC_FORMAT_PRINTF(3, 0); va_list args) ISC_FORMAT_PRINTF(3, 0);
static void static void
library_unexpected_error(const char *file, int line, const char *format, library_unexpected_error(const char *file, int line, const char *format,

View File

@ -383,74 +383,86 @@ ISC_PLATFORM_NORETURN_PRE static void
fatal(named_server_t *server, const char *msg, fatal(named_server_t *server, const char *msg,
isc_result_t result) ISC_PLATFORM_NORETURN_POST; isc_result_t result) ISC_PLATFORM_NORETURN_POST;
static void named_server_reload(isc_task_t *task, isc_event_t *event); static void
named_server_reload(isc_task_t *task, isc_event_t *event);
static isc_result_t ns_listenelt_fromconfig(const cfg_obj_t *listener, static isc_result_t
const cfg_obj_t *config, ns_listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
cfg_aclconfctx_t *actx, cfg_aclconfctx_t *actx, isc_mem_t *mctx,
isc_mem_t *mctx, uint16_t family, uint16_t family, ns_listenelt_t **target);
ns_listenelt_t **target); static isc_result_t
static isc_result_t ns_listenlist_fromconfig(const cfg_obj_t *listenlist, ns_listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config,
const cfg_obj_t *config, cfg_aclconfctx_t *actx, isc_mem_t *mctx,
cfg_aclconfctx_t *actx, uint16_t family, ns_listenlist_t **target);
isc_mem_t *mctx, uint16_t family,
ns_listenlist_t **target);
static isc_result_t configure_forward(const cfg_obj_t *config, dns_view_t *view, static isc_result_t
const dns_name_t *origin, configure_forward(const cfg_obj_t *config, dns_view_t *view,
const cfg_obj_t *forwarders, const dns_name_t *origin, const cfg_obj_t *forwarders,
const cfg_obj_t *forwardtype); const cfg_obj_t *forwardtype);
static isc_result_t configure_alternates(const cfg_obj_t *config, static isc_result_t
dns_view_t *view, configure_alternates(const cfg_obj_t *config, dns_view_t *view,
const cfg_obj_t *alternates); const cfg_obj_t *alternates);
static isc_result_t configure_zone(const cfg_obj_t *config, static isc_result_t
const cfg_obj_t *zconfig, configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
const cfg_obj_t *vconfig, isc_mem_t *mctx, const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
dns_view_t *view, dns_viewlist_t *viewlist, dns_viewlist_t *viewlist, dns_kasplist_t *kasplist,
dns_kasplist_t *kasplist, cfg_aclconfctx_t *aclconf, bool added, bool old_rpz_ok,
cfg_aclconfctx_t *aclconf, bool added, bool modify);
bool old_rpz_ok, bool modify);
static isc_result_t configure_newzones(dns_view_t *view, cfg_obj_t *config, static isc_result_t
cfg_obj_t *vconfig, isc_mem_t *mctx, configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
cfg_aclconfctx_t *actx); isc_mem_t *mctx, cfg_aclconfctx_t *actx);
static isc_result_t add_keydata_zone(dns_view_t *view, const char *directory, static isc_result_t
isc_mem_t *mctx); add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx);
static void end_reserved_dispatches(named_server_t *server, bool all); static void
end_reserved_dispatches(named_server_t *server, bool all);
static void newzone_cfgctx_destroy(void **cfgp); static void
newzone_cfgctx_destroy(void **cfgp);
static inline isc_result_t putstr(isc_buffer_t **b, const char *str); static inline isc_result_t
putstr(isc_buffer_t **b, const char *str);
static isc_result_t putmem(isc_buffer_t **b, const char *str, size_t len); static isc_result_t
putmem(isc_buffer_t **b, const char *str, size_t len);
static isc_result_t putuint8(isc_buffer_t **b, uint8_t val); static isc_result_t
putuint8(isc_buffer_t **b, uint8_t val);
static inline isc_result_t putnull(isc_buffer_t **b); static inline isc_result_t
putnull(isc_buffer_t **b);
static int count_zones(const cfg_obj_t *conf); static int
count_zones(const cfg_obj_t *conf);
#ifdef HAVE_LMDB #ifdef HAVE_LMDB
static isc_result_t migrate_nzf(dns_view_t *view); static isc_result_t
migrate_nzf(dns_view_t *view);
static isc_result_t nzd_writable(dns_view_t *view); static isc_result_t
nzd_writable(dns_view_t *view);
static isc_result_t nzd_open(dns_view_t *view, unsigned int flags, static isc_result_t
MDB_txn **txnp, MDB_dbi *dbi); nzd_open(dns_view_t *view, unsigned int flags, MDB_txn **txnp, MDB_dbi *dbi);
static isc_result_t nzd_env_reopen(dns_view_t *view); static isc_result_t
nzd_env_reopen(dns_view_t *view);
static void nzd_env_close(dns_view_t *view); static void
nzd_env_close(dns_view_t *view);
static isc_result_t nzd_close(MDB_txn **txnp, bool commit); static isc_result_t
nzd_close(MDB_txn **txnp, bool commit);
static isc_result_t nzd_count(dns_view_t *view, int *countp); static isc_result_t
nzd_count(dns_view_t *view, int *countp);
#else /* ifdef HAVE_LMDB */ #else /* ifdef HAVE_LMDB */
static isc_result_t nzf_append(dns_view_t *view, const cfg_obj_t *zconfig); static isc_result_t
nzf_append(dns_view_t *view, const cfg_obj_t *zconfig);
#endif /* ifdef HAVE_LMDB */ #endif /* ifdef HAVE_LMDB */
/*% /*%

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -30,8 +30,10 @@ static char ConsoleTitle[128];
/* /*
* Forward declarations * Forward declarations
*/ */
void ServiceControl(DWORD dwCtrlCode); void
int bindmain(int, char *[]); /* From main.c */ ServiceControl(DWORD dwCtrlCode);
int
bindmain(int, char *[]); /* From main.c */
/* /*
* Initialize the Service by registering it. * Initialize the Service by registering it.

View File

@ -181,16 +181,21 @@ typedef struct nsu_requestinfo {
isc_sockaddr_t *addr; isc_sockaddr_t *addr;
} nsu_requestinfo_t; } nsu_requestinfo_t;
static void sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, static void
sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
dns_request_t **request); dns_request_t **request);
static void send_update(dns_name_t *zonename, isc_sockaddr_t *master); static void
send_update(dns_name_t *zonename, isc_sockaddr_t *master);
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ...) ISC_PLATFORM_NORETURN_PRE static void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
static void debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
static void ddebug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void
ddebug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
#ifdef GSSAPI #ifdef GSSAPI
static dns_fixedname_t fkname; static dns_fixedname_t fkname;
@ -204,14 +209,19 @@ typedef struct nsu_gssinfo {
gss_ctx_id_t context; gss_ctx_id_t context;
} nsu_gssinfo_t; } nsu_gssinfo_t;
static void failed_gssrequest(); static void
static void start_gssrequest(dns_name_t *master); failed_gssrequest();
static void send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, static void
start_gssrequest(dns_name_t *master);
static void
send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
dns_request_t **request, gss_ctx_id_t context); dns_request_t **request, gss_ctx_id_t context);
static void recvgss(isc_task_t *task, isc_event_t *event); static void
recvgss(isc_task_t *task, isc_event_t *event);
#endif /* GSSAPI */ #endif /* GSSAPI */
static void error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void
error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
#define STATUS_MORE (uint16_t)0 #define STATUS_MORE (uint16_t)0
#define STATUS_SEND (uint16_t)1 #define STATUS_SEND (uint16_t)1

View File

@ -110,18 +110,18 @@ typedef struct filter_instance {
/* /*
* Forward declarations of functions referenced in install_hooks(). * Forward declarations of functions referenced in install_hooks().
*/ */
static ns_hookresult_t filter_qctx_initialize(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t filter_respond_begin(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t filter_respond_any_found(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t filter_prep_response_begin(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t filter_query_done_send(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t filter_qctx_destroy(void *arg, void *cbdata, static ns_hookresult_t
isc_result_t *resp); filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp);
/*% /*%
* Register the functions to be called at each hook point in 'hooktable', using * Register the functions to be called at each hook point in 'hooktable', using

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -84,7 +84,8 @@ static uint32_t serial;
static bool quiet = false; static bool quiet = false;
static bool showresult = false; static bool showresult = false;
static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task); static void
rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
ISC_PLATFORM_NORETURN_PRE static void ISC_PLATFORM_NORETURN_PRE static void
usage(int status) ISC_PLATFORM_NORETURN_POST; usage(int status) ISC_PLATFORM_NORETURN_POST;

View File

@ -56,7 +56,8 @@ static isc_mutex_t client_lock;
static isc_stdtime_t now; static isc_stdtime_t now;
static dns_adb_t *adb; static dns_adb_t *adb;
static void check_result(isc_result_t result, const char *format, ...) static void
check_result(isc_result_t result, const char *format, ...)
ISC_FORMAT_PRINTF(2, 3); ISC_FORMAT_PRINTF(2, 3);
static void static void

View File

@ -45,7 +45,8 @@ static isc_log_t *lctx;
static isc_logconfig_t *lcfg; static isc_logconfig_t *lcfg;
static unsigned int level = 0; static unsigned int level = 0;
static void adb_callback(isc_task_t *task, isc_event_t *event); static void
adb_callback(isc_task_t *task, isc_event_t *event);
static void static void
log_init(void) { log_init(void) {

View File

@ -72,9 +72,12 @@ static gss_ctx_id_t *gssctxp = &gssctx;
#define PORT 53 #define PORT 53
#define TIMEOUT 30 #define TIMEOUT 30
static void initctx1(isc_task_t *task, isc_event_t *event); static void
static void sendquery(isc_task_t *task, isc_event_t *event); initctx1(isc_task_t *task, isc_event_t *event);
static void setup(); static void
sendquery(isc_task_t *task, isc_event_t *event);
static void
setup();
static void static void
console(isc_task_t *task, isc_event_t *event) { console(isc_task_t *task, isc_event_t *event) {

View File

@ -24,9 +24,12 @@ isc_timermgr_t *timermgr = NULL;
isc_task_t *g_task = NULL; isc_task_t *g_task = NULL;
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
static void utick(isc_task_t *task, isc_event_t *event); static void
static void shutdown_rl(isc_task_t *task, isc_event_t *event); utick(isc_task_t *task, isc_event_t *event);
static void shutdown_all(isc_task_t *task, isc_event_t *event); static void
shutdown_rl(isc_task_t *task, isc_event_t *event);
static void
shutdown_all(isc_task_t *task, isc_event_t *event);
typedef struct { typedef struct {
int milliseconds; int milliseconds;

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -61,7 +61,8 @@
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */ #endif /* ifndef CLOCK_REALTIME */
static int clock_gettime(int32_t id, struct timespec *tp); static int
clock_gettime(int32_t id, struct timespec *tp);
static int static int
clock_gettime(int32_t id, struct timespec *tp) { clock_gettime(int32_t id, struct timespec *tp) {

View File

@ -59,7 +59,8 @@ struct record {
#define MAX_RECORDS 100 #define MAX_RECORDS 100
typedef void log_t(int level, const char *fmt, ...); typedef void
log_t(int level, const char *fmt, ...);
struct dlz_example_data { struct dlz_example_data {
char *zone_name; char *zone_name;

View File

@ -46,7 +46,8 @@ typedef struct {
} librpz_emsg_t; } librpz_emsg_t;
#endif /* ifdef USE_DNSRPS */ #endif /* ifdef USE_DNSRPS */
static bool link_dnsrps(librpz_emsg_t *emsg); static bool
link_dnsrps(librpz_emsg_t *emsg);
#define USAGE "usage: [-ap] [-n domain] [-w sec.onds]\n" #define USAGE "usage: [-ap] [-n domain] [-w sec.onds]\n"

View File

@ -29,9 +29,11 @@ isc_mem_t *mctx = NULL;
bool printmemstats = false; bool printmemstats = false;
bool dorender = false; bool dorender = false;
static void process_message(isc_buffer_t *source); static void
process_message(isc_buffer_t *source);
static isc_result_t printmessage(dns_message_t *msg); static isc_result_t
printmessage(dns_message_t *msg);
static inline void static inline void
CHECKRESULT(isc_result_t result, const char *msg) { CHECKRESULT(isc_result_t result, const char *msg) {

View File

@ -68,8 +68,8 @@ const char *program = "dnstap-read";
} \ } \
} while (0) } while (0)
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ISC_PLATFORM_NORETURN_PRE static void
...) ISC_PLATFORM_NORETURN_POST; fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
static void static void
fatal(const char *format, ...) { fatal(const char *format, ...) {

View File

@ -781,7 +781,8 @@ sendqueries(isc_task_t *task, isc_event_t *event) {
return; return;
} }
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {
@ -891,7 +892,8 @@ help(void) {
stdout); stdout);
} }
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ...) ISC_PLATFORM_NORETURN_PRE static void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
static void static void

View File

@ -32,7 +32,8 @@ static isc_lex_t *lex;
static isc_lexspecials_t specials; static isc_lexspecials_t specials;
ISC_PLATFORM_NORETURN_PRE static void usage(void) ISC_PLATFORM_NORETURN_POST; ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void static void
usage(void) { usage(void) {
@ -48,8 +49,8 @@ usage(void) {
exit(0); exit(0);
} }
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ISC_PLATFORM_NORETURN_PRE static void
...) ISC_PLATFORM_NORETURN_POST; fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
static void static void
fatal(const char *format, ...) { fatal(const char *format, ...) {

View File

@ -32,8 +32,8 @@
const char *program = "nsec3hash"; const char *program = "nsec3hash";
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format, ISC_PLATFORM_NORETURN_PRE static void
...) ISC_PLATFORM_NORETURN_POST; fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
static void static void
fatal(const char *format, ...) { fatal(const char *format, ...) {
@ -63,9 +63,9 @@ usage() {
exit(1); exit(1);
} }
typedef void nsec3printer(unsigned algo, unsigned flags, unsigned iters, typedef void
const char *saltstr, const char *domain, nsec3printer(unsigned algo, unsigned flags, unsigned iters, const char *saltstr,
const char *digest); const char *domain, const char *digest);
static void static void
nsec3hash(nsec3printer *nsec3print, const char *algostr, const char *flagstr, nsec3hash(nsec3printer *nsec3print, const char *algostr, const char *flagstr,

View File

@ -23,10 +23,13 @@
int int
GetAccountPrivileges(char *name, /* Name of Account */ GetAccountPrivileges(char *name, /* Name of Account */
wchar_t **PrivList, /* List of Privileges returned */ wchar_t **PrivList, /* List of Privileges returned */
unsigned int *PrivCount, /* Count of Privileges returned */ unsigned int *PrivCount, /* Count of Privileges
char **Groups, /* List of Groups to which account belongs returned */
char **Groups, /* List of Groups to which account
* belongs
*/
unsigned int *totalGroups, /* Count of Groups returned
*/ */
unsigned int *totalGroups, /* Count of Groups returned */
int maxGroups /* Maximum number of Groups to return */ int maxGroups /* Maximum number of Groups to return */
); );

View File

@ -11,8 +11,7 @@
#define CONCAT(a, b) a##b #define CONCAT(a, b) a##b
#define DNSCONF_SET_STRING(FIELD) \ #define DNSCONF_SET_STRING(FIELD) \
void CONCAT(DNSConf_set, FIELD)(DNSConf * cfg, const char *arg) \ void CONCAT(DNSConf_set, FIELD)(DNSConf * cfg, const char *arg) { \
{ \
DBGPRINT("inside DNSConf_set" #FIELD "\n"); \ DBGPRINT("inside DNSConf_set" #FIELD "\n"); \
\ \
if (!DNSConf_initctx(cfg)) \ if (!DNSConf_initctx(cfg)) \
@ -29,8 +28,7 @@
} }
#define DNSCONF_GET_STRING(FIELD) \ #define DNSCONF_GET_STRING(FIELD) \
char *CONCAT(DNSConf_get, FIELD)(DNSConf * cfg) \ char *CONCAT(DNSConf_get, FIELD)(DNSConf * cfg) { \
{ \
char *result = NULL; \ char *result = NULL; \
isc_result_t tmpres; \ isc_result_t tmpres; \
\ \

View File

@ -69,35 +69,47 @@
/* shut up compiler warnings about no previous prototype */ /* shut up compiler warnings about no previous prototype */
static void show_usage(void); static void
show_usage(void);
int getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey); int
getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
int gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey); int
gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
void bdb_cleanup(void); void
bdb_cleanup(void);
isc_result_t bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, isc_result_t
int flags); bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags);
void put_data(bool dns_data, char *input_key, char *input_data); void
put_data(bool dns_data, char *input_key, char *input_data);
void insert_data(void); void
insert_data(void);
isc_result_t openBDB(void); isc_result_t
openBDB(void);
isc_result_t open_lexer(void); isc_result_t
open_lexer(void);
void close_lexer(void); void
close_lexer(void);
isc_result_t bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, isc_result_t
DBT *bdbdata); bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata);
void operation_add(void); void
operation_add(void);
void operation_bulk(void); void
operation_bulk(void);
void operation_listOrDelete(bool dlt); void
operation_listOrDelete(bool dlt);
/*% /*%
* Maximum length of a single data line that * Maximum length of a single data line that
@ -247,8 +259,7 @@ isc_buffer_t lex_buffer; /*%< buffer for lexer during add operation */
*/ */
static void static void
show_usage(void) show_usage(void) {
{
fprintf(stderr, "\n\n\ fprintf(stderr, "\n\n\
---Usage:---------------------------------------------------------------------\ ---Usage:---------------------------------------------------------------------\
\n\n\ \n\n\
@ -292,8 +303,7 @@ c mynm.com 192.168.0.10\n\
/*% BDB callback to create zone secondary index */ /*% BDB callback to create zone secondary index */
int int
getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) {
{
char *token, *last; char *token, *last;
UNUSED(dbp); UNUSED(dbp);
@ -319,8 +329,7 @@ getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey)
*/ */
int int
gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) {
{
char *token, *last; char *token, *last;
UNUSED(dbp); UNUSED(dbp);
@ -354,8 +363,7 @@ gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey)
*/ */
void void
bdb_cleanup(void) bdb_cleanup(void) {
{
/* close cursors */ /* close cursors */
if (db.cursor4 != NULL) { if (db.cursor4 != NULL) {
db.cursor4->c_close(db.cursor4); db.cursor4->c_close(db.cursor4);
@ -405,8 +413,7 @@ bdb_cleanup(void)
/*% Initializes, sets flags and then opens Berkeley databases. */ /*% Initializes, sets flags and then opens Berkeley databases. */
isc_result_t isc_result_t
bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags) bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags) {
{
int result; int result;
int createFlag = 0; int createFlag = 0;
@ -451,8 +458,7 @@ bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags)
*/ */
void void
put_data(bool dns_data, char *input_key, char *input_data) put_data(bool dns_data, char *input_key, char *input_data) {
{
int bdbres; int bdbres;
DBT key, data; DBT key, data;
@ -487,8 +493,7 @@ put_data(bool dns_data, char *input_key, char *input_data)
} }
void void
insert_data(void) insert_data(void) {
{
unsigned int opt = ISC_LEXOPT_EOL | /* Want end-of-line token. */ unsigned int opt = ISC_LEXOPT_EOL | /* Want end-of-line token. */
ISC_LEXOPT_EOF | /* Want end-of-file token. */ ISC_LEXOPT_EOF | /* Want end-of-file token. */
ISC_LEXOPT_QSTRING | /* Recognize qstrings. */ ISC_LEXOPT_QSTRING | /* Recognize qstrings. */
@ -613,8 +618,7 @@ data_cleanup:
} }
isc_result_t isc_result_t
openBDB(void) openBDB(void) {
{
int bdbres; int bdbres;
isc_result_t result; isc_result_t result;
@ -707,8 +711,7 @@ openBDB_cleanup:
/*% Create & open lexer to parse input data */ /*% Create & open lexer to parse input data */
isc_result_t isc_result_t
open_lexer(void) open_lexer(void) {
{
isc_result_t result; isc_result_t result;
/* check if we already opened the lexer, if we did, return success */ /* check if we already opened the lexer, if we did, return success */
@ -744,8 +747,7 @@ open_lexer(void)
/*% Close the lexer, and cleanup memory */ /*% Close the lexer, and cleanup memory */
void void
close_lexer(void) close_lexer(void) {
{
/* If lexer is still open, close it & destroy it. */ /* If lexer is still open, close it & destroy it. */
if (lexer != NULL) { if (lexer != NULL) {
isc_lex_close(lexer); isc_lex_close(lexer);
@ -761,8 +763,7 @@ close_lexer(void)
/*% Perform add operation */ /*% Perform add operation */
void void
operation_add(void) operation_add(void) {
{
/* check for any parameters that are not allowed during add */ /* check for any parameters that are not allowed during add */
checkInvalidParam(key, "k", "for add operation"); checkInvalidParam(key, "k", "for add operation");
checkInvalidParam(zone, "z", "for add operation"); checkInvalidParam(zone, "z", "for add operation");
@ -793,8 +794,7 @@ operation_add(void)
/*% Perform bulk insert operation */ /*% Perform bulk insert operation */
void void
operation_bulk(void) operation_bulk(void) {
{
/* check for any parameters that are not allowed during bulk */ /* check for any parameters that are not allowed during bulk */
checkInvalidParam(key, "k", "for bulk load operation"); checkInvalidParam(key, "k", "for bulk load operation");
checkInvalidParam(zone, "z", "for bulk load operation"); checkInvalidParam(zone, "z", "for bulk load operation");
@ -827,8 +827,7 @@ operation_bulk(void)
} }
isc_result_t isc_result_t
bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata) bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata) {
{
int bdbres; int bdbres;
db_recno_t recNum; db_recno_t recNum;
char *retkey = NULL, *retdata; char *retkey = NULL, *retdata;
@ -910,8 +909,7 @@ bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata)
*/ */
void void
operation_listOrDelete(bool dlt) operation_listOrDelete(bool dlt) {
{
int bdbres = 0; int bdbres = 0;
DBC *curList[3]; DBC *curList[3];
DBT bdbkey, bdbdata; DBT bdbkey, bdbdata;
@ -1160,8 +1158,7 @@ operation_listOrDelete(bool dlt)
} }
int int
main(int argc, char **argv) main(int argc, char **argv) {
{
int ch; int ch;
char *endp; char *endp;

View File

@ -94,10 +94,9 @@ typedef struct parsed_data {
/* forward reference */ /* forward reference */
static isc_result_t bdb_findzone(void *driverarg, void *dbdata, static isc_result_t
const char *name, bdb_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo);
dns_clientinfo_t *clientinfo);
/*% /*%
* Parses the DBT from the Berkeley DB into a parsed_data record * Parses the DBT from the Berkeley DB into a parsed_data record
@ -108,8 +107,7 @@ static isc_result_t bdb_findzone(void *driverarg, void *dbdata,
*/ */
static isc_result_t static isc_result_t
bdb_parse_data(char *in, parsed_data_t *pd) bdb_parse_data(char *in, parsed_data_t *pd) {
{
char *endp, *ttlStr; char *endp, *ttlStr;
char *tmp = in; char *tmp = in;
char *lastchar = (char *)&tmp[strlen(tmp) + 1]; char *lastchar = (char *)&tmp[strlen(tmp) + 1];
@ -209,8 +207,7 @@ bdb_parse_data(char *in, parsed_data_t *pd)
static isc_result_t static isc_result_t
bdb_allowzonexfr(void *driverarg, void *dbdata, const char *name, bdb_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
bdb_instance_t *db = (bdb_instance_t *)dbdata; bdb_instance_t *db = (bdb_instance_t *)dbdata;
DBC *client_cursor = NULL; DBC *client_cursor = NULL;
@ -280,8 +277,7 @@ xfr_cleanup:
static isc_result_t static isc_result_t
bdb_allnodes(const char *zone, void *driverarg, void *dbdata, bdb_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
bdb_instance_t *db = (bdb_instance_t *)dbdata; bdb_instance_t *db = (bdb_instance_t *)dbdata;
DBC *zone_cursor = NULL; DBC *zone_cursor = NULL;
@ -361,8 +357,7 @@ allnodes_cleanup:
*/ */
static void static void
bdb_cleanup(bdb_instance_t *db) bdb_cleanup(bdb_instance_t *db) {
{
isc_mem_t *mctx; isc_mem_t *mctx;
/* close databases */ /* close databases */
@ -395,8 +390,7 @@ bdb_cleanup(bdb_instance_t *db)
static isc_result_t static isc_result_t
bdb_findzone(void *driverarg, void *dbdata, const char *name, bdb_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
bdb_instance_t *db = (bdb_instance_t *)dbdata; bdb_instance_t *db = (bdb_instance_t *)dbdata;
DBC *zone_cursor = NULL; DBC *zone_cursor = NULL;
@ -459,8 +453,7 @@ findzone_cleanup:
static isc_result_t static isc_result_t
bdb_lookup(const char *zone, const char *name, void *driverarg, void *dbdata, bdb_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
bdb_instance_t *db = (bdb_instance_t *)dbdata; bdb_instance_t *db = (bdb_instance_t *)dbdata;
DBC *zone_cursor = NULL; DBC *zone_cursor = NULL;
@ -581,8 +574,7 @@ lookup_cleanup:
static isc_result_t static isc_result_t
bdb_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name, bdb_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
char *db_file, int flags) char *db_file, int flags) {
{
int result; int result;
/* Initialize the database. */ /* Initialize the database. */
@ -622,8 +614,7 @@ bdb_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
static isc_result_t static isc_result_t
bdb_create(const char *dlzname, unsigned int argc, char *argv[], bdb_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
int bdbres; int bdbres;
bdb_instance_t *db = NULL; bdb_instance_t *db = NULL;
@ -738,8 +729,7 @@ init_cleanup:
} }
static void static void
bdb_destroy(void *driverarg, void *dbdata) bdb_destroy(void *driverarg, void *dbdata) {
{
UNUSED(driverarg); UNUSED(driverarg);
bdb_cleanup((bdb_instance_t *)dbdata); bdb_cleanup((bdb_instance_t *)dbdata);
@ -767,8 +757,7 @@ static dns_sdlzmethods_t dlz_bdb_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_bdb_init(void) dlz_bdb_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -796,8 +785,7 @@ dlz_bdb_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_bdb_clear(void) dlz_bdb_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -92,18 +92,16 @@ typedef struct bdbhpt_parsed_data {
/* forward reference */ /* forward reference */
static isc_result_t bdbhpt_findzone(void *driverarg, void *dbdata, static isc_result_t
const char *name, bdbhpt_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo);
dns_clientinfo_t *clientinfo);
/*% /*%
* Reverses a string in place. * Reverses a string in place.
*/ */
static char * static char *
bdbhpt_strrev(char *str) bdbhpt_strrev(char *str) {
{
char *p1, *p2; char *p1, *p2;
if (!str || !*str) { if (!str || !*str) {
@ -126,8 +124,7 @@ bdbhpt_strrev(char *str)
*/ */
static isc_result_t static isc_result_t
bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd) bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd) {
{
char *endp, *ttlStr; char *endp, *ttlStr;
char *tmp = in; char *tmp = in;
char *lastchar = (char *)&tmp[strlen(tmp)]; char *lastchar = (char *)&tmp[strlen(tmp)];
@ -237,8 +234,7 @@ bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd)
static isc_result_t static isc_result_t
bdbhpt_allowzonexfr(void *driverarg, void *dbdata, const char *name, bdbhpt_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBT key, data; DBT key, data;
@ -321,8 +317,7 @@ xfr_cleanup:
static isc_result_t static isc_result_t
bdbhpt_allnodes(const char *zone, void *driverarg, void *dbdata, bdbhpt_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBC *xfr_cursor = NULL; DBC *xfr_cursor = NULL;
@ -456,8 +451,7 @@ allnodes_cleanup:
*/ */
static void static void
bdbhpt_cleanup(bdbhpt_instance_t *db) bdbhpt_cleanup(bdbhpt_instance_t *db) {
{
isc_mem_t *mctx; isc_mem_t *mctx;
/* close databases */ /* close databases */
@ -490,8 +484,8 @@ bdbhpt_cleanup(bdbhpt_instance_t *db)
static isc_result_t static isc_result_t
bdbhpt_findzone(void *driverarg, void *dbdata, const char *name, bdbhpt_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods,
{ dns_clientinfo_t *clientinfo) {
isc_result_t result; isc_result_t result;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBT key, data; DBT key, data;
@ -545,8 +539,7 @@ bdbhpt_findzone(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
bdbhpt_lookup(const char *zone, const char *name, void *driverarg, void *dbdata, bdbhpt_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBC *data_cursor = NULL; DBC *data_cursor = NULL;
@ -628,8 +621,7 @@ lookup_cleanup:
static isc_result_t static isc_result_t
bdbhpt_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name, bdbhpt_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
char *db_file, int flags) char *db_file, int flags) {
{
int result; int result;
/* Initialize the database. */ /* Initialize the database. */
@ -669,8 +661,7 @@ bdbhpt_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
static isc_result_t static isc_result_t
bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[], bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
int bdbhptres; int bdbhptres;
int bdbFlags = 0; int bdbFlags = 0;
@ -805,8 +796,7 @@ init_cleanup:
} }
static void static void
bdbhpt_destroy(void *driverarg, void *dbdata) bdbhpt_destroy(void *driverarg, void *dbdata) {
{
UNUSED(driverarg); UNUSED(driverarg);
bdbhpt_cleanup((bdbhpt_instance_t *)dbdata); bdbhpt_cleanup((bdbhpt_instance_t *)dbdata);
@ -836,8 +826,7 @@ static dns_sdlzmethods_t dlz_bdbhpt_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_bdbhpt_init(void) dlz_bdbhpt_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -865,8 +854,7 @@ dlz_bdbhpt_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_bdbhpt_clear(void) dlz_bdbhpt_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -62,8 +62,7 @@
*/ */
isc_result_t isc_result_t
dlz_drivers_init(void) dlz_drivers_init(void) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
#ifdef DLZ_STUB #ifdef DLZ_STUB
@ -127,8 +126,7 @@ dlz_drivers_init(void)
*/ */
void void
dlz_drivers_clear(void) dlz_drivers_clear(void) {
{
#ifdef DLZ_STUB #ifdef DLZ_STUB
dlz_stub_clear(); dlz_stub_clear();
#endif /* ifdef DLZ_STUB */ #endif /* ifdef DLZ_STUB */

View File

@ -89,15 +89,15 @@ typedef ISC_LIST(dir_entry_t) dlist_t;
/* forward reference */ /* forward reference */
static void fs_destroy(void *driverarg, void *dbdata); static void
fs_destroy(void *driverarg, void *dbdata);
/* /*
* Private methods * Private methods
*/ */
static bool static bool
is_safe(const char *input) is_safe(const char *input) {
{
unsigned int i; unsigned int i;
unsigned int len = strlen(input); unsigned int len = strlen(input);
@ -165,8 +165,7 @@ is_safe(const char *input)
} }
static void static void
create_path_helper(char *out, const char *in, config_data_t *cd) create_path_helper(char *out, const char *in, config_data_t *cd) {
{
char *tmpString; char *tmpString;
char *tmpPtr; char *tmpPtr;
int i; int i;
@ -229,8 +228,7 @@ create_path_helper(char *out, const char *in, config_data_t *cd)
static isc_result_t static isc_result_t
create_path(const char *zone, const char *host, const char *client, create_path(const char *zone, const char *host, const char *client,
config_data_t *cd, char **path) config_data_t *cd, char **path) {
{
char *tmpPath; char *tmpPath;
int pathsize; int pathsize;
int len; int len;
@ -346,8 +344,7 @@ create_path(const char *zone, const char *host, const char *client,
static isc_result_t static isc_result_t
process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, process_dir(isc_dir_t *dir, void *passback, config_data_t *cd,
dlist_t *dir_list, unsigned int basedirlen) dlist_t *dir_list, unsigned int basedirlen) {
{
char tmp[PATH_MAX + NAME_MAX]; char tmp[PATH_MAX + NAME_MAX];
int astPos; int astPos;
struct stat sb; struct stat sb;
@ -574,8 +571,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd,
static isc_result_t static isc_result_t
fs_allowzonexfr(void *driverarg, void *dbdata, const char *name, fs_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
char *path; char *path;
struct stat sb; struct stat sb;
@ -609,8 +605,7 @@ complete_AXFR:
static isc_result_t static isc_result_t
fs_allnodes(const char *zone, void *driverarg, void *dbdata, fs_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
dlist_t *dir_list; dlist_t *dir_list;
config_data_t *cd; config_data_t *cd;
@ -724,8 +719,7 @@ complete_allnds:
static isc_result_t static isc_result_t
fs_findzone(void *driverarg, void *dbdata, const char *name, fs_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
char *path; char *path;
struct stat sb; struct stat sb;
@ -767,8 +761,7 @@ complete_FZ:
static isc_result_t static isc_result_t
fs_lookup(const char *zone, const char *name, void *driverarg, void *dbdata, fs_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
char *path; char *path;
struct stat sb; struct stat sb;
@ -841,8 +834,7 @@ complete_lkup:
static isc_result_t static isc_result_t
fs_create(const char *dlzname, unsigned int argc, char *argv[], void *driverarg, fs_create(const char *dlzname, unsigned int argc, char *argv[], void *driverarg,
void **dbdata) void **dbdata) {
{
config_data_t *cd; config_data_t *cd;
char *endp; char *endp;
int len; int len;
@ -929,8 +921,7 @@ fs_create(const char *dlzname, unsigned int argc, char *argv[], void *driverarg,
} }
static void static void
fs_destroy(void *driverarg, void *dbdata) fs_destroy(void *driverarg, void *dbdata) {
{
isc_mem_t *mctx; isc_mem_t *mctx;
config_data_t *cd; config_data_t *cd;
@ -982,8 +973,7 @@ static dns_sdlzmethods_t dlz_fs_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_fs_init(void) dlz_fs_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -1010,8 +1000,7 @@ dlz_fs_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_fs_clear(void) dlz_fs_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -101,12 +101,13 @@ typedef struct {
/* forward references */ /* forward references */
static isc_result_t dlz_ldap_findzone(void *driverarg, void *dbdata, static isc_result_t
const char *name, dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo); dns_clientinfo_t *clientinfo);
static void dlz_ldap_destroy(void *driverarg, void *dbdata); static void
dlz_ldap_destroy(void *driverarg, void *dbdata);
/* /*
* Private methods * Private methods
@ -114,8 +115,7 @@ static void dlz_ldap_destroy(void *driverarg, void *dbdata);
/*% checks that the LDAP URL parameters make sense */ /*% checks that the LDAP URL parameters make sense */
static isc_result_t static isc_result_t
dlz_ldap_checkURL(char *URL, int attrCnt, const char *msg) dlz_ldap_checkURL(char *URL, int attrCnt, const char *msg) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
int ldap_result; int ldap_result;
LDAPURLDesc *ldap_url = NULL; LDAPURLDesc *ldap_url = NULL;
@ -191,8 +191,7 @@ cleanup:
/*% Connects / reconnects to LDAP server */ /*% Connects / reconnects to LDAP server */
static isc_result_t static isc_result_t
dlz_ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) dlz_ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) {
{
isc_result_t result; isc_result_t result;
int ldap_result; int ldap_result;
@ -246,8 +245,7 @@ cleanup:
* multithreaded operation. * multithreaded operation.
*/ */
static void static void
ldap_destroy_dblist(db_list_t *dblist) ldap_destroy_dblist(db_list_t *dblist) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -281,8 +279,7 @@ ldap_destroy_dblist(db_list_t *dblist)
* multithreaded operation. * multithreaded operation.
*/ */
static dbinstance_t * static dbinstance_t *
ldap_find_avail_conn(db_list_t *dblist) ldap_find_avail_conn(db_list_t *dblist) {
{
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
dbinstance_t *head; dbinstance_t *head;
int count = 0; int count = 0;
@ -315,8 +312,7 @@ ldap_find_avail_conn(db_list_t *dblist)
static isc_result_t static isc_result_t
ldap_process_results(LDAP *dbc, LDAPMessage *msg, char **attrs, void *ptr, ldap_process_results(LDAP *dbc, LDAPMessage *msg, char **attrs, void *ptr,
bool allnodes) bool allnodes) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
int i = 0; int i = 0;
int j; int j;
@ -553,8 +549,7 @@ cleanup:
*/ */
static isc_result_t static isc_result_t
ldap_get_results(const char *zone, const char *record, const char *client, ldap_get_results(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, void *ptr) unsigned int query, void *dbdata, void *ptr) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
char *querystring = NULL; char *querystring = NULL;
@ -839,8 +834,7 @@ cleanup:
*/ */
static isc_result_t static isc_result_t
dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name, dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
UNUSED(driverarg); UNUSED(driverarg);
@ -858,16 +852,14 @@ dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
dlz_ldap_allnodes(const char *zone, void *driverarg, void *dbdata, dlz_ldap_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
UNUSED(driverarg); UNUSED(driverarg);
return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes)); return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes));
} }
static isc_result_t static isc_result_t
dlz_ldap_authority(const char *zone, void *driverarg, void *dbdata, dlz_ldap_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup) dns_sdlzlookup_t *lookup) {
{
UNUSED(driverarg); UNUSED(driverarg);
return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup)); return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup));
} }
@ -875,8 +867,7 @@ dlz_ldap_authority(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name, dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
UNUSED(driverarg); UNUSED(driverarg);
UNUSED(methods); UNUSED(methods);
UNUSED(clientinfo); UNUSED(clientinfo);
@ -886,8 +877,8 @@ dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
dlz_ldap_lookup(const char *zone, const char *name, void *driverarg, dlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup, void *dbdata, dns_sdlzlookup_t *lookup,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods,
{ dns_clientinfo_t *clientinfo) {
isc_result_t result; isc_result_t result;
UNUSED(driverarg); UNUSED(driverarg);
@ -906,8 +897,7 @@ dlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
static isc_result_t static isc_result_t
dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[], dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
ldap_instance_t *ldap_inst = NULL; ldap_instance_t *ldap_inst = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1154,8 +1144,7 @@ cleanup:
} }
void void
dlz_ldap_destroy(void *driverarg, void *dbdata) dlz_ldap_destroy(void *driverarg, void *dbdata) {
{
UNUSED(driverarg); UNUSED(driverarg);
if (dbdata != NULL) { if (dbdata != NULL) {
@ -1203,8 +1192,7 @@ static dns_sdlzmethods_t dlz_ldap_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_ldap_init(void) dlz_ldap_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -1231,8 +1219,7 @@ dlz_ldap_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_ldap_clear(void) dlz_ldap_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -87,8 +87,7 @@ static dns_sdlzimplementation_t *dlz_mysql = NULL;
*/ */
static char * static char *
mysqldrv_escape_string(MYSQL *mysql, const char *instr) mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
{
char *outstr; char *outstr;
unsigned int len; unsigned int len;
@ -117,8 +116,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr)
static isc_result_t static isc_result_t
mysql_get_resultset(const char *zone, const char *record, const char *client, mysql_get_resultset(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, MYSQL_RES **rs) unsigned int query, void *dbdata, MYSQL_RES **rs) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
char *querystring = NULL; char *querystring = NULL;
@ -357,8 +355,7 @@ cleanup:
*/ */
static isc_result_t static isc_result_t
mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs) mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
MYSQL_ROW row; MYSQL_ROW row;
unsigned int fields; unsigned int fields;
@ -475,8 +472,7 @@ mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
static isc_result_t static isc_result_t
mysql_findzone(void *driverarg, void *dbdata, const char *name, mysql_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
my_ulonglong rows; my_ulonglong rows;
@ -516,8 +512,7 @@ mysql_findzone(void *driverarg, void *dbdata, const char *name,
/*% Determine if the client is allowed to perform a zone transfer */ /*% Determine if the client is allowed to perform a zone transfer */
static isc_result_t static isc_result_t
mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name, mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
my_ulonglong rows; my_ulonglong rows;
@ -575,8 +570,7 @@ mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name,
*/ */
static isc_result_t static isc_result_t
mysql_allnodes(const char *zone, void *driverarg, void *dbdata, mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
MYSQL_ROW row; MYSQL_ROW row;
@ -681,8 +675,7 @@ mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
mysql_authority(const char *zone, void *driverarg, void *dbdata, mysql_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup) dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
@ -716,8 +709,7 @@ mysql_authority(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
mysql_lookup(const char *zone, const char *name, void *driverarg, void *dbdata, mysql_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
@ -753,8 +745,7 @@ mysql_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
*/ */
static isc_result_t static isc_result_t
mysql_create(const char *dlzname, unsigned int argc, char *argv[], mysql_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
char *tmp = NULL; char *tmp = NULL;
@ -973,8 +964,7 @@ cleanup:
*/ */
static void static void
mysql_destroy(void *driverarg, void *dbdata) mysql_destroy(void *driverarg, void *dbdata) {
{
dbinstance_t *dbi; dbinstance_t *dbi;
UNUSED(driverarg); UNUSED(driverarg);
@ -1014,8 +1004,7 @@ static dns_sdlzmethods_t dlz_mysql_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_mysql_init(void) dlz_mysql_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -1050,8 +1039,7 @@ dlz_mysql_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_mysql_clear(void) dlz_mysql_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -104,15 +104,15 @@ typedef struct {
/* forward reference */ /* forward reference */
static size_t odbc_makesafe(char *to, const char *from, size_t length); static size_t
odbc_makesafe(char *to, const char *from, size_t length);
/* /*
* Private methods * Private methods
*/ */
static SQLSMALLINT static SQLSMALLINT
safeLen(void *a) safeLen(void *a) {
{
if (a == NULL) { if (a == NULL) {
return (0); return (0);
} }
@ -122,8 +122,7 @@ safeLen(void *a)
/*% propertly cleans up an odbc_instance_t */ /*% propertly cleans up an odbc_instance_t */
static void static void
destroy_odbc_instance(odbc_instance_t *odbc_inst) destroy_odbc_instance(odbc_instance_t *odbc_inst) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -189,8 +188,7 @@ destroy_odbc_instance(odbc_instance_t *odbc_inst)
/*% Connects to database, and creates ODBC statements */ /*% Connects to database, and creates ODBC statements */
static isc_result_t static isc_result_t
odbc_connect(odbc_instance_t *dbi, odbc_db_t **dbc) odbc_connect(odbc_instance_t *dbi, odbc_db_t **dbc) {
{
odbc_db_t *ndb = *dbc; odbc_db_t *ndb = *dbc;
SQLRETURN sqlRes; SQLRETURN sqlRes;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@ -281,8 +279,7 @@ cleanup:
*/ */
static dbinstance_t * static dbinstance_t *
odbc_find_avail_conn(db_list_t *dblist) odbc_find_avail_conn(db_list_t *dblist) {
{
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
dbinstance_t *head; dbinstance_t *head;
int count = 0; int count = 0;
@ -321,8 +318,7 @@ odbc_find_avail_conn(db_list_t *dblist)
*/ */
static char * static char *
odbc_escape_string(const char *instr) odbc_escape_string(const char *instr) {
{
char *outstr; char *outstr;
unsigned int len; unsigned int len;
@ -358,8 +354,7 @@ odbc_escape_string(const char *instr)
*/ */
static size_t static size_t
odbc_makesafe(char *to, const char *from, size_t length) odbc_makesafe(char *to, const char *from, size_t length) {
{
const char *source = from; const char *source = from;
char *target = to; char *target = to;
unsigned int remaining = length; unsigned int remaining = length;
@ -414,8 +409,7 @@ odbc_makesafe(char *to, const char *from, size_t length)
static isc_result_t static isc_result_t
odbc_get_resultset(const char *zone, const char *record, const char *client, odbc_get_resultset(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, dbinstance_t **r_dbi) unsigned int query, void *dbdata, dbinstance_t **r_dbi) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
char *querystring = NULL; char *querystring = NULL;
@ -649,8 +643,7 @@ cleanup: /* it's always good to cleanup after yourself */
*/ */
static isc_result_t static isc_result_t
odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data) odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data) {
{
SQLLEN size; SQLLEN size;
REQUIRE(data != NULL && *data == NULL); REQUIRE(data != NULL && *data == NULL);
@ -680,8 +673,7 @@ odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data)
static isc_result_t static isc_result_t
odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField, odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
SQLSMALLINT endField, char **retData) SQLSMALLINT endField, char **retData) {
{
isc_result_t result; isc_result_t result;
SQLLEN size; SQLLEN size;
int totSize = 0; int totSize = 0;
@ -747,8 +739,7 @@ odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
*/ */
static isc_result_t static isc_result_t
odbc_process_rs(dns_sdlzlookup_t *lookup, dbinstance_t *dbi) odbc_process_rs(dns_sdlzlookup_t *lookup, dbinstance_t *dbi) {
{
isc_result_t result; isc_result_t result;
SQLSMALLINT fields; SQLSMALLINT fields;
SQLHSTMT *stmnt; SQLHSTMT *stmnt;
@ -884,8 +875,7 @@ process_rs_cleanup:
static isc_result_t static isc_result_t
odbc_findzone(void *driverarg, void *dbdata, const char *name, odbc_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -919,8 +909,7 @@ odbc_findzone(void *driverarg, void *dbdata, const char *name,
/*% Determine if the client is allowed to perform a zone transfer */ /*% Determine if the client is allowed to perform a zone transfer */
static isc_result_t static isc_result_t
odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name, odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -975,8 +964,7 @@ odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
odbc_allnodes(const char *zone, void *driverarg, void *dbdata, odbc_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
SQLHSTMT *stmnt; SQLHSTMT *stmnt;
@ -1108,8 +1096,7 @@ allnodes_cleanup:
static isc_result_t static isc_result_t
odbc_authority(const char *zone, void *driverarg, void *dbdata, odbc_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup) dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1139,8 +1126,7 @@ odbc_authority(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
odbc_lookup(const char *zone, const char *name, void *driverarg, void *dbdata, odbc_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1171,8 +1157,7 @@ odbc_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
*/ */
static isc_result_t static isc_result_t
odbc_create(const char *dlzname, unsigned int argc, char *argv[], odbc_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
odbc_instance_t *odbc_inst = NULL; odbc_instance_t *odbc_inst = NULL;
dbinstance_t *db = NULL; dbinstance_t *db = NULL;
@ -1357,8 +1342,7 @@ cleanup:
*/ */
static void static void
odbc_destroy(void *driverarg, void *dbdata) odbc_destroy(void *driverarg, void *dbdata) {
{
UNUSED(driverarg); UNUSED(driverarg);
destroy_odbc_instance((odbc_instance_t *)dbdata); destroy_odbc_instance((odbc_instance_t *)dbdata);
@ -1388,8 +1372,7 @@ static dns_sdlzmethods_t dlz_odbc_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_odbc_init(void) dlz_odbc_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -1425,8 +1408,7 @@ dlz_odbc_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_odbc_clear(void) dlz_odbc_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -107,8 +107,7 @@ static dns_sdlzimplementation_t *dlz_postgres = NULL;
*/ */
static size_t static size_t
postgres_makesafe(char *to, const char *from, size_t length) postgres_makesafe(char *to, const char *from, size_t length) {
{
const char *source = from; const char *source = from;
char *target = to; char *target = to;
unsigned int remaining = length; unsigned int remaining = length;
@ -150,8 +149,7 @@ postgres_makesafe(char *to, const char *from, size_t length)
* multithreaded operation. * multithreaded operation.
*/ */
static void static void
postgres_destroy_dblist(db_list_t *dblist) postgres_destroy_dblist(db_list_t *dblist) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -186,8 +184,7 @@ postgres_destroy_dblist(db_list_t *dblist)
*/ */
static dbinstance_t * static dbinstance_t *
postgres_find_avail_conn(db_list_t *dblist) postgres_find_avail_conn(db_list_t *dblist) {
{
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
dbinstance_t *head; dbinstance_t *head;
int count = 0; int count = 0;
@ -227,8 +224,7 @@ postgres_find_avail_conn(db_list_t *dblist)
*/ */
static char * static char *
postgres_escape_string(const char *instr) postgres_escape_string(const char *instr) {
{
char *outstr; char *outstr;
unsigned int len; unsigned int len;
@ -264,8 +260,7 @@ postgres_escape_string(const char *instr)
*/ */
static isc_result_t static isc_result_t
postgres_get_resultset(const char *zone, const char *record, const char *client, postgres_get_resultset(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, PGresult **rs) unsigned int query, void *dbdata, PGresult **rs) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
char *querystring = NULL; char *querystring = NULL;
@ -609,8 +604,7 @@ cleanup:
*/ */
static isc_result_t static isc_result_t
postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs) postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs) {
{
isc_result_t result; isc_result_t result;
unsigned int i; unsigned int i;
unsigned int rows; unsigned int rows;
@ -730,8 +724,7 @@ postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs)
static isc_result_t static isc_result_t
postgres_findzone(void *driverarg, void *dbdata, const char *name, postgres_findzone(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
PGresult *rs = NULL; PGresult *rs = NULL;
unsigned int rows; unsigned int rows;
@ -771,8 +764,7 @@ postgres_findzone(void *driverarg, void *dbdata, const char *name,
/*% Determine if the client is allowed to perform a zone transfer */ /*% Determine if the client is allowed to perform a zone transfer */
static isc_result_t static isc_result_t
postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name, postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
isc_result_t result; isc_result_t result;
PGresult *rs = NULL; PGresult *rs = NULL;
unsigned int rows; unsigned int rows;
@ -830,8 +822,7 @@ postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name,
*/ */
static isc_result_t static isc_result_t
postgres_allnodes(const char *zone, void *driverarg, void *dbdata, postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
PGresult *rs = NULL; PGresult *rs = NULL;
unsigned int i; unsigned int i;
@ -942,8 +933,7 @@ postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
postgres_authority(const char *zone, void *driverarg, void *dbdata, postgres_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup) dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
PGresult *rs = NULL; PGresult *rs = NULL;
@ -979,8 +969,8 @@ postgres_authority(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
postgres_lookup(const char *zone, const char *name, void *driverarg, postgres_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup, void *dbdata, dns_sdlzlookup_t *lookup,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods,
{ dns_clientinfo_t *clientinfo) {
isc_result_t result; isc_result_t result;
PGresult *rs = NULL; PGresult *rs = NULL;
@ -1016,8 +1006,7 @@ postgres_lookup(const char *zone, const char *name, void *driverarg,
*/ */
static isc_result_t static isc_result_t
postgres_create(const char *dlzname, unsigned int argc, char *argv[], postgres_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
unsigned int j; unsigned int j;
@ -1189,8 +1178,7 @@ cleanup:
* so we really only need to clean it up since we are not using driverarg. * so we really only need to clean it up since we are not using driverarg.
*/ */
static void static void
postgres_destroy(void *driverarg, void *dbdata) postgres_destroy(void *driverarg, void *dbdata) {
{
UNUSED(driverarg); UNUSED(driverarg);
/* cleanup the list of DBI's */ /* cleanup the list of DBI's */
postgres_destroy_dblist((db_list_t *)dbdata); postgres_destroy_dblist((db_list_t *)dbdata);
@ -1220,8 +1208,7 @@ static dns_sdlzmethods_t dlz_postgres_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_postgres_init(void) dlz_postgres_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -1257,8 +1244,7 @@ dlz_postgres_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_postgres_clear(void) dlz_postgres_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -73,8 +73,7 @@ typedef struct config_data {
static isc_result_t static isc_result_t
stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata, stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes) dns_sdlzallnodes_t *allnodes) {
{
config_data_t *cd; config_data_t *cd;
isc_result_t result; isc_result_t result;
@ -102,8 +101,7 @@ stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name, stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client) const char *client) {
{
config_data_t *cd; config_data_t *cd;
UNUSED(driverarg); UNUSED(driverarg);
@ -119,8 +117,7 @@ stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
stub_dlz_authority(const char *zone, void *driverarg, void *dbdata, stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup) dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
config_data_t *cd; config_data_t *cd;
@ -148,8 +145,7 @@ stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
static isc_result_t static isc_result_t
stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name, stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
dns_clientinfomethods_t *methods, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
config_data_t *cd; config_data_t *cd;
UNUSED(driverarg); UNUSED(driverarg);
@ -173,8 +169,8 @@ stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
static isc_result_t static isc_result_t
stub_dlz_lookup(const char *zone, const char *name, void *driverarg, stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup, void *dbdata, dns_sdlzlookup_t *lookup,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) dns_clientinfomethods_t *methods,
{ dns_clientinfo_t *clientinfo) {
isc_result_t result; isc_result_t result;
config_data_t *cd; config_data_t *cd;
@ -198,8 +194,7 @@ stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
static isc_result_t static isc_result_t
stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[], stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata) void *driverarg, void **dbdata) {
{
config_data_t *cd; config_data_t *cd;
UNUSED(driverarg); UNUSED(driverarg);
@ -237,8 +232,7 @@ stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
} }
static void static void
stub_dlz_destroy(void *driverarg, void *dbdata) stub_dlz_destroy(void *driverarg, void *dbdata) {
{
config_data_t *cd; config_data_t *cd;
isc_mem_t *mctx; isc_mem_t *mctx;
@ -280,8 +274,7 @@ static dns_sdlzmethods_t dlz_stub_methods = {
* Wrapper around dns_sdlzregister(). * Wrapper around dns_sdlzregister().
*/ */
isc_result_t isc_result_t
dlz_stub_init(void) dlz_stub_init(void) {
{
isc_result_t result; isc_result_t result;
/* /*
@ -308,8 +301,7 @@ dlz_stub_init(void)
* Wrapper around dns_sdlzunregister(). * Wrapper around dns_sdlzunregister().
*/ */
void void
dlz_stub_clear(void) dlz_stub_clear(void) {
{
/* /*
* Write debugging message to log * Write debugging message to log
*/ */

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -63,8 +63,7 @@
*/ */
static void static void
destroy_querylist(isc_mem_t *mctx, query_list_t **querylist) destroy_querylist(isc_mem_t *mctx, query_list_t **querylist) {
{
query_segment_t *tseg = NULL; query_segment_t *tseg = NULL;
query_segment_t *nseg = NULL; query_segment_t *nseg = NULL;
@ -100,8 +99,7 @@ destroy_querylist(isc_mem_t *mctx, query_list_t **querylist)
static isc_result_t static isc_result_t
build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
char **record, char **client, query_list_t **querylist, char **record, char **client, query_list_t **querylist,
unsigned int flags) unsigned int flags) {
{
isc_result_t result; isc_result_t result;
bool foundzone = false; bool foundzone = false;
bool foundrecord = false; bool foundrecord = false;
@ -268,8 +266,7 @@ flag_fail:
* used to be in our queries from named.conf * used to be in our queries from named.conf
*/ */
char * char *
sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist) sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist) {
{
query_segment_t *tseg = NULL; query_segment_t *tseg = NULL;
unsigned int length = 0; unsigned int length = 0;
char *qs = NULL; char *qs = NULL;
@ -319,8 +316,7 @@ isc_result_t
sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str, sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
const char *allowxfr_str, const char *authority_str, const char *allowxfr_str, const char *authority_str,
const char *findzone_str, const char *lookup_str, const char *findzone_str, const char *lookup_str,
const char *countzone_str, dbinstance_t **dbi) const char *countzone_str, dbinstance_t **dbi) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *db = NULL; dbinstance_t *db = NULL;
@ -435,8 +431,7 @@ cleanup:
} }
void void
sdlzh_destroy_sqldbinstance(dbinstance_t *dbi) sdlzh_destroy_sqldbinstance(dbinstance_t *dbi) {
{
isc_mem_t *mctx; isc_mem_t *mctx;
/* save mctx for later */ /* save mctx for later */
@ -458,8 +453,7 @@ sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
} }
char * char *
sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char *key) sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char *key) {
{
int keylen; int keylen;
char *keystart; char *keystart;
char value[255]; char value[255];

View File

@ -63,8 +63,7 @@ struct dlz_example_data {
}; };
static bool static bool
single_valued(const char *type) single_valued(const char *type) {
{
const char *single[] = { "soa", "cname", NULL }; const char *single[] = { "soa", "cname", NULL };
int i; int i;
@ -81,8 +80,7 @@ single_valued(const char *type)
*/ */
static isc_result_t static isc_result_t
add_name(struct dlz_example_data *state, struct record *list, const char *name, add_name(struct dlz_example_data *state, struct record *list, const char *name,
const char *type, dns_ttl_t ttl, const char *data) const char *type, dns_ttl_t ttl, const char *data) {
{
int i; int i;
bool single = single_valued(type); bool single = single_valued(type);
int first_empty = -1; int first_empty = -1;
@ -139,8 +137,7 @@ add_name(struct dlz_example_data *state, struct record *list, const char *name,
*/ */
static isc_result_t static isc_result_t
del_name(struct dlz_example_data *state, struct record *list, const char *name, del_name(struct dlz_example_data *state, struct record *list, const char *name,
const char *type, dns_ttl_t ttl, const char *data) const char *type, dns_ttl_t ttl, const char *data) {
{
int i; int i;
UNUSED(state); UNUSED(state);
@ -161,8 +158,7 @@ del_name(struct dlz_example_data *state, struct record *list, const char *name,
} }
static isc_result_t static isc_result_t
fmt_address(isc_sockaddr_t *addr, char *buffer, size_t size) fmt_address(isc_sockaddr_t *addr, char *buffer, size_t size) {
{
char addr_buf[100]; char addr_buf[100];
const char *ret; const char *ret;
uint16_t port = 0; uint16_t port = 0;
@ -194,8 +190,7 @@ fmt_address(isc_sockaddr_t *addr, char *buffer, size_t size)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
UNUSED(flags); UNUSED(flags);
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
} }
@ -205,8 +200,7 @@ dlz_version(unsigned int *flags)
*/ */
static void static void
b9_add_helper(struct dlz_example_data *state, const char *helper_name, b9_add_helper(struct dlz_example_data *state, const char *helper_name,
void *ptr) void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
state->log = (log_t *)ptr; state->log = (log_t *)ptr;
} }
@ -226,8 +220,7 @@ b9_add_helper(struct dlz_example_data *state, const char *helper_name,
*/ */
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
struct dlz_example_data *state; struct dlz_example_data *state;
const char *helper_name; const char *helper_name;
va_list ap; va_list ap;
@ -311,8 +304,7 @@ failure:
* Shut down the backend * Shut down the backend
*/ */
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (state->log != NULL) { if (state->log != NULL) {
@ -328,8 +320,7 @@ dlz_destroy(void *dbdata)
*/ */
isc_result_t isc_result_t
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
isc_sockaddr_t *src; isc_sockaddr_t *src;
char addrbuf[100]; char addrbuf[100];
@ -397,8 +388,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
isc_result_t isc_result_t
dlz_lookup(const char *zone, const char *name, void *dbdata, dlz_lookup(const char *zone, const char *name, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
bool found = false; bool found = false;
@ -501,8 +491,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
* See if a zone transfer is allowed * See if a zone transfer is allowed
*/ */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
UNUSED(client); UNUSED(client);
/* Just say yes for all our zones */ /* Just say yes for all our zones */
@ -513,8 +502,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
* Perform a zone transfer * Perform a zone transfer
*/ */
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
int i; int i;
@ -545,8 +533,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes)
* Start a transaction * Start a transaction
*/ */
isc_result_t isc_result_t
dlz_newversion(const char *zone, void *dbdata, void **versionp) dlz_newversion(const char *zone, void *dbdata, void **versionp) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (state->transaction_started) { if (state->transaction_started) {
@ -569,8 +556,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp)
* End a transaction * End a transaction
*/ */
void void
dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (!state->transaction_started) { if (!state->transaction_started) {
@ -630,8 +616,7 @@ dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp)
* Configure a writeable zone * Configure a writeable zone
*/ */
isc_result_t isc_result_t
dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
isc_result_t result; isc_result_t result;
@ -674,8 +659,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata)
bool bool
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
const char *type, const char *key, uint32_t keydatalen, const char *type, const char *key, uint32_t keydatalen,
unsigned char *keydata, void *dbdata) unsigned char *keydata, void *dbdata) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
UNUSED(tcpaddr); UNUSED(tcpaddr);
@ -704,8 +688,7 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
static isc_result_t static isc_result_t
modrdataset(struct dlz_example_data *state, const char *name, modrdataset(struct dlz_example_data *state, const char *name,
const char *rdatastr, struct record *list) const char *rdatastr, struct record *list) {
{
char *full_name, *dclass, *type, *data, *ttlstr, *buf; char *full_name, *dclass, *type, *data, *ttlstr, *buf;
char absolute[1024]; char absolute[1024];
isc_result_t result; isc_result_t result;
@ -768,8 +751,7 @@ error:
isc_result_t isc_result_t
dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata, dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
void *version) void *version) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (version != (void *)&state->transaction_started) { if (version != (void *)&state->transaction_started) {
@ -786,8 +768,7 @@ dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
isc_result_t isc_result_t
dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata, dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
void *version) void *version) {
{
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (version != (void *)&state->transaction_started) { if (version != (void *)&state->transaction_started) {
@ -805,8 +786,8 @@ dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
} }
isc_result_t isc_result_t
dlz_delrdataset(const char *name, const char *type, void *dbdata, void *version) dlz_delrdataset(const char *name, const char *type, void *dbdata,
{ void *version) {
struct dlz_example_data *state = (struct dlz_example_data *)dbdata; struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (version != (void *)&state->transaction_started) { if (version != (void *)&state->transaction_started) {

View File

@ -14,8 +14,7 @@
* Called when we enter the DLL * Called when we enter the DLL
*/ */
__declspec(dllexport) BOOL WINAPI __declspec(dllexport) BOOL WINAPI
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
{
switch (fdwReason) { switch (fdwReason) {
/* /*
* The DLL is loading due to process * The DLL is loading due to process

View File

@ -103,15 +103,14 @@ typedef struct bdbhpt_parsed_data {
char *data; char *data;
} bdbhpt_parsed_data_t; } bdbhpt_parsed_data_t;
static void b9_add_helper(struct bdbhpt_instance *db, const char *helper_name, static void
void *ptr); b9_add_helper(struct bdbhpt_instance *db, const char *helper_name, void *ptr);
/*% /*%
* Reverses a string in place. * Reverses a string in place.
*/ */
static char * static char *
bdbhpt_strrev(char *str) bdbhpt_strrev(char *str) {
{
char *p1, *p2; char *p1, *p2;
if (!str || !*str) { if (!str || !*str) {
@ -134,8 +133,7 @@ bdbhpt_strrev(char *str)
*/ */
static isc_result_t static isc_result_t
bdbhpt_parse_data(log_t *log, char *in, bdbhpt_parsed_data_t *pd) bdbhpt_parse_data(log_t *log, char *in, bdbhpt_parsed_data_t *pd) {
{
char *endp, *ttlStr; char *endp, *ttlStr;
char *tmp = in; char *tmp = in;
char *lastchar = (char *)&tmp[strlen(tmp)]; char *lastchar = (char *)&tmp[strlen(tmp)];
@ -242,8 +240,7 @@ bdbhpt_parse_data(log_t *log, char *in, bdbhpt_parsed_data_t *pd)
* See if a zone transfer is allowed * See if a zone transfer is allowed
*/ */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
isc_result_t result; isc_result_t result;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBT key, data; DBT key, data;
@ -329,8 +326,7 @@ xfr_cleanup:
* updates by a separate process). * updates by a separate process).
*/ */
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata; bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
DBC *xfr_cursor = NULL; DBC *xfr_cursor = NULL;
@ -460,8 +456,7 @@ allnodes_cleanup:
* Used by bdbhpt_destroy when the driver is shutting down. * Used by bdbhpt_destroy when the driver is shutting down.
*/ */
static void static void
bdbhpt_cleanup(bdbhpt_instance_t *db) bdbhpt_cleanup(bdbhpt_instance_t *db) {
{
/* close databases */ /* close databases */
if (db->data != NULL) { if (db->data != NULL) {
db->data->close(db->data, 0); db->data->close(db->data, 0);
@ -641,8 +636,7 @@ lookup_cleanup:
*/ */
static isc_result_t static isc_result_t
bdbhpt_opendb(log_t *log, DB_ENV *db_env, DBTYPE db_type, DB **db, bdbhpt_opendb(log_t *log, DB_ENV *db_env, DBTYPE db_type, DB **db,
const char *db_name, char *db_file, int flags) const char *db_name, char *db_file, int flags) {
{
int result; int result;
/* Initialise the database. */ /* Initialise the database. */
@ -682,8 +676,7 @@ bdbhpt_opendb(log_t *log, DB_ENV *db_env, DBTYPE db_type, DB **db,
*/ */
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
isc_result_t result; isc_result_t result;
int bdbhptres; int bdbhptres;
int bdbFlags = 0; int bdbFlags = 0;
@ -826,8 +819,7 @@ init_cleanup:
* Shut down the backend * Shut down the backend
*/ */
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
struct bdbhpt_instance *db = (struct bdbhpt_instance *)dbdata; struct bdbhpt_instance *db = (struct bdbhpt_instance *)dbdata;
db->log(ISC_LOG_INFO, "dlz_bdbhpt_dynamic (%s): shutting down", db->log(ISC_LOG_INFO, "dlz_bdbhpt_dynamic (%s): shutting down",
@ -840,8 +832,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
UNUSED(flags); UNUSED(flags);
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
} }
@ -850,8 +841,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(struct bdbhpt_instance *db, const char *helper_name, void *ptr) b9_add_helper(struct bdbhpt_instance *db, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
db->log = (log_t *)ptr; db->log = (log_t *)ptr;
} }

View File

@ -61,8 +61,7 @@
*/ */
void void
destroy_querylist(query_list_t **querylist) destroy_querylist(query_list_t **querylist) {
{
query_segment_t *tseg = NULL; query_segment_t *tseg = NULL;
query_segment_t *nseg = NULL; query_segment_t *nseg = NULL;
@ -96,8 +95,7 @@ destroy_querylist(query_list_t **querylist)
isc_result_t isc_result_t
build_querylist(const char *query_str, char **zone, char **record, build_querylist(const char *query_str, char **zone, char **record,
char **client, query_list_t **querylist, unsigned int flags, char **client, query_list_t **querylist, unsigned int flags,
log_t log) log_t log) {
{
isc_result_t result; isc_result_t result;
bool foundzone = false; bool foundzone = false;
bool foundrecord = false; bool foundrecord = false;
@ -273,8 +271,7 @@ flag_fail:
* used to be in our queries from named.conf * used to be in our queries from named.conf
*/ */
char * char *
build_querystring(query_list_t *querylist) build_querystring(query_list_t *querylist) {
{
query_segment_t *tseg = NULL; query_segment_t *tseg = NULL;
unsigned int length = 0; unsigned int length = 0;
char *qs = NULL; char *qs = NULL;
@ -323,8 +320,7 @@ isc_result_t
build_dbinstance(const char *allnodes_str, const char *allowxfr_str, build_dbinstance(const char *allnodes_str, const char *allowxfr_str,
const char *authority_str, const char *findzone_str, const char *authority_str, const char *findzone_str,
const char *lookup_str, const char *countzone_str, const char *lookup_str, const char *countzone_str,
dbinstance_t **dbi, log_t log) dbinstance_t **dbi, log_t log) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *db = NULL; dbinstance_t *db = NULL;
int err; int err;
@ -452,8 +448,7 @@ cleanup:
} }
void void
destroy_dbinstance(dbinstance_t *dbi) destroy_dbinstance(dbinstance_t *dbi) {
{
/* destroy any query lists we created */ /* destroy any query lists we created */
destroy_querylist(&dbi->allnodes_q); destroy_querylist(&dbi->allnodes_q);
destroy_querylist(&dbi->allowxfr_q); destroy_querylist(&dbi->allowxfr_q);
@ -470,8 +465,7 @@ destroy_dbinstance(dbinstance_t *dbi)
} }
char * char *
get_parameter_value(const char *input, const char *key) get_parameter_value(const char *input, const char *key) {
{
int keylen; int keylen;
char *keystart; char *keystart;
char value[255]; char value[255];

View File

@ -27,8 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
void void
dir_init(dir_t *dir) dir_init(dir_t *dir) {
{
dir->entry.name[0] = '\0'; dir->entry.name[0] = '\0';
dir->entry.length = 0; dir->entry.length = 0;
@ -36,8 +35,7 @@ dir_init(dir_t *dir)
} }
isc_result_t isc_result_t
dir_open(dir_t *dir, const char *dirname) dir_open(dir_t *dir, const char *dirname) {
{
char *p; char *p;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@ -90,8 +88,7 @@ dir_open(dir_t *dir, const char *dirname)
* the dir stream and reads the first file in one operation. * the dir stream and reads the first file in one operation.
*/ */
isc_result_t isc_result_t
dir_read(dir_t *dir) dir_read(dir_t *dir) {
{
struct dirent *entry; struct dirent *entry;
entry = readdir(dir->handle); entry = readdir(dir->handle);
@ -113,8 +110,7 @@ dir_read(dir_t *dir)
* \brief Close directory stream. * \brief Close directory stream.
*/ */
void void
dir_close(dir_t *dir) dir_close(dir_t *dir) {
{
(void)closedir(dir->handle); (void)closedir(dir->handle);
dir->handle = NULL; dir->handle = NULL;
} }
@ -123,8 +119,7 @@ dir_close(dir_t *dir)
* \brief Reposition directory stream at start. * \brief Reposition directory stream at start.
*/ */
isc_result_t isc_result_t
dir_reset(dir_t *dir) dir_reset(dir_t *dir) {
{
rewinddir(dir->handle); rewinddir(dir->handle);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@ -88,15 +88,14 @@ typedef DLZ_LIST(dir_entry_t) dlist_t;
/* forward reference */ /* forward reference */
static void b9_add_helper(struct config_data *cd, const char *helper_name, static void
void *ptr); b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr);
/* /*
* Private methods * Private methods
*/ */
static bool static bool
is_safe(const char *input) is_safe(const char *input) {
{
unsigned int i; unsigned int i;
unsigned int len = strlen(input); unsigned int len = strlen(input);
@ -164,8 +163,7 @@ is_safe(const char *input)
} }
static isc_result_t static isc_result_t
create_path_helper(char *out, const char *in, config_data_t *cd) create_path_helper(char *out, const char *in, config_data_t *cd) {
{
char *tmpString; char *tmpString;
char *tmpPtr; char *tmpPtr;
int i; int i;
@ -232,8 +230,7 @@ create_path_helper(char *out, const char *in, config_data_t *cd)
static isc_result_t static isc_result_t
create_path(const char *zone, const char *host, const char *client, create_path(const char *zone, const char *host, const char *client,
config_data_t *cd, char **path) config_data_t *cd, char **path) {
{
char *tmpPath; char *tmpPath;
int pathsize; int pathsize;
int len; int len;
@ -361,8 +358,7 @@ cleanup_mem:
static isc_result_t static isc_result_t
process_dir(dir_t *dir, void *passback, config_data_t *cd, dlist_t *dir_list, process_dir(dir_t *dir, void *passback, config_data_t *cd, dlist_t *dir_list,
unsigned int basedirlen) unsigned int basedirlen) {
{
char tmp[DIR_PATHMAX + DIR_NAMEMAX]; char tmp[DIR_PATHMAX + DIR_NAMEMAX];
int astPos; int astPos;
struct stat sb; struct stat sb;
@ -582,8 +578,7 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, dlist_t *dir_list,
* DLZ methods * DLZ methods
*/ */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
isc_result_t result; isc_result_t result;
char *path; char *path;
struct stat sb; struct stat sb;
@ -614,8 +609,7 @@ complete_AXFR:
} }
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
dlist_t *dir_list; dlist_t *dir_list;
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
@ -849,8 +843,7 @@ complete_lkup:
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
isc_result_t result = ISC_R_NOMEMORY; isc_result_t result = ISC_R_NOMEMORY;
config_data_t *cd; config_data_t *cd;
char *endp; char *endp;
@ -971,8 +964,7 @@ free_cd:
} }
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
config_data_t *cd; config_data_t *cd;
cd = (config_data_t *)dbdata; cd = (config_data_t *)dbdata;
@ -1001,8 +993,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
UNUSED(flags); UNUSED(flags);
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
} }
@ -1011,8 +1002,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr) b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
cd->log = (log_t *)ptr; cd->log = (log_t *)ptr;
} }

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -108,17 +108,19 @@ typedef struct {
/* forward references */ /* forward references */
#if DLZ_DLOPEN_VERSION < 3 #if DLZ_DLOPEN_VERSION < 3
isc_result_t dlz_findzonedb(void *dbdata, const char *name); isc_result_t
dlz_findzonedb(void *dbdata, const char *name);
#else /* if DLZ_DLOPEN_VERSION < 3 */ #else /* if DLZ_DLOPEN_VERSION < 3 */
isc_result_t dlz_findzonedb(void *dbdata, const char *name, isc_result_t
dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo); dns_clientinfo_t *clientinfo);
#endif /* if DLZ_DLOPEN_VERSION < 3 */ #endif /* if DLZ_DLOPEN_VERSION < 3 */
void dlz_destroy(void *dbdata); void
dlz_destroy(void *dbdata);
static void b9_add_helper(ldap_instance_t *db, const char *helper_name, static void
void *ptr); b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr);
/* /*
* Private methods * Private methods
@ -126,8 +128,7 @@ static void b9_add_helper(ldap_instance_t *db, const char *helper_name,
/*% checks that the LDAP URL parameters make sense */ /*% checks that the LDAP URL parameters make sense */
static isc_result_t static isc_result_t
ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
int ldap_result; int ldap_result;
LDAPURLDesc *ldap_url = NULL; LDAPURLDesc *ldap_url = NULL;
@ -192,8 +193,7 @@ cleanup:
/*% Connects / reconnects to LDAP server */ /*% Connects / reconnects to LDAP server */
static isc_result_t static isc_result_t
ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) {
{
isc_result_t result; isc_result_t result;
int ldap_result; int ldap_result;
@ -248,8 +248,7 @@ cleanup:
* multithreaded operation. * multithreaded operation.
*/ */
static void static void
ldap_destroy_dblist(db_list_t *dblist) ldap_destroy_dblist(db_list_t *dblist) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -283,8 +282,7 @@ ldap_destroy_dblist(db_list_t *dblist)
* multithreaded operation. * multithreaded operation.
*/ */
static dbinstance_t * static dbinstance_t *
ldap_find_avail_conn(ldap_instance_t *ldap) ldap_find_avail_conn(ldap_instance_t *ldap) {
{
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
dbinstance_t *head; dbinstance_t *head;
int count = 0; int count = 0;
@ -318,8 +316,7 @@ ldap_find_avail_conn(ldap_instance_t *ldap)
static isc_result_t static isc_result_t
ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg, ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg,
char **attrs, void *ptr, bool allnodes) char **attrs, void *ptr, bool allnodes) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
int i = 0; int i = 0;
int j; int j;
@ -547,8 +544,7 @@ cleanup:
*/ */
static isc_result_t static isc_result_t
ldap_get_results(const char *zone, const char *record, const char *client, ldap_get_results(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, void *ptr) unsigned int query, void *dbdata, void *ptr) {
{
isc_result_t result; isc_result_t result;
ldap_instance_t *db = (ldap_instance_t *)dbdata; ldap_instance_t *db = (ldap_instance_t *)dbdata;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -837,8 +833,7 @@ cleanup:
* DLZ methods * DLZ methods
*/ */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
isc_result_t result; isc_result_t result;
/* check to see if we are authoritative for the zone first */ /* check to see if we are authoritative for the zone first */
@ -857,14 +852,12 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
} }
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes)); return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes));
} }
isc_result_t isc_result_t
dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
{
return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup)); return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup));
} }
@ -914,8 +907,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
isc_result_t result = ISC_R_FAILURE; isc_result_t result = ISC_R_FAILURE;
ldap_instance_t *ldap = NULL; ldap_instance_t *ldap = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1201,8 +1193,7 @@ cleanup:
} }
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
if (dbdata != NULL) { if (dbdata != NULL) {
ldap_instance_t *db = (ldap_instance_t *)dbdata; ldap_instance_t *db = (ldap_instance_t *)dbdata;
#if PTHREADS #if PTHREADS
@ -1236,8 +1227,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
*flags |= DNS_SDLZFLAG_RELATIVERDATA; *flags |= DNS_SDLZFLAG_RELATIVERDATA;
#if PTHREADS #if PTHREADS
*flags |= DNS_SDLZFLAG_THREADSAFE; *flags |= DNS_SDLZFLAG_THREADSAFE;
@ -1251,8 +1241,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr) b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
db->log = (log_t *)ptr; db->log = (log_t *)ptr;
} }

View File

@ -97,22 +97,22 @@ typedef struct {
} mysql_instance_t; } mysql_instance_t;
/* forward references */ /* forward references */
isc_result_t dlz_findzonedb(void *dbdata, const char *name, isc_result_t
dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo); dns_clientinfo_t *clientinfo);
void dlz_destroy(void *dbdata); void
dlz_destroy(void *dbdata);
static void b9_add_helper(mysql_instance_t *db, const char *helper_name, static void
void *ptr); b9_add_helper(mysql_instance_t *db, const char *helper_name, void *ptr);
/* /*
* Private methods * Private methods
*/ */
void void
mysql_destroy(dbinstance_t *db) mysql_destroy(dbinstance_t *db) {
{
/* release DB connection */ /* release DB connection */
if (db->dbconn != NULL) { if (db->dbconn != NULL) {
mysql_close((MYSQL *)db->dbconn); mysql_close((MYSQL *)db->dbconn);
@ -129,8 +129,7 @@ mysql_destroy(dbinstance_t *db)
* multithreaded operation. * multithreaded operation.
*/ */
static void static void
mysql_destroy_dblist(db_list_t *dblist) mysql_destroy_dblist(db_list_t *dblist) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -157,8 +156,7 @@ mysql_destroy_dblist(db_list_t *dblist)
* multithreaded operation. * multithreaded operation.
*/ */
static dbinstance_t * static dbinstance_t *
mysql_find_avail_conn(mysql_instance_t *mysql) mysql_find_avail_conn(mysql_instance_t *mysql) {
{
dbinstance_t *dbi = NULL, *head; dbinstance_t *dbi = NULL, *head;
int count = 0; int count = 0;
@ -197,8 +195,7 @@ mysql_find_avail_conn(mysql_instance_t *mysql)
* want special characters in the string causing problems. * want special characters in the string causing problems.
*/ */
static char * static char *
mysqldrv_escape_string(MYSQL *mysql, const char *instr) mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
{
char *outstr; char *outstr;
unsigned int len; unsigned int len;
@ -228,8 +225,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr)
*/ */
static isc_result_t static isc_result_t
mysql_get_resultset(const char *zone, const char *record, const char *client, mysql_get_resultset(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, MYSQL_RES **rs) unsigned int query, void *dbdata, MYSQL_RES **rs) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
@ -441,8 +437,8 @@ cleanup:
* into this function to minimize code. * into this function to minimize code.
*/ */
static isc_result_t static isc_result_t
mysql_process_rs(mysql_instance_t *db, dns_sdlzlookup_t *lookup, MYSQL_RES *rs) mysql_process_rs(mysql_instance_t *db, dns_sdlzlookup_t *lookup,
{ MYSQL_RES *rs) {
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
MYSQL_ROW row; MYSQL_ROW row;
unsigned int fields; unsigned int fields;
@ -554,8 +550,7 @@ mysql_process_rs(mysql_instance_t *db, dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
/*% determine if the zone is supported by (in) the database */ /*% determine if the zone is supported by (in) the database */
isc_result_t isc_result_t
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
my_ulonglong rows; my_ulonglong rows;
@ -591,8 +586,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
/*% Determine if the client is allowed to perform a zone transfer */ /*% Determine if the client is allowed to perform a zone transfer */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
isc_result_t result; isc_result_t result;
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
@ -643,8 +637,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
* query. * query.
*/ */
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
@ -747,8 +740,7 @@ cleanup:
* use this function to get that information for named. * use this function to get that information for named.
*/ */
isc_result_t isc_result_t
dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
@ -778,8 +770,7 @@ dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup)
isc_result_t isc_result_t
dlz_lookup(const char *zone, const char *name, void *dbdata, dlz_lookup(const char *zone, const char *name, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
MYSQL_RES *rs = NULL; MYSQL_RES *rs = NULL;
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
@ -811,8 +802,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
*/ */
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
isc_result_t result = ISC_R_FAILURE; isc_result_t result = ISC_R_FAILURE;
mysql_instance_t *mysql = NULL; mysql_instance_t *mysql = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1074,8 +1064,7 @@ cleanup:
* Destroy the module. * Destroy the module.
*/ */
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
mysql_instance_t *db = (mysql_instance_t *)dbdata; mysql_instance_t *db = (mysql_instance_t *)dbdata;
#if PTHREADS #if PTHREADS
/* cleanup the list of DBI's */ /* cleanup the list of DBI's */
@ -1107,8 +1096,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
*flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA | *flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA |
DNS_SDLZFLAG_THREADSAFE); DNS_SDLZFLAG_THREADSAFE);
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
@ -1118,8 +1106,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(mysql_instance_t *db, const char *helper_name, void *ptr) b9_add_helper(mysql_instance_t *db, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
db->log = (log_t *)ptr; db->log = (log_t *)ptr;
} }

View File

@ -251,8 +251,7 @@ static const char *modname = "dlz_mysqldyn";
* Local functions * Local functions
*/ */
static bool static bool
db_connect(mysql_data_t *state, mysql_instance_t *dbi) db_connect(mysql_data_t *state, mysql_instance_t *dbi) {
{
MYSQL *conn; MYSQL *conn;
/* /*
* Make sure this thread has been through 'init' * Make sure this thread has been through 'init'
@ -287,8 +286,7 @@ db_connect(mysql_data_t *state, mysql_instance_t *dbi)
} }
static mysql_instance_t * static mysql_instance_t *
get_dbi(mysql_data_t *state) get_dbi(mysql_data_t *state) {
{
int i; int i;
/* /*
@ -315,8 +313,7 @@ get_dbi(mysql_data_t *state)
* of string 'original' * of string 'original'
*/ */
static char * static char *
sanitize(mysql_instance_t *dbi, const char *original) sanitize(mysql_instance_t *dbi, const char *original) {
{
char *s; char *s;
if (original == NULL) { if (original == NULL) {
@ -339,8 +336,7 @@ sanitize(mysql_instance_t *dbi, const char *original)
* and add the string length to the running total pointed to by 'len'. * and add the string length to the running total pointed to by 'len'.
*/ */
static isc_result_t static isc_result_t
additem(mysql_arglist_t *arglist, char **s, size_t *len) additem(mysql_arglist_t *arglist, char **s, size_t *len) {
{
mysql_arg_t *item; mysql_arg_t *item;
item = malloc(sizeof(*item)); item = malloc(sizeof(*item));
@ -369,8 +365,7 @@ additem(mysql_arglist_t *arglist, char **s, size_t *len)
*/ */
static char * static char *
build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command, build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command,
...) ...) {
{
isc_result_t result; isc_result_t result;
bool localdbi = false; bool localdbi = false;
mysql_arglist_t arglist; mysql_arglist_t arglist;
@ -491,8 +486,7 @@ fail:
/* Does this name end in a dot? */ /* Does this name end in a dot? */
static bool static bool
isrelative(const char *s) isrelative(const char *s) {
{
if (s == NULL || s[strlen(s) - 1] == '.') { if (s == NULL || s[strlen(s) - 1] == '.') {
return (false); return (false);
} }
@ -501,8 +495,7 @@ isrelative(const char *s)
/* Return a dot if 's' doesn't already end with one */ /* Return a dot if 's' doesn't already end with one */
static inline const char * static inline const char *
dot(const char *s) dot(const char *s) {
{
return (isrelative(s) ? "." : ""); return (isrelative(s) ? "." : "");
} }
@ -512,8 +505,7 @@ dot(const char *s)
* enough space). * enough space).
*/ */
static void static void
fqhn(const char *name, const char *zone, char *dest) fqhn(const char *name, const char *zone, char *dest) {
{
if (dest == NULL) { if (dest == NULL) {
return; return;
} }
@ -534,8 +526,7 @@ fqhn(const char *name, const char *zone, char *dest)
* removes labels matching 'zone' from the end of 'name'. * removes labels matching 'zone' from the end of 'name'.
*/ */
static char * static char *
relname(const char *name, const char *zone) relname(const char *name, const char *zone) {
{
size_t nlen, zlen; size_t nlen, zlen;
const char *p; const char *p;
char *new; char *new;
@ -570,8 +561,7 @@ relname(const char *name, const char *zone)
} }
static isc_result_t static isc_result_t
validate_txn(mysql_data_t *state, mysql_transaction_t *txn) validate_txn(mysql_data_t *state, mysql_transaction_t *txn) {
{
isc_result_t result = ISC_R_FAILURE; isc_result_t result = ISC_R_FAILURE;
mysql_transaction_t *txp; mysql_transaction_t *txp;
@ -592,8 +582,7 @@ validate_txn(mysql_data_t *state, mysql_transaction_t *txn)
} }
static isc_result_t static isc_result_t
db_execute(mysql_data_t *state, mysql_instance_t *dbi, const char *query) db_execute(mysql_data_t *state, mysql_instance_t *dbi, const char *query) {
{
int ret; int ret;
/* Make sure this instance is connected. */ /* Make sure this instance is connected. */
@ -619,8 +608,7 @@ db_execute(mysql_data_t *state, mysql_instance_t *dbi, const char *query)
} }
static MYSQL_RES * static MYSQL_RES *
db_query(mysql_data_t *state, mysql_instance_t *dbi, const char *query) db_query(mysql_data_t *state, mysql_instance_t *dbi, const char *query) {
{
isc_result_t result; isc_result_t result;
bool localdbi = false; bool localdbi = false;
MYSQL_RES *res = NULL; MYSQL_RES *res = NULL;
@ -684,8 +672,7 @@ fail:
* values to the 'on the wire' packet values. * values to the 'on the wire' packet values.
*/ */
static unsigned char * static unsigned char *
make_notify(const char *zone, int *packetlen) make_notify(const char *zone, int *packetlen) {
{
int i, j; int i, j;
unsigned char *packet = (unsigned char *)malloc(strlen(zone) + 18); unsigned char *packet = (unsigned char *)malloc(strlen(zone) + 18);
@ -739,8 +726,7 @@ make_notify(const char *zone, int *packetlen)
} }
static void static void
send_notify(struct sockaddr_in *addr, const unsigned char *p, const int plen) send_notify(struct sockaddr_in *addr, const unsigned char *p, const int plen) {
{
int s; int s;
addr->sin_family = AF_INET; addr->sin_family = AF_INET;
@ -759,8 +745,7 @@ send_notify(struct sockaddr_in *addr, const unsigned char *p, const int plen)
* Generate and send a DNS NOTIFY packet * Generate and send a DNS NOTIFY packet
*/ */
static void static void
notify(mysql_data_t *state, const char *zone, int sn) notify(mysql_data_t *state, const char *zone, int sn) {
{
MYSQL_RES *res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
char *query; char *query;
@ -851,8 +836,7 @@ notify(mysql_data_t *state, const char *zone, int sn)
* used in the dlz_{add,sub,del}rdataset functions below. * used in the dlz_{add,sub,del}rdataset functions below.
*/ */
static mysql_record_t * static mysql_record_t *
makerecord(mysql_data_t *state, const char *name, const char *rdatastr) makerecord(mysql_data_t *state, const char *name, const char *rdatastr) {
{
mysql_record_t *new_record; mysql_record_t *new_record;
char *real_name, *dclass, *type, *data, *ttlstr, *buf; char *real_name, *dclass, *type, *data, *ttlstr, *buf;
dns_ttl_t ttlvalue; dns_ttl_t ttlvalue;
@ -929,8 +913,7 @@ error:
* Remember a helper function from the bind9 dlz_dlopen driver * Remember a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(mysql_data_t *state, const char *helper_name, void *ptr) b9_add_helper(mysql_data_t *state, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
state->log = (log_t *)ptr; state->log = (log_t *)ptr;
} }
@ -953,8 +936,7 @@ b9_add_helper(mysql_data_t *state, const char *helper_name, void *ptr)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
UNUSED(flags); UNUSED(flags);
*flags |= DNS_SDLZFLAG_THREADSAFE; *flags |= DNS_SDLZFLAG_THREADSAFE;
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
@ -965,8 +947,7 @@ dlz_version(unsigned int *flags)
*/ */
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
mysql_data_t *state; mysql_data_t *state;
const char *helper_name; const char *helper_name;
va_list ap; va_list ap;
@ -1067,8 +1048,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
* Shut down the backend * Shut down the backend
*/ */
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
int i; int i;
@ -1095,8 +1075,7 @@ dlz_destroy(void *dbdata)
*/ */
isc_result_t isc_result_t
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
MYSQL_RES *res; MYSQL_RES *res;
@ -1128,8 +1107,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
isc_result_t isc_result_t
dlz_lookup(const char *zone, const char *name, void *dbdata, dlz_lookup(const char *zone, const char *name, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
bool found = false; bool found = false;
@ -1266,8 +1244,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
* See if a zone transfer is allowed * See if a zone transfer is allowed
*/ */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
if (state->debug && state->log != NULL) { if (state->debug && state->log != NULL) {
@ -1283,8 +1260,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
* Perform a zone transfer * Perform a zone transfer
*/ */
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
MYSQL_RES *res; MYSQL_RES *res;
@ -1336,8 +1312,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes)
* Start a transaction * Start a transaction
*/ */
isc_result_t isc_result_t
dlz_newversion(const char *zone, void *dbdata, void **versionp) dlz_newversion(const char *zone, void *dbdata, void **versionp) {
{
isc_result_t result = ISC_R_FAILURE; isc_result_t result = ISC_R_FAILURE;
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
MYSQL_RES *res; MYSQL_RES *res;
@ -1451,8 +1426,7 @@ cleanup:
* End a transaction * End a transaction
*/ */
void void
dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) {
{
isc_result_t result; isc_result_t result;
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
mysql_transaction_t *txn = (mysql_transaction_t *)*versionp; mysql_transaction_t *txn = (mysql_transaction_t *)*versionp;
@ -1654,8 +1628,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata)
bool bool
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
const char *type, const char *key, uint32_t keydatalen, const char *type, const char *key, uint32_t keydatalen,
unsigned char *keydata, void *dbdata) unsigned char *keydata, void *dbdata) {
{
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
UNUSED(tcpaddr); UNUSED(tcpaddr);
@ -1673,8 +1646,7 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
isc_result_t isc_result_t
dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata, dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
void *version) void *version) {
{
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
mysql_transaction_t *txn = (mysql_transaction_t *)version; mysql_transaction_t *txn = (mysql_transaction_t *)version;
char *new_name, *query; char *new_name, *query;
@ -1737,8 +1709,7 @@ cleanup:
isc_result_t isc_result_t
dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata, dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
void *version) void *version) {
{
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
mysql_transaction_t *txn = (mysql_transaction_t *)version; mysql_transaction_t *txn = (mysql_transaction_t *)version;
char *new_name, *query; char *new_name, *query;
@ -1788,8 +1759,8 @@ cleanup:
} }
isc_result_t isc_result_t
dlz_delrdataset(const char *name, const char *type, void *dbdata, void *version) dlz_delrdataset(const char *name, const char *type, void *dbdata,
{ void *version) {
mysql_data_t *state = (mysql_data_t *)dbdata; mysql_data_t *state = (mysql_data_t *)dbdata;
mysql_transaction_t *txn = (mysql_transaction_t *)version; mysql_transaction_t *txn = (mysql_transaction_t *)version;
char *new_name, *query; char *new_name, *query;

View File

@ -101,11 +101,14 @@ typedef struct config_data {
* the warnings. * the warnings.
*/ */
EXTERN_C void xs_init(pTHX); EXTERN_C void xs_init(pTHX);
EXTERN_C void boot_DynaLoader(pTHX_ CV *cv); EXTERN_C void
EXTERN_C void boot_DLZ_Perl__clientinfo(pTHX_ CV *cv); boot_DynaLoader(pTHX_ CV *cv);
EXTERN_C void boot_DLZ_Perl(pTHX_ CV *cv); EXTERN_C void
EXTERN_C void xs_init(pTHX) boot_DLZ_Perl__clientinfo(pTHX_ CV *cv);
{ EXTERN_C void
boot_DLZ_Perl(pTHX_ CV *cv);
EXTERN_C void
xs_init(pTHX) {
char *file = __FILE__; char *file = __FILE__;
dXSUB_SYS; dXSUB_SYS;
@ -124,8 +127,7 @@ EXTERN_C void xs_init(pTHX)
* remember a helper function, from the bind9 dlz_dlopen driver * remember a helper function, from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(config_data_t *state, const char *helper_name, void *ptr) b9_add_helper(config_data_t *state, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
state->log = ptr; state->log = ptr;
} }
@ -141,14 +143,12 @@ b9_add_helper(config_data_t *state, const char *helper_name, void *ptr)
} }
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
} }
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
isc_result_t retval; isc_result_t retval;
int rrcount, r; int rrcount, r;
@ -250,8 +250,7 @@ CLEAN_UP_AND_RETURN:
} }
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
int r; int r;
isc_result_t retval; isc_result_t retval;
@ -528,8 +527,7 @@ missing_perl_method(const char *perl_class_name)
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
config_data_t *cd; config_data_t *cd;
char *init_args[] = { NULL, NULL }; char *init_args[] = { NULL, NULL };
char *perlrun[] = { "", NULL, "dlz perl", NULL }; char *perlrun[] = { "", NULL, "dlz perl", NULL };
@ -716,8 +714,7 @@ CLEAN_UP_PERL_AND_FAIL:
} }
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
#ifdef MULTIPLICITY #ifdef MULTIPLICITY
PerlInterpreter *my_perl = cd->perl; PerlInterpreter *my_perl = cd->perl;

View File

@ -102,22 +102,22 @@ typedef struct {
} sqlite3_res_t; } sqlite3_res_t;
/* forward references */ /* forward references */
isc_result_t dlz_findzonedb(void *dbdata, const char *name, isc_result_t
dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo); dns_clientinfo_t *clientinfo);
void dlz_destroy(void *dbdata); void
dlz_destroy(void *dbdata);
static void b9_add_helper(sqlite3_instance_t *db, const char *helper_name, static void
void *ptr); b9_add_helper(sqlite3_instance_t *db, const char *helper_name, void *ptr);
/* /*
* Private methods * Private methods
*/ */
void void
sqlite3_destroy(dbinstance_t *db) sqlite3_destroy(dbinstance_t *db) {
{
/* release DB connection */ /* release DB connection */
if (db->dbconn != NULL) { if (db->dbconn != NULL) {
sqlite3_close((sqlite3 *)db->dbconn); sqlite3_close((sqlite3 *)db->dbconn);
@ -135,8 +135,7 @@ sqlite3_destroy(dbinstance_t *db)
* multithreaded operation. * multithreaded operation.
*/ */
static void static void
sqlite3_destroy_dblist(db_list_t *dblist) sqlite3_destroy_dblist(db_list_t *dblist) {
{
dbinstance_t *ndbi = NULL; dbinstance_t *ndbi = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -163,8 +162,7 @@ sqlite3_destroy_dblist(db_list_t *dblist)
* multithreaded operation. * multithreaded operation.
*/ */
static dbinstance_t * static dbinstance_t *
sqlite3_find_avail(sqlite3_instance_t *sqlite3) sqlite3_find_avail(sqlite3_instance_t *sqlite3) {
{
dbinstance_t *dbi = NULL, *head; dbinstance_t *dbi = NULL, *head;
int count = 0; int count = 0;
@ -203,8 +201,7 @@ sqlite3_find_avail(sqlite3_instance_t *sqlite3)
* want special characters in the string causing problems. * want special characters in the string causing problems.
*/ */
static char * static char *
escape_string(const char *instr) escape_string(const char *instr) {
{
char *outstr; char *outstr;
char *ptr; char *ptr;
unsigned int len; unsigned int len;
@ -252,8 +249,7 @@ escape_string(const char *instr)
*/ */
static isc_result_t static isc_result_t
sqlite3_get_resultset(const char *zone, const char *record, const char *client, sqlite3_get_resultset(const char *zone, const char *record, const char *client,
unsigned int query, void *dbdata, sqlite3_res_t **rsp) unsigned int query, void *dbdata, sqlite3_res_t **rsp) {
{
isc_result_t result; isc_result_t result;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
@ -476,8 +472,7 @@ cleanup:
*/ */
char ** char **
sqlite3_fetch_row(sqlite3_res_t *rs) sqlite3_fetch_row(sqlite3_res_t *rs) {
{
char **retval = NULL; char **retval = NULL;
if (rs != NULL) { if (rs != NULL) {
if (rs->pnRow > 0U && rs->curRow < rs->pnRow) { if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
@ -490,8 +485,7 @@ sqlite3_fetch_row(sqlite3_res_t *rs)
} }
unsigned int unsigned int
sqlite3_num_fields(sqlite3_res_t *rs) sqlite3_num_fields(sqlite3_res_t *rs) {
{
unsigned int retval = 0; unsigned int retval = 0;
if (rs != NULL) { if (rs != NULL) {
retval = rs->pnColumn; retval = rs->pnColumn;
@ -500,8 +494,7 @@ sqlite3_num_fields(sqlite3_res_t *rs)
} }
unsigned int unsigned int
sqlite3_num_rows(sqlite3_res_t *rs) sqlite3_num_rows(sqlite3_res_t *rs) {
{
unsigned int retval = 0; unsigned int retval = 0;
if (rs != NULL) { if (rs != NULL) {
retval = rs->pnRow; retval = rs->pnRow;
@ -510,8 +503,7 @@ sqlite3_num_rows(sqlite3_res_t *rs)
} }
void void
sqlite3_free_result(sqlite3_res_t *rs) sqlite3_free_result(sqlite3_res_t *rs) {
{
if (rs != NULL) { if (rs != NULL) {
sqlite3_free_table(rs->pazResult); sqlite3_free_table(rs->pazResult);
free(rs); free(rs);
@ -520,8 +512,7 @@ sqlite3_free_result(sqlite3_res_t *rs)
static isc_result_t static isc_result_t
sqlite3_process_rs(sqlite3_instance_t *db, dns_sdlzlookup_t *lookup, sqlite3_process_rs(sqlite3_instance_t *db, dns_sdlzlookup_t *lookup,
sqlite3_res_t *rs) sqlite3_res_t *rs) {
{
isc_result_t result = ISC_R_NOTFOUND; isc_result_t result = ISC_R_NOTFOUND;
char **row; char **row;
unsigned int fields; unsigned int fields;
@ -633,8 +624,7 @@ sqlite3_process_rs(sqlite3_instance_t *db, dns_sdlzlookup_t *lookup,
/*% determine if the zone is supported by (in) the database */ /*% determine if the zone is supported by (in) the database */
isc_result_t isc_result_t
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
sqlite3_res_t *rs = NULL; sqlite3_res_t *rs = NULL;
sqlite3_uint64 rows; sqlite3_uint64 rows;
@ -671,8 +661,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
/*% Determine if the client is allowed to perform a zone transfer */ /*% Determine if the client is allowed to perform a zone transfer */
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
isc_result_t result; isc_result_t result;
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
sqlite3_res_t *rs = NULL; sqlite3_res_t *rs = NULL;
@ -724,8 +713,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
* query. * query.
*/ */
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
isc_result_t result; isc_result_t result;
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
sqlite3_res_t *rs = NULL; sqlite3_res_t *rs = NULL;
@ -828,8 +816,7 @@ cleanup:
* use this function to get that information for named. * use this function to get that information for named.
*/ */
isc_result_t isc_result_t
dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
sqlite3_res_t *rs = NULL; sqlite3_res_t *rs = NULL;
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
@ -860,8 +847,7 @@ dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup)
isc_result_t isc_result_t
dlz_lookup(const char *zone, const char *name, void *dbdata, dlz_lookup(const char *zone, const char *name, void *dbdata,
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo) dns_clientinfo_t *clientinfo) {
{
isc_result_t result; isc_result_t result;
sqlite3_res_t *rs = NULL; sqlite3_res_t *rs = NULL;
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
@ -893,8 +879,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
*/ */
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
isc_result_t result = ISC_R_FAILURE; isc_result_t result = ISC_R_FAILURE;
sqlite3_instance_t *s3 = NULL; sqlite3_instance_t *s3 = NULL;
dbinstance_t *dbi = NULL; dbinstance_t *dbi = NULL;
@ -1080,8 +1065,7 @@ cleanup:
* Destroy the module. * Destroy the module.
*/ */
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata; sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
#if PTHREADS #if PTHREADS
/* cleanup the list of DBI's */ /* cleanup the list of DBI's */
@ -1101,8 +1085,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
*flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA | *flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA |
DNS_SDLZFLAG_THREADSAFE); DNS_SDLZFLAG_THREADSAFE);
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
@ -1112,8 +1095,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(sqlite3_instance_t *db, const char *helper_name, void *ptr) b9_add_helper(sqlite3_instance_t *db, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
db->log = (log_t *)ptr; db->log = (log_t *)ptr;
} }

View File

@ -114,18 +114,20 @@ struct named_rr {
/* /*
* Forward references * Forward references
*/ */
static int rangematch(const char *, char, int, char **); static int
rangematch(const char *, char, int, char **);
static int fnmatch(const char *pattern, const char *string, int flags); static int
fnmatch(const char *pattern, const char *string, int flags);
static void b9_add_helper(struct config_data *cd, const char *helper_name, static void
void *ptr); b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr);
static const char *shortest_match(const char *pattern, const char *string); static const char *
shortest_match(const char *pattern, const char *string);
isc_result_t isc_result_t
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
isc_result_t result; isc_result_t result;
char *querystring = NULL; char *querystring = NULL;
@ -176,8 +178,7 @@ done:
} }
isc_result_t isc_result_t
dlz_allowzonexfr(void *dbdata, const char *name, const char *client) dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
UNUSED(name); UNUSED(name);
@ -318,8 +319,7 @@ done:
} }
isc_result_t isc_result_t
dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
{
isc_result_t result; isc_result_t result;
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
char *querystring = NULL; char *querystring = NULL;
@ -376,8 +376,7 @@ done:
} }
static void static void
destroy_rrlist(config_data_t *cd) destroy_rrlist(config_data_t *cd) {
{
nrr_t *trec, *nrec; nrr_t *trec, *nrec;
nrec = DLZ_LIST_HEAD(cd->rrs_list); nrec = DLZ_LIST_HEAD(cd->rrs_list);
@ -404,8 +403,7 @@ destroy_rrlist(config_data_t *cd)
isc_result_t isc_result_t
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
...) ...) {
{
config_data_t *cd; config_data_t *cd;
char *endp; char *endp;
int i, def_ttl; int i, def_ttl;
@ -516,8 +514,7 @@ cleanup:
} }
void void
dlz_destroy(void *dbdata) dlz_destroy(void *dbdata) {
{
config_data_t *cd = (config_data_t *)dbdata; config_data_t *cd = (config_data_t *)dbdata;
/* /*
@ -536,8 +533,7 @@ dlz_destroy(void *dbdata)
* Return the version of the API * Return the version of the API
*/ */
int int
dlz_version(unsigned int *flags) dlz_version(unsigned int *flags) {
{
UNUSED(flags); UNUSED(flags);
/* XXX: ok to set DNS_SDLZFLAG_THREADSAFE here? */ /* XXX: ok to set DNS_SDLZFLAG_THREADSAFE here? */
return (DLZ_DLOPEN_VERSION); return (DLZ_DLOPEN_VERSION);
@ -547,8 +543,7 @@ dlz_version(unsigned int *flags)
* Register a helper function from the bind9 dlz_dlopen driver * Register a helper function from the bind9 dlz_dlopen driver
*/ */
static void static void
b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr) b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr) {
{
if (strcmp(helper_name, "log") == 0) { if (strcmp(helper_name, "log") == 0) {
cd->log = (log_t *)ptr; cd->log = (log_t *)ptr;
} }
@ -564,8 +559,7 @@ b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr)
} }
static const char * static const char *
shortest_match(const char *pattern, const char *string) shortest_match(const char *pattern, const char *string) {
{
const char *p = string; const char *p = string;
if (pattern == NULL || p == NULL || *p == '\0') { if (pattern == NULL || p == NULL || *p == '\0') {
return (NULL); return (NULL);
@ -601,8 +595,7 @@ shortest_match(const char *pattern, const char *string)
#define RANGE_ERROR (-1) #define RANGE_ERROR (-1)
static int static int
fnmatch(const char *pattern, const char *string, int flags) fnmatch(const char *pattern, const char *string, int flags) {
{
const char *stringstart; const char *stringstart;
char *newp; char *newp;
char c, test; char c, test;
@ -724,8 +717,7 @@ fnmatch(const char *pattern, const char *string, int flags)
} }
static int static int
rangematch(const char *pattern, char test, int flags, char **newp) rangematch(const char *pattern, char test, int flags, char **newp) {
{
int negate, ok; int negate, ok;
char c, c2; char c, c2;

View File

@ -22,8 +22,7 @@ int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
int int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
{
isc_buffer_t buf; isc_buffer_t buf;
isc_result_t result; isc_result_t result;
dns_fixedname_t origin; dns_fixedname_t origin;

View File

@ -42,15 +42,13 @@ int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
static void static void
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) {
{
UNUSED(cb); UNUSED(cb);
UNUSED(fmt); UNUSED(fmt);
} }
int int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
{
char totext[1024]; char totext[1024];
dns_compress_t cctx; dns_compress_t cctx;
dns_decompress_t dctx; dns_decompress_t dctx;

View File

@ -28,14 +28,12 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static void __attribute__((constructor)) init(void) static void __attribute__((constructor)) init(void) {
{
isc_mem_create(&mctx); isc_mem_create(&mctx);
RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS); RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS);
} }
static void __attribute__((destructor)) deinit(void) static void __attribute__((destructor)) deinit(void) {
{
dst_lib_destroy(); dst_lib_destroy();
isc_mem_destroy(&mctx); isc_mem_destroy(&mctx);
} }

View File

@ -26,8 +26,7 @@
#include <dirent.h> #include <dirent.h>
static void static void
test_all_from(const char *dirname) test_all_from(const char *dirname) {
{
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
@ -91,8 +90,7 @@ test_all_from(const char *dirname)
} }
int int
main(int argc, char **argv) main(int argc, char **argv) {
{
char corpusdir[PATH_MAX]; char corpusdir[PATH_MAX];
const char *target = strrchr(argv[0], '/'); const char *target = strrchr(argv[0], '/');
@ -114,8 +112,7 @@ main(int argc, char **argv)
#elif __AFL_COMPILER #elif __AFL_COMPILER
int int
main(int argc, char **argv) main(int argc, char **argv) {
{
int ret; int ret;
unsigned char buf[64 * 1024]; unsigned char buf[64 * 1024];

View File

@ -60,8 +60,9 @@
#include <dst/result.h> #include <dst/result.h>
#include <pk11/site.h> #include <pk11/site.h>
static isc_result_t fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, static isc_result_t
bool writeable, isc_log_t *logctxlogc); fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, bool writeable,
isc_log_t *logctxlogc);
static void static void
freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) { freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) {

View File

@ -0,0 +1 @@
../../../.clang-format.headers

View File

@ -284,65 +284,105 @@ struct dns_adbentry {
/* /*
* Internal functions (and prototypes). * Internal functions (and prototypes).
*/ */
static inline dns_adbname_t *new_adbname(dns_adb_t *, const dns_name_t *); static inline dns_adbname_t *
static inline void free_adbname(dns_adb_t *, dns_adbname_t **); new_adbname(dns_adb_t *, const dns_name_t *);
static inline dns_adbnamehook_t *new_adbnamehook(dns_adb_t *, dns_adbentry_t *); static inline void
static inline void free_adbnamehook(dns_adb_t *, dns_adbnamehook_t **); free_adbname(dns_adb_t *, dns_adbname_t **);
static inline dns_adbnamehook_t *
new_adbnamehook(dns_adb_t *, dns_adbentry_t *);
static inline void
free_adbnamehook(dns_adb_t *, dns_adbnamehook_t **);
static inline dns_adblameinfo_t * static inline dns_adblameinfo_t *
new_adblameinfo(dns_adb_t *, const dns_name_t *, dns_rdatatype_t); new_adblameinfo(dns_adb_t *, const dns_name_t *, dns_rdatatype_t);
static inline void free_adblameinfo(dns_adb_t *, dns_adblameinfo_t **); static inline void
static inline dns_adbentry_t *new_adbentry(dns_adb_t *); free_adblameinfo(dns_adb_t *, dns_adblameinfo_t **);
static inline void free_adbentry(dns_adb_t *, dns_adbentry_t **); static inline dns_adbentry_t *
static inline dns_adbfind_t *new_adbfind(dns_adb_t *); new_adbentry(dns_adb_t *);
static inline bool free_adbfind(dns_adb_t *, dns_adbfind_t **); static inline void
static inline dns_adbaddrinfo_t *new_adbaddrinfo(dns_adb_t *, dns_adbentry_t *, free_adbentry(dns_adb_t *, dns_adbentry_t **);
in_port_t); static inline dns_adbfind_t *
static inline dns_adbfetch_t *new_adbfetch(dns_adb_t *); new_adbfind(dns_adb_t *);
static inline void free_adbfetch(dns_adb_t *, dns_adbfetch_t **); static inline bool
static inline dns_adbname_t *find_name_and_lock(dns_adb_t *, const dns_name_t *, free_adbfind(dns_adb_t *, dns_adbfind_t **);
unsigned int, int *); static inline dns_adbaddrinfo_t *
new_adbaddrinfo(dns_adb_t *, dns_adbentry_t *, in_port_t);
static inline dns_adbfetch_t *
new_adbfetch(dns_adb_t *);
static inline void
free_adbfetch(dns_adb_t *, dns_adbfetch_t **);
static inline dns_adbname_t *
find_name_and_lock(dns_adb_t *, const dns_name_t *, unsigned int, int *);
static inline dns_adbentry_t * static inline dns_adbentry_t *
find_entry_and_lock(dns_adb_t *, const isc_sockaddr_t *, int *, isc_stdtime_t); find_entry_and_lock(dns_adb_t *, const isc_sockaddr_t *, int *, isc_stdtime_t);
static void dump_adb(dns_adb_t *, FILE *, bool debug, isc_stdtime_t); static void
static void print_dns_name(FILE *, const dns_name_t *); dump_adb(dns_adb_t *, FILE *, bool debug, isc_stdtime_t);
static void print_namehook_list(FILE *, const char *legend, dns_adb_t *adb, static void
dns_adbnamehooklist_t *list, bool debug, print_dns_name(FILE *, const dns_name_t *);
isc_stdtime_t now); static void
static void print_find_list(FILE *, dns_adbname_t *); print_namehook_list(FILE *, const char *legend, dns_adb_t *adb,
static void print_fetch_list(FILE *, dns_adbname_t *); dns_adbnamehooklist_t *list, bool debug, isc_stdtime_t now);
static inline bool dec_adb_irefcnt(dns_adb_t *); static void
static inline void inc_adb_irefcnt(dns_adb_t *); print_find_list(FILE *, dns_adbname_t *);
static inline void inc_adb_erefcnt(dns_adb_t *); static void
static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, bool); print_fetch_list(FILE *, dns_adbname_t *);
static inline bool dec_entry_refcnt(dns_adb_t *, bool, dns_adbentry_t *, bool); static inline bool
static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); dec_adb_irefcnt(dns_adb_t *);
static bool clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static inline void
static void clean_target(dns_adb_t *, dns_name_t *); inc_adb_irefcnt(dns_adb_t *);
static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int); static inline void
static bool check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); inc_adb_erefcnt(dns_adb_t *);
static bool check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); static inline void
static void cancel_fetches_at_name(dns_adbname_t *); inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, bool);
static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, static inline bool
dec_entry_refcnt(dns_adb_t *, bool, dns_adbentry_t *, bool);
static inline void
violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *);
static bool
clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *);
static void
clean_target(dns_adb_t *, dns_name_t *);
static void
clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int);
static bool
check_expire_namehooks(dns_adbname_t *, isc_stdtime_t);
static bool
check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t);
static void
cancel_fetches_at_name(dns_adbname_t *);
static isc_result_t
dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t);
static isc_result_t
fetch_name(dns_adbname_t *, bool, unsigned int, isc_counter_t *qc,
dns_rdatatype_t); dns_rdatatype_t);
static isc_result_t fetch_name(dns_adbname_t *, bool, unsigned int, static inline void
isc_counter_t *qc, dns_rdatatype_t); check_exit(dns_adb_t *);
static inline void check_exit(dns_adb_t *); static void
static void destroy(dns_adb_t *); destroy(dns_adb_t *);
static bool shutdown_names(dns_adb_t *); static bool
static bool shutdown_entries(dns_adb_t *); shutdown_names(dns_adb_t *);
static inline void link_name(dns_adb_t *, int, dns_adbname_t *); static bool
static inline bool unlink_name(dns_adb_t *, dns_adbname_t *); shutdown_entries(dns_adb_t *);
static inline void link_entry(dns_adb_t *, int, dns_adbentry_t *); static inline void
static inline bool unlink_entry(dns_adb_t *, dns_adbentry_t *); link_name(dns_adb_t *, int, dns_adbname_t *);
static bool kill_name(dns_adbname_t **, isc_eventtype_t); static inline bool
static void water(void *, int); unlink_name(dns_adb_t *, dns_adbname_t *);
static void dump_entry(FILE *, dns_adb_t *, dns_adbentry_t *, bool, static inline void
isc_stdtime_t); link_entry(dns_adb_t *, int, dns_adbentry_t *);
static void adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, static inline bool
unsigned int factor, isc_stdtime_t now); unlink_entry(dns_adb_t *, dns_adbentry_t *);
static void shutdown_task(isc_task_t *task, isc_event_t *ev); static bool
static void log_quota(dns_adbentry_t *entry, const char *fmt, ...) kill_name(dns_adbname_t **, isc_eventtype_t);
ISC_FORMAT_PRINTF(2, 3); static void
water(void *, int);
static void
dump_entry(FILE *, dns_adb_t *, dns_adbentry_t *, bool, isc_stdtime_t);
static void
adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor,
isc_stdtime_t now);
static void
shutdown_task(isc_task_t *task, isc_event_t *ev);
static void
log_quota(dns_adbentry_t *entry, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
/* /*
* MUST NOT overlap DNS_ADBFIND_* flags! * MUST NOT overlap DNS_ADBFIND_* flags!
@ -460,7 +500,8 @@ static isc_result_t find_err_map[FIND_ERR_MAX] = {
DNS_R_NXRRSET, ISC_R_UNEXPECTED, ISC_R_NOTFOUND /* not YET found */ DNS_R_NXRRSET, ISC_R_UNEXPECTED, ISC_R_NOTFOUND /* not YET found */
}; };
static void DP(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3); static void
DP(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
static void static void
DP(int level, const char *format, ...) { DP(int level, const char *format, ...) {

View File

@ -56,8 +56,8 @@ struct dns_bcentry {
dns_name_t name; dns_name_t name;
}; };
static isc_result_t badcache_resize(dns_badcache_t *bc, isc_time_t *now, static isc_result_t
bool grow); badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow);
isc_result_t isc_result_t
dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) { dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {

View File

@ -153,16 +153,18 @@ struct dns_cache {
*** Functions *** Functions
***/ ***/
static isc_result_t cache_cleaner_init(dns_cache_t *cache, static isc_result_t
isc_taskmgr_t *taskmgr, cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
isc_timermgr_t *timermgr, isc_timermgr_t *timermgr, cache_cleaner_t *cleaner);
cache_cleaner_t *cleaner);
static void incremental_cleaning_action(isc_task_t *task, isc_event_t *event); static void
incremental_cleaning_action(isc_task_t *task, isc_event_t *event);
static void cleaner_shutdown_action(isc_task_t *task, isc_event_t *event); static void
cleaner_shutdown_action(isc_task_t *task, isc_event_t *event);
static void overmem_cleaning_action(isc_task_t *task, isc_event_t *event); static void
overmem_cleaning_action(isc_task_t *task, isc_event_t *event);
static inline isc_result_t static inline isc_result_t
cache_create_db(dns_cache_t *cache, dns_db_t **db) { cache_create_db(dns_cache_t *cache, dns_db_t **db) {

View File

@ -17,14 +17,17 @@
#include <dns/callbacks.h> #include <dns/callbacks.h>
#include <dns/log.h> #include <dns/log.h>
static void stdio_error_warn_callback(dns_rdatacallbacks_t *, const char *, ...) static void
stdio_error_warn_callback(dns_rdatacallbacks_t *, const char *, ...)
ISC_FORMAT_PRINTF(2, 3); ISC_FORMAT_PRINTF(2, 3);
static void isclog_error_callback(dns_rdatacallbacks_t *callbacks, static void
const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); isclog_error_callback(dns_rdatacallbacks_t *callbacks, const char *fmt, ...)
ISC_FORMAT_PRINTF(2, 3);
static void isclog_warn_callback(dns_rdatacallbacks_t *callbacks, static void
const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); isclog_warn_callback(dns_rdatacallbacks_t *callbacks, const char *fmt, ...)
ISC_FORMAT_PRINTF(2, 3);
/* /*
* Private * Private

View File

@ -80,13 +80,12 @@ struct dns_catz_zone {
isc_refcount_t refs; isc_refcount_t refs;
}; };
static isc_result_t catz_process_zones_entry(dns_catz_zone_t *zone, static isc_result_t
dns_rdataset_t *value, catz_process_zones_entry(dns_catz_zone_t *zone, dns_rdataset_t *value,
dns_label_t *mhash); dns_label_t *mhash);
static isc_result_t catz_process_zones_suboption(dns_catz_zone_t *zone, static isc_result_t
dns_rdataset_t *value, catz_process_zones_suboption(dns_catz_zone_t *zone, dns_rdataset_t *value,
dns_label_t *mhash, dns_label_t *mhash, dns_name_t *name);
dns_name_t *name);
/*% /*%
* Collection of catalog zones for a view * Collection of catalog zones for a view

View File

@ -255,9 +255,12 @@ typedef struct updatectx {
struct updatectx *bp6; struct updatectx *bp6;
} updatectx_t; } updatectx_t;
static isc_result_t request_soa(updatectx_t *uctx); static isc_result_t
static void client_resfind(resctx_t *rctx, dns_fetchevent_t *event); request_soa(updatectx_t *uctx);
static isc_result_t send_update(updatectx_t *uctx); static void
client_resfind(resctx_t *rctx, dns_fetchevent_t *event);
static isc_result_t
send_update(updatectx_t *uctx);
/* /*
* Try honoring the operating system's preferred ephemeral port range. * Try honoring the operating system's preferred ephemeral port range.

View File

@ -274,53 +274,75 @@ struct dns_dispatch {
/* /*
* Statics. * Statics.
*/ */
static dns_dispentry_t *entry_search(dns_qid_t *, const isc_sockaddr_t *, static dns_dispentry_t *
dns_messageid_t, in_port_t, unsigned int); entry_search(dns_qid_t *, const isc_sockaddr_t *, dns_messageid_t, in_port_t,
static bool destroy_disp_ok(dns_dispatch_t *); unsigned int);
static void destroy_disp(isc_task_t *task, isc_event_t *event); static bool
static void destroy_dispsocket(dns_dispatch_t *, dispsocket_t **); destroy_disp_ok(dns_dispatch_t *);
static void deactivate_dispsocket(dns_dispatch_t *, dispsocket_t *); static void
static void udp_exrecv(isc_task_t *, isc_event_t *); destroy_disp(isc_task_t *task, isc_event_t *event);
static void udp_shrecv(isc_task_t *, isc_event_t *); static void
static void udp_recv(isc_event_t *, dns_dispatch_t *, dispsocket_t *); destroy_dispsocket(dns_dispatch_t *, dispsocket_t **);
static void tcp_recv(isc_task_t *, isc_event_t *); static void
static isc_result_t startrecv(dns_dispatch_t *, dispsocket_t *); deactivate_dispsocket(dns_dispatch_t *, dispsocket_t *);
static uint32_t dns_hash(dns_qid_t *, const isc_sockaddr_t *, dns_messageid_t, static void
in_port_t); udp_exrecv(isc_task_t *, isc_event_t *);
static void free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len); static void
static void *allocate_udp_buffer(dns_dispatch_t *disp); udp_shrecv(isc_task_t *, isc_event_t *);
static inline void free_devent(dns_dispatch_t *disp, dns_dispatchevent_t *ev); static void
static inline dns_dispatchevent_t *allocate_devent(dns_dispatch_t *disp); udp_recv(isc_event_t *, dns_dispatch_t *, dispsocket_t *);
static void do_cancel(dns_dispatch_t *disp); static void
static dns_dispentry_t *linear_first(dns_qid_t *disp); tcp_recv(isc_task_t *, isc_event_t *);
static dns_dispentry_t *linear_next(dns_qid_t *disp, dns_dispentry_t *resp); static isc_result_t
static void dispatch_free(dns_dispatch_t **dispp); startrecv(dns_dispatch_t *, dispsocket_t *);
static isc_result_t get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp, static uint32_t
isc_socketmgr_t *sockmgr, dns_hash(dns_qid_t *, const isc_sockaddr_t *, dns_messageid_t, in_port_t);
const isc_sockaddr_t *localaddr, static void
isc_socket_t **sockp, free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len);
isc_socket_t *dup_socket, bool duponly); static void *
allocate_udp_buffer(dns_dispatch_t *disp);
static inline void
free_devent(dns_dispatch_t *disp, dns_dispatchevent_t *ev);
static inline dns_dispatchevent_t *
allocate_devent(dns_dispatch_t *disp);
static void
do_cancel(dns_dispatch_t *disp);
static dns_dispentry_t *
linear_first(dns_qid_t *disp);
static dns_dispentry_t *
linear_next(dns_qid_t *disp, dns_dispentry_t *resp);
static void
dispatch_free(dns_dispatch_t **dispp);
static isc_result_t
get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
isc_socketmgr_t *sockmgr, const isc_sockaddr_t *localaddr,
isc_socket_t **sockp, isc_socket_t *dup_socket, bool duponly);
static isc_result_t static isc_result_t
dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr, dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
isc_taskmgr_t *taskmgr, const isc_sockaddr_t *localaddr, isc_taskmgr_t *taskmgr, const isc_sockaddr_t *localaddr,
unsigned int maxrequests, unsigned int attributes, unsigned int maxrequests, unsigned int attributes,
dns_dispatch_t **dispp, isc_socket_t *dup_socket); dns_dispatch_t **dispp, isc_socket_t *dup_socket);
static bool destroy_mgr_ok(dns_dispatchmgr_t *mgr); static bool
static void destroy_mgr(dns_dispatchmgr_t **mgrp); destroy_mgr_ok(dns_dispatchmgr_t *mgr);
static isc_result_t qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets, static void
unsigned int increment, dns_qid_t **qidp, destroy_mgr(dns_dispatchmgr_t **mgrp);
bool needaddrtable); static isc_result_t
static void qid_destroy(isc_mem_t *mctx, dns_qid_t **qidp); qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets,
static isc_result_t open_socket(isc_socketmgr_t *mgr, unsigned int increment, dns_qid_t **qidp, bool needaddrtable);
const isc_sockaddr_t *local, static void
qid_destroy(isc_mem_t *mctx, dns_qid_t **qidp);
static isc_result_t
open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
unsigned int options, isc_socket_t **sockp, unsigned int options, isc_socket_t **sockp,
isc_socket_t *dup_socket, bool duponly); isc_socket_t *dup_socket, bool duponly);
static bool portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, static bool
portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock,
isc_sockaddr_t *sockaddrp); isc_sockaddr_t *sockaddrp);
#define LVL(x) ISC_LOG_DEBUG(x) #define LVL(x) ISC_LOG_DEBUG(x)
static void mgr_log(dns_dispatchmgr_t *mgr, int level, const char *fmt, ...) static void
mgr_log(dns_dispatchmgr_t *mgr, int level, const char *fmt, ...)
ISC_FORMAT_PRINTF(3, 4); ISC_FORMAT_PRINTF(3, 4);
static void static void
@ -355,7 +377,8 @@ dec_stats(dns_dispatchmgr_t *mgr, isc_statscounter_t counter) {
} }
} }
static void dispatch_log(dns_dispatch_t *disp, int level, const char *fmt, ...) static void
dispatch_log(dns_dispatch_t *disp, int level, const char *fmt, ...)
ISC_FORMAT_PRINTF(3, 4); ISC_FORMAT_PRINTF(3, 4);
static void static void
@ -376,7 +399,8 @@ dispatch_log(dns_dispatch_t *disp, int level, const char *fmt, ...) {
msgbuf); msgbuf);
} }
static void request_log(dns_dispatch_t *disp, dns_dispentry_t *resp, int level, static void
request_log(dns_dispatch_t *disp, dns_dispentry_t *resp, int level,
const char *fmt, ...) ISC_FORMAT_PRINTF(4, 5); const char *fmt, ...) ISC_FORMAT_PRINTF(4, 5);
static void static void

View File

@ -56,12 +56,14 @@ LIBDNS_EXTERNAL_DATA isc_stats_t *dns_dnssec_stats;
#define TYPE_SIGN 0 #define TYPE_SIGN 0
#define TYPE_VERIFY 1 #define TYPE_VERIFY 1
static isc_result_t digest_callback(void *arg, isc_region_t *data); static isc_result_t
digest_callback(void *arg, isc_region_t *data);
static int rdata_compare_wrapper(const void *rdata1, const void *rdata2); static int
rdata_compare_wrapper(const void *rdata1, const void *rdata2);
static isc_result_t rdataset_to_sortedarray(dns_rdataset_t *set, static isc_result_t
isc_mem_t *mctx, rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx,
dns_rdata_t **rdata, int *nrdata); dns_rdata_t **rdata, int *nrdata);
static isc_result_t static isc_result_t

View File

@ -135,32 +135,36 @@ static dst_func_t *dst_t_func[DST_MAX_ALGS];
static bool dst_initialized = false; static bool dst_initialized = false;
void gss_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); void
gss_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
/* /*
* Static functions. * Static functions.
*/ */
static dst_key_t *get_key_struct(const dns_name_t *name, unsigned int alg, static dst_key_t *
unsigned int flags, unsigned int protocol, get_key_struct(const dns_name_t *name, unsigned int alg, unsigned int flags,
unsigned int bits, dns_rdataclass_t rdclass, unsigned int protocol, unsigned int bits,
dns_ttl_t ttl, isc_mem_t *mctx); dns_rdataclass_t rdclass, dns_ttl_t ttl, isc_mem_t *mctx);
static isc_result_t write_public_key(const dst_key_t *key, int type, static isc_result_t
const char *directory); write_public_key(const dst_key_t *key, int type, const char *directory);
static isc_result_t write_key_state(const dst_key_t *key, int type, static isc_result_t
const char *directory); write_key_state(const dst_key_t *key, int type, const char *directory);
static isc_result_t buildfilename(dns_name_t *name, dns_keytag_t id, static isc_result_t
unsigned int alg, unsigned int type, buildfilename(dns_name_t *name, dns_keytag_t id, unsigned int alg,
const char *directory, isc_buffer_t *out); unsigned int type, const char *directory, isc_buffer_t *out);
static isc_result_t computeid(dst_key_t *key); static isc_result_t
static isc_result_t frombuffer(const dns_name_t *name, unsigned int alg, computeid(dst_key_t *key);
unsigned int flags, unsigned int protocol, static isc_result_t
dns_rdataclass_t rdclass, isc_buffer_t *source, frombuffer(const dns_name_t *name, unsigned int alg, unsigned int flags,
isc_mem_t *mctx, dst_key_t **keyp); unsigned int protocol, dns_rdataclass_t rdclass,
isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp);
static isc_result_t algorithm_status(unsigned int alg); static isc_result_t
algorithm_status(unsigned int alg);
static isc_result_t addsuffix(char *filename, int len, const char *dirname, static isc_result_t
const char *ofilename, const char *suffix); addsuffix(char *filename, int len, const char *dirname, const char *ofilename,
const char *suffix);
#define RETERR(x) \ #define RETERR(x) \
do { \ do { \

View File

@ -81,18 +81,25 @@ typedef struct rdatasetheader {
#define NXDOMAIN(header) (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0) #define NXDOMAIN(header) (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
#define NEGATIVE(header) (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0) #define NEGATIVE(header) (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)
static isc_result_t dns_ecdb_create(isc_mem_t *mctx, const dns_name_t *origin, static isc_result_t
dns_dbtype_t type, dns_rdataclass_t rdclass, dns_ecdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
unsigned int argc, char *argv[], dns_rdataclass_t rdclass, unsigned int argc, char *argv[],
void *driverarg, dns_db_t **dbp); void *driverarg, dns_db_t **dbp);
static void rdataset_disassociate(dns_rdataset_t *rdataset); static void
static isc_result_t rdataset_first(dns_rdataset_t *rdataset); rdataset_disassociate(dns_rdataset_t *rdataset);
static isc_result_t rdataset_next(dns_rdataset_t *rdataset); static isc_result_t
static void rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); rdataset_first(dns_rdataset_t *rdataset);
static void rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target); static isc_result_t
static unsigned int rdataset_count(dns_rdataset_t *rdataset); rdataset_next(dns_rdataset_t *rdataset);
static void rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust); static void
rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata);
static void
rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target);
static unsigned int
rdataset_count(dns_rdataset_t *rdataset);
static void
rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust);
static dns_rdatasetmethods_t rdataset_methods = { static dns_rdatasetmethods_t rdataset_methods = {
rdataset_disassociate, rdataset_disassociate,
@ -118,11 +125,14 @@ typedef struct ecdb_rdatasetiter {
rdatasetheader_t *current; rdatasetheader_t *current;
} ecdb_rdatasetiter_t; } ecdb_rdatasetiter_t;
static void rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp); static void
static isc_result_t rdatasetiter_first(dns_rdatasetiter_t *iterator); rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp);
static isc_result_t rdatasetiter_next(dns_rdatasetiter_t *iterator); static isc_result_t
static void rdatasetiter_current(dns_rdatasetiter_t *iterator, rdatasetiter_first(dns_rdatasetiter_t *iterator);
dns_rdataset_t *rdataset); static isc_result_t
rdatasetiter_next(dns_rdatasetiter_t *iterator);
static void
rdatasetiter_current(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset);
static dns_rdatasetitermethods_t rdatasetiter_methods = { static dns_rdatasetitermethods_t rdatasetiter_methods = {
rdatasetiter_destroy, rdatasetiter_first, rdatasetiter_next, rdatasetiter_destroy, rdatasetiter_first, rdatasetiter_next,

View File

@ -33,7 +33,8 @@ struct dns_fwdtable {
#define FWDTABLEMAGIC ISC_MAGIC('F', 'w', 'd', 'T') #define FWDTABLEMAGIC ISC_MAGIC('F', 'w', 'd', 'T')
#define VALID_FWDTABLE(ft) ISC_MAGIC_VALID(ft, FWDTABLEMAGIC) #define VALID_FWDTABLE(ft) ISC_MAGIC_VALID(ft, FWDTABLEMAGIC)
static void auto_detach(void *, void *); static void
auto_detach(void *, void *);
isc_result_t isc_result_t
dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep) { dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep) {

View File

@ -173,13 +173,19 @@ static struct ttnam {
static int maxtype = -1; static int maxtype = -1;
static char *upper(char *); static char *
static char *funname(const char *, char *); upper(char *);
static void doswitch(const char *, const char *, const char *, const char *, static char *
const char *, const char *); funname(const char *, char *);
static void add(int, const char *, int, const char *, const char *); static void
static void sd(int, const char *, const char *, char); doswitch(const char *, const char *, const char *, const char *, const char *,
static void insert_into_typenames(int, const char *, const char *); const char *);
static void
add(int, const char *, int, const char *, const char *);
static void
sd(int, const char *, const char *, char);
static void
insert_into_typenames(int, const char *, const char *);
/*% /*%
* If you use more than 10 of these in, say, a printf(), you'll have problems. * If you use more than 10 of these in, say, a printf(), you'll have problems.

View File

@ -135,8 +135,8 @@
return (ISC_R_SUCCESS); \ return (ISC_R_SUCCESS); \
} }
static isc_result_t hmac_fromdns(isc_md_type_t type, dst_key_t *key, static isc_result_t
isc_buffer_t *data); hmac_fromdns(isc_md_type_t type, dst_key_t *key, isc_buffer_t *data);
struct dst_hmac_key { struct dst_hmac_key {
uint8_t key[ISC_MAX_BLOCK_SIZE]; uint8_t key[ISC_MAX_BLOCK_SIZE];

View File

@ -0,0 +1 @@
../../../.clang-format.headers

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