Author: jra
Date: 2005-09-03 00:33:27 +0000 (Sat, 03 Sep 2005)
New Revision: 9979

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9979

Log:
Ensure the creds stream is set up when testing the netlogon pipe.
Jeremy.

Modified:
   branches/tmp/RPCREWRITE/source/rpc_client/cli_lsarpc.c
   branches/tmp/RPCREWRITE/source/rpcclient/rpcclient.c


Changeset:
Modified: branches/tmp/RPCREWRITE/source/rpc_client/cli_lsarpc.c
===================================================================
--- branches/tmp/RPCREWRITE/source/rpc_client/cli_lsarpc.c      2005-09-02 
23:42:56 UTC (rev 9978)
+++ branches/tmp/RPCREWRITE/source/rpc_client/cli_lsarpc.c      2005-09-03 
00:33:27 UTC (rev 9979)
@@ -178,7 +178,7 @@
        LSA_R_LOOKUP_SIDS r;
        DOM_R_REF ref;
        LSA_TRANS_NAME_ENUM t_names;
-       NTSTATUS result;
+       NTSTATUS result = NT_STATUS_OK;
        int i;
 
        ZERO_STRUCT(q);

Modified: branches/tmp/RPCREWRITE/source/rpcclient/rpcclient.c
===================================================================
--- branches/tmp/RPCREWRITE/source/rpcclient/rpcclient.c        2005-09-02 
23:42:56 UTC (rev 9978)
+++ branches/tmp/RPCREWRITE/source/rpcclient/rpcclient.c        2005-09-03 
00:33:27 UTC (rev 9979)
@@ -519,23 +519,6 @@
        /* Open pipe */
 
        if (cmd_entry->pipe_idx != -1 && cmd_entry->rpc_pipe == NULL) {
-#if 0
-               if (lp_client_schannel() && (cmd_entry->pipe_idx == 
PI_NETLOGON) && !(cli->pipe_auth_flags & AUTH_PIPE_SCHANNEL)) {
-               uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
-               uint32 sec_channel_type;
-       uchar trust_password[16];
-       
-               if (!secrets_fetch_trust_account_password(lp_workgroup(),
-                                                         trust_password,
-                                                         NULL, 
&sec_channel_type)) {
-                       return NT_STATUS_UNSUCCESSFUL;
-               }
-               
-               ntresult = cli_nt_setup_creds(cli, sec_channel_type, 
-                                             trust_password,
-                                             &neg_flags, 2);
-}
-#endif
                switch (pipe_default_auth_type) {
                        case PIPE_AUTH_TYPE_NONE:
                                cmd_entry->rpc_pipe = 
cli_rpc_pipe_open_noauth(cli,
@@ -566,6 +549,32 @@
                                get_pipe_name_from_index(cmd_entry->pipe_idx)));
                        return NT_STATUS_UNSUCCESSFUL;
                }
+
+               if (cmd_entry->pipe_idx == PI_NETLOGON) {
+                       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+                       uint32 sec_channel_type;
+                       uchar trust_password[16];
+       
+                       if 
(!secrets_fetch_trust_account_password(lp_workgroup(),
+                                                       trust_password,
+                                                       NULL, 
&sec_channel_type)) {
+                               return NT_STATUS_UNSUCCESSFUL;
+                       }
+               
+                       ntresult = 
rpccli_netlogon_setup_creds(cmd_entry->rpc_pipe,
+                                               cli->desthost,
+                                               lp_workgroup(),
+                                               global_myname(),
+                                               trust_password,
+                                               sec_channel_type,
+                                               &neg_flags);
+
+                       if (!NT_STATUS_IS_OK(ntresult)) {
+                               DEBUG(0, ("Could not initialise credentials for 
%s.\n",
+                                       
get_pipe_name_from_index(cmd_entry->pipe_idx)));
+                               return ntresult;
+                       }
+               }
        }
 
        /* Run command */

Reply via email to