diff options
author | Luke Leighton <lkcl@samba.org> | 1998-12-02 22:05:56 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-12-02 22:05:56 +0000 |
commit | 78a86c64960a7823b0db8b7bebfffabb4a5ba864 (patch) | |
tree | 22fd61bd4f6699ab93456ab46e7ec39956f7ffc7 | |
parent | 9bce7340d60a49594f67cc3c6cc6119b33a5358a (diff) | |
download | samba-78a86c64960a7823b0db8b7bebfffabb4a5ba864.tar.gz samba-78a86c64960a7823b0db8b7bebfffabb4a5ba864.tar.xz samba-78a86c64960a7823b0db8b7bebfffabb4a5ba864.zip |
added rid and sid_name_use to DOMAIN_GRP_MEMBER, for use in group member
query.
domain groups now work, hurrah! only thing is that the description is
one character long, don't know why (which is wierd in itself).
-rw-r--r-- | source/groupdb/groupunix.c | 13 | ||||
-rw-r--r-- | source/include/rpc_samr.h | 20 | ||||
-rw-r--r-- | source/include/smb.h | 2 | ||||
-rw-r--r-- | source/rpc_parse/parse_misc.c | 2 | ||||
-rw-r--r-- | source/rpc_parse/parse_samr.c | 117 | ||||
-rw-r--r-- | source/rpc_server/srv_samr.c | 18 |
6 files changed, 90 insertions, 82 deletions
diff --git a/source/groupdb/groupunix.c b/source/groupdb/groupunix.c index 685e8146c02..154e23338d9 100644 --- a/source/groupdb/groupunix.c +++ b/source/groupdb/groupunix.c @@ -84,6 +84,8 @@ BOOL get_unixgroup_members(struct group *grp, for (i = 0; (unix_name = grp->gr_mem[i]) != NULL; i++) { DOM_NAME_MAP gmep; + DOMAIN_GRP_MEMBER *mem; + uint32 rid; if (!lookupsmbpwnam (unix_name, &gmep) && !lookupsmbgrpnam(unix_name, &gmep)) @@ -100,7 +102,8 @@ BOOL get_unixgroup_members(struct group *grp, continue; } - if (!sid_front_equal(&global_sam_sid, &gmep.sid)) + sid_split_rid(&gmep.sid, &rid); + if (!sid_equal(&global_sam_sid, &gmep.sid)) { DEBUG(0,("group database: could not resolve name %s (wrong Domain SID)\n", unix_name)); @@ -113,9 +116,13 @@ BOOL get_unixgroup_members(struct group *grp, return False; } - fstrcpy((*members)[(*num_mem)].name, gmep.nt_name); - (*members)[(*num_mem)].attr = 0x07; + mem = &(*members)[(*num_mem)]; (*num_mem)++; + + fstrcpy(mem->name, gmep.nt_name); + mem->attr = 0x07; + mem->sid_use = gmep.type; + mem->rid = rid; } return True; } diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h index 4c42c18921a..657058d9407 100644 --- a/source/include/rpc_samr.h +++ b/source/include/rpc_samr.h @@ -1037,20 +1037,20 @@ SAMR_R_UNKNOWN_12 - do a conversion from group RID to names /* SAMR_R_UNKNOWN_12 */ typedef struct r_samr_unknown_12_info { - POLICY_HND pol; /* policy handle */ + POLICY_HND pol; /* policy handle */ - uint32 num_aliases1; /* number of aliases being looked up */ - uint32 ptr_aliases; /* pointer to aliases */ - uint32 num_aliases2; /* number of aliases being looked up */ + uint32 num_names1; /* number of aliases being looked up */ + uint32 ptr_names; /* pointer to aliases */ + uint32 num_names2; /* number of aliases being looked up */ - UNIHDR hdr_als_name[MAX_LOOKUP_SIDS]; /* unicode account name header */ - UNISTR2 uni_als_name[MAX_LOOKUP_SIDS]; /* unicode account name string */ + UNIHDR hdr_name[MAX_LOOKUP_SIDS]; /* unicode account name header */ + UNISTR2 uni_name[MAX_LOOKUP_SIDS]; /* unicode account name string */ - uint32 num_als_usrs1; /* number of users in aliases being looked up */ - uint32 ptr_als_usrs; /* pointer to users in aliases */ - uint32 num_als_usrs2; /* number of users in aliases being looked up */ + uint32 num_types1; /* number of users in aliases being looked up */ + uint32 ptr_types; /* pointer to users in aliases */ + uint32 num_types2; /* number of users in aliases being looked up */ - uint32 num_als_usrs[MAX_LOOKUP_SIDS]; /* number of users per group */ + uint32 type[MAX_LOOKUP_SIDS]; /* SID_ENUM type */ uint32 status; diff --git a/source/include/smb.h b/source/include/smb.h index 3d8dd14a1b8..e4191f706d2 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -486,6 +486,8 @@ typedef struct domain_grp_member_info { fstring name; uint8 attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */ + uint32 rid; /* rid of domain group member */ + uint8 sid_use; /* usr=1 grp=2 dom=3 alias=4 wkng=5 del=6 inv=7 unk=8 */ } DOMAIN_GRP_MEMBER; diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c index 6c42070de4d..18c5f23ce37 100644 --- a/source/rpc_parse/parse_misc.c +++ b/source/rpc_parse/parse_misc.c @@ -458,7 +458,7 @@ void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i prs_align(ps); - prs_uint32("uni_max_len", ps, depth, &(buf2->buf_max_len)); + prs_uint32("buf_max_len", ps, depth, &(buf2->buf_max_len)); prs_uint32("undoc ", ps, depth, &(buf2->undoc )); prs_uint32("buf_len ", ps, depth, &(buf2->buf_len)); diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c index 8e0ecef3d4e..5a9b7660ab9 100644 --- a/source/rpc_parse/parse_samr.c +++ b/source/rpc_parse/parse_samr.c @@ -1387,7 +1387,7 @@ void make_samr_group_info1(GROUP_INFO1 *gr1, make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); gr1->unknown_1 = 0x3; - gr1->unknown_2 = 0x1; + gr1->unknown_2 = 0x3; make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); @@ -1406,13 +1406,15 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept prs_align(ps); - smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , 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_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); } @@ -1460,25 +1462,22 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); prs_align(ps); - if (ctr->switch_value != 0) + switch (ctr->switch_value) { - switch (ctr->switch_value) + case 1: { - 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; - } + 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; } } @@ -2483,43 +2482,43 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i makes a SAMR_R_UNKNOWN_12 structure. ********************************************************************/ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, - uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs, + uint32 num_names, fstring *name, uint8 *type, uint32 status) { int i; - if (r_u == NULL || als_name == NULL || num_als_usrs == NULL) return; + if (r_u == NULL || name == NULL || type == NULL) return; DEBUG(5,("make_samr_r_unknown_12\n")); if (status == 0x0) { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 1; - r_u->num_aliases2 = num_aliases; + r_u->num_names1 = num_names; + r_u->ptr_names = 1; + r_u->num_names2 = num_names; - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 1; - r_u->num_als_usrs2 = num_aliases; + r_u->num_types1 = num_names; + r_u->ptr_types = 1; + r_u->num_types2 = num_names; - SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + SMB_ASSERT_ARRAY(r_u->hdr_name, num_names); - for (i = 0; i < num_aliases; i++) + for (i = 0; i < num_names; i++) { - int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; - make_uni_hdr(&(r_u->hdr_als_name[i]), als_len , als_len, als_name[i] ? 1 : 0); - make_unistr2(&(r_u->uni_als_name[i]), als_name[i], als_len); - r_u->num_als_usrs[i] = num_als_usrs[i]; + int len = name[i] != NULL ? strlen(name[i]) : 0; + make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0); + make_unistr2(&(r_u->uni_name[i]), name[i], len); + r_u->type[i] = type[i]; } } else { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 0; - r_u->num_aliases2 = num_aliases; + r_u->num_names1 = num_names; + r_u->ptr_names = 0; + r_u->num_names2 = num_names; - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 0; - r_u->num_als_usrs2 = num_aliases; + r_u->num_types1 = num_names; + r_u->ptr_types = 0; + r_u->num_types2 = num_names; } r_u->status = status; @@ -2539,43 +2538,41 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i prs_align(ps); - prs_uint32("num_aliases1", ps, depth, &(r_u->num_aliases1)); - prs_uint32("ptr_aliases ", ps, depth, &(r_u->ptr_aliases )); - prs_uint32("num_aliases2", ps, depth, &(r_u->num_aliases2)); + prs_uint32("num_names1", ps, depth, &(r_u->num_names1)); + prs_uint32("ptr_names ", ps, depth, &(r_u->ptr_names )); + prs_uint32("num_names2", ps, depth, &(r_u->num_names2)); - if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) + if (r_u->ptr_names != 0 && r_u->num_names1 != 0) { - SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + SMB_ASSERT_ARRAY(r_u->hdr_name, r_u->num_names2); - for (i = 0; i < r_u->num_aliases2; i++) + for (i = 0; i < r_u->num_names2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); - smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); + slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i); + smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth); } - for (i = 0; i < r_u->num_aliases2; i++) + for (i = 0; i < r_u->num_names2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); - smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); + slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i); + smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth); } } prs_align(ps); - prs_uint32("num_als_usrs1", ps, depth, &(r_u->num_als_usrs1)); - prs_uint32("ptr_als_usrs ", ps, depth, &(r_u->ptr_als_usrs )); - prs_uint32("num_als_usrs2", ps, depth, &(r_u->num_als_usrs2)); + prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); + prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); - if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) + if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { - SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); - - for (i = 0; i < r_u->num_als_usrs2; i++) + for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); + slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->type[i])); } } diff --git a/source/rpc_server/srv_samr.c b/source/rpc_server/srv_samr.c index 505fad25b4e..7bc12afe748 100644 --- a/source/rpc_server/srv_samr.c +++ b/source/rpc_server/srv_samr.c @@ -670,7 +670,6 @@ 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 ********************************************************************/ @@ -741,9 +740,14 @@ static void samr_reply_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_u, /* store the response in the SMB stream */ samr_io_r_query_groupmem("", &r_u, rdata, 0); - if (sid != NULL) + if (rid != NULL) { - free(sid); + free(rid); + } + + if (attr != NULL) + { + free(attr); } DEBUG(5,("samr_query_groupmem: %d\n", __LINE__)); @@ -764,8 +768,6 @@ static void api_samr_query_groupmem( uint16 vuid, prs_struct *data, prs_struct * samr_reply_query_groupmem(&q_u, rdata); } -#endif - /******************************************************************* samr_reply_query_groupinfo @@ -793,13 +795,13 @@ static void samr_reply_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_u, { r_e.ptr = 1; ctr.switch_value = 1; - make_samr_group_info1(&ctr.group.info1, "<account name>", "<account description>"); + 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>"); + make_samr_group_info4(&ctr.group.info4, "account description"); } else { @@ -1296,7 +1298,6 @@ static void samr_reply_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, sid_copy(&sid, &pol_sid); sid_append_rid(&sid, q_u->gid[i]); lookup_sid(&sid, group_names[i], &group_attrs[i]); - group_attrs[i] = 0x2; } } @@ -2075,6 +2076,7 @@ static struct api_struct api_samr_cmds [] = { "SAMR_ENUM_DOM_ALIASES" , SAMR_ENUM_DOM_ALIASES , api_samr_enum_dom_aliases }, { "SAMR_QUERY_USERALIASES", SAMR_QUERY_USERALIASES, api_samr_query_useraliases}, { "SAMR_QUERY_ALIASMEM" , SAMR_QUERY_ALIASMEM , api_samr_query_aliasmem }, + { "SAMR_QUERY_GROUPMEM" , SAMR_QUERY_GROUPMEM , api_samr_query_groupmem }, { "SAMR_LOOKUP_NAMES" , SAMR_LOOKUP_NAMES , api_samr_lookup_names }, { "SAMR_OPEN_USER" , SAMR_OPEN_USER , api_samr_open_user }, { "SAMR_QUERY_USERINFO" , SAMR_QUERY_USERINFO , api_samr_query_userinfo }, |