ѕ3: fix domain trust documentation confusion
[ira/wip.git] / source3 / utils / net_rpc.c
index c584b54e9e90a7a06d788fc8d980b279e667d689..c3d002c1b104c8675800bdabeb2dd0e8de602267 100644 (file)
 
 #include "includes.h"
 #include "utils/net.h"
+#include "../libcli/auth/libcli_auth.h"
 
 static int net_mode_share;
 static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
 
-extern const char *share_type[];
-
 /**
  * @file net_rpc.c
  *
@@ -56,23 +55,23 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                                   DOM_SID **domain_sid,
                                   const char **domain_name)
 {
-       struct rpc_pipe_client *lsa_pipe;
-       POLICY_HND pol;
+       struct rpc_pipe_client *lsa_pipe = NULL;
+       struct policy_handle pol;
        NTSTATUS result = NT_STATUS_OK;
        union lsa_PolicyInformation *info = NULL;
 
        result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
                                          &lsa_pipe);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not initialise lsa pipe\n");
+               d_fprintf(stderr, _("Could not initialise lsa pipe\n"));
                return result;
        }
 
        result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, false,
-                                    SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                    SEC_FLAG_MAXIMUM_ALLOWED,
                                     &pol);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "open_policy failed: %s\n",
+               d_fprintf(stderr, _("open_policy failed: %s\n"),
                          nt_errstr(result));
                return result;
        }
@@ -82,7 +81,7 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                                            LSA_POLICY_INFO_ACCOUNT_DOMAIN,
                                            &info);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "lsaquery failed: %s\n",
+               d_fprintf(stderr, _("lsaquery failed: %s\n"),
                          nt_errstr(result));
                return result;
        }
@@ -122,6 +121,7 @@ int run_rpc_command(struct net_context *c,
        NTSTATUS nt_status;
        DOM_SID *domain_sid;
        const char *domain_name;
+       int ret = -1;
 
        /* make use of cli_state handed over as an argument, if possible */
        if (!cli_arg) {
@@ -143,15 +143,13 @@ int run_rpc_command(struct net_context *c,
 
        if (!(mem_ctx = talloc_init("run_rpc_command"))) {
                DEBUG(0, ("talloc_init() failed\n"));
-               cli_shutdown(cli);
-               return -1;
+               goto fail;
        }
 
        nt_status = net_get_remote_domain_sid(cli, mem_ctx, &domain_sid,
                                              &domain_name);
        if (!NT_STATUS_IS_OK(nt_status)) {
-               cli_shutdown(cli);
-               return -1;
+               goto fail;
        }
 
        if (!(conn_flags & NET_FLAGS_NO_PIPE)) {
@@ -160,20 +158,21 @@ int run_rpc_command(struct net_context *c,
                                            &ndr_table_netlogon.syntax_id))) {
                        /* Always try and create an schannel netlogon pipe. */
                        nt_status = cli_rpc_pipe_open_schannel(
-                               cli, interface,
-                               PIPE_AUTH_LEVEL_PRIVACY, domain_name,
+                               cli, interface, NCACN_NP,
+                               DCERPC_AUTH_LEVEL_PRIVACY, domain_name,
                                &pipe_hnd);
                        if (!NT_STATUS_IS_OK(nt_status)) {
                                DEBUG(0, ("Could not initialise schannel netlogon pipe. Error was %s\n",
                                        nt_errstr(nt_status) ));
-                               cli_shutdown(cli);
-                               return -1;
+                               goto fail;
                        }
                } else {
                        if (conn_flags & NET_FLAGS_SEAL) {
                                nt_status = cli_rpc_pipe_open_ntlmssp(
                                        cli, interface,
-                                       PIPE_AUTH_LEVEL_PRIVACY,
+                                       (conn_flags & NET_FLAGS_TCP) ?
+                                       NCACN_IP_TCP : NCACN_NP,
+                                       DCERPC_AUTH_LEVEL_PRIVACY,
                                        lp_workgroup(), c->opt_user_name,
                                        c->opt_password, &pipe_hnd);
                        } else {
@@ -183,11 +182,9 @@ int run_rpc_command(struct net_context *c,
                        }
                        if (!NT_STATUS_IS_OK(nt_status)) {
                                DEBUG(0, ("Could not initialise pipe %s. Error was %s\n",
-                                       cli_get_pipe_name_from_iface(
-                                               debug_ctx(), cli, interface),
+                                       get_pipe_name_from_iface(interface),
                                        nt_errstr(nt_status) ));
-                               cli_shutdown(cli);
-                               return -1;
+                               goto fail;
                        }
                }
        }
@@ -197,6 +194,7 @@ int run_rpc_command(struct net_context *c,
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(1, ("rpc command function failed! (%s)\n", nt_errstr(nt_status)));
        } else {
+               ret = 0;
                DEBUG(5, ("rpc command function succedded\n"));
        }
 
@@ -206,13 +204,14 @@ int run_rpc_command(struct net_context *c,
                }
        }
 
+fail:
        /* close the connection only if it was opened here */
        if (!cli_arg) {
                cli_shutdown(cli);
        }
 
        talloc_destroy(mem_ctx);
-       return (!NT_STATUS_IS_OK(nt_status));
+       return ret;
 }
 
 /**
@@ -240,8 +239,16 @@ static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
+       NTSTATUS status;
+
+       status = trust_pw_find_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, _("Failed to change machine account password: %s\n"),
+                       nt_errstr(status));
+               return status;
+       }
 
-       return trust_pw_find_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup);
+       return NT_STATUS_OK;
 }
 
 /**
@@ -257,9 +264,9 @@ static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
 int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc changetrustpw\n"
-                        "    Change the machine trust password\n");
+               d_printf(_("Usage:\n"
+                          "net rpc changetrustpw\n"
+                          "    Change the machine trust password\n"));
                return 0;
        }
 
@@ -341,7 +348,7 @@ static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
                                              sec_channel_type);
 
        if (NT_STATUS_IS_OK(result))
-               printf("Joined domain %s.\n", c->opt_target_workgroup);
+               printf(_("Joined domain %s.\n"), c->opt_target_workgroup);
 
 
        if (!secrets_store_domain_sid(c->opt_target_workgroup, domain_sid)) {
@@ -387,16 +394,16 @@ static int net_rpc_oldjoin(struct net_context *c, int argc, const char **argv)
        int rc = -1;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc oldjoin\n"
-                        "    Join a domain the old way\n");
+               d_printf(_("Usage:\n"
+                          "net rpc oldjoin\n"
+                          "    Join a domain the old way\n"));
                return 0;
        }
 
        rc = net_rpc_perform_oldjoin(c, argc, argv);
 
        if (rc) {
-               d_fprintf(stderr, "Failed to join domain\n");
+               d_fprintf(stderr, _("Failed to join domain\n"));
        }
 
        return rc;
@@ -417,27 +424,27 @@ static int net_rpc_oldjoin(struct net_context *c, int argc, const char **argv)
 int net_rpc_join(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc join -U <username>[%%password] <type>\n"
-                        "  Join a domain\n"
-                        "    username\tName of the admin user"
-                        "    password\tPassword of the admin user, will "
-                        "prompt if not specified\n"
-                        "    type\tCan be one of the following:\n"
-                        "\t\tMEMBER\tJoin as member server (default)\n"
-                        "\t\tBDC\tJoin as BDC\n"
-                        "\t\tPDC\tJoin as PDC\n");
+               d_printf(_("Usage:\n"
+                          "net rpc join -U <username>[%%password] <type>\n"
+                          "  Join a domain\n"
+                          "    username\tName of the admin user"
+                          "    password\tPassword of the admin user, will "
+                          "prompt if not specified\n"
+                          "    type\tCan be one of the following:\n"
+                          "\t\tMEMBER\tJoin as member server (default)\n"
+                          "\t\tBDC\tJoin as BDC\n"
+                          "\t\tPDC\tJoin as PDC\n"));
                return 0;
        }
 
        if (lp_server_role() == ROLE_STANDALONE) {
-               d_printf("cannot join as standalone machine\n");
+               d_printf(_("cannot join as standalone machine\n"));
                return -1;
        }
 
        if (strlen(global_myname()) > 15) {
-               d_printf("Our netbios name can be at most 15 chars long, "
-                        "\"%s\" is %u chars long\n",
+               d_printf(_("Our netbios name can be at most 15 chars long, "
+                          "\"%s\" is %u chars long\n"),
                         global_myname(), (unsigned int)strlen(global_myname()));
                return -1;
        }
@@ -473,7 +480,7 @@ NTSTATUS rpc_info_internals(struct net_context *c,
                        int argc,
                        const char **argv)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        union samr_DomainInfo *info = NULL;
        fstring sid_str;
@@ -486,7 +493,8 @@ NTSTATUS rpc_info_internals(struct net_context *c,
                                      MAXIMUM_ALLOWED_ACCESS,
                                      &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not connect to SAM: %s\n", nt_errstr(result));
+               d_fprintf(stderr, _("Could not connect to SAM: %s\n"),
+                         nt_errstr(result));
                goto done;
        }
 
@@ -497,7 +505,8 @@ NTSTATUS rpc_info_internals(struct net_context *c,
                                        CONST_DISCARD(struct dom_sid2 *, domain_sid),
                                        &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not open domain: %s\n", nt_errstr(result));
+               d_fprintf(stderr, _("Could not open domain: %s\n"),
+                         nt_errstr(result));
                goto done;
        }
 
@@ -506,13 +515,14 @@ NTSTATUS rpc_info_internals(struct net_context *c,
                                             2,
                                             &info);
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("Domain Name: %s\n", info->info2.domain_name.string);
-               d_printf("Domain SID: %s\n", sid_str);
-               d_printf("Sequence number: %llu\n",
-                       (unsigned long long)info->info2.sequence_num);
-               d_printf("Num users: %u\n", info->info2.num_users);
-               d_printf("Num domain groups: %u\n", info->info2.num_groups);
-               d_printf("Num local groups: %u\n", info->info2.num_aliases);
+               d_printf(_("Domain Name: %s\n"),
+                        info->general.domain_name.string);
+               d_printf(_("Domain SID: %s\n"), sid_str);
+               d_printf(_("Sequence number: %llu\n"),
+                       (unsigned long long)info->general.sequence_num);
+               d_printf(_("Num users: %u\n"), info->general.num_users);
+               d_printf(_("Num domain groups: %u\n"),info->general.num_groups);
+               d_printf(_("Num local groups: %u\n"),info->general.num_aliases);
        }
 
  done:
@@ -529,9 +539,9 @@ NTSTATUS rpc_info_internals(struct net_context *c,
 int net_rpc_info(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc info\n"
-                        "  Display information about the domain\n");
+               d_printf(_("Usage:\n"
+                          "net rpc info\n"
+                          "  Display information about the domain\n"));
                return 0;
        }
 
@@ -568,7 +578,7 @@ static NTSTATUS rpc_getsid_internals(struct net_context *c,
        fstring sid_str;
 
        sid_to_fstring(sid_str, domain_sid);
-       d_printf("Storing SID %s for Domain %s in secrets.tdb\n",
+       d_printf(_("Storing SID %s for Domain %s in secrets.tdb\n"),
                 sid_str, domain_name);
 
        if (!secrets_store_domain_sid(domain_name, domain_sid)) {
@@ -589,9 +599,9 @@ static NTSTATUS rpc_getsid_internals(struct net_context *c,
 int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc getsid\n"
-                        "    Fetch domain SID into local secrets.tdb\n");
+               d_printf(_("Usage:\n"
+                          "net rpc getsid\n"
+                          "    Fetch domain SID into local secrets.tdb\n"));
                return 0;
        }
 
@@ -646,12 +656,12 @@ static int rpc_user_add(struct net_context *c, int argc, const char **argv)
        status = NetUserAdd(c->opt_host, 1, (uint8_t *)&info1, &parm_error);
 
        if (status != 0) {
-               d_fprintf(stderr, "Failed to add user '%s' with: %s.\n",
+               d_fprintf(stderr,_("Failed to add user '%s' with error: %s.\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                                                            status));
                return -1;
        } else {
-               d_printf("Added user '%s'.\n", argv[0]);
+               d_printf(_("Added user '%s'.\n"), argv[0]);
        }
 
        return 0;
@@ -683,11 +693,12 @@ static int rpc_user_rename(struct net_context *c, int argc, const char **argv)
        status = NetUserSetInfo(c->opt_host, argv[0],
                                0, (uint8_t *)&u0, &parm_err);
        if (status) {
-               d_fprintf(stderr, "Failed to rename user from %s to %s - %s\n",
+               d_fprintf(stderr,
+                         _("Failed to rename user from %s to %s - %s\n"),
                          argv[0], argv[1],
                          libnetapi_get_error_string(c->netapi_ctx, status));
        } else {
-               d_printf("Renamed user from %s to %s\n", argv[0], argv[1]);
+               d_printf(_("Renamed user from %s to %s\n"), argv[0], argv[1]);
        }
 
        return status;
@@ -715,12 +726,12 @@ static int rpc_user_delete(struct net_context *c, int argc, const char **argv)
        status = NetUserDel(c->opt_host, argv[0]);
 
        if (status != 0) {
-                d_fprintf(stderr, "Failed to delete user '%s' with: %s.\n",
+                d_fprintf(stderr, _("Failed to delete user '%s' with: %s.\n"),
                          argv[0],
                          libnetapi_get_error_string(c->netapi_ctx, status));
                return -1;
         } else {
-                d_printf("Deleted user '%s'.\n", argv[0]);
+                d_printf(_("Deleted user '%s'.\n"), argv[0]);
         }
 
        return 0;
@@ -742,6 +753,7 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
        char *prompt = NULL;
        struct USER_INFO_1003 u1003;
        uint32_t parm_err = 0;
+       int ret;
 
        if (argc < 1 || c->display_usage) {
                rpc_user_usage(c, argc, argv);
@@ -751,7 +763,11 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
        if (argv[1]) {
                u1003.usri1003_password = argv[1];
        } else {
-               asprintf(&prompt, "Enter new password for %s:", argv[0]);
+               ret = asprintf(&prompt, _("Enter new password for %s:"),
+                              argv[0]);
+               if (ret == -1) {
+                       return -1;
+               }
                u1003.usri1003_password = getpass(prompt);
                SAFE_FREE(prompt);
        }
@@ -760,7 +776,8 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
 
        /* Display results */
        if (status != 0) {
-               d_fprintf(stderr, "Failed to set password for '%s' with: %s.\n",
+               d_fprintf(stderr,
+                       _("Failed to set password for '%s' with error: %s.\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                                                            status));
                return -1;
@@ -797,12 +814,13 @@ static int rpc_user_info(struct net_context *c, int argc, const char **argv)
        status = NetUserGetGroups(c->opt_host,
                                  argv[0],
                                  0,
-                                 (uint8_t **)&u0,
+                                 (uint8_t **)(void *)&u0,
                                  (uint32_t)-1,
                                  &entries_read,
                                  &total_entries);
        if (status != 0) {
-               d_fprintf(stderr, "Failed to get groups for '%s' with: %s.\n",
+               d_fprintf(stderr,
+                       _("Failed to get groups for '%s' with error: %s.\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                                                            status));
                return -1;
@@ -841,8 +859,8 @@ static int rpc_user_list(struct net_context *c, int argc, const char **argv)
 
        /* Query domain users */
        if (c->opt_long_list_entries)
-               d_printf("\nUser name             Comment"
-                        "\n-----------------------------\n");
+               d_printf(_("\nUser name             Comment"
+                          "\n-----------------------------\n"));
        do {
                uint32_t max_entries, max_size;
 
@@ -898,41 +916,41 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv)
                        "add",
                        rpc_user_add,
                        NET_TRANSPORT_RPC,
-                       "Add specified user",
-                       "net rpc user add\n"
-                       "    Add specified user"
+                       N_("Add specified user"),
+                       N_("net rpc user add\n"
+                          "    Add specified user")
                },
                {
                        "info",
                        rpc_user_info,
                        NET_TRANSPORT_RPC,
-                       "List domain groups of user",
-                       "net rpc user info\n"
-                       "    Lis domain groups of user"
+                       N_("List domain groups of user"),
+                       N_("net rpc user info\n"
+                          "    Lis domain groups of user")
                },
                {
                        "delete",
                        rpc_user_delete,
                        NET_TRANSPORT_RPC,
-                       "Remove specified user",
-                       "net rpc user delete\n"
-                       "    Remove specified user"
+                       N_("Remove specified user"),
+                       N_("net rpc user delete\n"
+                          "    Remove specified user")
                },
                {
                        "password",
                        rpc_user_password,
                        NET_TRANSPORT_RPC,
-                       "Change user password",
-                       "net rpc user password\n"
-                       "    Change user password"
+                       N_("Change user password"),
+                       N_("net rpc user password\n"
+                          "    Change user password")
                },
                {
                        "rename",
                        rpc_user_rename,
                        NET_TRANSPORT_RPC,
-                       "Rename specified user",
-                       "net rpc user rename\n"
-                       "    Rename specified user"
+                       N_("Rename specified user"),
+                       N_("net rpc user rename\n"
+                          "    Rename specified user")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -949,9 +967,9 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv)
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n");
-                       d_printf("net rpc user\n"
-                                "    List all users\n");
+                       d_printf(_("Usage:\n"));
+                       d_printf(_("net rpc user\n"
+                                  "    List all users\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
@@ -990,17 +1008,17 @@ static NTSTATUS rpc_sh_handle_user(struct net_context *c,
                                           TALLOC_CTX *mem_ctx,
                                           struct rpc_sh_ctx *ctx,
                                           struct rpc_pipe_client *pipe_hnd,
-                                          POLICY_HND *user_hnd,
+                                          struct policy_handle *user_hnd,
                                           int argc, const char **argv))
 {
-       POLICY_HND connect_pol, domain_pol, user_pol;
+       struct policy_handle connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        DOM_SID sid;
        uint32 rid;
        enum lsa_SidType type;
 
        if (argc == 0) {
-               d_fprintf(stderr, "usage: %s <username>\n", ctx->whoami);
+               d_fprintf(stderr, _("usage: %s <username>\n"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1011,20 +1029,20 @@ static NTSTATUS rpc_sh_handle_user(struct net_context *c,
        result = net_rpc_lookup_name(c, mem_ctx, rpc_pipe_np_smb_conn(pipe_hnd),
                                     argv[0], NULL, NULL, &sid, &type);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not lookup %s: %s\n", argv[0],
+               d_fprintf(stderr, _("Could not lookup %s: %s\n"), argv[0],
                          nt_errstr(result));
                goto done;
        }
 
        if (type != SID_NAME_USER) {
-               d_fprintf(stderr, "%s is a %s, not a user\n", argv[0],
+               d_fprintf(stderr, _("%s is a %s, not a user\n"), argv[0],
                          sid_type_lookup(type));
                result = NT_STATUS_NO_SUCH_USER;
                goto done;
        }
 
        if (!sid_peek_check_rid(ctx->domain_sid, &sid, &rid)) {
-               d_fprintf(stderr, "%s is not in our domain\n", argv[0]);
+               d_fprintf(stderr, _("%s is not in our domain\n"), argv[0]);
                result = NT_STATUS_NO_SUCH_USER;
                goto done;
        }
@@ -1074,14 +1092,14 @@ static NTSTATUS rpc_sh_user_show_internals(struct net_context *c,
                                           TALLOC_CTX *mem_ctx,
                                           struct rpc_sh_ctx *ctx,
                                           struct rpc_pipe_client *pipe_hnd,
-                                          POLICY_HND *user_hnd,
+                                          struct policy_handle *user_hnd,
                                           int argc, const char **argv)
 {
        NTSTATUS result;
        union samr_UserInfo *info = NULL;
 
        if (argc != 0) {
-               d_fprintf(stderr, "usage: %s show <username>\n", ctx->whoami);
+               d_fprintf(stderr, _("usage: %s show <username>\n"),ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1093,7 +1111,7 @@ static NTSTATUS rpc_sh_user_show_internals(struct net_context *c,
                return result;
        }
 
-       d_printf("user rid: %d, group rid: %d\n",
+       d_printf(_("user rid: %d, group rid: %d\n"),
                info->info21.rid,
                info->info21.primary_gid);
 
@@ -1125,7 +1143,7 @@ static NTSTATUS rpc_sh_user_str_edit_internals(struct net_context *c,
                                               TALLOC_CTX *mem_ctx,
                                               struct rpc_sh_ctx *ctx,
                                               struct rpc_pipe_client *pipe_hnd,
-                                              POLICY_HND *user_hnd,
+                                              struct policy_handle *user_hnd,
                                               int argc, const char **argv)
 {
        NTSTATUS result;
@@ -1134,7 +1152,7 @@ static NTSTATUS rpc_sh_user_str_edit_internals(struct net_context *c,
        union samr_UserInfo *info = NULL;
 
        if (argc > 1) {
-               d_fprintf(stderr, "usage: %s <username> [new value|NULL]\n",
+               d_fprintf(stderr, _("usage: %s <username> [new value|NULL]\n"),
                          ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -1157,7 +1175,7 @@ static NTSTATUS rpc_sh_user_str_edit_internals(struct net_context *c,
        FETCHSTR("description", description);
 
        if (argc == 0) {
-               d_printf("%s's %s: [%s]\n", username, ctx->thiscmd, oldval);
+               d_printf(_("%s's %s: [%s]\n"), username, ctx->thiscmd, oldval);
                goto done;
        }
 
@@ -1179,7 +1197,7 @@ static NTSTATUS rpc_sh_user_str_edit_internals(struct net_context *c,
                                         21,
                                         info);
 
-       d_printf("Set %s's %s from [%s] to [%s]\n", username,
+       d_printf(_("Set %s's %s from [%s] to [%s]\n"), username,
                 ctx->thiscmd, oldval, argv[0]);
 
  done:
@@ -1210,7 +1228,7 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(struct net_context *c,
                                                TALLOC_CTX *mem_ctx,
                                                struct rpc_sh_ctx *ctx,
                                                struct rpc_pipe_client *pipe_hnd,
-                                               POLICY_HND *user_hnd,
+                                               struct policy_handle *user_hnd,
                                                int argc, const char **argv)
 {
        NTSTATUS result;
@@ -1223,7 +1241,9 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(struct net_context *c,
        if ((argc > 1) ||
            ((argc == 1) && !strequal(argv[0], "yes") &&
             !strequal(argv[0], "no"))) {
-               d_fprintf(stderr, "usage: %s <username> [yes|no]\n",
+               /* TRANSATORS: The yes|no here are program keywords. Please do
+                  not translate. */
+               d_fprintf(stderr, _("usage: %s <username> [yes|no]\n"),
                          ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -1248,7 +1268,8 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(struct net_context *c,
        HANDLEFLG("pwnoexp", PWNOEXP);
 
        if (argc == 0) {
-               d_printf("%s's %s flag: %s\n", username, ctx->thiscmd, oldval);
+               d_printf(_("%s's %s flag: %s\n"), username, ctx->thiscmd,
+                        oldval);
                goto done;
        }
 
@@ -1263,7 +1284,7 @@ static NTSTATUS rpc_sh_user_flag_edit_internals(struct net_context *c,
                                         info);
 
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("Set %s's %s flag from [%s] to [%s]\n", username,
+               d_printf(_("Set %s's %s flag from [%s] to [%s]\n"), username,
                         ctx->thiscmd, oldval, argv[0]);
        }
 
@@ -1289,34 +1310,34 @@ struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c,
        static struct rpc_sh_cmd cmds[] = {
 
                { "fullname", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's full name" },
+                 N_("Show/Set a user's full name") },
 
                { "homedir", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's home directory" },
+                 N_("Show/Set a user's home directory") },
 
                { "homedrive", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's home drive" },
+                 N_("Show/Set a user's home drive") },
 
                { "logonscript", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's logon script" },
+                 N_("Show/Set a user's logon script") },
 
                { "profilepath", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's profile path" },
+                 N_("Show/Set a user's profile path") },
 
                { "description", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit,
-                 "Show/Set a user's description" },
+                 N_("Show/Set a user's description") },
 
                { "disabled", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit,
-                 "Show/Set whether a user is disabled" },
+                 N_("Show/Set whether a user is disabled") },
 
                { "autolock", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit,
-                 "Show/Set whether a user locked out" },
+                 N_("Show/Set whether a user locked out") },
 
                { "pwnotreq", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit,
-                 "Show/Set whether a user does not need a password" },
+                 N_("Show/Set whether a user does not need a password") },
 
                { "pwnoexp", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit,
-                 "Show/Set whether a user's password does not expire" },
+                 N_("Show/Set whether a user's password does not expire") },
 
                { NULL, NULL, 0, NULL, NULL }
        };
@@ -1331,16 +1352,16 @@ struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c,
        static struct rpc_sh_cmd cmds[] = {
 
                { "list", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_list,
-                 "List available users" },
+                 N_("List available users") },
 
                { "info", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_info,
-                 "List the domain groups a user is member of" },
+                 N_("List the domain groups a user is member of") },
 
                { "show", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_show,
-                 "Show info about a user" },
+                 N_("Show info about a user") },
 
                { "edit", net_rpc_user_edit_cmds, 0, NULL,
-                 "Show/Modify a user's fields" },
+                 N_("Show/Modify a user's fields") },
 
                { NULL, NULL, 0, NULL, NULL }
        };
@@ -1387,14 +1408,14 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
-       POLICY_HND connect_pol, domain_pol, group_pol, user_pol;
+       struct policy_handle connect_pol, domain_pol, group_pol, user_pol;
        bool group_is_primary = false;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32_t group_rid;
        struct samr_RidTypeArray *rids = NULL;
        /* char **names; */
        int i;
-       /* DOM_GID *user_gids; */
+       /* struct samr_RidWithAttribute *user_gids; */
 
        struct samr_Ids group_rids, name_types;
        struct lsa_String lsa_acct_name;
@@ -1411,7 +1432,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                      &connect_pol);
 
         if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Request samr_Connect2 failed\n");
+               d_fprintf(stderr, _("Request samr_Connect2 failed\n"));
                goto done;
         }
 
@@ -1422,7 +1443,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                        &domain_pol);
 
         if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Request open_domain failed\n");
+               d_fprintf(stderr, _("Request open_domain failed\n"));
                goto done;
         }
 
@@ -1435,7 +1456,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                         &group_rids,
                                         &name_types);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Lookup of '%s' failed\n",argv[0]);
+               d_fprintf(stderr, _("Lookup of '%s' failed\n"),argv[0]);
                goto done;
        }
 
@@ -1448,7 +1469,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                               group_rids.ids[0],
                                               &group_pol);
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Request open_group failed");
+                       d_fprintf(stderr, _("Request open_group failed"));
                        goto done;
                }
 
@@ -1459,12 +1480,15 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                                      &rids);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Unable to query group members of %s",argv[0]);
+                       d_fprintf(stderr,
+                                 _("Unable to query group members of %s"),
+                                 argv[0]);
                        goto done;
                }
 
                if (c->opt_verbose) {
-                       d_printf("Domain Group %s (rid: %d) has %d members\n",
+                       d_printf(
+                               _("Domain Group %s (rid: %d) has %d members\n"),
                                argv[0],group_rid, rids->count);
                }
 
@@ -1478,7 +1502,8 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                                      &user_pol);
 
                        if (!NT_STATUS_IS_OK(result)) {
-                               d_fprintf(stderr, "Unable to open group member %d\n",
+                               d_fprintf(stderr,
+                                       _("Unable to open group member %d\n"),
                                        rids->rids[i]);
                                goto done;
                        }
@@ -1489,14 +1514,17 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                                           &info);
 
                        if (!NT_STATUS_IS_OK(result)) {
-                               d_fprintf(stderr, "Unable to lookup userinfo for group member %d\n",
+                               d_fprintf(stderr,
+                                       _("Unable to lookup userinfo for group "
+                                         "member %d\n"),
                                        rids->rids[i]);
                                goto done;
                        }
 
                        if (info->info21.primary_gid == group_rid) {
                                if (c->opt_verbose) {
-                                       d_printf("Group is primary group of %s\n",
+                                       d_printf(_("Group is primary group "
+                                                  "of %s\n"),
                                                info->info21.account_name.string);
                                }
                                group_is_primary = true;
@@ -1506,8 +1534,9 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                }
 
                if (group_is_primary) {
-                       d_fprintf(stderr, "Unable to delete group because some "
-                                "of it's members have it as primary group\n");
+                       d_fprintf(stderr, _("Unable to delete group because "
+                                "some of it's members have it as primary "
+                                "group\n"));
                        result = NT_STATUS_MEMBERS_PRIMARY_GROUP;
                        goto done;
                }
@@ -1516,7 +1545,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                for (i = 0; i < rids->count; i++)
                {
                        if (c->opt_verbose)
-                               d_printf("Remove group member %d...",
+                               d_printf(_("Remove group member %d..."),
                                        rids->rids[i]);
                        result = rpccli_samr_DeleteGroupMember(pipe_hnd, mem_ctx,
                                                               &group_pol,
@@ -1524,10 +1553,10 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
 
                        if (NT_STATUS_IS_OK(result)) {
                                if (c->opt_verbose)
-                                       d_printf("ok\n");
+                                       d_printf(_("ok\n"));
                        } else {
                                if (c->opt_verbose)
-                                       d_printf("failed\n");
+                                       d_printf(_("failed\n"));
                                goto done;
                        }
                }
@@ -1545,7 +1574,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                               &group_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Request open_alias failed\n");
+                       d_fprintf(stderr, _("Request open_alias failed\n"));
                        goto done;
                }
 
@@ -1553,7 +1582,8 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
                                                    &group_pol);
                break;
        default:
-               d_fprintf(stderr, "%s is of type %s. This command is only for deleting local or global groups\n",
+               d_fprintf(stderr, _("%s is of type %s. This command is only "
+                                   "for deleting local or global groups\n"),
                        argv[0],sid_type_lookup(name_types.ids[0]));
                result = NT_STATUS_UNSUCCESSFUL;
                goto done;
@@ -1561,9 +1591,10 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c,
 
        if (NT_STATUS_IS_OK(result)) {
                if (c->opt_verbose)
-                       d_printf("Deleted %s '%s'\n",sid_type_lookup(name_types.ids[0]),argv[0]);
+                       d_printf(_("Deleted %s '%s'\n"),
+                                sid_type_lookup(name_types.ids[0]), argv[0]);
        } else {
-               d_fprintf(stderr, "Deleting of %s failed: %s\n",argv[0],
+               d_fprintf(stderr, _("Deleting of %s failed: %s\n"), argv[0],
                        get_friendly_nt_error_msg(result));
        }
 
@@ -1599,12 +1630,13 @@ static int rpc_group_add_internals(struct net_context *c, int argc, const char *
        status = NetGroupAdd(c->opt_host, 1, (uint8_t *)&info1, &parm_error);
 
        if (status != 0) {
-               d_fprintf(stderr, "Failed to add group '%s' with: %s.\n",
+               d_fprintf(stderr,
+                       _("Failed to add group '%s' with error: %s.\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                                                            status));
                return -1;
        } else {
-               d_printf("Added group '%s'.\n", argv[0]);
+               d_printf(_("Added group '%s'.\n"), argv[0]);
        }
 
        return 0;
@@ -1631,12 +1663,13 @@ static int rpc_alias_add_internals(struct net_context *c, int argc, const char *
        status = NetLocalGroupAdd(c->opt_host, 1, (uint8_t *)&info1, &parm_error);
 
        if (status != 0) {
-               d_fprintf(stderr, "Failed to add alias '%s' with: %s.\n",
+               d_fprintf(stderr,
+                       _("Failed to add alias '%s' with error: %s.\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                                                            status));
                return -1;
        } else {
-               d_printf("Added alias '%s'.\n", argv[0]);
+               d_printf(_("Added alias '%s'.\n"), argv[0]);
        }
 
        return 0;
@@ -1658,8 +1691,8 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
 {
        DOM_SID *sids = NULL;
        enum lsa_SidType *types = NULL;
-       struct rpc_pipe_client *pipe_hnd;
-       POLICY_HND lsa_pol;
+       struct rpc_pipe_client *pipe_hnd = NULL;
+       struct policy_handle lsa_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 
        result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
@@ -1669,7 +1702,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
        }
 
        result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, false,
-                                    SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol);
+                                    SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -1711,10 +1744,10 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
                                const DOM_SID *group_sid,
                                const char *member)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result;
        uint32 group_rid;
-       POLICY_HND group_pol;
+       struct policy_handle group_pol;
 
        struct samr_Ids rids, rid_types;
        struct lsa_String lsa_acct_name;
@@ -1756,7 +1789,8 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
                                         &rid_types);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not lookup up group member %s\n", member);
+               d_fprintf(stderr, _("Could not lookup up group member %s\n"),
+                         member);
                goto done;
        }
 
@@ -1785,10 +1819,10 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                const DOM_SID *alias_sid,
                                const char *member)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result;
        uint32 alias_rid;
-       POLICY_HND alias_pol;
+       struct policy_handle alias_pol;
 
        DOM_SID member_sid;
        enum lsa_SidType member_type;
@@ -1805,7 +1839,8 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                   member, &member_sid, &member_type);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not lookup up group member %s\n", member);
+               d_fprintf(stderr, _("Could not lookup up group member %s\n"),
+                         member);
                return result;
        }
 
@@ -1864,17 +1899,18 @@ static NTSTATUS rpc_group_addmem_internals(struct net_context *c,
        enum lsa_SidType group_type;
 
        if (argc != 2 || c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc group addmem <group> <member>\n"
-                        "  Add a member to a group\n"
-                        "    group\tGroup to add member to\n"
-                        "    member\tMember to add to group\n");
+               d_printf(_("Usage:\n"
+                          "net rpc group addmem <group> <member>\n"
+                          "  Add a member to a group\n"
+                          "    group\tGroup to add member to\n"
+                          "    member\tMember to add to group\n"));
                return NT_STATUS_UNSUCCESSFUL;
        }
 
        if (!NT_STATUS_IS_OK(get_sid_from_name(cli, mem_ctx, argv[0],
                                               &group_sid, &group_type))) {
-               d_fprintf(stderr, "Could not lookup group name %s\n", argv[0]);
+               d_fprintf(stderr, _("Could not lookup group name %s\n"),
+                         argv[0]);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -1883,7 +1919,7 @@ static NTSTATUS rpc_group_addmem_internals(struct net_context *c,
                                                   &group_sid, argv[1]);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Could not add %s to %s: %s\n",
+                       d_fprintf(stderr, _("Could not add %s to %s: %s\n"),
                                 argv[1], argv[0], nt_errstr(result));
                }
                return result;
@@ -1894,14 +1930,14 @@ static NTSTATUS rpc_group_addmem_internals(struct net_context *c,
                                                   &group_sid, argv[1]);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Could not add %s to %s: %s\n",
+                       d_fprintf(stderr, _("Could not add %s to %s: %s\n"),
                                 argv[1], argv[0], nt_errstr(result));
                }
                return result;
        }
 
-       d_fprintf(stderr, "Can only add members to global or local groups "
-                "which %s is not\n", argv[0]);
+       d_fprintf(stderr, _("Can only add members to global or local groups "
+                "which %s is not\n"), argv[0]);
 
        return NT_STATUS_UNSUCCESSFUL;
 }
@@ -1919,10 +1955,10 @@ static NTSTATUS rpc_del_groupmem(struct net_context *c,
                                const DOM_SID *group_sid,
                                const char *member)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result;
        uint32 group_rid;
-       POLICY_HND group_pol;
+       struct policy_handle group_pol;
 
        struct samr_Ids rids, rid_types;
        struct lsa_String lsa_acct_name;
@@ -1960,7 +1996,8 @@ static NTSTATUS rpc_del_groupmem(struct net_context *c,
                                         &rids,
                                         &rid_types);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not lookup up group member %s\n", member);
+               d_fprintf(stderr, _("Could not lookup up group member %s\n"),
+                         member);
                goto done;
        }
 
@@ -1987,10 +2024,10 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                const DOM_SID *alias_sid,
                                const char *member)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result;
        uint32 alias_rid;
-       POLICY_HND alias_pol;
+       struct policy_handle alias_pol;
 
        DOM_SID member_sid;
        enum lsa_SidType member_type;
@@ -2006,7 +2043,8 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                   member, &member_sid, &member_type);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Could not lookup up group member %s\n", member);
+               d_fprintf(stderr, _("Could not lookup up group member %s\n"),
+                         member);
                return result;
        }
 
@@ -2063,17 +2101,18 @@ static NTSTATUS rpc_group_delmem_internals(struct net_context *c,
        enum lsa_SidType group_type;
 
        if (argc != 2 || c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc group delmem <group> <member>\n"
-                        "  Delete a member from a group\n"
-                        "    group\tGroup to delete member from\n"
-                        "    member\tMember to delete from group\n");
+               d_printf(_("Usage:\n"
+                          "net rpc group delmem <group> <member>\n"
+                          "  Delete a member from a group\n"
+                          "    group\tGroup to delete member from\n"
+                          "    member\tMember to delete from group\n"));
                return NT_STATUS_UNSUCCESSFUL;
        }
 
        if (!NT_STATUS_IS_OK(get_sid_from_name(cli, mem_ctx, argv[0],
                                               &group_sid, &group_type))) {
-               d_fprintf(stderr, "Could not lookup group name %s\n", argv[0]);
+               d_fprintf(stderr, _("Could not lookup group name %s\n"),
+                         argv[0]);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -2082,7 +2121,7 @@ static NTSTATUS rpc_group_delmem_internals(struct net_context *c,
                                                   &group_sid, argv[1]);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Could not del %s from %s: %s\n",
+                       d_fprintf(stderr, _("Could not del %s from %s: %s\n"),
                                 argv[1], argv[0], nt_errstr(result));
                }
                return result;
@@ -2093,14 +2132,14 @@ static NTSTATUS rpc_group_delmem_internals(struct net_context *c,
                                                   &group_sid, argv[1]);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Could not del %s from %s: %s\n",
+                       d_fprintf(stderr, _("Could not del %s from %s: %s\n"),
                                 argv[1], argv[0], nt_errstr(result));
                }
                return result;
        }
 
-       d_fprintf(stderr, "Can only delete members from global or local groups "
-                "which %s is not\n", argv[0]);
+       d_fprintf(stderr, _("Can only delete members from global or local "
+                "groups which %s is not\n"), argv[0]);
 
        return NT_STATUS_UNSUCCESSFUL;
 }
@@ -2137,7 +2176,7 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32 start_idx=0, max_entries=250, num_entries, i, loop_count = 0;
        struct samr_SamArray *groups = NULL;
@@ -2146,14 +2185,15 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
        bool builtin = false;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc group list [global] [local] [builtin]\n"
-                        "  List groups on RPC server\n"
-                        "    global\tList global groups\n"
-                        "    local\tList local groups\n"
-                        "    builtin\tList builtin groups\n"
-                        "    If none of global, local or builtin is "
-                        "specified, all three options are considered set\n");
+               d_printf(_("Usage:\n"
+                          "net rpc group list [global] [local] [builtin]\n"
+                          "  List groups on RPC server\n"
+                          "    global\tList global groups\n"
+                          "    local\tList local groups\n"
+                          "    builtin\tList builtin groups\n"
+                          "    If none of global, local or builtin is "
+                          "specified, all three options are considered "
+                          "set\n"));
                return NT_STATUS_OK;
        }
 
@@ -2197,8 +2237,8 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
 
        /* Query domain groups */
        if (c->opt_long_list_entries)
-               d_printf("\nGroup name            Comment"
-                        "\n-----------------------------\n");
+               d_printf(_("\nGroup name            Comment"
+                          "\n-----------------------------\n"));
        do {
                uint32_t max_size, total_size, returned_size;
                union samr_DispInfo info;
@@ -2260,7 +2300,7 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
 
                        if (c->opt_long_list_entries) {
 
-                               POLICY_HND alias_pol;
+                               struct policy_handle alias_pol;
                                union samr_AliasInfo *info = NULL;
 
                                if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
@@ -2319,7 +2359,7 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
 
                        if (c->opt_long_list_entries) {
 
-                               POLICY_HND alias_pol;
+                               struct policy_handle alias_pol;
                                union samr_AliasInfo *info = NULL;
 
                                if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
@@ -2363,11 +2403,11 @@ static NTSTATUS rpc_list_group_members(struct net_context *c,
                                        TALLOC_CTX *mem_ctx,
                                        const char *domain_name,
                                        const DOM_SID *domain_sid,
-                                       POLICY_HND *domain_pol,
+                                       struct policy_handle *domain_pol,
                                        uint32 rid)
 {
        NTSTATUS result;
-       POLICY_HND group_pol;
+       struct policy_handle group_pol;
        uint32 num_members, *group_rids;
        int i;
        struct samr_RidTypeArray *rids = NULL;
@@ -2438,12 +2478,12 @@ static NTSTATUS rpc_list_group_members(struct net_context *c,
 static NTSTATUS rpc_list_alias_members(struct net_context *c,
                                        struct rpc_pipe_client *pipe_hnd,
                                        TALLOC_CTX *mem_ctx,
-                                       POLICY_HND *domain_pol,
+                                       struct policy_handle *domain_pol,
                                        uint32 rid)
 {
        NTSTATUS result;
        struct rpc_pipe_client *lsa_pipe;
-       POLICY_HND alias_pol, lsa_pol;
+       struct policy_handle alias_pol, lsa_pol;
        uint32 num_members;
        DOM_SID *alias_sids;
        char **domains;
@@ -2466,7 +2506,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
                                               &sid_array);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Couldn't list alias members\n");
+               d_fprintf(stderr, _("Couldn't list alias members\n"));
                return result;
        }
 
@@ -2480,23 +2520,23 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
                                          &ndr_table_lsarpc.syntax_id,
                                          &lsa_pipe);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Couldn't open LSA pipe. Error was %s\n",
+               d_fprintf(stderr, _("Couldn't open LSA pipe. Error was %s\n"),
                        nt_errstr(result) );
                return result;
        }
 
        result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, true,
-                                    SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol);
+                                    SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Couldn't open LSA policy handle\n");
+               d_fprintf(stderr, _("Couldn't open LSA policy handle\n"));
                TALLOC_FREE(lsa_pipe);
                return result;
        }
 
        alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members);
        if (!alias_sids) {
-               d_fprintf(stderr, "Out of memory\n");
+               d_fprintf(stderr, _("Out of memory\n"));
                TALLOC_FREE(lsa_pipe);
                return NT_STATUS_NO_MEMORY;
        }
@@ -2511,7 +2551,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
 
        if (!NT_STATUS_IS_OK(result) &&
            !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED)) {
-               d_fprintf(stderr, "Couldn't lookup SIDs\n");
+               d_fprintf(stderr, _("Couldn't lookup SIDs\n"));
                TALLOC_FREE(lsa_pipe);
                return result;
        }
@@ -2522,8 +2562,8 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
 
                if (c->opt_long_list_entries) {
                        printf("%s %s\\%s %d\n", sid_str,
-                              domains[i] ? domains[i] : "*unknown*",
-                              names[i] ? names[i] : "*unknown*", types[i]);
+                              domains[i] ? domains[i] : _("*unknown*"),
+                              names[i] ? names[i] : _("*unknown*"), types[i]);
                } else {
                        if (domains[i])
                                printf("%s\\%s\n", domains[i], names[i]);
@@ -2546,7 +2586,7 @@ static NTSTATUS rpc_group_members_internals(struct net_context *c,
                                        const char **argv)
 {
        NTSTATUS result;
-       POLICY_HND connect_pol, domain_pol;
+       struct policy_handle connect_pol, domain_pol;
        struct samr_Ids rids, rid_types;
        struct lsa_String lsa_acct_name;
 
@@ -2597,7 +2637,8 @@ static NTSTATUS rpc_group_members_internals(struct net_context *c,
                                                &domain_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Couldn't find group %s\n", argv[0]);
+                       d_fprintf(stderr, _("Couldn't find group %s\n"),
+                                 argv[0]);
                        return result;
                }
 
@@ -2609,13 +2650,15 @@ static NTSTATUS rpc_group_members_internals(struct net_context *c,
                                                 &rid_types);
 
                if (!NT_STATUS_IS_OK(result)) {
-                       d_fprintf(stderr, "Couldn't find group %s\n", argv[0]);
+                       d_fprintf(stderr, _("Couldn't find group %s\n"),
+                                 argv[0]);
                        return result;
                }
        }
 
        if (rids.count != 1) {
-               d_fprintf(stderr, "Couldn't find group %s\n", argv[0]);
+               d_fprintf(stderr, _("Couldn't find group %s\n"),
+                         argv[0]);
                return result;
        }
 
@@ -2651,7 +2694,7 @@ static int rpc_group_rename_internals(struct net_context *c, int argc, const cha
        uint32_t parm_err;
 
        if (argc != 2) {
-               d_printf("Usage: 'net rpc group rename group newname'\n");
+               d_printf(_("Usage: 'net rpc group rename group newname'\n"));
                return -1;
        }
 
@@ -2664,7 +2707,7 @@ static int rpc_group_rename_internals(struct net_context *c, int argc, const cha
                                 &parm_err);
 
        if (status != 0) {
-               d_fprintf(stderr, "Renaming group %s failed with: %s\n",
+               d_fprintf(stderr, _("Renaming group %s failed with: %s\n"),
                        argv[0], libnetapi_get_error_string(c->netapi_ctx,
                        status));
                return -1;
@@ -2698,57 +2741,57 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv)
                        "add",
                        rpc_group_add,
                        NET_TRANSPORT_RPC,
-                       "Create specified group",
-                       "net rpc group add\n"
-                       "    Create specified group"
+                       N_("Create specified group"),
+                       N_("net rpc group add\n"
+                          "    Create specified group")
                },
                {
                        "delete",
                        rpc_group_delete,
                        NET_TRANSPORT_RPC,
-                       "Delete specified group",
-                       "net rpc group delete\n"
-                       "    Delete specified group"
+                       N_("Delete specified group"),
+                       N_("net rpc group delete\n"
+                          "    Delete specified group")
                },
                {
                        "addmem",
                        rpc_group_addmem,
                        NET_TRANSPORT_RPC,
-                       "Add member to group",
-                       "net rpc group addmem\n"
-                       "    Add member to group"
+                       N_("Add member to group"),
+                       N_("net rpc group addmem\n"
+                          "    Add member to group")
                },
                {
                        "delmem",
                        rpc_group_delmem,
                        NET_TRANSPORT_RPC,
-                       "Remove member from group",
-                       "net rpc group delmem\n"
-                       "    Remove member from group"
+                       N_("Remove member from group"),
+                       N_("net rpc group delmem\n"
+                          "    Remove member from group")
                },
                {
                        "list",
                        rpc_group_list,
                        NET_TRANSPORT_RPC,
-                       "List groups",
-                       "net rpc group list\n"
-                       "    List groups"
+                       N_("List groups"),
+                       N_("net rpc group list\n"
+                          "    List groups")
                },
                {
                        "members",
                        rpc_group_members,
                        NET_TRANSPORT_RPC,
-                       "List group members",
-                       "net rpc group members\n"
-                       "    List group members"
+                       N_("List group members"),
+                       N_("net rpc group members\n"
+                          "    List group members")
                },
                {
                        "rename",
                        rpc_group_rename,
                        NET_TRANSPORT_RPC,
-                       "Rename group",
-                       "net rpc group rename\n"
-                       "    Rename group"
+                       N_("Rename group"),
+                       N_("net rpc group rename\n"
+                          "    Rename group")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -2765,10 +2808,10 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv)
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n");
-                       d_printf("net rpc group\n"
-                                "    Alias for net rpc group list global local "
-                                "builtin\n");
+                       d_printf(_("Usage:\n"));
+                       d_printf(_("net rpc group\n"
+                                  "    Alias for net rpc group list global "
+                                  "local builtin\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
@@ -2838,7 +2881,7 @@ static int rpc_share_add(struct net_context *c, int argc, const char **argv)
                             (uint8_t *)&i2,
                             &parm_error);
        if (status != 0) {
-               printf("NetShareAdd failed with: %s\n",
+               printf(_("NetShareAdd failed with: %s\n"),
                        libnetapi_get_error_string(c->netapi_ctx, status));
        }
 
@@ -2876,7 +2919,7 @@ static void display_share_info_1(struct net_context *c,
        if (c->opt_long_list_entries) {
                d_printf("%-12s %-8.8s %-50s\n",
                         r->shi1_netname,
-                        share_type[r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)],
+                        net_share_type_str(r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)),
                         r->shi1_remark);
        } else {
                d_printf("%s\n", r->shi1_netname);
@@ -2989,15 +3032,15 @@ static int rpc_share_list(struct net_context *c, int argc, const char **argv)
        uint32_t i, level = 1;
 
        if (c->display_usage) {
-               d_printf("Usage\n"
-                        "net rpc share list\n"
-                        "    List shares on remote server\n");
+               d_printf(_("Usage\n"
+                          "net rpc share list\n"
+                          "    List shares on remote server\n"));
                return 0;
        }
 
        status = NetShareEnum(c->opt_host,
                              level,
-                             (uint8_t **)&i1,
+                             (uint8_t **)(void *)&i1,
                              (uint32_t)-1,
                              &entries_read,
                              &total_entries,
@@ -3009,10 +3052,10 @@ static int rpc_share_list(struct net_context *c, int argc, const char **argv)
        /* Display results */
 
        if (c->opt_long_list_entries) {
-               d_printf(
+               d_printf(_(
        "\nEnumerating shared resources (exports) on remote server:\n\n"
        "\nShare name   Type     Description\n"
-       "----------   ----     -----------\n");
+       "----------   ----     -----------\n"));
        }
        for (i = 0; i < entries_read; i++)
                display_share_info_1(c, &i1[i]);
@@ -3022,8 +3065,8 @@ static int rpc_share_list(struct net_context *c, int argc, const char **argv)
 
 static bool check_share_availability(struct cli_state *cli, const char *netname)
 {
-       if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
-               d_printf("skipping   [%s]: not a file share.\n", netname);
+       if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, netname, "A:", "", 0))) {
+               d_printf(_("skipping   [%s]: not a file share.\n"), netname);
                return false;
        }
 
@@ -3038,7 +3081,8 @@ static bool check_share_sanity(struct net_context *c, struct cli_state *cli,
 {
        /* only support disk shares */
        if (! ( type == STYPE_DISKTREE || type == (STYPE_DISKTREE | STYPE_HIDDEN)) ) {
-               printf("share [%s] is not a diskshare (type: %x)\n", netname, type);
+               printf(_("share [%s] is not a diskshare (type: %x)\n"), netname,
+                      type);
                return false;
        }
 
@@ -3049,7 +3093,7 @@ static bool check_share_sanity(struct net_context *c, struct cli_state *cli,
                return false;
 
        if (c->opt_exclude && in_list(netname, c->opt_exclude, false)) {
-               printf("excluding  [%s]\n", netname);
+               printf(_("excluding  [%s]\n"), netname);
                return false;
        }
 
@@ -3116,7 +3160,8 @@ static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
 
                /* finally add the share on the dst server */
 
-               printf("migrating: [%s], path: %s, comment: %s, without share-ACLs\n", 
+               printf(_("migrating: [%s], path: %s, comment: %s, without "
+                        "share-ACLs\n"),
                        info502.name, info502.path, info502.comment);
 
                info.info502 = &info502;
@@ -3128,14 +3173,14 @@ static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
                                                      &parm_error,
                                                      &result);
 
-                if (W_ERROR_V(result) == W_ERROR_V(WERR_ALREADY_EXISTS)) {
-                       printf("           [%s] does already exist\n",
+                if (W_ERROR_V(result) == W_ERROR_V(WERR_FILE_EXISTS)) {
+                       printf(_("           [%s] does already exist\n"),
                                info502.name);
                        continue;
                }
 
                if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
-                       printf("cannot add share: %s\n", dos_errstr(result));
+                       printf(_("cannot add share: %s\n"), win_errstr(result));
                        goto done;
                }
 
@@ -3165,14 +3210,14 @@ static int rpc_share_migrate_shares(struct net_context *c, int argc,
                                    const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc share migrate shares\n"
-                        "    Migrate shares to local server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc share migrate shares\n"
+                          "    Migrate shares to local server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               printf("no server to migrate\n");
+               printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3232,12 +3277,12 @@ static void copy_fn(const char *mnt, file_info *f,
                                                  false);
                        break;
                default:
-                       d_fprintf(stderr, "Unsupported mode %d\n", net_mode_share);
+                       d_fprintf(stderr, _("Unsupported mode %d\n"), net_mode_share);
                        return;
                }
 
                if (!NT_STATUS_IS_OK(nt_status))
-                       printf("could not handle dir %s: %s\n",
+                       printf(_("could not handle dir %s: %s\n"),
                                dir, nt_errstr(nt_status));
 
                /* search below that directory */
@@ -3247,7 +3292,7 @@ static void copy_fn(const char *mnt, file_info *f,
                old_dir = local_state->cwd;
                local_state->cwd = dir;
                if (!sync_files(local_state, new_mask))
-                       printf("could not handle files\n");
+                       printf(_("could not handle files\n"));
                local_state->cwd = old_dir;
 
                return;
@@ -3274,12 +3319,13 @@ static void copy_fn(const char *mnt, file_info *f,
                                          true);
                break;
        default:
-               d_fprintf(stderr, "Unsupported file mode %d\n", net_mode_share);
+               d_fprintf(stderr, _("Unsupported file mode %d\n"),
+                         net_mode_share);
                return;
        }
 
        if (!NT_STATUS_IS_OK(nt_status))
-               printf("could not handle file %s: %s\n",
+               printf(_("could not handle file %s: %s\n"),
                        filename, nt_errstr(nt_status));
 
 }
@@ -3300,15 +3346,16 @@ static bool sync_files(struct copy_clistate *cp_clistate, const char *mask)
 
        DEBUG(3,("calling cli_list with mask: %s\n", mask));
 
-       if ( !cli_resolve_path(talloc_tos(), "", cp_clistate->cli_share_src,
+       if ( !cli_resolve_path(talloc_tos(), "", NULL, cp_clistate->cli_share_src,
                                mask, &targetcli, &targetpath ) ) {
-               d_fprintf(stderr, "cli_resolve_path %s failed with error: %s\n", 
+               d_fprintf(stderr, _("cli_resolve_path %s failed with error: "
+                                   "%s\n"),
                        mask, cli_errstr(cp_clistate->cli_share_src));
                return false;
        }
 
        if (cli_list(targetcli, targetpath, cp_clistate->attribute, copy_fn, cp_clistate) == -1) {
-               d_fprintf(stderr, "listing %s failed with error: %s\n",
+               d_fprintf(stderr, _("listing %s failed with error: %s\n"),
                        mask, cli_errstr(targetcli));
                return false;
        }
@@ -3342,12 +3389,13 @@ bool copy_top_level_perms(struct net_context *c,
                                                false);
                break;
        default:
-               d_fprintf(stderr, "Unsupported mode %d\n", net_mode_share);
+               d_fprintf(stderr, _("Unsupported mode %d\n"), net_mode_share);
                break;
        }
 
        if (!NT_STATUS_IS_OK(nt_status))  {
-               printf("Could handle directory attributes for top level directory of share %s. Error %s\n", 
+               printf(_("Could handle directory attributes for top level "
+                        "directory of share %s. Error %s\n"),
                        sharename, nt_errstr(nt_status));
                return false;
        }
@@ -3413,7 +3461,8 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
 
                /* one might not want to mirror whole discs :) */
                if (strequal(info502.name, "print$") || info502.name[1] == '$') {
-                       d_printf("skipping   [%s]: builtin/hidden share\n", info502.name);
+                       d_printf(_("skipping   [%s]: builtin/hidden share\n"),
+                                info502.name);
                        continue;
                }
 
@@ -3423,14 +3472,16 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
                        printf("syncing");
                        break;
                default:
-                       d_fprintf(stderr, "Unsupported mode %d\n", net_mode_share);
+                       d_fprintf(stderr, _("Unsupported mode %d\n"),
+                                 net_mode_share);
                        break;
                }
-               printf("    [%s] files and directories %s ACLs, %s DOS Attributes %s\n", 
+               printf(_("    [%s] files and directories %s ACLs, %s DOS "
+                        "Attributes %s\n"),
                        info502.name,
-                       c->opt_acls ? "including" : "without",
-                       c->opt_attrs ? "including" : "without",
-                       c->opt_timestamps ? "(preserving timestamps)" : "");
+                       c->opt_acls ? _("including") : _("without"),
+                       c->opt_attrs ? _("including") : _("without"),
+                       c->opt_timestamps ? _("(preserving timestamps)") : "");
 
                cp_clistate.mem_ctx = mem_ctx;
                cp_clistate.cli_share_src = NULL;
@@ -3459,13 +3510,16 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
                }
 
                if (!copy_top_level_perms(c, &cp_clistate, info502.name)) {
-                       d_fprintf(stderr, "Could not handle the top level directory permissions for the share: %s\n", info502.name);
+                       d_fprintf(stderr, _("Could not handle the top level "
+                                           "directory permissions for the "
+                                           "share: %s\n"), info502.name);
                        nt_status = NT_STATUS_UNSUCCESSFUL;
                        goto done;
                }
 
                if (!sync_files(&cp_clistate, mask)) {
-                       d_fprintf(stderr, "could not handle files for share: %s\n", info502.name);
+                       d_fprintf(stderr, _("could not handle files for share: "
+                                           "%s\n"), info502.name);
                        nt_status = NT_STATUS_UNSUCCESSFUL;
                        goto done;
                }
@@ -3489,14 +3543,14 @@ done:
 static int rpc_share_migrate_files(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net share migrate files\n"
-                        "    Migrate files to local server\n");
+               d_printf(_("Usage:\n"
+                          "net share migrate files\n"
+                          "    Migrate files to local server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3564,7 +3618,8 @@ static NTSTATUS rpc_share_migrate_security_internals(struct net_context *c,
                if (!check_share_sanity(c, cli, info502.name, info502.type))
                        continue;
 
-               printf("migrating: [%s], path: %s, comment: %s, including share-ACLs\n", 
+               printf(_("migrating: [%s], path: %s, comment: %s, including "
+                        "share-ACLs\n"),
                        info502.name, info502.path, info502.comment);
 
                if (c->opt_verbose)
@@ -3582,7 +3637,8 @@ static NTSTATUS rpc_share_migrate_security_internals(struct net_context *c,
                                                          &parm_error,
                                                          &result);
                if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
-                       printf("cannot set share-acl: %s\n", dos_errstr(result));
+                       printf(_("cannot set share-acl: %s\n"),
+                              win_errstr(result));
                        goto done;
                }
 
@@ -3612,14 +3668,14 @@ static int rpc_share_migrate_security(struct net_context *c, int argc,
                                      const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc share migrate security\n"
-                        "    Migrate share-acls to local server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc share migrate security\n"
+                          "    Migrate share-acls to local server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3645,14 +3701,14 @@ static int rpc_share_migrate_all(struct net_context *c, int argc,
        int ret;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc share migrate all\n"
-                        "    Migrates shares including all share settings\n");
+               d_printf(_("Usage:\n"
+                          "net rpc share migrate all\n"
+                          "    Migrates shares including all share settings\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3689,33 +3745,33 @@ static int rpc_share_migrate(struct net_context *c, int argc, const char **argv)
                        "all",
                        rpc_share_migrate_all,
                        NET_TRANSPORT_RPC,
-                       "Migrate shares from remote to local server",
-                       "net rpc share migrate all\n"
-                       "    Migrate shares from remote to local server"
+                       N_("Migrate shares from remote to local server"),
+                       N_("net rpc share migrate all\n"
+                          "    Migrate shares from remote to local server")
                },
                {
                        "files",
                        rpc_share_migrate_files,
                        NET_TRANSPORT_RPC,
-                       "Migrate files from remote to local server",
-                       "net rpc share migrate files\n"
-                       "    Migrate files from remote to local server"
+                       N_("Migrate files from remote to local server"),
+                       N_("net rpc share migrate files\n"
+                          "    Migrate files from remote to local server")
                },
                {
                        "security",
                        rpc_share_migrate_security,
                        NET_TRANSPORT_RPC,
-                       "Migrate share-ACLs from remote to local server",
-                       "net rpc share migrate security\n"
-                       "    Migrate share-ACLs from remote to local server"
+                       N_("Migrate share-ACLs from remote to local server"),
+                       N_("net rpc share migrate security\n"
+                          "    Migrate share-ACLs from remote to local server")
                },
                {
                        "shares",
                        rpc_share_migrate_shares,
                        NET_TRANSPORT_RPC,
-                       "Migrate shares from remote to local server",
-                       "net rpc share migrate shares\n"
-                       "    Migrate shares from remote to local server"
+                       N_("Migrate shares from remote to local server"),
+                       N_("net rpc share migrate shares\n"
+                          "    Migrate shares from remote to local server")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -3753,13 +3809,13 @@ static void push_alias(TALLOC_CTX *mem_ctx, struct full_alias *alias)
 
 static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
                                        TALLOC_CTX *mem_ctx,
-                                       POLICY_HND *connect_pol,
+                                       struct policy_handle *connect_pol,
                                        const DOM_SID *domain_sid)
 {
        uint32 start_idx, max_entries, num_entries, i;
        struct samr_SamArray *groups = NULL;
        NTSTATUS result;
-       POLICY_HND domain_pol;
+       struct policy_handle domain_pol;
 
        /* Get domain policy handle */
 
@@ -3783,7 +3839,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
                                                       &num_entries);
                for (i = 0; i < num_entries; i++) {
 
-                       POLICY_HND alias_pol;
+                       struct policy_handle alias_pol;
                        struct full_alias alias;
                        struct lsa_SidArray sid_array;
                        int j;
@@ -3848,10 +3904,10 @@ static NTSTATUS rpc_aliaslist_dump(struct net_context *c,
 {
        int i;
        NTSTATUS result;
-       POLICY_HND lsa_pol;
+       struct policy_handle lsa_pol;
 
        result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
-                                    SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                    SEC_FLAG_MAXIMUM_ALLOWED,
                                     &lsa_pol);
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -3913,7 +3969,7 @@ static NTSTATUS rpc_aliaslist_internals(struct net_context *c,
                                        const char **argv)
 {
        NTSTATUS result;
-       POLICY_HND connect_pol;
+       struct policy_handle connect_pol;
 
        result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
                                      pipe_hnd->desthost,
@@ -3942,7 +3998,7 @@ static void init_user_token(NT_USER_TOKEN *token, DOM_SID *user_sid)
        token->num_sids = 4;
 
        if (!(token->user_sids = SMB_MALLOC_ARRAY(DOM_SID, 4))) {
-               d_fprintf(stderr, "malloc failed\n");
+               d_fprintf(stderr, _("malloc failed\n"));
                token->num_sids = 0;
                return;
        }
@@ -3958,17 +4014,6 @@ static void free_user_token(NT_USER_TOKEN *token)
        SAFE_FREE(token->user_sids);
 }
 
-static bool is_sid_in_token(NT_USER_TOKEN *token, DOM_SID *sid)
-{
-       int i;
-
-       for (i=0; i<token->num_sids; i++) {
-               if (sid_compare(sid, &token->user_sids[i]) == 0)
-                       return true;
-       }
-       return false;
-}
-
 static void add_sid_to_token(NT_USER_TOKEN *token, DOM_SID *sid)
 {
        if (is_sid_in_token(token, sid))
@@ -4075,7 +4120,11 @@ static bool get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
                return false;
        }
 
-       string_to_sid(&user_sid, sid_str);
+       if (!string_to_sid(&user_sid, sid_str)) {
+               DEBUG(1,("Could not convert sid %s from string\n", sid_str));
+               return false;
+       }
+
        wbcFreeMemory(sid_str);
        sid_str = NULL;
 
@@ -4096,8 +4145,8 @@ static bool get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
 
                wbc_status = wbcGidToSid(gid, &wsid);
                if (!WBC_ERROR_IS_OK(wbc_status)) {
-                       DEBUG(1, ("winbind could not find SID of gid %d: %s\n",
-                                 gid, wbcErrorString(wbc_status)));
+                       DEBUG(1, ("winbind could not find SID of gid %u: %s\n",
+                                 (unsigned int)gid, wbcErrorString(wbc_status)));
                        wbcFreeMemory(groups);
                        return false;
                }
@@ -4136,8 +4185,8 @@ static bool get_user_tokens(struct net_context *c, int *num_tokens,
 
        if (lp_winbind_use_default_domain() &&
            (c->opt_target_workgroup == NULL)) {
-               d_fprintf(stderr, "winbind use default domain = yes set, "
-                        "please specify a workgroup\n");
+               d_fprintf(stderr, _("winbind use default domain = yes set, "
+                        "please specify a workgroup\n"));
                return false;
        }
 
@@ -4145,7 +4194,7 @@ static bool get_user_tokens(struct net_context *c, int *num_tokens,
 
        wbc_status = wbcListUsers(NULL, &num_users, &users);
        if (!WBC_ERROR_IS_OK(wbc_status)) {
-               DEBUG(1, ("winbind could not list users: %s\n",
+               DEBUG(1, (_("winbind could not list users: %s\n"),
                          wbcErrorString(wbc_status)));
                return false;
        }
@@ -4211,7 +4260,11 @@ static bool get_user_tokens_from_file(FILE *f,
                        /* We have a SID */
 
                        DOM_SID sid;
-                       string_to_sid(&sid, &line[1]);
+                       if(!string_to_sid(&sid, &line[1])) {
+                               DEBUG(1,("get_user_tokens_from_file: Could "
+                                       "not convert sid %s \n",&line[1]));
+                               return false;
+                       }
 
                        if (token == NULL) {
                                DEBUG(0, ("File does not begin with username"));
@@ -4253,7 +4306,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                        int num_tokens,
                        struct user_token *tokens)
 {
-       int fnum;
+       uint16_t fnum;
        SEC_DESC *share_sd = NULL;
        SEC_DESC *root_sd = NULL;
        struct cli_state *cli = rpc_pipe_np_smb_conn(pipe_hnd);
@@ -4284,13 +4337,12 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
 
        cnum = cli->cnum;
 
-       if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
+       if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, netname, "A:", "", 0))) {
                return;
        }
 
-       fnum = cli_nt_create(cli, "\\", READ_CONTROL_ACCESS);
-
-       if (fnum != -1) {
+       if (!NT_STATUS_IS_OK(cli_ntcreate(cli, "\\", 0, READ_CONTROL_ACCESS, 0,
+                       FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
                root_sd = cli_query_secdesc(cli, fnum, mem_ctx);
        }
 
@@ -4298,16 +4350,15 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                uint32 acc_granted;
 
                if (share_sd != NULL) {
-                       if (!se_access_check(share_sd, &tokens[i].token,
-                                            1, &acc_granted, &status)) {
+                       status = se_access_check(share_sd, &tokens[i].token,
+                                            1, &acc_granted);
+
+                       if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(1, ("Could not check share_sd for "
                                          "user %s\n",
                                          tokens[i].name));
                                continue;
                        }
-
-                       if (!NT_STATUS_IS_OK(status))
-                               continue;
                }
 
                if (root_sd == NULL) {
@@ -4315,20 +4366,17 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                        continue;
                }
 
-               if (!se_access_check(root_sd, &tokens[i].token,
-                                    1, &acc_granted, &status)) {
+               status = se_access_check(root_sd, &tokens[i].token,
+                                    1, &acc_granted);
+               if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Could not check root_sd for user %s\n",
                                  tokens[i].name));
                        continue;
                }
-
-               if (!NT_STATUS_IS_OK(status))
-                       continue;
-
                d_printf(" %s\n", tokens[i].name);
        }
 
-       if (fnum != -1)
+       if (fnum != (uint16_t)-1)
                cli_close(cli, fnum);
        cli_tdis(cli);
        cli->cnum = cnum;
@@ -4385,7 +4433,6 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c,
 {
        int ret;
        bool r;
-       ENUM_HND hnd;
        uint32 i;
        FILE *f;
 
@@ -4418,8 +4465,6 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c,
        for (i=0; i<num_tokens; i++)
                collect_alias_memberships(&tokens[i].token);
 
-       init_enum_hnd(&hnd, 0);
-
        share_list.num_shares = 0;
        share_list.shares = NULL;
 
@@ -4458,9 +4503,9 @@ static int rpc_share_allowedusers(struct net_context *c, int argc,
        int result;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc share allowedusers\n"
-                        "    List allowed users\n");
+               d_printf(_("Usage:\n"
+                          "net rpc share allowedusers\n"
+                           "    List allowed users\n"));
                return 0;
        }
 
@@ -4508,10 +4553,10 @@ int net_usersidlist(struct net_context *c, int argc, const char **argv)
 
 int net_usersidlist_usage(struct net_context *c, int argc, const char **argv)
 {
-       d_printf("net usersidlist\n"
-                "\tprints out a list of all users the running winbind knows\n"
-                "\tabout, together with all their SIDs. This is used as\n"
-                "\tinput to the 'net rpc share allowedusers' command.\n\n");
+       d_printf(_("net usersidlist\n"
+                  "\tprints out a list of all users the running winbind knows\n"
+                  "\tabout, together with all their SIDs. This is used as\n"
+                  "\tinput to the 'net rpc share allowedusers' command.\n\n"));
 
        net_common_flags_usage(c, argc, argv);
        return -1;
@@ -4533,41 +4578,41 @@ int net_rpc_share(struct net_context *c, int argc, const char **argv)
                        "add",
                        rpc_share_add,
                        NET_TRANSPORT_RPC,
-                       "Add share",
-                       "net rpc share add\n"
-                       "    Add share"
+                       N_("Add share"),
+                       N_("net rpc share add\n"
+                          "    Add share")
                },
                {
                        "delete",
                        rpc_share_delete,
                        NET_TRANSPORT_RPC,
-                       "Remove share",
-                       "net rpc share delete\n"
-                       "    Remove share"
+                       N_("Remove share"),
+                       N_("net rpc share delete\n"
+                          "    Remove share")
                },
                {
                        "allowedusers",
                        rpc_share_allowedusers,
                        NET_TRANSPORT_RPC,
-                       "Modify allowed users",
-                       "net rpc share allowedusers\n"
-                       "    Modify allowed users"
+                       N_("Modify allowed users"),
+                       N_("net rpc share allowedusers\n"
+                          "    Modify allowed users")
                },
                {
                        "migrate",
                        rpc_share_migrate,
                        NET_TRANSPORT_RPC,
-                       "Migrate share to local server",
-                       "net rpc share migrate\n"
-                       "    Migrate share to local server"
+                       N_("Migrate share to local server"),
+                       N_("net rpc share migrate\n"
+                          "    Migrate share to local server")
                },
                {
                        "list",
                        rpc_share_list,
                        NET_TRANSPORT_RPC,
-                       "List shares",
-                       "net rpc share list\n"
-                       "    List shares"
+                       N_("List shares"),
+                       N_("net rpc share list\n"
+                          "    List shares")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -4584,10 +4629,10 @@ int net_rpc_share(struct net_context *c, int argc, const char **argv)
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n"
-                                "net rpc share\n"
-                                "    List shares\n"
-                                "    Alias for net rpc share list\n");
+                       d_printf(_("Usage:\n"
+                                  "net rpc share\n"
+                                  "    List shares\n"
+                                  "    Alias for net rpc share list\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
@@ -4619,7 +4664,7 @@ static NTSTATUS rpc_sh_share_add(struct net_context *c,
        struct SHARE_INFO_2 i2;
 
        if ((argc < 2) || (argc > 3)) {
-               d_fprintf(stderr, "usage: %s <share> <path> [comment]\n",
+               d_fprintf(stderr, _("usage: %s <share> <path> [comment]\n"),
                          ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -4648,7 +4693,7 @@ static NTSTATUS rpc_sh_share_delete(struct net_context *c,
                                    int argc, const char **argv)
 {
        if (argc != 1) {
-               d_fprintf(stderr, "usage: %s <share>\n", ctx->whoami);
+               d_fprintf(stderr, _("usage: %s <share>\n"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -4666,7 +4711,7 @@ static NTSTATUS rpc_sh_share_info(struct net_context *c,
        NTSTATUS status;
 
        if (argc != 1) {
-               d_fprintf(stderr, "usage: %s <share>\n", ctx->whoami);
+               d_fprintf(stderr, _("usage: %s <share>\n"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -4680,10 +4725,10 @@ static NTSTATUS rpc_sh_share_info(struct net_context *c,
                goto done;
        }
 
-       d_printf("Name:     %s\n", info.info2->name);
-       d_printf("Comment:  %s\n", info.info2->comment);
-       d_printf("Path:     %s\n", info.info2->path);
-       d_printf("Password: %s\n", info.info2->password);
+       d_printf(_("Name:     %s\n"), info.info2->name);
+       d_printf(_("Comment:  %s\n"), info.info2->comment);
+       d_printf(_("Path:     %s\n"), info.info2->path);
+       d_printf(_("Password: %s\n"), info.info2->password);
 
  done:
        return werror_to_ntstatus(result);
@@ -4695,16 +4740,16 @@ struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx
        static struct rpc_sh_cmd cmds[] = {
 
        { "list", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_list,
-         "List available shares" },
+         N_("List available shares") },
 
        { "add", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_add,
-         "Add a share" },
+         N_("Add a share") },
 
        { "delete", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_delete,
-         "Delete a share" },
+         N_("Delete a share") },
 
        { "info", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_info,
-         "Get information about a share" },
+         N_("Get information about a share") },
 
        { NULL, NULL, 0, NULL, NULL }
        };
@@ -4740,104 +4785,70 @@ static int rpc_file_close(struct net_context *c, int argc, const char **argv)
 /**
  * Formatted print of open file info
  *
- * @param r  struct srvsvc_NetFileInfo3 contents
+ * @param r  struct FILE_INFO_3 contents
  **/
 
-static void display_file_info_3(struct srvsvc_NetFileInfo3 *r)
+static void display_file_info_3(struct FILE_INFO_3 *r)
 {
        d_printf("%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
-                r->fid, r->user, r->permissions, r->num_locks, r->path);
+                r->fi3_id, r->fi3_username, r->fi3_permissions,
+                r->fi3_num_locks, r->fi3_pathname);
 }
 
 /**
- * List open files on a remote RPC server.
- *
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passed through.
+ * List files for a user on a remote RPC server.
  *
- * @param c    A net_context structure.
- * @param domain_sid The domain sid acquired from the remote server.
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destroyed on completion of the function.
  * @param argc  Standard main() style argc.
  * @param argv  Standard main() style argv. Initial components are already
  *              stripped.
  *
- * @return Normal NTSTATUS return.
+ * @return A shell status integer (0 for success)..
  **/
 
-static NTSTATUS rpc_file_list_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
-                                       const char *domain_name,
-                                       struct cli_state *cli,
-                                       struct rpc_pipe_client *pipe_hnd,
-                                       TALLOC_CTX *mem_ctx,
-                                       int argc,
-                                       const char **argv)
+static int rpc_file_user(struct net_context *c, int argc, const char **argv)
 {
-       struct srvsvc_NetFileInfoCtr info_ctr;
-       struct srvsvc_NetFileCtr3 ctr3;
-       WERROR result;
-       NTSTATUS status;
+       NET_API_STATUS status;
        uint32 preferred_len = 0xffffffff, i;
        const char *username=NULL;
        uint32_t total_entries = 0;
+       uint32_t entries_read = 0;
        uint32_t resume_handle = 0;
+       struct FILE_INFO_3 *i3 = NULL;
+
+       if (c->display_usage) {
+               return rpc_file_usage(c, argc, argv);
+       }
 
        /* if argc > 0, must be user command */
-       if (argc > 0)
+       if (argc > 0) {
                username = smb_xstrdup(argv[0]);
+       }
 
-       ZERO_STRUCT(info_ctr);
-       ZERO_STRUCT(ctr3);
-
-       info_ctr.level = 3;
-       info_ctr.ctr.ctr3 = &ctr3;
-
-       status = rpccli_srvsvc_NetFileEnum(pipe_hnd, mem_ctx,
-                                          pipe_hnd->desthost,
-                                          NULL,
-                                          username,
-                                          &info_ctr,
-                                          preferred_len,
-                                          &total_entries,
-                                          &resume_handle,
-                                          &result);
+       status = NetFileEnum(c->opt_host,
+                            NULL,
+                            username,
+                            3,
+                            (uint8_t **)(void *)&i3,
+                            preferred_len,
+                            &entries_read,
+                            &total_entries,
+                            &resume_handle);
 
-       if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result))
+       if (status != 0) {
                goto done;
+       }
 
        /* Display results */
 
-       d_printf(
+       d_printf(_(
                 "\nEnumerating open files on remote server:\n\n"
                 "\nFileId  Opened by            Perms  Locks  Path"
-                "\n------  ---------            -----  -----  ---- \n");
-       for (i = 0; i < total_entries; i++)
-               display_file_info_3(&info_ctr.ctr.ctr3->array[i]);
- done:
-       return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-}
-
-/**
- * List files for a user on a remote RPC server.
- *
- * @param argc  Standard main() style argc.
- * @param argv  Standard main() style argv. Initial components are already
- *              stripped.
- *
- * @return A shell status integer (0 for success)..
- **/
-
-static int rpc_file_user(struct net_context *c, int argc, const char **argv)
-{
-       if (argc < 1 || c->display_usage) {
-               return rpc_file_usage(c, argc, argv);
+                "\n------  ---------            -----  -----  ---- \n"));
+       for (i = 0; i < entries_read; i++) {
+               display_file_info_3(&i3[i]);
        }
-
-       return run_rpc_command(c, NULL, &ndr_table_srvsvc.syntax_id, 0,
-                              rpc_file_list_internals,
-                              argc, argv);
+ done:
+       return status;
 }
 
 /**
@@ -4856,26 +4867,26 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv)
                        "close",
                        rpc_file_close,
                        NET_TRANSPORT_RPC,
-                       "Close opened file",
-                       "net rpc file close\n"
-                       "    Close opened file"
+                       N_("Close opened file"),
+                       N_("net rpc file close\n"
+                          "    Close opened file")
                },
                {
                        "user",
                        rpc_file_user,
                        NET_TRANSPORT_RPC,
-                       "List files opened by user",
-                       "net rpc file user\n"
-                       "    List files opened by user"
+                       N_("List files opened by user"),
+                       N_("net rpc file user\n"
+                          "    List files opened by user")
                },
 #if 0
                {
                        "info",
                        rpc_file_info,
                        NET_TRANSPORT_RPC,
-                       "Display information about opened file",
-                       "net rpc file info\n"
-                       "    Display information about opened file"
+                       N_("Display information about opened file"),
+                       N_("net rpc file info\n"
+                          "    Display information about opened file")
                },
 #endif
                {NULL, NULL, 0, NULL, NULL}
@@ -4893,16 +4904,14 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv)
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n");
-                       d_printf("net rpc file\n"
-                                "    List opened files\n");
+                       d_printf(_("Usage:\n"));
+                       d_printf(_("net rpc file\n"
+                                  "    List opened files\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
 
-               return run_rpc_command(c, NULL, &ndr_table_srvsvc.syntax_id, 0,
-                                      rpc_file_list_internals,
-                                      argc, argv);
+               return rpc_file_user(c, argc, argv);
        }
 
        return net_run_function(c, argc, argv, "net rpc file", func);
@@ -4939,7 +4948,7 @@ static NTSTATUS rpc_shutdown_abort_internals(struct net_context *c,
        result = rpccli_initshutdown_Abort(pipe_hnd, mem_ctx, NULL, NULL);
 
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("\nShutdown successfully aborted\n");
+               d_printf(_("\nShutdown successfully aborted\n"));
                DEBUG(5,("cmd_shutdown_abort: query succeeded\n"));
        } else
                DEBUG(5,("cmd_shutdown_abort: query failed\n"));
@@ -4978,7 +4987,7 @@ static NTSTATUS rpc_reg_shutdown_abort_internals(struct net_context *c,
        result = rpccli_winreg_AbortSystemShutdown(pipe_hnd, mem_ctx, NULL, NULL);
 
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("\nShutdown successfully aborted\n");
+               d_printf(_("\nShutdown successfully aborted\n"));
                DEBUG(5,("cmd_reg_abort_shutdown: query succeeded\n"));
        } else
                DEBUG(5,("cmd_reg_abort_shutdown: query failed\n"));
@@ -5002,9 +5011,9 @@ static int rpc_shutdown_abort(struct net_context *c, int argc,
        int rc = -1;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc abortshutdown\n"
-                        "    Abort a scheduled shutdown\n");
+               d_printf(_("Usage:\n"
+                          "net rpc abortshutdown\n"
+                          "    Abort a scheduled shutdown\n"));
                return 0;
        }
 
@@ -5048,10 +5057,9 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
                                     const char **argv)
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-        const char *msg = "This machine will be shutdown shortly";
+        const char *msg = N_("This machine will be shutdown shortly");
        uint32 timeout = 20;
-       struct initshutdown_String msg_string;
-       struct initshutdown_String_sub s;
+       struct lsa_StringLarge msg_string;
 
        if (c->opt_comment) {
                msg = c->opt_comment;
@@ -5060,8 +5068,7 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
                timeout = c->opt_timeout;
        }
 
-       s.name = msg;
-       msg_string.name = &s;
+       msg_string.string = msg;
 
        /* create an entry */
        result = rpccli_initshutdown_Init(pipe_hnd, mem_ctx, NULL,
@@ -5069,7 +5076,7 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
                        NULL);
 
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("\nShutdown of remote machine succeeded\n");
+               d_printf(_("\nShutdown of remote machine succeeded\n"));
                DEBUG(5,("Shutdown of remote machine succeeded\n"));
        } else {
                DEBUG(1,("Shutdown of remote machine failed!\n"));
@@ -5103,18 +5110,16 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
                                    int argc,
                                    const char **argv)
 {
-        const char *msg = "This machine will be shutdown shortly";
+        const char *msg = N_("This machine will be shutdown shortly");
        uint32 timeout = 20;
-       struct initshutdown_String msg_string;
-       struct initshutdown_String_sub s;
+       struct lsa_StringLarge msg_string;
        NTSTATUS result;
        WERROR werr;
 
        if (c->opt_comment) {
                msg = c->opt_comment;
        }
-       s.name = msg;
-       msg_string.name = &s;
+       msg_string.string = msg;
 
        if (c->opt_timeout) {
                timeout = c->opt_timeout;
@@ -5126,13 +5131,13 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
                        &werr);
 
        if (NT_STATUS_IS_OK(result)) {
-               d_printf("\nShutdown of remote machine succeeded\n");
+               d_printf(_("\nShutdown of remote machine succeeded\n"));
        } else {
                d_fprintf(stderr, "\nShutdown of remote machine failed\n");
                if ( W_ERROR_EQUAL(werr, WERR_MACHINE_LOCKED) )
                        d_fprintf(stderr, "\nMachine locked, use -f switch to force\n");
                else
-                       d_fprintf(stderr, "\nresult was: %s\n", dos_errstr(werr));
+                       d_fprintf(stderr, "\nresult was: %s\n", win_errstr(werr));
        }
 
        return result;
@@ -5153,9 +5158,9 @@ static int rpc_shutdown(struct net_context *c, int argc, const char **argv)
        int rc =  -1;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc shutdown\n"
-                        "    Shut down a remote RPC server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc shutdown\n"
+                          "    Shut down a remote RPC server\n"));
                return 0;
        }
 
@@ -5200,7 +5205,7 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
                                                int argc,
                                                const char **argv)
 {
-       POLICY_HND connect_pol, domain_pol, user_pol;
+       struct policy_handle connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        char *acct_name;
        struct lsa_String lsa_acct_name;
@@ -5212,8 +5217,8 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
        unsigned int orig_timeout;
 
        if (argc != 2) {
-               d_printf("Usage: net rpc trustdom add <domain_name> "
-                        "<trust password>\n");
+               d_printf(_("Usage: net rpc trustdom add <domain_name> "
+                          "<trust password>\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -5274,43 +5279,24 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
        rpccli_set_timeout(pipe_hnd, orig_timeout);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("net rpc trustdom add: create user %s failed %s\n",
+               d_printf(_("net rpc trustdom add: create user %s failed %s\n"),
                        acct_name, nt_errstr(result));
                goto done;
        }
 
        {
-               NTTIME notime;
-               struct samr_LogonHours hours;
-               struct lsa_BinaryString parameters;
-               const int units_per_week = 168;
                struct samr_CryptPassword crypt_pwd;
 
-               ZERO_STRUCT(notime);
-               ZERO_STRUCT(hours);
-               ZERO_STRUCT(parameters);
-
-               hours.bits = talloc_array(mem_ctx, uint8_t, units_per_week);
-               if (!hours.bits) {
-                       result = NT_STATUS_NO_MEMORY;
-                       goto done;
-               }
-               hours.units_per_week = units_per_week;
-               memset(hours.bits, 0xFF, units_per_week);
+               ZERO_STRUCT(info.info23);
 
                init_samr_CryptPassword(argv[1],
                                        &cli->user_session_key,
                                        &crypt_pwd);
 
-               init_samr_user_info23(&info.info23,
-                                     notime, notime, notime,
-                                     notime, notime, notime,
-                                     NULL, NULL, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, &parameters,
-                                     0, 0, ACB_DOMTRUST, SAMR_FIELD_ACCT_FLAGS,
-                                     hours,
-                                     0, 0, 0, 0, 0, 0, 0,
-                                     crypt_pwd.data, 24);
+               info.info23.info.fields_present = SAMR_FIELD_ACCT_FLAGS |
+                                                 SAMR_FIELD_NT_PASSWORD_PRESENT;
+               info.info23.info.acct_flags = ACB_DOMTRUST;
+               info.info23.password = crypt_pwd;
 
                result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
                                                  &user_pol,
@@ -5344,8 +5330,9 @@ static int rpc_trustdom_add(struct net_context *c, int argc, const char **argv)
                return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id, 0,
                                       rpc_trustdom_add_internals, argc, argv);
        } else {
-               d_printf("Usage:\n"
-                       "net rpc trustdom add <domain_name> <trust password>\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom add <domain_name> <trust "
+                          "password>\n"));
                return -1;
        }
 }
@@ -5376,7 +5363,7 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
-       POLICY_HND connect_pol, domain_pol, user_pol;
+       struct policy_handle connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        char *acct_name;
        DOM_SID trust_acct_sid;
@@ -5384,7 +5371,7 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
        struct lsa_String lsa_acct_name;
 
        if (argc != 1) {
-               d_printf("Usage: net rpc trustdom del <domain_name>\n");
+               d_printf(_("Usage: net rpc trustdom del <domain_name>\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -5427,7 +5414,8 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
                                         &name_types);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("net rpc trustdom del: LookupNames on user %s failed %s\n",
+               d_printf(_("net rpc trustdom del: LookupNames on user %s "
+                          "failed %s\n"),
                        acct_name, nt_errstr(result) );
                goto done;
        }
@@ -5439,7 +5427,8 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
                                      &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("net rpc trustdom del: OpenUser on user %s failed %s\n",
+               d_printf(_("net rpc trustdom del: OpenUser on user %s failed "
+                          "%s\n"),
                        acct_name, nt_errstr(result) );
                goto done;
        }
@@ -5456,7 +5445,8 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
                                                           &user_pol,
                                                           &trust_acct_sid);
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("net rpc trustdom del: RemoveMemberFromForeignDomain on user %s failed %s\n",
+               d_printf(_("net rpc trustdom del: RemoveMemberFromForeignDomain"
+                          " on user %s failed %s\n"),
                        acct_name, nt_errstr(result) );
                goto done;
        }
@@ -5467,13 +5457,14 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
                                        &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("net rpc trustdom del: DeleteUser on user %s failed %s\n",
+               d_printf(_("net rpc trustdom del: DeleteUser on user %s failed "
+                          "%s\n"),
                        acct_name, nt_errstr(result) );
                goto done;
        }
 
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("Could not set trust account password: %s\n",
+               d_printf(_("Could not set trust account password: %s\n"),
                   nt_errstr(result));
                goto done;
        }
@@ -5497,8 +5488,8 @@ static int rpc_trustdom_del(struct net_context *c, int argc, const char **argv)
                return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id, 0,
                                       rpc_trustdom_del_internals, argc, argv);
        } else {
-               d_printf("Usage:\n"
-                        "net rpc trustdom del <domain>\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom del <domain>\n"));
                return -1;
        }
 }
@@ -5565,7 +5556,7 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
        struct cli_state *cli = NULL;
        struct sockaddr_storage server_ss;
        struct rpc_pipe_client *pipe_hnd = NULL;
-       POLICY_HND connect_hnd;
+       struct policy_handle connect_hnd;
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
        DOM_SID *domain_sid;
@@ -5580,8 +5571,8 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
         */
 
        if (argc != 1 || c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc trustdom establish <domain_name>\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom establish <domain_name>\n"));
                return -1;
        }
 
@@ -5589,7 +5580,9 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
        strupper_m(domain_name);
 
        /* account name used at first is our domain's name with '$' */
-       asprintf(&acct_name, "%s$", lp_workgroup());
+       if (asprintf(&acct_name, "%s$", lp_workgroup()) == -1) {
+               return -1;
+       }
        strupper_m(acct_name);
 
        /*
@@ -5664,7 +5657,7 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
                return -1;
        }
 
-       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, true, SEC_RIGHTS_QUERY_VALUE,
+       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, true, KEY_QUERY_VALUE,
                                         &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't open policy handle. Error was %s\n",
@@ -5721,7 +5714,7 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
 
        talloc_destroy(mem_ctx);
 
-       d_printf("Trust to domain %s established\n", domain_name);
+       d_printf(_("Trust to domain %s established\n"), domain_name);
        return 0;
 }
 
@@ -5742,10 +5735,10 @@ static int rpc_trustdom_revoke(struct net_context *c, int argc,
        int rc = -1;
 
        if (argc < 1 || c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc trustdom revoke <domain_name>\n"
-                        "  Revoke trust relationship\n"
-                        "    domain_name\tName of domain to revoke trust\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom revoke <domain_name>\n"
+                          "  Revoke trust relationship\n"
+                          "    domain_name\tName of domain to revoke trust\n"));
                return -1;
        }
 
@@ -5799,15 +5792,16 @@ static void print_trusted_domain(DOM_SID *dom_sid, const char *trusted_dom_name)
 
 static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
                                      TALLOC_CTX *mem_ctx,
-                                     POLICY_HND *pol,
+                                     struct policy_handle *pol,
                                      DOM_SID dom_sid,
                                      const char *trusted_dom_name)
 {
        NTSTATUS nt_status;
        union lsa_TrustedDomainInfo *info = NULL;
        char *cleartextpwd = NULL;
-       uint8_t nt_hash[16];
-       DATA_BLOB data;
+       uint8_t session_key[16];
+       DATA_BLOB session_key_blob;
+       DATA_BLOB data = data_blob_null;
 
        nt_status = rpccli_lsa_QueryTrustedDomainInfoBySid(pipe_hnd, mem_ctx,
                                                           pol,
@@ -5823,12 +5817,13 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
        data = data_blob(info->password.password->data,
                         info->password.password->length);
 
-       if (!rpccli_get_pwd_hash(pipe_hnd, nt_hash)) {
+       if (!rpccli_get_pwd_hash(pipe_hnd, session_key)) {
                DEBUG(0, ("Could not retrieve password hash\n"));
                goto done;
        }
 
-       cleartextpwd = decrypt_trustdom_secret(nt_hash, &data);
+       session_key_blob = data_blob_const(session_key, sizeof(session_key));
+       cleartextpwd = sess_decrypt_string(mem_ctx, &data, &session_key_blob);
 
        if (cleartextpwd == NULL) {
                DEBUG(0,("retrieved NULL password\n"));
@@ -5865,7 +5860,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
        NTSTATUS nt_status;
        const char *domain_name = NULL;
        DOM_SID *queried_dom_sid;
-       POLICY_HND connect_hnd;
+       struct policy_handle connect_hnd;
        union lsa_PolicyInformation *info = NULL;
 
        /* trusted domains listing variables */
@@ -5875,9 +5870,9 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
        fstring pdc_name;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc trustdom vampire\n"
-                        "  Vampire trust relationship from remote server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom vampire\n"
+                          "  Vampire trust relationship from remote server\n"));
                return 0;
        }
 
@@ -5920,7 +5915,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
                return -1;
        };
 
-       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, SEC_RIGHTS_QUERY_VALUE,
+       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, KEY_QUERY_VALUE,
                                        &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't open policy handle. Error was %s\n",
@@ -5951,7 +5946,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
         * the end of enumeration is reached
         */
 
-       d_printf("Vampire trusted domains:\n\n");
+       d_printf(_("Vampire trusted domains:\n\n"));
 
        do {
                nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
@@ -5986,7 +5981,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
                 * in case of no trusted domains say something rather
                 * than just display blank line
                 */
-               if (!dom_list.count) d_printf("none\n");
+               if (!dom_list.count) d_printf(_("none\n"));
 
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
@@ -6018,7 +6013,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
        DOM_SID *queried_dom_sid;
        fstring padding;
        int ascii_dom_name_len;
-       POLICY_HND connect_hnd;
+       struct policy_handle connect_hnd;
        union lsa_PolicyInformation *info = NULL;
 
        /* trusted domains listing variables */
@@ -6028,13 +6023,13 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
        fstring pdc_name;
 
        /* trusting domains listing variables */
-       POLICY_HND domain_hnd;
+       struct policy_handle domain_hnd;
        struct samr_SamArray *trusts = NULL;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc trustdom list\n"
-                        "    List trust relationships\n");
+               d_printf(_("Usage:\n"
+                          "net rpc trustdom list\n"
+                          "    List in- and outgoing trust relationships\n"));
                return 0;
        }
 
@@ -6077,7 +6072,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
                return -1;
        };
 
-       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, SEC_RIGHTS_QUERY_VALUE,
+       nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, KEY_QUERY_VALUE,
                                        &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0, ("Couldn't open policy handle. Error was %s\n",
@@ -6108,7 +6103,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
         * the end of enumeration is reached
         */
         
-       d_printf("Trusted domains list:\n\n");
+       d_printf(_("Trusted domains list:\n\n"));
 
        do {
                nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
@@ -6133,7 +6128,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
                 * in case of no trusted domains say something rather
                 * than just display blank line
                 */
-               if (!dom_list.count) d_printf("none\n");
+               if (!dom_list.count) d_printf(_("none\n"));
 
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
@@ -6153,7 +6148,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
         * Listing trusting domains (stored in passdb backend, if local)
         */
        
-       d_printf("\nTrusting domains list:\n\n");
+       d_printf(_("\nTrusting domains list:\n\n"));
 
        /*
         * Open \PIPE\samr and get needed policy handles
@@ -6170,7 +6165,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
        /* SamrConnect2 */
        nt_status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
                                         pipe_hnd->desthost,
-                                        SA_RIGHT_SAM_OPEN_DOMAIN,
+                                        SAMR_ACCESS_LOOKUP_DOMAIN,
                                         &connect_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't open SAMR policy handle. Error was %s\n",
@@ -6184,7 +6179,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
           able to enumerate accounts*/
        nt_status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
                                           &connect_hnd,
-                                          SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+                                          SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS,
                                           queried_dom_sid,
                                           &domain_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
@@ -6255,13 +6250,14 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
                                            &ndr_table_lsarpc.syntax_id, 0,
                                            rpc_query_domain_sid, argc,
                                            argv))
-                                       d_fprintf(stderr, "couldn't get domain's sid\n");
+                                       d_fprintf(stderr,
+                                             _("couldn't get domain's sid\n"));
 
                                cli_shutdown(remote_cli);
 
                        } else {
-                               d_fprintf(stderr, "domain controller is not "
-                                         "responding: %s\n",
+                               d_fprintf(stderr, _("domain controller is not "
+                                         "responding: %s\n"),
                                          nt_errstr(nt_status));
                        };
                };
@@ -6304,49 +6300,49 @@ static int rpc_trustdom(struct net_context *c, int argc, const char **argv)
                        "add",
                        rpc_trustdom_add,
                        NET_TRANSPORT_RPC,
-                       "Add trusted domain's account",
-                       "net rpc trustdom add\n"
-                       "    Add trusted domain's account"
+                       N_("Add trusting domain's account"),
+                       N_("net rpc trustdom add\n"
+                          "    Add trusting domain's account")
                },
                {
                        "del",
                        rpc_trustdom_del,
                        NET_TRANSPORT_RPC,
-                       "Remove trusted domain's account",
-                       "net rpc trustdom del\n"
-                       "    Remove trusted domain's account"
+                       N_("Remove trusting domain's account"),
+                       N_("net rpc trustdom del\n"
+                          "    Remove trusting domain's account")
                },
                {
                        "establish",
                        rpc_trustdom_establish,
                        NET_TRANSPORT_RPC,
-                       "Establish trust relationship",
-                       "net rpc trustdom establish\n"
-                       "    Establish trust relationship"
+                       N_("Establish outgoing trust relationship"),
+                       N_("net rpc trustdom establish\n"
+                          "    Establish outgoing trust relationship")
                },
                {
                        "revoke",
                        rpc_trustdom_revoke,
                        NET_TRANSPORT_RPC,
-                       "Revoke trust relationship",
-                       "net rpc trustdom revoke\n"
-                       "    Revoke trust relationship"
+                       N_("Revoke outgoing trust relationship"),
+                       N_("net rpc trustdom revoke\n"
+                          "    Revoke outgoing trust relationship")
                },
                {
                        "list",
                        rpc_trustdom_list,
                        NET_TRANSPORT_RPC,
-                       "List domain trusts",
-                       "net rpc trustdom list\n"
-                       "    List domain trusts"
+                       N_("List in- and outgoing domain trusts"),
+                       N_("net rpc trustdom list\n"
+                          "    List in- and outgoing domain trusts")
                },
                {
                        "vampire",
                        rpc_trustdom_vampire,
                        NET_TRANSPORT_RPC,
-                       "Vampire trusts from remote server",
-                       "net rpc trustdom vampire\n"
-                       "    Vampire trusts from remote server"
+                       N_("Vampire trusts from remote server"),
+                       N_("net rpc trustdom vampire\n"
+                          "    Vampire trusts from remote server")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -6382,7 +6378,8 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
        if (!attempt_netbios_session_request(&cli, global_myname(),
                                             server_name, &server_ss))
                goto done;
-       if (!cli_negprot(cli))
+       status = cli_negprot(cli);
+       if (!NT_STATUS_IS_OK(status))
                goto done;
        if (cli->protocol < PROTOCOL_NT1)
                goto done;
@@ -6396,9 +6393,9 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
 /* dump sam database via samsync rpc calls */
 static int rpc_samdump(struct net_context *c, int argc, const char **argv) {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc samdump\n"
-                        "    Dump remote SAM database\n");
+               d_printf(_("Usage:\n"
+                          "net rpc samdump\n"
+                          "    Dump remote SAM database\n"));
                return 0;
        }
 
@@ -6415,17 +6412,27 @@ static int rpc_vampire(struct net_context *c, int argc, const char **argv)
                        "ldif",
                        rpc_vampire_ldif,
                        NET_TRANSPORT_RPC,
-                       "Dump remote SAM database to ldif",
-                       "net rpc vampire ldif\n"
-                       "    Dump remote SAM database to LDIF file or stdout"
+                       N_("Dump remote SAM database to ldif"),
+                       N_("net rpc vampire ldif\n"
+                          "    Dump remote SAM database to LDIF file or "
+                          "stdout")
                },
                {
                        "keytab",
                        rpc_vampire_keytab,
                        NET_TRANSPORT_RPC,
-                       "Dump remote SAM database to Kerberos Keytab",
-                       "net rpc vampire keytab\n"
-                       "    Dump remote SAM database to Kerberos keytab file"
+                       N_("Dump remote SAM database to Kerberos Keytab"),
+                       N_("net rpc vampire keytab\n"
+                          "    Dump remote SAM database to Kerberos keytab "
+                          "file")
+               },
+               {
+                       "passdb",
+                       rpc_vampire_passdb,
+                       NET_TRANSPORT_RPC,
+                       N_("Dump remote SAM database to passdb"),
+                       N_("net rpc vampire passdb\n"
+                          "    Dump remote SAM database to passdb")
                },
 
                {NULL, NULL, 0, NULL, NULL}
@@ -6433,9 +6440,9 @@ static int rpc_vampire(struct net_context *c, int argc, const char **argv)
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n"
-                                "net rpc vampire\n"
-                                "    Vampire remote SAM database\n");
+                       d_printf(_("Usage:\n"
+                                  "net rpc vampire\n"
+                                  "    Vampire remote SAM database\n"));
                        return 0;
                }
 
@@ -6469,41 +6476,41 @@ static int rpc_printer_migrate_all(struct net_context *c, int argc,
        int ret;
 
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate all\n"
-                        "    Migrate everything from a print server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate all\n"
+                          "    Migrate everything from a print server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                              rpc_printer_migrate_printers_internals, argc,
                              argv);
        if (ret)
                return ret;
 
-       ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                              rpc_printer_migrate_drivers_internals, argc,
                              argv);
        if (ret)
                return ret;
 
-       ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                              rpc_printer_migrate_forms_internals, argc, argv);
        if (ret)
                return ret;
 
-       ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                              rpc_printer_migrate_settings_internals, argc,
                              argv);
        if (ret)
                return ret;
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_security_internals, argc,
                               argv);
 
@@ -6523,18 +6530,18 @@ static int rpc_printer_migrate_drivers(struct net_context *c, int argc,
                                       const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate drivers\n"
-                        "     Migrate print-drivers from a print-server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate drivers\n"
+                          "     Migrate print-drivers from a print-server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_drivers_internals,
                               argc, argv);
 }
@@ -6553,18 +6560,18 @@ static int rpc_printer_migrate_forms(struct net_context *c, int argc,
                                     const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate forms\n"
-                        "    Migrate print-forms from a print-server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate forms\n"
+                          "    Migrate print-forms from a print-server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_forms_internals,
                               argc, argv);
 }
@@ -6583,18 +6590,18 @@ static int rpc_printer_migrate_printers(struct net_context *c, int argc,
                                        const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate printers\n"
-                        "    Migrate printers from a print-server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate printers\n"
+                          "    Migrate printers from a print-server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_printers_internals,
                               argc, argv);
 }
@@ -6613,18 +6620,18 @@ static int rpc_printer_migrate_security(struct net_context *c, int argc,
                                        const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate security\n"
-                        "    Migrate printer-ACLs from a print-server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate security\n"
+                          "    Migrate printer-ACLs from a print-server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_security_internals,
                               argc, argv);
 }
@@ -6643,18 +6650,19 @@ static int rpc_printer_migrate_settings(struct net_context *c, int argc,
                                        const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer migrate settings\n"
-                        "    Migrate printer-settings from a print-server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer migrate settings\n"
+                           "    Migrate printer-settings from a "
+                           "print-server\n"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_migrate_settings_internals,
                               argc, argv);
 }
@@ -6680,49 +6688,49 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv)
                        "all",
                        rpc_printer_migrate_all,
                        NET_TRANSPORT_RPC,
-                       "Migrate all from remote to local print server",
-                       "net rpc printer migrate all\n"
-                       "    Migrate all from remote to local print server"
+                       N_("Migrate all from remote to local print server"),
+                       N_("net rpc printer migrate all\n"
+                          "    Migrate all from remote to local print server")
                },
                {
                        "drivers",
                        rpc_printer_migrate_drivers,
                        NET_TRANSPORT_RPC,
-                       "Migrate drivers to local server",
-                       "net rpc printer migrate drivers\n"
-                       "    Migrate drivers to local server"
+                       N_("Migrate drivers to local server"),
+                       N_("net rpc printer migrate drivers\n"
+                          "    Migrate drivers to local server")
                },
                {
                        "forms",
                        rpc_printer_migrate_forms,
                        NET_TRANSPORT_RPC,
-                       "Migrate froms to local server",
-                       "net rpc printer migrate forms\n"
-                       "    Migrate froms to local server"
+                       N_("Migrate froms to local server"),
+                       N_("net rpc printer migrate forms\n"
+                          "    Migrate froms to local server")
                },
                {
                        "printers",
                        rpc_printer_migrate_printers,
                        NET_TRANSPORT_RPC,
-                       "Migrate printers to local server",
-                       "net rpc printer migrate printers\n"
-                       "    Migrate printers to local server"
+                       N_("Migrate printers to local server"),
+                       N_("net rpc printer migrate printers\n"
+                          "    Migrate printers to local server")
                },
                {
                        "security",
                        rpc_printer_migrate_security,
                        NET_TRANSPORT_RPC,
-                       "Mirgate printer ACLs to local server",
-                       "net rpc printer migrate security\n"
-                       "    Mirgate printer ACLs to local server"
+                       N_("Mirgate printer ACLs to local server"),
+                       N_("net rpc printer migrate security\n"
+                          "    Mirgate printer ACLs to local server")
                },
                {
                        "settings",
                        rpc_printer_migrate_settings,
                        NET_TRANSPORT_RPC,
-                       "Migrate printer settings to local server",
-                       "net rpc printer migrate settings\n"
-                       "    Migrate printer settings to local server"
+                       N_("Migrate printer settings to local server"),
+                       N_("net rpc printer migrate settings\n"
+                          "    Migrate printer settings to local server")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -6744,13 +6752,13 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv)
 static int rpc_printer_list(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer list\n"
-                        "    List printers on a remote RPC server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer list\n"
+                          "    List printers on a remote RPC server\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_list_internals,
                               argc, argv);
 }
@@ -6769,13 +6777,13 @@ static int rpc_printer_driver_list(struct net_context *c, int argc,
                                   const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer driver\n"
-                        "    List printer-drivers on a remote RPC server\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer driver\n"
+                          "    List printer-drivers on a remote RPC server\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_driver_list_internals,
                               argc, argv);
 }
@@ -6794,13 +6802,13 @@ static int rpc_printer_publish_publish(struct net_context *c, int argc,
                                       const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer publish publish\n"
-                        "     Publish printer in ADS via MSRPC\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer publish publish\n"
+                          "     Publish printer in ADS via MSRPC\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_publish_publish_internals,
                               argc, argv);
 }
@@ -6818,13 +6826,13 @@ static int rpc_printer_publish_publish(struct net_context *c, int argc,
 static int rpc_printer_publish_update(struct net_context *c, int argc, const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer publish update\n"
-                        "    Update printer in ADS via MSRPC\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer publish update\n"
+                          "    Update printer in ADS via MSRPC\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_publish_update_internals,
                               argc, argv);
 }
@@ -6843,13 +6851,13 @@ static int rpc_printer_publish_unpublish(struct net_context *c, int argc,
                                         const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer publish unpublish\n"
-                        "    UnPublish printer in ADS via MSRPC\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer publish unpublish\n"
+                          "    UnPublish printer in ADS via MSRPC\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_publish_unpublish_internals,
                               argc, argv);
 }
@@ -6868,13 +6876,13 @@ static int rpc_printer_publish_list(struct net_context *c, int argc,
                                    const char **argv)
 {
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc printer publish list\n"
-                        "    List published printers via MSRPC\n");
+               d_printf(_("Usage:\n"
+                          "net rpc printer publish list\n"
+                          "    List published printers via MSRPC\n"));
                return 0;
        }
 
-       return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+       return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_publish_list_internals,
                               argc, argv);
 }
@@ -6899,47 +6907,48 @@ static int rpc_printer_publish(struct net_context *c, int argc,
                        "publish",
                        rpc_printer_publish_publish,
                        NET_TRANSPORT_RPC,
-                       "Publish printer in AD",
-                       "net rpc printer publish publish\n"
-                       "    Publish printer in AD"
+                       N_("Publish printer in AD"),
+                       N_("net rpc printer publish publish\n"
+                          "    Publish printer in AD")
                },
                {
                        "update",
                        rpc_printer_publish_update,
                        NET_TRANSPORT_RPC,
-                       "Update printer in AD",
-                       "net rpc printer publish update\n"
-                       "    Update printer in AD"
+                       N_("Update printer in AD"),
+                       N_("net rpc printer publish update\n"
+                          "    Update printer in AD")
                },
                {
                        "unpublish",
                        rpc_printer_publish_unpublish,
                        NET_TRANSPORT_RPC,
-                       "Unpublish printer",
-                       "net rpc printer publish unpublish\n"
-                       "    Unpublish printer"
+                       N_("Unpublish printer"),
+                       N_("net rpc printer publish unpublish\n"
+                          "    Unpublish printer")
                },
                {
                        "list",
                        rpc_printer_publish_list,
                        NET_TRANSPORT_RPC,
-                       "List published printers",
-                       "net rpc printer publish list\n"
-                       "    List published printers"
+                       N_("List published printers"),
+                       N_("net rpc printer publish list\n"
+                          "    List published printers")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n");
-                       d_printf("net rpc printer publish\n"
-                                "    List published printers\n"
-                                "    Alias of net rpc printer publish list\n");
+                       d_printf(_("Usage:\n"));
+                       d_printf(_("net rpc printer publish\n"
+                                  "    List published printers\n"
+                                  "    Alias of net rpc printer publish "
+                                  "list\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
-               return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+               return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_publish_list_internals,
                               argc, argv);
        }
@@ -6959,31 +6968,31 @@ static int rpc_printer_publish(struct net_context *c, int argc,
  **/
 int rpc_printer_usage(struct net_context *c, int argc, const char **argv)
 {
-       d_printf("net rpc printer LIST [printer] [misc. options] [targets]\n"
-                "\tlists all printers on print-server\n\n");
-       d_printf("net rpc printer DRIVER [printer] [misc. options] [targets]\n"
-                "\tlists all printer-drivers on print-server\n\n");
-       d_printf("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"
-                "\tpublishes printer settings in Active Directory\n"
-                "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n");
-       d_printf("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"
-                "\n\tmigrates printers from remote to local server\n\n");
-       d_printf("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"
-                "\n\tmigrates printer-settings from remote to local server\n\n");
-       d_printf("net rpc printer MIGRATE DRIVERS [printer] [misc. options] [targets]"
-                "\n\tmigrates printer-drivers from remote to local server\n\n");
-       d_printf("net rpc printer MIGRATE FORMS [printer] [misc. options] [targets]"
-                "\n\tmigrates printer-forms from remote to local server\n\n");
-       d_printf("net rpc printer MIGRATE SECURITY [printer] [misc. options] [targets]"
-                "\n\tmigrates printer-ACLs from remote to local server\n\n");
-       d_printf("net rpc printer MIGRATE ALL [printer] [misc. options] [targets]"
-                "\n\tmigrates drivers, forms, queues, settings and acls from\n"
-                "\tremote to local print-server\n\n");
+       d_printf(_("net rpc printer LIST [printer] [misc. options] [targets]\n"
+                  "\tlists all printers on print-server\n\n"));
+       d_printf(_("net rpc printer DRIVER [printer] [misc. options] [targets]\n"
+                  "\tlists all printer-drivers on print-server\n\n"));
+       d_printf(_("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"
+                  "\tpublishes printer settings in Active Directory\n"
+                  "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n"));
+       d_printf(_("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"
+                  "\n\tmigrates printers from remote to local server\n\n"));
+       d_printf(_("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"
+                  "\n\tmigrates printer-settings from remote to local server\n\n"));
+       d_printf(_("net rpc printer MIGRATE DRIVERS [printer] [misc. options] [targets]"
+                  "\n\tmigrates printer-drivers from remote to local server\n\n"));
+       d_printf(_("net rpc printer MIGRATE FORMS [printer] [misc. options] [targets]"
+                  "\n\tmigrates printer-forms from remote to local server\n\n"));
+       d_printf(_("net rpc printer MIGRATE SECURITY [printer] [misc. options] [targets]"
+                  "\n\tmigrates printer-ACLs from remote to local server\n\n"));
+       d_printf(_("net rpc printer MIGRATE ALL [printer] [misc. options] [targets]"
+                  "\n\tmigrates drivers, forms, queues, settings and acls from\n"
+                  "\tremote to local print-server\n\n"));
        net_common_methods_usage(c, argc, argv);
        net_common_flags_usage(c, argc, argv);
-       d_printf(
+       d_printf(_(
         "\t-v or --verbose\t\t\tgive verbose output\n"
-        "\t      --destination\t\tmigration target server (default: localhost)\n");
+        "\t      --destination\t\tmigration target server (default: localhost)\n"));
 
        return -1;
 }
@@ -7003,46 +7012,46 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv)
                        "list",
                        rpc_printer_list,
                        NET_TRANSPORT_RPC,
-                       "List all printers on print server",
-                       "net rpc printer list\n"
-                       "    List all printers on print server"
+                       N_("List all printers on print server"),
+                       N_("net rpc printer list\n"
+                          "    List all printers on print server")
                },
                {
                        "migrate",
                        rpc_printer_migrate,
                        NET_TRANSPORT_RPC,
-                       "Migrate printer to local server",
-                       "net rpc printer migrate\n"
-                       "    Migrate printer to local server"
+                       N_("Migrate printer to local server"),
+                       N_("net rpc printer migrate\n"
+                          "    Migrate printer to local server")
                },
                {
                        "driver",
                        rpc_printer_driver_list,
                        NET_TRANSPORT_RPC,
-                       "List printer drivers",
-                       "net rpc printer driver\n"
-                       "    List printer drivers"
+                       N_("List printer drivers"),
+                       N_("net rpc printer driver\n"
+                          "    List printer drivers")
                },
                {
                        "publish",
                        rpc_printer_publish,
                        NET_TRANSPORT_RPC,
-                       "Publish printer in AD",
-                       "net rpc printer publish\n"
-                       "    Publish printer in AD"
+                       N_("Publish printer in AD"),
+                       N_("net rpc printer publish\n"
+                          "    Publish printer in AD")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
 
        if (argc == 0) {
                if (c->display_usage) {
-                       d_printf("Usage:\n");
-                       d_printf("net rpc printer\n"
-                                "    List printers\n");
+                       d_printf(_("Usage:\n"));
+                       d_printf(_("net rpc printer\n"
+                                  "    List printers\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
-               return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+               return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
                               rpc_printer_list_internals,
                               argc, argv);
        }
@@ -7061,185 +7070,198 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv)
 
 int net_rpc(struct net_context *c, int argc, const char **argv)
 {
+       NET_API_STATUS status;
+
        struct functable func[] = {
                {
                        "audit",
                        net_rpc_audit,
                        NET_TRANSPORT_RPC,
-                       "Modify global audit settings",
-                       "net rpc audit\n"
-                       "    Modify global audit settings"
+                       N_("Modify global audit settings"),
+                       N_("net rpc audit\n"
+                          "    Modify global audit settings")
                },
                {
                        "info",
                        net_rpc_info,
                        NET_TRANSPORT_RPC,
-                       "Show basic info about a domain",
-                       "net rpc info\n"
-                       "    Show basic info about a domain"
+                       N_("Show basic info about a domain"),
+                       N_("net rpc info\n"
+                          "    Show basic info about a domain")
                },
                {
                        "join",
                        net_rpc_join,
                        NET_TRANSPORT_RPC,
-                       "Join a domain",
-                       "net rpc join\n"
-                       "    Join a domain"
+                       N_("Join a domain"),
+                       N_("net rpc join\n"
+                          "    Join a domain")
                },
                {
                        "oldjoin",
                        net_rpc_oldjoin,
                        NET_TRANSPORT_RPC,
-                       "Join a domain created in server manager",
-                       "net rpc oldjoin\n"
-                       "    Join a domain created in server manager"
+                       N_("Join a domain created in server manager"),
+                       N_("net rpc oldjoin\n"
+                          "    Join a domain created in server manager")
                },
                {
                        "testjoin",
                        net_rpc_testjoin,
                        NET_TRANSPORT_RPC,
-                       "Test that a join is valid",
-                       "net rpc testjoin\n"
-                       "    Test that a join is valid"
+                       N_("Test that a join is valid"),
+                       N_("net rpc testjoin\n"
+                          "    Test that a join is valid")
                },
                {
                        "user",
                        net_rpc_user,
                        NET_TRANSPORT_RPC,
-                       "List/modify users",
-                       "net rpc user\n"
-                       "    List/modify users"
+                       N_("List/modify users"),
+                       N_("net rpc user\n"
+                          "    List/modify users")
                },
                {
                        "password",
                        rpc_user_password,
                        NET_TRANSPORT_RPC,
-                       "Change a user password",
-                       "net rpc password\n"
-                       "    Change a user password\n"
-                       "    Alias for net rpc user password"
+                       N_("Change a user password"),
+                       N_("net rpc password\n"
+                          "    Change a user password\n"
+                          "    Alias for net rpc user password")
                },
                {
                        "group",
                        net_rpc_group,
                        NET_TRANSPORT_RPC,
-                       "List/modify groups",
-                       "net rpc group\n"
-                       "    List/modify groups"
+                       N_("List/modify groups"),
+                       N_("net rpc group\n"
+                          "    List/modify groups")
                },
                {
                        "share",
                        net_rpc_share,
                        NET_TRANSPORT_RPC,
-                       "List/modify shares",
-                       "net rpc share\n"
-                       "    List/modify shares"
+                       N_("List/modify shares"),
+                       N_("net rpc share\n"
+                          "    List/modify shares")
                },
                {
                        "file",
                        net_rpc_file,
                        NET_TRANSPORT_RPC,
-                       "List open files",
-                       "net rpc file\n"
-                       "    List open files"
+                       N_("List open files"),
+                       N_("net rpc file\n"
+                          "    List open files")
                },
                {
                        "printer",
                        net_rpc_printer,
                        NET_TRANSPORT_RPC,
-                       "List/modify printers",
-                       "net rpc printer\n"
-                       "    List/modify printers"
+                       N_("List/modify printers"),
+                       N_("net rpc printer\n"
+                          "    List/modify printers")
                },
                {
                        "changetrustpw",
                        net_rpc_changetrustpw,
                        NET_TRANSPORT_RPC,
-                       "Change trust account password",
-                       "net rpc changetrustpw\n"
-                       "    Change trust account password"
+                       N_("Change trust account password"),
+                       N_("net rpc changetrustpw\n"
+                          "    Change trust account password")
                },
                {
                        "trustdom",
                        rpc_trustdom,
                        NET_TRANSPORT_RPC,
-                       "Modify domain trusts",
-                       "net rpc trustdom\n"
-                       "    Modify domain trusts"
+                       N_("Modify domain trusts"),
+                       N_("net rpc trustdom\n"
+                          "    Modify domain trusts")
                },
                {
                        "abortshutdown",
                        rpc_shutdown_abort,
                        NET_TRANSPORT_RPC,
-                       "Abort a remote shutdown",
-                       "net rpc abortshutdown\n"
-                       "    Abort a remote shutdown"
+                       N_("Abort a remote shutdown"),
+                       N_("net rpc abortshutdown\n"
+                          "    Abort a remote shutdown")
                },
                {
                        "shutdown",
                        rpc_shutdown,
                        NET_TRANSPORT_RPC,
-                       "Shutdown a remote server",
-                       "net rpc shutdown\n"
-                       "    Shutdown a remote server"
+                       N_("Shutdown a remote server"),
+                       N_("net rpc shutdown\n"
+                          "    Shutdown a remote server")
                },
                {
                        "samdump",
                        rpc_samdump,
                        NET_TRANSPORT_RPC,
-                       "Dump SAM data of remote NT PDC",
-                       "net rpc samdump\n"
-                       "    Dump SAM data of remote NT PDC"
+                       N_("Dump SAM data of remote NT PDC"),
+                       N_("net rpc samdump\n"
+                          "    Dump SAM data of remote NT PDC")
                },
                {
                        "vampire",
                        rpc_vampire,
                        NET_TRANSPORT_RPC,
-                       "Sync a remote NT PDC's data into local passdb",
-                       "net rpc vampire\n"
-                       "    Sync a remote NT PDC's data into local passdb"
+                       N_("Sync a remote NT PDC's data into local passdb"),
+                       N_("net rpc vampire\n"
+                          "    Sync a remote NT PDC's data into local passdb")
                },
                {
                        "getsid",
                        net_rpc_getsid,
                        NET_TRANSPORT_RPC,
-                       "Fetch the domain sid into local secrets.tdb",
-                       "net rpc getsid\n"
-                       "    Fetch the domain sid into local secrets.tdb"
+                       N_("Fetch the domain sid into local secrets.tdb"),
+                       N_("net rpc getsid\n"
+                          "    Fetch the domain sid into local secrets.tdb")
                },
                {
                        "rights",
                        net_rpc_rights,
                        NET_TRANSPORT_RPC,
-                       "Manage privileges assigned to SID",
-                       "net rpc rights\n"
-                       "    Manage privileges assigned to SID"
+                       N_("Manage privileges assigned to SID"),
+                       N_("net rpc rights\n"
+                          "    Manage privileges assigned to SID")
                },
                {
                        "service",
                        net_rpc_service,
                        NET_TRANSPORT_RPC,
-                       "Start/stop/query remote services",
-                       "net rpc service\n"
-                       "    Start/stop/query remote services"
+                       N_("Start/stop/query remote services"),
+                       N_("net rpc service\n"
+                          "    Start/stop/query remote services")
                },
                {
                        "registry",
                        net_rpc_registry,
                        NET_TRANSPORT_RPC,
-                       "Manage registry hives",
-                       "net rpc registry\n"
-                       "    Manage registry hives"
+                       N_("Manage registry hives"),
+                       N_("net rpc registry\n"
+                          "    Manage registry hives")
                },
                {
                        "shell",
                        net_rpc_shell,
                        NET_TRANSPORT_RPC,
-                       "Open interactive shell on remote server",
-                       "net rpc shell\n"
-                       "    Open interactive shell on remote server"
+                       N_("Open interactive shell on remote server"),
+                       N_("net rpc shell\n"
+                          "    Open interactive shell on remote server")
                },
                {NULL, NULL, 0, NULL, NULL}
        };
+
+       status = libnetapi_init(&c->netapi_ctx);
+       if (status != 0) {
+               return -1;
+       }
+       libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
+       libnetapi_set_password(c->netapi_ctx, c->opt_password);
+       if (c->opt_kerberos) {
+               libnetapi_set_use_kerberos(c->netapi_ctx);
+       }
+
        return net_run_function(c, argc, argv, "net rpc", func);
 }