diff options
author | Martin Willi <martin@strongswan.org> | 2007-02-28 14:04:36 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2007-02-28 14:04:36 +0000 |
commit | c60c7694d2d8925c5d93ff33d132f561ad89e071 (patch) | |
tree | 9c7957b0749139c5e7c9b008c927e79d69f8e500 /src/libstrongswan/utils/identification.c | |
parent | a7a5e834e318d0582b6db979b63a5739c0a8244f (diff) | |
download | strongswan-c60c7694d2d8925c5d93ff33d132f561ad89e071.tar.bz2 strongswan-c60c7694d2d8925c5d93ff33d132f561ad89e071.tar.xz |
merged tasking branch into trunk
Diffstat (limited to 'src/libstrongswan/utils/identification.c')
-rw-r--r-- | src/libstrongswan/utils/identification.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c index 6c77b41e8..341af39c0 100644 --- a/src/libstrongswan/utils/identification.c +++ b/src/libstrongswan/utils/identification.c @@ -497,7 +497,10 @@ bool match_dn(chunk_t a, chunk_t b, int *wildcards) bool next_a, next_b; /* initialize wildcard counter */ - *wildcards = 0; + if (wildcards) + { + *wildcards = 0; + } /* initialize DN parsing */ if (init_rdn(a, &rdn_a, &attribute_a, &next_a) != SUCCESS @@ -522,7 +525,10 @@ bool match_dn(chunk_t a, chunk_t b, int *wildcards) /* does rdn_b contain a wildcard? */ if (value_b.len == 1 && *value_b.ptr == '*') { - (*wildcards)++; + if (wildcards) + { + (*wildcards)++; + } continue; } /* same lengths for values */ @@ -549,7 +555,10 @@ bool match_dn(chunk_t a, chunk_t b, int *wildcards) } /* the two DNs match! */ - *wildcards = min(*wildcards, MAX_WILDCARDS); + if (wildcards) + { + *wildcards = min(*wildcards, MAX_WILDCARDS); + } return TRUE; } @@ -750,10 +759,16 @@ static bool matches_binary(private_identification_t *this, { if (other->type == ID_ANY) { - *wildcards = MAX_WILDCARDS; + if (wildcards) + { + *wildcards = MAX_WILDCARDS; + } return TRUE; } - *wildcards = 0; + if (wildcards) + { + *wildcards = 0; + } return this->type == other->type && chunk_equals(this->encoded, other->encoded); } @@ -769,7 +784,10 @@ static bool matches_string(private_identification_t *this, if (other->type == ID_ANY) { - *wildcards = MAX_WILDCARDS; + if (wildcards) + { + *wildcards = MAX_WILDCARDS; + } return TRUE; } @@ -779,7 +797,10 @@ static bool matches_string(private_identification_t *this, /* try a binary comparison first */ if (equals_binary(this, other)) { - *wildcards = 0; + if (wildcards) + { + *wildcards = 0; + } return TRUE; } @@ -789,7 +810,10 @@ static bool matches_string(private_identification_t *this, /* check for single wildcard at the head of the string */ if (*other->encoded.ptr == '*') { - *wildcards = 1; + if (wildcards) + { + *wildcards = 1; + } /* single asterisk matches any string */ if (len-- == 1) @@ -809,7 +833,10 @@ static bool matches_string(private_identification_t *this, static bool matches_any(private_identification_t *this, private_identification_t *other, int *wildcards) { - *wildcards = 0; + if (wildcards) + { + *wildcards = 0; + } return other->type == ID_ANY; } @@ -822,7 +849,10 @@ static bool matches_dn(private_identification_t *this, { if (other->type == ID_ANY) { - *wildcards = MAX_WILDCARDS; + if (wildcards) + { + *wildcards = MAX_WILDCARDS; + } return TRUE; } |