3ce7d3
diff --git a/contrib/sdb/bdb/bdb.c b/contrib/sdb/bdb/bdb.c
3ce7d3
index 23594bb..b3c6619 100644
3ce7d3
--- a/contrib/sdb/bdb/bdb.c
3ce7d3
+++ b/contrib/sdb/bdb/bdb.c
3ce7d3
@@ -43,7 +43,7 @@
3ce7d3
 #include <dns/lib.h>
3ce7d3
 #include <dns/ttl.h>
3ce7d3
 
3ce7d3
-#include <named/bdb.h>
3ce7d3
+#include "bdb.h"
3ce7d3
 #include <named/globals.h>
3ce7d3
 #include <named/config.h>
3ce7d3
 
3ce7d3
diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c
3ce7d3
index 07c89bc..23dd873 100644
3ce7d3
--- a/contrib/sdb/ldap/zone2ldap.c
3ce7d3
+++ b/contrib/sdb/ldap/zone2ldap.c
3ce7d3
@@ -63,16 +63,16 @@ typedef struct LDAP_INFO
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);
3ce7d3
@@ -88,7 +88,7 @@ void add_to_rr_list (char *dn, char *name, char *type, char *data,
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,
3ce7d3
@@ -97,11 +97,17 @@ void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
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
 
3ce7d3
@@ -128,7 +134,7 @@ main (int argc, char **argv)
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;
3ce7d3
@@ -304,9 +310,9 @@ main (int argc, char **argv)
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)
3ce7d3
@@ -363,7 +369,7 @@ main (int argc, char **argv)
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
     {
3ce7d3
@@ -470,20 +476,20 @@ add_to_rr_list (char *dn, char *name, char *type,
3ce7d3
       if (tmp->attrs == (LDAPMod **) NULL)
3ce7d3
 	fatal("calloc");
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)
3ce7d3
 	    fatal("malloc");
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;
3ce7d3
@@ -492,7 +498,7 @@ add_to_rr_list (char *dn, char *name, char *type,
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)
3ce7d3
@@ -521,7 +527,7 @@ add_to_rr_list (char *dn, char *name, char *type,
3ce7d3
 	 fatal("strdup");
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)
3ce7d3
@@ -535,7 +541,7 @@ add_to_rr_list (char *dn, char *name, char *type,
3ce7d3
 	 fatal("strdup");
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);
3ce7d3
 
3ce7d3
       if (tmp->attrs[4]->mod_values == (char **)NULL)
3ce7d3
@@ -648,7 +654,7 @@ hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)
bc5dde
 	  zname = ++tmp;
bc5dde
 	}
bc5dde
       else
bc5dde
-	hnamebuff = "@";
bc5dde
+	hnamebuff = (char*)"@";
bc5dde
     }
bc5dde
   else
bc5dde
     {
3ce7d3
@@ -727,12 +733,12 @@ init_ldap_conn ()
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
     {
3ce7d3
diff --git a/contrib/sdb/pgsql/pgsqldb.c b/contrib/sdb/pgsql/pgsqldb.c
3ce7d3
index 50d3cba..516eb9f 100644
3ce7d3
--- a/contrib/sdb/pgsql/pgsqldb.c
3ce7d3
+++ b/contrib/sdb/pgsql/pgsqldb.c
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>
3ce7d3
diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c
3ce7d3
index b8f5912..ff2d135 100644
3ce7d3
--- a/contrib/sdb/pgsql/zonetodb.c
3ce7d3
+++ b/contrib/sdb/pgsql/zonetodb.c
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.
3ce7d3
@@ -54,6 +54,9 @@ char *dbname, *dbtable;
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);
3ce7d3
@@ -61,6 +64,9 @@ closeandexit(int status) {
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,
3ce7d3
@@ -84,7 +90,8 @@ quotestring(const unsigned char *source, unsigned char *dest) {
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];