summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-12-04 21:48:06 +0000
committerLuke Leighton <lkcl@samba.org>1998-12-04 21:48:06 +0000
commit89c56492a86fb02b2045182490b93f17a475f03d (patch)
treea05232c9a4e77b8ec2148abd0758f86503861429
parentcf0ea874b1a7cb1dcaaea159d9a4a8a5deae1310 (diff)
downloadsamba-89c56492a86fb02b2045182490b93f17a475f03d.tar.gz
samba-89c56492a86fb02b2045182490b93f17a475f03d.tar.xz
samba-89c56492a86fb02b2045182490b93f17a475f03d.zip
- oops, i got "add alias member" and "delete alias member" swapped.
- samr_enum_dom_users, the first 4 bytes is some sort of garbage, nt5-beta2 clears them out to zeros whereas nt4 does not. fixed bug where we were assuming that the first 4 bytes of a response _had_ to be non-zero. - cli_lsarpc.c: forgot to append the rid on the lsa_lookup_names() client call. - added in "addaliasmem" and "addgroupmem" commands. the addaliasmem command actually turned out to be a "delaliasmem" :-) :-) - parse_lsa.c: moved assert array check to after the size of useable array space is set... (This used to be commit 165b15a8cacc4bc7cf8cc0b9aaabb6b92cef7fdb)
-rw-r--r--source3/include/proto.h10
-rw-r--r--source3/include/rpc_samr.h31
-rw-r--r--source3/rpc_client/cli_lsarpc.c2
-rw-r--r--source3/rpc_client/cli_samr.c2
-rw-r--r--source3/rpc_parse/parse_lsa.c4
-rw-r--r--source3/rpc_parse/parse_samr.c42
-rw-r--r--source3/rpc_server/srv_samr.c5
-rw-r--r--source3/rpcclient/cmd_samr.c24
-rw-r--r--source3/rpcclient/rpcclient.c2
9 files changed, 61 insertions, 61 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e2b33b32262..49fdda7075e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2086,7 +2086,7 @@ void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol,
uint16 acb_mask, uint16 unk_1, uint32 size);
void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth);
void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
- uint16 total_num_entries, uint16 unk_0,
+ uint32 unk_0,
uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status);
void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth);
void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol,
@@ -2203,14 +2203,14 @@ void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd,
const char *acct_desc);
void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth);
void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth);
-void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd,
- DOM_SID *sid);
-void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *ps, int depth);
-void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *ps, int depth);
void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
DOM_SID *sid);
void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth);
void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth);
+void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd,
+ DOM_SID *sid);
+void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth);
+void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth);
void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd);
void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth);
void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index 9c4cd4bd8cc..620532a0129 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -104,8 +104,8 @@ SamrTestPrivateFunctionsUser
#define SAMR_QUERY_ALIASINFO 0x1c
#define SAMR_SET_ALIASINFO 0x1d
#define SAMR_DELETE_DOM_ALIAS 0x1e
-#define SAMR_UNK_ALIAS 0x1f
-#define SAMR_ADD_ALIASMEM 0x20
+#define SAMR_ADD_ALIASMEM 0x1f
+#define SAMR_DEL_ALIASMEM 0x20
#define SAMR_QUERY_ALIASMEM 0x21
#define SAMR_OPEN_USER 0x22
@@ -480,8 +480,7 @@ typedef struct q_samr_enum_dom_users_info
/* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
typedef struct r_samr_enum_dom_users_info
{
- uint16 total_num_entries; /* number of entries that match without the acb mask */
- uint16 unknown_0; /* same as unknown_0 (enum context?) in request */
+ uint32 unknown_0; /* unknown. */
uint32 ptr_entries1; /* actual number of entries to follow, having masked some out */
uint32 num_entries2;
@@ -1191,40 +1190,40 @@ typedef struct r_samr_query_aliasmem_info
} SAMR_R_QUERY_ALIASMEM;
-/* SAMR_Q_UNK_ALIASMEM - don't know! */
-typedef struct q_samr_unk_alias_mem_info
+/* SAMR_Q_ADD_ALIASMEM - don't know! */
+typedef struct q_samr_add_alias_mem_info
{
POLICY_HND alias_pol; /* policy handle */
DOM_SID sid; /* member sid to be "something"ed to do with the alias */
-} SAMR_Q_UNK_ALIASMEM;
+} SAMR_Q_ADD_ALIASMEM;
-/* SAMR_R_UNK_ALIASMEM - probably an open */
-typedef struct r_samr_unk_alias_mem_info
+/* SAMR_R_ADD_ALIASMEM - probably an open */
+typedef struct r_samr_add_alias_mem_info
{
uint32 status; /* return status */
-} SAMR_R_UNK_ALIASMEM;
+} SAMR_R_ADD_ALIASMEM;
-/* SAMR_Q_ADD_ALIASMEM - probably an add member */
-typedef struct q_samr_add_alias_mem_info
+/* SAMR_Q_DEL_ALIASMEM - add an add alias member */
+typedef struct q_samr_del_alias_mem_info
{
POLICY_HND alias_pol; /* policy handle */
DOM_SID2 sid; /* member sid to be added to alias */
-} SAMR_Q_ADD_ALIASMEM;
+} SAMR_Q_DEL_ALIASMEM;
-/* SAMR_R_ADD_ALIASMEM - probably an open */
-typedef struct r_samr_add_alias_mem_info
+/* SAMR_R_DEL_ALIASMEM - delete alias member */
+typedef struct r_samr_del_alias_mem_info
{
uint32 status; /* return status */
-} SAMR_R_ADD_ALIASMEM;
+} SAMR_R_DEL_ALIASMEM;
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index f80d6613f66..0516cee96d3 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -192,10 +192,12 @@ BOOL lsa_lookup_names(struct cli_state *cli,
for (i = 0; i < (*num_sids); i++)
{
uint32 dom_idx = t_rids[i].rid_idx;
+ uint32 dom_rid = t_rids[i].rid;
DOM_SID *sid = &(*sids)[i];
if (dom_idx != 0xffffffff)
{
sid_copy(sid, &ref.ref_dom[dom_idx].ref_dom.sid);
+ sid_append_rid(sid, dom_rid);
}
else
{
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 2ea7d54821b..9d3cbd22c23 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -861,7 +861,7 @@ BOOL samr_open_alias(struct cli_state *cli,
prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True );
/* store the parameters */
- make_samr_q_open_alias(&q_o, domain_pol, 0x0008, rid);
+ make_samr_q_open_alias(&q_o, domain_pol, 0x000f001f, rid);
/* turn parameters into data stream */
samr_io_q_open_alias("", &q_o, &data, 0);
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 7fcdeccec8b..9781e3cfabb 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -677,11 +677,11 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
- SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries);
-
q_l->num_entries = num_names;
q_l->num_entries2 = num_names;
+ SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries);
+
for (i = 0; i < num_names; i++)
{
int len = strlen(names[i]);
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index a344d0d4eeb..ac849a89874 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -853,7 +853,7 @@ void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struc
makes a SAMR_R_ENUM_DOM_USERS structure.
********************************************************************/
void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
- uint16 total_num_entries, uint16 unk_0,
+ uint32 unk_0,
uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status)
{
int i;
@@ -869,10 +869,9 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
num_sam_entries));
}
- r_u->total_num_entries = total_num_entries;
- r_u->unknown_0 = unk_0;
+ r_u->unknown_0 = unk_0;
- if (total_num_entries > 0)
+ if (num_sam_entries != 0)
{
r_u->ptr_entries1 = 1;
r_u->ptr_entries2 = 1;
@@ -917,11 +916,10 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc
prs_align(ps);
- prs_uint16("total_num_entries", ps, depth, &(r_u->total_num_entries));
- prs_uint16("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
+ prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1));
- if (r_u->total_num_entries != 0 && r_u->ptr_entries1 != 0)
+ if (r_u->ptr_entries1 != 0)
{
prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
@@ -2378,7 +2376,7 @@ void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u,
memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
q_u->num_sids1 = 1;
- q_u->ptr = 0;
+ q_u->ptr = 1;
q_u->num_sids2 = 1;
{
@@ -2813,14 +2811,14 @@ void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_s
/*******************************************************************
-makes a SAMR_Q_UNK_ALIASMEM structure.
+makes a SAMR_Q_ADD_ALIASMEM structure.
********************************************************************/
-void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd,
+void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
DOM_SID *sid)
{
if (q_u == NULL) return;
- DEBUG(5,("make_samr_q_unk_aliasmem\n"));
+ DEBUG(5,("make_samr_q_add_aliasmem\n"));
memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
sid_copy(&q_u->sid, sid);
@@ -2830,11 +2828,11 @@ void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *ps, int depth)
+void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
- prs_debug(ps, depth, desc, "samr_io_q_unk_aliasmem");
+ prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
depth++;
prs_align(ps);
@@ -2846,11 +2844,11 @@ void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *p
/*******************************************************************
reads or writes a structure.
********************************************************************/
-void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *ps, int depth)
+void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
- prs_debug(ps, depth, desc, "samr_io_r_unk_aliasmem");
+ prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
depth++;
prs_align(ps);
@@ -2860,14 +2858,14 @@ void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *p
/*******************************************************************
-makes a SAMR_Q_ADD_ALIASMEM structure.
+makes a SAMR_Q_DEL_ALIASMEM structure.
********************************************************************/
-void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
+void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd,
DOM_SID *sid)
{
if (q_u == NULL) return;
- DEBUG(5,("make_samr_q_add_aliasmem\n"));
+ DEBUG(5,("make_samr_q_del_aliasmem\n"));
memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
make_dom_sid2(&q_u->sid, sid);
@@ -2877,11 +2875,11 @@ void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth)
+void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
- prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
+ prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
depth++;
prs_align(ps);
@@ -2893,11 +2891,11 @@ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *p
/*******************************************************************
reads or writes a structure.
********************************************************************/
-void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth)
+void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
- prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
+ prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
depth++;
prs_align(ps);
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 9ed2409ab2a..02bfa2e178e 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -350,7 +350,6 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u,
int total_entries;
r_e.status = 0x0;
- r_e.total_num_entries = 0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
@@ -364,8 +363,8 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u,
get_sampwd_entries(pass, 0, &total_entries, &num_entries, MAX_SAM_ENTRIES, q_u->acb_mask);
unbecome_root(True);
- make_samr_r_enum_dom_users(&r_e, total_entries,
- q_u->unknown_0, num_entries,
+ make_samr_r_enum_dom_users(&r_e,
+ 0x00000000, num_entries,
pass, r_e.status);
/* store the response in the SMB stream */
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 13e08296137..ae3ef548c61 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -208,9 +208,9 @@ void cmd_sam_add_aliasmem(struct client_info *info)
fprintf(out_hnd, "addaliasmem: <alias rid> [member sid1] [member sid2] ...\n");
return;
}
- alias_rid = strtoul(tmp, (char**)NULL, 10);
+ alias_rid = get_number(tmp);
- fprintf(out_hnd, "SAM Create Domain Alias\n");
+ fprintf(out_hnd, "SAM Domain Alias Member\n");
/* open SAMR session. negotiate credentials */
res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
@@ -385,9 +385,9 @@ void cmd_sam_add_groupmem(struct client_info *info)
fprintf(out_hnd, "addgroupmem: <group rid> [member rid1] [member rid2] ...\n");
return;
}
- group_rid = strtoul(tmp, (char**)NULL, 10);
+ group_rid = get_number(tmp);
- fprintf(out_hnd, "SAM Create Domain Group\n");
+ fprintf(out_hnd, "SAM Add Domain Group member\n");
/* open SAMR session. negotiate credentials */
res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
@@ -959,7 +959,7 @@ void cmd_sam_enum_aliases(struct client_info *info)
DOM_SID sid1;
BOOL res = True;
BOOL request_member_info = False;
- uint32 flags = 0x304; /* absolutely no idea. */
+ uint32 flags = 0x200003f3; /* absolutely no idea. */
fstring tmp;
uint32 alias_idx;
@@ -1049,15 +1049,15 @@ void cmd_sam_enum_aliases(struct client_info *info)
uint16 old_fnum = smb_cli->nt_pipe_fnum;
if (num_aliases != 0)
- {
+ {
sids = malloc(num_aliases * sizeof(DOM_SID*));
- }
+ }
res3 = sids != NULL;
if (res3)
- {
+ {
for (i = 0; i < num_aliases; i++)
- {
+ {
sids[i] = &sid_mem[i].sid;
}
}
@@ -1083,7 +1083,7 @@ void cmd_sam_enum_aliases(struct client_info *info)
smb_cli->nt_pipe_fnum = old_fnum;
if (res4 && names != NULL)
- {
+ {
display_alias_members(out_hnd, ACTION_HEADER , num_names, names);
display_alias_members(out_hnd, ACTION_ENUMERATE, num_names, names);
display_alias_members(out_hnd, ACTION_FOOTER , num_names, names);
@@ -1104,8 +1104,8 @@ void cmd_sam_enum_aliases(struct client_info *info)
free(sids);
}
}
- }
- }
+ }
+ }
res = res ? samr_close(smb_cli,
&info->dom.samr_pol_connect) : False;
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 68b7356e536..400faffef4a 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -124,6 +124,8 @@ struct
{"lookupsids", cmd_lsa_lookup_sids, "Resolve names from SIDs"},
{"lookupnames",cmd_lsa_lookup_names, "Resolve SIDs from names"},
{"enumusers", cmd_sam_enum_users, "SAM User Database Query (experimental!)"},
+ {"addgroupmem",cmd_sam_add_groupmem,"<group rid> [member rid1] [member rid2] ... SAM Add Domain Group Member"},
+ {"addaliasmem",cmd_sam_add_aliasmem,"<alias rid> [member sid1] [member sid2] ... SAM Add Domain Alias Member"},
{"creategroup",cmd_sam_create_dom_group,"SAM Create Domain Group"},
{"createalias",cmd_sam_create_dom_alias,"SAM Create Domain Alias"},
{"ntpass", cmd_sam_ntchange_pwd, "NT SAM Password Change"},