/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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
#include <config.h>
#include <dlz/sdlz_helper.h>
/*
* sdlz helper methods
*/
/*%
* properly destroys a querylist by de-allocating the
* memory for each query segment, and then the list itself
*/
static void
{
/* if query list is null, nothing to do */
return;
/* start at the top of the list */
/*
* free the query segment's text string but only if it
* was really a query segment, and not a pointer to
* %zone%, or %record%, or %client%
*/
/* get the next query segment, before we destroy this one. */
/* deallocate this query segment. */
}
/* deallocate the query segment list */
}
/*% constructs a query list by parsing a string into query segments */
static isc_result_t
unsigned int flags)
{
/* if query string is null, or zero length */
if ((flags & SDLZH_REQUIRE_QUERY) == 0)
/* we don't need it were ok. */
return (ISC_R_SUCCESS);
else
/* we did need it, PROBLEM!!! */
return (ISC_R_FAILURE);
}
/* allocate memory for query list */
/* couldn't allocate memory. Problem!! */
return (ISC_R_NOMEMORY);
/* initialize the query segment list */
ISC_LIST_INIT(*tql);
/* make a copy of query_str so we can chop it up */
/* couldn't make a copy, problem!! */
goto cleanup;
}
/* loop through the string and chop it up */
/* allocate memory for tseg */
goto cleanup;
}
/* initialize the query segment link */
/* append the query segment to the list */
/*
* split string at the first "$". set query segment to
* left portion
*/
"$"));
/* no memory, clean everything up. */
goto cleanup;
}
/* tseg->sql points directly to a string. */
/* check if we encountered "$zone$" token */
/*
* we don't really need, or want the "zone"
* text, so get rid of it.
*/
/* set tseg->sql to in-direct zone string */
/* tseg->sql points in-directly to a string */
/* check if we encountered "$record$" token */
/*
* we don't really need, or want the "record"
* text, so get rid of it.
*/
/* set tseg->sql to in-direct record string */
/* tseg->sql points in-directly poinsts to a string */
/* check if we encountered "$client$" token */
/*
* we don't really need, or want the "client"
* text, so get rid of it.
*/
/* set tseg->sql to in-direct record string */
/* tseg->sql points in-directly poinsts to a string */
}
}
/* we don't need temp_str any more */
/*
* add checks later to verify zone and record are found if
* necessary.
*/
/* if this query requires %client%, make sure we found it */
/* Write error message to log */
"Required token $client$ not found.");
goto flag_fail;
}
/* if this query requires %record%, make sure we found it */
/* Write error message to log */
"Required token $record$ not found.");
goto flag_fail;
}
/* if this query requires %zone%, make sure we found it */
/* Write error message to log */
"Required token $zone$ not found.");
goto flag_fail;
}
/* pass back the query list */
/* return success */
return (ISC_R_SUCCESS);
/* get rid of temp_str */
/* get rid of what was build of the query list */
return result;
}
/*%
* build a query string from query segments, and dynamic segments
* dynamic segments replace where the tokens %zone%, %record%, %client%
* used to be in our queries from named.conf
*/
char *
{
unsigned int length = 0;
/* start at the top of the list */
/*
* if this is a query segment, use the
* precalculated string length
*/
else /* calculate string length for dynamic segments. */
/* get the next segment */
}
/* allocate memory for the string */
/* couldn't allocate memory, We need more ram! */
return NULL;
*qs = 0;
/* start at the top of the list again */
/* query segments */
else
/* dynamic segments */
/* get the next segment */
}
return qs;
}
/*% constructs a sql dbinstance (DBI) */
const char *allowxfr_str, const char *authority_str,
const char *findzone_str, const char *lookup_str,
{
/* allocate and zero memory for driver structure */
"Could not allocate memory for "
"database instance object.");
return (ISC_R_NOMEMORY);
}
/* attach to the memory context */
/* initialize the reference count mutex */
if (result != ISC_R_SUCCESS) {
"isc_mutex_init() failed: %s",
goto cleanup;
}
/* build the all nodes query list */
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build all nodes query list");
goto cleanup;
}
/* build the allow zone transfer query list */
&db->allowxfr_q,
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build allow xfr query list");
goto cleanup;
}
/* build the authority query, query list */
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build authority query list");
goto cleanup;
}
/* build findzone query, query list */
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build find zone query list");
goto cleanup;
}
/* build countzone query, query list */
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build count zone query list");
goto cleanup;
}
/* build lookup query, query list */
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
"Could not build lookup query list");
goto cleanup;
}
/* pass back the db instance */
/* return success */
return (ISC_R_SUCCESS);
/* destroy whatever was build of the db instance */
/* return failure */
return (ISC_R_FAILURE);
}
void
{
/* save mctx for later */
/* destroy any query lists we created */
/* get rid of the mutex */
/* return, and detach the memory */
}
char *
{
int keylen;
char *keystart;
int i;
return NULL;
if (keylen < 1)
return NULL;
return NULL;
for (i = 0; i < 255; i++) {
value[i] = '\0';
break;
}
}
}
#endif