summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-10 01:45:49 +0000
committerAndrew Tridgell <tridge@samba.org>2002-03-10 01:45:49 +0000
commit664fa8e572b4ed3db6d1eb2b5023cce4ed25659c (patch)
tree672ea9fc3be754e153f4b09641bbfdc38c1eed86
parent02a601b98c2fa36f1e0b00d8bbf5f5ebb46e8363 (diff)
downloadsamba-664fa8e572b4ed3db6d1eb2b5023cce4ed25659c.tar.gz
samba-664fa8e572b4ed3db6d1eb2b5023cce4ed25659c.tar.bz2
samba-664fa8e572b4ed3db6d1eb2b5023cce4ed25659c.zip
return the correct SID and domain name for the samr enum_domain and
lookup_domain calls. We were incorrectly returning the PDCs domain nameand SID when we are a domain member. We should only do that when we are the DC (This used to be commit f56d689497eaa670cbfb214486ba88d5972129db)
-rw-r--r--source3/rpc_server/srv_samr_nt.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 552623306f..eb8ec16f45 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -2098,16 +2098,27 @@ NTSTATUS _samr_connect(pipes_struct *p, SAMR_Q_CONNECT *q_u, SAMR_R_CONNECT *r_u
NTSTATUS _samr_lookup_domain(pipes_struct *p, SAMR_Q_LOOKUP_DOMAIN *q_u, SAMR_R_LOOKUP_DOMAIN *r_u)
{
- r_u->status = NT_STATUS_OK;
+ fstring domain_name;
+ DOM_SID sid;
+
+ r_u->status = NT_STATUS_OK;
- if (!find_policy_by_hnd(p, &q_u->connect_pol, NULL))
- return NT_STATUS_INVALID_HANDLE;
+ if (!find_policy_by_hnd(p, &q_u->connect_pol, NULL))
+ return NT_STATUS_INVALID_HANDLE;
- /* assume the domain name sent is our global_myname and
- send global_sam_sid */
- init_samr_r_lookup_domain(r_u, &global_sam_sid, r_u->status);
+ rpcstr_pull(domain_name, q_u->uni_domain.buffer, sizeof(domain_name), q_u->uni_domain.uni_str_len*2, 0);
- return r_u->status;
+ ZERO_STRUCT(sid);
+
+ if (!secrets_fetch_domain_sid(domain_name, &sid)) {
+ r_u->status = NT_STATUS_NO_SUCH_DOMAIN;
+ }
+
+ DEBUG(2,("Returning domain sid for domain %s -> %s\n", domain_name, sid_string_static(&sid)));
+
+ init_samr_r_lookup_domain(r_u, &sid, r_u->status);
+
+ return r_u->status;
}
/******************************************************************
@@ -2156,10 +2167,21 @@ NTSTATUS _samr_enum_domains(pipes_struct *p, SAMR_Q_ENUM_DOMAINS *q_u, SAMR_R_EN
{
uint32 num_entries = 2;
fstring dom[2];
+ char *name;
r_u->status = NT_STATUS_OK;
- fstrcpy(dom[0],global_myworkgroup);
+ switch (lp_server_role()) {
+ case ROLE_DOMAIN_PDC:
+ case ROLE_DOMAIN_BDC:
+ name = global_myworkgroup;
+ break;
+ default:
+ name = global_myname;
+ }
+
+ fstrcpy(dom[0],name);
+ strupper(dom[0]);
fstrcpy(dom[1],"Builtin");
if (!make_enum_domains(p->mem_ctx, &r_u->sam, &r_u->uni_dom_name, num_entries, dom))