summaryrefslogtreecommitdiff
path: root/source3/passdb/login_cache.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-03-16 21:03:34 +0100
committerVolker Lendecke <vl@samba.org>2010-06-09 10:27:17 +0200
commit1fd15dcb7c31f18036ce15cb504ae2d4a9122629 (patch)
treebbb3e89197806c2c09c23c05233287e50408c602 /source3/passdb/login_cache.c
parent34a8324409961c4837e83c714fb1a285f238312d (diff)
downloadsamba-1fd15dcb7c31f18036ce15cb504ae2d4a9122629.tar.gz
samba-1fd15dcb7c31f18036ce15cb504ae2d4a9122629.tar.bz2
samba-1fd15dcb7c31f18036ce15cb504ae2d4a9122629.zip
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
Diffstat (limited to 'source3/passdb/login_cache.c')
-rw-r--r--source3/passdb/login_cache.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c
index cf6c796321..eba83ea686 100644
--- a/source3/passdb/login_cache.c
+++ b/source3/passdb/login_cache.c
@@ -68,6 +68,7 @@ bool login_cache_read(struct samu *sampass, struct login_cache *entry)
char *keystr;
TDB_DATA databuf;
uint32_t entry_timestamp = 0, bad_password_time = 0;
+ uint16_t acct_ctrl;
if (!login_cache_init()) {
return false;
@@ -92,7 +93,7 @@ bool login_cache_read(struct samu *sampass, struct login_cache *entry)
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"));
@@ -100,6 +101,12 @@ bool login_cache_read(struct samu *sampass, struct login_cache *entry)
return false;
}
+ /*
+ * 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;