summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-31 01:29:53 +0000
committerSimo Sorce <idra@samba.org>2001-08-31 01:29:53 +0000
commit137fb61490080c3419e109dbfd40aca14caa4c95 (patch)
tree5fb90e4045d3868fdebabcb014b8b835473585c5 /source3
parent4bd774f458e0628986c8b135686238acf2ff32c9 (diff)
downloadsamba-137fb61490080c3419e109dbfd40aca14caa4c95.tar.gz
samba-137fb61490080c3419e109dbfd40aca14caa4c95.tar.bz2
samba-137fb61490080c3419e109dbfd40aca14caa4c95.zip
changed the data format in the tdb, as the time fields were not
managed correctly. this mean you need to rebuild your passdb.tdb file. (This used to be commit 57b8d3bb84e261e55febdde88e45684455f0a294)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_tdb.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index fc19f27918..909a5d809f 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -23,8 +23,9 @@
#ifdef WITH_TDBPWD
+#define PDB_VERSION "20010830"
#define PASSDB_FILE_NAME "/passdb.tdb"
-#define TDB_FORMAT_STRING "BBBBBBBBBBBBBBBBBBddBBwdwdBdd"
+#define TDB_FORMAT_STRING "ddddddBBBBBBBBBBBBddBBwdwdBdd"
#define USERPREFIX "USER_"
#define RIDPREFIX "RID_"
@@ -48,13 +49,16 @@ static struct tdb_enum_info global_tdb_ent;
static BOOL init_sam_from_buffer (SAM_ACCOUNT *sampass, uint8 *buf,
uint32 buflen)
{
- time_t logon_time,
+
+ /* times are stored as 32bit integer
+ take care on system with 64bit wide time_t
+ --SSS */
+ uint32 logon_time,
logoff_time,
kickoff_time,
pass_last_set_time,
pass_can_change_time,
pass_must_change_time;
- uint32 time_t_len;
char *username;
char *domain;
char *nt_username;
@@ -83,12 +87,12 @@ static BOOL init_sam_from_buffer (SAM_ACCOUNT *sampass, uint8 *buf,
/* unpack the buffer into variables */
len = tdb_unpack (buf, buflen, TDB_FORMAT_STRING,
- &time_t_len, &logon_time,
- &time_t_len, &logoff_time,
- &time_t_len, &kickoff_time,
- &time_t_len, &pass_last_set_time,
- &time_t_len, &pass_can_change_time,
- &time_t_len, &pass_must_change_time,
+ &logon_time,
+ &logoff_time,
+ &kickoff_time,
+ &pass_last_set_time,
+ &pass_can_change_time,
+ &pass_must_change_time,
&username_len, &username,
&domain_len, &domain,
&nt_username_len, &nt_username,
@@ -161,7 +165,10 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
{
size_t len, buflen;
- time_t logon_time,
+ /* times are stored as 32bit integer
+ take care on system with 64bit wide time_t
+ --SSS */
+ uint32 logon_time,
logoff_time,
kickoff_time,
pass_last_set_time,
@@ -186,7 +193,6 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
uint8 *lm_pw;
uint8 *nt_pw;
- uint32 time_t_len = sizeof (time_t);
uint32 lm_pw_len = 16;
uint32 nt_pw_len = 16;
@@ -250,12 +256,12 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
/* one time to get the size needed */
len = tdb_pack(NULL, 0, TDB_FORMAT_STRING,
- time_t_len, &logon_time,
- time_t_len, &logoff_time,
- time_t_len, &kickoff_time,
- time_t_len, &pass_last_set_time,
- time_t_len, &pass_can_change_time,
- time_t_len, &pass_must_change_time,
+ logon_time,
+ logoff_time,
+ kickoff_time,
+ pass_last_set_time,
+ pass_can_change_time,
+ pass_must_change_time,
username_len, username,
domain_len, domain,
nt_username_len, nt_username,
@@ -289,14 +295,13 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
}
/* now for the real call to tdb_pack() */
- /* one time to get the size needed */
buflen = tdb_pack(*buf, len, TDB_FORMAT_STRING,
- time_t_len, &logon_time,
- time_t_len, &logoff_time,
- time_t_len, &kickoff_time,
- time_t_len, &pass_last_set_time,
- time_t_len, &pass_can_change_time,
- time_t_len, &pass_must_change_time,
+ logon_time,
+ logoff_time,
+ kickoff_time,
+ pass_last_set_time,
+ pass_can_change_time,
+ pass_must_change_time,
username_len, username,
domain_len, domain,
nt_username_len, nt_username,