* gpgkeys_ldap.c (main): Fix build problem with non-OpenLDAP LDAP
authorDavid Shaw <dshaw@jabberwocky.com>
Fri, 3 Mar 2006 21:55:38 +0000 (21:55 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Fri, 3 Mar 2006 21:55:38 +0000 (21:55 +0000)
libraries that have TLS.

keyserver/ChangeLog
keyserver/gpgkeys_ldap.c

index 1546035..795b7d4 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-03  David Shaw  <dshaw@jabberwocky.com>
+
+       * gpgkeys_ldap.c (main): Fix build problem with non-OpenLDAP LDAP
+       libraries that have TLS.
+
 2006-02-23  David Shaw  <dshaw@jabberwocky.com>
 
        * ksutil.c (init_ks_options): Default include-revoked and
index 1c593ba..85654fb 100644 (file)
@@ -1928,7 +1928,8 @@ main(int argc,char *argv[])
       return KEYSERVER_INTERNAL_ERROR;
     }
 
-#if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS_CACERTFILE)
+#if defined(LDAP_OPT_X_TLS_CACERTFILE) && defined(HAVE_LDAP_SET_OPTION)
+
   if(opt->ca_cert_file)
     {
       err=ldap_set_option(NULL,LDAP_OPT_X_TLS_CACERTFILE,opt->ca_cert_file);
@@ -1940,7 +1941,7 @@ main(int argc,char *argv[])
          goto fail;
        }
     }
-#endif /* HAVE_LDAP_SET_OPTION && LDAP_OPT_X_TLS_CACERTFILE */
+#endif /* LDAP_OPT_X_TLS_CACERTFILE && HAVE_LDAP_SET_OPTION */
 
   /* SSL trumps TLS */
   if(use_ssl)
@@ -2104,6 +2105,8 @@ main(int argc,char *argv[])
          int ver=LDAP_VERSION3;
 
          err=ldap_set_option(ldap,LDAP_OPT_PROTOCOL_VERSION,&ver);
+
+#ifdef LDAP_OPT_X_TLS
          if(err==LDAP_SUCCESS)
            {
              if(opt->flags.check_cert)
@@ -2112,9 +2115,11 @@ main(int argc,char *argv[])
                ver=LDAP_OPT_X_TLS_NEVER;
 
              err=ldap_set_option(ldap,LDAP_OPT_X_TLS_REQUIRE_CERT,&ver);
-             if(err==LDAP_SUCCESS)
-               err=ldap_start_tls_s(ldap,NULL,NULL);
            }
+#endif
+
+         if(err==LDAP_SUCCESS)
+           err=ldap_start_tls_s(ldap,NULL,NULL);
 
          if(err!=LDAP_SUCCESS)
            {
@@ -2128,7 +2133,7 @@ main(int argc,char *argv[])
                  goto fail;
                }
            }
-         else if(err==LDAP_SUCCESS && opt->verbose>1)
+         else if(opt->verbose>1)
            fprintf(console,"gpgkeys: TLS started successfully.\n");
 #else
          if(use_tls>=2)