summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-09-04 22:02:53 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-09-04 22:02:53 +0000
commitcc5088b5f4174a7f44004746d3c7d395d51441ff (patch)
treeff54ec60f2729f714797755652b4a18c744b6a7c /source3
parentcbaa14857b6fd2704fa920c1fb15011e70b7df0f (diff)
downloadsamba-cc5088b5f4174a7f44004746d3c7d395d51441ff.tar.gz
samba-cc5088b5f4174a7f44004746d3c7d395d51441ff.tar.bz2
samba-cc5088b5f4174a7f44004746d3c7d395d51441ff.zip
Only cache the user list on the SAMR handle for a particular
acb_mask/all_machines flag combination. The avoids a bug where we were listing users in the 'trusting domains' dialog in usrmgr. We might also need to invalidate the cache for some other SAMR actions. Andrew Bartlett (This used to be commit 65047aee7fefefaecded9772184a54c046ab1784)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_samr_nt.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 927acb24b8..e2336aca55 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -57,6 +57,8 @@ struct samr_info {
DOM_SID sid;
uint32 status; /* some sort of flag. best to record it. comes from opnum 0x39 */
uint32 acc_granted;
+ uint16 acb_mask;
+ BOOL all_machines;
DISP_INFO disp_info;
TALLOC_CTX *mem_ctx;
@@ -150,26 +152,36 @@ static struct samr_info *get_samr_info_by_sid(DOM_SID *psid)
return info;
}
+
/*******************************************************************
Function to free the per handle data.
********************************************************************/
-static void free_samr_db(struct samr_info *info)
+static void free_samr_users(struct samr_info *info)
{
int i;
- /* Groups are talloced */
-
if (info->disp_info.user_dbloaded){
for (i=0; i<info->disp_info.num_user_account; i++) {
/* Not really a free, actually a 'clear' */
pdb_free_sam(&info->disp_info.disp_user_info[i].sam);
}
}
-
info->disp_info.user_dbloaded=False;
+ info->disp_info.num_user_account=0;
+}
+
+
+/*******************************************************************
+ Function to free the per handle data.
+ ********************************************************************/
+static void free_samr_db(struct samr_info *info)
+{
+ /* Groups are talloced */
+
+ free_samr_users(info);
+
info->disp_info.group_dbloaded=False;
info->disp_info.num_group_account=0;
- info->disp_info.num_user_account=0;
}
@@ -208,11 +220,15 @@ static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOO
DEBUG(10,("load_sampwd_entries\n"));
/* if the snapshoot is already loaded, return */
- if (info->disp_info.user_dbloaded==True) {
+ if ((info->disp_info.user_dbloaded==True)
+ && (info->acb_mask == acb_mask)
+ && (info->all_machines == all_machines)) {
DEBUG(10,("load_sampwd_entries: already in memory\n"));
return NT_STATUS_OK;
}
+ free_samr_users(info);
+
if (!pdb_setsampwent(False)) {
DEBUG(0, ("load_sampwd_entries: Unable to open passdb.\n"));
return NT_STATUS_ACCESS_DENIED;
@@ -261,6 +277,8 @@ static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOO
/* the snapshoot is in memory, we're ready to enumerate fast */
+ info->acb_mask = acb_mask;
+ info->all_machines = all_machines;
info->disp_info.user_dbloaded=True;
DEBUG(12,("load_sampwd_entries: done\n"));