s3: Remove unused "retry" from cli_full_connection
[nivanova/samba-autobuild/.git] / source3 / utils / net_util.c
index 3560a9bd3b9741b3b3744d21e75ed260bcbd5a73..2f031c412386f9d2b777f4d652aca481c410d800 100644 (file)
 #include "includes.h"
 #include "utils/net.h"
 #include "../librpc/gen_ndr/cli_lsa.h"
+#include "rpc_client/cli_lsarpc.h"
 #include "../librpc/gen_ndr/cli_dssetup.h"
+#include "secrets.h"
+#include "../libcli/security/security.h"
 
 NTSTATUS net_rpc_lookup_name(struct net_context *c,
                             TALLOC_CTX *mem_ctx, struct cli_state *cli,
                             const char *name, const char **ret_domain,
-                            const char **ret_name, DOM_SID *ret_sid,
+                            const char **ret_name, struct dom_sid *ret_sid,
                             enum lsa_SidType *ret_type)
 {
        struct rpc_pipe_client *lsa_pipe = NULL;
        struct policy_handle pol;
        NTSTATUS result = NT_STATUS_OK;
        const char **dom_names;
-       DOM_SID *sids;
+       struct dom_sid *sids;
        enum lsa_SidType *types;
 
        ZERO_STRUCT(pol);
@@ -50,8 +53,8 @@ NTSTATUS net_rpc_lookup_name(struct net_context *c,
                                        SEC_FLAG_MAXIMUM_ALLOWED,
                                        &pol);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "open_policy ",_("failed"),": %s\n"),
-                         nt_errstr(result);
+               d_fprintf(stderr, "open_policy %s: %s\n", _("failed"),
+                         nt_errstr(result));
                return result;
        }
 
@@ -109,11 +112,15 @@ NTSTATUS connect_to_service(struct net_context *c,
                flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
        }
 
+       if (c->opt_ccache) {
+               flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+       }
+
        nt_status = cli_full_connection(cli_ctx, NULL, server_name,
                                        server_ss, c->opt_port,
                                        service_name, service_type,
                                        c->opt_user_name, c->opt_workgroup,
-                                       c->opt_password, flags, Undefined, NULL);
+                                       c->opt_password, flags, Undefined);
        if (!NT_STATUS_IS_OK(nt_status)) {
                d_fprintf(stderr, _("Could not connect to server %s\n"),
                          server_name);
@@ -197,7 +204,7 @@ NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
                                        server_name, server_ss, c->opt_port,
                                        "IPC$", "IPC",
                                        "", "",
-                                       "", 0, Undefined, NULL);
+                                       "", 0, Undefined);
 
        if (NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
@@ -257,7 +264,7 @@ NTSTATUS connect_to_ipc_krb5(struct net_context *c,
                                        user_and_realm, c->opt_workgroup,
                                        c->opt_password,
                                        CLI_FULL_CONNECTION_USE_KERBEROS,
-                                       Undefined, NULL);
+                                       Undefined);
 
        SAFE_FREE(user_and_realm);