diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_samr.h | 17 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 67 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 26 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 55 |
4 files changed, 152 insertions, 13 deletions
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 8a3c4a8420..37a0ed9a3f 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -1112,6 +1112,21 @@ typedef struct samr_group_info4 } GROUP_INFO4; +typedef struct samr_group_info5 +{ + UNIHDR hdr_acct_name; + + uint32 group_attr; /* 0x0000 0003 - group attribute */ + uint32 num_members; /* 0x0000 0001 - number of group members? */ + + UNIHDR hdr_acct_desc; + + UNISTR2 uni_acct_name; + UNISTR2 uni_acct_desc; + +} GROUP_INFO5; + + /* GROUP_INFO_CTR */ typedef struct group_info_ctr { @@ -1123,7 +1138,7 @@ typedef struct group_info_ctr GROUP_INFO2 info2; GROUP_INFO3 info3; GROUP_INFO4 info4; - + GROUP_INFO5 info5; } group; } GROUP_INFO_CTR; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2a9daa0e47..05c75fe98a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2307,6 +2307,69 @@ BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, } /******************************************************************* +inits a GROUP_INFO5 structure. +********************************************************************/ + +void init_samr_group_info5(GROUP_INFO5 * gr5, + char *acct_name, char *acct_desc, + uint32 num_members) +{ + 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); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5, + prs_struct *ps, int depth) +{ + uint16 dummy = 1; + + if (gr5 == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_group_info5"); + depth++; + + if(!prs_uint16("level", ps, depth, &dummy)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unihdr("hdr_acct_name", &gr5->hdr_acct_name, ps, depth)) + return False; + + if(!prs_uint32("group_attr", ps, depth, &gr5->group_attr)) + return False; + if(!prs_uint32("num_members", ps, depth, &gr5->num_members)) + return False; + + if(!smb_io_unihdr("hdr_acct_desc", &gr5->hdr_acct_desc, ps, depth)) + return False; + + if(!smb_io_unistr2("uni_acct_name", &gr5->uni_acct_name, + gr5->hdr_acct_name.buffer, ps, depth)) + return False; + + if(!smb_io_unistr2("uni_acct_desc", &gr5->uni_acct_desc, + gr5->hdr_acct_desc.buffer, ps, depth)) + return False; + + return True; +} + + +/******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2342,6 +2405,10 @@ static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth)) return False; break; + case 5: + if(!samr_io_group_info5("group_info5", &(*ctr)->group.info5, ps, depth)) + return False; + break; default: DEBUG(0,("samr_group_info_ctr: unsupported switch level\n")); break; diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index dc17977041..c4b3d3512c 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -4362,6 +4362,10 @@ NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAM map.comment, num_members); break; } + case 2: + ctr->switch_value1 = 2; + init_samr_group_info2(&ctr->group.info2, map.nt_name); + break; case 3: ctr->switch_value1 = 3; init_samr_group_info3(&ctr->group.info3); @@ -4370,6 +4374,28 @@ NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAM ctr->switch_value1 = 4; init_samr_group_info4(&ctr->group.info4, map.comment); break; + case 5: { + /* + uint32 *members; + size_t num_members; + */ + + ctr->switch_value1 = 5; + + /* + become_root(); + r_u->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; + } + */ + init_samr_group_info5(&ctr->group.info5, map.nt_name, + map.comment, 0 /* num_members */); /* in w2k3 this is always 0 */ + break; + } default: return NT_STATUS_INVALID_INFO_CLASS; } diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index e612f390c0..ca0b6e9624 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -442,6 +442,18 @@ static void display_group_info1(GROUP_INFO1 *info1) /**************************************************************************** display group info ****************************************************************************/ +static void display_group_info2(GROUP_INFO2 *info2) +{ + fstring name; + + unistr2_to_ascii(name, &info2->uni_acct_name, sizeof(name)-1); + printf("\tGroup Description:%s\n", name); +} + + +/**************************************************************************** + display group info + ****************************************************************************/ static void display_group_info3(GROUP_INFO3 *info3) { printf("\tGroup Attribute:%d\n", info3->group_attr); @@ -460,23 +472,42 @@ static void display_group_info4(GROUP_INFO4 *info4) } /**************************************************************************** + display group info + ****************************************************************************/ +static void display_group_info5(GROUP_INFO5 *info5) +{ + fstring temp; + + unistr2_to_ascii(temp, &info5->uni_acct_name, sizeof(temp)-1); + printf("\tGroup Name:\t%s\n", temp); + unistr2_to_ascii(temp, &info5->uni_acct_desc, sizeof(temp)-1); + printf("\tDescription:\t%s\n", temp); + printf("\tGroup Attribute:%d\n", info5->group_attr); + printf("\tNum Members:%d\n", info5->num_members); +} + +/**************************************************************************** display sam sync structure ****************************************************************************/ static void display_group_info_ctr(GROUP_INFO_CTR *ctr) { switch (ctr->switch_value1) { - case 1: { - display_group_info1(&ctr->group.info1); - break; - } - case 3: { - display_group_info3(&ctr->group.info3); - break; - } - case 4: { - display_group_info4(&ctr->group.info4); - break; - } + case 1: + display_group_info1(&ctr->group.info1); + break; + case 2: + display_group_info2(&ctr->group.info2); + break; + case 3: + display_group_info3(&ctr->group.info3); + break; + case 4: + display_group_info4(&ctr->group.info4); + break; + case 5: + display_group_info5(&ctr->group.info5); + break; + } } |