[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Remove platform visibility from Subversion auth functions (Was: Python bindings build seems broken)

From: Jeremy Whitlock <jcscoobyrs_at_gmail.com>
Date: Fri, 10 Oct 2008 23:37:45 -0600

Hi All,
    I have attached a patch for review that will remove the platform
visibility from the Subversion auth functions. This will also fix the
SWIG Python bindings. The only reason I've not committed this is I do
not have a non-OSX box available yet for testing other systems and I'd
hate to break Subversion over the weekend. Can someone test this on
Linux and/or Windows? (If you can, compile both Subversion and the
swig-py bindings and then run tests on both.) On OSX, all Subversion
tests pass and the SWIG Python tests pass as well.

-- 
Take care,
Jeremy Whitlock
http://www.thoughtspark.org
[[[
Remove platform visibility for Subversion auth functions.
* subversion/libsvn_subr/cmdline.c (svn_cmdline_set_up_auth_baton): Perform NULL
   checks when retrieving the available auth providers.
* subversion/libsvn_subr/win32_crypto.c: Make WIN32 platform check affect
   visibility to Win32 headers only.
  (svn_auth_get_windows_simple_provider,
   svn_auth_get_windows_ssl_server_trust_provider): Added WIN32 platform check
   within the functions and made public to all platforms.
* subversion/libsvn_subr/macos_keychain.c
  (svn_auth_get_keychain_simple_provider,
   svn_auth_get_keychain_ssl_client_cert_pw_provider): Added DARWIN platform
   check within the functions and made public to all platforms.
* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
  (svn_auth_get_gnome_keyring_simple_provider,
   svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider): Added WIN32 and
   DARWIN checks within the functions.
* subversion/bindings/javahl/native/SVNClient.cpp (getContext): Perform NULL
   checks when retrieving the available auth providers.
* subversion/include/svn_client.h
  (svn_client_get_windows_simple_provider): Removed WIN32 platform check and
   added check for CTYPESGEN.
* subversion/include/svn_auth.h
  (svn_auth_get_windows_simple_provider): Removed WIN32 platform check.
  (svn_auth_get_keychain_simple_provider,
   svn_auth_get_keychain_ssl_client_cert_pw_provider): Removed DARWIN platform
   check.
  (svn_auth_gnome_keyring_version, svn_auth_get_gnome_keyring_simple_provider
   svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider,
   svn_auth_kwallet_version, svn_auth_get_kwallet_simple_provider,
   svn_auth_get_kwallet_ssl_client_cert_pw_provider): Removed DARWIN and WIN32
   platform checks.
* subversion/libsvn_client/compat_providers.c
  (svn_client_get_windows_simple_provider): Removed WIN32 platform check.
* subversion/libsvn_auth_kwallet/kwallet.cpp
  (svn_auth_get_kwallet_simple_provider,
   svn_auth_get_kwallet_ssl_client_cert_pw_provider): Added WIN32 and
   DARWIN platform checks within the functions.
]]]
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c	(revision 33596)
+++ subversion/libsvn_subr/cmdline.c	(working copy)
@@ -530,10 +530,18 @@
         {
 #ifdef SVN_HAVE_KEYCHAIN_SERVICES
           svn_auth_get_keychain_simple_provider(&provider, pool);
-          APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+          if (provider)
+            {
+              APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *)
= provider;
+            }
+
           svn_auth_get_keychain_ssl_client_cert_pw_provider(&provider, pool);
-          APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+          if (provider)
+            {
+              APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *)
= provider;
+            }
 #endif
           continue;
         }
@@ -542,7 +550,11 @@
         {
 #if defined(WIN32) && !defined(__MINGW32__)
           svn_auth_get_windows_simple_provider(&provider, pool);
-          APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+          if (provider)
+            {
+              APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *)
= provider;
+            }
 #endif
           continue;
         }
@@ -612,7 +624,11 @@
   /* The server-cert, client-cert, and client-cert-password providers. */
 #if defined(WIN32) && !defined(__MINGW32__)
   svn_auth_get_windows_ssl_server_trust_provider(&provider, pool);
-  APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+  if (provider)
+    {
+      APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+    }
 #endif
   svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
   APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
Index: subversion/libsvn_subr/win32_crypto.c
===================================================================
--- subversion/libsvn_subr/win32_crypto.c	(revision 33596)
+++ subversion/libsvn_subr/win32_crypto.c	(working copy)
@@ -18,8 +18,6 @@
 /* ==================================================================== */
-#if defined(WIN32) && !defined(__MINGW32__)
-
 /*** Includes. ***/
 #include <apr_pools.h>
@@ -33,8 +31,11 @@
 #include "svn_private_config.h"
+#include <apr_base64.h>
+
+#if defined(WIN32) && !defined(__MINGW32__)
+
 #include <wincrypt.h>
-#include <apr_base64.h>
 
 /*-----------------------------------------------------------------------*/
 /* Windows simple provider, encrypts the password on Win2k and later.    */
@@ -158,18 +159,6 @@
   windows_simple_save_creds
 };
-
-/* Public API */
-void
-svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
-                                     apr_pool_t *pool)
-{
-  svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
-
-  po->vtable = &windows_simple_provider;
-  *provider = po;
-}
-
 
 /*-----------------------------------------------------------------------*/
 /* Windows SSL server trust provider, validates ssl certificate using    */
@@ -281,16 +270,36 @@
   NULL,
   NULL,
 };
+#endif /* WIN32 */
 /* Public API */
 void
+svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
+                                     apr_pool_t *pool)
+{
+  svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+
+#if defined(WIN32) && !defined(__MINGW32__)
+  po->vtable = &windows_simple_provider;
+#else
+  po->vtable = NULL;
+#endif
+
+  *provider = po;
+}
+
+/* Public API */
+void
 svn_auth_get_windows_ssl_server_trust_provider
   (svn_auth_provider_object_t **provider, apr_pool_t *pool)
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+#if defined(WIN32) && !defined(__MINGW32__)
   po->vtable = &windows_server_trust_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
 }
-
-#endif /* WIN32 */
Index: subversion/libsvn_subr/macos_keychain.c
===================================================================
--- subversion/libsvn_subr/macos_keychain.c	(revision 33596)
+++ subversion/libsvn_subr/macos_keychain.c	(working copy)
@@ -226,6 +226,7 @@
   keychain_ssl_client_cert_pw_save_creds
 };
+#endif /* SVN_HAVE_KEYCHAIN_SERVICES */
 /* Public API */
 void
@@ -234,7 +235,12 @@
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+#if defined(DARWIN)
   po->vtable = &keychain_simple_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
 }
@@ -245,7 +251,10 @@
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+#if defined(DARWIN)
   po->vtable = &keychain_ssl_client_cert_pw_provider;
+#else
+  po->vtable = NULL;
+#endif
   *provider = po;
 }
-#endif /* SVN_HAVE_KEYCHAIN_SERVICES */
Index: subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
===================================================================
--- subversion/libsvn_auth_gnome_keyring/gnome_keyring.c	(revision 33596)
+++ subversion/libsvn_auth_gnome_keyring/gnome_keyring.c	(working copy)
@@ -186,10 +186,17 @@
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+#if !defined(DARWIN) && !defined(WIN32)
   po->vtable = &gnome_keyring_simple_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
+#if !defined(DARWIN) && !defined(WIN32)
   gnome_keyring_init();
+#endif
 }
 
@@ -251,6 +258,11 @@
 {
   svn_auth_provider_object_t *po = apr_pcalloc(pool, sizeof(*po));
+#if !defined(DARWIN) && !defined(WIN32)
   po->vtable = &gnome_keyring_ssl_client_cert_pw_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
 }
Index: subversion/bindings/javahl/native/SVNClient.cpp
===================================================================
--- subversion/bindings/javahl/native/SVNClient.cpp	(revision 33596)
+++ subversion/bindings/javahl/native/SVNClient.cpp	(working copy)
@@ -1229,16 +1229,28 @@
     /* The main disk-caching auth providers, for both
      * 'username/password' creds and 'username' creds.  */
     svn_auth_provider_object_t *provider;
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(WIN32) && !defined(__MINGW32__)
     svn_auth_get_windows_simple_provider(&provider, pool);
-    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+    if (provider)
+      {
+        APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+      }
 #endif
 #ifdef SVN_HAVE_KEYCHAIN_SERVICES
     svn_auth_get_keychain_simple_provider(&provider, pool);
-    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+    if (provider)
+      {
+        APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+      }
+
     svn_auth_get_keychain_ssl_client_cert_pw_provider(&provider, pool);
-    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+    if (provider)
+      {
+        APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+      }
 #endif
 #ifdef SVN_HAVE_GNOME_KEYRING
     SVN_JNI_ERR(get_auth_provider(&provider, "gnome_keyring", "simple",
@@ -1276,7 +1288,11 @@
     /* The server-cert, client-cert, and client-cert-password providers. */
 #if defined(WIN32) && !defined(__MINGW32__)
     svn_auth_get_windows_ssl_server_trust_provider(&provider, pool);
-    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+    if (provider)
+      {
+        APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+      }
 #endif
     svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
     APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h	(revision 33596)
+++ subversion/include/svn_client.h	(working copy)
@@ -160,7 +160,7 @@
                                apr_pool_t *pool);
-#if (defined(WIN32) && !defined(__MINGW32__)) || defined(DOXYGEN) ||
defined(CTYPESGEN)
+#if defined(DOXYGEN) || defined(CTYPESGEN)
 /**
  * Create and return @a *provider, an authentication provider of type @c
  * svn_auth_cred_simple_t that gets/sets information from the user's
@@ -187,7 +187,7 @@
 void
 svn_client_get_windows_simple_provider(svn_auth_provider_object_t **provider,
                                        apr_pool_t *pool);
-#endif /* WIN32 && !__MINGW32__ || DOXYGEN || CTYPESGEN */
+#endif /* DOXYGEN || CTYPESGEN */
 /** Create and return @a *provider, an authentication provider of type @c
  * svn_auth_cred_username_t that gets/sets information from a user's
Index: subversion/include/svn_auth.h
===================================================================
--- subversion/include/svn_auth.h	(revision 33596)
+++ subversion/include/svn_auth.h	(working copy)
@@ -785,7 +785,7 @@
                              apr_pool_t *pool);
-#if (defined(WIN32) && !defined(__MINGW32__)) || defined(DOXYGEN) ||
defined(CTYPESGEN)
+#if defined(DOXYGEN) || defined(CTYPESGEN)
 /**
  * Create and return @a *provider, an authentication provider of type @c
  * svn_auth_cred_simple_t that gets/sets information from the user's
@@ -808,9 +808,9 @@
 void
 svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
                                      apr_pool_t *pool);
-#endif /* WIN32 && !__MINGW32__ || DOXYGEN || CTYPESGEN */
+#endif /* DOXYGEN || CTYPESGEN */
-#if defined(DARWIN) || defined(DOXYGEN) || defined(CTYPESGEN)
+#if defined(DOXYGEN) || defined(CTYPESGEN)
 /**
  * Create and return @a *provider, an authentication provider of type @c
  * svn_auth_cred_simple_t that gets/sets information from the user's
@@ -843,9 +843,9 @@
 svn_auth_get_keychain_ssl_client_cert_pw_provider
   (svn_auth_provider_object_t **provider,
    apr_pool_t *pool);
-#endif /* DARWIN || DOXYGEN || CTYPESGEN */
+#endif /* DOXYGEN || CTYPESGEN */
-#if (!defined(DARWIN) && !defined(WIN32)) || defined(DOXYGEN)
+#if defined(DOXYGEN) || defined(CTYPESGEN)
 /**
  * Get libsvn_auth_gnome_keyring version information.
  *
@@ -937,7 +937,7 @@
 svn_auth_get_kwallet_ssl_client_cert_pw_provider
   (svn_auth_provider_object_t **provider,
    apr_pool_t *pool);
-#endif /* (!DARWIN && !WIN32) || DOXYGEN */
+#endif /* DOXYGEN || CTYPESGEN */
 /** Create and return @a *provider, an authentication provider of type @c
Index: subversion/libsvn_client/compat_providers.c
===================================================================
--- subversion/libsvn_client/compat_providers.c	(revision 33596)
+++ subversion/libsvn_client/compat_providers.c	(working copy)
@@ -57,14 +57,12 @@
   svn_auth_get_simple_provider2(provider, NULL, NULL, pool);
 }
-#if defined(WIN32) && !defined(__MINGW32__)
 void
 svn_client_get_windows_simple_provider(svn_auth_provider_object_t **provider,
                                        apr_pool_t *pool)
 {
   svn_auth_get_windows_simple_provider(provider, pool);
 }
-#endif /* WIN32 */
 void svn_client_get_username_provider(svn_auth_provider_object_t **provider,
                                       apr_pool_t *pool)
Index: subversion/libsvn_auth_kwallet/kwallet.cpp
===================================================================
--- subversion/libsvn_auth_kwallet/kwallet.cpp	(revision 33596)
+++ subversion/libsvn_auth_kwallet/kwallet.cpp	(working copy)
@@ -222,7 +222,12 @@
   svn_auth_provider_object_t *po =
     static_cast<svn_auth_provider_object_t *> (apr_pcalloc(pool, sizeof(*po)));
+#if !defined(DARWIN) && !defined(WIN32)
   po->vtable = &kwallet_simple_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
 }
 }
@@ -287,6 +292,12 @@
   svn_auth_provider_object_t *po =
     static_cast<svn_auth_provider_object_t *> (apr_pcalloc(pool, sizeof(*po)));
+
+#if !defined(DARWIN) && !defined(WIN32)
   po->vtable = &kwallet_ssl_client_cert_pw_provider;
+#else
+  po->vtable = NULL;
+#endif
+
   *provider = po;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-10-11 07:37:58 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.