summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_netlogon.c
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-04-08 05:36:15 +0000
committerMatthew Chapman <matty@samba.org>1999-04-08 05:36:15 +0000
commit373ea639e03e72bef8242133abbf678cf90ed0d9 (patch)
treec6fb6d1918c77c49f039ba0953dc4066abbb2d9c /source3/rpcclient/cmd_netlogon.c
parent53f0cd990c3d26e73b42266be35516d6db9621e0 (diff)
downloadsamba-373ea639e03e72bef8242133abbf678cf90ed0d9.tar.gz
samba-373ea639e03e72bef8242133abbf678cf90ed0d9.tar.bz2
samba-373ea639e03e72bef8242133abbf678cf90ed0d9.zip
Mainly BDC-related changes.
* Added SEC_CHAN_BDC * Propagate sec_chan into the various functions which change trust account passwords, so they can be used for domain control and inter-domain trusts. * Fix for endianness problem reported by Edan Idzerda <edan@mtu.edu>. A BUFFER2 is really a "unibuf" in my terminology and we should treat it as such. * Added some more common NT structures (BIGINT, BUFHDR2, BUFFER4). * Added NET_SAM_SYNC (-> NetDatabaseSync2) RPC for account replication. Still experimental and incomplete, with a few too many NULL security descriptors lying around (must go look at Jeremy's SD code). Haven't worked out password encryption yet either. However, the XXX_INFO structures I've added to rpc_netlogon.h are quite nice as they give some insight into how these objects are stored in the SAM. (This used to be commit 7b830350eb54dc9d357c115e12ddf9a0633527ac)
Diffstat (limited to 'source3/rpcclient/cmd_netlogon.c')
-rw-r--r--source3/rpcclient/cmd_netlogon.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 1ad71b7f4f..be5bf8596a 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -101,7 +101,7 @@ void cmd_netlogon_login_test(struct client_info *info)
{
unsigned char new_trust_passwd[16];
generate_random_buffer(new_trust_passwd, 16, True);
- res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd) : False;
+ res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd, SEC_CHAN_WKSTA) : False;
if (res)
{
@@ -174,3 +174,31 @@ void cmd_netlogon_domain_test(struct client_info *info)
nt_trust_dom, BOOLSTR(res));
}
+/****************************************************************************
+experimental SAM synchronisation.
+****************************************************************************/
+void cmd_sam_sync(struct client_info *info)
+{
+ uint16 nt_pipe_fnum;
+ BOOL res = True;
+ unsigned char trust_passwd[16];
+
+ DEBUG(5,("Attempting SAM Synchronisation with PDC\n"));
+
+ res = res ? trust_get_passwd(trust_passwd, smb_cli->domain, info->myhostname) : False;
+
+ /* open NETLOGON session. negotiate credentials */
+ res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON, &nt_pipe_fnum) : False;
+
+ res = res ? cli_nt_setup_creds(smb_cli, nt_pipe_fnum, smb_cli->mach_acct,
+ trust_passwd, SEC_CHAN_BDC) : False;
+
+ res = res ? cli_net_sam_sync(smb_cli, nt_pipe_fnum, 0) : False;
+
+ memset(trust_passwd, 0, 16);
+
+ /* close the session */
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
+
+ fprintf(out_hnd,"cmd_sam_sync: test succeeded: %s\n", BOOLSTR(res));
+}