|
|
bc5dde |
--- bind-9.3.2b2/contrib/sdb/ldap/zone2ldap.c.sdbsrc 2005-08-16 00:43:03.000000000 -0400
|
|
|
bc5dde |
+++ bind-9.3.2b2/contrib/sdb/ldap/zone2ldap.c 2005-11-15 12:57:44.000000000 -0500
|
|
|
bc5dde |
@@ -59,16 +59,16 @@
|
|
|
bc5dde |
ldap_info;
|
|
|
bc5dde |
|
|
|
bc5dde |
/* usage Info */
|
|
|
bc5dde |
-void usage ();
|
|
|
bc5dde |
+void usage (void);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Add to the ldap dit */
|
|
|
bc5dde |
void add_ldap_values (ldap_info * ldinfo);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Init an ldap connection */
|
|
|
bc5dde |
-void init_ldap_conn ();
|
|
|
bc5dde |
+void init_ldap_conn (void);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Ldap error checking */
|
|
|
bc5dde |
-void ldap_result_check (char *msg, char *dn, int err);
|
|
|
bc5dde |
+void ldap_result_check (const char *msg, char *dn, int err);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Put a hostname into a char ** array */
|
|
|
bc5dde |
char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags);
|
|
|
bc5dde |
@@ -84,7 +84,7 @@
|
|
|
bc5dde |
unsigned int ttl, unsigned int flags);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Error checking */
|
|
|
bc5dde |
-void isc_result_check (isc_result_t res, char *errorstr);
|
|
|
bc5dde |
+void isc_result_check (isc_result_t res, const char *errorstr);
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Generate LDIF Format files */
|
|
|
bc5dde |
void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
|
|
|
bc5dde |
@@ -93,11 +93,17 @@
|
|
|
bc5dde |
/* head pointer to the list */
|
|
|
bc5dde |
ldap_info *ldap_info_base = NULL;
|
|
|
bc5dde |
|
|
|
bc5dde |
+ldap_info *
|
|
|
bc5dde |
+locate_by_dn (char *dn);
|
|
|
bc5dde |
+void
|
|
|
bc5dde |
+init_ldap_conn ();
|
|
|
bc5dde |
+void usage();
|
|
|
bc5dde |
+
|
|
|
bc5dde |
char *argzone, *ldapbase, *binddn, *bindpw = NULL;
|
|
|
bc5dde |
-char *ldapsystem = "localhost";
|
|
|
bc5dde |
-static char *objectClasses[] =
|
|
|
bc5dde |
+const char *ldapsystem = "localhost";
|
|
|
bc5dde |
+static const char *objectClasses[] =
|
|
|
bc5dde |
{ "top", "dNSZone", NULL };
|
|
|
bc5dde |
-static char *topObjectClasses[] = { "top", NULL };
|
|
|
bc5dde |
+static const char *topObjectClasses[] = { "top", NULL };
|
|
|
bc5dde |
LDAP *conn;
|
|
|
bc5dde |
unsigned int debug = 0;
|
|
|
bc5dde |
|
|
|
bc5dde |
@@ -106,7 +112,7 @@
|
|
|
bc5dde |
#endif
|
|
|
bc5dde |
|
|
|
bc5dde |
int
|
|
|
bc5dde |
-main (int *argc, char **argv)
|
|
|
bc5dde |
+main (int argc, char **argv)
|
|
|
bc5dde |
{
|
|
|
bc5dde |
isc_mem_t *mctx = NULL;
|
|
|
bc5dde |
isc_entropy_t *ectx = NULL;
|
|
|
bc5dde |
@@ -116,7 +122,7 @@
|
|
|
bc5dde |
LDAPMod *base_attrs[2];
|
|
|
bc5dde |
LDAPMod base;
|
|
|
bc5dde |
isc_buffer_t buff;
|
|
|
bc5dde |
- char *zonefile;
|
|
|
bc5dde |
+ char *zonefile=0L;
|
|
|
bc5dde |
char fullbasedn[1024];
|
|
|
bc5dde |
char *ctmp;
|
|
|
bc5dde |
dns_fixedname_t fixedzone, fixedname;
|
|
|
bc5dde |
@@ -280,9 +286,9 @@
|
|
|
bc5dde |
if ((*ctmp == ',') || (ctmp == &basedn[0]))
|
|
|
bc5dde |
{
|
|
|
bc5dde |
base.mod_op = LDAP_MOD_ADD;
|
|
|
bc5dde |
- base.mod_type = "objectClass";
|
|
|
bc5dde |
- base.mod_values = topObjectClasses;
|
|
|
bc5dde |
- base_attrs[0] = &bas;;
|
|
|
bc5dde |
+ base.mod_type = (char*)"objectClass";
|
|
|
bc5dde |
+ base.mod_values = (char**)topObjectClasses;
|
|
|
bc5dde |
+ base_attrs[0] = (void*)&bas;;
|
|
|
bc5dde |
base_attrs[1] = NULL;
|
|
|
bc5dde |
|
|
|
bc5dde |
if (ldapbase)
|
|
|
bc5dde |
@@ -337,7 +343,7 @@
|
|
|
bc5dde |
* I should probably rename this function, as not to cause any
|
|
|
bc5dde |
* confusion with the isc* routines. Will exit on error. */
|
|
|
bc5dde |
void
|
|
|
bc5dde |
-isc_result_check (isc_result_t res, char *errorstr)
|
|
|
bc5dde |
+isc_result_check (isc_result_t res, const char *errorstr)
|
|
|
bc5dde |
{
|
|
|
bc5dde |
if (res != ISC_R_SUCCESS)
|
|
|
bc5dde |
{
|
|
|
bc5dde |
@@ -449,7 +455,7 @@
|
|
|
bc5dde |
exit (-1);
|
|
|
bc5dde |
}
|
|
|
bc5dde |
|
|
|
bc5dde |
- for (i = 0; i < flags; i++)
|
|
|
bc5dde |
+ for (i = 0; i < (int)flags; i++)
|
|
|
bc5dde |
{
|
|
|
bc5dde |
tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod));
|
|
|
bc5dde |
if (tmp->attrs[i] == (LDAPMod *) NULL)
|
|
|
bc5dde |
@@ -459,13 +465,13 @@
|
|
|
bc5dde |
}
|
|
|
bc5dde |
}
|
|
|
bc5dde |
tmp->attrs[0]->mod_op = LDAP_MOD_ADD;
|
|
|
bc5dde |
- tmp->attrs[0]->mod_type = "objectClass";
|
|
|
bc5dde |
+ tmp->attrs[0]->mod_type = (char*)"objectClass";
|
|
|
bc5dde |
|
|
|
bc5dde |
if (flags == DNS_OBJECT)
|
|
|
bc5dde |
- tmp->attrs[0]->mod_values = objectClasses;
|
|
|
bc5dde |
+ tmp->attrs[0]->mod_values = (char**)objectClasses;
|
|
|
bc5dde |
else
|
|
|
bc5dde |
{
|
|
|
bc5dde |
- tmp->attrs[0]->mod_values = topObjectClasses;
|
|
|
bc5dde |
+ tmp->attrs[0]->mod_values = (char**)topObjectClasses;
|
|
|
bc5dde |
tmp->attrs[1] = NULL;
|
|
|
bc5dde |
tmp->attrcnt = 2;
|
|
|
bc5dde |
tmp->next = ldap_info_base;
|
|
|
bc5dde |
@@ -474,7 +480,7 @@
|
|
|
bc5dde |
}
|
|
|
bc5dde |
|
|
|
bc5dde |
tmp->attrs[1]->mod_op = LDAP_MOD_ADD;
|
|
|
bc5dde |
- tmp->attrs[1]->mod_type = "relativeDomainName";
|
|
|
bc5dde |
+ tmp->attrs[1]->mod_type = (char*)"relativeDomainName";
|
|
|
bc5dde |
tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);
|
|
|
bc5dde |
|
|
|
bc5dde |
if (tmp->attrs[1]->mod_values == (char **)NULL)
|
|
|
bc5dde |
@@ -496,7 +502,7 @@
|
|
|
bc5dde |
tmp->attrs[2]->mod_values[1] = NULL;
|
|
|
bc5dde |
|
|
|
bc5dde |
tmp->attrs[3]->mod_op = LDAP_MOD_ADD;
|
|
|
bc5dde |
- tmp->attrs[3]->mod_type = "dNSTTL";
|
|
|
bc5dde |
+ tmp->attrs[3]->mod_type = (char*)"dNSTTL";
|
|
|
bc5dde |
tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);
|
|
|
bc5dde |
|
|
|
bc5dde |
if (tmp->attrs[3]->mod_values == (char **)NULL)
|
|
|
bc5dde |
@@ -507,7 +513,7 @@
|
|
|
bc5dde |
tmp->attrs[3]->mod_values[1] = NULL;
|
|
|
bc5dde |
|
|
|
bc5dde |
tmp->attrs[4]->mod_op = LDAP_MOD_ADD;
|
|
|
bc5dde |
- tmp->attrs[4]->mod_type = "zoneName";
|
|
|
bc5dde |
+ tmp->attrs[4]->mod_type = (char*)"zoneName";
|
|
|
bc5dde |
tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);
|
|
|
bc5dde |
tmp->attrs[4]->mod_values[0] = gbl_zone;
|
|
|
bc5dde |
tmp->attrs[4]->mod_values[1] = NULL;
|
|
|
bc5dde |
@@ -607,7 +613,7 @@
|
|
|
bc5dde |
zname = ++tmp;
|
|
|
bc5dde |
}
|
|
|
bc5dde |
else
|
|
|
bc5dde |
- hnamebuff = "@";
|
|
|
bc5dde |
+ hnamebuff = (char*)"@";
|
|
|
bc5dde |
}
|
|
|
bc5dde |
else
|
|
|
bc5dde |
{
|
|
|
bc5dde |
@@ -686,12 +692,12 @@
|
|
|
bc5dde |
}
|
|
|
bc5dde |
|
|
|
bc5dde |
result = ldap_simple_bind_s (conn, binddn, bindpw);
|
|
|
bc5dde |
- ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result);
|
|
|
bc5dde |
+ ldap_result_check ("ldap_simple_bind_s", (char*)"LDAP Bind", result);
|
|
|
bc5dde |
}
|
|
|
bc5dde |
|
|
|
bc5dde |
/* Like isc_result_check, only for LDAP */
|
|
|
bc5dde |
void
|
|
|
bc5dde |
-ldap_result_check (char *msg, char *dn, int err)
|
|
|
bc5dde |
+ldap_result_check (const char *msg, char *dn, int err)
|
|
|
bc5dde |
{
|
|
|
bc5dde |
if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS))
|
|
|
bc5dde |
{
|
|
|
bc5dde |
@@ -730,5 +736,8 @@
|
|
|
bc5dde |
usage ()
|
|
|
bc5dde |
{
|
|
|
bc5dde |
fprintf (stderr,
|
|
|
bc5dde |
- "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]
|
|
|
bc5dde |
- [-c Create LDAP Base structure][-d Debug Output (lots !)] \n ");}
|
|
|
bc5dde |
+ "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]\n"
|
|
|
bc5dde |
+ "\t[-c Create LDAP Base structure][-d Debug Output (lots !)]\n "
|
|
|
bc5dde |
+ );
|
|
|
bc5dde |
+}
|
|
|
bc5dde |
+
|
|
|
bc5dde |
--- bind-9.3.2b2/contrib/sdb/bdb/bdb.c.sdbsrc 2002-07-02 00:45:34.000000000 -0400
|
|
|
bc5dde |
+++ bind-9.3.2b2/contrib/sdb/bdb/bdb.c 2005-11-15 12:57:44.000000000 -0500
|
|
|
bc5dde |
@@ -43,7 +43,7 @@
|
|
|
bc5dde |
#include <dns/lib.h>
|
|
|
bc5dde |
#include <dns/ttl.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
-#include <named/bdb.h>
|
|
|
bc5dde |
+#include "bdb.h"
|
|
|
bc5dde |
#include <named/globals.h>
|
|
|
bc5dde |
#include <named/config.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
--- bind-9.3.2b2/contrib/sdb/pgsql/pgsqldb.c.sdbsrc 2004-03-08 04:04:22.000000000 -0500
|
|
|
bc5dde |
+++ bind-9.3.2b2/contrib/sdb/pgsql/pgsqldb.c 2005-11-15 12:57:44.000000000 -0500
|
|
|
bc5dde |
@@ -23,7 +23,7 @@
|
|
|
bc5dde |
#include <string.h>
|
|
|
bc5dde |
#include <stdlib.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
-#include <pgsql/libpq-fe.h>
|
|
|
bc5dde |
+#include <libpq-fe.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
#include <isc/mem.h>
|
|
|
bc5dde |
#include <isc/print.h>
|
|
|
bc5dde |
--- bind-9.3.2b2/contrib/sdb/pgsql/zonetodb.c.sdbsrc 2005-09-05 22:12:40.000000000 -0400
|
|
|
bc5dde |
+++ bind-9.3.2b2/contrib/sdb/pgsql/zonetodb.c 2005-11-15 12:58:12.000000000 -0500
|
|
|
bc5dde |
@@ -37,7 +37,7 @@
|
|
|
bc5dde |
#include <dns/rdatatype.h>
|
|
|
bc5dde |
#include <dns/result.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
-#include <pgsql/libpq-fe.h>
|
|
|
bc5dde |
+#include <libpq-fe.h>
|
|
|
bc5dde |
|
|
|
bc5dde |
/*
|
|
|
bc5dde |
* Generate a PostgreSQL table from a zone.
|
|
|
bc5dde |
@@ -54,6 +54,9 @@
|
|
|
bc5dde |
char str[10240];
|
|
|
bc5dde |
|
|
|
bc5dde |
void
|
|
|
bc5dde |
+closeandexit(int status);
|
|
|
bc5dde |
+
|
|
|
bc5dde |
+void
|
|
|
bc5dde |
closeandexit(int status) {
|
|
|
bc5dde |
if (conn != NULL)
|
|
|
bc5dde |
PQfinish(conn);
|
|
|
bc5dde |
@@ -61,6 +64,9 @@
|
|
|
bc5dde |
}
|
|
|
bc5dde |
|
|
|
bc5dde |
void
|
|
|
bc5dde |
+check_result(isc_result_t result, const char *message);
|
|
|
bc5dde |
+
|
|
|
bc5dde |
+void
|
|
|
bc5dde |
check_result(isc_result_t result, const char *message) {
|
|
|
bc5dde |
if (result != ISC_R_SUCCESS) {
|
|
|
bc5dde |
fprintf(stderr, "%s: %s\n", message,
|
|
|
bc5dde |
@@ -84,7 +90,8 @@
|
|
|
bc5dde |
}
|
|
|
bc5dde |
*dest++ = 0;
|
|
|
bc5dde |
}
|
|
|
bc5dde |
-
|
|
|
bc5dde |
+void
|
|
|
bc5dde |
+addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata);
|
|
|
bc5dde |
void
|
|
|
bc5dde |
addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) {
|
|
|
bc5dde |
unsigned char namearray[DNS_NAME_MAXTEXT + 1];
|