diff options
author | Stefan Metzmacher <metze@samba.org> | 2019-11-29 13:47:16 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-02-10 16:32:36 +0000 |
commit | 0be5505942917c068c5996c02c4772c40c072dba (patch) | |
tree | d2c8b2bee304dfc7dc142a3b896bcc84396cc5fb /lib/krb5_wrap | |
parent | fd2ca9d26d52b9c007192baf2d91219325f3e292 (diff) | |
download | samba-0be5505942917c068c5996c02c4772c40c072dba.tar.gz |
lib/krb5_wrap: prefer new enctyptes in ms_suptypes_to_ietf_enctypes()
This is currently not critical as we only use keytabs
only as acceptor, but in future we'll also use them
for kinit() and there we should prefer the newest type.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib/krb5_wrap')
-rw-r--r-- | lib/krb5_wrap/enctype_convert.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/krb5_wrap/enctype_convert.c b/lib/krb5_wrap/enctype_convert.c index a658911190a..4a644358c17 100644 --- a/lib/krb5_wrap/enctype_convert.c +++ b/lib/krb5_wrap/enctype_convert.c @@ -83,13 +83,17 @@ krb5_error_code ms_suptypes_to_ietf_enctypes(TALLOC_CTX *mem_ctx, uint32_t enctype_bitmap, krb5_enctype **enctypes) { - unsigned int i, j = 0; + size_t max_bits = 8 * sizeof(enctype_bitmap); + size_t j = 0; + ssize_t i; + *enctypes = talloc_zero_array(mem_ctx, krb5_enctype, - (8 * sizeof(enctype_bitmap)) + 1); + max_bits + 1); if (!*enctypes) { return ENOMEM; } - for (i = 0; i < (8 * sizeof(enctype_bitmap)); i++) { + + for (i = max_bits - 1; i >= 0; i--) { uint32_t bit_value = (1U << i) & enctype_bitmap; if (bit_value & enctype_bitmap) { (*enctypes)[j] = ms_suptype_to_ietf_enctype(bit_value); |