s3:dom_sid Global replace of DOM_SID with struct dom_sid
[samba.git] / source3 / rpcclient / rpcclient.c
index 20ea8a05e7d3ad9460a52e0d59320253e67a3bb3..56c0057dd96a5d6a4a778577f98e7bfd007afe2e 100644 (file)
 #include "includes.h"
 #include "rpcclient.h"
 #include "../libcli/auth/libcli_auth.h"
+#include "../librpc/gen_ndr/cli_lsa.h"
+#include "rpc_client/cli_lsarpc.h"
+#include "../librpc/gen_ndr/ndr_netlogon.h"
+#include "rpc_client/cli_netlogon.h"
 
-DOM_SID domain_sid;
+struct dom_sid domain_sid;
 
 static enum pipe_auth_type pipe_default_auth_type = PIPE_AUTH_TYPE_NONE;
 static enum dcerpc_AuthLevel pipe_default_auth_level = DCERPC_AUTH_LEVEL_NONE;
@@ -678,15 +682,16 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                        default:
                                DEBUG(0, ("Could not initialise %s. Invalid "
                                          "auth type %u\n",
-                                         get_pipe_name_from_iface(
+                                         get_pipe_name_from_syntax(
+                                                 talloc_tos(),
                                                  cmd_entry->interface),
                                          pipe_default_auth_type ));
                                return NT_STATUS_UNSUCCESSFUL;
                }
                if (!NT_STATUS_IS_OK(ntresult)) {
                        DEBUG(0, ("Could not initialise %s. Error was %s\n",
-                                 get_pipe_name_from_iface(
-                                         cmd_entry->interface),
+                                 get_pipe_name_from_syntax(
+                                         talloc_tos(), cmd_entry->interface),
                                  nt_errstr(ntresult) ));
                        return ntresult;
                }
@@ -716,7 +721,8 @@ static NTSTATUS do_cmd(struct cli_state *cli,
 
                        if (!NT_STATUS_IS_OK(ntresult)) {
                                DEBUG(0, ("Could not initialise credentials for %s.\n",
-                                         get_pipe_name_from_iface(
+                                         get_pipe_name_from_syntax(
+                                                 talloc_tos(),
                                                  cmd_entry->interface)));
                                return ntresult;
                        }
@@ -963,10 +969,31 @@ out_free:
                binding->transport = NCACN_NP;
        }
 
+       if (binding->flags & DCERPC_SIGN) {
+               pipe_default_auth_level = DCERPC_AUTH_LEVEL_INTEGRITY;
+               pipe_default_auth_type = PIPE_AUTH_TYPE_NTLMSSP;
+       }
+       if (binding->flags & DCERPC_SEAL) {
+               pipe_default_auth_level = DCERPC_AUTH_LEVEL_PRIVACY;
+               pipe_default_auth_type = PIPE_AUTH_TYPE_NTLMSSP;
+       }
+       if (binding->flags & DCERPC_AUTH_SPNEGO) {
+               pipe_default_auth_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP;
+       }
+       if (binding->flags & DCERPC_AUTH_NTLM) {
+               pipe_default_auth_type = PIPE_AUTH_TYPE_NTLMSSP;
+       }
+       if (binding->flags & DCERPC_AUTH_KRB5) {
+               pipe_default_auth_type = PIPE_AUTH_TYPE_SPNEGO_KRB5;
+       }
+
        if (get_cmdline_auth_info_use_kerberos(rpcclient_auth_info)) {
                flags |= CLI_FULL_CONNECTION_USE_KERBEROS |
                         CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
        }
+       if (get_cmdline_auth_info_use_ccache(rpcclient_auth_info)) {
+               flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+       }
 
        user = talloc_strdup(frame, get_cmdline_auth_info_username(rpcclient_auth_info));
        SMB_ASSERT(user != NULL);