summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-12-02 01:13:02 +0000
committerLuke Leighton <lkcl@samba.org>1998-12-02 01:13:02 +0000
commit51534a4b97f09fc0f98d00e7a2730dddde496dd8 (patch)
tree1ac57a51befb8b87d3c2add8ba6774fed3736fdb /source3
parentf7682385826a9ed2f463d794e0c91ba53ddd6a9e (diff)
downloadsamba-51534a4b97f09fc0f98d00e7a2730dddde496dd8.tar.gz
samba-51534a4b97f09fc0f98d00e7a2730dddde496dd8.tar.bz2
samba-51534a4b97f09fc0f98d00e7a2730dddde496dd8.zip
adding group member code, made a start. found that the group members'
rid is needed not the name (see DOMAIN_GRP_MEMBER) decided to go home. (This used to be commit 9337049dfc98becfa74522d418dae64a97c7a304)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h20
-rw-r--r--source3/include/rpc_misc.h12
-rw-r--r--source3/include/rpc_samr.h55
-rw-r--r--source3/rpc_parse/parse_misc.c3
-rw-r--r--source3/rpc_parse/parse_samr.c403
-rw-r--r--source3/rpc_server/srv_samr.c235
6 files changed, 640 insertions, 88 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 1509253c04..ea260f07cd 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2045,6 +2045,26 @@ void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u,
void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth);
void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c,
POLICY_HND *hnd, uint32 unk, uint32 rid);
+void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth);
+void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth);
+void make_samr_group_info1(GROUP_INFO1 *gr1,
+ char *acct_name, char *acct_desc);
+void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth);
+void make_samr_group_info4(GROUP_INFO4 *gr4, char *acct_desc);
+void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth);
+void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth);
+void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
+ POLICY_HND *pol,
+ uint16 switch_level);
+void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth);
+void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr,
+ uint32 status);
+void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth);
+void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd);
+void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth);
+void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u,
+ uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status);
+void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth);
void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol,
uint16 switch_level, uint32 start_idx, uint32 size);
void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth);
diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h
index e41c61f882..ff0d2cc49d 100644
--- a/source3/include/rpc_misc.h
+++ b/source3/include/rpc_misc.h
@@ -199,6 +199,7 @@ typedef struct domrid3_info
uint32 type1; /* value is 0x1 */
uint32 ptr_type; /* undocumented pointer */
uint32 type2; /* value is 0x1 */
+ uint32 unk; /* value is 0x2 */
} DOM_RID3;
@@ -211,17 +212,6 @@ typedef struct domrid4_info
} DOM_RID4;
-/* DOM_RID5 - rid, type & attributes */
-typedef struct domrid5_info
-{
- uint32 ptr_unk; /* pointer to unk */
- uint32 unk; /* value is 0x1 */
- uint32 rid; /* RID */
- uint8 type; /* SID_NAME_USE_ENUM */
- uint16 attr;
-
-} DOM_RID5;
-
/* DOM_CLNT_SRV - client / server names */
typedef struct clnt_srv_info
{
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index f8e95937a1..4c42c18921 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -749,19 +749,26 @@ typedef struct samr_group_info4
} GROUP_INFO4;
-/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
-typedef struct r_samr_query_groupinfo_info
+/* GROUP_INFO_CTR */
+typedef struct group_info_ctr
{
- uint32 ptr;
- uint16 switch_value; /* 0x0001 seen */
- /* uint8[2] padding */
+ uint16 switch_value;
union
{
+ GROUP_INFO4 info4;
GROUP_INFO1 info1;
} group;
+} GROUP_INFO_CTR;
+
+/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
+typedef struct r_samr_query_groupinfo_info
+{
+ uint32 ptr;
+ GROUP_INFO_CTR *ctr;
+
uint32 status;
} SAMR_R_QUERY_GROUPINFO;
@@ -771,14 +778,7 @@ typedef struct r_samr_query_groupinfo_info
typedef struct q_samr_set_group_info
{
POLICY_HND pol; /* policy handle */
- uint16 switch_value1; /* 0x0004 seen */
- uint16 switch_value2; /* 0x0004 seen */
-
- union
- {
- GROUP_INFO4 info4;
-
- } group;
+ GROUP_INFO_CTR *ctr;
} SAMR_Q_SET_GROUPINFO;
@@ -1005,8 +1005,6 @@ typedef struct r_samr_lookup_names_info
uint32 num_entries2;
DOM_RID3 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
- uint32 num_entries3;
-
uint32 status; /* return code */
} SAMR_R_LOOKUP_NAMES;
@@ -1106,6 +1104,33 @@ typedef struct r_samr_unknown_32_info
} SAMR_R_UNKNOWN_32;
+/* SAMR_Q_QUERY_GROUPMEM - query group members */
+typedef struct q_samr_query_groupmem_info
+{
+ POLICY_HND group_pol; /* policy handle */
+
+} SAMR_Q_QUERY_GROUPMEM;
+
+
+/* SAMR_R_QUERY_GROUPMEM - query group members */
+typedef struct r_samr_query_groupmem_info
+{
+ uint32 ptr;
+ uint32 num_entries;
+
+ uint32 ptr_rids;
+ uint32 ptr_attrs;
+
+ uint32 num_rids;
+ uint32 *rid;
+
+ uint32 num_attrs;
+ uint32 *attr;
+
+ uint32 status;
+
+} SAMR_R_QUERY_GROUPMEM;
+
/* SAMR_Q_ADD_GROUPMEM - probably an add group member */
typedef struct q_samr_add_group_mem_info
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index e9423b3a51..6c42070de4 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -651,6 +651,7 @@ void make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type)
rid3->type1 = type;
rid3->ptr_type = 0x1; /* non-zero, basically. */
rid3->type2 = 0x1;
+ rid3->unk = type;
}
/*******************************************************************
@@ -669,6 +670,7 @@ void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth)
prs_uint32("type1 ", ps, depth, &(rid3->type1 ));
prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type));
prs_uint32("type2 ", ps, depth, &(rid3->type2 ));
+ prs_uint32("unk ", ps, depth, &(rid3->unk ));
}
/*******************************************************************
@@ -681,7 +683,6 @@ void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid)
rid4->rid = rid;
}
-
/*******************************************************************
makes a DOM_CLNT_SRV structure.
********************************************************************/
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index d8bc97d1d3..8e0ecef3d4 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1247,6 +1247,42 @@ void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c,
q_c->rid_group = rid;
}
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth)
+{
+ if (q_u == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_q_open_group");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
+
+ prs_uint32("unknown ", ps, depth, &(q_u->unknown ));
+ prs_uint32("rid_group", ps, depth, &(q_u->rid_group));
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth)
+{
+ if (r_u == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_r_open_group");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
+ prs_align(ps);
+
+ prs_uint32("status", ps, depth, &(r_u->status));
+}
+
#if 0
/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
@@ -1272,52 +1308,6 @@ typedef struct r_samr_create_dom_group_info
} SAMR_R_CREATE_DOM_GROUP;
-/* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
-typedef struct q_samr_query_group_info
-{
- POLICY_HND pol; /* policy handle */
-
- uint16 switch_level; /* 0x0001 seen */
-
-} SAMR_Q_QUERY_GROUPINFO;
-
-typedef struct samr_group_info1
-{
- UNIHDR hdr_acct_name;
- UNIHDR hdr_acct_desc;
-
- uint32 unknown_1; /* 0x0000 0003 - number of group members? */
- uint32 unknown_2; /* 0x0000 0001 - number of group members? */
-
- UNISTR2 uni_acct_name;
- UNISTR2 uni_acct_desc;
-
-} GROUP_INFO1;
-
-typedef struct samr_group_info4
-{
- UNIHDR hdr_acct_desc;
- UNISTR2 uni_acct_desc;
-
-} GROUP_INFO4;
-
-/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
-typedef struct r_samr_query_groupinfo_info
-{
- uint32 ptr;
- uint16 switch_value; /* 0x0001 seen */
- /* uint8[2] padding */
-
- union
- {
- GROUP_INFO1 info1;
-
- } group;
-
- uint32 status;
-
-} SAMR_R_QUERY_GROUPINFO;
-
/* SAMR_Q_SET_GROUPINFO - SAM Group Info */
typedef struct q_samr_set_group_info
@@ -1381,6 +1371,302 @@ typedef struct r_samr_open_group_info
#endif
+/*******************************************************************
+makes a GROUP_INFO1 structure.
+********************************************************************/
+void make_samr_group_info1(GROUP_INFO1 *gr1,
+ char *acct_name, char *acct_desc)
+{
+ int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0;
+ int acct_len = acct_name != NULL ? strlen(acct_name) : 0;
+ if (gr1 == NULL) return;
+
+ DEBUG(5,("make_samr_group_info1\n"));
+
+ make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0);
+ make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0);
+
+ gr1->unknown_1 = 0x3;
+ gr1->unknown_2 = 0x1;
+
+ make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len);
+ make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len);
+}
+
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth)
+{
+ if (gr1 == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_group_info1");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth);
+ smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth);
+
+ prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1));
+ prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2));
+
+ smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth);
+ smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth);
+}
+
+/*******************************************************************
+makes a GROUP_INFO4 structure.
+********************************************************************/
+void make_samr_group_info4(GROUP_INFO4 *gr4, char *acct_desc)
+{
+ int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
+ if (gr4 == NULL) return;
+
+ DEBUG(5,("make_samr_group_info4\n"));
+
+ make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
+ make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len);
+}
+
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth)
+{
+ if (gr4 == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_group_info4");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth);
+ smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth);
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth)
+{
+ if (ctr == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_group_info_ctr");
+ depth++;
+
+ prs_uint16("switch_value", ps, depth, &(ctr->switch_value));
+ prs_align(ps);
+
+ if (ctr->switch_value != 0)
+ {
+ switch (ctr->switch_value)
+ {
+ case 1:
+ {
+ samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth);
+ break;
+ }
+ case 4:
+ {
+ samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth);
+ break;
+ }
+ default:
+ {
+ DEBUG(4,("samr_group_info_ctr: unsupported switch level\n"));
+ break;
+ }
+ }
+ }
+
+ prs_align(ps);
+}
+
+
+/*******************************************************************
+makes a SAMR_Q_QUERY_GROUPINFO structure.
+********************************************************************/
+void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
+ POLICY_HND *pol,
+ uint16 switch_level)
+{
+ if (q_e == NULL || pol == NULL) return;
+
+ DEBUG(5,("make_samr_q_query_groupinfo\n"));
+
+ memcpy(&(q_e->pol), pol, sizeof(*pol));
+
+ q_e->switch_level = switch_level;
+}
+
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth)
+{
+ if (q_e == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
+ prs_align(ps);
+
+ prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
+}
+
+
+/*******************************************************************
+makes a SAMR_R_QUERY_GROUPINFO structure.
+********************************************************************/
+void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr,
+ uint32 status)
+{
+ if (r_u == NULL) return;
+
+ DEBUG(5,("make_samr_r_query_groupinfo\n"));
+
+ r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
+ r_u->ctr = ctr;
+ r_u->status = status;
+}
+
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth)
+{
+ if (r_u == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
+ depth++;
+
+ prs_align(ps);
+
+ prs_uint32("ptr", ps, depth, &(r_u->ptr));
+
+ if (r_u->ptr != 0)
+ {
+ samr_group_info_ctr("ctr", r_u->ctr, ps, depth);
+ }
+
+ prs_uint32("status", ps, depth, &(r_u->status));
+}
+
+
+/*******************************************************************
+makes a SAMR_Q_QUERY_GROUPMEM structure.
+********************************************************************/
+void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd)
+{
+ if (q_c == NULL || hnd == NULL) return;
+
+ DEBUG(5,("make_samr_q_query_groupmem\n"));
+
+ memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol));
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth)
+{
+ if (q_u == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
+ depth++;
+
+ prs_align(ps);
+
+ smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
+}
+
+/*******************************************************************
+makes a SAMR_R_QUERY_GROUPMEM structure.
+********************************************************************/
+void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u,
+ uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status)
+{
+ if (r_u == NULL) return;
+
+ DEBUG(5,("make_samr_r_query_groupmem\n"));
+
+ if (status == 0x0)
+ {
+ r_u->ptr = (num_entries != 0) ? 1 : 0;
+ r_u->num_entries = num_entries;
+
+ r_u->ptr_attrs = attr != NULL ? 1 : 0;
+ r_u->ptr_rids = rid != NULL ? 1 : 0;
+
+ r_u->num_rids = num_entries;
+ r_u->rid = rid;
+
+ r_u->num_attrs = num_entries;
+ r_u->attr = attr;
+ }
+ else
+ {
+ r_u->ptr = 0;
+ r_u->num_entries = 0;
+ }
+
+ r_u->status = status;
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth)
+{
+ int i;
+
+ if (r_u == NULL) return;
+
+ prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
+ depth++;
+
+ prs_align(ps);
+
+ prs_uint32("ptr", ps, depth, &(r_u->ptr));
+ prs_uint32("num_entries ", ps, depth, &(r_u->num_entries));
+
+ if (r_u->ptr != 0)
+ {
+ prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids ));
+ prs_uint32("ptr_attrs", ps, depth, &(r_u->ptr_attrs));
+
+ if (r_u->ptr_rids != 0)
+ {
+ prs_uint32("num_rids", ps, depth, &(r_u->num_rids));
+ for (i = 0; i < r_u->num_rids; i++)
+ {
+ prs_grow(ps);
+ prs_uint32("", ps, depth, &(r_u->rid[i]));
+ }
+ }
+
+ if (r_u->ptr_attrs != 0)
+ {
+ prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs));
+ for (i = 0; i < r_u->num_attrs; i++)
+ {
+ prs_grow(ps);
+ prs_uint32("", ps, depth, &(r_u->attr[i]));
+ }
+ }
+ }
+
+ prs_uint32("status", ps, depth, &(r_u->status));
+}
+
/*******************************************************************
makes a SAMR_Q_ENUM_DOM_GROUPS structure.
@@ -1770,7 +2056,7 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s
makes a ALIAS_INFO3 structure.
********************************************************************/
void make_samr_alias_info3(ALIAS_INFO3 *al3, char *acct_desc)
- {
+{
int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
if (al3 == NULL) return;
@@ -1813,19 +2099,19 @@ void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int d
if (ctr->switch_value != 0)
{
switch (ctr->switch_value)
+ {
+ case 3:
{
- case 3:
- {
samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth);
- break;
- }
- default:
- {
+ break;
+ }
+ default:
+ {
DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n"));
- break;
- }
+ break;
}
}
+ }
prs_align(ps);
}
@@ -1880,7 +2166,7 @@ void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ct
r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
r_u->ctr = ctr;
r_u->status = status;
- }
+}
/*******************************************************************
@@ -2658,15 +2944,12 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u,
{
make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]);
}
-
- r_u->num_entries3 = num_rids;
}
else
{
r_u->num_entries = 0;
r_u->undoc_buffer = 0;
r_u->num_entries2 = 0;
- r_u->num_entries3 = 0;
}
r_u->status = status;
@@ -2701,8 +2984,6 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p
}
- prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
-
prs_uint32("status", ps, depth, &(r_u->status));
}
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index a02338bf34..505fad25b4 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -670,6 +670,166 @@ static void api_samr_query_dispinfo( uint16 vuid, prs_struct *data, prs_struct *
samr_reply_query_dispinfo(&q_e, rdata);
}
+#if 0
+/*******************************************************************
+ samr_reply_query_groupmem
+ ********************************************************************/
+static void samr_reply_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_u,
+ prs_struct *rdata)
+{
+ uint32 status = 0;
+
+ DOMAIN_GRP_MEMBER *mem_grp = NULL;
+ uint32 *rid = NULL;
+ uint32 *attr = NULL;
+ int num_rids = 0;
+ DOM_SID group_sid;
+ uint32 group_rid;
+ fstring group_sid_str;
+
+ SAMR_R_QUERY_GROUPMEM r_u;
+
+ DEBUG(5,("samr_query_groupmem: %d\n", __LINE__));
+
+ /* find the policy handle. open a policy on it. */
+ if (status == 0x0 && !get_lsa_policy_samr_sid(&q_u->group_pol, &group_sid))
+ {
+ status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
+ }
+ else
+ {
+ sid_to_string(group_sid_str, &group_sid );
+ sid_split_rid(&group_sid, &group_rid);
+ }
+
+ if (status == 0x0)
+ {
+ DEBUG(10,("sid is %s\n", group_sid_str));
+
+ if (sid_equal(&group_sid, &global_sam_sid))
+ {
+ DEBUG(10,("lookup on Domain SID\n"));
+
+ become_root(True);
+ status = getgrouprid(group_rid, &mem_grp, &num_rids) != NULL ? 0x0 : 0xC0000000 | NT_STATUS_NO_SUCH_GROUP;
+ unbecome_root(True);
+ }
+ else
+ {
+ status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
+ }
+ }
+
+ if (status == 0x0 && num_rids > 0)
+ {
+ rid = malloc(num_rids * sizeof(uint32));
+ attr = malloc(num_rids * sizeof(uint32));
+ if (mem_grp != NULL && rid != NULL && attr != NULL)
+ {
+ int i;
+ for (i = 0; i < num_rids; i++)
+ {
+ rid [i] = mem_grp[i].rid;
+ attr[i] = mem_grp[i].attr;
+ }
+ free(mem_grp);
+ }
+ }
+
+ make_samr_r_query_groupmem(&r_u, num_rids, rid, attr, status);
+
+ /* store the response in the SMB stream */
+ samr_io_r_query_groupmem("", &r_u, rdata, 0);
+
+ if (sid != NULL)
+ {
+ free(sid);
+ }
+
+ DEBUG(5,("samr_query_groupmem: %d\n", __LINE__));
+
+}
+
+/*******************************************************************
+ api_samr_query_groupmem
+ ********************************************************************/
+static void api_samr_query_groupmem( uint16 vuid, prs_struct *data, prs_struct *rdata)
+{
+ SAMR_Q_QUERY_GROUPMEM q_u;
+
+ /* grab the samr 0x19 */
+ samr_io_q_query_groupmem("", &q_u, data, 0);
+
+ /* construct reply. always indicate success */
+ samr_reply_query_groupmem(&q_u, rdata);
+}
+
+#endif
+
+
+/*******************************************************************
+ samr_reply_query_groupinfo
+ ********************************************************************/
+static void samr_reply_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_u,
+ prs_struct *rdata)
+{
+ SAMR_R_QUERY_GROUPINFO r_e;
+ GROUP_INFO_CTR ctr;
+ uint32 status = 0x0;
+
+ r_e.ptr = 0;
+
+ /* find the policy handle. open a policy on it. */
+ if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
+ {
+ r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
+ }
+
+ DEBUG(5,("samr_reply_query_groupinfo: %d\n", __LINE__));
+
+ if (status == 0x0)
+ {
+ if (q_u->switch_level == 1)
+ {
+ r_e.ptr = 1;
+ ctr.switch_value = 1;
+ make_samr_group_info1(&ctr.group.info1, "<account name>", "<account description>");
+ }
+ else if (q_u->switch_level == 4)
+ {
+ r_e.ptr = 1;
+ ctr.switch_value = 4;
+ make_samr_group_info4(&ctr.group.info4, "<account description>");
+ }
+ else
+ {
+ status = NT_STATUS_INVALID_INFO_CLASS;
+ }
+ }
+
+ make_samr_r_query_groupinfo(&r_e, status == 0 ? &ctr : NULL, status);
+
+ /* store the response in the SMB stream */
+ samr_io_r_query_groupinfo("", &r_e, rdata, 0);
+
+ DEBUG(5,("samr_query_groupinfo: %d\n", __LINE__));
+
+}
+
+/*******************************************************************
+ api_samr_query_groupinfo
+ ********************************************************************/
+static void api_samr_query_groupinfo( uint16 vuid, prs_struct *data, prs_struct *rdata)
+{
+ SAMR_Q_QUERY_GROUPINFO q_e;
+
+ /* grab the samr open */
+ samr_io_q_query_groupinfo("", &q_e, data, 0);
+
+ /* construct reply. */
+ samr_reply_query_groupinfo(&q_e, rdata);
+}
+
/*******************************************************************
samr_reply_query_aliasinfo
@@ -1784,6 +1944,8 @@ static void samr_reply_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
+ DEBUG(0,("TODO: verify that the alias rid exists\n"));
+
/* associate a RID with the (unique) handle. */
if (r_u.status == 0x0 && !set_lsa_policy_samr_rid(&(r_u.pol), q_u->rid_alias))
{
@@ -1830,6 +1992,77 @@ static void api_samr_open_alias( uint16 vuid, prs_struct *data, prs_struct *rdat
}
/*******************************************************************
+ samr_reply_open_group
+ ********************************************************************/
+static void samr_reply_open_group(SAMR_Q_OPEN_GROUP *q_u,
+ prs_struct *rdata)
+{
+ SAMR_R_OPEN_GROUP r_u;
+ DOM_SID sid;
+ BOOL pol_open = False;
+
+ /* set up the SAMR open_group response */
+
+ r_u.status = 0x0;
+ if (r_u.status == 0x0 && !get_lsa_policy_samr_sid(&q_u->domain_pol, &sid))
+ {
+ r_u.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
+ }
+
+ /* get a (unique) handle. open a policy on it. */
+ if (r_u.status == 0x0 && !(pol_open = open_lsa_policy_hnd(&(r_u.pol))))
+ {
+ r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ DEBUG(0,("TODO: verify that the group rid exists\n"));
+
+ /* associate a RID with the (unique) handle. */
+ if (r_u.status == 0x0 && !set_lsa_policy_samr_rid(&(r_u.pol), q_u->rid_group))
+ {
+ /* oh, whoops. don't know what error message to return, here */
+ r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ sid_append_rid(&sid, q_u->rid_group);
+
+ /* associate an group SID with the (unique) handle. */
+ if (r_u.status == 0x0 && !set_lsa_policy_samr_sid(&(r_u.pol), &sid))
+ {
+ /* oh, whoops. don't know what error message to return, here */
+ r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ if (r_u.status != 0 && pol_open)
+ {
+ close_lsa_policy_hnd(&(r_u.pol));
+ }
+
+ DEBUG(5,("samr_open_group: %d\n", __LINE__));
+
+ /* store the response in the SMB stream */
+ samr_io_r_open_group("", &r_u, rdata, 0);
+
+ DEBUG(5,("samr_open_group: %d\n", __LINE__));
+
+}
+
+/*******************************************************************
+ api_samr_open_group
+ ********************************************************************/
+static void api_samr_open_group( uint16 vuid, prs_struct *data, prs_struct *rdata)
+
+{
+ SAMR_Q_OPEN_GROUP q_u;
+
+ /* grab the samr open policy */
+ samr_io_q_open_group("", &q_u, data, 0);
+
+ /* construct reply. always indicate success */
+ samr_reply_open_group(&q_u, rdata);
+}
+
+/*******************************************************************
array of \PIPE\samr operations
********************************************************************/
static struct api_struct api_samr_cmds [] =
@@ -1849,11 +2082,13 @@ static struct api_struct api_samr_cmds [] =
{ "SAMR_QUERY_USERGROUPS" , SAMR_QUERY_USERGROUPS , api_samr_query_usergroups },
{ "SAMR_QUERY_DISPINFO" , SAMR_QUERY_DISPINFO , api_samr_query_dispinfo },
{ "SAMR_QUERY_ALIASINFO" , SAMR_QUERY_ALIASINFO , api_samr_query_aliasinfo },
+ { "SAMR_QUERY_GROUPINFO" , SAMR_QUERY_GROUPINFO , api_samr_query_groupinfo },
{ "SAMR_0x32" , 0x32 , api_samr_unknown_32 },
{ "SAMR_UNKNOWN_12" , SAMR_UNKNOWN_12 , api_samr_unknown_12 },
{ "SAMR_UNKNOWN_38" , SAMR_UNKNOWN_38 , api_samr_unknown_38 },
{ "SAMR_CHGPASSWD_USER" , SAMR_CHGPASSWD_USER , api_samr_chgpasswd_user },
{ "SAMR_OPEN_ALIAS" , SAMR_OPEN_ALIAS , api_samr_open_alias },
+ { "SAMR_OPEN_GROUP" , SAMR_OPEN_GROUP , api_samr_open_group },
{ "SAMR_OPEN_DOMAIN" , SAMR_OPEN_DOMAIN , api_samr_open_domain },
{ "SAMR_UNKNOWN_3" , SAMR_UNKNOWN_3 , api_samr_unknown_3 },
{ "SAMR_UNKNOWN_2C" , SAMR_UNKNOWN_2C , api_samr_unknown_2c },