From ccc8585567804d6a7e6f684a97d58871e2fd9f8a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Nov 1999 00:26:11 +0000 Subject: added regqueryval command (experimental) to get reg_io_q_info() and reg_io_r_info() working properly. previously they weren't well understood (well, they were the first of the registry functions i did, back in december 97, ok??? :-) set ntversion to 0x1 in SAMQUERY, so that we reply same as NT4 srv. (This used to be commit 98ddeaf442cb30972cb281bf0489a6e5f7eb2883) --- source3/rpc_server/srv_lsa.c | 52 ++++++++++++++++++++++++++++++++------------ source3/rpc_server/srv_reg.c | 6 ++--- 2 files changed, 41 insertions(+), 17 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 36259477da..7bc5841cfc 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -39,18 +39,19 @@ lsa_reply_open_policy2 ***************************************************************************/ static void lsa_reply_open_policy2(prs_struct *rdata) { - int i; LSA_R_OPEN_POL2 r_o; ZERO_STRUCT(r_o); /* set up the LSA QUERY INFO response */ - for (i = 4; i < POL_HND_SIZE; i++) + r_o.status = 0x0; + + /* get a (unique) handle. open a policy on it. */ + if (!open_lsa_policy_hnd(&r_o.pol)) { - r_o.pol.data[i] = i; + r_o.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND; } - r_o.status = 0x0; /* store the response in the SMB stream */ lsa_io_r_open_pol2("", &r_o, rdata, 0); @@ -61,18 +62,19 @@ lsa_reply_open_policy ***************************************************************************/ static void lsa_reply_open_policy(prs_struct *rdata) { - int i; LSA_R_OPEN_POL r_o; ZERO_STRUCT(r_o); /* set up the LSA QUERY INFO response */ - for (i = 4; i < POL_HND_SIZE; i++) + r_o.status = 0x0; + + /* get a (unique) handle. open a policy on it. */ + if (!open_lsa_policy_hnd(&r_o.pol)) { - r_o.pol.data[i] = i; + r_o.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND; } - r_o.status = 0x0; /* store the response in the SMB stream */ lsa_io_r_open_pol("", &r_o, rdata, 0); @@ -128,15 +130,22 @@ static void lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata, ZERO_STRUCT(r_q); - /* set up the LSA QUERY INFO response */ - - r_q.undoc_buffer = 0x22000000; /* bizarre */ - r_q.info_class = q_q->info_class; + /* get a (unique) handle. open a policy on it. */ + if (r_q.status == 0x0 && !open_lsa_policy_hnd(&q_q->pol)) + { + r_q.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + else + { + /* set up the LSA QUERY INFO response */ - make_dom_query(&r_q.dom.id5, dom_name, dom_sid); + r_q.undoc_buffer = 0x1; /* bizarre */ + r_q.info_class = q_q->info_class; - r_q.status = 0x0; + make_dom_query(&r_q.dom.id5, dom_name, dom_sid); + r_q.status = 0x0; + } /* store the response in the SMB stream */ lsa_io_r_query("", &r_q, rdata, 0); } @@ -572,9 +581,24 @@ static void api_lsa_close( pipes_struct *p, prs_struct *data, prs_struct *rdata) { LSA_R_CLOSE r_c; + LSA_Q_CLOSE q_c; + + lsa_io_q_close("", &q_c, data, 0); ZERO_STRUCT(r_c); + r_c.status = 0x0; + + /* find the connection policy handle. */ + if (r_c.status == 0x0 && (find_lsa_policy_by_hnd(&(q_c.pol)) == -1)) + { + r_c.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE; + } + if (r_c.status == 0x0) + { + close_lsa_policy_hnd(&(q_c.pol)); + } + /* store the response in the SMB stream */ lsa_io_r_close("", &r_c, rdata, 0); } diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index fcc22a792a..ab7e4cf3ec 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -142,8 +142,8 @@ static void reg_reply_open_entry(REG_Q_OPEN_ENTRY *q_u, { DEBUG(5,("reg_open_entry: %s\n", name)); /* lkcl XXXX do a check on the name, here */ - if (!strequal(name, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions") || - !strequal(name, "SYSTEM\\CurrentControlSet\\Services\\NETLOGON\\Parameters")) + if (!strequal(name, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions") && + !strequal(name, "SYSTEM\\CurrentControlSet\\Services\\NETLOGON\\Parameters\\")) { status = 0xC000000 | NT_STATUS_ACCESS_DENIED; } @@ -197,9 +197,9 @@ static void reg_reply_info(REG_Q_INFO *q_u, if (status == 0) { + make_reg_r_info(&r_u, 1, "LanmanNT", status); } - make_reg_r_info(&r_u, 1, "LanmanNT", status); /* store the response in the SMB stream */ reg_io_r_info("", &r_u, rdata, 0); -- cgit