summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_parse/parse_samr.c66
-rw-r--r--source3/rpc_server/srv_samr.c23
-rw-r--r--source3/rpc_server/srv_samr_nt.c91
3 files changed, 80 insertions, 100 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 436e284fd5..468fe4af51 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1259,22 +1259,21 @@ bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
}
/*******************************************************************
-inits a GROUP_INFO1 structure.
+ inits a samr_GroupInfoAll structure.
********************************************************************/
-void init_samr_group_info1(GROUP_INFO1 * gr1,
- char *acct_name, char *acct_desc,
- uint32 num_members)
+void init_samr_group_info1(struct samr_GroupInfoAll *r,
+ const char *name,
+ uint32_t attributes,
+ uint32_t num_members,
+ const char *description)
{
DEBUG(5, ("init_samr_group_info1\n"));
- gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
- gr1->num_members = num_members;
-
- init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
- init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
+ init_lsa_String(&r->name, name);
+ r->attributes = attributes;
+ r->num_members = num_members;
+ init_lsa_String(&r->description, description);
}
/*******************************************************************
@@ -1321,16 +1320,14 @@ bool samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
}
/*******************************************************************
-inits a GROUP_INFO2 structure.
+ inits a lsa_String structure
********************************************************************/
-void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
+void init_samr_group_info2(struct lsa_String *r, const char *group_name)
{
DEBUG(5, ("init_samr_group_info2\n"));
- gr2->level = 2;
- init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
+ init_lsa_String(r, group_name);
}
/*******************************************************************
@@ -1358,14 +1355,15 @@ bool samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int
}
/*******************************************************************
-inits a GROUP_INFO3 structure.
+ inits a samr_GroupInfoAttributes structure.
********************************************************************/
-void init_samr_group_info3(GROUP_INFO3 *gr3)
+void init_samr_group_info3(struct samr_GroupInfoAttributes *r,
+ uint32_t attributes)
{
DEBUG(5, ("init_samr_group_info3\n"));
- gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
+ r->attributes = attributes;
}
/*******************************************************************
@@ -1390,16 +1388,14 @@ bool samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int
}
/*******************************************************************
-inits a GROUP_INFO4 structure.
+ inits a lsa_String structure
********************************************************************/
-void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
+void init_samr_group_info4(struct lsa_String *r, const char *description)
{
DEBUG(5, ("init_samr_group_info4\n"));
- gr4->level = 4;
- init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
+ init_lsa_String(r, description);
}
/*******************************************************************
@@ -1426,23 +1422,23 @@ bool samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
return True;
}
+
/*******************************************************************
-inits a GROUP_INFO5 structure.
+ inits a samr_GroupInfoAll structure.
********************************************************************/
-void init_samr_group_info5(GROUP_INFO5 * gr5,
- char *acct_name, char *acct_desc,
- uint32 num_members)
+void init_samr_group_info5(struct samr_GroupInfoAll *r,
+ const char *name,
+ uint32_t attributes,
+ uint32_t num_members,
+ const char *description)
{
DEBUG(5, ("init_samr_group_info5\n"));
- gr5->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
- gr5->num_members = num_members;
-
- init_unistr2(&gr5->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr5->hdr_acct_name, &gr5->uni_acct_name);
- init_unistr2(&gr5->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr5->hdr_acct_desc, &gr5->uni_acct_desc);
+ init_lsa_String(&r->name, name);
+ r->attributes = attributes;
+ r->num_members = num_members;
+ init_lsa_String(&r->description, description);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 70fe85d6c7..d5666e741d 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -662,28 +662,7 @@ static bool api_samr_create_dom_alias(pipes_struct *p)
static bool api_samr_query_groupinfo(pipes_struct *p)
{
- SAMR_Q_QUERY_GROUPINFO q_u;
- SAMR_R_QUERY_GROUPINFO r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!samr_io_q_query_groupinfo("", &q_u, data, 0)) {
- DEBUG(0,("api_samr_query_groupinfo: unable to unmarshall SAMR_Q_QUERY_GROUPINFO.\n"));
- return False;
- }
-
- r_u.status = _samr_query_groupinfo(p, &q_u, &r_u);
-
- if (!samr_io_r_query_groupinfo("", &r_u, rdata, 0)) {
- DEBUG(0,("api_samr_query_groupinfo: unable to marshall SAMR_R_QUERY_GROUPINFO.\n"));
- return False;
- }
-
- return True;
+ return proxy_samr_call(p, NDR_SAMR_QUERYGROUPINFO);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 836ff3574f..5081565a5a 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -4640,25 +4640,32 @@ NTSTATUS _samr_CreateDomAlias(pipes_struct *p,
}
/*********************************************************************
- _samr_query_groupinfo
-
-sends the name/comment pair of a domain group
-level 1 send also the number of users of that group
+ _samr_QueryGroupInfo
*********************************************************************/
-NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAMR_R_QUERY_GROUPINFO *r_u)
+NTSTATUS _samr_QueryGroupInfo(pipes_struct *p,
+ struct samr_QueryGroupInfo *r)
{
+ NTSTATUS status;
DOM_SID group_sid;
GROUP_MAP map;
- GROUP_INFO_CTR *ctr;
+ union samr_GroupInfo *info = NULL;
uint32 acc_granted;
bool ret;
+ uint32_t attributes = SE_GROUP_MANDATORY |
+ SE_GROUP_ENABLED_BY_DEFAULT |
+ SE_GROUP_ENABLED;
+ const char *group_name = NULL;
+ const char *group_description = NULL;
- if (!get_lsa_policy_samr_sid(p, &q_u->pol, &group_sid, &acc_granted, NULL))
+ if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, NULL))
return NT_STATUS_INVALID_HANDLE;
- if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, SA_RIGHT_GROUP_LOOKUP_INFO, "_samr_query_groupinfo"))) {
- return r_u->status;
+ status = access_check_samr_function(acc_granted,
+ SA_RIGHT_GROUP_LOOKUP_INFO,
+ "_samr_QueryGroupInfo");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
become_root();
@@ -4667,41 +4674,47 @@ NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAM
if (!ret)
return NT_STATUS_INVALID_HANDLE;
- ctr=TALLOC_ZERO_P(p->mem_ctx, GROUP_INFO_CTR);
- if (ctr==NULL)
+ /* FIXME: map contains fstrings */
+ group_name = talloc_strdup(r, map.nt_name);
+ group_description = talloc_strdup(r, map.comment);
+
+ info = TALLOC_ZERO_P(p->mem_ctx, union samr_GroupInfo);
+ if (!info) {
return NT_STATUS_NO_MEMORY;
+ }
- switch (q_u->switch_level) {
+ switch (r->in.level) {
case 1: {
uint32 *members;
size_t num_members;
- ctr->switch_value1 = 1;
-
become_root();
- r_u->status = pdb_enum_group_members(
+ status = pdb_enum_group_members(
p->mem_ctx, &group_sid, &members, &num_members);
unbecome_root();
- if (!NT_STATUS_IS_OK(r_u->status)) {
- return r_u->status;
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
- init_samr_group_info1(&ctr->group.info1, map.nt_name,
- map.comment, num_members);
+ init_samr_group_info1(&info->all,
+ group_name,
+ attributes,
+ num_members,
+ group_description);
break;
}
case 2:
- ctr->switch_value1 = 2;
- init_samr_group_info2(&ctr->group.info2, map.nt_name);
+ init_samr_group_info2(&info->name,
+ group_name);
break;
case 3:
- ctr->switch_value1 = 3;
- init_samr_group_info3(&ctr->group.info3);
+ init_samr_group_info3(&info->attributes,
+ attributes);
break;
case 4:
- ctr->switch_value1 = 4;
- init_samr_group_info4(&ctr->group.info4, map.comment);
+ init_samr_group_info4(&info->description,
+ group_description);
break;
case 5: {
/*
@@ -4709,27 +4722,29 @@ NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAM
size_t num_members;
*/
- ctr->switch_value1 = 5;
-
/*
become_root();
- r_u->status = pdb_enum_group_members(
+ status = pdb_enum_group_members(
p->mem_ctx, &group_sid, &members, &num_members);
unbecome_root();
- if (!NT_STATUS_IS_OK(r_u->status)) {
- return r_u->status;
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
*/
- init_samr_group_info5(&ctr->group.info5, map.nt_name,
- map.comment, 0 /* num_members */); /* in w2k3 this is always 0 */
+ init_samr_group_info5(&info->all2,
+ group_name,
+ attributes,
+ 0, /* num_members - in w2k3 this is always 0 */
+ group_description);
+
break;
}
default:
return NT_STATUS_INVALID_INFO_CLASS;
}
- init_samr_r_query_groupinfo(r_u, ctr, NT_STATUS_OK);
+ *r->out.info = info;
return NT_STATUS_OK;
}
@@ -5213,16 +5228,6 @@ NTSTATUS _samr_LookupRids(pipes_struct *p,
/****************************************************************
****************************************************************/
-NTSTATUS _samr_QueryGroupInfo(pipes_struct *p,
- struct samr_QueryGroupInfo *r)
-{
- p->rng_fault_state = true;
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
-/****************************************************************
-****************************************************************/
-
NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p,
struct samr_SetMemberAttributesOfGroup *r)
{