summaryrefslogtreecommitdiff
path: root/source4/dns_server
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-03-08 18:34:04 +1100
committerAmitay Isaacs <amitay@gmail.com>2012-04-16 11:16:34 +1000
commit07677b2e433e4dc1aa956b2fda0e477a9c7b88b5 (patch)
tree056509ae3f051ef7454f0e3fd46b342946b1ae9a /source4/dns_server
parent89e998412fe07a01f9c79330973f62d909dc2da2 (diff)
downloadsamba-07677b2e433e4dc1aa956b2fda0e477a9c7b88b5.tar.gz
samba-07677b2e433e4dc1aa956b2fda0e477a9c7b88b5.tar.bz2
samba-07677b2e433e4dc1aa956b2fda0e477a9c7b88b5.zip
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
Diffstat (limited to 'source4/dns_server')
-rw-r--r--source4/dns_server/dlz_bind9.c38
-rw-r--r--source4/dns_server/dlz_minimal.h37
2 files changed, 53 insertions, 22 deletions
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 6aa0aad8de..153574b1aa 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;
};
@@ -849,7 +847,9 @@ static isc_result_t dlz_lookup_types(struct dlz_bind9_data *state,
lookup one record
*/
_PUBLIC_ isc_result_t dlz_lookup(const char *zone, const char *name,
- void *dbdata, dns_sdlzlookup_t *lookup)
+ void *dbdata, dns_sdlzlookup_t *lookup,
+ dns_clientinfomethods_t *methods,
+ dns_clientinfo_t *clientinfo)
{
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 +1184,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 +1192,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 +1206,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 +1216,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 +1225,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 +1247,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 +1262,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 +1274,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 +1282,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 +1290,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 9aae7766bf..3f408ab117 100644
--- a/source4/dns_server/dlz_minimal.h
+++ b/source4/dns_server/dlz_minimal.h
@@ -23,10 +23,10 @@
tree.
*/
typedef unsigned int isc_result_t;
-typedef bool isc_boolean_t;
+typedef int isc_boolean_t;
typedef uint32_t dns_ttl_t;
-#define DLZ_DLOPEN_VERSION 1
+#define DLZ_DLOPEN_VERSION 2
/* return this in flags to dlz_version() if thread safe */
#define DNS_SDLZFLAG_THREADSAFE 0x00000001U
@@ -34,8 +34,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 +54,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
@@ -80,7 +109,9 @@ isc_result_t dlz_findzonedb(void *dbdata, const char *name);
dlz_lookup is required for all DLZ external drivers
*/
isc_result_t dlz_lookup(const char *zone, const char *name,
- void *dbdata, dns_sdlzlookup_t *lookup);
+ void *dbdata, dns_sdlzlookup_t *lookup,
+ dns_clientinfomethods_t *methods,
+ dns_clientinfo_t *clientinfo);
/*
dlz_allowzonexfr() is optional, and should be supplied if you want