3066. [func] The DLZ "dlopen" driver is now built by default,
no longer requiring a configure option. To
disable it, use "configure --without-dlopen".
Driver also supported on win32. [RT #23467]
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: Makefile.in,v 1.5 2009/12/05 23:31:40 each Exp $
|
||||
# $Id: Makefile.in,v 1.6 2011/03/10 04:36:15 each Exp $
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
@@ -28,7 +28,7 @@ DLZINCLUDES = @DLZ_DRIVER_INCLUDES@
|
||||
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
|
||||
${ISC_INCLUDES} ${DLZINCLUDES}
|
||||
|
||||
CDEFINES = @USE_DLZ@
|
||||
CDEFINES = @CONTRIB_DLZ@
|
||||
CWARNINGS =
|
||||
|
||||
DLZLIBS = @DLZ_DRIVER_LIBS@
|
||||
|
||||
@@ -29,7 +29,7 @@ dlzdir='${DLZ_DRIVER_DIR}'
|
||||
# LIBS is any necessary library definitions
|
||||
#
|
||||
AC_DEFUN(DLZ_ADD_DRIVER, [
|
||||
USE_DLZ="$USE_DLZ -DDLZ_$1"
|
||||
CONTRIB_DLZ="$CONTRIB_DLZ -DDLZ_$1"
|
||||
for i in $2
|
||||
do
|
||||
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
|
||||
@@ -456,38 +456,16 @@ case "$use_dlz_stub" in
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Was --with-dlz-dlopen specified?
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING(for dlopen DLZ driver)
|
||||
AC_ARG_WITH(dlz_dlopen,
|
||||
[ --with-dlz-dlopen[=PATH] Build with dlopen DLZ driver [yes|no].
|
||||
(Required to use dlopen driver with DLZ)],
|
||||
use_dlz_dlopen="$withval", use_dlz_dlopen="no")
|
||||
|
||||
case "$use_dlz_dlopen" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(dl, dlclose)
|
||||
AC_CHECK_FUNCS(dlopen dlclose dlsym)
|
||||
DLZ_ADD_DRIVER(DLOPEN, dlz_dlopen_driver)
|
||||
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Add any additional DLZ drivers here.
|
||||
|
||||
#
|
||||
# Finally, some generic stuff that applies to all drivers, assuming
|
||||
# we're compiling DLZ at all.
|
||||
# we're compiling contrib DLZ drivers at all.
|
||||
#
|
||||
if test -n "$USE_DLZ"
|
||||
if test -n "$CONTRIB_DLZ"
|
||||
then
|
||||
CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
|
||||
|
||||
#
|
||||
# Where to find DLZ driver header files.
|
||||
#
|
||||
|
||||
@@ -1,624 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Andrew Tridgell
|
||||
*
|
||||
* based on dlz_stub_driver.c
|
||||
* which is:
|
||||
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
|
||||
* Copyright (C) 1999-2001 Internet Software Consortium.
|
||||
* see dlz_stub_driver.c for details
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
|
||||
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
* STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
|
||||
* conceived and contributed by Rob Butler.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
|
||||
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
* ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef DLZ_DLOPEN
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <dns/log.h>
|
||||
#include <dns/sdlz.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <named/globals.h>
|
||||
|
||||
#include <dlz/dlz_dlopen_driver.h>
|
||||
|
||||
static dns_sdlzimplementation_t *dlz_dlopen = NULL;
|
||||
|
||||
|
||||
typedef struct dlopen_data {
|
||||
isc_mem_t *mctx;
|
||||
char *dl_path;
|
||||
char *dlzname;
|
||||
void *dl_handle;
|
||||
void *dbdata;
|
||||
unsigned int flags;
|
||||
isc_mutex_t lock;
|
||||
int version;
|
||||
isc_boolean_t in_configure;
|
||||
|
||||
int (*dlz_version)(unsigned int *flags);
|
||||
isc_result_t (*dlz_create)(const char *dlzname,
|
||||
unsigned int argc, char *argv[],
|
||||
void **dbdata, ...);
|
||||
isc_result_t (*dlz_findzonedb)(void *dbdata, const char *name);
|
||||
isc_result_t (*dlz_lookup)(const char *zone, const char *name,
|
||||
void *dbdata, dns_sdlzlookup_t *lookup);
|
||||
isc_result_t (*dlz_authority)(const char *zone, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup);
|
||||
isc_result_t (*dlz_allnodes)(const char *zone, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes);
|
||||
isc_result_t (*dlz_allowzonexfr)(void *dbdata, const char *name,
|
||||
const char *client);
|
||||
isc_result_t (*dlz_newversion)(const char *zone, void *dbdata,
|
||||
void **versionp);
|
||||
void (*dlz_closeversion)(const char *zone, isc_boolean_t commit,
|
||||
void *dbdata, void **versionp);
|
||||
isc_result_t (*dlz_configure)(dns_view_t *view, void *dbdata);
|
||||
isc_boolean_t (*dlz_ssumatch)(const char *signer, const char *name,
|
||||
const char *tcpaddr, const char *type,
|
||||
const char *key, uint32_t keydatalen,
|
||||
uint8_t *keydata, void *dbdata);
|
||||
isc_result_t (*dlz_addrdataset)(const char *name, const char *rdatastr,
|
||||
void *dbdata, void *version);
|
||||
isc_result_t (*dlz_subrdataset)(const char *name, const char *rdatastr,
|
||||
void *dbdata, void *version);
|
||||
isc_result_t (*dlz_delrdataset)(const char *name, const char *type,
|
||||
void *dbdata, void *version);
|
||||
void (*dlz_destroy)(void *dbdata);
|
||||
} dlopen_data_t;
|
||||
|
||||
/* Modules can choose whether they are lock-safe or not. */
|
||||
#define MAYBE_LOCK(cd) \
|
||||
do { \
|
||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||
cd->in_configure == ISC_FALSE) \
|
||||
LOCK(&cd->lock); \
|
||||
} while (0)
|
||||
|
||||
#define MAYBE_UNLOCK(cd) \
|
||||
do { \
|
||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||
cd->in_configure == ISC_FALSE) \
|
||||
UNLOCK(&cd->lock); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Log a message at the given level.
|
||||
*/
|
||||
static void dlopen_log(int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(level),
|
||||
fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
* SDLZ methods
|
||||
*/
|
||||
|
||||
static isc_result_t
|
||||
dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzallnodes_t *allnodes)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_allnodes == NULL) {
|
||||
return (ISC_R_NOPERM);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
static isc_result_t
|
||||
dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
|
||||
const char *client)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
|
||||
if (cd->dlz_allowzonexfr == NULL) {
|
||||
return (ISC_R_NOPERM);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
|
||||
dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_authority == NULL) {
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_authority(zone, cd->dbdata, lookup);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_findzonedb(cd->dbdata, name);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
static isc_result_t
|
||||
dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
||||
void *dbdata, dns_sdlzlookup_t *lookup)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_lookup(zone, name, cd->dbdata, lookup);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a symbol from the library
|
||||
*/
|
||||
static void *
|
||||
dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
||||
void *ptr = dlsym(cd->dl_handle, symbol);
|
||||
if (ptr == NULL && mandatory) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen: library '%s' is missing "
|
||||
"required symbol '%s'", cd->dl_path, symbol);
|
||||
}
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called at startup for each dlopen zone in named.conf
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
void *driverarg, void **dbdata)
|
||||
{
|
||||
dlopen_data_t *cd;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
int dlopen_flags;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (argc < 2) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen driver for '%s' needs a path to "
|
||||
"the shared library", dlzname);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
isc_mem_create(0, 0, &mctx);
|
||||
|
||||
cd = isc_mem_get(mctx, sizeof(*cd));
|
||||
if (cd == NULL) {
|
||||
isc_mem_destroy(&mctx);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
memset(cd, 0, sizeof(*cd));
|
||||
|
||||
cd->mctx = mctx;
|
||||
|
||||
cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
|
||||
if (cd->dl_path == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
|
||||
if (cd->dlzname == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* Open the library */
|
||||
dlopen_flags = RTLD_NOW;
|
||||
|
||||
#ifdef RTLD_DEEPBIND
|
||||
/*
|
||||
* If RTLD_DEEPBIND is available then use it. This can avoid
|
||||
* issues with a module using a different version of a system
|
||||
* library than one that bind9 uses. For example, bind9 may link
|
||||
* to MIT kerberos, but the module may use Heimdal. If we don't
|
||||
* use RTLD_DEEPBIND then we could end up with Heimdal functions
|
||||
* calling MIT functions, which leads to bizarre results (usually
|
||||
* a segfault).
|
||||
*/
|
||||
dlopen_flags |= RTLD_DEEPBIND;
|
||||
#endif
|
||||
|
||||
cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
|
||||
if (cd->dl_handle == NULL) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen failed to open library '%s' - %s",
|
||||
cd->dl_path, dlerror());
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* Find the symbols */
|
||||
cd->dlz_version = dl_load_symbol(cd, "dlz_version", true);
|
||||
cd->dlz_create = dl_load_symbol(cd, "dlz_create", true);
|
||||
cd->dlz_lookup = dl_load_symbol(cd, "dlz_lookup", true);
|
||||
cd->dlz_findzonedb = dl_load_symbol(cd, "dlz_findzonedb", true);
|
||||
|
||||
if (cd->dlz_create == NULL || cd->dlz_lookup == NULL ||
|
||||
cd->dlz_findzonedb == NULL)
|
||||
{
|
||||
/* We're missing a required symbol */
|
||||
goto failed;
|
||||
}
|
||||
|
||||
cd->dlz_allowzonexfr = dl_load_symbol(cd, "dlz_allowzonexfr", false);
|
||||
cd->dlz_allnodes = dl_load_symbol(cd, "dlz_allnodes",
|
||||
cd->dlz_allowzonexfr != NULL);
|
||||
cd->dlz_authority = dl_load_symbol(cd, "dlz_authority", false);
|
||||
cd->dlz_newversion = dl_load_symbol(cd, "dlz_newversion", false);
|
||||
cd->dlz_closeversion = dl_load_symbol(cd, "dlz_closeversion",
|
||||
cd->dlz_newversion != NULL);
|
||||
cd->dlz_configure = dl_load_symbol(cd, "dlz_configure", false);
|
||||
cd->dlz_ssumatch = dl_load_symbol(cd, "dlz_ssumatch", false);
|
||||
cd->dlz_addrdataset = dl_load_symbol(cd, "dlz_addrdataset", false);
|
||||
cd->dlz_subrdataset = dl_load_symbol(cd, "dlz_subrdataset", false);
|
||||
cd->dlz_delrdataset = dl_load_symbol(cd, "dlz_delrdataset", false);
|
||||
|
||||
/* Check the version of the API is the same */
|
||||
cd->version = cd->dlz_version(&cd->flags);
|
||||
if (cd->version != DLZ_DLOPEN_VERSION) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen: incorrect version %d "
|
||||
"should be %d in '%s'",
|
||||
cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call the library's create function. Note that this is an
|
||||
* extended version of dlz create, with the addition of
|
||||
* named function pointers for helper functions that the
|
||||
* driver will need. This avoids the need for the backend to
|
||||
* link the bind9 libraries
|
||||
*/
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_create(dlzname, argc-1, argv+1,
|
||||
&cd->dbdata,
|
||||
"log", dlopen_log,
|
||||
"putrr", dns_sdlz_putrr,
|
||||
"putnamedrr", dns_sdlz_putnamedrr,
|
||||
"writeable_zone", dns_dlz_writeablezone,
|
||||
NULL);
|
||||
MAYBE_UNLOCK(cd);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto failed;
|
||||
|
||||
*dbdata = cd;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
failed:
|
||||
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
|
||||
if (cd->dl_path)
|
||||
isc_mem_free(mctx, cd->dl_path);
|
||||
if (cd->dlzname)
|
||||
isc_mem_free(mctx, cd->dlzname);
|
||||
#ifdef HAVE_DLCLOSE
|
||||
if (cd->dl_handle)
|
||||
dlclose(cd->dl_handle);
|
||||
#endif
|
||||
isc_mem_put(mctx, cd, sizeof(*cd));
|
||||
isc_mem_destroy(&mctx);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when bind is shutting down
|
||||
*/
|
||||
static void
|
||||
dlopen_dlz_destroy(void *driverarg, void *dbdata) {
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_mem_t *mctx;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_destroy) {
|
||||
MAYBE_LOCK(cd);
|
||||
cd->dlz_destroy(cd->dbdata);
|
||||
MAYBE_UNLOCK(cd);
|
||||
}
|
||||
|
||||
if (cd->dl_path)
|
||||
isc_mem_free(cd->mctx, cd->dl_path);
|
||||
if (cd->dlzname)
|
||||
isc_mem_free(cd->mctx, cd->dlzname);
|
||||
#ifdef HAVE_DLCLOSE
|
||||
if (cd->dl_handle)
|
||||
dlclose(cd->dl_handle);
|
||||
#endif
|
||||
mctx = cd->mctx;
|
||||
isc_mem_put(mctx, cd, sizeof(*cd));
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called to start a transaction
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
|
||||
void **versionp)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_newversion == NULL)
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_newversion(zone, cd->dbdata, versionp);
|
||||
MAYBE_UNLOCK(cd);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called to end a transaction
|
||||
*/
|
||||
static void
|
||||
dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
|
||||
void *driverarg, void *dbdata, void **versionp)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_newversion == NULL) {
|
||||
*versionp = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
cd->dlz_closeversion(zone, commit, cd->dbdata, versionp);
|
||||
MAYBE_UNLOCK(cd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called on startup to configure any writeable zones
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_configure(dns_view_t *view, void *driverarg, void *dbdata) {
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_configure == NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
cd->in_configure = ISC_TRUE;
|
||||
result = cd->dlz_configure(view, cd->dbdata);
|
||||
cd->in_configure = ISC_FALSE;
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check for authority to change a name
|
||||
*/
|
||||
static isc_boolean_t
|
||||
dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||
const char *type, const char *key, uint32_t keydatalen,
|
||||
uint8_t *keydata, void *driverarg, void *dbdata)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_boolean_t ret;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_ssumatch == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
|
||||
keydata, cd->dbdata);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add an rdataset
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_addrdataset(const char *name, const char *rdatastr,
|
||||
void *driverarg, void *dbdata, void *version)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_addrdataset == NULL)
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Subtract an rdataset
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_subrdataset(const char *name, const char *rdatastr,
|
||||
void *driverarg, void *dbdata, void *version)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_subrdataset == NULL)
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
delete a rdataset
|
||||
*/
|
||||
static isc_result_t
|
||||
dlopen_dlz_delrdataset(const char *name, const char *type,
|
||||
void *driverarg, void *dbdata, void *version)
|
||||
{
|
||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_delrdataset == NULL)
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
MAYBE_LOCK(cd);
|
||||
result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
|
||||
MAYBE_UNLOCK(cd);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
static dns_sdlzmethods_t dlz_dlopen_methods = {
|
||||
dlopen_dlz_create,
|
||||
dlopen_dlz_destroy,
|
||||
dlopen_dlz_findzonedb,
|
||||
dlopen_dlz_lookup,
|
||||
dlopen_dlz_authority,
|
||||
dlopen_dlz_allnodes,
|
||||
dlopen_dlz_allowzonexfr,
|
||||
dlopen_dlz_newversion,
|
||||
dlopen_dlz_closeversion,
|
||||
dlopen_dlz_configure,
|
||||
dlopen_dlz_ssumatch,
|
||||
dlopen_dlz_addrdataset,
|
||||
dlopen_dlz_subrdataset,
|
||||
dlopen_dlz_delrdataset
|
||||
};
|
||||
|
||||
/*
|
||||
* Register driver with BIND
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_dlopen_init(void) {
|
||||
isc_result_t result;
|
||||
|
||||
dlopen_log(2, "Registering DLZ_dlopen driver");
|
||||
|
||||
result = dns_sdlzregister("dlopen", &dlz_dlopen_methods, NULL,
|
||||
DNS_SDLZFLAG_RELATIVEOWNER |
|
||||
DNS_SDLZFLAG_THREADSAFE,
|
||||
ns_g_mctx, &dlz_dlopen);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"dns_sdlzregister() failed: %s",
|
||||
isc_result_totext(result));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Unregister the driver
|
||||
*/
|
||||
void
|
||||
dlz_dlopen_clear(void) {
|
||||
dlopen_log(2, "Unregistering DLZ_dlopen driver");
|
||||
if (dlz_dlopen != NULL)
|
||||
dns_sdlzunregister(&dlz_dlopen);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dlz_drivers.c,v 1.3 2010/12/18 01:56:20 each Exp $ */
|
||||
/* $Id: dlz_drivers.c,v 1.4 2011/03/10 04:36:16 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -61,10 +61,6 @@
|
||||
#include <dlz/dlz_odbc_driver.h>
|
||||
#endif
|
||||
|
||||
#ifdef DLZ_DLOPEN
|
||||
#include <dlz/dlz_dlopen_driver.h>
|
||||
#endif
|
||||
|
||||
/*%
|
||||
* Call init functions for all relevant DLZ drivers.
|
||||
*/
|
||||
@@ -119,12 +115,6 @@ dlz_drivers_init(void) {
|
||||
return (result);
|
||||
#endif
|
||||
|
||||
#ifdef DLZ_DLOPEN
|
||||
result = dlz_dlopen_init();
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
#endif
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -164,8 +154,4 @@ dlz_drivers_clear(void) {
|
||||
dlz_odbc_clear();
|
||||
#endif
|
||||
|
||||
#ifdef DLZ_DLOPEN
|
||||
dlz_dlopen_clear();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Andrew Tridgell
|
||||
*
|
||||
* based on dlz_stub_driver.h
|
||||
* which is:
|
||||
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
|
||||
* Copyright (C) 1999-2001 Internet Software Consortium.
|
||||
* see dlz_stub_driver.h for details
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
|
||||
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
* STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
|
||||
* conceived and contributed by Rob Butler.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
|
||||
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
* ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DLZ_DLOPEN_DRIVER_H
|
||||
#define DLZ_DLOPEN_DRIVER_H
|
||||
|
||||
isc_result_t
|
||||
dlz_dlopen_init(void);
|
||||
|
||||
void
|
||||
dlz_dlopen_clear(void);
|
||||
|
||||
#define DLZ_DLOPEN_VERSION 1
|
||||
|
||||
#endif
|
||||
|
||||
57
contrib/dlz/example/win32/DLLMain.c
Normal file
57
contrib/dlz/example/win32/DLLMain.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2001 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: DLLMain.c,v 1.2 2011/03/10 04:36:16 each Exp $ */
|
||||
|
||||
#include <windows.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
* Called when we enter the DLL
|
||||
*/
|
||||
__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason) {
|
||||
/*
|
||||
* The DLL is loading due to process
|
||||
* initialization or a call to LoadLibrary.
|
||||
*/
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
/* The attached process creates a new thread. */
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
||||
/* The thread of the attached process terminates. */
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
|
||||
/*
|
||||
* The DLL is unloading from a process due to
|
||||
* process termination or a call to FreeLibrary.
|
||||
*/
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
20
contrib/dlz/example/win32/dxdriver.def
Normal file
20
contrib/dlz/example/win32/dxdriver.def
Normal file
@@ -0,0 +1,20 @@
|
||||
LIBRARY dxdriver
|
||||
|
||||
; Exported Functions
|
||||
EXPORTS
|
||||
dlz_addrdataset
|
||||
dlz_allnodes
|
||||
dlz_allowzonexfr
|
||||
dlz_closeversion
|
||||
dlz_configure
|
||||
dlz_create
|
||||
dlz_delrdataset
|
||||
dlz_destroy
|
||||
dlz_findzonedb
|
||||
dlz_lookup
|
||||
dlz_newversion
|
||||
dlz_ssumatch
|
||||
dlz_subrdataset
|
||||
dlz_version
|
||||
|
||||
|
||||
121
contrib/dlz/example/win32/dxdriver.dsp
Normal file
121
contrib/dlz/example/win32/dxdriver.dsp
Normal file
@@ -0,0 +1,121 @@
|
||||
# Microsoft Developer Studio Project File - Name="dxdriver" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=dxdriver - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "dxdriver.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "dxdriver.mak" CFG="dxdriver - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dxdriver - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dxdriver - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "../../../../../" /I "../../../../../lib/isc/win32" /I "../../../../../lib/isc/win32/include" /I "../../../../../lib/isc/include" /I "../../../../../lib/dns/include" /D "NDEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
|
||||
# SUBTRACT CPP /X
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../../../Build/Release/dxdriver.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "dxdriver - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "../../../../../" /I "../../../../../lib/isc/win32" /I "../../../../../lib/isc/win32/include" /I "../../../../../lib/isc/include" /I "../../../../../lib/dns/include" /D "_DEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
|
||||
# SUBTRACT CPP /X
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"../../../../../Build/Debug/dxdriver.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "dxdriver - Win32 Release"
|
||||
# Name "dxdriver - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\driver.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DLLMain.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\driver.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dxdriver.def
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
contrib/dlz/example/win32/dxdriver.dsw
Normal file
29
contrib/dlz/example/win32/dxdriver.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "dxdriver"=.\dxdriver.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
298
contrib/dlz/example/win32/dxdriver.mak
Normal file
298
contrib/dlz/example/win32/dxdriver.mak
Normal file
@@ -0,0 +1,298 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on dxdriver.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=dxdriver - Win32 Release
|
||||
!MESSAGE No configuration specified. Defaulting to dxdriver - Win32 Release.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "dxdriver - Win32 Release" && "$(CFG)" != "dxdriver - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "dxdriver.mak" CFG="dxdriver - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dxdriver - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dxdriver - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release"
|
||||
_VC_MANIFEST_INC=0
|
||||
_VC_MANIFEST_BASENAME=__VC80
|
||||
!ELSE
|
||||
_VC_MANIFEST_INC=1
|
||||
_VC_MANIFEST_BASENAME=__VC80.Debug
|
||||
!ENDIF
|
||||
|
||||
####################################################
|
||||
# Specifying name of temporary resource file used only in incremental builds:
|
||||
|
||||
!if "$(_VC_MANIFEST_INC)" == "1"
|
||||
_VC_MANIFEST_AUTO_RES=$(_VC_MANIFEST_BASENAME).auto.res
|
||||
!else
|
||||
_VC_MANIFEST_AUTO_RES=
|
||||
!endif
|
||||
|
||||
####################################################
|
||||
# _VC_MANIFEST_EMBED_EXE - command to embed manifest in EXE:
|
||||
|
||||
!if "$(_VC_MANIFEST_INC)" == "1"
|
||||
|
||||
#MT_SPECIAL_RETURN=1090650113
|
||||
#MT_SPECIAL_SWITCH=-notify_resource_update
|
||||
MT_SPECIAL_RETURN=0
|
||||
MT_SPECIAL_SWITCH=
|
||||
_VC_MANIFEST_EMBED_EXE= \
|
||||
if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \
|
||||
if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \
|
||||
rc /r $(_VC_MANIFEST_BASENAME).auto.rc & \
|
||||
link $** /out:$@ $(LFLAGS)
|
||||
|
||||
!else
|
||||
|
||||
_VC_MANIFEST_EMBED_EXE= \
|
||||
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;1
|
||||
|
||||
!endif
|
||||
|
||||
####################################################
|
||||
# _VC_MANIFEST_EMBED_DLL - command to embed manifest in DLL:
|
||||
|
||||
!if "$(_VC_MANIFEST_INC)" == "1"
|
||||
|
||||
#MT_SPECIAL_RETURN=1090650113
|
||||
#MT_SPECIAL_SWITCH=-notify_resource_update
|
||||
MT_SPECIAL_RETURN=0
|
||||
MT_SPECIAL_SWITCH=
|
||||
_VC_MANIFEST_EMBED_EXE= \
|
||||
if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \
|
||||
if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \
|
||||
rc /r $(_VC_MANIFEST_BASENAME).auto.rc & \
|
||||
link $** /out:$@ $(LFLAGS)
|
||||
|
||||
!else
|
||||
|
||||
_VC_MANIFEST_EMBED_EXE= \
|
||||
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;2
|
||||
|
||||
!endif
|
||||
####################################################
|
||||
# _VC_MANIFEST_CLEAN - command to clean resources files generated temporarily:
|
||||
|
||||
!if "$(_VC_MANIFEST_INC)" == "1"
|
||||
|
||||
_VC_MANIFEST_CLEAN=-del $(_VC_MANIFEST_BASENAME).auto.res \
|
||||
$(_VC_MANIFEST_BASENAME).auto.rc \
|
||||
$(_VC_MANIFEST_BASENAME).auto.manifest
|
||||
|
||||
!else
|
||||
|
||||
_VC_MANIFEST_CLEAN=
|
||||
|
||||
!endif
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
|
||||
ALL : "..\..\..\..\..\Build\Release\dxdriver.dll"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DLLMain.obj"
|
||||
-@erase "$(INTDIR)\driver.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\dxdriver.exp"
|
||||
-@erase "$(OUTDIR)\dxdriver.lib"
|
||||
-@erase "..\..\..\..\..\Build\Release\dxdriver.dll"
|
||||
-@$(_VC_MANIFEST_CLEAN)
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "../" /I "../../../../../" /I "../../../../../lib/isc/win32" /I "../../../../../lib/isc/win32/include" /I "../../../../../lib/isc/include" /I "../../../../../lib/dns/include" /D "NDEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"$(INTDIR)\dxdriver.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dxdriver.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\dxdriver.pdb" /machine:I386 /def:".\dxdriver.def" /out:"../../../../../Build/Release/dxdriver.dll" /implib:"$(OUTDIR)\dxdriver.lib"
|
||||
DEF_FILE= \
|
||||
".\dxdriver.def"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DLLMain.obj" \
|
||||
"$(INTDIR)\driver.obj"
|
||||
|
||||
"..\..\..\..\..\Build\Release\dxdriver.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
$(_VC_MANIFEST_EMBED_DLL)
|
||||
|
||||
!ELSEIF "$(CFG)" == "dxdriver - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "..\..\..\..\..\Build\Debug\dxdriver.dll" "$(OUTDIR)\dxdriver.bsc"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DLLMain.obj"
|
||||
-@erase "$(INTDIR)\DLLMain.sbr"
|
||||
-@erase "$(INTDIR)\driver.obj"
|
||||
-@erase "$(INTDIR)\driver.sbr"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\dxdriver.bsc"
|
||||
-@erase "$(OUTDIR)\dxdriver.exp"
|
||||
-@erase "$(OUTDIR)\dxdriver.lib"
|
||||
-@erase "$(OUTDIR)\dxdriver.pdb"
|
||||
-@erase "..\..\..\..\..\Build\Debug\dxdriver.dll"
|
||||
-@erase "..\..\..\..\..\Build\Debug\dxdriver.ilk"
|
||||
-@$(_VC_MANIFEST_CLEAN)
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "../../../../../" /I "../../../../../lib/isc/win32" /I "../../../../../lib/isc/win32/include" /I "../../../../../lib/isc/include" /I "../../../../../lib/dns/include" /D "_DEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\dxdriver.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dxdriver.bsc"
|
||||
BSC32_SBRS= \
|
||||
"$(INTDIR)\DLLMain.sbr" \
|
||||
"$(INTDIR)\driver.sbr"
|
||||
|
||||
"$(OUTDIR)\dxdriver.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
|
||||
$(BSC32) @<<
|
||||
$(BSC32_FLAGS) $(BSC32_SBRS)
|
||||
<<
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\dxdriver.pdb" /debug /machine:I386 /def:".\dxdriver.def" /out:"../../../../../Build/Debug/dxdriver.dll" /implib:"$(OUTDIR)\dxdriver.lib" /pdbtype:sept
|
||||
DEF_FILE= \
|
||||
".\dxdriver.def"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DLLMain.obj" \
|
||||
"$(INTDIR)\driver.obj"
|
||||
|
||||
"..\..\..\..\..\Build\Debug\dxdriver.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
$(_VC_MANIFEST_EMBED_DLL)
|
||||
|
||||
!ENDIF
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("dxdriver.dep")
|
||||
!INCLUDE "dxdriver.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "dxdriver.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release" || "$(CFG)" == "dxdriver - Win32 Debug"
|
||||
SOURCE=.\DLLMain.c
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\DLLMain.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "dxdriver - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\DLLMain.obj" "$(INTDIR)\DLLMain.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\driver.c
|
||||
|
||||
!IF "$(CFG)" == "dxdriver - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\driver.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "dxdriver - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\driver.obj" "$(INTDIR)\driver.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
####################################################
|
||||
# Commands to generate initial empty manifest file and the RC file
|
||||
# that references it, and for generating the .res file:
|
||||
|
||||
$(_VC_MANIFEST_BASENAME).auto.res : $(_VC_MANIFEST_BASENAME).auto.rc
|
||||
|
||||
$(_VC_MANIFEST_BASENAME).auto.rc : $(_VC_MANIFEST_BASENAME).auto.manifest
|
||||
type <<$@
|
||||
#include <winuser.h>
|
||||
1RT_MANIFEST"$(_VC_MANIFEST_BASENAME).auto.manifest"
|
||||
<< KEEP
|
||||
|
||||
$(_VC_MANIFEST_BASENAME).auto.manifest :
|
||||
type <<$@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||
</assembly>
|
||||
<< KEEP
|
||||
Reference in New Issue
Block a user