diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-12-06 16:57:12 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-12-06 17:24:52 +1100 |
commit | 49e0aef3cb74b96ee710d5c705aa48512d81cddc (patch) | |
tree | c3ee05c2ebe39dd981c95ab1dc80efd1ae62a52b | |
parent | c60ce7503cd3ce445612c8f8b5387b2d8cc98ba8 (diff) | |
download | samba-49e0aef3cb74b96ee710d5c705aa48512d81cddc.tar.gz samba-49e0aef3cb74b96ee710d5c705aa48512d81cddc.tar.bz2 samba-49e0aef3cb74b96ee710d5c705aa48512d81cddc.zip |
s4-dns: support Samba command line options to the dlz_bind.so module
this allows setting of Samba command line options in named.conf
-rw-r--r-- | source4/dns_server/dlz_bind9.c | 35 | ||||
-rw-r--r-- | source4/dns_server/wscript_build | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c index 0eb90b78c5..5249ca3d7c 100644 --- a/source4/dns_server/dlz_bind9.c +++ b/source4/dns_server/dlz_bind9.c @@ -26,6 +26,7 @@ #include "dsdb/common/util.h" #include "auth/session.h" #include "gen_ndr/ndr_dnsp.h" +#include "lib/cmdline/popt_common.h" #include "dlz_bind9.h" struct dlz_bind9_data { @@ -222,6 +223,35 @@ static isc_result_t b9_putnamedrr(struct dlz_bind9_data *state, /* + parse options + */ +static isc_result_t parse_options(struct dlz_bind9_data *state, + unsigned int argc, char *argv[]) +{ + int opt; + poptContext pc; + struct poptOption long_options[] = { + POPT_COMMON_SAMBA + { NULL } + }; + + pc = poptGetContext("dlz_bind9", argc, (const char **)argv, long_options, + POPT_CONTEXT_KEEP_FIRST); + + while ((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + default: + state->log(ISC_LOG_ERROR, "Invalid option %s: %s", + poptBadOption(pc, 0), poptStrerror(opt)); + return ISC_R_FAILURE; + } + } + + return ISC_R_SUCCESS; +} + + +/* called to initialise the driver */ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, @@ -251,6 +281,11 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, } va_end(ap); + result = parse_options(state, argc, argv); + if (result != ISC_R_SUCCESS) { + goto failed; + } + state->lp = loadparm_init_global(true); if (state->lp == NULL) { result = ISC_R_NOMEMORY; diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build index a543b12a06..884d0c1f12 100644 --- a/source4/dns_server/wscript_build +++ b/source4/dns_server/wscript_build @@ -14,4 +14,4 @@ bld.SAMBA_LIBRARY('dlz_bind9', source='dlz_bind9.c', private_library=True, link_name='modules/bind9/dlz_bind9.so', - deps='samba-hostconfig ldbsamba samba-util') + deps='samba-hostconfig ldbsamba samba-util popt POPT_SAMBA') |