summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-26 08:10:51 +0000
committerJeremy Allison <jra@samba.org>2001-02-26 08:10:51 +0000
commit683ccef0bdfc6a1460087cc3eed2b7ac643d0227 (patch)
tree3175eb03fba361338da1fb421d4381ea16ee0c27
parent0d54de536c03f941739359a121a337aa33a2dc84 (diff)
downloadsamba-683ccef0bdfc6a1460087cc3eed2b7ac643d0227.tar.gz
samba-683ccef0bdfc6a1460087cc3eed2b7ac643d0227.tar.bz2
samba-683ccef0bdfc6a1460087cc3eed2b7ac643d0227.zip
Started conversion of lsa server code to canonical format (as srv_reg and
srv_samr have been). Jeremy. (This used to be commit f434cda9774b4864321b37b0f8f42e6e8dee8d5b)
-rw-r--r--source3/include/proto.h11
-rw-r--r--source3/include/rpc_lsa.h19
-rw-r--r--source3/rpc_parse/parse_lsa.c39
-rw-r--r--source3/rpc_server/srv_lsa.c151
4 files changed, 162 insertions, 58 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 1f00ade95b..73b46af447 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2403,6 +2403,8 @@ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r,
void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd);
BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth);
BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth);
+BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth);
+BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth);
/*The following definitions come from rpc_parse/parse_misc.c */
@@ -3383,6 +3385,15 @@ pipes_struct *get_rpc_pipe(int pnum);
BOOL api_reg_rpc(pipes_struct *p);
#endif
+/*The following definitions come from rpc_server/srv_reg_nt.c */
+
+#if OLD_NTDOMAIN
+uint32 _reg_close(pipes_struct *p, REG_Q_CLOSE *q_u, REG_R_CLOSE *r_u);
+uint32 _reg_open(pipes_struct *p, REG_Q_OPEN_HKLM *q_u, REG_R_OPEN_HKLM *r_u);
+uint32 _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY *r_u);
+uint32 _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u);
+#endif
+
/*The following definitions come from rpc_server/srv_samr.c */
#if OLD_NTDOMAIN
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h
index 60daa261ba..186f8f1115 100644
--- a/source3/include/rpc_lsa.h
+++ b/source3/include/rpc_lsa.h
@@ -360,4 +360,23 @@ typedef struct lsa_r_lookup_names
} LSA_R_LOOKUP_NAMES;
+/* This is probably a policy handle but at the moment we
+ never read it - so use a dummy struct. */
+
+typedef struct lsa_q_open_secret
+{
+ uint32 dummy;
+} LSA_Q_OPEN_SECRET;
+
+/* We always return "not found" at present - so just marshal the minimum. */
+
+typedef struct lsa_r_open_secret
+{
+ uint32 dummy1;
+ uint32 dummy2;
+ uint32 dummy3;
+ uint32 dummy4;
+ uint32 status;
+} LSA_R_OPEN_SECRET;
+
#endif /* _RPC_LSA_H */
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 8654453bcf..a33c759473 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -1257,3 +1257,42 @@ BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
return True;
}
+
+/*******************************************************************
+ Reads or writes an LSA_Q_OPEN_SECRET structure.
+********************************************************************/
+
+BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
+ depth++;
+
+ /* Don't bother to read or write at present... */
+ return True;
+}
+
+/*******************************************************************
+ Reads or writes an LSA_R_OPEN_SECRET structure.
+********************************************************************/
+
+BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
+ depth++;
+
+ if(!prs_align(ps))
+ return False;
+
+ if(!prs_uint32("dummy1", ps, depth, &r_c->dummy1))
+ return False;
+ if(!prs_uint32("dummy2", ps, depth, &r_c->dummy2))
+ return False;
+ if(!prs_uint32("dummy3", ps, depth, &r_c->dummy3))
+ return False;
+ if(!prs_uint32("dummy4", ps, depth, &r_c->dummy4))
+ return False;
+ if(!prs_uint32("status", ps, depth, &r_c->status))
+ return False;
+
+ return True;
+}
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index 3629bb7d8e..7d79de6bba 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -6,7 +6,7 @@
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
- * Copyright (C) Jeremy Allison 1998.
+ * Copyright (C) Jeremy Allison 2001.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ static void lsa_reply_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM *q_e,
/* set up the LSA QUERY INFO response */
init_r_enum_trust_dom(&r_e, enum_context, dom_name, dom_sid,
- dom_name != NULL ? 0x0 : 0x80000000 | NT_STATUS_UNABLE_TO_FREE_VM);
+ dom_name != NULL ? NT_STATUS_NO_PROBLEMO : NT_STATUS_UNABLE_TO_FREE_VM);
/* store the response in the SMB stream */
lsa_io_r_enum_trust_dom("", &r_e, rdata, 0);
@@ -267,9 +267,9 @@ static void init_reply_lookup_names(LSA_R_LOOKUP_NAMES *r_l,
r_l->mapped_count = mapped_count;
if (mapped_count == 0)
- r_l->status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ r_l->status = NT_STATUS_NONE_MAPPED;
else
- r_l->status = 0x0;
+ r_l->status = NT_STATUS_NO_PROBLEMO;
}
/***************************************************************************
@@ -362,9 +362,9 @@ static void init_reply_lookup_sids(LSA_R_LOOKUP_SIDS *r_l,
r_l->mapped_count = mapped_count;
if (mapped_count == 0)
- r_l->status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ r_l->status = NT_STATUS_NONE_MAPPED;
else
- r_l->status = 0x0;
+ r_l->status = NT_STATUS_NO_PROBLEMO;
}
/***************************************************************************
@@ -399,36 +399,6 @@ static BOOL lsa_reply_lookup_sids(prs_struct *rdata, DOM_SID2 *sid, int num_entr
}
/***************************************************************************
-lsa_reply_lookup_names
- ***************************************************************************/
-
-static BOOL lsa_reply_lookup_names(prs_struct *rdata, UNISTR2 *names,
- int num_entries)
-{
- LSA_R_LOOKUP_NAMES r_l;
- DOM_R_REF ref;
- DOM_RID2 rids[MAX_LOOKUP_SIDS];
- uint32 mapped_count = 0;
- BOOL result = True;
-
- ZERO_STRUCT(r_l);
- ZERO_STRUCT(ref);
- ZERO_ARRAY(rids);
-
- /* set up the LSA Lookup RIDs response */
- init_lsa_rid2s(&ref, rids, num_entries, names, &mapped_count);
- init_reply_lookup_names(&r_l, &ref, num_entries, rids, mapped_count);
-
- /* store the response in the SMB stream */
- if(!lsa_io_r_lookup_names("", &r_l, rdata, 0)) {
- DEBUG(0,("lsa_reply_lookup_names: Failed to marshall LSA_R_LOOKUP_NAMES.\n"));
- result = False;
- }
-
- return result;
-}
-
-/***************************************************************************
api_lsa_open_policy2
***************************************************************************/
@@ -587,7 +557,7 @@ static BOOL api_lsa_query_info(pipes_struct *p)
break;
default:
DEBUG(0,("api_lsa_query_info: unknown info level in Lsa Query: %d\n", q_i.info_class));
- r_q.status = (NT_STATUS_INVALID_INFO_CLASS | 0xC0000000);
+ r_q.status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
@@ -626,38 +596,90 @@ static BOOL api_lsa_lookup_sids(pipes_struct *p)
}
/***************************************************************************
+lsa_reply_lookup_names
+ ***************************************************************************/
+
+static uint32 _lsa_lookup_names(pipes_struct *p,LSA_Q_LOOKUP_NAMES *q_u, LSA_R_LOOKUP_NAMES *r_u)
+{
+ UNISTR2 *names = q_u->uni_name;
+ int num_entries = q_u->num_entries;
+ DOM_R_REF ref;
+ DOM_RID2 rids[MAX_LOOKUP_SIDS];
+ uint32 mapped_count = 0;
+
+ ZERO_STRUCT(ref);
+ ZERO_ARRAY(rids);
+
+ /* set up the LSA Lookup RIDs response */
+ init_lsa_rid2s(&ref, rids, num_entries, names, &mapped_count);
+ init_reply_lookup_names(r_u, &ref, num_entries, rids, mapped_count);
+
+ return r_u->status;
+}
+
+/***************************************************************************
api_lsa_lookup_names
***************************************************************************/
static BOOL api_lsa_lookup_names(pipes_struct *p)
{
- LSA_Q_LOOKUP_NAMES q_l;
+ LSA_Q_LOOKUP_NAMES q_u;
+ LSA_R_LOOKUP_NAMES r_u;
prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
- ZERO_STRUCT(q_l);
+ ZERO_STRUCT(q_u);
+ ZERO_STRUCT(r_u);
/* grab the info class and policy handle */
- if(!lsa_io_q_lookup_names("", &q_l, data, 0)) {
+ if(!lsa_io_q_lookup_names("", &q_u, data, 0)) {
DEBUG(0,("api_lsa_lookup_names: failed to unmarshall LSA_Q_LOOKUP_NAMES.\n"));
return False;
}
- return lsa_reply_lookup_names(rdata, q_l.uni_name, q_l.num_entries);
+ r_u.status = _lsa_lookup_names(p, &q_u, &r_u);
+
+ /* store the response in the SMB stream */
+ if(!lsa_io_r_lookup_names("", &r_u, rdata, 0)) {
+ DEBUG(0,("api_lsa_lookup_names: Failed to marshall LSA_R_LOOKUP_NAMES.\n"));
+ return False;
+ }
+
+ return True;
}
/***************************************************************************
- api_lsa_close
+ _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
***************************************************************************/
+
+static uint32 _lsa_close(pipes_struct *p, LSA_Q_CLOSE *q_u, LSA_R_CLOSE *r_u)
+{
+ return NT_STATUS_NO_PROBLEMO;
+}
+
+/***************************************************************************
+ api_lsa_close.
+ ***************************************************************************/
+
static BOOL api_lsa_close(pipes_struct *p)
{
- LSA_R_CLOSE r_c;
+ LSA_Q_CLOSE q_u;
+ LSA_R_CLOSE r_u;
+ prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
- ZERO_STRUCT(r_c);
+ ZERO_STRUCT(q_u);
+ ZERO_STRUCT(r_u);
+
+ if (!lsa_io_q_close("", &q_u, data, 0)) {
+ DEBUG(0,("api_lsa_close: lsa_io_q_close failed.\n"));
+ return False;
+ }
+
+ r_u.status = _lsa_close(p, &q_u, &r_u);
/* store the response in the SMB stream */
- if (!lsa_io_r_close("", &r_c, rdata, 0)) {
+ if (!lsa_io_r_close("", &r_u, rdata, 0)) {
DEBUG(0,("api_lsa_close: lsa_io_r_close failed.\n"));
return False;
}
@@ -666,26 +688,38 @@ static BOOL api_lsa_close(pipes_struct *p)
}
/***************************************************************************
- api_lsa_open_secret
+ "No more secrets Marty...." :-).
+ ***************************************************************************/
+
+static uint32 _lsa_open_secret(pipes_struct *p, LSA_Q_OPEN_SECRET *q_u, LSA_R_OPEN_SECRET *r_u)
+{
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+}
+
+/***************************************************************************
+ api_lsa_open_secret.
***************************************************************************/
+
static BOOL api_lsa_open_secret(pipes_struct *p)
{
- /* XXXX this is NOT good */
- size_t i;
- uint32 dummy = 0;
+ LSA_Q_OPEN_SECRET q_u;
+ LSA_R_OPEN_SECRET r_u;
+ prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
- for(i =0; i < 4; i++) {
- if(!prs_uint32("api_lsa_close", rdata, 1, &dummy)) {
- DEBUG(0,("api_lsa_open_secret: prs_uint32 %d failed.\n",
- (int)i ));
- return False;
- }
+ ZERO_STRUCT(q_u);
+ ZERO_STRUCT(r_u);
+
+ if(!lsa_io_q_open_secret("", &q_u, data, 0)) {
+ DEBUG(0,("api_lsa_open_secret: failed to unmarshall LSA_Q_OPEN_SECRET.\n"));
+ return False;
}
- dummy = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
- if(!prs_uint32("api_lsa_close", rdata, 1, &dummy)) {
- DEBUG(0,("api_lsa_open_secret: prs_uint32 status failed.\n"));
+ r_u.status = _lsa_open_secret(p, &q_u, &r_u);
+
+ /* store the response in the SMB stream */
+ if(!lsa_io_r_open_secret("", &r_u, rdata, 0)) {
+ DEBUG(0,("api_lsa_open_secret: Failed to marshall LSA_R_OPEN_SECRET.\n"));
return False;
}
@@ -695,6 +729,7 @@ static BOOL api_lsa_open_secret(pipes_struct *p)
/***************************************************************************
\PIPE\ntlsa commands
***************************************************************************/
+
static struct api_struct api_lsa_cmds[] =
{
{ "LSA_OPENPOLICY2" , LSA_OPENPOLICY2 , api_lsa_open_policy2 },