replaced strncmp() == 0 by strneq()
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
* for more details.
|
* for more details.
|
||||||
|
*
|
||||||
|
* RCSID $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -40,7 +42,7 @@ static bool present(const char* pattern, chunk_t* ch)
|
|||||||
{
|
{
|
||||||
u_int pattern_len = strlen(pattern);
|
u_int pattern_len = strlen(pattern);
|
||||||
|
|
||||||
if (ch->len >= pattern_len && strncmp(ch->ptr, pattern, pattern_len) == 0)
|
if (ch->len >= pattern_len && strneq(ch->ptr, pattern, pattern_len))
|
||||||
{
|
{
|
||||||
ch->ptr += pattern_len;
|
ch->ptr += pattern_len;
|
||||||
ch->len -= pattern_len;
|
ch->len -= pattern_len;
|
||||||
|
|||||||
@@ -456,12 +456,16 @@ static bool same_dn(chunk_t a, chunk_t b)
|
|||||||
|| (type_a == ASN1_IA5STRING && known_oid(oid_a) == OID_PKCS9_EMAIL)))
|
|| (type_a == ASN1_IA5STRING && known_oid(oid_a) == OID_PKCS9_EMAIL)))
|
||||||
{
|
{
|
||||||
if (strncasecmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
if (strncasecmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strncmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
if (!strneq(value_a.ptr, value_b.ptr, value_b.len))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* both DNs must have same number of RDNs */
|
/* both DNs must have same number of RDNs */
|
||||||
@@ -529,12 +533,16 @@ bool match_dn(chunk_t a, chunk_t b, int *wildcards)
|
|||||||
|| (type_a == ASN1_IA5STRING && known_oid(oid_a) == OID_PKCS9_EMAIL)))
|
|| (type_a == ASN1_IA5STRING && known_oid(oid_a) == OID_PKCS9_EMAIL)))
|
||||||
{
|
{
|
||||||
if (strncasecmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
if (strncasecmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strncmp(value_a.ptr, value_b.ptr, value_b.len) != 0)
|
if (!strneq(value_a.ptr, value_b.ptr, value_b.len))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* both DNs must have same number of RDNs */
|
/* both DNs must have same number of RDNs */
|
||||||
|
|||||||
Reference in New Issue
Block a user