You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/03/05 01:22:58 UTC

svn commit: r1664187 - /subversion/trunk/subversion/libsvn_subr/auth.c

Author: rhuijben
Date: Thu Mar  5 00:22:58 2015
New Revision: 1664187

URL: http://svn.apache.org/r1664187
Log:
Following up on r1664078, r1664080 provide a combined set of parameters
to the auth iterator callbacks.

* subversion/libsvn_subr/auth.c
  (svn_auth_iterstate_t): Add parameters.
  (svn_auth_first_credentials): If there is a set of slave parameters,
    combine values. Store in iterator.
  (svn_auth_next_credentials): Pass parameters from iterator.

Modified:
    subversion/trunk/subversion/libsvn_subr/auth.c

Modified: subversion/trunk/subversion/libsvn_subr/auth.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/auth.c?rev=1664187&r1=1664186&r2=1664187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/auth.c (original)
+++ subversion/trunk/subversion/libsvn_subr/auth.c Thu Mar  5 00:22:58 2015
@@ -125,6 +125,7 @@ struct svn_auth_iterstate_t
   const char *realmstring;      /* The original realmstring passed in */
   const char *cache_key;        /* key to use in auth_baton's creds_cache */
   svn_auth_baton_t *auth_baton; /* the original auth_baton. */
+  apr_hash_t *parameters;
 };
 
 
@@ -239,6 +240,7 @@ svn_auth_first_credentials(void **creden
   svn_boolean_t got_first = FALSE;
   svn_auth_iterstate_t *iterstate;
   const char *cache_key;
+  apr_hash_t *parameters;
 
   if (! auth_baton)
     return svn_error_create(SVN_ERR_AUTHN_NO_PROVIDER, NULL,
@@ -261,6 +263,23 @@ svn_auth_first_credentials(void **creden
   else
     /* If not, find a provider that can give "first" credentials. */
     {
+      if (auth_baton->slave_parameters)
+        {
+          apr_hash_index_t *hi;
+          parameters = apr_hash_overlay(pool, auth_baton->slave_parameters,
+                                        auth_baton->parameters);
+
+          for (hi = apr_hash_first(pool, auth_baton->slave_parameters);
+               hi;
+               hi = apr_hash_next(hi))
+            {
+              if (apr_hash_this_val(hi) == auth_NULL)
+                svn_hash_sets(parameters, apr_hash_this_key(hi), NULL);
+            }
+        }
+      else
+        parameters = auth_baton->parameters;
+
       /* Find a provider that can give "first" credentials. */
       for (i = 0; i < table->providers->nelts; i++)
         {
@@ -268,7 +287,7 @@ svn_auth_first_credentials(void **creden
                                    svn_auth_provider_object_t *);
           SVN_ERR(provider->vtable->first_credentials(&creds, &iter_baton,
                                                       provider->provider_baton,
-                                                      auth_baton->parameters,
+                                                      parameters,
                                                       realmstring,
                                                       auth_baton->pool));
 
@@ -295,6 +314,7 @@ svn_auth_first_credentials(void **creden
       iterstate->realmstring = apr_pstrdup(pool, realmstring);
       iterstate->cache_key = cache_key;
       iterstate->auth_baton = auth_baton;
+      iterstate->parameters = parameters;
       *state = iterstate;
 
       /* Put the creds in the cache */
@@ -340,7 +360,7 @@ svn_auth_next_credentials(void **credent
           SVN_ERR(provider->vtable->next_credentials(&creds,
                                                      state->provider_iter_baton,
                                                      provider->provider_baton,
-                                                     auth_baton->parameters,
+                                                     state->parameters,
                                                      state->realmstring,
                                                      auth_baton->pool));
         }