2e2c49
diff --git a/contrib/sdb/bdb/bdb.c b/contrib/sdb/bdb/bdb.c
2e2c49
index 23594bb..b3c6619 100644
2e2c49
--- a/contrib/sdb/bdb/bdb.c
2e2c49
+++ b/contrib/sdb/bdb/bdb.c
2e2c49
@@ -43,7 +43,7 @@
2e2c49
 #include <dns/lib.h>
2e2c49
 #include <dns/ttl.h>
2e2c49
 
2e2c49
-#include <named/bdb.h>
2e2c49
+#include "bdb.h"
2e2c49
 #include <named/globals.h>
2e2c49
 #include <named/config.h>
2e2c49
 
2e2c49
diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c
2e2c49
index 07c89bc..23dd873 100644
2e2c49
--- a/contrib/sdb/ldap/zone2ldap.c
2e2c49
+++ b/contrib/sdb/ldap/zone2ldap.c
2e2c49
@@ -63,16 +63,16 @@ typedef struct LDAP_INFO
2e2c49
 ldap_info;
2e2c49
 
2e2c49
 /* usage Info */
2e2c49
-void usage ();
2e2c49
+void usage (void);
2e2c49
 
2e2c49
 /* Add to the ldap dit */
2e2c49
 void add_ldap_values (ldap_info * ldinfo);
2e2c49
 
2e2c49
 /* Init an ldap connection */
2e2c49
-void init_ldap_conn ();
2e2c49
+void init_ldap_conn (void);
2e2c49
 
2e2c49
 /* Ldap error checking */
2e2c49
-void ldap_result_check (char *msg, char *dn, int err);
2e2c49
+void ldap_result_check (const char *msg, char *dn, int err);
2e2c49
 
2e2c49
 /* Put a hostname into a char ** array */
2e2c49
 char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags);
2e2c49
@@ -88,7 +88,7 @@ void add_to_rr_list (char *dn, char *name, char *type, char *data,
2e2c49
 		     unsigned int ttl, unsigned int flags);
2e2c49
 
2e2c49
 /* Error checking */
2e2c49
-void isc_result_check (isc_result_t res, char *errorstr);
2e2c49
+void isc_result_check (isc_result_t res, const char *errorstr);
2e2c49
 
2e2c49
 /* Generate LDIF Format files */
2e2c49
 void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
2e2c49
@@ -97,11 +97,17 @@ void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
2e2c49
 /* head pointer to the list */
2e2c49
 ldap_info *ldap_info_base = NULL;
2e2c49
 
2e2c49
+ldap_info *
2e2c49
+locate_by_dn (char *dn);
2e2c49
+void
2e2c49
+init_ldap_conn ();
2e2c49
+void usage();
2e2c49
+
2e2c49
 char *argzone, *ldapbase, *binddn, *bindpw = NULL;
2e2c49
-char *ldapsystem = "localhost";
2e2c49
-static char *objectClasses[] =
2e2c49
+const char *ldapsystem = "localhost";
2e2c49
+static const char *objectClasses[] =
2e2c49
   { "top", "dNSZone", NULL };
2e2c49
-static char *topObjectClasses[] = { "top", NULL };
2e2c49
+static const char *topObjectClasses[] = { "top", NULL };
2e2c49
 LDAP *conn;
2e2c49
 unsigned int debug = 0;
2e2c49
 
2e2c49
@@ -128,7 +134,7 @@ main (int argc, char **argv)
2e2c49
   LDAPMod *base_attrs[2];
2e2c49
   LDAPMod base;
2e2c49
   isc_buffer_t buff;
2e2c49
-  char *zonefile;
2e2c49
+  char *zonefile=0L;
2e2c49
   char fullbasedn[1024];
2e2c49
   char *ctmp;
2e2c49
   dns_fixedname_t fixedzone, fixedname;
2e2c49
@@ -304,9 +310,9 @@ main (int argc, char **argv)
2e2c49
 	  if ((*ctmp == ',') || (ctmp == &basedn[0]))
2e2c49
 	    {
2e2c49
 	      base.mod_op = LDAP_MOD_ADD;
2e2c49
-	      base.mod_type = "objectClass";
2e2c49
-	      base.mod_values = topObjectClasses;
2e2c49
-	      base_attrs[0] = &bas;;
2e2c49
+	      base.mod_type = (char*)"objectClass";
2e2c49
+	      base.mod_values = (char**)topObjectClasses;
2e2c49
+	      base_attrs[0] = (void*)&bas;;
2e2c49
 	      base_attrs[1] = NULL;
2e2c49
 
2e2c49
 	      if (ldapbase)
2e2c49
@@ -363,7 +369,7 @@ main (int argc, char **argv)
2e2c49
  * I should probably rename this function, as not to cause any
2e2c49
  * confusion with the isc* routines. Will exit on error. */
2e2c49
 void
2e2c49
-isc_result_check (isc_result_t res, char *errorstr)
2e2c49
+isc_result_check (isc_result_t res, const char *errorstr)
2e2c49
 {
2e2c49
   if (res != ISC_R_SUCCESS)
2e2c49
     {
2e2c49
@@ -470,20 +476,20 @@ add_to_rr_list (char *dn, char *name, char *type,
2e2c49
       if (tmp->attrs == (LDAPMod **) NULL)
2e2c49
 	fatal("calloc");
2e2c49
 
2e2c49
-      for (i = 0; i < flags; i++)
2e2c49
+      for (i = 0; i < (int)flags; i++)
2e2c49
 	{
2e2c49
 	  tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod));
2e2c49
 	  if (tmp->attrs[i] == (LDAPMod *) NULL)
2e2c49
 	    fatal("malloc");
2e2c49
 	}
2e2c49
       tmp->attrs[0]->mod_op = LDAP_MOD_ADD;
2e2c49
-      tmp->attrs[0]->mod_type = "objectClass";
2e2c49
+      tmp->attrs[0]->mod_type = (char*)"objectClass";
2e2c49
 
2e2c49
       if (flags == DNS_OBJECT)
2e2c49
-	tmp->attrs[0]->mod_values = objectClasses;
2e2c49
+	tmp->attrs[0]->mod_values = (char**)objectClasses;
2e2c49
       else
2e2c49
 	{
2e2c49
-	  tmp->attrs[0]->mod_values = topObjectClasses;
2e2c49
+	  tmp->attrs[0]->mod_values = (char**)topObjectClasses;
2e2c49
 	  tmp->attrs[1] = NULL;
2e2c49
 	  tmp->attrcnt = 2;
2e2c49
 	  tmp->next = ldap_info_base;
2e2c49
@@ -492,7 +498,7 @@ add_to_rr_list (char *dn, char *name, char *type,
2e2c49
 	}
2e2c49
 
2e2c49
       tmp->attrs[1]->mod_op = LDAP_MOD_ADD;
2e2c49
-      tmp->attrs[1]->mod_type = "relativeDomainName";
2e2c49
+      tmp->attrs[1]->mod_type = (char*)"relativeDomainName";
2e2c49
       tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);
2e2c49
 
2e2c49
       if (tmp->attrs[1]->mod_values == (char **)NULL)
2e2c49
@@ -521,7 +527,7 @@ add_to_rr_list (char *dn, char *name, char *type,
2e2c49
 	 fatal("strdup");
2e2c49
 
2e2c49
       tmp->attrs[3]->mod_op = LDAP_MOD_ADD;
2e2c49
-      tmp->attrs[3]->mod_type = "dNSTTL";
2e2c49
+      tmp->attrs[3]->mod_type = (char*)"dNSTTL";
2e2c49
       tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);
2e2c49
 
2e2c49
       if (tmp->attrs[3]->mod_values == (char **)NULL)
2e2c49
@@ -535,7 +541,7 @@ add_to_rr_list (char *dn, char *name, char *type,
2e2c49
 	 fatal("strdup");
2e2c49
 
2e2c49
       tmp->attrs[4]->mod_op = LDAP_MOD_ADD;
2e2c49
-      tmp->attrs[4]->mod_type = "zoneName";
2e2c49
+      tmp->attrs[4]->mod_type = (char*)"zoneName";
2e2c49
       tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);
2e2c49
 
2e2c49
       if (tmp->attrs[4]->mod_values == (char **)NULL)
2e2c49
@@ -648,7 +654,7 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)
2e2c49
 	  zname = ++tmp;
2e2c49
 	}
2e2c49
       else
2e2c49
-	hnamebuff = "@";
2e2c49
+	hnamebuff = (char*)"@";
2e2c49
     }
2e2c49
   else
2e2c49
     {
2e2c49
@@ -727,12 +733,12 @@ init_ldap_conn ()
2e2c49
     }
2e2c49
 
2e2c49
   result = ldap_simple_bind_s (conn, binddn, bindpw);
2e2c49
-  ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result);
2e2c49
+  ldap_result_check ("ldap_simple_bind_s", (char*)"LDAP Bind", result);
2e2c49
 }
2e2c49
 
2e2c49
 /* Like isc_result_check, only for LDAP */
2e2c49
 void
2e2c49
-ldap_result_check (char *msg, char *dn, int err)
2e2c49
+ldap_result_check (const char *msg, char *dn, int err)
2e2c49
 {
2e2c49
   if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS))
2e2c49
     {
2e2c49
diff --git a/contrib/sdb/pgsql/pgsqldb.c b/contrib/sdb/pgsql/pgsqldb.c
2e2c49
index 50d3cba..516eb9f 100644
2e2c49
--- a/contrib/sdb/pgsql/pgsqldb.c
2e2c49
+++ b/contrib/sdb/pgsql/pgsqldb.c
2e2c49
@@ -23,7 +23,7 @@
2e2c49
 #include <string.h>
2e2c49
 #include <stdlib.h>
2e2c49
 
2e2c49
-#include <pgsql/libpq-fe.h>
2e2c49
+#include <libpq-fe.h>
2e2c49
 
2e2c49
 #include <isc/mem.h>
2e2c49
 #include <isc/print.h>
2e2c49
diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c
2e2c49
index b8f5912..ff2d135 100644
2e2c49
--- a/contrib/sdb/pgsql/zonetodb.c
2e2c49
+++ b/contrib/sdb/pgsql/zonetodb.c
2e2c49
@@ -37,7 +37,7 @@
2e2c49
 #include <dns/rdatatype.h>
2e2c49
 #include <dns/result.h>
2e2c49
 
2e2c49
-#include <pgsql/libpq-fe.h>
2e2c49
+#include <libpq-fe.h>
2e2c49
 
2e2c49
 /*
2e2c49
  * Generate a PostgreSQL table from a zone.
2e2c49
@@ -54,6 +54,9 @@ char *dbname, *dbtable;
2e2c49
 char str[10240];
2e2c49
 
2e2c49
 void
2e2c49
+closeandexit(int status);
2e2c49
+
2e2c49
+void
2e2c49
 closeandexit(int status) {
2e2c49
 	if (conn != NULL)
2e2c49
 		PQfinish(conn);
2e2c49
@@ -61,6 +64,9 @@ closeandexit(int status) {
2e2c49
 }
2e2c49
 
2e2c49
 void
2e2c49
+check_result(isc_result_t result, const char *message);
2e2c49
+
2e2c49
+void
2e2c49
 check_result(isc_result_t result, const char *message) {
2e2c49
 	if (result != ISC_R_SUCCESS) {
2e2c49
 		fprintf(stderr, "%s: %s\n", message,
2e2c49
@@ -84,7 +90,8 @@ quotestring(const unsigned char *source, unsigned char *dest) {
2e2c49
 	}
2e2c49
 	*dest++ = 0;
2e2c49
 }
2e2c49
-
2e2c49
+void
2e2c49
+addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata);
2e2c49
 void
2e2c49
 addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) {
2e2c49
 	unsigned char namearray[DNS_NAME_MAXTEXT + 1];