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