mirror of
https://github.com/samba-team/samba.git
synced 2025-12-06 16:23:49 +03:00
adding extra parameter back in to trust account functions (trust account name).
restoring opening S-1-5-20 in sam enum users code.
This commit is contained in:
@@ -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,
|
BOOL cli_net_sam_logon(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr,
|
||||||
NET_USER_INFO_3 *user_info3);
|
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_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],
|
BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16],
|
||||||
|
const char* acct_name,
|
||||||
const char* srv_name,
|
const char* srv_name,
|
||||||
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
|
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
|
||||||
SAM_DELTA_CTR deltas [MAX_SAM_DELTAS],
|
SAM_DELTA_CTR deltas [MAX_SAM_DELTAS],
|
||||||
|
|||||||
@@ -490,7 +490,12 @@ password ?).\n", cli->desthost ));
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Synchronise SAM Database (requires SEC_CHAN_BDC).
|
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;
|
NET_Q_SAM_SYNC q_s;
|
||||||
prs_struct rbuf;
|
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 */
|
/* 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);
|
&new_clnt_cred, database_id);
|
||||||
|
|
||||||
/* turn parameters into data stream */
|
/* 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],
|
BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16],
|
||||||
|
const char* acct_name,
|
||||||
const char* srv_name,
|
const char* srv_name,
|
||||||
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
|
SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS],
|
||||||
SAM_DELTA_CTR 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_session_open(cli, PIPE_NETLOGON, &nt_pipe_fnum) : False;
|
||||||
|
|
||||||
res = res ? cli_nt_setup_creds(cli, nt_pipe_fnum,
|
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;
|
trust_passwd, SEC_CHAN_BDC) == 0x0 : False;
|
||||||
|
|
||||||
memset(trust_passwd, 0, 16);
|
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 */
|
/* close the session */
|
||||||
cli_nt_session_close(cli, nt_pipe_fnum);
|
cli_nt_session_close(cli, nt_pipe_fnum);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ BOOL synchronise_passdb(void)
|
|||||||
return False;
|
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);
|
hdr_deltas, deltas, &num);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ experimental nt login.
|
|||||||
void cmd_netlogon_login_test(struct client_info *info)
|
void cmd_netlogon_login_test(struct client_info *info)
|
||||||
{
|
{
|
||||||
uint16 nt_pipe_fnum;
|
uint16 nt_pipe_fnum;
|
||||||
|
#if 0
|
||||||
extern BOOL global_machine_password_needs_changing;
|
extern BOOL global_machine_password_needs_changing;
|
||||||
|
#endif
|
||||||
|
|
||||||
fstring nt_user_name;
|
fstring nt_user_name;
|
||||||
fstring password;
|
fstring password;
|
||||||
@@ -195,7 +197,8 @@ void cmd_sam_sync(struct client_info *info)
|
|||||||
return;
|
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))
|
hdr_deltas, deltas, &num))
|
||||||
{
|
{
|
||||||
display_sam_sync(out_hnd, ACTION_HEADER , hdr_deltas, deltas, num);
|
display_sam_sync(out_hnd, ACTION_HEADER , hdr_deltas, deltas, num);
|
||||||
|
|||||||
@@ -1280,8 +1280,9 @@ static void req_alias_info(struct client_info *info, uint16 fnum,
|
|||||||
ptr_sid = (uint32*) malloc(sizeof(ptr_sid[0]) * 1);
|
ptr_sid = (uint32*) malloc(sizeof(ptr_sid[0]) * 1);
|
||||||
als_sid = (DOM_SID2*)malloc(sizeof(als_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);
|
sid_append_rid(&als_sid[0].sid, user_rid);
|
||||||
|
als_sid[0].num_auths = als_sid[0].sid.num_auths;
|
||||||
|
|
||||||
ptr_sid[0] = 1;
|
ptr_sid[0] = 1;
|
||||||
|
|
||||||
@@ -1365,6 +1366,7 @@ int msrpc_sam_enum_users(struct client_info *info,
|
|||||||
uint32 user_idx;
|
uint32 user_idx;
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res1 = True;
|
BOOL res1 = True;
|
||||||
|
BOOL res2 = True;
|
||||||
uint32 start_idx = 0x0;
|
uint32 start_idx = 0x0;
|
||||||
uint16 unk_0 = 0x0;
|
uint16 unk_0 = 0x0;
|
||||||
uint16 acb_mask = 0;
|
uint16 acb_mask = 0;
|
||||||
@@ -1412,15 +1414,15 @@ int msrpc_sam_enum_users(struct client_info *info,
|
|||||||
&info->dom.samr_pol_connect, ace_perms, &sid1,
|
&info->dom.samr_pol_connect, ace_perms, &sid1,
|
||||||
&info->dom.samr_pol_open_domain) : False;
|
&info->dom.samr_pol_open_domain) : False;
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* connect to the S-1-5-20 domain */
|
/* 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_connect, ace_perms, &sid_1_5_20,
|
||||||
&info->dom.samr_pol_open_builtindom) : False;
|
&info->dom.samr_pol_open_builtindom) : False;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
if (res1)
|
||||||
|
{
|
||||||
/* read some users */
|
/* read some users */
|
||||||
while (res1 && status == STATUS_MORE_ENTRIES)
|
while (status == STATUS_MORE_ENTRIES)
|
||||||
{
|
{
|
||||||
status = samr_enum_dom_users(smb_cli, fnum,
|
status = samr_enum_dom_users(smb_cli, fnum,
|
||||||
&info->dom.samr_pol_open_domain,
|
&info->dom.samr_pol_open_domain,
|
||||||
@@ -1429,13 +1431,11 @@ int msrpc_sam_enum_users(struct client_info *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res1 && info->dom.num_sam_entries == 0)
|
if (info->dom.num_sam_entries == 0)
|
||||||
{
|
{
|
||||||
report(out_hnd, "No users\n");
|
report(out_hnd, "No users\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res1)
|
|
||||||
{
|
|
||||||
/* query all the users */
|
/* query all the users */
|
||||||
for (user_idx = 0; res && user_idx <
|
for (user_idx = 0; res && user_idx <
|
||||||
info->dom.num_sam_entries; user_idx++)
|
info->dom.num_sam_entries; user_idx++)
|
||||||
@@ -1463,12 +1463,10 @@ int msrpc_sam_enum_users(struct client_info *info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
res2 = res2 ? samr_close(smb_cli, fnum,
|
||||||
res1 = res1 ? samr_close(smb_cli, fnum,
|
|
||||||
&info->dom.samr_pol_open_builtindom) : False;
|
&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;
|
&info->dom.samr_pol_open_domain) : False;
|
||||||
|
|
||||||
res = res ? samr_close(smb_cli, fnum,
|
res = res ? samr_close(smb_cli, fnum,
|
||||||
|
|||||||
Reference in New Issue
Block a user