You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2017/06/07 22:31:02 UTC

svn commit: r1798004 - in /subversion/trunk: ./ build/ac-macros/ subversion/include/ subversion/include/private/ subversion/libsvn_auth_gnome_keyring/ subversion/libsvn_subr/ subversion/tests/libsvn_subr/

Author: philip
Date: Wed Jun  7 22:31:02 2017
New Revision: 1798004

URL: http://svn.apache.org/viewvc?rev=1798004&view=rev
Log:
Use libsecret to implement the GNOME Keyring provider by default
instead of libgnome-keyring.  The GNOME project have deprecated
libgnome-keyring and libsecret is the preferred replacement.  The old
implementation using libgnome-keyring can still be chosen at configure
time.  Both implementations read and write passwords that can be used
by the other implementation.

The configure option '--with-gnome-keyring' now controls the new
implementation while the option '--with-old-gnome-keyring' controls
the previous implementation.

* build/ac-macros/libsecret.m4: New, provides --with-gnome-keyring.

* configure.ac: Change --with-gnome-keyring to --with-old-gnome-keyring
  and disable by default.

* aclocal.m4: Include libsecret.m4.

* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c: Add new
  libsecret implementation conditional on SVN_HAVE_LIBSECRET, make old
  code conditional on SVN_HAVE_GNOME_KEYRING,

* subversion/libsvn_subr/auth.c
  (svn_auth_get_platform_specific_provider): Make already conditional
  code depend on SVN_HAVE_LIBSECRET.

* subversion/include/svn_auth.h
  (SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
   SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON): Deprecate.

* subversion/include/private/svn_cmdline_private.h
  (svn_cmdline__auth_gnome_keyring_unlock_prompt): Deprecate.

* subversion/libsvn_subr/prompt.c
  (svn_cmdline__auth_gnome_keyring_unlock_prompt): Make conditional.

* subversion/tests/libsvn_subr/auth-test.c
  (test_platform_specific_auth_providers): Make already conditional
  code depend on SVN_HAVE_LIBSECRET.

Added:
    subversion/trunk/build/ac-macros/libsecret.m4
Modified:
    subversion/trunk/aclocal.m4
    subversion/trunk/configure.ac
    subversion/trunk/subversion/include/private/svn_cmdline_private.h
    subversion/trunk/subversion/include/svn_auth.h
    subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
    subversion/trunk/subversion/libsvn_subr/auth.c
    subversion/trunk/subversion/libsvn_subr/prompt.c
    subversion/trunk/subversion/tests/libsvn_subr/auth-test.c

Modified: subversion/trunk/aclocal.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Wed Jun  7 22:31:02 2017
@@ -45,6 +45,7 @@ sinclude(build/ac-macros/sqlite.m4)
 sinclude(build/ac-macros/swig.m4)
 sinclude(build/ac-macros/zlib.m4)
 sinclude(build/ac-macros/kwallet.m4)
+sinclude(build/ac-macros/libsecret.m4)
 sinclude(build/ac-macros/macosx.m4)
 
 # Include the libtool macros

Added: subversion/trunk/build/ac-macros/libsecret.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/libsecret.m4?rev=1798004&view=auto
==============================================================================
--- subversion/trunk/build/ac-macros/libsecret.m4 (added)
+++ subversion/trunk/build/ac-macros/libsecret.m4 Wed Jun  7 22:31:02 2017
@@ -0,0 +1,93 @@
+dnl ===================================================================
+dnl   Licensed to the Apache Software Foundation (ASF) under one
+dnl   or more contributor license agreements.  See the NOTICE file
+dnl   distributed with this work for additional information
+dnl   regarding copyright ownership.  The ASF licenses this file
+dnl   to you under the Apache License, Version 2.0 (the
+dnl   "License"); you may not use this file except in compliance
+dnl   with the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl   Unless required by applicable law or agreed to in writing,
+dnl   software distributed under the License is distributed on an
+dnl   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl   KIND, either express or implied.  See the License for the
+dnl   specific language governing permissions and limitations
+dnl   under the License.
+dnl ===================================================================
+dnl
+dnl  SVN_LIB_SECRET
+dnl
+dnl  Check configure options and assign variables related to libsecret support
+
+AC_DEFUN(SVN_LIB_SECRET,
+[
+  AC_ARG_WITH(gnome_keyring,
+    AS_HELP_STRING([--with-gnome-keyring],
+                   [Enable GNOME Keyring for auth credentials (enabled by default if found)]),
+                   [with_gnome_keyring="$withval"],
+                   [with_gnome_keyring=auto])
+
+  found_gnome_keyring="no"
+  AC_MSG_CHECKING([whether to look for GNOME Keyring])
+  if test "$found_old_gnome_keyring" = "yes" && test "$with_gnome_keyring" = "auto"; then
+    with_gnome_keyring="no"
+  fi
+  if test "$with_gnome_keyring" != "no"; then
+    AC_MSG_RESULT([yes])
+    case "$host" in
+    *-*-darwin*)
+      if test "$with_gnome_keyring" = "yes"; then
+        AC_MSG_ERROR([--with-gnome-keyring is not supported on Mac OS X.])
+      fi
+      ;;
+    *)
+      AC_MSG_CHECKING([for GNOME Keyring])
+      if test "$found_old_gnome_keyring" = "no"; then
+        if test "$svn_enable_shared" = "yes"; then
+          if test "$APR_HAS_DSO" = "yes"; then
+            if test -n "$PKG_CONFIG"; then
+              if $PKG_CONFIG --exists libsecret-1; then
+                AC_MSG_RESULT([yes])
+                AC_DEFINE([SVN_HAVE_LIBSECRET], [1],
+                          [Is libsecret support enabled?])
+                SVN_GNOME_KEYRING_INCLUDES="`$PKG_CONFIG --cflags libsecret-1`"
+                SVN_GNOME_KEYRING_LIBS="`$PKG_CONFIG --libs libsecret-1`"
+                found_gnome_keyring="yes"
+              else
+                if test "$with_gnome_keyring" = "yes"; then
+                  AC_MSG_ERROR([cannot find libsecret])
+                fi
+              fi
+            else
+              if test "$with_gnome_keyring" = "yes"; then
+                AC_MSG_ERROR([cannot find pkg-config])
+              fi
+            fi
+          else
+            if test "$with_gnome_keyring" = "yes"; then
+              AC_MSG_ERROR([APR does not support DSOs])
+            fi
+          fi
+        else
+          if test "$with_gnome_keyring" = "yes"; then
+            AC_MSG_ERROR([--with-gnome-keyring conflicts with --disable-shared])
+          fi
+        fi
+      else
+        if test "$with_gnome_keyring" = "yes"; then
+          AC_MSG_ERROR([--with-gnome-keyring conflicts with --with-old-gnome-keyring])
+        fi
+      fi
+      if test "$found_gnome_keyring" = "no"; then
+        AC_MSG_RESULT([no])
+      fi
+      ;;
+    esac
+  else
+    AC_MSG_RESULT([no])
+  fi
+  AC_SUBST(SVN_GNOME_KEYRING_INCLUDES)
+  AC_SUBST(SVN_GNOME_KEYRING_LIBS)
+])

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Wed Jun  7 22:31:02 2017
@@ -555,22 +555,22 @@ AC_SUBST(SVN_HAVE_GPG_AGENT)
 
 dnl GNOME Keyring -------------------
 
-AC_ARG_WITH(gnome_keyring,
-  AS_HELP_STRING([--with-gnome-keyring], 
-                 [Enable use of GNOME Keyring for auth credentials (enabled by default if found)]),
-                 [with_gnome_keyring="$withval"],
-                 [with_gnome_keyring=auto])
-
-found_gnome_keyring=no
-AC_MSG_CHECKING([whether to look for GNOME Keyring])
-if test "$with_gnome_keyring" != "no"; then
+AC_ARG_WITH(old_gnome_keyring,
+  AS_HELP_STRING([--with-old-gnome-keyring], 
+                 [Enable old GNOME Keyring for auth credentials (prefer --with-gnome-keyring)]),
+                 [with_old_gnome_keyring="$withval"],
+                 [with_old_gnome_keyring=no])
+
+found_old_gnome_keyring=no
+AC_MSG_CHECKING([whether to look for old GNOME Keyring])
+if test "$with_old_gnome_keyring" != "no"; then
   AC_MSG_RESULT([yes])
   case "$host" in
   *-*-darwin*)
-    if test "$with_gnome_keyring" = "yes"; then
-      AC_MSG_ERROR([--with-gnome-keyring is not supported on Mac OS X.])
+    if test "$with_old_gnome_keyring" = "yes"; then
+      AC_MSG_ERROR([--with-old-gnome-keyring is not supported on Mac OS X.])
     else
-      with_gnome_keyring=no
+      with_old_gnome_keyring=no
     fi
     ;;
   *)
@@ -583,9 +583,9 @@ if test "$with_gnome_keyring" != "no"; t
             old_CPPFLAGS="$CPPFLAGS"
             SVN_GNOME_KEYRING_INCLUDES="`$PKG_CONFIG --cflags glib-2.0 gnome-keyring-1`"
             CPPFLAGS="$CPPFLAGS $SVN_GNOME_KEYRING_INCLUDES"
-            AC_CHECK_HEADER(gnome-keyring.h, found_gnome_keyring=yes, found_gnome_keyring=no)
+            AC_CHECK_HEADER(gnome-keyring.h, found_old_gnome_keyring=yes, found_old_gnome_keyring=no)
             AC_MSG_CHECKING([for GNOME Keyring])
-            if test "$found_gnome_keyring" = "yes"; then
+            if test "$found_old_gnome_keyring" = "yes"; then
               AC_MSG_RESULT([yes])
               AC_DEFINE([SVN_HAVE_GNOME_KEYRING], [1], 
                         [Is GNOME Keyring support enabled?])
@@ -593,37 +593,37 @@ if test "$with_gnome_keyring" != "no"; t
               SVN_GNOME_KEYRING_LIBS="`$PKG_CONFIG --libs glib-2.0 gnome-keyring-1`"
             else
               AC_MSG_RESULT([no])
-              if test "$with_gnome_keyring" = "yes"; then
+              if test "$with_old_gnome_keyring" = "yes"; then
                 AC_MSG_ERROR([cannot find GNOME Keyring])
               fi
             fi
           else
             AC_MSG_RESULT([no])
-            if test "$with_gnome_keyring" = "yes"; then
+            if test "$with_old_gnome_keyring" = "yes"; then
               AC_MSG_ERROR([cannot find GLib and GNOME Keyring .pc files.])
             else
-              with_gnome_keyring=no
+              with_old_gnome_keyring=no
             fi
           fi
         else
-          if test "$with_gnome_keyring" = "yes"; then
+          if test "$with_old_gnome_keyring" = "yes"; then
             AC_MSG_ERROR([cannot find pkg-config. GNOME Keyring requires this.])
           else
-            with_gnome_keyring=no
+            with_old_gnome_keyring=no
           fi
         fi
       else
-        if test "$with_gnome_keyring" = "yes"; then
+        if test "$with_old_gnome_keyring" = "yes"; then
           AC_MSG_ERROR([APR does not have support for DSOs. GNOME Keyring requires this.])
         else
-          with_gnome_keyring=no
+          with_old_gnome_keyring=no
         fi
       fi
     else
-      if test "$with_gnome_keyring" = "yes"; then
-        AC_MSG_ERROR([--with-gnome-keyring conflicts with --disable-shared])
+      if test "$with_old_gnome_keyring" = "yes"; then
+        AC_MSG_ERROR([--with-old-gnome-keyring conflicts with --disable-shared])
       else
-        with_gnome_keyring=no
+        with_old_gnome_keyring=no
       fi
     fi
     ;;
@@ -634,6 +634,9 @@ fi
 AC_SUBST(SVN_GNOME_KEYRING_INCLUDES)
 AC_SUBST(SVN_GNOME_KEYRING_LIBS)
 
+dnl LibSecret -------------------
+SVN_LIB_SECRET
+
 dnl Googlemock -----------------
 AC_ARG_ENABLE([googlemock],
   AS_HELP_STRING([--disable-googlemock],
@@ -901,7 +904,7 @@ if test "$svn_lib_kwallet" = "yes"; then
   INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-kwallet-lib"
 fi
 
-if test "$found_gnome_keyring" = "yes"; then
+if test "$found_old_gnome_keyring" = "yes" || test "$found_gnome_keyring" = "yes"; then
   BUILD_RULES="$BUILD_RULES gnome-keyring-lib"
   INSTALL_RULES="`echo $INSTALL_RULES | $SED 's/install-lib/install-lib install-gnome-keyring-lib/'`"
   INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-gnome-keyring-lib"

Modified: subversion/trunk/subversion/include/private/svn_cmdline_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_cmdline_private.h?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_cmdline_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_cmdline_private.h Wed Jun  7 22:31:02 2017
@@ -63,6 +63,7 @@ svn_cmdline__print_xml_prop(svn_stringbu
  * Expects a @c svn_cmdline_prompt_baton2_t to be passed as @a baton.
  *
  * @since New in 1.6.
+ * @deprecated Only used by old libgome-keyring implementation.
  */
 svn_error_t *
 svn_cmdline__auth_gnome_keyring_unlock_prompt(char **keyring_password,

Modified: subversion/trunk/subversion/include/svn_auth.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_auth.h?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_auth.h (original)
+++ subversion/trunk/subversion/include/svn_auth.h Wed Jun  7 22:31:02 2017
@@ -1012,11 +1012,13 @@ typedef svn_error_t *(*svn_auth_gnome_ke
 
 /** @brief The pointer to function which prompts user for GNOME Keyring
  * password.
- * The type of this pointer should be svn_auth_gnome_keyring_unlock_prompt_func_t. */
+ * The type of this pointer should be svn_auth_gnome_keyring_unlock_prompt_func_t.
+ * @deprecated Only used by old libgnome-keyring implementation. */
 #define SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC "gnome-keyring-unlock-prompt-func"
 
 /** @brief The baton which is passed to
- * @c *SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC. */
+ * @c *SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC.
+ * @deprecated Only used by old libgnome-keyring implementation. */
 #define SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON "gnome-keyring-unlock-prompt-baton"
 
 #if (!defined(DARWIN) && !defined(WIN32)) || defined(DOXYGEN)
@@ -1037,7 +1039,7 @@ svn_auth_gnome_keyring_version(void);
  * This is like svn_client_get_simple_provider(), except that the
  * password is stored in GNOME Keyring.
  *
- * If the GNOME Keyring is locked the provider calls
+ * If the GNOME Keyring is locked the old libgnome-keyring provider calls
  * @c *SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC in order to unlock
  * the keyring.
  *

Modified: subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c (original)
+++ subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c Wed Jun  7 22:31:02 2017
@@ -23,31 +23,169 @@
 
 /* ==================================================================== */
 
-
 
 /*** Includes. ***/
-
 #include <apr_pools.h>
 #include <apr_strings.h>
-#include <glib.h>
-#include <gnome-keyring.h>
-
 #include "svn_auth.h"
-#include "svn_config.h"
-#include "svn_error.h"
 #include "svn_hash.h"
-#include "svn_pools.h"
-
+#include "svn_version.h"
 #include "private/svn_auth_private.h"
-
 #include "svn_private_config.h"
 
+#ifdef SVN_HAVE_LIBSECRET
 
-
-/*-----------------------------------------------------------------------*/
-/* GNOME Keyring simple provider, puts passwords in GNOME Keyring        */
-/*-----------------------------------------------------------------------*/
+#include <libsecret/secret.h>
+
+/* Return TRUE if the default collection is available and FALSE
+   otherwise.  In interactive mode the collection only has to exist to
+   be available, it can be locked or unlocked.  The default collection
+   will be created if necessary.
+
+   In non-interactive mode the collection is only available if it
+   already exists and is unlocked.  Such an available collection can
+   be used without prompting.  Strictly this is racy: nothing ensures
+   the collection remains unlocked.  A similar issue affects the
+   KWallet and original GNOME Keyring providers.
+
+   As a non-racy alternative one could override prompt_async in the
+   _SecretServiceClass vtable, the get/set would still fail but there
+   would be no prompt and no race.  This "works" but it is not clear
+   to me whether it is legitimate since the SecretService is a
+   singleton and the effect would be application-wide.
+ */
+static svn_boolean_t
+available_collection(svn_boolean_t non_interactive,
+                     apr_pool_t *pool)
+{
+  GError *gerror = NULL;
+  SecretService *service = NULL;
+  SecretCollection *collection = NULL;
+
+  service = secret_service_get_sync(SECRET_SERVICE_NONE, NULL, &gerror);
+  if (gerror || !service)
+    goto error_return;
+
+  collection = secret_collection_for_alias_sync(service,
+                                                SECRET_COLLECTION_DEFAULT,
+                                                SECRET_COLLECTION_NONE,
+                                                NULL, &gerror);
+  if (gerror)
+    goto error_return;
+
+  if (!collection)
+    {
+      if (non_interactive)
+        goto error_return;
+
+      /* "Default" is the label used by the old libgnome-keyring. */
+      collection = secret_collection_create_sync(service, "Default",
+                                                 SECRET_COLLECTION_DEFAULT,
+                                                 0, NULL, &gerror);
+      if (gerror || !collection)
+        goto error_return;
+    }
+
+  if (non_interactive && secret_collection_get_locked(collection))
+    goto error_return;
+
+  g_object_unref(collection);
+  g_object_unref(service);
+
+  return TRUE;
+
+ error_return:
+  if (gerror)
+    g_error_free(gerror);
+  if (collection)
+    g_object_unref(collection);
+  if (service)
+    g_object_unref(service);
+  return FALSE;
+}
+
+/* Implementation of svn_auth__password_get_t that retrieves the password
+   using libsecret. */
+static svn_error_t *
+password_get_gnome_keyring(svn_boolean_t *done,
+                           const char **password,
+                           apr_hash_t *creds,
+                           const char *realmstring,
+                           const char *username,
+                           apr_hash_t *parameters,
+                           svn_boolean_t non_interactive,
+                           apr_pool_t *pool)
+{
+  GError *gerror = NULL;
+  gchar *gpassword;
+  
+  if (!available_collection(non_interactive, pool))
+    return SVN_NO_ERROR;
+  
+  gpassword = secret_password_lookup_sync(SECRET_SCHEMA_COMPAT_NETWORK, NULL,
+                                          &gerror,
+                                          "domain", realmstring,
+                                          "user", username,
+                                          NULL);
+  if (gerror)
+    {
+      g_error_free(gerror);
+    }
+  else if (gpassword)
+    {
+      *password = apr_pstrdup(pool, gpassword);
+      g_free(gpassword);
+      *done = TRUE;
+    }
+  
+  return SVN_NO_ERROR;
+}
+
+/* Implementation of svn_auth__password_set_t that stores the password
+   using libsecret. */
+static svn_error_t *
+password_set_gnome_keyring(svn_boolean_t *done,
+                           apr_hash_t *creds,
+                           const char *realmstring,
+                           const char *username,
+                           const char *password,
+                           apr_hash_t *parameters,
+                           svn_boolean_t non_interactive,
+                           apr_pool_t *pool)
+{
+  GError *gerror = NULL;
+  gboolean gstatus;
+  
+  if (!available_collection(non_interactive, pool))
+    return SVN_NO_ERROR;
+
+  /* "network password" is the label used by the old libgnome-keyring. */
+  gstatus = secret_password_store_sync(SECRET_SCHEMA_COMPAT_NETWORK,
+                                       SECRET_COLLECTION_DEFAULT,
+                                       "network password",
+                                       password,
+                                       NULL, &gerror,
+                                       "domain", realmstring,
+                                       "user", username,
+                                       NULL);
+  if (gerror)
+    {
+      g_error_free(gerror);
+    }
+  else if (gstatus)
+    {
+      *done = TRUE;
+    }
+  
+  return SVN_NO_ERROR;
+}
+
+#endif /* SVN_HAVE_LIBSECRET */
 
+#ifdef SVN_HAVE_GNOME_KEYRING
+
+#include <glib.h>
+#include <gnome-keyring.h>
 
 /* Returns the default keyring name, allocated in RESULT_POOL. */
 static char*
@@ -252,6 +390,41 @@ password_set_gnome_keyring(svn_boolean_t
   return SVN_NO_ERROR;
 }
 
+#if GLIB_CHECK_VERSION(2,6,0)
+static void
+log_noop(const gchar *log_domain, GLogLevelFlags log_level,
+         const gchar *message, gpointer user_data)
+{
+  /* do nothing */
+}
+#endif
+
+static void
+init_gnome_keyring(void)
+{
+  const char *application_name = NULL;
+  application_name = g_get_application_name();
+  if (!application_name)
+    g_set_application_name("Subversion");
+
+  /* Ideally we call g_log_set_handler() with a log_domain specific to
+     libgnome-keyring.  Unfortunately, at least as of gnome-keyring
+     2.22.3, it doesn't have its own log_domain.  As a result, we
+     suppress stderr spam for not only libgnome-keyring, but for
+     anything else the app is linked to that uses glib logging and
+     doesn't specify a log_domain. */
+#if GLIB_CHECK_VERSION(2,6,0)
+  g_log_set_default_handler(log_noop, NULL);
+#endif
+}
+
+#endif /* SVN_HAVE_GNOME_KEYRING */
+
+
+/*-----------------------------------------------------------------------*/
+/* GNOME Keyring simple provider, puts passwords in GNOME Keyring        */
+/*-----------------------------------------------------------------------*/
+
 /* Get cached encrypted credentials from the simple provider's cache. */
 static svn_error_t *
 simple_gnome_keyring_first_creds(void **credentials,
@@ -286,34 +459,6 @@ simple_gnome_keyring_save_creds(svn_bool
                                           pool);
 }
 
-#if GLIB_CHECK_VERSION(2,6,0)
-static void
-log_noop(const gchar *log_domain, GLogLevelFlags log_level,
-         const gchar *message, gpointer user_data)
-{
-  /* do nothing */
-}
-#endif
-
-static void
-init_gnome_keyring(void)
-{
-  const char *application_name = NULL;
-  application_name = g_get_application_name();
-  if (!application_name)
-    g_set_application_name("Subversion");
-
-  /* Ideally we call g_log_set_handler() with a log_domain specific to
-     libgnome-keyring.  Unfortunately, at least as of gnome-keyring
-     2.22.3, it doesn't have its own log_domain.  As a result, we
-     suppress stderr spam for not only libgnome-keyring, but for
-     anything else the app is linked to that uses glib logging and
-     doesn't specify a log_domain. */
-#if GLIB_CHECK_VERSION(2,6,0)
-  g_log_set_default_handler(log_noop, NULL);
-#endif
-}
-
 static const svn_auth_provider_t gnome_keyring_simple_provider = {
   SVN_AUTH_CRED_SIMPLE,
   simple_gnome_keyring_first_creds,
@@ -332,9 +477,12 @@ svn_auth_get_gnome_keyring_simple_provid
   po->vtable = &gnome_keyring_simple_provider;
   *provider = po;
 
+#ifdef SVN_HAVE_GNOME_KEYRING
   init_gnome_keyring();
+#endif
 }
 
+
 
 /*-----------------------------------------------------------------------*/
 /* GNOME Keyring SSL client certificate passphrase provider,             */
@@ -391,5 +539,7 @@ svn_auth_get_gnome_keyring_ssl_client_ce
   po->vtable = &gnome_keyring_ssl_client_cert_pw_provider;
   *provider = po;
 
+#ifdef SVN_HAVE_GNOME_KEYRING
   init_gnome_keyring();
+#endif
 }

Modified: subversion/trunk/subversion/libsvn_subr/auth.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/auth.c?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/auth.c (original)
+++ subversion/trunk/subversion/libsvn_subr/auth.c Wed Jun  7 22:31:02 2017
@@ -502,7 +502,7 @@ svn_auth_get_platform_specific_provider(
   if (apr_strnatcmp(provider_name, "gnome_keyring") == 0 ||
       apr_strnatcmp(provider_name, "kwallet") == 0)
     {
-#if defined(SVN_HAVE_GNOME_KEYRING) || defined(SVN_HAVE_KWALLET)
+#if defined(SVN_HAVE_GNOME_KEYRING) || defined(SVN_HAVE_KWALLET) || defined (SVN_HAVE_LIBSECRET)
       apr_dso_handle_t *dso;
       apr_dso_handle_sym_t provider_function_symbol, version_function_symbol;
       const char *library_label, *library_name;

Modified: subversion/trunk/subversion/libsvn_subr/prompt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/prompt.c?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/prompt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/prompt.c Wed Jun  7 22:31:02 2017
@@ -922,6 +922,7 @@ svn_cmdline_prompt_user2(const char **re
                 (svn_cmdline_prompt_baton2_t *)baton, pool);
 }
 
+#if SVN_HAVE_GNOME_KEYRING
 /* This implements 'svn_auth_gnome_keyring_unlock_prompt_func_t'. */
 svn_error_t *
 svn_cmdline__auth_gnome_keyring_unlock_prompt(char **keyring_password,
@@ -939,3 +940,4 @@ svn_cmdline__auth_gnome_keyring_unlock_p
   *keyring_password = apr_pstrdup(pool, password);
   return SVN_NO_ERROR;
 }
+#endif

Modified: subversion/trunk/subversion/tests/libsvn_subr/auth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/auth-test.c?rev=1798004&r1=1798003&r2=1798004&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/auth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/auth-test.c Wed Jun  7 22:31:02 2017
@@ -50,7 +50,7 @@ test_platform_specific_auth_providers(ap
   SVN_ERR(svn_auth_get_platform_specific_client_providers(&providers, NULL,
                                                           pool));
 
-#ifdef SVN_HAVE_GNOME_KEYRING
+#if defined(SVN_HAVE_GNOME_KEYRING) || defined(SVN_HAVE_LIBSECRET)
   number_of_providers += 2;
 #endif
 #ifdef SVN_HAVE_KWALLET
@@ -145,7 +145,7 @@ test_platform_specific_auth_providers(ap
 #endif
 
   /* Test GNOME Keyring auth providers */
-#ifdef SVN_HAVE_GNOME_KEYRING
+#if defined(SVN_HAVE_GNOME_KEYRING) || defined(SVN_HAVE_LIBSECRET)
   SVN_ERR(svn_auth_get_platform_specific_provider(&provider, "gnome_keyring",
                                                   "simple", pool));