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;
};
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);
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);
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);
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);
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);
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 */
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 */
talloc_free(res);
} else {
talloc_free(tmp_ctx);
- return false;
+ return ISC_FALSE;
}
/* Do ACL check */
"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 */
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);
signer, name, tcpaddr, type, key);
talloc_free(tmp_ctx);
- return true;
+ return ISC_TRUE;
}
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
/* 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)
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
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