kdc: fix comparision between krb5uint32 and (unsigned int)
commitaedb034228aaefd0fd7577635d66ef5e282d9496
authorStefan Metzmacher <metze@samba.org>
Fri, 15 Jul 2011 06:44:53 +0000 (15 08:44 +0200)
committerLove Hörnquist Åstrand <lha@h5l.org>
Sat, 30 Jul 2011 19:37:16 +0000 (30 12:37 -0700)
tree6e2b2e16650246b70b92c1fd4ec548be08dc514b
parent1d96f39170620b6d7a7e33d0e49cb8f864a36e32
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

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
kdc/krb5tgs.c