Adding DBG_LIB to all calls of libstrongswan's version of DBG*.

This commit is contained in:
Tobias Brunner
2010-04-06 12:47:40 +02:00
parent 9ed6341d3f
commit 8b0e09103b
82 changed files with 660 additions and 576 deletions
+18 -17
View File
@@ -133,7 +133,7 @@ size_t asn1_length(chunk_t *blob)
if (blob->len < 2)
{
DBG2("insufficient number of octets to parse ASN.1 length");
DBG2(DBG_LIB, "insufficient number of octets to parse ASN.1 length");
return ASN1_INVALID_LENGTH;
}
@@ -145,7 +145,7 @@ size_t asn1_length(chunk_t *blob)
{ /* single length octet */
if (n > blob->len)
{
DBG2("length is larger than remaining blob size");
DBG2(DBG_LIB, "length is larger than remaining blob size");
return ASN1_INVALID_LENGTH;
}
return n;
@@ -156,14 +156,14 @@ size_t asn1_length(chunk_t *blob)
if (n == 0 || n > blob->len)
{
DBG2("number of length octets invalid");
DBG2(DBG_LIB, "number of length octets invalid");
return ASN1_INVALID_LENGTH;
}
if (n > sizeof(len))
{
DBG2("number of length octets is larger than limit of %d octets",
(int)sizeof(len));
DBG2(DBG_LIB, "number of length octets is larger than limit of"
" %d octets", (int)sizeof(len));
return ASN1_INVALID_LENGTH;
}
@@ -176,7 +176,7 @@ size_t asn1_length(chunk_t *blob)
}
if (len > blob->len)
{
DBG2("length is larger than remaining blob size");
DBG2(DBG_LIB, "length is larger than remaining blob size");
return ASN1_INVALID_LENGTH;
}
return len;
@@ -376,7 +376,7 @@ void asn1_debug_simple_object(chunk_t object, asn1_t type, bool private)
oid = asn1_known_oid(object);
if (oid != OID_UNKNOWN)
{
DBG2(" '%s'", oid_names[oid].name);
DBG2(DBG_LIB, " '%s'", oid_names[oid].name);
return;
}
break;
@@ -385,14 +385,14 @@ void asn1_debug_simple_object(chunk_t object, asn1_t type, bool private)
case ASN1_PRINTABLESTRING:
case ASN1_T61STRING:
case ASN1_VISIBLESTRING:
DBG2(" '%.*s'", (int)object.len, object.ptr);
DBG2(DBG_LIB, " '%.*s'", (int)object.len, object.ptr);
return;
case ASN1_UTCTIME:
case ASN1_GENERALIZEDTIME:
{
time_t time = asn1_to_time(&object, type);
DBG2(" '%T'", &time, TRUE);
DBG2(DBG_LIB, " '%T'", &time, TRUE);
}
return;
default:
@@ -400,11 +400,11 @@ void asn1_debug_simple_object(chunk_t object, asn1_t type, bool private)
}
if (private)
{
DBG4("%B", &object);
DBG4(DBG_LIB, "%B", &object);
}
else
{
DBG3("%B", &object);
DBG3(DBG_LIB, "%B", &object);
}
}
@@ -418,13 +418,14 @@ bool asn1_parse_simple_object(chunk_t *object, asn1_t type, u_int level, const c
/* an ASN.1 object must possess at least a tag and length field */
if (object->len < 2)
{
DBG2("L%d - %s: ASN.1 object smaller than 2 octets", level, name);
DBG2(DBG_LIB, "L%d - %s: ASN.1 object smaller than 2 octets", level,
name);
return FALSE;
}
if (*object->ptr != type)
{
DBG2("L%d - %s: ASN1 tag 0x%02x expected, but is 0x%02x",
DBG2(DBG_LIB, "L%d - %s: ASN1 tag 0x%02x expected, but is 0x%02x",
level, name, type, *object->ptr);
return FALSE;
}
@@ -433,12 +434,12 @@ bool asn1_parse_simple_object(chunk_t *object, asn1_t type, u_int level, const c
if (len == ASN1_INVALID_LENGTH || object->len < len)
{
DBG2("L%d - %s: length of ASN.1 object invalid or too large",
DBG2(DBG_LIB, "L%d - %s: length of ASN.1 object invalid or too large",
level, name);
return FALSE;
}
DBG2("L%d - %s:", level, name);
DBG2(DBG_LIB, "L%d - %s:", level, name);
asn1_debug_simple_object(*object, type, FALSE);
return TRUE;
}
@@ -500,7 +501,7 @@ bool is_asn1(chunk_t blob)
if (tag != ASN1_SEQUENCE && tag != ASN1_SET && tag != ASN1_OCTET_STRING)
{
DBG2(" file content is not binary ASN.1");
DBG2(DBG_LIB, " file content is not binary ASN.1");
return FALSE;
}
@@ -518,7 +519,7 @@ bool is_asn1(chunk_t blob)
return TRUE;
}
DBG2(" file size does not match ASN.1 coded length");
DBG2(DBG_LIB, " file size does not match ASN.1 coded length");
return FALSE;
}