credential-manager: Prefer local over global sets
authorAdrian-Ken Rueegsegger <ken@codelabs.ch>
Wed, 26 Apr 2017 11:46:26 +0000 (13:46 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 23 May 2017 14:36:35 +0000 (16:36 +0200)
Invert set enumeration order to first enumerate local and then global
credential sets.

src/libstrongswan/credentials/credential_manager.c

index 95c5cd7..8e8be7e 100644 (file)
@@ -166,19 +166,19 @@ METHOD(enumerator_t, sets_enumerate, bool,
                        return TRUE;
                }
        }
-       if (this->global)
+       if (this->local)
        {
-               if (this->global->enumerate(this->global, set))
+               if (this->local->enumerate(this->local, set))
                {
                        return TRUE;
                }
-               /* end of global sets, look for local */
-               this->global->destroy(this->global);
-               this->global = NULL;
+               /* end of local sets, look for global */
+               this->local->destroy(this->local);
+               this->local = NULL;
        }
-       if (this->local)
+       if (this->global)
        {
-               return this->local->enumerate(this->local, set);
+               return this->global->enumerate(this->global, set);
        }
        return FALSE;
 }