summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-06-22 14:16:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:58 -0500
commit864ca4f0510da95cadf5ad449b2ec818a78d8c17 (patch)
treea5bc84aed720079ea509f6d41d1c11022d18716b
parentf1c8b8235bec0a221edf7d1b0fcbf3c1e97ce7e1 (diff)
downloadsamba-864ca4f0510da95cadf5ad449b2ec818a78d8c17.tar.gz
samba-864ca4f0510da95cadf5ad449b2ec818a78d8c17.tar.bz2
samba-864ca4f0510da95cadf5ad449b2ec818a78d8c17.zip
r7836: Fix the bug where users show up as trusting domains.
Volker (This used to be commit 61585fa56b4f838f416815598f4a301aa9ee12d7)
-rw-r--r--source3/rpc_server/srv_samr_nt.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index e510f69cc8..9b98d4cb16 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -45,11 +45,14 @@ extern rid_name domain_alias_rids[];
extern rid_name builtin_alias_rids[];
typedef struct disp_info {
- struct pdb_search *users;
- struct pdb_search *machines;
- struct pdb_search *groups;
- struct pdb_search *aliases;
- struct pdb_search *builtins;
+ struct pdb_search *users; /* querydispinfo 1 and 4 */
+ struct pdb_search *machines; /* querydispinfo 2 */
+ struct pdb_search *groups; /* querydispinfo 3 and 5, enumgroups */
+ struct pdb_search *aliases; /* enumaliases */
+ struct pdb_search *builtins; /* enumaliases */
+
+ uint16 enum_acb_mask;
+ struct pdb_search *enum_users; /* enumusers with a mask */
} DISP_INFO;
struct samr_info {
@@ -264,6 +267,8 @@ static void free_samr_db(struct samr_info *info)
info->disp_info.aliases = NULL;
pdb_search_destroy(info->disp_info.builtins);
info->disp_info.builtins = NULL;
+ pdb_search_destroy(info->disp_info.enum_users);
+ info->disp_info.enum_users = NULL;
}
static void free_samr_info(void *ptr)
@@ -590,11 +595,19 @@ NTSTATUS _samr_enum_dom_users(pipes_struct *p, SAMR_Q_ENUM_DOM_USERS *q_u,
DEBUG(5,("_samr_enum_dom_users: %d\n", __LINE__));
become_root();
- if (info->disp_info.users == NULL)
- info->disp_info.users = pdb_search_users(q_u->acb_mask);
- if (info->disp_info.users == NULL)
+ if ((info->disp_info.enum_users != NULL) &&
+ (info->disp_info.enum_acb_mask != q_u->acb_mask)) {
+ pdb_search_destroy(info->disp_info.enum_users);
+ info->disp_info.enum_users = NULL;
+ }
+
+ if (info->disp_info.enum_users == NULL) {
+ info->disp_info.enum_users = pdb_search_users(q_u->acb_mask);
+ info->disp_info.enum_acb_mask = q_u->acb_mask;
+ }
+ if (info->disp_info.enum_users == NULL)
return NT_STATUS_ACCESS_DENIED;
- num_account = pdb_search_entries(info->disp_info.users,
+ num_account = pdb_search_entries(info->disp_info.enum_users,
enum_context, max_entries,
&entries);
unbecome_root();