From fc4f333b5f3f9fd330a15b9bfedd99d0c1a3e323 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Thu, 15 Aug 2013 15:01:22 -0600
Subject: [PATCH 2/3] fix compiler warnings

---
 lib/libadminutil/acclanglist.c |    6 ++--
 lib/libadminutil/admutil.c     |   67 +++------------------------------------
 lib/libadminutil/form_post.c   |    4 +-
 lib/libadminutil/psetc.c       |    3 +-
 lib/libadmsslutil/admsslutil.c |   13 --------
 5 files changed, 12 insertions(+), 81 deletions(-)

diff --git a/lib/libadminutil/acclanglist.c b/lib/libadminutil/acclanglist.c
index 903be02..671dfcc 100644
--- a/lib/libadminutil/acclanglist.c
+++ b/lib/libadminutil/acclanglist.c
@@ -54,8 +54,8 @@ AcceptLangList(const char* AcceptLanguage,
   char* cPtr;
   char* cPtr1;
   char* cPtr2;
-  int i;
-  int j;
+  size_t i;
+  size_t j;
   size_t countLang = 0;
   
   input = strdup(AcceptLanguage);
@@ -145,7 +145,7 @@ static int
 langIsInList(const char *lang, size_t listsize, ACCEPT_LANGUAGE_LIST accll)
 {
 	int retval = 0;
-	int ii;
+	size_t ii;
 
 	for (ii = 0; !retval && (ii < listsize); ++ii) {
 		if (!strcmp(lang, accll[ii])) {
diff --git a/lib/libadminutil/admutil.c b/lib/libadminutil/admutil.c
index b4e12dd..bf04c10 100644
--- a/lib/libadminutil/admutil.c
+++ b/lib/libadminutil/admutil.c
@@ -37,20 +37,6 @@
 #define strcasecmp stricmp
 #define strncasecmp _strnicmp
 #endif
-
-#ifdef XP_UNIX
-/*
- * Version information for the 'ident' and 'what commands
- *
- * NOTE: the first component of the concatenated rcsid string
- * must not end in a '$' to prevent rcs keyword substitution.
- */
-static char rcsid[] = "$Header: AdminUtil " ADMSDK_PRODUCT  
-        "  " ADMSDK_BUILDNUM " $";
-static char sccsid[] = "@(#)AdminUtil " ADMSDK_PRODUCT  
-		"  " ADMSDK_BUILDNUM;
-#endif /* XP_UNIX */
-
  
 /* Max size for a pathname */
 #ifndef PATH_MAX
@@ -2286,17 +2272,19 @@ admutil_ldap_init(
 #if defined(USE_OPENLDAP)
       char *certdir = admldapGetSecurityDir(info);
       int optval = 0;
+#else
+      LDAP *myld = NULL;
 #endif /* !USE_OPENLDAP */
       int ssl_strength = 0;
-      LDAP *myld = NULL;
 
+#if !defined(USE_OPENLDAP)
       /* we can only use the set functions below with a real
          LDAP* if it has already gone through ldapssl_init -
          so, use NULL if using starttls */
       if (secure == 1) {
 		myld = ld;
       }
-
+#endif
 		/* verify certificate only */
 #if defined(USE_OPENLDAP)
       ssl_strength = LDAP_OPT_X_TLS_NEVER;
@@ -2414,55 +2402,12 @@ admutil_ldap_bind(
 {
   int rc = LDAP_SUCCESS;
   int err = LDAP_SUCCESS;
-  int secure = 0;
   struct berval bvcreds = {0, NULL};
   LDAPMessage *result = NULL;
   struct berval *servercredp = NULL;
-#if defined(USE_OPENLDAP)
-  /* openldap doesn't have a SSL/TLS yes/no flag - so grab the
-     ldapurl, parse it, and see if it is a secure one */
-  char *ldapurl = NULL;
 
-  ldap_get_option(ld, LDAP_OPT_URI, &ldapurl);
-  if (ldapurl && !PL_strncasecmp(ldapurl, "ldaps", 5)) {
-    secure = 1;
-  }
-  PL_strfree(ldapurl);
-  ldapurl = NULL;
-#else /* !USE_OPENLDAP */
-  ldap_get_option(ld, LDAP_OPT_SSL, &secure);
-#endif
-
-#ifdef EXTERNAL_AUTH_SUPPORTED
-  if (secure && mech && !strcmp(mech, LDAP_SASL_EXTERNAL)) {
-	/* SSL connections will use the server's security context
-	   and cert for client auth */
-	rc = slapd_SSL_client_auth(ld);
-
-	if (rc != 0) {
-#ifdef DEBUG
-      fprintf(stderr, "admutil_ldap_bind: "
-                      "Error: could not configure the server for cert "
-                      "auth - error %d - make sure the server is "
-                      "correctly configured for SSL/TLS\n", rc);
-#endif
-      goto done;
-	} else {
-#ifdef DEBUG
-      fprintf(stderr, "admutil_ldap_bind: "
-                      "Set up conn to use client auth\n");
-#endif
-    }
-	bvcreds.bv_val = NULL; /* ignore username and passed in creds */
-	bvcreds.bv_len = 0; /* for external auth */
-	bindid = NULL;
-  } else { /* other type of auth */
-#endif /* EXTERNAL_AUTH_SUPPORTED */
-	bvcreds.bv_val = (char *)creds;
-	bvcreds.bv_len = creds ? strlen(creds) : 0;
-#ifdef EXTERNAL_AUTH_SUPPORTED
-  }
-#endif /* EXTERNAL_AUTH_SUPPORTED */
+  bvcreds.bv_val = (char *)creds;
+  bvcreds.bv_len = creds ? strlen(creds) : 0;
 
   /* The connection has been set up - now do the actual bind, depending on
      the mechanism and arguments */
diff --git a/lib/libadminutil/form_post.c b/lib/libadminutil/form_post.c
index cbe5299..9bc9e41 100644
--- a/lib/libadminutil/form_post.c
+++ b/lib/libadminutil/form_post.c
@@ -174,13 +174,13 @@ PR_IMPLEMENT(void)
 unescape_entities(char *s)
 {
     int		idx;
-    char	*p, *r, *d;
+    char	*p, *r;
 
     if (!s || !*s) {
         return;
     }
 
-    d = r = s;
+    r = s;
     for ( p = s; *p != '\0'; LDAP_UTF8INC( p )) {
         if ( ((*p) & 0x80) == 0 && ( (*p) == '&') ) {
             for( idx = 0; idx < entitynum; ++idx ) {
diff --git a/lib/libadminutil/psetc.c b/lib/libadminutil/psetc.c
index 42d0871..6a09638 100644
--- a/lib/libadminutil/psetc.c
+++ b/lib/libadminutil/psetc.c
@@ -1109,13 +1109,12 @@ psetRootModAttribute(PsetRootPtr psetRoot, int mode, NameType name,
 {
   PsetPtr     pset = NULL;
   LDAPMod     **mods;
-  int         nameLen, nodeFlag, errorcode;
+  int         nodeFlag, errorcode;
   char        namebuf[256];
   char        *attrName, *nodeName;
   ValueType   valsptr;
   PsetNodePtr nodePtr;
 
-  nameLen = PL_strlen(name);
   PR_snprintf(namebuf, sizeof(namebuf), "%s", name);
   attrName = strrchr(namebuf, '.');
   if (!attrName) {
diff --git a/lib/libadmsslutil/admsslutil.c b/lib/libadmsslutil/admsslutil.c
index a86c37c..1ba0dfa 100644
--- a/lib/libadmsslutil/admsslutil.c
+++ b/lib/libadmsslutil/admsslutil.c
@@ -51,19 +51,6 @@
 
 #define SECURITY_ATTR "configuration.nsServerSecurity"
 
-#ifdef XP_UNIX
-/*
- * Version information for the 'ident' and 'what commands
- *
- * NOTE: the first component of the concatenated rcsid string
- * must not end in a '$' to prevent rcs keyword substitution.
- */
-static char rcsid[] = "$Header: AdminUtil " ADMSDK_PRODUCT  
-        "  " ADMSDK_BUILDNUM " $";
-static char sccsid[] = "@(#)AdminUtil " ADMSDK_PRODUCT  
-		"  " ADMSDK_BUILDNUM;
-#endif /* XP_UNIX */
-
 void servssl_error(char *fmt, ...);
 
 char custom_file[BIG_LINE] = "";
-- 
1.7.1

