summaryrefslogtreecommitdiff
path: root/contrib/sdb
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:15:23 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:15:23 -0600
commit708dfaae929e0746a1e6fb5100d2c74036e45adf (patch)
tree8e41d12e0a398d83e4b055867ea794f50d3dc337 /contrib/sdb
parent00fa0dd5b9bb17deb8d2e96a2bc4234abaa9d5ac (diff)
downloadbind9-708dfaae929e0746a1e6fb5100d2c74036e45adf.tar.gz
9.3.0beta2
Diffstat (limited to 'contrib/sdb')
-rw-r--r--contrib/sdb/dir/dirdb.c4
-rw-r--r--contrib/sdb/dir/dirdb.h4
-rw-r--r--contrib/sdb/ldap/INSTALL.ldap70
-rw-r--r--contrib/sdb/ldap/README.ldap16
-rw-r--r--contrib/sdb/ldap/ldapdb.c147
-rw-r--r--contrib/sdb/ldap/zone2ldap.c25
-rw-r--r--contrib/sdb/pgsql/pgsqldb.c4
-rw-r--r--contrib/sdb/pgsql/pgsqldb.h4
-rw-r--r--contrib/sdb/pgsql/zonetodb.c17
-rw-r--r--contrib/sdb/sqlite/README.sdb_sqlite67
-rw-r--r--contrib/sdb/sqlite/sqlitedb.c324
-rw-r--r--contrib/sdb/sqlite/sqlitedb.h25
-rw-r--r--contrib/sdb/sqlite/zone2sqlite.c301
-rw-r--r--contrib/sdb/tcl/lookup.tcl4
-rw-r--r--contrib/sdb/tcl/tcldb.c6
-rw-r--r--contrib/sdb/tcl/tcldb.h4
-rw-r--r--contrib/sdb/time/timedb.c4
-rw-r--r--contrib/sdb/time/timedb.h4
18 files changed, 71 insertions, 959 deletions
diff --git a/contrib/sdb/dir/dirdb.c b/contrib/sdb/dir/dirdb.c
index 7226816d..5aaefbc3 100644
--- a/contrib/sdb/dir/dirdb.c
+++ b/contrib/sdb/dir/dirdb.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dirdb.c,v 1.9.4.3 2004/03/09 06:10:34 marka Exp $ */
+/* $Id: dirdb.c,v 1.9.4.2.8.2 2004/03/08 09:04:22 marka Exp $ */
/*
* A simple database driver that returns basic information about
diff --git a/contrib/sdb/dir/dirdb.h b/contrib/sdb/dir/dirdb.h
index 76bd9ad3..71b01ebd 100644
--- a/contrib/sdb/dir/dirdb.h
+++ b/contrib/sdb/dir/dirdb.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dirdb.h,v 1.2.4.3 2004/03/09 06:10:34 marka Exp $ */
+/* $Id: dirdb.h,v 1.2.4.2.8.2 2004/03/08 09:04:22 marka Exp $ */
#include <isc/types.h>
diff --git a/contrib/sdb/ldap/INSTALL.ldap b/contrib/sdb/ldap/INSTALL.ldap
index 91511296..e3801ed2 100644
--- a/contrib/sdb/ldap/INSTALL.ldap
+++ b/contrib/sdb/ldap/INSTALL.ldap
@@ -1,12 +1,12 @@
-This is the INSTALL file for 1.0-beta. See
+This is the INSTALL file for 0.9. See
http://www.venaas.no/ldap/bind-sdb/ for updates or other information.
BUILDING
You need the source for BIND 9.1.0 or newer (for zone transfers you
will need at least 9.1.1rc3 due to a bug). Basically you need to follow
-the instructions in doc/misc/sdb, if my instructions don't make sense,
-please have a look at those as well.
+the instructions in doc/misc/sdb, if my instructions doesn't make sense,
+please have a look at that as well.
Copy ldapdb.c to bin/named and ldapdb.h to bin/named/include in the
source tree.
@@ -22,19 +22,11 @@ Finally you need to edit bin/named/main.c. Below where it says
it says "xxdb_init();" add the line "ldapdb_init();", and finally
below where it says "xxdb_clear();", add "ldapdb_clear();".
-Now you should hopefully be able to build as usual; first configure
-and then make. If you get an error message about ldap_memfree() not
-being defined, you're probably using an LDAP library with the
-interface defined in RFC 1823. To build, uncomment the "#define
-LDAPDB_RFC1823API" line near the top of ldapdb.c.
+Now you should hopefully be able to build it. If you get an error
+message about ldap_memfree() not being defined, you're probably
+using an LDAP library with the interface defined in RFC 1823. To
+build, uncomment the #define RFC1823API line near the top of ldapdb.c.
-Also, if you're using an LDAPv2 only server, you need to change
-the line "#define LDAPDB_LDAP_VERSION 3" in ldapdb.c. Simply
-replace 3 with 2. Instead of editing the file, you may define
-LDAPDB_LDAP_VERSION yourself.
-
-If you want to use TLS, you need to uncommed the #define LDAPDB_TLS"
-line near the top of ldapdb.c.
CONFIGURING
@@ -42,42 +34,26 @@ Before you do any configuring of LDAP stuff, please try to configure
and start bind as usual to see if things work.
To do anything useful, you need to store a zone in some LDAP server.
-You must use a schema called dNSZone. Note that it relies on some
-attribute definitions in the Cosine schema, so that must be included
-as well. The Cosine schema probably comes with your LDAP server. You
-can find dNSZone and further details on how to store the data in your
-LDAP server at http://www.venaas.no/ldap/bind-sdb/
-
-To make BIND use a zone stored in LDAP, you will have to put something
-like this in named.conf:
-
+From this release on, you must use a schema called dNSZone. Note that
+it relies on some attribute definitions in the Cosine schema, so that
+must be included as well. The Cosine schema probably comes with your
+LDAP server. You can find dNSZone and further details on how to store
+the data in your LDAP server at
+http://www.venaas.no/ldap/bind-sdb/
+
+For an example, have a look at my venaas.com zone. Try a subtree search
+for objectClass=* at
+ldap ldap://129.241.20.67/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no
+
+To use it with BIND, I've added the following to named.conf:
zone "venaas.com" {
type master;
- database "ldap ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no 172800";
+ database "ldap ldap://129.241.20.67/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no 172800";
};
When doing lookups BIND will do a sub-tree search below the base in the
URL. The number 172800 is the TTL which will be used for all entries that
-haven't got the dNSTTL attribute. It is also possible to add a filter to
-the URL, say "ldap://host/base???(o=internal)".
-
-Version 1.0 also has support for simple LDAP bind, that is, binding to
-LDAP using plain text authentication. The bind dn and password is coded
-into the URL as extensions, according to RFC 2255. If you want simple
-bind with say dn "cn=Manager,dc=venaas,dc=no" and password "secret", the
-URL will be something like this:
-
-ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no????!bindname=cn=Manager%2cdc=venaas%2cdc=no,!x-bindpw=secret
-
-This URL may also include a filter part if you need it. Note that in
-the bind dn, "," is hex-escaped as "%2c". This is necessary since ","
-is the separator between the extension elements. The "!" in front of
-"bindname" and "x-bindpw" can be omitted if you prefer. "x-bindpw" is
-not standardized, but it's used by several other LDAP applications. See
-RFC 2255 for details.
-
-Finally, if you enabled TLS when compiling, you can also use TLS if
-you like. To do this you use the extension "x-tls", e.g.
-ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no????!bindname=cn=Manager%2cdc=venaas%2cdc=no,!x-bindpw=secret,x-tls
+haven't got the dNSTTL attribute. It is also possible to add an filter to
+the URL, say ldap://host/base???(o=internal)
-Stig Venaas <venaas@uninett.no> 2004-08-15
+Stig Venaas <venaas@uninett.no> 2002-04-17
diff --git a/contrib/sdb/ldap/README.ldap b/contrib/sdb/ldap/README.ldap
index b4ea18ab..10d65872 100644
--- a/contrib/sdb/ldap/README.ldap
+++ b/contrib/sdb/ldap/README.ldap
@@ -1,15 +1,7 @@
This is an attempt at an LDAP back-end for BIND 9 using the new simplified
-database interface "sdb". This is release 1.0-beta and should be pretty
-stable. Note that since version 0.4 a new schema is used. It is not
-backwards compatible with versions before 0.4.
-
-1.0-beta fixes a large memory leak. An extension x-tls for enabling TLS
-has been added.
-
-1.0-alpha uses LDAPv3 by default and also supports LDAP simple bind. That
-is, one can use plain text password for authentication. The bind dn and
-password is coded into the URL using extensions bindname and x-bindpw
-per RFC 2255.
+database interface "sdb". This is the nineth release (0.9) and seems to
+be pretty stable. Note that since version 0.4 a new schema is used.
+It is not backwards compatible with versions before 0.4.
In 0.9 the code has been cleaned up a bit and should be slightly faster
than previous versions. It also fixes an error with zone transfers (AXFR)
@@ -45,4 +37,4 @@ contact me. See also http://www.venaas.no/ldap/bind-sdb/ for information.
See INSTALL for how to build, install and use.
-Stig Venaas <venaas@uninett.no> 2004-08-15
+Stig Venaas <venaas@uninett.no> 2001-12-29
diff --git a/contrib/sdb/ldap/ldapdb.c b/contrib/sdb/ldap/ldapdb.c
index ed124c07..ca2866b9 100644
--- a/contrib/sdb/ldap/ldapdb.c
+++ b/contrib/sdb/ldap/ldapdb.c
@@ -1,31 +1,18 @@
/*
- * ldapdb.c version 1.0-beta
+ * ldapdb.c version 0.9
*
- * Copyright (C) 2002, 2004 Stig Venaas
+ * Copyright (C) 2002 Stig Venaas
*
* 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.
- *
- * Contributors: Jeremy C. McDermond
- */
-
-/*
- * If you want to use TLS, uncomment the define below
*/
-/* #define LDAPDB_TLS */
/*
* If you are using an old LDAP API uncomment the define below. Only do this
* if you know what you're doing or get compilation errors on ldap_memfree().
- * This also forces LDAPv2.
*/
-/* #define LDAPDB_RFC1823API */
-
-/* Using LDAPv3 by default, change this if you want v2 */
-#ifndef LDAPDB_LDAP_VERSION
-#define LDAPDB_LDAP_VERSION 3
-#endif
+/* #define RFC1823API */
#include <config.h>
@@ -68,11 +55,6 @@ struct ldapdb_data {
char *filterone;
int filteronelen;
char *filtername;
- char *bindname;
- char *bindpw;
-#ifdef LDAPDB_TLS
- int tls;
-#endif
};
/* used by ldapdb_getconn */
@@ -178,7 +160,7 @@ ldapdb_getconn(struct ldapdb_data *data)
conndata = malloc(sizeof(*conndata));
if (conndata == NULL)
return (NULL);
- conndata->index = data->hostport;
+ (char *)conndata->index = data->hostport;
conndata->size = strlen(data->hostport);
conndata->data = NULL;
ldapdb_insert((struct ldapdb_entry **)&threaddata->data,
@@ -191,27 +173,12 @@ ldapdb_getconn(struct ldapdb_data *data)
static void
ldapdb_bind(struct ldapdb_data *data, LDAP **ldp)
{
-#ifndef LDAPDB_RFC1823API
- const int ver = LDAPDB_LDAP_VERSION;
-#endif
-
if (*ldp != NULL)
ldap_unbind(*ldp);
*ldp = ldap_open(data->hostname, data->portno);
if (*ldp == NULL)
return;
-
-#ifndef LDAPDB_RFC1823API
- ldap_set_option(*ldp, LDAP_OPT_PROTOCOL_VERSION, &ver);
-#endif
-
-#ifdef LDAPDB_TLS
- if (data->tls) {
- ldap_start_tls_s(*ldp, NULL, NULL);
- }
-#endif
-
- if (ldap_simple_bind_s(*ldp, data->bindname, data->bindpw) != LDAP_SUCCESS) {
+ if (ldap_simple_bind_s(*ldp, NULL, NULL) != LDAP_SUCCESS) {
ldap_unbind(*ldp);
*ldp = NULL;
}
@@ -224,9 +191,9 @@ ldapdb_search(const char *zone, const char *name, void *dbdata, void *retdata)
isc_result_t result = ISC_R_NOTFOUND;
LDAP **ldp;
LDAPMessage *res, *e;
- char *fltr, *a, **vals = NULL, **names = NULL;
+ char *fltr, *a, **vals, **names = NULL;
char type[64];
-#ifdef LDAPDB_RFC1823API
+#ifdef RFC1823API
void *ptr;
#else
BerElement *ptr;
@@ -311,7 +278,7 @@ ldapdb_search(const char *zone, const char *name, void *dbdata, void *retdata)
*s = toupper(*s);
s = strstr(a, "RECORD");
if ((s == NULL) || (s == a) || (s - a >= (signed int)sizeof(type))) {
-#ifndef LDAPDB_RFC1823API
+#ifndef RFC1823API
ldap_memfree(a);
#endif
continue;
@@ -335,7 +302,7 @@ ldapdb_search(const char *zone, const char *name, void *dbdata, void *retdata)
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"LDAP sdb zone '%s': dns_sdb_put... failed for %s", zone, vals[i]);
ldap_value_free(vals);
-#ifndef LDAPDB_RFC1823API
+#ifndef RFC1823API
ldap_memfree(a);
if (ptr != NULL)
ber_free(ptr, 0);
@@ -348,23 +315,21 @@ ldapdb_search(const char *zone, const char *name, void *dbdata, void *retdata)
}
ldap_value_free(vals);
}
-#ifndef LDAPDB_RFC1823API
+#ifndef RFC1823API
ldap_memfree(a);
#endif
}
-#ifndef LDAPDB_RFC1823API
+#ifndef RFC1823API
if (ptr != NULL)
ber_free(ptr, 0);
#endif
if (name == NULL)
ldap_value_free(names);
- /* free this result */
+ /* cleanup this result */
ldap_msgfree(res);
}
- /* free final result */
- ldap_msgfree(res);
return (result);
}
@@ -406,56 +371,7 @@ unhex(char *in)
return in;
}
-/* returns 0 for ok, -1 for bad syntax, -2 for unknown critical extension */
-static int
-parseextensions(char *extensions, struct ldapdb_data *data)
-{
- char *s, *next, *name, *value;
- int critical;
-
- while (extensions != NULL) {
- s = strchr(extensions, ',');
- if (s != NULL) {
- *s++ = '\0';
- next = s;
- } else {
- next = NULL;
- }
-
- if (*extensions != '\0') {
- s = strchr(extensions, '=');
- if (s != NULL) {
- *s++ = '\0';
- value = *s != '\0' ? s : NULL;
- } else {
- value = NULL;
- }
- name = extensions;
- critical = *name == '!';
- if (critical) {
- name++;
- }
- if (*name == '\0') {
- return -1;
- }
-
- if (!strcasecmp(name, "bindname")) {
- data->bindname = value;
- } else if (!strcasecmp(name, "x-bindpw")) {
- data->bindpw = value;
-#ifdef LDAPDB_TLS
- } else if (!strcasecmp(name, "x-tls")) {
- data->tls = value == NULL || !strcasecmp(value, "true");
-#endif
- } else if (critical) {
- return -2;
- }
- }
- extensions = next;
- }
- return 0;
-}
static void
free_data(struct ldapdb_data *data)
@@ -477,7 +393,7 @@ ldapdb_create(const char *zone, int argc, char **argv,
void *driverdata, void **dbdata)
{
struct ldapdb_data *data;
- char *s, *filter = NULL, *extensions = NULL;
+ char *s, *filter = NULL;
int defaultttl;
UNUSED(driverdata);
@@ -523,15 +439,6 @@ ldapdb_create(const char *zone, int argc, char **argv,
s = strchr(s, '?');
if (s != NULL) {
*s++ = '\0';
- /* extensions */
- extensions = s;
- s = strchr(s, '?');
- if (s != NULL) {
- *s++ = '\0';
- }
- if (*extensions == '\0') {
- extensions = NULL;
- }
}
if (*filter == '\0') {
filter = NULL;
@@ -542,37 +449,15 @@ ldapdb_create(const char *zone, int argc, char **argv,
if (*data->base == '\0') {
data->base = NULL;
}
- }
-
- /* parse extensions */
- if (extensions != NULL) {
- int err;
- err = parseextensions(extensions, data);
- if (err < 0) {
- /* err should be -1 or -2 */
+ if ((data->base != NULL && unhex(data->base) == NULL) || (filter != NULL && unhex(filter) == NULL)) {
free_data(data);
- if (err == -1) {
- isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
- "LDAP sdb zone '%s': URL: extension syntax error", zone);
- } else if (err == -2) {
- isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
- "LDAP sdb zone '%s': URL: unknown critical extension", zone);
- }
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': bad hex values", zone);
return (ISC_R_FAILURE);
}
}
- if ((data->base != NULL && unhex(data->base) == NULL) ||
- (filter != NULL && unhex(filter) == NULL) ||
- (data->bindname != NULL && unhex(data->bindname) == NULL) ||
- (data->bindpw != NULL && unhex(data->bindpw) == NULL)) {
- free_data(data);
- isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
- "LDAP sdb zone '%s': URL: bad hex values", zone);
- return (ISC_R_FAILURE);
- }
-
/* compute filterall and filterone once and for all */
if (filter == NULL) {
data->filteralllen = strlen(zone) + strlen("(zoneName=)") + 1;
diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c
index 90028b6d..badc06ce 100644
--- a/contrib/sdb/ldap/zone2ldap.c
+++ b/contrib/sdb/ldap/zone2ldap.c
@@ -20,8 +20,6 @@
#include <getopt.h>
#include <isc/buffer.h>
-#include <isc/entropy.h>
-#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
@@ -108,8 +106,7 @@ debug = 1;
int
main (int *argc, char **argv)
{
- isc_mem_t *mctx = NULL;
- isc_entropy_t *ectx = NULL;
+ isc_mem_t *isc_ctx = NULL;
isc_result_t result;
char *basedn;
ldap_info *tmp;
@@ -188,15 +185,9 @@ main (int *argc, char **argv)
if (debug)
printf ("Initializing ISC Routines, parsing zone file\n");
- result = isc_mem_create (0, 0, &mctx);
+ result = isc_mem_create (0, 0, &isc_ctx);
isc_result_check (result, "isc_mem_create");
- result = isc_entropy_create(mctx, &ectx);
- isc_result_check (result, "isc_entropy_create");
-
- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
- isc_result_check (result, "isc_hash_create");
-
isc_buffer_init (&buff, argzone, strlen (argzone));
isc_buffer_add (&buff, strlen (argzone));
dns_fixedname_init (&fixedzone);
@@ -204,8 +195,9 @@ main (int *argc, char **argv)
result = dns_name_fromtext (zone, &buff, dns_rootname, ISC_FALSE, NULL);
isc_result_check (result, "dns_name_fromtext");
- result = dns_db_create (mctx, "rbt", zone, dns_dbtype_zone,
- dns_rdataclass_in, 0, NULL, &db);
+ result =
+ dns_db_create (isc_ctx, "rbt", zone, dns_dbtype_zone, dns_rdataclass_in,
+ 0, NULL, &db);
isc_result_check (result, "dns_db_create");
result = dns_db_load (db, zonefile);
@@ -321,14 +313,9 @@ main (int *argc, char **argv)
add_ldap_values (tmp);
}
- if (debug)
+if (debug)
printf("Operation Complete.\n");
- /* Cleanup */
- isc_hash_destroy();
- isc_entropy_detach(&ectx);
- isc_mem_destroy(&mctx);
-
return 0;
}
diff --git a/contrib/sdb/pgsql/pgsqldb.c b/contrib/sdb/pgsql/pgsqldb.c
index 730c5110..9421cebc 100644
--- a/contrib/sdb/pgsql/pgsqldb.c
+++ b/contrib/sdb/pgsql/pgsqldb.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: pgsqldb.c,v 1.12.4.3 2004/03/09 06:10:34 marka Exp $ */
+/* $Id: pgsqldb.c,v 1.12.4.2.8.2 2004/03/08 09:04:22 marka Exp $ */
#include <config.h>
diff --git a/contrib/sdb/pgsql/pgsqldb.h b/contrib/sdb/pgsql/pgsqldb.h
index b151f4e6..f91e98f0 100644
--- a/contrib/sdb/pgsql/pgsqldb.h
+++ b/contrib/sdb/pgsql/pgsqldb.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: pgsqldb.h,v 1.2.4.3 2004/03/09 06:10:35 marka Exp $ */
+/* $Id: pgsqldb.h,v 1.2.4.2.8.2 2004/03/08 09:04:22 marka Exp $ */
#include <isc/types.h>
diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c
index ee837e84..515f07d9 100644
--- a/contrib/sdb/pgsql/zonetodb.c
+++ b/contrib/sdb/pgsql/zonetodb.c
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 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
@@ -15,14 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zonetodb.c,v 1.12.4.5 2005/09/06 02:11:54 marka Exp $ */
+/* $Id: zonetodb.c,v 1.12.4.2.8.4 2004/03/08 09:04:22 marka Exp $ */
#include <stdlib.h>
#include <string.h>
#include <isc/buffer.h>
-#include <isc/entropy.h>
-#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
@@ -142,7 +140,6 @@ main(int argc, char **argv) {
dns_rdataset_t rdataset;
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_mem_t *mctx = NULL;
- isc_entropy_t *ectx = NULL;
isc_buffer_t b;
isc_result_t result;
PGresult *res;
@@ -164,12 +161,6 @@ main(int argc, char **argv) {
result = isc_mem_create(0, 0, &mctx);
check_result(result, "isc_mem_create");
- result = isc_entropy_create(mctx, &ectx);
- result_check (result, "isc_entropy_create");
-
- result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
- check_result (result, "isc_hash_create");
-
isc_buffer_init(&b, porigin, strlen(porigin));
isc_buffer_add(&b, strlen(porigin));
dns_fixedname_init(&forigin);
@@ -284,8 +275,6 @@ main(int argc, char **argv) {
PQclear(res);
dns_dbiterator_destroy(&dbiter);
dns_db_detach(&db);
- isc_hash_destroy();
- isc_entropy_detach(&ectx);
isc_mem_destroy(&mctx);
closeandexit(0);
exit(0);
diff --git a/contrib/sdb/sqlite/README.sdb_sqlite b/contrib/sdb/sqlite/README.sdb_sqlite
deleted file mode 100644
index 36128e19..00000000
--- a/contrib/sdb/sqlite/README.sdb_sqlite
+++ /dev/null
@@ -1,67 +0,0 @@
- SQLite BIND SDB driver
-
-The SQLite BIND SDB "driver" is intended as an alternative both to the
-pgsqldb and dirdb drivers, for situations that would like the management
-simplicity and convenience of single filesystem files, with the additional
-capability of SQL databases. It is also intended as an alternative to
-the standard dynamic DNS update capability in bind, which effectively
-requires use of DNSSEC keys for authorization and is limited to 'nsupdate'
-for updates. An sqlite database, by contrast, uses and requires only
-normal filesystem permissions, and may be updated however a typical SQLite
-database might be updated, e.g., via a web service with an SQLite backend.
-
-This driver is not considered suitable for very high volume public
-nameserver use, while likely useful for smaller private nameserver
-applications, whether or not in a production environment. It should
-generally be suitable wherever SQLite is preferable over larger database
-engines, and not suitable where SQLite is not preferable.
-
-Usage:
-
-o Use the named_sdb process ( put ENABLE_SDB=yes in /etc/sysconfig/named )
-
-o Edit your named.conf to contain a database zone, eg.:
-
-zone "mydomain.net." IN {
- type master;
- database "sqlite /etc/named.d/mydomain.db mydomain";
- # ^- DB file ^-Table
-};
-
-o Create the database zone table
- The table must contain the columns "name", "rdtype", and "rdata", and
- is expected to contain a properly constructed zone. The program
- "zone2sqlite" creates such a table.
-
- zone2sqlite usage:
-
- zone2sqlite origin zonefile dbfile dbtable
-
- where
- origin : zone origin, eg "mydomain.net."
- zonefile : master zone database file, eg. mydomain.net.zone
- dbfile : name of SQLite database file
- dbtable : name of table in database
-
----
-# mydomain.net.zone:
-$TTL 1H
-@ SOA localhost. root.localhost. ( 1
- 3H
- 1H
- 1W
- 1H )
- NS localhost.
-host1 A 192.168.2.1
-host2 A 192.168.2.2
-host3 A 192.168.2.3
-host4 A 192.168.2.4
-host5 A 192.168.2.5
-host6 A 192.168.2.6
-host7 A 192.168.2.7
----
-
-# zone2sqlite mydomain.net. mydomain.net.zone mydomain.net.db mydomain
-
-will create/update the 'mydomain' table in database file 'mydomain.net.db'.
-
diff --git a/contrib/sdb/sqlite/sqlitedb.c b/contrib/sdb/sqlite/sqlitedb.c
deleted file mode 100644
index 9eb06e74..00000000
--- a/contrib/sdb/sqlite/sqlitedb.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-/* $Id: sqlitedb.c,v 1.1.4.1 2007/03/05 05:36:58 marka Exp $ */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sqlite3.h>
-
-#include <isc/mem.h>
-#include <isc/print.h>
-#include <isc/result.h>
-#include <isc/util.h>
-
-#include <dns/sdb.h>
-#include <dns/result.h>
-
-#include <named/globals.h>
-
-#include "sqlitedb.h"
-
-/*
- * A simple database driver that interfaces to a SQLite database.
- *
- * The table must contain the fields "name", "rdtype", and "rdata", and
- * is expected to contain a properly constructed zone. The program "zonetodb"
- * creates such a table.
- */
-
-static dns_sdbimplementation_t *sqlitedb = NULL;
-
-typedef struct _dbinfo {
- sqlite3 *db;
- char *filename;
- char *table;
-} dbinfo_t;
-
-
-static isc_result_t
-db_connect(dbinfo_t *dbi)
-{
- if (sqlite3_open(dbi->filename, &dbi->db) == SQLITE_OK) {
- return (ISC_R_SUCCESS);
- } else {
- /* a connection is returned even if the open fails */
- sqlite3_close(dbi->db);
- dbi->db = NULL;
- return (ISC_R_FAILURE);
- }
-}
-
-
-typedef struct _lookup_parm_t {
- int i;
- dns_sdblookup_t *lookup;
- isc_result_t result;
-} lookup_parm_t;
-
-
-static int
-sqlitedb_lookup_cb(void *p, int cc, char **cv, char **cn)
-{
- lookup_parm_t *parm = p;
- dns_ttl_t ttl;
- char *endp;
-
- /* FIXME - check these(num/names); I'm assuming a mapping for now */
- char *ttlstr = cv[0];
- char *type = cv[1];
- char *data = cv[2];
-
- UNUSED(cc);
- UNUSED(cn);
-
- ttl = strtol(ttlstr, &endp, 10);
- if (*endp) {
- parm->result = DNS_R_BADTTL;
- return 1;
- }
-
- parm->result = dns_sdb_putrr(parm->lookup, type, ttl, data);
-
- if (parm->result != ISC_R_SUCCESS)
- return 1;
-
- (parm->i)++;
-
- return 0;
-}
-
-
-static isc_result_t
-sqlitedb_lookup(const char *zone,
- const char *name, void *dbdata,
- dns_sdblookup_t *lookup)
-/*
- * synchronous absolute name lookup
- */
-{
- dbinfo_t *dbi = (dbinfo_t *) dbdata;
- char *sql;
- lookup_parm_t parm = { 0, lookup, ISC_R_SUCCESS };
- char *errmsg = NULL;
- int result;
-
- UNUSED(zone);
-
- sql = sqlite3_mprintf(
- "SELECT TTL,RDTYPE,RDATA FROM \"%q\" WHERE "
- "lower(NAME) = lower('%q')",
- dbi->table, name);
-
- result = sqlite3_exec(dbi->db, sql,
- &sqlitedb_lookup_cb, &parm,
- &errmsg);
- sqlite3_free(sql);
-
- if (result != SQLITE_OK)
- return (ISC_R_FAILURE);
- if (parm.i == 0)
- return (ISC_R_NOTFOUND);
-
- return (ISC_R_SUCCESS);
-}
-
-
-typedef struct _allnodes_parm_t {
- int i;
- dns_sdballnodes_t *allnodes;
- isc_result_t result;
-} allnodes_parm_t;
-
-
-static int
-sqlitedb_allnodes_cb(void *p, int cc, char **cv, char **cn)
-{
- allnodes_parm_t *parm = p;
- dns_ttl_t ttl;
- char *endp;
-
- /* FIXME - check these(num/names); I'm assuming a mapping for now */
- char *ttlstr = cv[0];
- char *name = cv[1];
- char *type = cv[2];
- char *data = cv[3];
-
- UNUSED(cc);
- UNUSED(cn);
-
- ttl = strtol(ttlstr, &endp, 10);
- if (*endp) {
- parm->result = DNS_R_BADTTL;
- return 1;
- }
-
- parm->result = dns_sdb_putnamedrr(parm->allnodes, name, type, ttl, data);
-
- if (parm->result != ISC_R_SUCCESS)
- return 1;
-
- (parm->i)++;
-
- return 0;
-}
-
-
-static isc_result_t
-sqlitedb_allnodes(const char *zone,
- void *dbdata,
- dns_sdballnodes_t *allnodes)
-{
- dbinfo_t *dbi = (dbinfo_t *) dbdata;
- char *sql;
- allnodes_parm_t parm = { 0, allnodes, ISC_R_SUCCESS };
- char *errmsg = NULL;
- int result;
-
- UNUSED(zone);
-
- sql = sqlite3_mprintf(
- "SELECT TTL,NAME,RDTYPE,RDATA FROM \"%q\" ORDER BY NAME",
- dbi->table);
-
- result = sqlite3_exec(dbi->db, sql,
- &sqlitedb_allnodes_cb, &parm,
- &errmsg);
- sqlite3_free(sql);
-
- if (result != SQLITE_OK)
- return (ISC_R_FAILURE);
- if (parm.i == 0)
- return (ISC_R_NOTFOUND);
-
- return (ISC_R_SUCCESS);
-}
-
-
-static void
-sqlitedb_destroy(const char *zone, void *driverdata, void **dbdata)
-{
- dbinfo_t *dbi = *dbdata;
-
- UNUSED(zone);
- UNUSED(driverdata);
-
- if (dbi->db != NULL)
- sqlite3_close(dbi->db);
- if (dbi->table != NULL)
- isc_mem_free(ns_g_mctx, dbi->table);
- if (dbi->filename != NULL)
- isc_mem_free(ns_g_mctx, dbi->filename);
-
- isc_mem_put(ns_g_mctx, dbi, sizeof(dbinfo_t));
-}
-
-
-#define STRDUP_OR_FAIL(target, source) \
- do { \
- target = isc_mem_strdup(ns_g_mctx, source); \
- if (target == NULL) { \
- result = ISC_R_NOMEMORY; \
- goto cleanup; \
- } \
- } while (0);
-
-/*
- * Create a connection to the database and save any necessary information
- * in dbdata.
- *
- * argv[0] is the name of the database file
- * argv[1] is the name of the table
- */
-static isc_result_t
-sqlitedb_create(const char *zone,
- int argc, char **argv,
- void *driverdata, void **dbdata)
-{
- dbinfo_t *dbi;
- isc_result_t result;
-
- UNUSED(zone);
- UNUSED(driverdata);
-
- if (argc < 2)
- return (ISC_R_FAILURE);
-
- dbi = isc_mem_get(ns_g_mctx, sizeof(dbinfo_t));
- if (dbi == NULL)
- return (ISC_R_NOMEMORY);
- dbi->db = NULL;
- dbi->filename = NULL;
- dbi->table = NULL;
-
- STRDUP_OR_FAIL(dbi->filename, argv[0]);
- STRDUP_OR_FAIL(dbi->table, argv[1]);
-
- result = db_connect(dbi);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- *dbdata = dbi;
- return (ISC_R_SUCCESS);
-
-cleanup:
- sqlitedb_destroy(zone, driverdata, (void **)&dbi);
- return (result);
-}
-
-
-/*
- * Since the SQL database corresponds to a zone, the authority data should
- * be returned by the lookup() function. Therefore the authority() function
- * is NULL.
- */
-static dns_sdbmethods_t sqlitedb_methods = {
- sqlitedb_lookup,
- NULL, /* authority */
- sqlitedb_allnodes,
- sqlitedb_create,
- sqlitedb_destroy
-};
-
-
-/*
- * Wrapper around dns_sdb_register().
- */
-isc_result_t
-sqlitedb_init(void)
-{
- unsigned int flags;
- flags = 0;
- return (dns_sdb_register("sqlite", &sqlitedb_methods, NULL, flags,
- ns_g_mctx, &sqlitedb));
-}
-
-
-/*
- * Wrapper around dns_sdb_unregister().
- */
-void
-sqlitedb_clear(void)
-{
- if (sqlitedb != NULL)
- dns_sdb_unregister(&sqlitedb);
-}
diff --git a/contrib/sdb/sqlite/sqlitedb.h b/contrib/sdb/sqlite/sqlitedb.h
deleted file mode 100644
index e08c1ff4..00000000
--- a/contrib/sdb/sqlite/sqlitedb.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2000-2002 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.
- */
-
-/* $Id: sqlitedb.h,v 1.1.4.1 2007/03/05 05:36:58 marka Exp $ */
-
-#include <isc/types.h>
-
-isc_result_t sqlitedb_init(void);
-
-void sqlitedb_clear(void);
-
diff --git a/contrib/sdb/sqlite/zone2sqlite.c b/contrib/sdb/sqlite/zone2sqlite.c
deleted file mode 100644
index 40ff0e6f..00000000
--- a/contrib/sdb/sqlite/zone2sqlite.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-/* $Id: zone2sqlite.c,v 1.1.4.1 2007/03/05 05:36:58 marka Exp $ */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <isc/buffer.h>
-#include <isc/mem.h>
-#include <isc/print.h>
-#include <isc/result.h>
-
-#include <dns/db.h>
-#include <dns/dbiterator.h>
-#include <dns/fixedname.h>
-#include <dns/name.h>
-#include <dns/rdata.h>
-#include <dns/rdataset.h>
-#include <dns/rdatasetiter.h>
-#include <dns/rdatatype.h>
-#include <dns/result.h>
-
-#include <sqlite3.h>
-
-#ifndef UNUSED
-#define UNUSED(x) (x) = (x)
-#endif
-
-/*
- * Generate an SQLite table from a zone.
- */
-
-typedef struct _dbinfo {
- sqlite3 *db;
- char *filename;
- char *table;
-} dbinfo_t;
-
-dbinfo_t dbi = { NULL, NULL, NULL };
-
-
-static void
-closeandexit(int status)
-{
- if (dbi.db) {
- sqlite3_close(dbi.db);
- dbi.db = NULL;
- }
- exit(status);
-}
-
-static void
-check_result(isc_result_t result, const char *message)
-{
- if (result != ISC_R_SUCCESS) {
- fprintf(stderr, "%s: %s\n", message,
- isc_result_totext(result));
- closeandexit(1);
- }
-}
-
-static isc_result_t
-db_connect(dbinfo_t *dbi)
-{
- if (sqlite3_open(dbi->filename, &dbi->db) == SQLITE_OK) {
- return (ISC_R_SUCCESS);
- } else {
- /* a connection is returned even if the open fails */
- sqlite3_close(dbi->db);
- dbi->db = NULL;
- return (ISC_R_FAILURE);
- }
-}
-
-static int
-add_rdata_cb(void *parm, int cc, char **cv, char **cn)
-{
- UNUSED(parm);
- UNUSED(cc);
- UNUSED(cv);
- UNUSED(cn);
-
- return 0;
-}
-
-
-static void
-addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
-{
- unsigned char namearray[DNS_NAME_MAXTEXT + 1];
- unsigned char typearray[20];
- unsigned char dataarray[2048];
- isc_buffer_t b;
- isc_result_t result;
- char *sql;
- char *errmsg = NULL;
- int res;
-
- isc_buffer_init(&b, namearray, sizeof(namearray) - 1);
- result = dns_name_totext(name, ISC_TRUE, &b);
- check_result(result, "dns_name_totext");
- namearray[isc_buffer_usedlength(&b)] = 0;
-
- isc_buffer_init(&b, typearray, sizeof(typearray) - 1);
- result = dns_rdatatype_totext(rdata->type, &b);
- check_result(result, "dns_rdatatype_totext");
- typearray[isc_buffer_usedlength(&b)] = 0;
-
- isc_buffer_init(&b, dataarray, sizeof(dataarray) - 1);
- result = dns_rdata_totext(rdata, NULL, &b);
- check_result(result, "dns_rdata_totext");
- dataarray[isc_buffer_usedlength(&b)] = 0;
-
- sql = sqlite3_mprintf(
- "INSERT INTO %q (NAME, TTL, RDTYPE, RDATA)"
- " VALUES ('%q', %d, '%q', '%q') ",
- dbi.table,
- namearray, ttl, typearray, dataarray);
- printf("%s\n", sql);
- res = sqlite3_exec(dbi.db, sql, add_rdata_cb, NULL, &errmsg);
- sqlite3_free(sql);
-
- if (result != SQLITE_OK) {
- fprintf(stderr, "INSERT failed: %s\n", errmsg);
- closeandexit(1);
- }
-}
-
-int
-main(int argc, char *argv[])
-{
- char *sql;
- int res;
- char *errmsg = NULL;
- char *porigin, *zonefile;
- dns_fixedname_t forigin, fname;
- dns_name_t *origin, *name;
- dns_db_t *db = NULL;
- dns_dbiterator_t *dbiter;
- dns_dbnode_t *node;
- dns_rdatasetiter_t *rdsiter;
- dns_rdataset_t rdataset;
- dns_rdata_t rdata = DNS_RDATA_INIT;
- isc_mem_t *mctx = NULL;
- isc_buffer_t b;
- isc_result_t result;
-
- if (argc != 5) {
- printf("usage: %s <zone> <zonefile> <dbfile> <dbtable>\n", argv[0]);
- exit(1);
- }
-
- porigin = argv[1];
- zonefile = argv[2];
-
- dbi.filename = argv[3];
- dbi.table = argv[4];
-
- dns_result_register();
-
- mctx = NULL;
- result = isc_mem_create(0, 0, &mctx);
- check_result(result, "isc_mem_create");
-
- isc_buffer_init(&b, porigin, strlen(porigin));
- isc_buffer_add(&b, strlen(porigin));
- dns_fixedname_init(&forigin);
- origin = dns_fixedname_name(&forigin);
- result = dns_name_fromtext(origin, &b, dns_rootname, ISC_FALSE, NULL);
- check_result(result, "dns_name_fromtext");
-
- db = NULL;
- result = dns_db_create(mctx, "rbt", origin, dns_dbtype_zone,
- dns_rdataclass_in, 0, NULL, &db);
- check_result(result, "dns_db_create");
-
- result = dns_db_load(db, zonefile);
- if (result == DNS_R_SEENINCLUDE)
- result = ISC_R_SUCCESS;
- check_result(result, "dns_db_load");
-
- printf("Connecting to '%s'\n", dbi.filename);
-
- if ((result = db_connect(&dbi)) != ISC_R_SUCCESS) {
- fprintf(stderr, "Connection to database '%s' failed\n",
- dbi.filename);
- closeandexit(1);
- }
-
- sql = sqlite3_mprintf("DROP TABLE %q ", dbi.table);
- printf("%s\n", sql);
- res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
- sqlite3_free(sql);
-#if 0
- if (res != SQLITE_OK) {
- fprintf(stderr, "DROP TABLE %s failed: %s\n",
- dbi.table, errmsg);
- }
-#endif
-
-#if 0
- sql = sqlite3_mprintf(sql, "BEGIN TRANSACTION");
- printf("%s\n", sql);
- res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
- sqlite3_free(sql);
- if (res != SQLITE_OK) {
- fprintf(stderr, "BEGIN TRANSACTION failed: %s\n", errmsg);
- closeandexit(1);
- }
-#endif
-
- sql = sqlite3_mprintf(
- "CREATE TABLE %q "
- "(NAME TEXT, TTL INTEGER, RDTYPE TEXT, RDATA TEXT) ",
- dbi.table);
- printf("%s\n", sql);
- res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
- sqlite3_free(sql);
- if (res != SQLITE_OK) {
- fprintf(stderr, "CREATE TABLE %s failed: %s\n",
- dbi.table, errmsg);
- closeandexit(1);
- }
-
- dbiter = NULL;
- result = dns_db_createiterator(db, ISC_FALSE, &dbiter);
- check_result(result, "dns_db_createiterator()");
-
- result = dns_dbiterator_first(dbiter);
- check_result(result, "dns_dbiterator_first");
-
- dns_fixedname_init(&fname);
- name = dns_fixedname_name(&fname);
- dns_rdataset_init(&rdataset);
- dns_rdata_init(&rdata);
-
- while (result == ISC_R_SUCCESS) {
- node = NULL;
- result = dns_dbiterator_current(dbiter, &node, name);
- if (result == ISC_R_NOMORE)
- break;
- check_result(result, "dns_dbiterator_current");
-
- rdsiter = NULL;
- result = dns_db_allrdatasets(db, node, NULL, 0, &rdsiter);
- check_result(result, "dns_db_allrdatasets");
-
- result = dns_rdatasetiter_first(rdsiter);
-
- while (result == ISC_R_SUCCESS) {
- dns_rdatasetiter_current(rdsiter, &rdataset);
- result = dns_rdataset_first(&rdataset);
- check_result(result, "dns_rdataset_first");
- while (result == ISC_R_SUCCESS) {
- dns_rdataset_current(&rdataset, &rdata);
- addrdata(name, rdataset.ttl, &rdata);
- dns_rdata_reset(&rdata);
- result = dns_rdataset_next(&rdataset);
- }
- dns_rdataset_disassociate(&rdataset);
- result = dns_rdatasetiter_next(rdsiter);
- }
- dns_rdatasetiter_destroy(&rdsiter);
- dns_db_detachnode(db, &node);
- result = dns_dbiterator_next(dbiter);
- }
-
-#if 0
- sql = sqlite3_mprintf(sql, "COMMIT TRANSACTION ");
- printf("%s\n", sql);
- res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
- sqlite3_free(sql);
- if (res != SQLITE_OK) {
- fprintf(stderr, "COMMIT TRANSACTION failed: %s\n", errmsg);
- closeandexit(1);
- }
-#endif
-
- dns_dbiterator_destroy(&dbiter);
- dns_db_detach(&db);
- isc_mem_destroy(&mctx);
-
- closeandexit(0);
-
- exit(0);
-}
diff --git a/contrib/sdb/tcl/lookup.tcl b/contrib/sdb/tcl/lookup.tcl
index fa1a39cc..6e940555 100644
--- a/contrib/sdb/tcl/lookup.tcl
+++ b/contrib/sdb/tcl/lookup.tcl
@@ -1,5 +1,5 @@
# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
-# Copyright (C) 2000-2002 Internet Software Consortium.
+# Copyright (C) 2000, 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
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: lookup.tcl,v 1.7.4.3 2004/03/09 06:10:35 marka Exp $
+# $Id: lookup.tcl,v 1.7.4.2.8.2 2004/03/08 09:04:23 marka Exp $
#
# Sample lookup procedure for tcldb
diff --git a/contrib/sdb/tcl/tcldb.c b/contrib/sdb/tcl/tcldb.c
index afda56bf..7866c871 100644
--- a/contrib/sdb/tcl/tcldb.c
+++ b/contrib/sdb/tcl/tcldb.c
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tcldb.c,v 1.7.4.5 2007/01/18 00:06:02 marka Exp $ */
+/* $Id: tcldb.c,v 1.7.4.2.8.2 2004/03/08 09:04:23 marka Exp $ */
/*
* A simple database driver that calls a Tcl procedure to define
diff --git a/contrib/sdb/tcl/tcldb.h b/contrib/sdb/tcl/tcldb.h
index 32aa20c1..60f4a71f 100644
--- a/contrib/sdb/tcl/tcldb.h
+++ b/contrib/sdb/tcl/tcldb.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tcldb.h,v 1.4.4.3 2004/03/09 06:10:36 marka Exp $ */
+/* $Id: tcldb.h,v 1.4.4.2.8.2 2004/03/08 09:04:23 marka Exp $ */
#include <isc/types.h>
diff --git a/contrib/sdb/time/timedb.c b/contrib/sdb/time/timedb.c
index 117ac71f..8455dedc 100644
--- a/contrib/sdb/time/timedb.c
+++ b/contrib/sdb/time/timedb.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timedb.c,v 1.7.4.3 2004/03/09 06:10:36 marka Exp $ */
+/* $Id: timedb.c,v 1.7.4.2.8.2 2004/03/08 09:04:23 marka Exp $ */
/*
* A simple database driver that enables the server to return the
diff --git a/contrib/sdb/time/timedb.h b/contrib/sdb/time/timedb.h
index 9fd48de5..f7b16bf1 100644
--- a/contrib/sdb/time/timedb.h
+++ b/contrib/sdb/time/timedb.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000, 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
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timedb.h,v 1.2.4.3 2004/03/09 06:10:36 marka Exp $ */
+/* $Id: timedb.h,v 1.2.4.2.8.2 2004/03/08 09:04:24 marka Exp $ */
#include <isc/types.h>