summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/passdb.h40
-rw-r--r--source3/include/rpc_samr.h5
-rw-r--r--source3/passdb/passdb.c12
-rw-r--r--source3/passdb/pdb_get_set.c17
-rw-r--r--source3/rpc_parse/parse_samr.c25
-rw-r--r--source3/rpc_server/srv_samr_util.c12
-rw-r--r--source3/rpcclient/cmd_samr.c2
7 files changed, 76 insertions, 37 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 355d1286fd..f13cfbe162 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -26,6 +26,42 @@
/*
+ * fields_present flags meanings
+ * same names as found in samba4 idl files
+ */
+
+#define ACCT_USERNAME 0x00000001
+#define ACCT_FULL_NAME 0x00000002
+#define ACCT_RID 0x00000004
+#define ACCT_PRIMARY_GID 0x00000008
+#define ACCT_ADMIN_DESC 0x00000010
+#define ACCT_DESCRIPTION 0x00000020
+#define ACCT_HOME_DIR 0x00000040
+#define ACCT_HOME_DRIVE 0x00000080
+#define ACCT_LOGON_SCRIPT 0x00000100
+#define ACCT_PROFILE 0x00000200
+#define ACCT_WORKSTATIONS 0x00000400
+#define ACCT_LAST_LOGON 0x00000800
+#define ACCT_LAST_LOGOFF 0x00001000
+#define ACCT_LOGON_HOURS 0x00002000
+#define ACCT_BAD_PWD_COUNT 0x00004000
+#define ACCT_NUM_LOGONS 0x00008000
+#define ACCT_ALLOW_PWD_CHANGE 0x00010000
+#define ACCT_FORCE_PWD_CHANGE 0x00020000
+#define ACCT_LAST_PWD_CHANGE 0x00040000
+#define ACCT_EXPIRY 0x00080000
+#define ACCT_FLAGS 0x00100000
+#define ACCT_CALLBACK 0x00200001
+#define ACCT_COUNTRY_CODE 0x00400000
+#define ACCT_CODE_PAGE 0x00800000
+#define ACCT_NT_PWD_SET 0x01000000
+#define ACCT_LM_PWD_SET 0x02000000
+#define ACCT_PRIVATEDATA 0x04000000
+#define ACCT_EXPIRED_FLAG 0x08000000
+#define ACCT_SEC_DESC 0x10000000
+#define ACCT_OWF_PWD 0x20000000
+
+/*
* bit flags representing initialized fields in SAM_ACCOUNT
*/
enum pdb_elements {
@@ -56,7 +92,7 @@ enum pdb_elements {
PDB_UNKNOWNSTR,
PDB_MUNGEDDIAL,
PDB_HOURS,
- PDB_UNKNOWN3,
+ PDB_FIELDS_PRESENT,
PDB_BAD_PASSWORD_COUNT,
PDB_LOGON_COUNT,
PDB_UNKNOWN6,
@@ -131,7 +167,7 @@ typedef struct sam_passwd
char* plaintext_pw; /* is Null if not available */
uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
- uint32 unknown_3; /* 0x00ff ffff */
+ uint32 fields_present; /* 0x00ff ffff */
uint16 logon_divs; /* 168 - number of hours in a week */
uint32 hours_len; /* normally 21 bytes */
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index 787535d0e9..a8ca504c8f 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -183,7 +183,7 @@ typedef struct sam_user_info_23
uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
- uint32 unknown_3; /* 0x09f8 27fa */
+ uint32 fields_present; /* 0x09f8 27fa */
uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
/* uint8 pad[2] */
@@ -308,7 +308,8 @@ typedef struct sam_user_info_21
uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
- uint32 unknown_3; /* 0x00ff ffff */
+ /* Was unknown_3 */
+ uint32 fields_present; /* 0x00ff ffff */
uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
/* uint8 pad[2] */
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index db3ec6eb11..1549fd0e66 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -79,7 +79,7 @@ void pdb_fill_default_sam(SAM_ACCOUNT *user)
user->private.logoff_time =
user->private.kickoff_time =
user->private.pass_must_change_time = get_time_t_max();
- user->private.unknown_3 = 0x00ffffff; /* don't know */
+ user->private.fields_present = 0x00ffffff;
user->private.logon_divs = 168; /* hours per week */
user->private.hours_len = 21; /* 21 times 8 bits = 168 */
memset(user->private.hours, 0xff, user->private.hours_len); /* available at all hours */
@@ -1332,7 +1332,7 @@ BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
fullname_len, homedir_len, logon_script_len,
profile_path_len, acct_desc_len, workstations_len;
- uint32 user_rid, group_rid, unknown_3, hours_len, unknown_6;
+ uint32 user_rid, group_rid, fields_present, hours_len, unknown_6;
uint16 acct_ctrl, logon_divs;
uint16 bad_password_count, logon_count;
uint8 *hours;
@@ -1371,7 +1371,7 @@ BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
&lm_pw_len, &lm_pw_ptr,
&nt_pw_len, &nt_pw_ptr,
&acct_ctrl,
- &unknown_3,
+ &fields_present,
&logon_divs,
&hours_len,
&hourslen, &hours,
@@ -1449,7 +1449,7 @@ BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_user_sid_from_rid(sampass, user_rid, PDB_SET);
pdb_set_group_sid_from_rid(sampass, group_rid, PDB_SET);
- pdb_set_unknown_3(sampass, unknown_3, PDB_SET);
+ pdb_set_fields_present(sampass, fields_present, PDB_SET);
pdb_set_hours_len(sampass, hours_len, PDB_SET);
pdb_set_bad_password_count(sampass, bad_password_count, PDB_SET);
pdb_set_logon_count(sampass, logon_count, PDB_SET);
@@ -1656,7 +1656,7 @@ uint32 init_buffer_from_sam (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL size_
lm_pw_len, lm_pw,
nt_pw_len, nt_pw,
pdb_get_acct_ctrl(sampass),
- pdb_get_unknown_3(sampass),
+ pdb_get_fields_present(sampass),
pdb_get_logon_divs(sampass),
pdb_get_hours_len(sampass),
MAX_HOURS_LEN, pdb_get_hours(sampass),
@@ -1699,7 +1699,7 @@ uint32 init_buffer_from_sam (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL size_
lm_pw_len, lm_pw,
nt_pw_len, nt_pw,
pdb_get_acct_ctrl(sampass),
- pdb_get_unknown_3(sampass),
+ pdb_get_fields_present(sampass),
pdb_get_logon_divs(sampass),
pdb_get_hours_len(sampass),
MAX_HOURS_LEN, pdb_get_hours(sampass),
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 935b75cf75..2d6b065cbd 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -306,10 +306,10 @@ const char* pdb_get_munged_dial (const SAM_ACCOUNT *sampass)
return (NULL);
}
-uint32 pdb_get_unknown_3 (const SAM_ACCOUNT *sampass)
+uint32 pdb_get_fields_present (const SAM_ACCOUNT *sampass)
{
if (sampass)
- return (sampass->private.unknown_3);
+ return (sampass->private.fields_present);
else
return (-1);
}
@@ -990,14 +990,14 @@ BOOL pdb_set_plaintext_pw_only (SAM_ACCOUNT *sampass, const char *password, enum
return pdb_set_init_flags(sampass, PDB_PLAINTEXT_PW, flag);
}
-BOOL pdb_set_unknown_3 (SAM_ACCOUNT *sampass, uint32 unkn, enum pdb_value_state flag)
+BOOL pdb_set_fields_present (SAM_ACCOUNT *sampass, uint32 fields_present, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private.unknown_3 = unkn;
+ sampass->private.fields_present = fields_present;
- return pdb_set_init_flags(sampass, PDB_UNKNOWN3, flag);
+ return pdb_set_init_flags(sampass, PDB_FIELDS_PRESENT, flag);
}
BOOL pdb_set_bad_password_count(SAM_ACCOUNT *sampass, uint16 bad_password_count, enum pdb_value_state flag)
@@ -1147,3 +1147,10 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
return True;
}
+
+/* check for any PDB_SET/CHANGED field and fill the appropriate mask bit */
+uint32 pdb_build_fields_present (SAM_ACCOUNT *sampass)
+{
+ /* value set to all for testing */
+ return 0x00ffffff;
+}
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 712baa5cf7..40fb8e6fe3 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -5316,7 +5316,6 @@ static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr,
/*************************************************************************
init_sam_user_infoa
- unknown_3 = 0x09f8 27fa
unknown_5 = 0x0001 0000
unknown_6 = 0x0000 04ec
@@ -5362,7 +5361,6 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
/*************************************************************************
init_sam_user_info23
- unknown_3 = 0x09f8 27fa
unknown_6 = 0x0000 04ec
*************************************************************************/
@@ -5386,7 +5384,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
uint32 user_rid, /* 0x0000 0000 */
uint32 group_rid,
uint32 acb_info,
- uint32 unknown_3,
+ uint32 fields_present,
uint16 logon_divs,
LOGON_HRS * hrs,
uint16 bad_password_count,
@@ -5406,7 +5404,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
usr->user_rid = user_rid; /* 0x0000 0000 */
usr->group_rid = group_rid;
usr->acb_info = acb_info;
- usr->unknown_3 = unknown_3; /* 09f8 27fa */
+ usr->fields_present = fields_present; /* 09f8 27fa */
usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
usr->ptr_logon_hrs = hrs ? 1 : 0;
@@ -5464,7 +5462,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
/*************************************************************************
init_sam_user_info23
- unknown_3 = 0x09f8 27fa
unknown_6 = 0x0000 04ec
*************************************************************************/
@@ -5481,7 +5478,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
char *prof_path, const char *desc, char *wkstas,
char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */
uint32 group_rid, uint32 acb_info,
- uint32 unknown_3, uint16 logon_divs,
+ uint32 fields_present, uint16 logon_divs,
LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
char newpass[516], uint32 unknown_6)
{
@@ -5500,7 +5497,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
usr->user_rid = user_rid; /* 0x0000 0000 */
usr->group_rid = group_rid;
usr->acb_info = acb_info;
- usr->unknown_3 = unknown_3; /* 09f8 27fa */
+ usr->fields_present = fields_present; /* 09f8 27fa */
usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
usr->ptr_logon_hrs = hrs ? 1 : 0;
@@ -5619,7 +5616,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
return False;
- if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3))
+ if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
return False;
if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
return False;
@@ -5816,7 +5813,6 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str
/*************************************************************************
init_sam_user_info21W
- unknown_3 = 0x00ff ffff
unknown_6 = 0x0000 04ec
*************************************************************************/
@@ -5843,7 +5839,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
uint32 user_rid,
uint32 group_rid,
uint32 acb_info,
- uint32 unknown_3,
+ uint32 fields_present,
uint16 logon_divs,
LOGON_HRS * hrs,
uint16 bad_password_count,
@@ -5863,7 +5859,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
usr->user_rid = user_rid;
usr->group_rid = group_rid;
usr->acb_info = acb_info;
- usr->unknown_3 = unknown_3; /* 0x00ff ffff */
+ usr->fields_present = fields_present; /* 0x00ff ffff */
usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
usr->ptr_logon_hrs = hrs ? 1 : 0;
@@ -5918,7 +5914,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
/*************************************************************************
init_sam_user_info21
- unknown_3 = 0x00ff ffff
unknown_6 = 0x0000 04ec
*************************************************************************/
@@ -6005,14 +6000,14 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
/*
Look at a user on a real NT4 PDC with usrmgr, press
- 'ok'. Then you will see that unknown_3 is set to
+ 'ok'. Then you will see that fields_present is set to
0x08f827fa. Look at the user immediately after that again,
and you will see that 0x00fffff is returned. This solves
the problem that you get access denied after having looked
at the user.
-- Volker
*/
- usr->unknown_3 = 0x00ffffff;
+ usr->fields_present = pdb_build_fields_present(pw);
usr->logon_divs = pdb_get_logon_divs(pw);
usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
@@ -6133,7 +6128,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
return False;
- if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3))
+ if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
return False;
if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
return False;
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 82f93a5b4c..409fd8efab 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -225,9 +225,9 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
}
- DEBUG(10,("INFO_21 UNKNOWN_3: %08X -> %08X\n",pdb_get_unknown_3(to),from->unknown_3));
- if (from->unknown_3 != pdb_get_unknown_3(to)) {
- pdb_set_unknown_3(to, from->unknown_3, PDB_CHANGED);
+ DEBUG(10,("INFO_21 FIELDS_PRESENT: %08X -> %08X\n",pdb_get_fields_present(to),from->fields_present));
+ if (from->fields_present != pdb_get_fields_present(to)) {
+ pdb_set_fields_present(to, from->fields_present, PDB_CHANGED);
}
DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
@@ -441,9 +441,9 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
}
- DEBUG(10,("INFO_23 UNKOWN_3: %08X -> %08X\n",pdb_get_unknown_3(to),from->unknown_3));
- if (from->unknown_3 != pdb_get_unknown_3(to)) {
- pdb_set_unknown_3(to, from->unknown_3, PDB_CHANGED);
+ DEBUG(10,("INFO_23 FIELDS_PRESENT: %08X -> %08X\n",pdb_get_fields_present(to),from->fields_present));
+ if (from->fields_present != pdb_get_fields_present(to)) {
+ pdb_set_fields_present(to, from->fields_present, PDB_CHANGED);
}
DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 34c6fc35ab..ed06a5a4a0 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -83,7 +83,7 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
printf("\tgroup_rid:\t0x%x\n" , usr->group_rid); /* Group ID */
printf("\tacb_info :\t0x%04x\n", usr->acb_info ); /* Account Control Info */
- printf("\tunknown_3:\t0x%08x\n", usr->unknown_3); /* 0x00ff ffff */
+ printf("\tfields_present:\t0x%08x\n", usr->fields_present); /* 0x00ff ffff */
printf("\tlogon_divs:\t%d\n", usr->logon_divs); /* 0x0000 00a8 which is 168 which is num hrs in a week */
printf("\tbad_password_count:\t0x%08x\n", usr->bad_password_count);
printf("\tlogon_count:\t0x%08x\n", usr->logon_count);