diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-09-18 12:47:17 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-09-18 14:40:41 +0200 |
commit | 35e2afd459e43970f76ffabc8aee74df7490f2bb (patch) | |
tree | dbbcfc9ca21100430d6b1a2b3995af4011b6f8aa /src | |
parent | b7a500e985811549c42e817ce48d3b6fc2fb45bf (diff) | |
download | strongswan-35e2afd459e43970f76ffabc8aee74df7490f2bb.tar.bz2 strongswan-35e2afd459e43970f76ffabc8aee74df7490f2bb.tar.xz |
Fix equality comparison of auth_cfg_t
We previously only confirmed that rules contained in the first config are also
contained in the second, but since the number of rules does not have to
be equal, it might be that the second config contains rules that the
first one doesn't.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/credentials/auth_cfg.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libstrongswan/credentials/auth_cfg.c b/src/libstrongswan/credentials/auth_cfg.c index 360e83f94..6ee4f9b6e 100644 --- a/src/libstrongswan/credentials/auth_cfg.c +++ b/src/libstrongswan/credentials/auth_cfg.c @@ -915,9 +915,9 @@ static void merge(private_auth_cfg_t *this, private_auth_cfg_t *other, bool copy } /** - * Implementation of auth_cfg_t.equals. + * Compare two auth_cfg_t objects for equality. */ -static bool equals(private_auth_cfg_t *this, private_auth_cfg_t *other) +static bool auth_cfg_equals(private_auth_cfg_t *this, private_auth_cfg_t *other) { enumerator_t *e1, *e2; entry_t *i1, *i2; @@ -954,6 +954,20 @@ static bool equals(private_auth_cfg_t *this, private_auth_cfg_t *other) return equal; } +/** + * Implementation of auth_cfg_t.equals. + */ +static bool equals(private_auth_cfg_t *this, private_auth_cfg_t *other) +{ + if (auth_cfg_equals(this, other)) + { + /* as 'other' might contain entries that 'this' doesn't we also check + * the other way around */ + return auth_cfg_equals(other, this); + } + return FALSE; +} + METHOD(auth_cfg_t, purge, void, private_auth_cfg_t *this, bool keep_ca) { |