summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-09-02 20:19:28 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-17 08:48:59 +1300
commit2be39c1866eda63beacdb67117e01b094686befb (patch)
tree6a2c6eedfbcb8904a10de8af76ad9beedb1adbc0
parent062df736fa1f297a34edc153d735bd479b781565 (diff)
downloadsamba-2be39c1866eda63beacdb67117e01b094686befb.tar.gz
samba-2be39c1866eda63beacdb67117e01b094686befb.tar.bz2
samba-2be39c1866eda63beacdb67117e01b094686befb.zip
s3:libsmb: inline trust_pw_change_and_store_it() into trust_pw_find_change_and_store_it()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/libsmb/trusts_util.c50
2 files changed, 15 insertions, 40 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 805e6e446e..497828e529 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -972,11 +972,6 @@ void update_trustdom_cache( void );
/* The following definitions come from libsmb/trusts_util.c */
-NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- const char *domain,
- const char *account_name,
- unsigned char orig_trust_passwd_hash[16],
- enum netr_SchannelType sec_channel_type);
NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *domain) ;
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 8a0e53dbe5..428e0c17cd 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -29,20 +29,27 @@
/*********************************************************
Change the domain password on the PDC.
- Store the password ourselves, but use the supplied password
- Caller must have already setup the connection to the NETLOGON pipe
+ Do most of the legwork ourselfs. Caller must have
+ already setup the connection to the NETLOGON pipe
**********************************************************/
-NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- const char *domain,
- const char *account_name,
- unsigned char orig_trust_passwd_hash[16],
- enum netr_SchannelType sec_channel_type)
+NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *domain)
{
+ unsigned char old_trust_passwd_hash[16];
unsigned char new_trust_passwd_hash[16];
+ enum netr_SchannelType sec_channel_type = SEC_CHAN_NULL;
+ const char *account_name;
char *new_trust_passwd;
NTSTATUS nt_status;
+ if (!get_trust_pw_hash(domain, old_trust_passwd_hash, &account_name,
+ &sec_channel_type)) {
+ DEBUG(0, ("could not fetch domain secrets for domain %s!\n", domain));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
switch (sec_channel_type) {
case SEC_CHAN_WKSTA:
case SEC_CHAN_DOMAIN:
@@ -64,7 +71,7 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m
nt_status = rpccli_netlogon_set_trust_password(cli, mem_ctx,
account_name,
- orig_trust_passwd_hash,
+ old_trust_passwd_hash,
new_trust_passwd,
new_trust_passwd_hash,
sec_channel_type);
@@ -108,30 +115,3 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m
return nt_status;
}
-
-/*********************************************************
- Change the domain password on the PDC.
- Do most of the legwork ourselfs. Caller must have
- already setup the connection to the NETLOGON pipe
-**********************************************************/
-
-NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- const char *domain)
-{
- unsigned char old_trust_passwd_hash[16];
- enum netr_SchannelType sec_channel_type = SEC_CHAN_NULL;
- const char *account_name;
-
- if (!get_trust_pw_hash(domain, old_trust_passwd_hash, &account_name,
- &sec_channel_type)) {
- DEBUG(0, ("could not fetch domain secrets for domain %s!\n", domain));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- return trust_pw_change_and_store_it(cli, mem_ctx, domain,
- account_name,
- old_trust_passwd_hash,
- sec_channel_type);
-}
-