[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Sun Apr 15 19:53:02 MDT 2012
The branch, master has been updated
via 06a0101 s4-provision: Update configuration lines for dlz_bind9
via bbc98df dlz_bind9: Build shared libraries for both BIND versions 9.8 and 9.9
via 07677b2 dlz_bind9: changes to make dlz_bind9 work with BIND 9.9.0
from 89e9984 waf: samba-specific methods should have capitalized names, change process_separate_rule to follow
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 06a010108251ac58010e65ffea97b307551d6122
Author: Amitay Isaacs <amitay at gmail.com>
Date: Thu Apr 5 16:51:24 2012 +1000
s4-provision: Update configuration lines for dlz_bind9
This adds configuration lines for BIND versions 9.8.x and 9.9.x.
Autobuild-User: Amitay Isaacs <amitay at samba.org>
Autobuild-Date: Mon Apr 16 03:52:14 CEST 2012 on sn-devel-104
commit bbc98df743fb81b560bbb0d1e2a3db6425720fac
Author: Amitay Isaacs <amitay at gmail.com>
Date: Thu Apr 5 16:45:01 2012 +1000
dlz_bind9: Build shared libraries for both BIND versions 9.8 and 9.9
This adds #define BIND_VERSION_9_8 and keeps the current version as 9.9, so
shared libraries can be built for both BIND versions.
commit 07677b2e433e4dc1aa956b2fda0e477a9c7b88b5
Author: Amitay Isaacs <amitay at gmail.com>
Date: Thu Mar 8 18:34:04 2012 +1100
dlz_bind9: changes to make dlz_bind9 work with BIND 9.9.0
The main changes are:
DLZ_DLOPEN_VERSION changed from 1 to 2
isc_boolean_t changed from bool to int
dlz_lookup() now takes 2 additional arguments
-----------------------------------------------------------------------
Summary of changes:
source4/dns_server/dlz_bind9.c | 41 ++++++++++--------
source4/dns_server/dlz_minimal.h | 44 ++++++++++++++++++++
source4/dns_server/wscript_build | 10 ++++
.../scripting/python/samba/provision/sambadns.py | 4 +-
source4/setup/named.conf.dlz | 7 +++-
5 files changed, 84 insertions(+), 22 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 6aa0aad..224f242 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -59,12 +59,10 @@ struct dlz_bind9_data {
char *update_name;
/* helper functions from the dlz_dlopen driver */
- void (*log)(int level, const char *fmt, ...);
- isc_result_t (*putrr)(dns_sdlzlookup_t *handle, const char *type,
- dns_ttl_t ttl, const char *data);
- isc_result_t (*putnamedrr)(dns_sdlzlookup_t *handle, const char *name,
- const char *type, dns_ttl_t ttl, const char *data);
- isc_result_t (*writeable_zone)(dns_view_t *view, const char *zone_name);
+ log_t *log;
+ dns_sdlz_putrr_t *putrr;
+ dns_sdlz_putnamedrr_t *putnamedrr;
+ dns_dlz_writeablezone_t *writeable_zone;
};
@@ -848,8 +846,15 @@ static isc_result_t dlz_lookup_types(struct dlz_bind9_data *state,
/*
lookup one record
*/
+#ifdef BIND_VERSION_9_8
_PUBLIC_ isc_result_t dlz_lookup(const char *zone, const char *name,
void *dbdata, dns_sdlzlookup_t *lookup)
+#else
+_PUBLIC_ 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)
+#endif
{
struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
return dlz_lookup_types(state, zone, name, lookup, NULL);
@@ -1184,7 +1189,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
state->log(ISC_LOG_ERROR, "samba_dlz: no memory");
- return false;
+ return ISC_FALSE;
}
ap_req = data_blob_const(keydata, keydatalen);
@@ -1192,7 +1197,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
if (!server_credentials) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to init server credentials");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
cli_credentials_set_krb5_context(server_credentials, state->smb_krb5_ctx);
@@ -1206,7 +1211,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
state->log(ISC_LOG_ERROR, "samba_dlz: failed to obtain server credentials from %s",
keytab_name);
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
talloc_free(keytab_name);
@@ -1216,7 +1221,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
if (!NT_STATUS_IS_OK(nt_status)) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to start gensec server");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
gensec_set_credentials(gensec_ctx, server_credentials);
@@ -1225,21 +1230,21 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
if (!NT_STATUS_IS_OK(nt_status)) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to start spnego");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
nt_status = gensec_update(gensec_ctx, tmp_ctx, state->ev_ctx, ap_req, &ap_req);
if (!NT_STATUS_IS_OK(nt_status)) {
state->log(ISC_LOG_ERROR, "samba_dlz: spnego update failed");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
nt_status = gensec_session_info(gensec_ctx, tmp_ctx, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to create session info");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
/* Get the DN from name */
@@ -1247,7 +1252,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
if (result != ISC_R_SUCCESS) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to find name %s", name);
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
/* make sure the dn exists, or find parent dn in case new object is being added */
@@ -1262,7 +1267,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
talloc_free(res);
} else {
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
/* Do ACL check */
@@ -1274,7 +1279,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
"samba_dlz: disallowing update of signer=%s name=%s type=%s error=%s",
signer, name, type, ldb_strerror(ldb_ret));
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
/* Cache session_info, so it can be used in the actual add/delete operation */
@@ -1282,7 +1287,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
if (state->update_name == NULL) {
state->log(ISC_LOG_ERROR, "samba_dlz: memory allocation error");
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
state->session_info = talloc_steal(state, session_info);
@@ -1290,7 +1295,7 @@ _PUBLIC_ isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const
signer, name, tcpaddr, type, key);
talloc_free(tmp_ctx);
- return true;
+ return ISC_TRUE;
}
diff --git a/source4/dns_server/dlz_minimal.h b/source4/dns_server/dlz_minimal.h
index 9aae776..5262cbd 100644
--- a/source4/dns_server/dlz_minimal.h
+++ b/source4/dns_server/dlz_minimal.h
@@ -23,10 +23,18 @@
tree.
*/
typedef unsigned int isc_result_t;
+#ifdef BIND_VERSION_9_8
typedef bool isc_boolean_t;
+#else
+typedef int isc_boolean_t;
+#endif
typedef uint32_t dns_ttl_t;
+#ifdef BIND_VERSION_9_8
#define DLZ_DLOPEN_VERSION 1
+#else
+#define DLZ_DLOPEN_VERSION 2
+#endif
/* return this in flags to dlz_version() if thread safe */
#define DNS_SDLZFLAG_THREADSAFE 0x00000001U
@@ -34,8 +42,14 @@ typedef uint32_t dns_ttl_t;
/* result codes */
#define ISC_R_SUCCESS 0
#define ISC_R_NOMEMORY 1
+#define ISC_R_NOPERM 6
#define ISC_R_NOTFOUND 23
#define ISC_R_FAILURE 25
+#define ISC_R_NOMORE 29
+
+/* boolean values */
+#define ISC_TRUE 1
+#define ISC_FALSE 0
/* log levels */
#define ISC_LOG_INFO (-1)
@@ -48,6 +62,29 @@ typedef uint32_t dns_ttl_t;
typedef void *dns_sdlzlookup_t;
typedef void *dns_sdlzallnodes_t;
typedef void *dns_view_t;
+typedef void *dns_clientinfomethods_t;
+typedef void *dns_clientinfo_t;
+
+/*
+ * method definitions for callbacks provided by dlopen driver
+ */
+
+typedef void log_t(int level, const char *fmt, ...);
+
+typedef isc_result_t dns_sdlz_putrr_t(dns_sdlzlookup_t *lookup,
+ const char *type,
+ dns_ttl_t ttl,
+ const char *data);
+
+typedef isc_result_t dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t *allnodes,
+ const char *name,
+ const char *type,
+ dns_ttl_t ttl,
+ const char *data);
+
+typedef isc_result_t dns_dlz_writeablezone_t(dns_view_t *view,
+ const char *zone_name);
+
/*
* prototypes for the functions you can include in your driver
@@ -79,8 +116,15 @@ isc_result_t dlz_findzonedb(void *dbdata, const char *name);
/*
dlz_lookup is required for all DLZ external drivers
*/
+#ifdef BIND_VERSION_9_8
isc_result_t dlz_lookup(const char *zone, const char *name,
void *dbdata, dns_sdlzlookup_t *lookup);
+#else
+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);
+#endif
/*
dlz_allowzonexfr() is optional, and should be supplied if you want
diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build
index 29895b2..e508fcd 100644
--- a/source4/dns_server/wscript_build
+++ b/source4/dns_server/wscript_build
@@ -12,8 +12,18 @@ bld.SAMBA_MODULE('service_dns',
# a bind9 dlz module giving access to the Samba DNS SAM
bld.SAMBA_LIBRARY('dlz_bind9',
source='dlz_bind9.c',
+ cflags='-DBIND_VERSION_9_8',
private_library=True,
link_name='modules/bind9/dlz_bind9.so',
realname='dlz_bind9.so',
install_path='${MODULESDIR}/bind9',
deps='samba-hostconfig samdb gensec popt')
+
+bld.SAMBA_LIBRARY('dlz_bind9_9',
+ source='dlz_bind9.c',
+ cflags='-DBIND_VERSION_9_9',
+ private_library=True,
+ link_name='modules/bind9/dlz_bind9_9.so',
+ realname='dlz_bind9.so',
+ install_path='${MODULESDIR}/bind9',
+ deps='samba-hostconfig samdb gensec popt')
diff --git a/source4/scripting/python/samba/provision/sambadns.py b/source4/scripting/python/samba/provision/sambadns.py
index f24284a..5c3e6ba 100644
--- a/source4/scripting/python/samba/provision/sambadns.py
+++ b/source4/scripting/python/samba/provision/sambadns.py
@@ -814,11 +814,9 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend):
setup_file(setup_path("named.conf.update"), paths.namedconf_update)
elif dns_backend == "BIND9_DLZ":
- dlz_module_path = os.path.join(samba.param.modules_dir(),
- "bind9/dlz_bind9.so")
setup_file(setup_path("named.conf.dlz"), paths.namedconf, {
"NAMED_CONF": paths.namedconf,
- "BIND9_DLZ_MODULE": dlz_module_path,
+ "MODULESDIR" : samba.param.modules_dir(),
})
diff --git a/source4/setup/named.conf.dlz b/source4/setup/named.conf.dlz
index c90020f..be20a57 100644
--- a/source4/setup/named.conf.dlz
+++ b/source4/setup/named.conf.dlz
@@ -7,8 +7,13 @@
#
# This configures dynamically loadable zones (DLZ) from AD schema
+# Uncomment only single database line, depending on your BIND version
#
dlz "AD DNS Zone" {
- database "dlopen ${BIND9_DLZ_MODULE}";
+ # For BIND 9.8.0
+ database "dlopen ${MODULESDIR}/bind9/dlz_bind9.so";
+
+ # For BIND 9.9.0
+ # database "dlopen ${MODULESDIR}/bind9/dlz_bind9_9.so";
};
--
Samba Shared Repository
More information about the samba-cvs
mailing list