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:
commit
a04cdde45d
@ -15,7 +15,7 @@ BraceWrapping:
|
||||
SplitEmptyFunction: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakAfterReturnType: TopLevelDefinitions
|
||||
AlwaysBreakAfterReturnType: All
|
||||
Cpp11BracedListStyle: false
|
||||
ColumnLimit: 80
|
||||
AlignAfterOpenBracket: Align
|
||||
|
61
.clang-format.headers
Normal file
61
.clang-format.headers
Normal 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
|
@ -17,9 +17,11 @@ variables:
|
||||
|
||||
MAKE: make
|
||||
CONFIGURE: ./configure
|
||||
CLANG: clang-9
|
||||
SCAN_BUILD: scan-build-9
|
||||
SYMBOLIZER: /usr/lib/llvm-9/bin/llvm-symbolizer
|
||||
ASAN_SYMBOLIZER_PATH: "$SYMBOLIZER"
|
||||
CLANG_FORMAT: clang-format-11
|
||||
|
||||
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"
|
||||
when: on_failure
|
||||
|
||||
💾:sid:amd64:
|
||||
<<: *precheck_job
|
||||
script:
|
||||
- if [ -r .clang-format ]; then "${CLANG_FORMAT}" -i -style=file $(git ls-files '*.c' '*.h'); fi
|
||||
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
|
||||
|
||||
🐞:sid:amd64:
|
||||
<<: *precheck_job
|
||||
<<: *debian_buster_amd64_image
|
||||
@ -618,7 +626,7 @@ scan-build:buster:amd64:
|
||||
<<: *debian_buster_amd64_image
|
||||
stage: postcheck
|
||||
variables:
|
||||
CC: clang-9
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
CONFIGURE: "${SCAN_BUILD} ./configure"
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
@ -878,7 +886,7 @@ tsan:buster:amd64:
|
||||
<<: *debian_buster_amd64_image
|
||||
<<: *build_job
|
||||
variables:
|
||||
CC: clang-9
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0"
|
||||
LDFLAGS: "-fsanitize=thread"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock"
|
||||
|
@ -48,7 +48,7 @@ DestroySockets(void);
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
extern int debug;
|
||||
extern const char * journal;
|
||||
extern const char *journal;
|
||||
extern bool nomerge;
|
||||
extern bool docheckmx;
|
||||
extern bool docheckns;
|
||||
|
@ -56,7 +56,8 @@ isc_log_t *logc = NULL;
|
||||
} while (0)
|
||||
|
||||
/*% 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
|
||||
usage(void) {
|
||||
|
@ -62,7 +62,8 @@ static enum { progmode_check, progmode_compile } progmode;
|
||||
} \
|
||||
} 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
|
||||
usage(void) {
|
||||
|
1
bin/confgen/include/.clang-format
Symbolic link
1
bin/confgen/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -127,11 +127,11 @@ static char anchortext[] = TRUST_ANCHORS;
|
||||
/*
|
||||
* Static function prototypes
|
||||
*/
|
||||
static isc_result_t get_reverse(char *reverse, size_t len, char *value,
|
||||
bool strict);
|
||||
static isc_result_t
|
||||
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,
|
||||
const char *desc);
|
||||
static isc_result_t
|
||||
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -205,7 +205,8 @@ usage(void) {
|
||||
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;
|
||||
|
||||
static void
|
||||
@ -221,7 +222,8 @@ fatal(const char *format, ...) {
|
||||
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
|
||||
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 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
|
||||
delv_log(int level, const char *fmt, ...) {
|
||||
|
@ -107,7 +107,8 @@ usage(void) {
|
||||
fprintf(stderr, "Press <Help> for complete list of options\n");
|
||||
}
|
||||
#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
|
||||
usage(void) {
|
||||
|
@ -122,10 +122,12 @@ int lookup_counter = 0;
|
||||
static char servercookie[256];
|
||||
|
||||
#ifdef HAVE_LIBIDN2
|
||||
static void idn_locale_to_ace(const char *src, char *dst, size_t dstlen);
|
||||
static void idn_ace_to_locale(const char *src, char **dst);
|
||||
static isc_result_t idn_output_filter(isc_buffer_t *buffer,
|
||||
unsigned int used_org);
|
||||
static void
|
||||
idn_locale_to_ace(const char *src, char *dst, size_t dstlen);
|
||||
static void
|
||||
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 */
|
||||
|
||||
isc_socket_t *keep = NULL;
|
||||
@ -227,19 +229,26 @@ void (*dighost_shutdown)(void);
|
||||
|
||||
/* 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
|
||||
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
|
||||
|
1
bin/dig/include/.clang-format
Symbolic link
1
bin/dig/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -124,8 +124,10 @@ static const char *rtypetext[] = {
|
||||
|
||||
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
|
||||
|
||||
static void flush_lookup_list(void);
|
||||
static void getinput(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
flush_lookup_list(void);
|
||||
static void
|
||||
getinput(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
static char *
|
||||
rcode_totext(dns_rcode_t rcode) {
|
||||
@ -876,7 +878,8 @@ get_next_command(void) {
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -121,8 +121,8 @@ typedef struct keyinfo {
|
||||
} keyinfo_t;
|
||||
|
||||
/* 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,
|
||||
dns_rdata_t *rdata);
|
||||
typedef isc_result_t
|
||||
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 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
|
||||
usage(void) {
|
||||
|
@ -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
|
||||
usage(void) {
|
||||
|
@ -264,7 +264,8 @@ emit(const char *dir, dns_rdata_t *rdata) {
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -46,7 +46,8 @@
|
||||
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -69,9 +69,11 @@ const char *program = "dnssec-keygen";
|
||||
|
||||
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 {
|
||||
const char *predecessor;
|
||||
|
@ -40,7 +40,8 @@ const char *program = "dnssec-revoke";
|
||||
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -43,7 +43,8 @@ const char *program = "dnssec-settime";
|
||||
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -186,7 +186,8 @@ static dns_ttl_t maxttl = 0;
|
||||
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.
|
||||
@ -3123,7 +3124,8 @@ print_version(FILE *fp) {
|
||||
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
|
||||
usage(void) {
|
||||
|
@ -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
|
||||
usage(void) {
|
||||
|
@ -32,12 +32,18 @@
|
||||
|
||||
typedef struct builtin builtin_t;
|
||||
|
||||
static isc_result_t do_version_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_hostname_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_authors_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_id_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_empty_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t do_dns64_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_version_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_hostname_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_authors_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_id_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_empty_lookup(dns_sdblookup_t *lookup);
|
||||
static isc_result_t
|
||||
do_dns64_lookup(dns_sdblookup_t *lookup);
|
||||
|
||||
/*
|
||||
* We can't use function pointers as the db_data directly
|
||||
|
@ -107,8 +107,10 @@ struct named_controls {
|
||||
isccc_symtab_t *symtab;
|
||||
};
|
||||
|
||||
static void control_newconn(isc_task_t *task, isc_event_t *event);
|
||||
static void control_recvmessage(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
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
|
||||
|
||||
|
1
bin/named/include/.clang-format
Symbolic link
1
bin/named/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -302,9 +302,9 @@ library_fatal_error(const char *file, int line, const char *format,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void library_unexpected_error(const char *file, int line,
|
||||
const char *format, va_list args)
|
||||
ISC_FORMAT_PRINTF(3, 0);
|
||||
static void
|
||||
library_unexpected_error(const char *file, int line, const char *format,
|
||||
va_list args) ISC_FORMAT_PRINTF(3, 0);
|
||||
|
||||
static void
|
||||
library_unexpected_error(const char *file, int line, const char *format,
|
||||
|
@ -383,74 +383,86 @@ ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(named_server_t *server, const char *msg,
|
||||
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,
|
||||
const cfg_obj_t *config,
|
||||
cfg_aclconfctx_t *actx,
|
||||
isc_mem_t *mctx, uint16_t family,
|
||||
ns_listenelt_t **target);
|
||||
static isc_result_t ns_listenlist_fromconfig(const cfg_obj_t *listenlist,
|
||||
const cfg_obj_t *config,
|
||||
cfg_aclconfctx_t *actx,
|
||||
isc_mem_t *mctx, uint16_t family,
|
||||
ns_listenlist_t **target);
|
||||
static isc_result_t
|
||||
ns_listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
|
||||
cfg_aclconfctx_t *actx, isc_mem_t *mctx,
|
||||
uint16_t family, ns_listenelt_t **target);
|
||||
static isc_result_t
|
||||
ns_listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config,
|
||||
cfg_aclconfctx_t *actx, 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,
|
||||
const dns_name_t *origin,
|
||||
const cfg_obj_t *forwarders,
|
||||
static isc_result_t
|
||||
configure_forward(const cfg_obj_t *config, dns_view_t *view,
|
||||
const dns_name_t *origin, const cfg_obj_t *forwarders,
|
||||
const cfg_obj_t *forwardtype);
|
||||
|
||||
static isc_result_t configure_alternates(const cfg_obj_t *config,
|
||||
dns_view_t *view,
|
||||
static isc_result_t
|
||||
configure_alternates(const cfg_obj_t *config, dns_view_t *view,
|
||||
const cfg_obj_t *alternates);
|
||||
|
||||
static isc_result_t configure_zone(const cfg_obj_t *config,
|
||||
const cfg_obj_t *zconfig,
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx,
|
||||
dns_view_t *view, dns_viewlist_t *viewlist,
|
||||
dns_kasplist_t *kasplist,
|
||||
cfg_aclconfctx_t *aclconf, bool added,
|
||||
bool old_rpz_ok, bool modify);
|
||||
static isc_result_t
|
||||
configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
|
||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
|
||||
dns_viewlist_t *viewlist, dns_kasplist_t *kasplist,
|
||||
cfg_aclconfctx_t *aclconf, bool added, bool old_rpz_ok,
|
||||
bool modify);
|
||||
|
||||
static isc_result_t configure_newzones(dns_view_t *view, cfg_obj_t *config,
|
||||
cfg_obj_t *vconfig, isc_mem_t *mctx,
|
||||
cfg_aclconfctx_t *actx);
|
||||
static isc_result_t
|
||||
configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
isc_mem_t *mctx, cfg_aclconfctx_t *actx);
|
||||
|
||||
static isc_result_t add_keydata_zone(dns_view_t *view, const char *directory,
|
||||
isc_mem_t *mctx);
|
||||
static isc_result_t
|
||||
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
|
||||
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,
|
||||
MDB_txn **txnp, MDB_dbi *dbi);
|
||||
static isc_result_t
|
||||
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 */
|
||||
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 */
|
||||
|
||||
/*%
|
||||
|
1
bin/named/unix/include/.clang-format
Symbolic link
1
bin/named/unix/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
1
bin/named/win32/include/.clang-format
Symbolic link
1
bin/named/win32/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -18,7 +18,7 @@
|
||||
#define BIND_SERVICE_NAME "named"
|
||||
|
||||
void
|
||||
ntservice_init();
|
||||
ntservice_init();
|
||||
void UpdateSCM(DWORD);
|
||||
void
|
||||
ServiceControl(DWORD dwCtrlCode);
|
||||
|
@ -30,8 +30,10 @@ static char ConsoleTitle[128];
|
||||
/*
|
||||
* Forward declarations
|
||||
*/
|
||||
void ServiceControl(DWORD dwCtrlCode);
|
||||
int bindmain(int, char *[]); /* From main.c */
|
||||
void
|
||||
ServiceControl(DWORD dwCtrlCode);
|
||||
int
|
||||
bindmain(int, char *[]); /* From main.c */
|
||||
|
||||
/*
|
||||
* Initialize the Service by registering it.
|
||||
|
@ -181,16 +181,21 @@ typedef struct nsu_requestinfo {
|
||||
isc_sockaddr_t *addr;
|
||||
} 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);
|
||||
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;
|
||||
|
||||
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
|
||||
static dns_fixedname_t fkname;
|
||||
@ -204,14 +209,19 @@ typedef struct nsu_gssinfo {
|
||||
gss_ctx_id_t context;
|
||||
} nsu_gssinfo_t;
|
||||
|
||||
static void failed_gssrequest();
|
||||
static void start_gssrequest(dns_name_t *master);
|
||||
static void send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
||||
static void
|
||||
failed_gssrequest();
|
||||
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);
|
||||
static void recvgss(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
recvgss(isc_task_t *task, isc_event_t *event);
|
||||
#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_SEND (uint16_t)1
|
||||
|
@ -110,18 +110,18 @@ typedef struct filter_instance {
|
||||
/*
|
||||
* Forward declarations of functions referenced in install_hooks().
|
||||
*/
|
||||
static ns_hookresult_t filter_qctx_initialize(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t filter_respond_begin(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t filter_respond_any_found(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t filter_prep_response_begin(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t filter_query_done_send(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t filter_qctx_destroy(void *arg, void *cbdata,
|
||||
isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp);
|
||||
static ns_hookresult_t
|
||||
filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp);
|
||||
|
||||
/*%
|
||||
* Register the functions to be called at each hook point in 'hooktable', using
|
||||
|
1
bin/rndc/include/.clang-format
Symbolic link
1
bin/rndc/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -84,7 +84,8 @@ static uint32_t serial;
|
||||
static bool quiet = 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
|
||||
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
|
@ -56,7 +56,8 @@ static isc_mutex_t client_lock;
|
||||
static isc_stdtime_t now;
|
||||
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);
|
||||
|
||||
static void
|
||||
|
@ -45,7 +45,8 @@ static isc_log_t *lctx;
|
||||
static isc_logconfig_t *lcfg;
|
||||
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
|
||||
log_init(void) {
|
||||
|
@ -72,9 +72,12 @@ static gss_ctx_id_t *gssctxp = &gssctx;
|
||||
#define PORT 53
|
||||
#define TIMEOUT 30
|
||||
|
||||
static void initctx1(isc_task_t *task, isc_event_t *event);
|
||||
static void sendquery(isc_task_t *task, isc_event_t *event);
|
||||
static void setup();
|
||||
static void
|
||||
initctx1(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
sendquery(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
setup();
|
||||
|
||||
static void
|
||||
console(isc_task_t *task, isc_event_t *event) {
|
||||
|
@ -24,9 +24,12 @@ isc_timermgr_t *timermgr = NULL;
|
||||
isc_task_t *g_task = NULL;
|
||||
isc_mem_t *mctx = NULL;
|
||||
|
||||
static void utick(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);
|
||||
static void
|
||||
utick(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 {
|
||||
int milliseconds;
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -61,7 +61,8 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#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
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
|
@ -59,7 +59,8 @@ struct record {
|
||||
|
||||
#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 {
|
||||
char *zone_name;
|
||||
|
@ -14,23 +14,23 @@
|
||||
#include <dns/types.h>
|
||||
|
||||
struct sample_instance {
|
||||
isc_mem_t * mctx;
|
||||
char * db_name;
|
||||
isc_mem_t *mctx;
|
||||
char *db_name;
|
||||
dns_dbimplementation_t *db_imp;
|
||||
|
||||
/* These are needed for zone creation. */
|
||||
dns_view_t * view;
|
||||
dns_view_t *view;
|
||||
dns_zonemgr_t *zmgr;
|
||||
isc_task_t * task;
|
||||
isc_task_t *task;
|
||||
bool exiting;
|
||||
|
||||
dns_zone_t * zone1;
|
||||
dns_zone_t *zone1;
|
||||
dns_fixedname_t zone1_fn;
|
||||
dns_name_t * zone1_name;
|
||||
dns_name_t *zone1_name;
|
||||
|
||||
dns_zone_t * zone2;
|
||||
dns_zone_t *zone2;
|
||||
dns_fixedname_t zone2_fn;
|
||||
dns_name_t * zone2_name;
|
||||
dns_name_t *zone2_name;
|
||||
};
|
||||
|
||||
typedef struct sample_instance sample_instance_t;
|
||||
@ -38,7 +38,7 @@ typedef struct sample_instance sample_instance_t;
|
||||
isc_result_t
|
||||
new_sample_instance(isc_mem_t *mctx, const char *db_name, int argc, char **argv,
|
||||
const dns_dyndbctx_t *dctx,
|
||||
sample_instance_t ** sample_instp);
|
||||
sample_instance_t **sample_instp);
|
||||
|
||||
isc_result_t
|
||||
load_sample_instance_zones(sample_instance_t *inst);
|
||||
|
@ -46,7 +46,8 @@ typedef struct {
|
||||
} librpz_emsg_t;
|
||||
#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"
|
||||
|
||||
|
@ -29,9 +29,11 @@ isc_mem_t *mctx = NULL;
|
||||
bool printmemstats = 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
|
||||
CHECKRESULT(isc_result_t result, const char *msg) {
|
||||
|
@ -68,8 +68,8 @@ const char *program = "dnstap-read";
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format,
|
||||
...) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
fatal(const char *format, ...) {
|
||||
|
@ -781,7 +781,8 @@ sendqueries(isc_task_t *task, isc_event_t *event) {
|
||||
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
|
||||
usage(void) {
|
||||
@ -891,7 +892,8 @@ help(void) {
|
||||
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;
|
||||
|
||||
static void
|
||||
|
@ -32,7 +32,8 @@ static isc_lex_t *lex;
|
||||
|
||||
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
|
||||
usage(void) {
|
||||
@ -48,8 +49,8 @@ usage(void) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format,
|
||||
...) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
fatal(const char *format, ...) {
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
const char *program = "nsec3hash";
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void fatal(const char *format,
|
||||
...) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
fatal(const char *format, ...) {
|
||||
@ -63,9 +63,9 @@ usage() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
typedef void nsec3printer(unsigned algo, unsigned flags, unsigned iters,
|
||||
const char *saltstr, const char *domain,
|
||||
const char *digest);
|
||||
typedef void
|
||||
nsec3printer(unsigned algo, unsigned flags, unsigned iters, const char *saltstr,
|
||||
const char *domain, const char *digest);
|
||||
|
||||
static void
|
||||
nsec3hash(nsec3printer *nsec3print, const char *algostr, const char *flagstr,
|
||||
|
@ -21,12 +21,15 @@
|
||||
* a given account as well as the groups to which it beongs
|
||||
*/
|
||||
int
|
||||
GetAccountPrivileges(char * name, /* Name of Account */
|
||||
wchar_t ** PrivList, /* List of Privileges returned */
|
||||
unsigned int *PrivCount, /* Count of Privileges returned */
|
||||
char **Groups, /* List of Groups to which account belongs
|
||||
GetAccountPrivileges(char *name, /* Name of Account */
|
||||
wchar_t **PrivList, /* List of Privileges returned */
|
||||
unsigned int *PrivCount, /* Count of Privileges
|
||||
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 */
|
||||
);
|
||||
|
||||
|
@ -33,7 +33,7 @@ class CDirBrowse : public CDialog {
|
||||
/* Construction */
|
||||
public:
|
||||
CDirBrowse(CString initialDir = "\\",
|
||||
CWnd * pParent = NULL); /* standard
|
||||
CWnd *pParent = NULL); /* standard
|
||||
* constructor
|
||||
*/
|
||||
CString
|
||||
|
@ -11,8 +11,7 @@
|
||||
|
||||
#define CONCAT(a, b) a##b
|
||||
#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"); \
|
||||
\
|
||||
if (!DNSConf_initctx(cfg)) \
|
||||
@ -29,9 +28,8 @@
|
||||
}
|
||||
|
||||
#define DNSCONF_GET_STRING(FIELD) \
|
||||
char *CONCAT(DNSConf_get, FIELD)(DNSConf * cfg) \
|
||||
{ \
|
||||
char * result = NULL; \
|
||||
char *CONCAT(DNSConf_get, FIELD)(DNSConf * cfg) { \
|
||||
char *result = NULL; \
|
||||
isc_result_t tmpres; \
|
||||
\
|
||||
if (cfg == NULL || cfg->confctx == NULL) \
|
||||
|
@ -69,35 +69,47 @@
|
||||
|
||||
/* 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,
|
||||
int flags);
|
||||
isc_result_t
|
||||
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,
|
||||
DBT *bdbdata);
|
||||
isc_result_t
|
||||
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
|
||||
@ -247,8 +259,7 @@ isc_buffer_t lex_buffer; /*%< buffer for lexer during add operation */
|
||||
*/
|
||||
|
||||
static void
|
||||
show_usage(void)
|
||||
{
|
||||
show_usage(void) {
|
||||
fprintf(stderr, "\n\n\
|
||||
---Usage:---------------------------------------------------------------------\
|
||||
\n\n\
|
||||
@ -292,8 +303,7 @@ c mynm.com 192.168.0.10\n\
|
||||
/*% BDB callback to create zone secondary index */
|
||||
|
||||
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;
|
||||
|
||||
UNUSED(dbp);
|
||||
@ -319,8 +329,7 @@ getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey)
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
UNUSED(dbp);
|
||||
@ -354,8 +363,7 @@ gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey)
|
||||
*/
|
||||
|
||||
void
|
||||
bdb_cleanup(void)
|
||||
{
|
||||
bdb_cleanup(void) {
|
||||
/* close cursors */
|
||||
if (db.cursor4 != NULL) {
|
||||
db.cursor4->c_close(db.cursor4);
|
||||
@ -405,8 +413,7 @@ bdb_cleanup(void)
|
||||
/*% Initializes, sets flags and then opens Berkeley databases. */
|
||||
|
||||
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 createFlag = 0;
|
||||
|
||||
@ -451,8 +458,7 @@ 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)
|
||||
{
|
||||
put_data(bool dns_data, char *input_key, char *input_data) {
|
||||
int bdbres;
|
||||
DBT key, data;
|
||||
|
||||
@ -487,8 +493,7 @@ put_data(bool dns_data, char *input_key, char *input_data)
|
||||
}
|
||||
|
||||
void
|
||||
insert_data(void)
|
||||
{
|
||||
insert_data(void) {
|
||||
unsigned int opt = ISC_LEXOPT_EOL | /* Want end-of-line token. */
|
||||
ISC_LEXOPT_EOF | /* Want end-of-file token. */
|
||||
ISC_LEXOPT_QSTRING | /* Recognize qstrings. */
|
||||
@ -613,8 +618,7 @@ data_cleanup:
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
openBDB(void)
|
||||
{
|
||||
openBDB(void) {
|
||||
int bdbres;
|
||||
isc_result_t result;
|
||||
|
||||
@ -707,8 +711,7 @@ openBDB_cleanup:
|
||||
/*% Create & open lexer to parse input data */
|
||||
|
||||
isc_result_t
|
||||
open_lexer(void)
|
||||
{
|
||||
open_lexer(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/* 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 */
|
||||
|
||||
void
|
||||
close_lexer(void)
|
||||
{
|
||||
close_lexer(void) {
|
||||
/* If lexer is still open, close it & destroy it. */
|
||||
if (lexer != NULL) {
|
||||
isc_lex_close(lexer);
|
||||
@ -761,8 +763,7 @@ close_lexer(void)
|
||||
/*% Perform add operation */
|
||||
|
||||
void
|
||||
operation_add(void)
|
||||
{
|
||||
operation_add(void) {
|
||||
/* check for any parameters that are not allowed during add */
|
||||
checkInvalidParam(key, "k", "for add operation");
|
||||
checkInvalidParam(zone, "z", "for add operation");
|
||||
@ -793,8 +794,7 @@ operation_add(void)
|
||||
/*% Perform bulk insert operation */
|
||||
|
||||
void
|
||||
operation_bulk(void)
|
||||
{
|
||||
operation_bulk(void) {
|
||||
/* check for any parameters that are not allowed during bulk */
|
||||
checkInvalidParam(key, "k", "for bulk load operation");
|
||||
checkInvalidParam(zone, "z", "for bulk load operation");
|
||||
@ -827,8 +827,7 @@ operation_bulk(void)
|
||||
}
|
||||
|
||||
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;
|
||||
db_recno_t recNum;
|
||||
char *retkey = NULL, *retdata;
|
||||
@ -910,8 +909,7 @@ bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata)
|
||||
*/
|
||||
|
||||
void
|
||||
operation_listOrDelete(bool dlt)
|
||||
{
|
||||
operation_listOrDelete(bool dlt) {
|
||||
int bdbres = 0;
|
||||
DBC *curList[3];
|
||||
DBT bdbkey, bdbdata;
|
||||
@ -1160,8 +1158,7 @@ operation_listOrDelete(bool dlt)
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
main(int argc, char **argv) {
|
||||
int ch;
|
||||
char *endp;
|
||||
|
||||
|
@ -94,10 +94,9 @@ typedef struct parsed_data {
|
||||
|
||||
/* forward reference */
|
||||
|
||||
static isc_result_t bdb_findzone(void *driverarg, void *dbdata,
|
||||
const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo);
|
||||
static isc_result_t
|
||||
bdb_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo);
|
||||
|
||||
/*%
|
||||
* 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
|
||||
bdb_parse_data(char *in, parsed_data_t *pd)
|
||||
{
|
||||
bdb_parse_data(char *in, parsed_data_t *pd) {
|
||||
char *endp, *ttlStr;
|
||||
char *tmp = in;
|
||||
char *lastchar = (char *)&tmp[strlen(tmp) + 1];
|
||||
@ -209,8 +207,7 @@ bdb_parse_data(char *in, parsed_data_t *pd)
|
||||
|
||||
static isc_result_t
|
||||
bdb_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
bdb_instance_t *db = (bdb_instance_t *)dbdata;
|
||||
DBC *client_cursor = NULL;
|
||||
@ -280,8 +277,7 @@ xfr_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
bdb_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
bdb_instance_t *db = (bdb_instance_t *)dbdata;
|
||||
DBC *zone_cursor = NULL;
|
||||
@ -361,8 +357,7 @@ allnodes_cleanup:
|
||||
*/
|
||||
|
||||
static void
|
||||
bdb_cleanup(bdb_instance_t *db)
|
||||
{
|
||||
bdb_cleanup(bdb_instance_t *db) {
|
||||
isc_mem_t *mctx;
|
||||
|
||||
/* close databases */
|
||||
@ -395,8 +390,7 @@ bdb_cleanup(bdb_instance_t *db)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
bdb_instance_t *db = (bdb_instance_t *)dbdata;
|
||||
DBC *zone_cursor = NULL;
|
||||
@ -459,8 +453,7 @@ findzone_cleanup:
|
||||
static isc_result_t
|
||||
bdb_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
bdb_instance_t *db = (bdb_instance_t *)dbdata;
|
||||
DBC *zone_cursor = NULL;
|
||||
@ -581,8 +574,7 @@ lookup_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
|
||||
/* 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
|
||||
bdb_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
int bdbres;
|
||||
bdb_instance_t *db = NULL;
|
||||
@ -738,8 +729,7 @@ init_cleanup:
|
||||
}
|
||||
|
||||
static void
|
||||
bdb_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
bdb_destroy(void *driverarg, void *dbdata) {
|
||||
UNUSED(driverarg);
|
||||
|
||||
bdb_cleanup((bdb_instance_t *)dbdata);
|
||||
@ -767,8 +757,7 @@ static dns_sdlzmethods_t dlz_bdb_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_bdb_init(void)
|
||||
{
|
||||
dlz_bdb_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -796,8 +785,7 @@ dlz_bdb_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_bdb_clear(void)
|
||||
{
|
||||
dlz_bdb_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -92,18 +92,16 @@ typedef struct bdbhpt_parsed_data {
|
||||
|
||||
/* forward reference */
|
||||
|
||||
static isc_result_t bdbhpt_findzone(void *driverarg, void *dbdata,
|
||||
const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo);
|
||||
static isc_result_t
|
||||
bdbhpt_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo);
|
||||
|
||||
/*%
|
||||
* Reverses a string in place.
|
||||
*/
|
||||
|
||||
static char *
|
||||
bdbhpt_strrev(char *str)
|
||||
{
|
||||
bdbhpt_strrev(char *str) {
|
||||
char *p1, *p2;
|
||||
|
||||
if (!str || !*str) {
|
||||
@ -126,8 +124,7 @@ bdbhpt_strrev(char *str)
|
||||
*/
|
||||
|
||||
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 *tmp = in;
|
||||
char *lastchar = (char *)&tmp[strlen(tmp)];
|
||||
@ -237,8 +234,7 @@ bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd)
|
||||
|
||||
static isc_result_t
|
||||
bdbhpt_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBT key, data;
|
||||
@ -321,8 +317,7 @@ xfr_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
bdbhpt_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBC *xfr_cursor = NULL;
|
||||
@ -456,8 +451,7 @@ allnodes_cleanup:
|
||||
*/
|
||||
|
||||
static void
|
||||
bdbhpt_cleanup(bdbhpt_instance_t *db)
|
||||
{
|
||||
bdbhpt_cleanup(bdbhpt_instance_t *db) {
|
||||
isc_mem_t *mctx;
|
||||
|
||||
/* close databases */
|
||||
@ -490,8 +484,8 @@ bdbhpt_cleanup(bdbhpt_instance_t *db)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBT key, data;
|
||||
@ -545,8 +539,7 @@ bdbhpt_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
static isc_result_t
|
||||
bdbhpt_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result = ISC_R_NOTFOUND;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBC *data_cursor = NULL;
|
||||
@ -628,8 +621,7 @@ lookup_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
|
||||
/* 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
|
||||
bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
int bdbhptres;
|
||||
int bdbFlags = 0;
|
||||
@ -805,8 +796,7 @@ init_cleanup:
|
||||
}
|
||||
|
||||
static void
|
||||
bdbhpt_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
bdbhpt_destroy(void *driverarg, void *dbdata) {
|
||||
UNUSED(driverarg);
|
||||
|
||||
bdbhpt_cleanup((bdbhpt_instance_t *)dbdata);
|
||||
@ -836,8 +826,7 @@ static dns_sdlzmethods_t dlz_bdbhpt_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_bdbhpt_init(void)
|
||||
{
|
||||
dlz_bdbhpt_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -865,8 +854,7 @@ dlz_bdbhpt_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_bdbhpt_clear(void)
|
||||
{
|
||||
dlz_bdbhpt_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -62,8 +62,7 @@
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dlz_drivers_init(void)
|
||||
{
|
||||
dlz_drivers_init(void) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
#ifdef DLZ_STUB
|
||||
@ -127,8 +126,7 @@ dlz_drivers_init(void)
|
||||
*/
|
||||
|
||||
void
|
||||
dlz_drivers_clear(void)
|
||||
{
|
||||
dlz_drivers_clear(void) {
|
||||
#ifdef DLZ_STUB
|
||||
dlz_stub_clear();
|
||||
#endif /* ifdef DLZ_STUB */
|
||||
|
@ -89,15 +89,15 @@ typedef ISC_LIST(dir_entry_t) dlist_t;
|
||||
|
||||
/* forward reference */
|
||||
|
||||
static void fs_destroy(void *driverarg, void *dbdata);
|
||||
static void
|
||||
fs_destroy(void *driverarg, void *dbdata);
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
static bool
|
||||
is_safe(const char *input)
|
||||
{
|
||||
is_safe(const char *input) {
|
||||
unsigned int i;
|
||||
unsigned int len = strlen(input);
|
||||
|
||||
@ -165,8 +165,7 @@ is_safe(const char *input)
|
||||
}
|
||||
|
||||
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 *tmpPtr;
|
||||
int i;
|
||||
@ -229,8 +228,7 @@ create_path_helper(char *out, const char *in, config_data_t *cd)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
int pathsize;
|
||||
int len;
|
||||
@ -346,8 +344,7 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
|
||||
static isc_result_t
|
||||
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];
|
||||
int astPos;
|
||||
struct stat sb;
|
||||
@ -574,8 +571,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd,
|
||||
|
||||
static isc_result_t
|
||||
fs_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
char *path;
|
||||
struct stat sb;
|
||||
@ -609,8 +605,7 @@ complete_AXFR:
|
||||
|
||||
static isc_result_t
|
||||
fs_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result;
|
||||
dlist_t *dir_list;
|
||||
config_data_t *cd;
|
||||
@ -724,8 +719,7 @@ complete_allnds:
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
char *path;
|
||||
struct stat sb;
|
||||
@ -767,8 +761,7 @@ complete_FZ:
|
||||
static isc_result_t
|
||||
fs_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
char *path;
|
||||
struct stat sb;
|
||||
@ -841,8 +834,7 @@ complete_lkup:
|
||||
|
||||
static isc_result_t
|
||||
fs_create(const char *dlzname, unsigned int argc, char *argv[], void *driverarg,
|
||||
void **dbdata)
|
||||
{
|
||||
void **dbdata) {
|
||||
config_data_t *cd;
|
||||
char *endp;
|
||||
int len;
|
||||
@ -929,8 +921,7 @@ fs_create(const char *dlzname, unsigned int argc, char *argv[], void *driverarg,
|
||||
}
|
||||
|
||||
static void
|
||||
fs_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
fs_destroy(void *driverarg, void *dbdata) {
|
||||
isc_mem_t *mctx;
|
||||
config_data_t *cd;
|
||||
|
||||
@ -982,8 +973,7 @@ static dns_sdlzmethods_t dlz_fs_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_fs_init(void)
|
||||
{
|
||||
dlz_fs_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -1010,8 +1000,7 @@ dlz_fs_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_fs_clear(void)
|
||||
{
|
||||
dlz_fs_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -101,12 +101,13 @@ typedef struct {
|
||||
|
||||
/* forward references */
|
||||
|
||||
static isc_result_t dlz_ldap_findzone(void *driverarg, void *dbdata,
|
||||
const char *name,
|
||||
static isc_result_t
|
||||
dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo);
|
||||
|
||||
static void dlz_ldap_destroy(void *driverarg, void *dbdata);
|
||||
static void
|
||||
dlz_ldap_destroy(void *driverarg, void *dbdata);
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
@ -114,8 +115,7 @@ static void dlz_ldap_destroy(void *driverarg, void *dbdata);
|
||||
|
||||
/*% checks that the LDAP URL parameters make sense */
|
||||
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;
|
||||
int ldap_result;
|
||||
LDAPURLDesc *ldap_url = NULL;
|
||||
@ -191,8 +191,7 @@ cleanup:
|
||||
|
||||
/*% Connects / reconnects to LDAP server */
|
||||
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;
|
||||
int ldap_result;
|
||||
|
||||
@ -246,8 +245,7 @@ cleanup:
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static void
|
||||
ldap_destroy_dblist(db_list_t *dblist)
|
||||
{
|
||||
ldap_destroy_dblist(db_list_t *dblist) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -281,8 +279,7 @@ ldap_destroy_dblist(db_list_t *dblist)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
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 *head;
|
||||
int count = 0;
|
||||
@ -315,8 +312,7 @@ ldap_find_avail_conn(db_list_t *dblist)
|
||||
|
||||
static isc_result_t
|
||||
ldap_process_results(LDAP *dbc, LDAPMessage *msg, char **attrs, void *ptr,
|
||||
bool allnodes)
|
||||
{
|
||||
bool allnodes) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
int i = 0;
|
||||
int j;
|
||||
@ -553,8 +549,7 @@ cleanup:
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
char *querystring = NULL;
|
||||
@ -839,8 +834,7 @@ cleanup:
|
||||
*/
|
||||
static isc_result_t
|
||||
dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -858,16 +852,14 @@ dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
|
||||
static isc_result_t
|
||||
dlz_ldap_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
UNUSED(driverarg);
|
||||
return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
dlz_ldap_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dns_sdlzlookup_t *lookup) {
|
||||
UNUSED(driverarg);
|
||||
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
|
||||
dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
UNUSED(driverarg);
|
||||
UNUSED(methods);
|
||||
UNUSED(clientinfo);
|
||||
@ -886,8 +877,8 @@ dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
static isc_result_t
|
||||
dlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
|
||||
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;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -906,8 +897,7 @@ dlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
|
||||
|
||||
static isc_result_t
|
||||
dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
ldap_instance_t *ldap_inst = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
@ -1154,8 +1144,7 @@ cleanup:
|
||||
}
|
||||
|
||||
void
|
||||
dlz_ldap_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
dlz_ldap_destroy(void *driverarg, void *dbdata) {
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (dbdata != NULL) {
|
||||
@ -1203,8 +1192,7 @@ static dns_sdlzmethods_t dlz_ldap_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_ldap_init(void)
|
||||
{
|
||||
dlz_ldap_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -1231,8 +1219,7 @@ dlz_ldap_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_ldap_clear(void)
|
||||
{
|
||||
dlz_ldap_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -87,8 +87,7 @@ static dns_sdlzimplementation_t *dlz_mysql = NULL;
|
||||
*/
|
||||
|
||||
static char *
|
||||
mysqldrv_escape_string(MYSQL *mysql, const char *instr)
|
||||
{
|
||||
mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
|
||||
char *outstr;
|
||||
unsigned int len;
|
||||
|
||||
@ -117,8 +116,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
char *querystring = NULL;
|
||||
@ -357,8 +355,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
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;
|
||||
MYSQL_ROW row;
|
||||
unsigned int fields;
|
||||
@ -475,8 +472,7 @@ mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
MYSQL_RES *rs = NULL;
|
||||
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 */
|
||||
static isc_result_t
|
||||
mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
my_ulonglong rows;
|
||||
@ -575,8 +570,7 @@ mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
*/
|
||||
static isc_result_t
|
||||
mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
MYSQL_ROW row;
|
||||
@ -681,8 +675,7 @@ mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
|
||||
static isc_result_t
|
||||
mysql_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dns_sdlzlookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
|
||||
@ -716,8 +709,7 @@ mysql_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
static isc_result_t
|
||||
mysql_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
|
||||
@ -753,8 +745,7 @@ mysql_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
*/
|
||||
static isc_result_t
|
||||
mysql_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
char *tmp = NULL;
|
||||
@ -973,8 +964,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
static void
|
||||
mysql_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
mysql_destroy(void *driverarg, void *dbdata) {
|
||||
dbinstance_t *dbi;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -1014,8 +1004,7 @@ static dns_sdlzmethods_t dlz_mysql_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_mysql_init(void)
|
||||
{
|
||||
dlz_mysql_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -1050,8 +1039,7 @@ dlz_mysql_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_mysql_clear(void)
|
||||
{
|
||||
dlz_mysql_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -104,15 +104,15 @@ typedef struct {
|
||||
|
||||
/* 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
|
||||
*/
|
||||
|
||||
static SQLSMALLINT
|
||||
safeLen(void *a)
|
||||
{
|
||||
safeLen(void *a) {
|
||||
if (a == NULL) {
|
||||
return (0);
|
||||
}
|
||||
@ -122,8 +122,7 @@ safeLen(void *a)
|
||||
/*% propertly cleans up an odbc_instance_t */
|
||||
|
||||
static void
|
||||
destroy_odbc_instance(odbc_instance_t *odbc_inst)
|
||||
{
|
||||
destroy_odbc_instance(odbc_instance_t *odbc_inst) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -189,8 +188,7 @@ destroy_odbc_instance(odbc_instance_t *odbc_inst)
|
||||
/*% Connects to database, and creates ODBC statements */
|
||||
|
||||
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;
|
||||
SQLRETURN sqlRes;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
@ -281,8 +279,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
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 *head;
|
||||
int count = 0;
|
||||
@ -321,8 +318,7 @@ odbc_find_avail_conn(db_list_t *dblist)
|
||||
*/
|
||||
|
||||
static char *
|
||||
odbc_escape_string(const char *instr)
|
||||
{
|
||||
odbc_escape_string(const char *instr) {
|
||||
char *outstr;
|
||||
unsigned int len;
|
||||
|
||||
@ -358,8 +354,7 @@ odbc_escape_string(const char *instr)
|
||||
*/
|
||||
|
||||
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;
|
||||
char *target = to;
|
||||
unsigned int remaining = length;
|
||||
@ -414,8 +409,7 @@ odbc_makesafe(char *to, const char *from, size_t length)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
char *querystring = NULL;
|
||||
@ -649,8 +643,7 @@ cleanup: /* it's always good to cleanup after yourself */
|
||||
*/
|
||||
|
||||
static isc_result_t
|
||||
odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data)
|
||||
{
|
||||
odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data) {
|
||||
SQLLEN size;
|
||||
|
||||
REQUIRE(data != NULL && *data == NULL);
|
||||
@ -680,8 +673,7 @@ odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data)
|
||||
|
||||
static isc_result_t
|
||||
odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
|
||||
SQLSMALLINT endField, char **retData)
|
||||
{
|
||||
SQLSMALLINT endField, char **retData) {
|
||||
isc_result_t result;
|
||||
SQLLEN size;
|
||||
int totSize = 0;
|
||||
@ -747,8 +739,7 @@ odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
|
||||
*/
|
||||
|
||||
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;
|
||||
SQLSMALLINT fields;
|
||||
SQLHSTMT *stmnt;
|
||||
@ -884,8 +875,7 @@ process_rs_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
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 */
|
||||
static isc_result_t
|
||||
odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -975,8 +964,7 @@ odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
|
||||
static isc_result_t
|
||||
odbc_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
SQLHSTMT *stmnt;
|
||||
@ -1108,8 +1096,7 @@ allnodes_cleanup:
|
||||
|
||||
static isc_result_t
|
||||
odbc_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dns_sdlzlookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -1139,8 +1126,7 @@ odbc_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
static isc_result_t
|
||||
odbc_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -1171,8 +1157,7 @@ odbc_lookup(const char *zone, const char *name, void *driverarg, void *dbdata,
|
||||
*/
|
||||
static isc_result_t
|
||||
odbc_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
odbc_instance_t *odbc_inst = NULL;
|
||||
dbinstance_t *db = NULL;
|
||||
@ -1357,8 +1342,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
static void
|
||||
odbc_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
odbc_destroy(void *driverarg, void *dbdata) {
|
||||
UNUSED(driverarg);
|
||||
|
||||
destroy_odbc_instance((odbc_instance_t *)dbdata);
|
||||
@ -1388,8 +1372,7 @@ static dns_sdlzmethods_t dlz_odbc_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_odbc_init(void)
|
||||
{
|
||||
dlz_odbc_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -1425,8 +1408,7 @@ dlz_odbc_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_odbc_clear(void)
|
||||
{
|
||||
dlz_odbc_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -107,8 +107,7 @@ static dns_sdlzimplementation_t *dlz_postgres = NULL;
|
||||
*/
|
||||
|
||||
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;
|
||||
char *target = to;
|
||||
unsigned int remaining = length;
|
||||
@ -150,8 +149,7 @@ postgres_makesafe(char *to, const char *from, size_t length)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static void
|
||||
postgres_destroy_dblist(db_list_t *dblist)
|
||||
{
|
||||
postgres_destroy_dblist(db_list_t *dblist) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -186,8 +184,7 @@ postgres_destroy_dblist(db_list_t *dblist)
|
||||
*/
|
||||
|
||||
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 *head;
|
||||
int count = 0;
|
||||
@ -227,8 +224,7 @@ postgres_find_avail_conn(db_list_t *dblist)
|
||||
*/
|
||||
|
||||
static char *
|
||||
postgres_escape_string(const char *instr)
|
||||
{
|
||||
postgres_escape_string(const char *instr) {
|
||||
char *outstr;
|
||||
unsigned int len;
|
||||
|
||||
@ -264,8 +260,7 @@ postgres_escape_string(const char *instr)
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
char *querystring = NULL;
|
||||
@ -609,8 +604,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
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;
|
||||
unsigned int i;
|
||||
unsigned int rows;
|
||||
@ -730,8 +724,7 @@ postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs)
|
||||
static isc_result_t
|
||||
postgres_findzone(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
PGresult *rs = NULL;
|
||||
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 */
|
||||
static isc_result_t
|
||||
postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
isc_result_t result;
|
||||
PGresult *rs = NULL;
|
||||
unsigned int rows;
|
||||
@ -830,8 +822,7 @@ postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
*/
|
||||
static isc_result_t
|
||||
postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
isc_result_t result;
|
||||
PGresult *rs = NULL;
|
||||
unsigned int i;
|
||||
@ -942,8 +933,7 @@ postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
|
||||
static isc_result_t
|
||||
postgres_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dns_sdlzlookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
PGresult *rs = NULL;
|
||||
|
||||
@ -979,8 +969,8 @@ postgres_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
static isc_result_t
|
||||
postgres_lookup(const char *zone, const char *name, void *driverarg,
|
||||
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;
|
||||
PGresult *rs = NULL;
|
||||
|
||||
@ -1016,8 +1006,7 @@ postgres_lookup(const char *zone, const char *name, void *driverarg,
|
||||
*/
|
||||
static isc_result_t
|
||||
postgres_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
isc_result_t result;
|
||||
dbinstance_t *dbi = NULL;
|
||||
unsigned int j;
|
||||
@ -1189,8 +1178,7 @@ cleanup:
|
||||
* so we really only need to clean it up since we are not using driverarg.
|
||||
*/
|
||||
static void
|
||||
postgres_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
postgres_destroy(void *driverarg, void *dbdata) {
|
||||
UNUSED(driverarg);
|
||||
/* cleanup the list of DBI's */
|
||||
postgres_destroy_dblist((db_list_t *)dbdata);
|
||||
@ -1220,8 +1208,7 @@ static dns_sdlzmethods_t dlz_postgres_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_postgres_init(void)
|
||||
{
|
||||
dlz_postgres_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -1257,8 +1244,7 @@ dlz_postgres_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_postgres_clear(void)
|
||||
{
|
||||
dlz_postgres_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
@ -73,8 +73,7 @@ typedef struct config_data {
|
||||
|
||||
static isc_result_t
|
||||
stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dns_sdlzallnodes_t *allnodes) {
|
||||
config_data_t *cd;
|
||||
isc_result_t result;
|
||||
|
||||
@ -102,8 +101,7 @@ stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
|
||||
static isc_result_t
|
||||
stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
const char *client) {
|
||||
config_data_t *cd;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -119,8 +117,7 @@ stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
|
||||
static isc_result_t
|
||||
stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dns_sdlzlookup_t *lookup) {
|
||||
isc_result_t result;
|
||||
config_data_t *cd;
|
||||
|
||||
@ -148,8 +145,7 @@ stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
static isc_result_t
|
||||
stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
config_data_t *cd;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -173,8 +169,8 @@ stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
|
||||
static isc_result_t
|
||||
stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
||||
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;
|
||||
config_data_t *cd;
|
||||
|
||||
@ -198,8 +194,7 @@ stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
||||
|
||||
static isc_result_t
|
||||
stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
void *driverarg, void **dbdata) {
|
||||
config_data_t *cd;
|
||||
|
||||
UNUSED(driverarg);
|
||||
@ -237,8 +232,7 @@ stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
}
|
||||
|
||||
static void
|
||||
stub_dlz_destroy(void *driverarg, void *dbdata)
|
||||
{
|
||||
stub_dlz_destroy(void *driverarg, void *dbdata) {
|
||||
config_data_t *cd;
|
||||
isc_mem_t *mctx;
|
||||
|
||||
@ -280,8 +274,7 @@ static dns_sdlzmethods_t dlz_stub_methods = {
|
||||
* Wrapper around dns_sdlzregister().
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_stub_init(void)
|
||||
{
|
||||
dlz_stub_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
@ -308,8 +301,7 @@ dlz_stub_init(void)
|
||||
* Wrapper around dns_sdlzunregister().
|
||||
*/
|
||||
void
|
||||
dlz_stub_clear(void)
|
||||
{
|
||||
dlz_stub_clear(void) {
|
||||
/*
|
||||
* Write debugging message to log
|
||||
*/
|
||||
|
1
contrib/dlz/drivers/include/.clang-format
Symbolic link
1
contrib/dlz/drivers/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -57,7 +57,7 @@ typedef struct driverinstance driverinstance_t;
|
||||
* special tokens are %zone%, %record%, %client%
|
||||
*/
|
||||
struct query_segment {
|
||||
void * sql;
|
||||
void *sql;
|
||||
unsigned int strlen;
|
||||
bool direct;
|
||||
ISC_LINK(query_segment_t) link;
|
||||
@ -71,18 +71,18 @@ struct query_segment {
|
||||
* make sure no two threads try to use the same DBI at a time.
|
||||
*/
|
||||
struct dbinstance {
|
||||
void * dbconn;
|
||||
void *dbconn;
|
||||
query_list_t *allnodes_q;
|
||||
query_list_t *allowxfr_q;
|
||||
query_list_t *authority_q;
|
||||
query_list_t *findzone_q;
|
||||
query_list_t *lookup_q;
|
||||
query_list_t *countzone_q;
|
||||
char * query_buf;
|
||||
char * zone;
|
||||
char * record;
|
||||
char * client;
|
||||
isc_mem_t * mctx;
|
||||
char *query_buf;
|
||||
char *zone;
|
||||
char *record;
|
||||
char *client;
|
||||
isc_mem_t *mctx;
|
||||
isc_mutex_t instance_lock;
|
||||
ISC_LINK(dbinstance_t) link;
|
||||
};
|
||||
|
@ -63,8 +63,7 @@
|
||||
*/
|
||||
|
||||
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 *nseg = NULL;
|
||||
|
||||
@ -100,8 +99,7 @@ destroy_querylist(isc_mem_t *mctx, query_list_t **querylist)
|
||||
static isc_result_t
|
||||
build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
|
||||
char **record, char **client, query_list_t **querylist,
|
||||
unsigned int flags)
|
||||
{
|
||||
unsigned int flags) {
|
||||
isc_result_t result;
|
||||
bool foundzone = false;
|
||||
bool foundrecord = false;
|
||||
@ -268,8 +266,7 @@ flag_fail:
|
||||
* used to be in our queries from named.conf
|
||||
*/
|
||||
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;
|
||||
unsigned int length = 0;
|
||||
char *qs = NULL;
|
||||
@ -319,8 +316,7 @@ isc_result_t
|
||||
sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
|
||||
const char *allowxfr_str, const char *authority_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;
|
||||
dbinstance_t *db = NULL;
|
||||
|
||||
@ -435,8 +431,7 @@ cleanup:
|
||||
}
|
||||
|
||||
void
|
||||
sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
|
||||
{
|
||||
sdlzh_destroy_sqldbinstance(dbinstance_t *dbi) {
|
||||
isc_mem_t *mctx;
|
||||
|
||||
/* save mctx for later */
|
||||
@ -458,8 +453,7 @@ sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
|
||||
}
|
||||
|
||||
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;
|
||||
char *keystart;
|
||||
char value[255];
|
||||
|
@ -63,8 +63,7 @@ struct dlz_example_data {
|
||||
};
|
||||
|
||||
static bool
|
||||
single_valued(const char *type)
|
||||
{
|
||||
single_valued(const char *type) {
|
||||
const char *single[] = { "soa", "cname", NULL };
|
||||
int i;
|
||||
|
||||
@ -81,8 +80,7 @@ single_valued(const char *type)
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
bool single = single_valued(type);
|
||||
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
|
||||
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;
|
||||
|
||||
UNUSED(state);
|
||||
@ -161,8 +158,7 @@ del_name(struct dlz_example_data *state, struct record *list, const char *name,
|
||||
}
|
||||
|
||||
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];
|
||||
const char *ret;
|
||||
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
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
UNUSED(flags);
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
}
|
||||
@ -205,8 +200,7 @@ dlz_version(unsigned int *flags)
|
||||
*/
|
||||
static void
|
||||
b9_add_helper(struct dlz_example_data *state, const char *helper_name,
|
||||
void *ptr)
|
||||
{
|
||||
void *ptr) {
|
||||
if (strcmp(helper_name, "log") == 0) {
|
||||
state->log = (log_t *)ptr;
|
||||
}
|
||||
@ -226,8 +220,7 @@ b9_add_helper(struct dlz_example_data *state, const char *helper_name,
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
struct dlz_example_data *state;
|
||||
const char *helper_name;
|
||||
va_list ap;
|
||||
@ -311,8 +304,7 @@ failure:
|
||||
* Shut down the backend
|
||||
*/
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||
|
||||
if (state->log != NULL) {
|
||||
@ -328,8 +320,7 @@ dlz_destroy(void *dbdata)
|
||||
*/
|
||||
isc_result_t
|
||||
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;
|
||||
isc_sockaddr_t *src;
|
||||
char addrbuf[100];
|
||||
@ -397,8 +388,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
isc_result_t
|
||||
dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||
bool found = false;
|
||||
@ -501,8 +491,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
* See if a zone transfer is allowed
|
||||
*/
|
||||
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);
|
||||
|
||||
/* 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
|
||||
*/
|
||||
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;
|
||||
int i;
|
||||
|
||||
@ -545,8 +533,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes)
|
||||
* Start a transaction
|
||||
*/
|
||||
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;
|
||||
|
||||
if (state->transaction_started) {
|
||||
@ -569,8 +556,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp)
|
||||
* End a transaction
|
||||
*/
|
||||
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;
|
||||
|
||||
if (!state->transaction_started) {
|
||||
@ -630,8 +616,7 @@ dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp)
|
||||
* Configure a writeable zone
|
||||
*/
|
||||
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;
|
||||
isc_result_t result;
|
||||
|
||||
@ -674,8 +659,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata)
|
||||
bool
|
||||
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
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;
|
||||
|
||||
UNUSED(tcpaddr);
|
||||
@ -704,8 +688,7 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
|
||||
static isc_result_t
|
||||
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 absolute[1024];
|
||||
isc_result_t result;
|
||||
@ -768,8 +751,7 @@ error:
|
||||
|
||||
isc_result_t
|
||||
dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
void *version)
|
||||
{
|
||||
void *version) {
|
||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||
|
||||
if (version != (void *)&state->transaction_started) {
|
||||
@ -786,8 +768,7 @@ dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
|
||||
isc_result_t
|
||||
dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
void *version)
|
||||
{
|
||||
void *version) {
|
||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||
|
||||
if (version != (void *)&state->transaction_started) {
|
||||
@ -805,8 +786,8 @@ dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (version != (void *)&state->transaction_started) {
|
||||
|
@ -14,8 +14,7 @@
|
||||
* Called when we enter the DLL
|
||||
*/
|
||||
__declspec(dllexport) BOOL WINAPI
|
||||
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
switch (fdwReason) {
|
||||
/*
|
||||
* The DLL is loading due to process
|
||||
|
@ -103,15 +103,14 @@ typedef struct bdbhpt_parsed_data {
|
||||
char *data;
|
||||
} bdbhpt_parsed_data_t;
|
||||
|
||||
static void b9_add_helper(struct bdbhpt_instance *db, const char *helper_name,
|
||||
void *ptr);
|
||||
static void
|
||||
b9_add_helper(struct bdbhpt_instance *db, const char *helper_name, void *ptr);
|
||||
|
||||
/*%
|
||||
* Reverses a string in place.
|
||||
*/
|
||||
static char *
|
||||
bdbhpt_strrev(char *str)
|
||||
{
|
||||
bdbhpt_strrev(char *str) {
|
||||
char *p1, *p2;
|
||||
|
||||
if (!str || !*str) {
|
||||
@ -134,8 +133,7 @@ bdbhpt_strrev(char *str)
|
||||
*/
|
||||
|
||||
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 *tmp = in;
|
||||
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
|
||||
*/
|
||||
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;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBT key, data;
|
||||
@ -329,8 +326,7 @@ xfr_cleanup:
|
||||
* updates by a separate process).
|
||||
*/
|
||||
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;
|
||||
bdbhpt_instance_t *db = (bdbhpt_instance_t *)dbdata;
|
||||
DBC *xfr_cursor = NULL;
|
||||
@ -460,8 +456,7 @@ allnodes_cleanup:
|
||||
* Used by bdbhpt_destroy when the driver is shutting down.
|
||||
*/
|
||||
static void
|
||||
bdbhpt_cleanup(bdbhpt_instance_t *db)
|
||||
{
|
||||
bdbhpt_cleanup(bdbhpt_instance_t *db) {
|
||||
/* close databases */
|
||||
if (db->data != NULL) {
|
||||
db->data->close(db->data, 0);
|
||||
@ -641,8 +636,7 @@ lookup_cleanup:
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
|
||||
/* Initialise the database. */
|
||||
@ -682,8 +676,7 @@ bdbhpt_opendb(log_t *log, DB_ENV *db_env, DBTYPE db_type, DB **db,
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result;
|
||||
int bdbhptres;
|
||||
int bdbFlags = 0;
|
||||
@ -826,8 +819,7 @@ init_cleanup:
|
||||
* Shut down the backend
|
||||
*/
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
struct bdbhpt_instance *db = (struct bdbhpt_instance *)dbdata;
|
||||
|
||||
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
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
UNUSED(flags);
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
}
|
||||
@ -850,8 +841,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
db->log = (log_t *)ptr;
|
||||
}
|
||||
|
@ -61,8 +61,7 @@
|
||||
*/
|
||||
|
||||
void
|
||||
destroy_querylist(query_list_t **querylist)
|
||||
{
|
||||
destroy_querylist(query_list_t **querylist) {
|
||||
query_segment_t *tseg = NULL;
|
||||
query_segment_t *nseg = NULL;
|
||||
|
||||
@ -96,8 +95,7 @@ destroy_querylist(query_list_t **querylist)
|
||||
isc_result_t
|
||||
build_querylist(const char *query_str, char **zone, char **record,
|
||||
char **client, query_list_t **querylist, unsigned int flags,
|
||||
log_t log)
|
||||
{
|
||||
log_t log) {
|
||||
isc_result_t result;
|
||||
bool foundzone = false;
|
||||
bool foundrecord = false;
|
||||
@ -273,8 +271,7 @@ flag_fail:
|
||||
* used to be in our queries from named.conf
|
||||
*/
|
||||
char *
|
||||
build_querystring(query_list_t *querylist)
|
||||
{
|
||||
build_querystring(query_list_t *querylist) {
|
||||
query_segment_t *tseg = NULL;
|
||||
unsigned int length = 0;
|
||||
char *qs = NULL;
|
||||
@ -323,8 +320,7 @@ isc_result_t
|
||||
build_dbinstance(const char *allnodes_str, const char *allowxfr_str,
|
||||
const char *authority_str, const char *findzone_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;
|
||||
dbinstance_t *db = NULL;
|
||||
int err;
|
||||
@ -452,8 +448,7 @@ cleanup:
|
||||
}
|
||||
|
||||
void
|
||||
destroy_dbinstance(dbinstance_t *dbi)
|
||||
{
|
||||
destroy_dbinstance(dbinstance_t *dbi) {
|
||||
/* destroy any query lists we created */
|
||||
destroy_querylist(&dbi->allnodes_q);
|
||||
destroy_querylist(&dbi->allowxfr_q);
|
||||
@ -470,8 +465,7 @@ destroy_dbinstance(dbinstance_t *dbi)
|
||||
}
|
||||
|
||||
char *
|
||||
get_parameter_value(const char *input, const char *key)
|
||||
{
|
||||
get_parameter_value(const char *input, const char *key) {
|
||||
int keylen;
|
||||
char *keystart;
|
||||
char value[255];
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
void
|
||||
dir_init(dir_t *dir)
|
||||
{
|
||||
dir_init(dir_t *dir) {
|
||||
dir->entry.name[0] = '\0';
|
||||
dir->entry.length = 0;
|
||||
|
||||
@ -36,8 +35,7 @@ dir_init(dir_t *dir)
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dir_open(dir_t *dir, const char *dirname)
|
||||
{
|
||||
dir_open(dir_t *dir, const char *dirname) {
|
||||
char *p;
|
||||
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.
|
||||
*/
|
||||
isc_result_t
|
||||
dir_read(dir_t *dir)
|
||||
{
|
||||
dir_read(dir_t *dir) {
|
||||
struct dirent *entry;
|
||||
|
||||
entry = readdir(dir->handle);
|
||||
@ -113,8 +110,7 @@ dir_read(dir_t *dir)
|
||||
* \brief Close directory stream.
|
||||
*/
|
||||
void
|
||||
dir_close(dir_t *dir)
|
||||
{
|
||||
dir_close(dir_t *dir) {
|
||||
(void)closedir(dir->handle);
|
||||
dir->handle = NULL;
|
||||
}
|
||||
@ -123,8 +119,7 @@ dir_close(dir_t *dir)
|
||||
* \brief Reposition directory stream at start.
|
||||
*/
|
||||
isc_result_t
|
||||
dir_reset(dir_t *dir)
|
||||
{
|
||||
dir_reset(dir_t *dir) {
|
||||
rewinddir(dir->handle);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
@ -29,7 +29,7 @@ typedef struct direntry {
|
||||
typedef struct dir {
|
||||
char dirname[DIR_PATHMAX];
|
||||
direntry_t entry;
|
||||
DIR * handle;
|
||||
DIR *handle;
|
||||
} dir_t;
|
||||
|
||||
void
|
||||
|
@ -88,15 +88,14 @@ typedef DLZ_LIST(dir_entry_t) dlist_t;
|
||||
|
||||
/* forward reference */
|
||||
|
||||
static void b9_add_helper(struct config_data *cd, const char *helper_name,
|
||||
void *ptr);
|
||||
static void
|
||||
b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr);
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
*/
|
||||
static bool
|
||||
is_safe(const char *input)
|
||||
{
|
||||
is_safe(const char *input) {
|
||||
unsigned int i;
|
||||
unsigned int len = strlen(input);
|
||||
|
||||
@ -164,8 +163,7 @@ is_safe(const char *input)
|
||||
}
|
||||
|
||||
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 *tmpPtr;
|
||||
int i;
|
||||
@ -232,8 +230,7 @@ create_path_helper(char *out, const char *in, config_data_t *cd)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
int pathsize;
|
||||
int len;
|
||||
@ -361,8 +358,7 @@ cleanup_mem:
|
||||
|
||||
static isc_result_t
|
||||
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];
|
||||
int astPos;
|
||||
struct stat sb;
|
||||
@ -582,8 +578,7 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, dlist_t *dir_list,
|
||||
* DLZ methods
|
||||
*/
|
||||
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;
|
||||
char *path;
|
||||
struct stat sb;
|
||||
@ -614,8 +609,7 @@ complete_AXFR:
|
||||
}
|
||||
|
||||
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;
|
||||
dlist_t *dir_list;
|
||||
config_data_t *cd = (config_data_t *)dbdata;
|
||||
@ -849,8 +843,7 @@ complete_lkup:
|
||||
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result = ISC_R_NOMEMORY;
|
||||
config_data_t *cd;
|
||||
char *endp;
|
||||
@ -971,8 +964,7 @@ free_cd:
|
||||
}
|
||||
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
config_data_t *cd;
|
||||
|
||||
cd = (config_data_t *)dbdata;
|
||||
@ -1001,8 +993,7 @@ dlz_destroy(void *dbdata)
|
||||
* Return the version of the API
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
UNUSED(flags);
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
}
|
||||
@ -1011,8 +1002,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
cd->log = (log_t *)ptr;
|
||||
}
|
||||
|
1
contrib/dlz/modules/include/.clang-format
Symbolic link
1
contrib/dlz/modules/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
@ -61,7 +61,7 @@ typedef struct driverinstance driverinstance_t;
|
||||
* special tokens are %zone%, %record%, %client%
|
||||
*/
|
||||
struct query_segment {
|
||||
void * cmd;
|
||||
void *cmd;
|
||||
unsigned int strlen;
|
||||
bool direct;
|
||||
DLZ_LINK(query_segment_t) link;
|
||||
@ -75,17 +75,17 @@ struct query_segment {
|
||||
* make sure no two threads try to use the same DBI at a time.
|
||||
*/
|
||||
struct dbinstance {
|
||||
void * dbconn;
|
||||
void *dbconn;
|
||||
query_list_t *allnodes_q;
|
||||
query_list_t *allowxfr_q;
|
||||
query_list_t *authority_q;
|
||||
query_list_t *findzone_q;
|
||||
query_list_t *lookup_q;
|
||||
query_list_t *countzone_q;
|
||||
char * query_buf;
|
||||
char * zone;
|
||||
char * record;
|
||||
char * client;
|
||||
char *query_buf;
|
||||
char *zone;
|
||||
char *record;
|
||||
char *client;
|
||||
dlz_mutex_t lock;
|
||||
DLZ_LINK(dbinstance_t) link;
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ typedef uint32_t dns_ttl_t;
|
||||
do { \
|
||||
union { \
|
||||
const void *k; \
|
||||
void * v; \
|
||||
void *v; \
|
||||
} _u; \
|
||||
_u.k = konst; \
|
||||
var = _u.v; \
|
||||
@ -109,21 +109,21 @@ typedef struct isc_sockaddr {
|
||||
#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */
|
||||
} type;
|
||||
unsigned int length;
|
||||
void * link;
|
||||
void *link;
|
||||
} isc_sockaddr_t;
|
||||
|
||||
#define DNS_CLIENTINFO_VERSION 2
|
||||
typedef struct dns_clientinfo {
|
||||
uint16_t version;
|
||||
void * data;
|
||||
void * dbversion;
|
||||
void *data;
|
||||
void *dbversion;
|
||||
} dns_clientinfo_t;
|
||||
|
||||
typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client,
|
||||
isc_sockaddr_t ** addrp);
|
||||
isc_sockaddr_t **addrp);
|
||||
|
||||
typedef isc_result_t (*dns_clientinfo_version_t)(dns_clientinfo_t *client,
|
||||
void ** addrp);
|
||||
void **addrp);
|
||||
|
||||
#define DNS_CLIENTINFOMETHODS_VERSION 2
|
||||
#define DNS_CLIENTINFOMETHODS_AGE 1
|
||||
|
@ -108,17 +108,19 @@ typedef struct {
|
||||
/* forward references */
|
||||
|
||||
#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 */
|
||||
isc_result_t dlz_findzonedb(void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
isc_result_t
|
||||
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo);
|
||||
#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,
|
||||
void *ptr);
|
||||
static void
|
||||
b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr);
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
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;
|
||||
int ldap_result;
|
||||
LDAPURLDesc *ldap_url = NULL;
|
||||
@ -192,8 +193,7 @@ cleanup:
|
||||
|
||||
/*% Connects / reconnects to LDAP server */
|
||||
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;
|
||||
int ldap_result;
|
||||
|
||||
@ -248,8 +248,7 @@ cleanup:
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static void
|
||||
ldap_destroy_dblist(db_list_t *dblist)
|
||||
{
|
||||
ldap_destroy_dblist(db_list_t *dblist) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -283,8 +282,7 @@ ldap_destroy_dblist(db_list_t *dblist)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
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 *head;
|
||||
int count = 0;
|
||||
@ -318,8 +316,7 @@ ldap_find_avail_conn(ldap_instance_t *ldap)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
int i = 0;
|
||||
int j;
|
||||
@ -547,8 +544,7 @@ cleanup:
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
ldap_instance_t *db = (ldap_instance_t *)dbdata;
|
||||
dbinstance_t *dbi = NULL;
|
||||
@ -837,8 +833,7 @@ cleanup:
|
||||
* DLZ methods
|
||||
*/
|
||||
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;
|
||||
|
||||
/* 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
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@ -914,8 +907,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
ldap_instance_t *ldap = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
@ -1201,8 +1193,7 @@ cleanup:
|
||||
}
|
||||
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
if (dbdata != NULL) {
|
||||
ldap_instance_t *db = (ldap_instance_t *)dbdata;
|
||||
#if PTHREADS
|
||||
@ -1236,8 +1227,7 @@ dlz_destroy(void *dbdata)
|
||||
* Return the version of the API
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
*flags |= DNS_SDLZFLAG_RELATIVERDATA;
|
||||
#if PTHREADS
|
||||
*flags |= DNS_SDLZFLAG_THREADSAFE;
|
||||
@ -1251,8 +1241,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
db->log = (log_t *)ptr;
|
||||
}
|
||||
|
@ -97,22 +97,22 @@ typedef struct {
|
||||
} mysql_instance_t;
|
||||
|
||||
/* forward references */
|
||||
isc_result_t dlz_findzonedb(void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
isc_result_t
|
||||
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
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,
|
||||
void *ptr);
|
||||
static void
|
||||
b9_add_helper(mysql_instance_t *db, const char *helper_name, void *ptr);
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
void
|
||||
mysql_destroy(dbinstance_t *db)
|
||||
{
|
||||
mysql_destroy(dbinstance_t *db) {
|
||||
/* release DB connection */
|
||||
if (db->dbconn != NULL) {
|
||||
mysql_close((MYSQL *)db->dbconn);
|
||||
@ -129,8 +129,7 @@ mysql_destroy(dbinstance_t *db)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static void
|
||||
mysql_destroy_dblist(db_list_t *dblist)
|
||||
{
|
||||
mysql_destroy_dblist(db_list_t *dblist) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -157,8 +156,7 @@ mysql_destroy_dblist(db_list_t *dblist)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static dbinstance_t *
|
||||
mysql_find_avail_conn(mysql_instance_t *mysql)
|
||||
{
|
||||
mysql_find_avail_conn(mysql_instance_t *mysql) {
|
||||
dbinstance_t *dbi = NULL, *head;
|
||||
int count = 0;
|
||||
|
||||
@ -197,8 +195,7 @@ mysql_find_avail_conn(mysql_instance_t *mysql)
|
||||
* want special characters in the string causing problems.
|
||||
*/
|
||||
static char *
|
||||
mysqldrv_escape_string(MYSQL *mysql, const char *instr)
|
||||
{
|
||||
mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
|
||||
char *outstr;
|
||||
unsigned int len;
|
||||
|
||||
@ -228,8 +225,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr)
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
mysql_instance_t *db = (mysql_instance_t *)dbdata;
|
||||
@ -441,8 +437,8 @@ cleanup:
|
||||
* into this function to minimize code.
|
||||
*/
|
||||
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;
|
||||
MYSQL_ROW row;
|
||||
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 */
|
||||
isc_result_t
|
||||
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
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 */
|
||||
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;
|
||||
mysql_instance_t *db = (mysql_instance_t *)dbdata;
|
||||
MYSQL_RES *rs = NULL;
|
||||
@ -643,8 +637,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
|
||||
* query.
|
||||
*/
|
||||
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;
|
||||
mysql_instance_t *db = (mysql_instance_t *)dbdata;
|
||||
MYSQL_RES *rs = NULL;
|
||||
@ -747,8 +740,7 @@ cleanup:
|
||||
* use this function to get that information for named.
|
||||
*/
|
||||
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;
|
||||
MYSQL_RES *rs = NULL;
|
||||
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
|
||||
dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
MYSQL_RES *rs = NULL;
|
||||
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
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
mysql_instance_t *mysql = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
@ -1074,8 +1064,7 @@ cleanup:
|
||||
* Destroy the module.
|
||||
*/
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
mysql_instance_t *db = (mysql_instance_t *)dbdata;
|
||||
#if PTHREADS
|
||||
/* cleanup the list of DBI's */
|
||||
@ -1107,8 +1096,7 @@ dlz_destroy(void *dbdata)
|
||||
* Return the version of the API
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
*flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA |
|
||||
DNS_SDLZFLAG_THREADSAFE);
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
@ -1118,8 +1106,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
db->log = (log_t *)ptr;
|
||||
}
|
||||
|
@ -251,8 +251,7 @@ static const char *modname = "dlz_mysqldyn";
|
||||
* Local functions
|
||||
*/
|
||||
static bool
|
||||
db_connect(mysql_data_t *state, mysql_instance_t *dbi)
|
||||
{
|
||||
db_connect(mysql_data_t *state, mysql_instance_t *dbi) {
|
||||
MYSQL *conn;
|
||||
/*
|
||||
* 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 *
|
||||
get_dbi(mysql_data_t *state)
|
||||
{
|
||||
get_dbi(mysql_data_t *state) {
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -315,8 +313,7 @@ get_dbi(mysql_data_t *state)
|
||||
* of string 'original'
|
||||
*/
|
||||
static char *
|
||||
sanitize(mysql_instance_t *dbi, const char *original)
|
||||
{
|
||||
sanitize(mysql_instance_t *dbi, const char *original) {
|
||||
char *s;
|
||||
|
||||
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'.
|
||||
*/
|
||||
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;
|
||||
|
||||
item = malloc(sizeof(*item));
|
||||
@ -369,8 +365,7 @@ additem(mysql_arglist_t *arglist, char **s, size_t *len)
|
||||
*/
|
||||
static char *
|
||||
build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result;
|
||||
bool localdbi = false;
|
||||
mysql_arglist_t arglist;
|
||||
@ -491,8 +486,7 @@ fail:
|
||||
|
||||
/* Does this name end in a dot? */
|
||||
static bool
|
||||
isrelative(const char *s)
|
||||
{
|
||||
isrelative(const char *s) {
|
||||
if (s == NULL || s[strlen(s) - 1] == '.') {
|
||||
return (false);
|
||||
}
|
||||
@ -501,8 +495,7 @@ isrelative(const char *s)
|
||||
|
||||
/* Return a dot if 's' doesn't already end with one */
|
||||
static inline const char *
|
||||
dot(const char *s)
|
||||
{
|
||||
dot(const char *s) {
|
||||
return (isrelative(s) ? "." : "");
|
||||
}
|
||||
|
||||
@ -512,8 +505,7 @@ dot(const char *s)
|
||||
* enough space).
|
||||
*/
|
||||
static void
|
||||
fqhn(const char *name, const char *zone, char *dest)
|
||||
{
|
||||
fqhn(const char *name, const char *zone, char *dest) {
|
||||
if (dest == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -534,8 +526,7 @@ fqhn(const char *name, const char *zone, char *dest)
|
||||
* removes labels matching 'zone' from the end of 'name'.
|
||||
*/
|
||||
static char *
|
||||
relname(const char *name, const char *zone)
|
||||
{
|
||||
relname(const char *name, const char *zone) {
|
||||
size_t nlen, zlen;
|
||||
const char *p;
|
||||
char *new;
|
||||
@ -570,8 +561,7 @@ relname(const char *name, const char *zone)
|
||||
}
|
||||
|
||||
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;
|
||||
mysql_transaction_t *txp;
|
||||
|
||||
@ -592,8 +582,7 @@ validate_txn(mysql_data_t *state, mysql_transaction_t *txn)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* 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 *
|
||||
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;
|
||||
bool localdbi = false;
|
||||
MYSQL_RES *res = NULL;
|
||||
@ -684,8 +672,7 @@ fail:
|
||||
* values to the 'on the wire' packet values.
|
||||
*/
|
||||
static unsigned char *
|
||||
make_notify(const char *zone, int *packetlen)
|
||||
{
|
||||
make_notify(const char *zone, int *packetlen) {
|
||||
int i, j;
|
||||
unsigned char *packet = (unsigned char *)malloc(strlen(zone) + 18);
|
||||
|
||||
@ -739,8 +726,7 @@ make_notify(const char *zone, int *packetlen)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
*/
|
||||
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_ROW row;
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
char *real_name, *dclass, *type, *data, *ttlstr, *buf;
|
||||
dns_ttl_t ttlvalue;
|
||||
@ -929,8 +913,7 @@ error:
|
||||
* Remember a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
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
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
UNUSED(flags);
|
||||
*flags |= DNS_SDLZFLAG_THREADSAFE;
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
@ -965,8 +947,7 @@ dlz_version(unsigned int *flags)
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
mysql_data_t *state;
|
||||
const char *helper_name;
|
||||
va_list ap;
|
||||
@ -1067,8 +1048,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
* Shut down the backend
|
||||
*/
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
int i;
|
||||
|
||||
@ -1095,8 +1075,7 @@ dlz_destroy(void *dbdata)
|
||||
*/
|
||||
isc_result_t
|
||||
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;
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
MYSQL_RES *res;
|
||||
@ -1128,8 +1107,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
isc_result_t
|
||||
dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
bool found = false;
|
||||
@ -1266,8 +1244,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
* See if a zone transfer is allowed
|
||||
*/
|
||||
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;
|
||||
|
||||
if (state->debug && state->log != NULL) {
|
||||
@ -1283,8 +1260,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
|
||||
* Perform a zone transfer
|
||||
*/
|
||||
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;
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
MYSQL_RES *res;
|
||||
@ -1336,8 +1312,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes)
|
||||
* Start a transaction
|
||||
*/
|
||||
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;
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
MYSQL_RES *res;
|
||||
@ -1451,8 +1426,7 @@ cleanup:
|
||||
* End a transaction
|
||||
*/
|
||||
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;
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
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
|
||||
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
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;
|
||||
|
||||
UNUSED(tcpaddr);
|
||||
@ -1673,8 +1646,7 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
|
||||
isc_result_t
|
||||
dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
void *version)
|
||||
{
|
||||
void *version) {
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
mysql_transaction_t *txn = (mysql_transaction_t *)version;
|
||||
char *new_name, *query;
|
||||
@ -1737,8 +1709,7 @@ cleanup:
|
||||
|
||||
isc_result_t
|
||||
dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
|
||||
void *version)
|
||||
{
|
||||
void *version) {
|
||||
mysql_data_t *state = (mysql_data_t *)dbdata;
|
||||
mysql_transaction_t *txn = (mysql_transaction_t *)version;
|
||||
char *new_name, *query;
|
||||
@ -1788,8 +1759,8 @@ cleanup:
|
||||
}
|
||||
|
||||
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_transaction_t *txn = (mysql_transaction_t *)version;
|
||||
char *new_name, *query;
|
||||
|
@ -101,11 +101,14 @@ typedef struct config_data {
|
||||
* the warnings.
|
||||
*/
|
||||
EXTERN_C void xs_init(pTHX);
|
||||
EXTERN_C void boot_DynaLoader(pTHX_ CV *cv);
|
||||
EXTERN_C void boot_DLZ_Perl__clientinfo(pTHX_ CV *cv);
|
||||
EXTERN_C void boot_DLZ_Perl(pTHX_ CV *cv);
|
||||
EXTERN_C void xs_init(pTHX)
|
||||
{
|
||||
EXTERN_C void
|
||||
boot_DynaLoader(pTHX_ CV *cv);
|
||||
EXTERN_C void
|
||||
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__;
|
||||
dXSUB_SYS;
|
||||
|
||||
@ -124,8 +127,7 @@ EXTERN_C void xs_init(pTHX)
|
||||
* remember a helper function, from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
state->log = ptr;
|
||||
}
|
||||
@ -141,14 +143,12 @@ b9_add_helper(config_data_t *state, const char *helper_name, void *ptr)
|
||||
}
|
||||
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
}
|
||||
|
||||
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;
|
||||
isc_result_t retval;
|
||||
int rrcount, r;
|
||||
@ -250,8 +250,7 @@ CLEAN_UP_AND_RETURN:
|
||||
}
|
||||
|
||||
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;
|
||||
int r;
|
||||
isc_result_t retval;
|
||||
@ -528,8 +527,7 @@ missing_perl_method(const char *perl_class_name)
|
||||
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
config_data_t *cd;
|
||||
char *init_args[] = { NULL, NULL };
|
||||
char *perlrun[] = { "", NULL, "dlz perl", NULL };
|
||||
@ -716,8 +714,7 @@ CLEAN_UP_PERL_AND_FAIL:
|
||||
}
|
||||
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
config_data_t *cd = (config_data_t *)dbdata;
|
||||
#ifdef MULTIPLICITY
|
||||
PerlInterpreter *my_perl = cd->perl;
|
||||
|
@ -20,5 +20,5 @@
|
||||
/* This is the only part that differs from dlz_minimal.h. */
|
||||
typedef struct dlz_perl_clientinfo_opaque {
|
||||
dns_clientinfomethods_t *methods;
|
||||
dns_clientinfo_t * clientinfo;
|
||||
dns_clientinfo_t *clientinfo;
|
||||
} dlz_perl_clientinfo_opaque;
|
||||
|
@ -102,22 +102,22 @@ typedef struct {
|
||||
} sqlite3_res_t;
|
||||
|
||||
/* forward references */
|
||||
isc_result_t dlz_findzonedb(void *dbdata, const char *name,
|
||||
dns_clientinfomethods_t *methods,
|
||||
isc_result_t
|
||||
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
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,
|
||||
void *ptr);
|
||||
static void
|
||||
b9_add_helper(sqlite3_instance_t *db, const char *helper_name, void *ptr);
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
void
|
||||
sqlite3_destroy(dbinstance_t *db)
|
||||
{
|
||||
sqlite3_destroy(dbinstance_t *db) {
|
||||
/* release DB connection */
|
||||
if (db->dbconn != NULL) {
|
||||
sqlite3_close((sqlite3 *)db->dbconn);
|
||||
@ -135,8 +135,7 @@ sqlite3_destroy(dbinstance_t *db)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static void
|
||||
sqlite3_destroy_dblist(db_list_t *dblist)
|
||||
{
|
||||
sqlite3_destroy_dblist(db_list_t *dblist) {
|
||||
dbinstance_t *ndbi = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
|
||||
@ -163,8 +162,7 @@ sqlite3_destroy_dblist(db_list_t *dblist)
|
||||
* multithreaded operation.
|
||||
*/
|
||||
static dbinstance_t *
|
||||
sqlite3_find_avail(sqlite3_instance_t *sqlite3)
|
||||
{
|
||||
sqlite3_find_avail(sqlite3_instance_t *sqlite3) {
|
||||
dbinstance_t *dbi = NULL, *head;
|
||||
int count = 0;
|
||||
|
||||
@ -203,8 +201,7 @@ sqlite3_find_avail(sqlite3_instance_t *sqlite3)
|
||||
* want special characters in the string causing problems.
|
||||
*/
|
||||
static char *
|
||||
escape_string(const char *instr)
|
||||
{
|
||||
escape_string(const char *instr) {
|
||||
char *outstr;
|
||||
char *ptr;
|
||||
unsigned int len;
|
||||
@ -252,8 +249,7 @@ escape_string(const char *instr)
|
||||
*/
|
||||
static isc_result_t
|
||||
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;
|
||||
dbinstance_t *dbi = NULL;
|
||||
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
|
||||
@ -476,8 +472,7 @@ cleanup:
|
||||
*/
|
||||
|
||||
char **
|
||||
sqlite3_fetch_row(sqlite3_res_t *rs)
|
||||
{
|
||||
sqlite3_fetch_row(sqlite3_res_t *rs) {
|
||||
char **retval = NULL;
|
||||
if (rs != NULL) {
|
||||
if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
|
||||
@ -490,8 +485,7 @@ sqlite3_fetch_row(sqlite3_res_t *rs)
|
||||
}
|
||||
|
||||
unsigned int
|
||||
sqlite3_num_fields(sqlite3_res_t *rs)
|
||||
{
|
||||
sqlite3_num_fields(sqlite3_res_t *rs) {
|
||||
unsigned int retval = 0;
|
||||
if (rs != NULL) {
|
||||
retval = rs->pnColumn;
|
||||
@ -500,8 +494,7 @@ sqlite3_num_fields(sqlite3_res_t *rs)
|
||||
}
|
||||
|
||||
unsigned int
|
||||
sqlite3_num_rows(sqlite3_res_t *rs)
|
||||
{
|
||||
sqlite3_num_rows(sqlite3_res_t *rs) {
|
||||
unsigned int retval = 0;
|
||||
if (rs != NULL) {
|
||||
retval = rs->pnRow;
|
||||
@ -510,8 +503,7 @@ sqlite3_num_rows(sqlite3_res_t *rs)
|
||||
}
|
||||
|
||||
void
|
||||
sqlite3_free_result(sqlite3_res_t *rs)
|
||||
{
|
||||
sqlite3_free_result(sqlite3_res_t *rs) {
|
||||
if (rs != NULL) {
|
||||
sqlite3_free_table(rs->pazResult);
|
||||
free(rs);
|
||||
@ -520,8 +512,7 @@ sqlite3_free_result(sqlite3_res_t *rs)
|
||||
|
||||
static isc_result_t
|
||||
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;
|
||||
char **row;
|
||||
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 */
|
||||
isc_result_t
|
||||
dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
sqlite3_res_t *rs = NULL;
|
||||
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 */
|
||||
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;
|
||||
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
|
||||
sqlite3_res_t *rs = NULL;
|
||||
@ -724,8 +713,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client)
|
||||
* query.
|
||||
*/
|
||||
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;
|
||||
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
|
||||
sqlite3_res_t *rs = NULL;
|
||||
@ -828,8 +816,7 @@ cleanup:
|
||||
* use this function to get that information for named.
|
||||
*/
|
||||
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;
|
||||
sqlite3_res_t *rs = NULL;
|
||||
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
|
||||
dlz_lookup(const char *zone, const char *name, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
|
||||
dns_clientinfo_t *clientinfo)
|
||||
{
|
||||
dns_clientinfo_t *clientinfo) {
|
||||
isc_result_t result;
|
||||
sqlite3_res_t *rs = NULL;
|
||||
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
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
sqlite3_instance_t *s3 = NULL;
|
||||
dbinstance_t *dbi = NULL;
|
||||
@ -1080,8 +1065,7 @@ cleanup:
|
||||
* Destroy the module.
|
||||
*/
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
sqlite3_instance_t *db = (sqlite3_instance_t *)dbdata;
|
||||
#if PTHREADS
|
||||
/* cleanup the list of DBI's */
|
||||
@ -1101,8 +1085,7 @@ dlz_destroy(void *dbdata)
|
||||
* Return the version of the API
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
*flags |= (DNS_SDLZFLAG_RELATIVEOWNER | DNS_SDLZFLAG_RELATIVERDATA |
|
||||
DNS_SDLZFLAG_THREADSAFE);
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
@ -1112,8 +1095,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
db->log = (log_t *)ptr;
|
||||
}
|
||||
|
@ -114,18 +114,20 @@ struct named_rr {
|
||||
/*
|
||||
* 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,
|
||||
void *ptr);
|
||||
static void
|
||||
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
|
||||
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;
|
||||
isc_result_t result;
|
||||
char *querystring = NULL;
|
||||
@ -176,8 +178,7 @@ done:
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
UNUSED(name);
|
||||
@ -318,8 +319,7 @@ done:
|
||||
}
|
||||
|
||||
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;
|
||||
config_data_t *cd = (config_data_t *)dbdata;
|
||||
char *querystring = NULL;
|
||||
@ -376,8 +376,7 @@ done:
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_rrlist(config_data_t *cd)
|
||||
{
|
||||
destroy_rrlist(config_data_t *cd) {
|
||||
nrr_t *trec, *nrec;
|
||||
|
||||
nrec = DLZ_LIST_HEAD(cd->rrs_list);
|
||||
@ -404,8 +403,7 @@ destroy_rrlist(config_data_t *cd)
|
||||
|
||||
isc_result_t
|
||||
dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
...)
|
||||
{
|
||||
...) {
|
||||
config_data_t *cd;
|
||||
char *endp;
|
||||
int i, def_ttl;
|
||||
@ -516,8 +514,7 @@ cleanup:
|
||||
}
|
||||
|
||||
void
|
||||
dlz_destroy(void *dbdata)
|
||||
{
|
||||
dlz_destroy(void *dbdata) {
|
||||
config_data_t *cd = (config_data_t *)dbdata;
|
||||
|
||||
/*
|
||||
@ -536,8 +533,7 @@ dlz_destroy(void *dbdata)
|
||||
* Return the version of the API
|
||||
*/
|
||||
int
|
||||
dlz_version(unsigned int *flags)
|
||||
{
|
||||
dlz_version(unsigned int *flags) {
|
||||
UNUSED(flags);
|
||||
/* XXX: ok to set DNS_SDLZFLAG_THREADSAFE here? */
|
||||
return (DLZ_DLOPEN_VERSION);
|
||||
@ -547,8 +543,7 @@ dlz_version(unsigned int *flags)
|
||||
* Register a helper function from the bind9 dlz_dlopen driver
|
||||
*/
|
||||
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) {
|
||||
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 *
|
||||
shortest_match(const char *pattern, const char *string)
|
||||
{
|
||||
shortest_match(const char *pattern, const char *string) {
|
||||
const char *p = string;
|
||||
if (pattern == NULL || p == NULL || *p == '\0') {
|
||||
return (NULL);
|
||||
@ -601,8 +595,7 @@ shortest_match(const char *pattern, const char *string)
|
||||
#define RANGE_ERROR (-1)
|
||||
|
||||
static int
|
||||
fnmatch(const char *pattern, const char *string, int flags)
|
||||
{
|
||||
fnmatch(const char *pattern, const char *string, int flags) {
|
||||
const char *stringstart;
|
||||
char *newp;
|
||||
char c, test;
|
||||
@ -724,8 +717,7 @@ fnmatch(const char *pattern, const char *string, int flags)
|
||||
}
|
||||
|
||||
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;
|
||||
char c, c2;
|
||||
|
||||
|
@ -22,12 +22,11 @@ int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
isc_buffer_t buf;
|
||||
isc_result_t result;
|
||||
dns_fixedname_t origin;
|
||||
char * de_const;
|
||||
char *de_const;
|
||||
|
||||
if (size < 5) {
|
||||
return (0);
|
||||
|
@ -42,15 +42,13 @@ int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
static void
|
||||
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...)
|
||||
{
|
||||
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) {
|
||||
UNUSED(cb);
|
||||
UNUSED(fmt);
|
||||
}
|
||||
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
char totext[1024];
|
||||
dns_compress_t cctx;
|
||||
dns_decompress_t dctx;
|
||||
@ -64,9 +62,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
rdata3 = DNS_RDATA_INIT;
|
||||
dns_rdatacallbacks_t callbacks;
|
||||
isc_buffer_t source, target;
|
||||
isc_lex_t * lex = NULL;
|
||||
isc_lex_t *lex = NULL;
|
||||
isc_lexspecials_t specials;
|
||||
isc_mem_t * mctx = NULL;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result;
|
||||
unsigned char fromtext[1024];
|
||||
unsigned char fromwire[1024];
|
||||
|
@ -28,14 +28,12 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
static void __attribute__((constructor)) init(void)
|
||||
{
|
||||
static void __attribute__((constructor)) init(void) {
|
||||
isc_mem_create(&mctx);
|
||||
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();
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
13
fuzz/main.c
13
fuzz/main.c
@ -26,9 +26,8 @@
|
||||
#include <dirent.h>
|
||||
|
||||
static void
|
||||
test_all_from(const char *dirname)
|
||||
{
|
||||
DIR * dirp;
|
||||
test_all_from(const char *dirname) {
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
|
||||
dirp = opendir(dirname);
|
||||
@ -40,7 +39,7 @@ test_all_from(const char *dirname)
|
||||
char filename[strlen(dirname) + strlen(dp->d_name) + 2];
|
||||
int fd;
|
||||
struct stat st;
|
||||
char * data;
|
||||
char *data;
|
||||
ssize_t n;
|
||||
|
||||
if (dp->d_name[0] == '.') {
|
||||
@ -91,8 +90,7 @@ test_all_from(const char *dirname)
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
main(int argc, char **argv) {
|
||||
char corpusdir[PATH_MAX];
|
||||
const char *target = strrchr(argv[0], '/');
|
||||
|
||||
@ -114,8 +112,7 @@ main(int argc, char **argv)
|
||||
#elif __AFL_COMPILER
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
main(int argc, char **argv) {
|
||||
int ret;
|
||||
unsigned char buf[64 * 1024];
|
||||
|
||||
|
@ -60,8 +60,9 @@
|
||||
#include <dst/result.h>
|
||||
#include <pk11/site.h>
|
||||
|
||||
static isc_result_t fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab,
|
||||
bool writeable, isc_log_t *logctxlogc);
|
||||
static isc_result_t
|
||||
fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, bool writeable,
|
||||
isc_log_t *logctxlogc);
|
||||
|
||||
static void
|
||||
freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) {
|
||||
|
1
lib/bind9/include/.clang-format
Symbolic link
1
lib/bind9/include/.clang-format
Symbolic link
@ -0,0 +1 @@
|
||||
../../../.clang-format.headers
|
151
lib/dns/adb.c
151
lib/dns/adb.c
@ -284,65 +284,105 @@ struct dns_adbentry {
|
||||
/*
|
||||
* Internal functions (and prototypes).
|
||||
*/
|
||||
static inline dns_adbname_t *new_adbname(dns_adb_t *, const dns_name_t *);
|
||||
static inline void 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_adbname_t *
|
||||
new_adbname(dns_adb_t *, const dns_name_t *);
|
||||
static inline void
|
||||
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 *
|
||||
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 dns_adbentry_t *new_adbentry(dns_adb_t *);
|
||||
static inline void free_adbentry(dns_adb_t *, dns_adbentry_t **);
|
||||
static inline dns_adbfind_t *new_adbfind(dns_adb_t *);
|
||||
static inline bool free_adbfind(dns_adb_t *, dns_adbfind_t **);
|
||||
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 void
|
||||
free_adblameinfo(dns_adb_t *, dns_adblameinfo_t **);
|
||||
static inline dns_adbentry_t *
|
||||
new_adbentry(dns_adb_t *);
|
||||
static inline void
|
||||
free_adbentry(dns_adb_t *, dns_adbentry_t **);
|
||||
static inline dns_adbfind_t *
|
||||
new_adbfind(dns_adb_t *);
|
||||
static inline bool
|
||||
free_adbfind(dns_adb_t *, dns_adbfind_t **);
|
||||
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 *
|
||||
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 print_dns_name(FILE *, const dns_name_t *);
|
||||
static void print_namehook_list(FILE *, const char *legend, dns_adb_t *adb,
|
||||
dns_adbnamehooklist_t *list, bool debug,
|
||||
isc_stdtime_t now);
|
||||
static void print_find_list(FILE *, dns_adbname_t *);
|
||||
static void print_fetch_list(FILE *, dns_adbname_t *);
|
||||
static inline bool dec_adb_irefcnt(dns_adb_t *);
|
||||
static inline void inc_adb_irefcnt(dns_adb_t *);
|
||||
static inline void inc_adb_erefcnt(dns_adb_t *);
|
||||
static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, bool);
|
||||
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,
|
||||
static void
|
||||
dump_adb(dns_adb_t *, FILE *, bool debug, isc_stdtime_t);
|
||||
static void
|
||||
print_dns_name(FILE *, const dns_name_t *);
|
||||
static void
|
||||
print_namehook_list(FILE *, const char *legend, dns_adb_t *adb,
|
||||
dns_adbnamehooklist_t *list, bool debug, isc_stdtime_t now);
|
||||
static void
|
||||
print_find_list(FILE *, dns_adbname_t *);
|
||||
static void
|
||||
print_fetch_list(FILE *, dns_adbname_t *);
|
||||
static inline bool
|
||||
dec_adb_irefcnt(dns_adb_t *);
|
||||
static inline void
|
||||
inc_adb_irefcnt(dns_adb_t *);
|
||||
static inline void
|
||||
inc_adb_erefcnt(dns_adb_t *);
|
||||
static inline void
|
||||
inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, bool);
|
||||
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);
|
||||
static isc_result_t fetch_name(dns_adbname_t *, bool, unsigned int,
|
||||
isc_counter_t *qc, dns_rdatatype_t);
|
||||
static inline void check_exit(dns_adb_t *);
|
||||
static void destroy(dns_adb_t *);
|
||||
static bool shutdown_names(dns_adb_t *);
|
||||
static bool shutdown_entries(dns_adb_t *);
|
||||
static inline void link_name(dns_adb_t *, int, dns_adbname_t *);
|
||||
static inline bool unlink_name(dns_adb_t *, dns_adbname_t *);
|
||||
static inline void link_entry(dns_adb_t *, int, dns_adbentry_t *);
|
||||
static inline bool unlink_entry(dns_adb_t *, dns_adbentry_t *);
|
||||
static bool kill_name(dns_adbname_t **, isc_eventtype_t);
|
||||
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);
|
||||
static inline void
|
||||
check_exit(dns_adb_t *);
|
||||
static void
|
||||
destroy(dns_adb_t *);
|
||||
static bool
|
||||
shutdown_names(dns_adb_t *);
|
||||
static bool
|
||||
shutdown_entries(dns_adb_t *);
|
||||
static inline void
|
||||
link_name(dns_adb_t *, int, dns_adbname_t *);
|
||||
static inline bool
|
||||
unlink_name(dns_adb_t *, dns_adbname_t *);
|
||||
static inline void
|
||||
link_entry(dns_adb_t *, int, dns_adbentry_t *);
|
||||
static inline bool
|
||||
unlink_entry(dns_adb_t *, dns_adbentry_t *);
|
||||
static bool
|
||||
kill_name(dns_adbname_t **, isc_eventtype_t);
|
||||
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!
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
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
|
||||
DP(int level, const char *format, ...) {
|
||||
|
@ -56,8 +56,8 @@ struct dns_bcentry {
|
||||
dns_name_t name;
|
||||
};
|
||||
|
||||
static isc_result_t badcache_resize(dns_badcache_t *bc, isc_time_t *now,
|
||||
bool grow);
|
||||
static isc_result_t
|
||||
badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow);
|
||||
|
||||
isc_result_t
|
||||
dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
|
||||
|
@ -153,16 +153,18 @@ struct dns_cache {
|
||||
*** Functions
|
||||
***/
|
||||
|
||||
static isc_result_t cache_cleaner_init(dns_cache_t *cache,
|
||||
isc_taskmgr_t *taskmgr,
|
||||
isc_timermgr_t *timermgr,
|
||||
cache_cleaner_t *cleaner);
|
||||
static isc_result_t
|
||||
cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
|
||||
isc_timermgr_t *timermgr, 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
|
||||
cache_create_db(dns_cache_t *cache, dns_db_t **db) {
|
||||
|
@ -17,14 +17,17 @@
|
||||
#include <dns/callbacks.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);
|
||||
|
||||
static void isclog_error_callback(dns_rdatacallbacks_t *callbacks,
|
||||
const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
|
||||
static void
|
||||
isclog_error_callback(dns_rdatacallbacks_t *callbacks, const char *fmt, ...)
|
||||
ISC_FORMAT_PRINTF(2, 3);
|
||||
|
||||
static void isclog_warn_callback(dns_rdatacallbacks_t *callbacks,
|
||||
const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
|
||||
static void
|
||||
isclog_warn_callback(dns_rdatacallbacks_t *callbacks, const char *fmt, ...)
|
||||
ISC_FORMAT_PRINTF(2, 3);
|
||||
|
||||
/*
|
||||
* Private
|
||||
|
@ -80,13 +80,12 @@ struct dns_catz_zone {
|
||||
isc_refcount_t refs;
|
||||
};
|
||||
|
||||
static isc_result_t catz_process_zones_entry(dns_catz_zone_t *zone,
|
||||
dns_rdataset_t *value,
|
||||
static isc_result_t
|
||||
catz_process_zones_entry(dns_catz_zone_t *zone, dns_rdataset_t *value,
|
||||
dns_label_t *mhash);
|
||||
static isc_result_t catz_process_zones_suboption(dns_catz_zone_t *zone,
|
||||
dns_rdataset_t *value,
|
||||
dns_label_t *mhash,
|
||||
dns_name_t *name);
|
||||
static isc_result_t
|
||||
catz_process_zones_suboption(dns_catz_zone_t *zone, dns_rdataset_t *value,
|
||||
dns_label_t *mhash, dns_name_t *name);
|
||||
|
||||
/*%
|
||||
* Collection of catalog zones for a view
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user