From e3a56d2d28b06d1e0b576248496e2032d6b5e2d0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 16 Mar 2010 21:03:34 +0100 Subject: [PATCH] s3: Fix bug 7253 acct_ctrl is 32 bit in LOGIN_CACHE, but "w" as a format specifier for tdb_unpack only writes 16 bits. Okay on x86, not okay on Solaris. Thanks to Vladimir.Marek@Sun.COM! Volker --- source3/passdb/login_cache.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c index 5630372..5adb24c 100644 --- a/source3/passdb/login_cache.c +++ b/source3/passdb/login_cache.c @@ -69,6 +69,7 @@ LOGIN_CACHE * login_cache_read(struct samu *sampass) TDB_DATA databuf; LOGIN_CACHE *entry; uint32_t entry_timestamp = 0, bad_password_time = 0; + uint16_t acct_ctrl; if (!login_cache_init()) return NULL; @@ -97,7 +98,7 @@ LOGIN_CACHE * login_cache_read(struct samu *sampass) if (tdb_unpack (databuf.dptr, databuf.dsize, SAM_CACHE_FORMAT, &entry_timestamp, - &entry->acct_ctrl, + &acct_ctrl, &entry->bad_password_count, &bad_password_time) == -1) { DEBUG(7, ("No cache entry found\n")); @@ -106,6 +107,12 @@ LOGIN_CACHE * login_cache_read(struct samu *sampass) return NULL; } + /* + * Deal with 32-bit acct_ctrl. In the tdb we only store 16-bit + * ("w" in SAM_CACHE_FORMAT). Fixes bug 7253. + */ + entry->acct_ctrl = acct_ctrl; + /* Deal with possible 64-bit time_t. */ entry->entry_timestamp = (time_t)entry_timestamp; entry->bad_password_time = (time_t)bad_password_time; -- 1.6.0.4