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

Gnome keyring - lack of error on failing to unlock the keyring

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Fri, 9 Oct 2009 15:37:27 +0100

I found some strange behaviour in simple_gnome_keyring_first_creds() and
the three similar functions. If we try to unlock the keyring and the
attempt fails, the code says, "give up and try the next provider" and
returns no error but does not set (or save) the credentials. Is that
right? I think it should return an error in that situation.

/* Get cached encrypted credentials from the simple provider's cache. */
static svn_error_t *
simple_gnome_keyring_first_creds(void **credentials,
                                 void **iter_baton,
                                 void *provider_baton,
                                 apr_hash_t *parameters,
                                 const char *realmstring,
                                 apr_pool_t *pool)
  svn_boolean_t non_interactive = apr_hash_get(parameters,
                                               APR_HASH_KEY_STRING) != NULL;
  const char *default_keyring = get_default_keyring_name(pool);
  if (! non_interactive)
      svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
      void *unlock_prompt_baton =
        apr_hash_get(parameters, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,

      char *keyring_password;

      if (unlock_prompt_func && check_keyring_is_locked(default_keyring))

          /* If keyring is locked give up and try the next provider. */
          if (! unlock_gnome_keyring(default_keyring, keyring_password, pool))
            return SVN_NO_ERROR;
      if (check_keyring_is_locked(default_keyring))
          return svn_error_create(SVN_ERR_AUTHN_CREDS_UNAVAILABLE, NULL,
                                  _("GNOME Keyring is locked and "
                                    "we are non-interactive"));
  return svn_auth__simple_first_creds_helper
            iter_baton, provider_baton,
            parameters, realmstring,

It's the "return SVN_NO_ERROR;" in the middle of the code above. I think
it should return an SVN_ERR_AUTHN_FAILED error there.

I looked at the callers of "first_creds" functions, and they pretty much
all treat an error return the same as they treat a successful return
with NULL for the credentials. There are two issues: (1) it seems to me
like an error ought to be reported in this situation, and (2) if the
function returns at this point with no error, the caller expects that
'*credentials' has been set to some value, but it has not been set to


- Julian


Received on 2009-10-09 16:40:42 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.