s3: Remove unused "retry" from cli_full_connection
[nivanova/samba-autobuild/.git] / source3 / utils / net_util.c
index eaa2125e34f7a58242828d9861d1b9d6dfa70936..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);
@@ -48,7 +53,7 @@ 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"),
+               d_fprintf(stderr, "open_policy %s: %s\n", _("failed"),
                          nt_errstr(result));
                return result;
        }
@@ -107,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);
@@ -195,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;
@@ -255,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);
 
@@ -581,13 +590,13 @@ int net_run_function(struct net_context *c, int argc, const char **argv,
                d_fprintf(stderr, _("Invalid command: %s %s\n"), whoami,
                          (argc > 0)?argv[0]:"");
        }
-       d_printf("Usage:\n");
+       d_printf(_("Usage:\n"));
        for (i=0; table[i].funcname != NULL; i++) {
                if(c->display_usage == false)
                        d_printf("%s %-15s %s\n", whoami, table[i].funcname,
-                                table[i].description);
+                                _(table[i].description));
                else
-                       d_printf("%s\n", table[i].usage);
+                       d_printf("%s\n", _(table[i].usage));
        }
 
        return c->display_usage?0:-1;
@@ -597,7 +606,7 @@ void net_display_usage_from_functable(struct functable *table)
 {
        int i;
        for (i=0; table[i].funcname != NULL; i++) {
-               d_printf("%s\n", table[i].usage);
+               d_printf("%s\n", _(table[i].usage));
        }
 }