diff -uNrp samba-3.0.32.org/source/libsmb/trusts_util.c samba-3.0.32/source/libsmb/trusts_util.c --- samba-3.0.32.org/source/libsmb/trusts_util.c 2008-08-26 06:09:21.000000000 +0900 +++ samba-3.0.32/source/libsmb/trusts_util.c 2008-10-27 17:27:01.000000000 +0900 @@ -33,7 +33,7 @@ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const unsigned char orig_trust_passwd_hash[16], const unsigned char new_trust_passwd_hash[16], - uint32 sec_channel_type) + uint32 sec_channel_type, uint32 neg_flags) { NTSTATUS result; @@ -41,8 +41,6 @@ static NTSTATUS just_change_the_password already have valid creds. If not we must set them up. */ if (cli->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) { - uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS; - result = rpccli_netlogon_setup_creds(cli, cli->cli->desthost, /* server name */ lp_workgroup(), /* domain */ @@ -77,7 +75,7 @@ static NTSTATUS just_change_the_password NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain, unsigned char orig_trust_passwd_hash[16], - uint32 sec_channel_type) + uint32 sec_channel_type, uint32 neg_flags) { unsigned char new_trust_passwd_hash[16]; char *new_trust_passwd; @@ -95,7 +93,7 @@ NTSTATUS trust_pw_change_and_store_it(st E_md4hash(new_trust_passwd, new_trust_passwd_hash); nt_status = just_change_the_password(cli, mem_ctx, orig_trust_passwd_hash, - new_trust_passwd_hash, sec_channel_type); + new_trust_passwd_hash, sec_channel_type, neg_flags); if (NT_STATUS_IS_OK(nt_status)) { DEBUG(3,("%s : trust_pw_change_and_store_it: Changed password.\n", @@ -134,7 +132,7 @@ NTSTATUS trust_pw_find_change_and_store_ return trust_pw_change_and_store_it(cli, mem_ctx, domain, old_trust_passwd_hash, - sec_channel_type); + sec_channel_type, NETLOGON_NEG_AUTH2_ADS_FLAGS); } /********************************************************************* diff -uNrp samba-3.0.32.org/source/utils/net.c samba-3.0.32/source/utils/net.c --- samba-3.0.32.org/source/utils/net.c 2008-08-26 06:09:21.000000000 +0900 +++ samba-3.0.32/source/utils/net.c 2008-10-27 17:47:45.000000000 +0900 @@ -495,15 +495,14 @@ struct cli_state *net_make_ipc_connectio server_name = SMB_STRDUP( server ); server_ip = *ip; } - - if (opt_user_name) { - nt_status = connect_to_ipc(&cli, &server_ip, server_name); + + if (flags & NET_FLAGS_ANONYMOUS) { + nt_status = connect_to_ipc_anonymous(&cli, &server_ip, server_name); if (NT_STATUS_IS_OK(nt_status)) { goto connected; } - } - if (flags & NET_FLAGS_ANONYMOUS) { - nt_status = connect_to_ipc_anonymous(&cli, &server_ip, server_name); + } else if (opt_user_name) { + nt_status = connect_to_ipc(&cli, &server_ip, server_name); if (NT_STATUS_IS_OK(nt_status)) { goto connected; } diff -uNrp samba-3.0.32.org/source/utils/net_rpc.c samba-3.0.32/source/utils/net_rpc.c --- samba-3.0.32.org/source/utils/net_rpc.c 2008-08-26 06:09:21.000000000 +0900 +++ samba-3.0.32/source/utils/net_rpc.c 2008-10-27 17:21:15.000000000 +0900 @@ -299,7 +299,7 @@ static NTSTATUS rpc_oldjoin_internals(co result = trust_pw_change_and_store_it(pipe_hnd, mem_ctx, opt_target_workgroup, orig_trust_passwd_hash, - sec_channel_type); + sec_channel_type, NETLOGON_NEG_AUTH2_FLAGS); if (NT_STATUS_IS_OK(result)) printf("Joined domain %s.\n",opt_target_workgroup);