smbd/change_trust_pw.c

ソースコードを見る。

関数

NTSTATUS change_trust_account_password (const char *domain, const char *remote_machine)


関数

NTSTATUS change_trust_account_password ( const char *  domain,
const char *  remote_machine 
)

change_trust_pw.c31 行で定義されています。

参照先 clicli_full_connection()cli_rpc_pipe_open_noauth()cli_shutdown()current_timestring()failedget_pdc_ip()global_mynamecli_state::mem_ctxname_status_find()nt_errstr()trust_pw_find_change_and_store_it().

参照元 timeout_processing().

00032 {
00033         NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
00034         struct in_addr pdc_ip;
00035         fstring dc_name;
00036         struct cli_state *cli = NULL;
00037         struct rpc_pipe_client *netlogon_pipe = NULL;
00038 
00039         DEBUG(5,("change_trust_account_password: Attempting to change trust account password in domain %s....\n",
00040                 domain));
00041 
00042         if (remote_machine == NULL || !strcmp(remote_machine, "*")) {
00043                 /* Use the PDC *only* for this */
00044         
00045                 if ( !get_pdc_ip(domain, &pdc_ip) ) {
00046                         DEBUG(0,("Can't get IP for PDC for domain %s\n", domain));
00047                         goto failed;
00048                 }
00049 
00050                 if ( !name_status_find( domain, 0x1b, 0x20, pdc_ip, dc_name) )
00051                         goto failed;
00052         } else {
00053                 /* supoport old deprecated "smbpasswd -j DOMAIN -r MACHINE" behavior */
00054                 fstrcpy( dc_name, remote_machine );
00055         }
00056         
00057         /* if this next call fails, then give up.  We can't do
00058            password changes on BDC's  --jerry */
00059            
00060         if (!NT_STATUS_IS_OK(cli_full_connection(&cli, global_myname(), dc_name, 
00061                                            NULL, 0,
00062                                            "IPC$", "IPC",  
00063                                            "", "",
00064                                            "", 0, Undefined, NULL))) {
00065                 DEBUG(0,("modify_trust_password: Connection to %s failed!\n", dc_name));
00066                 nt_status = NT_STATUS_UNSUCCESSFUL;
00067                 goto failed;
00068         }
00069       
00070         /*
00071          * Ok - we have an anonymous connection to the IPC$ share.
00072          * Now start the NT Domain stuff :-).
00073          */
00074 
00075         /* Shouldn't we open this with schannel ? JRA. */
00076 
00077         netlogon_pipe = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &nt_status);
00078         if (!netlogon_pipe) {
00079                 DEBUG(0,("modify_trust_password: unable to open the domain client session to machine %s. Error was : %s.\n", 
00080                         dc_name, nt_errstr(nt_status)));
00081                 cli_shutdown(cli);
00082                 cli = NULL;
00083                 goto failed;
00084         }
00085 
00086         nt_status = trust_pw_find_change_and_store_it(netlogon_pipe, cli->mem_ctx, domain);
00087   
00088         cli_shutdown(cli);
00089         cli = NULL;
00090         
00091 failed:
00092         if (!NT_STATUS_IS_OK(nt_status)) {
00093                 DEBUG(0,("%s : change_trust_account_password: Failed to change password for domain %s.\n", 
00094                         current_timestring(False), domain));
00095         }
00096         else
00097                 DEBUG(5,("change_trust_account_password: sucess!\n"));
00098   
00099         return nt_status;
00100 }


Sambaに対してSat Aug 29 21:24:24 2009に生成されました。  doxygen 1.4.7