kdc: fix comparision between krb5uint32 and (unsigned int) lorikeet-heimdal-201107241840
authorStefan Metzmacher <metze@samba.org>
Fri, 15 Jul 2011 06:44:53 +0000 (08:44 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 25 Jul 2011 16:40:28 +0000 (18:40 +0200)
commit0fdf11fa3cdb47df9f5393ebf36d9f5742243036
treeea0b172abcffa69489e42070d558dbf5cab12a9f
parent58cd08b72e07fd9fc7f8683e3a1b5cab131f0b7c
kdc: fix comparision between krb5uint32 and (unsigned int)

We don't need a cast in that case.

Before commit 1124c4872dfb81bec9c4b527b8927ca35e39a599
(KVNOs are krb5uint32 in RFC4120, make it so),
we compared krb5int32 casted to size_t with unsigned int,
which resulted in the following problem:

Casting krb5int32 to (size_t) is wrong, as sizeof(int)==4 != sizeof(size_t)== 8.

If you cast negative int values to size_t you'll get this:

int ival = -5000; // 0xFFFFEC78
size_t sval = (size_t)ival; // this will be 0xFFFFFFFFFFFFEC78

So we better compare while casting to (unsigned int).

This is important for Active Directory RODC support,
which adds a random number into the higher 16-bits of the
32-bit kvno value.

metze
kdc/krb5tgs.c