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