summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/rpc_client/cli_netlogon.c15
-rw-r--r--source3/rpc_client/cli_netlogon_sync.c2
-rw-r--r--source3/rpcclient/cmd_netlogon.c5
-rw-r--r--source3/rpcclient/cmd_samr.c48
5 files changed, 46 insertions, 32 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ade8866376..6789fdd0be 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1780,8 +1780,14 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint16 nt_pipe_fnum,
BOOL cli_net_sam_logon(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr,
NET_USER_INFO_3 *user_info3);
BOOL cli_net_sam_logoff(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr);
-BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 database_id, uint32 *num_deltas, SAM_DELTA_HDR *hdr_deltas, SAM_DELTA_CTR *deltas);
+BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum,
+ const char* srv_name,
+ uint32 database_id,
+ uint32 *num_deltas,
+ SAM_DELTA_HDR *hdr_deltas,
+ SAM_DELTA_CTR *deltas);
BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16],
+ const char* acct_name,
const char* srv_name,
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
SAM_DELTA_CTR deltas [MAX_SAM_DELTAS],
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index a91a448994..0a9228a3b2 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -490,7 +490,12 @@ password ?).\n", cli->desthost ));
/***************************************************************************
Synchronise SAM Database (requires SEC_CHAN_BDC).
****************************************************************************/
-BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 database_id, uint32 *num_deltas, SAM_DELTA_HDR *hdr_deltas, SAM_DELTA_CTR *deltas)
+BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum,
+ const char* srv_name,
+ uint32 database_id,
+ uint32 *num_deltas,
+ SAM_DELTA_HDR *hdr_deltas,
+ SAM_DELTA_CTR *deltas)
{
NET_Q_SAM_SYNC q_s;
prs_struct rbuf;
@@ -505,7 +510,7 @@ BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 databas
/* create and send a MSRPC command with api NET_SAM_SYNC */
- make_q_sam_sync(&q_s, cli->srv_name_slash, global_myname,
+ make_q_sam_sync(&q_s, cli->srv_name_slash, srv_name,
&new_clnt_cred, database_id);
/* turn parameters into data stream */
@@ -556,6 +561,7 @@ BOOL cli_net_sam_sync(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 databas
BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16],
+ const char* acct_name,
const char* srv_name,
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
SAM_DELTA_CTR deltas [MAX_SAM_DELTAS],
@@ -573,12 +579,13 @@ BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16],
res = res ? cli_nt_session_open(cli, PIPE_NETLOGON, &nt_pipe_fnum) : False;
res = res ? cli_nt_setup_creds(cli, nt_pipe_fnum,
- cli->mach_acct, srv_name,
+ acct_name, srv_name,
trust_passwd, SEC_CHAN_BDC) == 0x0 : False;
memset(trust_passwd, 0, 16);
- res = res ? cli_net_sam_sync(cli, nt_pipe_fnum, 0, num_deltas, hdr_deltas, deltas) : False;
+ res = res ? cli_net_sam_sync(cli, nt_pipe_fnum, srv_name,
+ 0, num_deltas, hdr_deltas, deltas) : False;
/* close the session */
cli_nt_session_close(cli, nt_pipe_fnum);
diff --git a/source3/rpc_client/cli_netlogon_sync.c b/source3/rpc_client/cli_netlogon_sync.c
index eb8dfe0b9f..5dd2ab4909 100644
--- a/source3/rpc_client/cli_netlogon_sync.c
+++ b/source3/rpc_client/cli_netlogon_sync.c
@@ -62,7 +62,7 @@ BOOL synchronise_passdb(void)
return False;
}
- ret = do_sam_sync(&cli, trust_passwd, global_myname,
+ ret = do_sam_sync(&cli, trust_passwd, cli.mach_acct, global_myname,
hdr_deltas, deltas, &num);
if (ret)
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 3652218692..5c17e5c3da 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -45,7 +45,9 @@ experimental nt login.
void cmd_netlogon_login_test(struct client_info *info)
{
uint16 nt_pipe_fnum;
+#if 0
extern BOOL global_machine_password_needs_changing;
+#endif
fstring nt_user_name;
fstring password;
@@ -195,7 +197,8 @@ void cmd_sam_sync(struct client_info *info)
return;
}
- if (do_sam_sync(smb_cli, trust_passwd, global_myname,
+ if (do_sam_sync(smb_cli, trust_passwd,
+ smb_cli->mach_acct, global_myname,
hdr_deltas, deltas, &num))
{
display_sam_sync(out_hnd, ACTION_HEADER , hdr_deltas, deltas, num);
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index a226608680..7d59503de4 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1280,8 +1280,9 @@ static void req_alias_info(struct client_info *info, uint16 fnum,
ptr_sid = (uint32*) malloc(sizeof(ptr_sid[0]) * 1);
als_sid = (DOM_SID2*)malloc(sizeof(als_sid[0]) * 1);
- make_dom_sid2(&als_sid[0], sid1);
+ sid_copy(&als_sid[0].sid, sid1);
sid_append_rid(&als_sid[0].sid, user_rid);
+ als_sid[0].num_auths = als_sid[0].sid.num_auths;
ptr_sid[0] = 1;
@@ -1365,6 +1366,7 @@ int msrpc_sam_enum_users(struct client_info *info,
uint32 user_idx;
BOOL res = True;
BOOL res1 = True;
+ BOOL res2 = True;
uint32 start_idx = 0x0;
uint16 unk_0 = 0x0;
uint16 acb_mask = 0;
@@ -1412,39 +1414,37 @@ int msrpc_sam_enum_users(struct client_info *info,
&info->dom.samr_pol_connect, ace_perms, &sid1,
&info->dom.samr_pol_open_domain) : False;
-#if 0
/* connect to the S-1-5-20 domain */
- res1 = res ? samr_open_domain(smb_cli, fnum,
+ res2 = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, ace_perms, &sid_1_5_20,
&info->dom.samr_pol_open_builtindom) : False;
-#endif
- /* read some users */
- while (res1 && status == STATUS_MORE_ENTRIES)
+ if (res1)
{
- status = samr_enum_dom_users(smb_cli, fnum,
- &info->dom.samr_pol_open_domain,
- &start_idx, acb_mask, unk_1, 0x01,
- &info->dom.sam, &info->dom.num_sam_entries);
- }
-
+ /* read some users */
+ while (status == STATUS_MORE_ENTRIES)
+ {
+ status = samr_enum_dom_users(smb_cli, fnum,
+ &info->dom.samr_pol_open_domain,
+ &start_idx, acb_mask, unk_1, 0x01,
+ &info->dom.sam, &info->dom.num_sam_entries);
+ }
+
- if (res1 && info->dom.num_sam_entries == 0)
- {
- report(out_hnd, "No users\n");
- }
+ if (info->dom.num_sam_entries == 0)
+ {
+ report(out_hnd, "No users\n");
+ }
- if (res1)
- {
/* query all the users */
for (user_idx = 0; res && user_idx <
- info->dom.num_sam_entries; user_idx++)
+ info->dom.num_sam_entries; user_idx++)
{
uint32 user_rid = info->dom.sam[user_idx].rid;
report(out_hnd, "User RID: %8x User Name: %s\n",
- user_rid,
- info->dom.sam[user_idx].acct_name);
+ user_rid,
+ info->dom.sam[user_idx].acct_name);
if (request_group_info)
{
@@ -1463,12 +1463,10 @@ int msrpc_sam_enum_users(struct client_info *info,
}
}
-#if 0
- res1 = res1 ? samr_close(smb_cli, fnum,
+ res2 = res2 ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_builtindom) : False;
-#endif
- res = res ? samr_close(smb_cli, fnum,
+ res1 = res1 ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
res = res ? samr_close(smb_cli, fnum,