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