aboutsummaryrefslogtreecommitdiff
path: root/src/tests/asn.1/trval.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-02-21 18:57:44 +0000
committerTom Yu <tlyu@mit.edu>2012-06-25 18:56:26 -0400
commit33af1767f876ff4a13f28513dede75e71544523f (patch)
treeb8c8be9950d69d1165a53dd1dfe2609bf197e23e /src/tests/asn.1/trval.c
parentceb037a667a6411ebb56f67535cb0d76f9511e4c (diff)
downloadkrb5-krb5-1.8.zip
krb5-krb5-1.8.tar.gz
krb5-krb5-1.8.tar.bz2
Fix kvno ASN.1 encoding interop with Windows RODCskrb5-1.8
RFC 4120 defines the EncryptedData kvno field as an integer in the range of unsigned 32-bit numbers. Windows encodes and decodes the field as a signed 32-bit integer. Historically we do the same in our encoder in 1.6 and prior, and in our decoder through 1.10. (Actually, our decoder through 1.10 decoded the value as a long and then cast the result to unsigned int, so it would accept positive values >= 2^31 on 64-bit platforms but not on 32-bit platforms.) kvno values that large (or negative) are only likely to appear in the context of Windows read-only domain controllers. So do what Windows does instead of what RFC 4120 says. (back ported from commit 7558fb3af9f9fdfb8195333c11a70ab7b354f82c) Add test cases for Windows RODC kvno compatibility (back ported from commit 8b33ff2daebcf3e4ccff6a938b410239b76ba287) Eliminate trailing whitespace in trval output Modify the trval output slightly so that the reference trval output files don't containing trailing whitespace, to make them friendlier to our git hooks. (The pkinit and ldap trval reference files now contain a leading blank line, which isn't very elegant, but avoiding that requires too much Makefile.in complexity.) Also correct a typo. (back ported from cff6ea939f061d17a5742a04b8eeb2905c1813dc) Restore some spaces in trval This is a cosmetic change to reintroduce some space characters that cff6ea939f061d17a5742a04b8eeb2905c1813dc removed, e.g. between the tag and the length or short value. (back ported from 0f976348054ca2f51187fe083a8c4668841f0b6d) ticket: 7186 (new) version_fixed: 1.8.7 status: resolved
Diffstat (limited to 'src/tests/asn.1/trval.c')
-rw-r--r--src/tests/asn.1/trval.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/tests/asn.1/trval.c b/src/tests/asn.1/trval.c
index b61bc3c..cb08da3 100644
--- a/src/tests/asn.1/trval.c
+++ b/src/tests/asn.1/trval.c
@@ -225,6 +225,7 @@ context_restart:
((eid & ID_CLASS) == CLASS_CONT) && (lev > 0)) {
rlen_ext += 2 + xlen;
enc += 2 + xlen;
+ fprintf(fp, " ");
goto context_restart;
}
@@ -235,8 +236,8 @@ context_restart:
break;
case FORM_CONS:
if (print_constructed_length) {
- fprintf(fp, "constr ");
- fprintf(fp, "<%d>", elen);
+ fprintf(fp, " constr");
+ fprintf(fp, " <%d>", elen);
}
r = do_cons(fp, enc+2+xlen, elen, lev+1, &rlen2);
*rlen = 2 + xlen + rlen2 + rlen_ext;
@@ -286,7 +287,7 @@ int do_prim_bitstring(fp, tag, enc, len, lev)
num += enc[i];
}
- fprintf(fp, "0x%lx", num);
+ fprintf(fp, " 0x%lx", num);
if (enc[0])
fprintf(fp, " (%d unused bits)", enc[0]);
return 1;
@@ -316,7 +317,7 @@ int do_prim_int(fp, tag, enc, len, lev)
num += enc[i];
}
- fprintf(fp, "%ld", num);
+ fprintf(fp, " %ld", num);
return 1;
}
@@ -343,7 +344,7 @@ int do_prim_string(fp, tag, enc, len, lev)
for (i=0; i < len; i++)
if (!isprint(enc[i]))
return 0;
- fprintf(fp, "\"%.*s\"", len, enc);
+ fprintf(fp, " \"%.*s\"", len, enc);
return 1;
}
@@ -367,7 +368,7 @@ int do_prim(fp, tag, enc, len, lev)
return OK;
if (print_primitive_length)
- fprintf(fp, "<%d>", len);
+ fprintf(fp, " <%d>", len);
width = (80 - (lev * 3) - 8) / 4;
@@ -477,7 +478,7 @@ struct typestring_table univ_types[] = {
#ifdef KRB5
struct typestring_table krb5_types[] = {
{ 1, -1, "Krb5 Ticket"},
- { 2, -1, "Krb5 Autenticator"},
+ { 2, -1, "Krb5 Authenticator"},
{ 3, -1, "Krb5 Encrypted ticket part"},
{ 10, -1, "Krb5 AS-REQ packet"},
{ 11, -1, "Krb5 AS-REP packet"},
@@ -760,7 +761,7 @@ void print_tag_type(fp, eid, lev)
fprintf(fp, "UNIV %d???", eid & ID_TAG);
}
- fprintf(fp, "] ");
+ fprintf(fp, "]");
}