s3: fix a typo
[kai/samba.git] / source3 / utils / net_rpc.c
index 845ceca57356cf1f1909f370f7c2bfd87a2c825e..8e2cbd1b2e0a09ab7554728886dacdce41beffbb 100644 (file)
 #include "includes.h"
 #include "utils/net.h"
 #include "../libcli/auth/libcli_auth.h"
+#include "../librpc/gen_ndr/cli_samr.h"
+#include "rpc_client/cli_samr.h"
+#include "rpc_client/init_samr.h"
+#include "../librpc/gen_ndr/cli_lsa.h"
+#include "rpc_client/cli_lsarpc.h"
+#include "../librpc/gen_ndr/cli_netlogon.h"
+#include "../librpc/gen_ndr/cli_srvsvc.h"
+#include "../librpc/gen_ndr/cli_spoolss.h"
+#include "../librpc/gen_ndr/cli_initshutdown.h"
+#include "../librpc/gen_ndr/cli_winreg.h"
 
 static int net_mode_share;
 static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
@@ -52,7 +62,7 @@ static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
  **/
 
 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
-                                  DOM_SID **domain_sid,
+                                  struct dom_sid **domain_sid,
                                   const char **domain_name)
 {
        struct rpc_pipe_client *lsa_pipe = NULL;
@@ -63,7 +73,7 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
        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;
        }
 
@@ -71,7 +81,8 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                                     SEC_FLAG_MAXIMUM_ALLOWED,
                                     &pol);
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "open_policy failed: %s\n",
+               d_fprintf(stderr, "open_policy %s: %s\n",
+                         _("failed"),
                          nt_errstr(result));
                return result;
        }
@@ -81,7 +92,8 @@ 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 %s: %s\n",
+                         _("failed"),
                          nt_errstr(result));
                return result;
        }
@@ -119,7 +131,7 @@ int run_rpc_command(struct net_context *c,
        struct rpc_pipe_client *pipe_hnd = NULL;
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
-       DOM_SID *domain_sid;
+       struct dom_sid *domain_sid;
        const char *domain_name;
        int ret = -1;
 
@@ -158,8 +170,8 @@ 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",
@@ -170,7 +182,9 @@ int run_rpc_command(struct net_context *c,
                        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 {
@@ -180,7 +194,8 @@ 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",
-                                       get_pipe_name_from_iface(interface),
+                                         get_pipe_name_from_syntax(
+                                                 talloc_tos(), interface),
                                        nt_errstr(nt_status) ));
                                goto fail;
                        }
@@ -229,7 +244,7 @@ fail:
  **/
 
 static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -237,8 +252,16 @@ static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
+       NTSTATUS status;
 
-       return trust_pw_find_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup);
+       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 NT_STATUS_OK;
 }
 
 /**
@@ -254,9 +277,11 @@ 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(  "%s\n"
+                          "net rpc changetrustpw\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Change the machine trust password"));
                return 0;
        }
 
@@ -287,7 +312,7 @@ int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -299,7 +324,7 @@ static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
        fstring trust_passwd;
        unsigned char orig_trust_passwd_hash[16];
        NTSTATUS result;
-       uint32 sec_channel_type;
+       enum netr_SchannelType sec_channel_type;
 
        result = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
                                          &pipe_hnd);
@@ -334,11 +359,12 @@ static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
        E_md4hash(trust_passwd, orig_trust_passwd_hash);
 
        result = trust_pw_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup,
+                                             global_myname(),
                                              orig_trust_passwd_hash,
                                              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)) {
@@ -384,16 +410,18 @@ 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(  "%s\n"
+                          "net rpc oldjoin\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Join a domain the old way"));
                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;
@@ -414,27 +442,28 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("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;
        }
@@ -462,7 +491,7 @@ int net_rpc_join(struct net_context *c, int argc, const char **argv)
  **/
 
 NTSTATUS rpc_info_internals(struct net_context *c,
-                       const DOM_SID *domain_sid,
+                       const struct dom_sid *domain_sid,
                        const char *domain_name,
                        struct cli_state *cli,
                        struct rpc_pipe_client *pipe_hnd,
@@ -483,7 +512,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;
        }
 
@@ -494,7 +524,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;
        }
 
@@ -503,13 +534,14 @@ NTSTATUS rpc_info_internals(struct net_context *c,
                                             2,
                                             &info);
        if (NT_STATUS_IS_OK(result)) {
-               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",
+               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);
+               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:
@@ -526,9 +558,11 @@ 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(  "%s\n"
+                          "net rpc info\n"
+                          "  %s\n",
+                        _("Usage:"),
+                        _("Display information about the domain"));
                return 0;
        }
 
@@ -554,7 +588,7 @@ int net_rpc_info(struct net_context *c, int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_getsid_internals(struct net_context *c,
-                       const DOM_SID *domain_sid,
+                       const struct dom_sid *domain_sid,
                        const char *domain_name,
                        struct cli_state *cli,
                        struct rpc_pipe_client *pipe_hnd,
@@ -565,7 +599,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)) {
@@ -585,15 +619,23 @@ static NTSTATUS rpc_getsid_internals(struct net_context *c,
 
 int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
 {
+       int conn_flags = NET_FLAGS_PDC;
+
+       if (!c->opt_user_specified) {
+               conn_flags |= NET_FLAGS_ANONYMOUS;
+       }
+
        if (c->display_usage) {
-               d_printf("Usage:\n"
-                        "net rpc getsid\n"
-                        "    Fetch domain SID into local secrets.tdb\n");
+               d_printf(  "%s\n"
+                          "net rpc getsid\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Fetch domain SID into local secrets.tdb"));
                return 0;
        }
 
        return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id,
-                              NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+                              conn_flags,
                               rpc_getsid_internals,
                               argc, argv);
 }
@@ -643,12 +685,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;
@@ -680,13 +722,65 @@ 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;
+}
+
+/**
+ * Set a user's primary group
+ *
+ * @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_user_setprimarygroup(struct net_context *c, int argc,
+                                   const char **argv)
+{
+       NET_API_STATUS status;
+       uint8_t *buffer;
+       struct GROUP_INFO_2 *g2;
+       struct USER_INFO_1051 u1051;
+       uint32_t parm_err = 0;
+
+       if (argc != 2 || c->display_usage) {
+               rpc_user_usage(c, argc, argv);
+               return 0;
        }
 
+       status = NetGroupGetInfo(c->opt_host, argv[1], 2, &buffer);
+       if (status) {
+               d_fprintf(stderr, _("Failed to find group name %s -- %s\n"),
+                         argv[1],
+                         libnetapi_get_error_string(c->netapi_ctx, status));
+               return status;
+       }
+       g2 = (struct GROUP_INFO_2 *)buffer;
+
+       u1051.usri1051_primary_group_id = g2->grpi2_group_id;
+
+       NetApiBufferFree(buffer);
+
+       status = NetUserSetInfo(c->opt_host, argv[0], 1051,
+                               (uint8_t *)&u1051, &parm_err);
+       if (status) {
+               d_fprintf(stderr,
+                         _("Failed to set user's primary group %s to %s - "
+                           "%s\n"), argv[0], argv[1],
+                         libnetapi_get_error_string(c->netapi_ctx, status));
+       } else {
+               d_printf(_("Set primary group of user %s to %s\n"), argv[0],
+                        argv[1]);
+       }
        return status;
 }
 
@@ -712,12 +806,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;
@@ -739,6 +833,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);
@@ -748,18 +843,24 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
        if (argv[1]) {
                u1003.usri1003_password = argv[1];
        } else {
-               if (asprintf(&prompt, "Enter new password for %s:", argv[0]) == -1) {
+               ret = asprintf(&prompt, _("Enter new password for %s:"),
+                              argv[0]);
+               if (ret == -1) {
                        return -1;
                }
-               u1003.usri1003_password = getpass(prompt);
+               u1003.usri1003_password = talloc_strdup(c, getpass(prompt));
                SAFE_FREE(prompt);
+               if (u1003.usri1003_password == NULL) {
+                       return -1;
+               }
        }
 
        status = NetUserSetInfo(c->opt_host, argv[0], 1003, (uint8_t *)&u1003, &parm_err);
 
        /* 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;
@@ -801,7 +902,8 @@ static int rpc_user_info(struct net_context *c, int argc, const char **argv)
                                  &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;
@@ -840,8 +942,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;
 
@@ -897,41 +999,49 @@ 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"
+                          "    List 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")
+               },
+               {
+                       "setprimarygroup",
+                       rpc_user_setprimarygroup,
+                       NET_TRANSPORT_RPC,
+                       "Set a user's primary group",
+                       "net rpc user setprimarygroup\n"
+                       "    Set a user's primary group"
                },
                {NULL, NULL, 0, NULL, NULL}
        };
@@ -948,9 +1058,11 @@ 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(  "%s\n"
+                                  "net rpc user\n"
+                                  "    %s\n",
+                                _("Usage:"),
+                                _("List all users"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
@@ -994,12 +1106,13 @@ static NTSTATUS rpc_sh_handle_user(struct net_context *c,
 {
        struct policy_handle connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       DOM_SID sid;
+       struct dom_sid sid;
        uint32 rid;
        enum lsa_SidType type;
 
        if (argc == 0) {
-               d_fprintf(stderr, "usage: %s <username>\n", ctx->whoami);
+               d_fprintf(stderr, "%s %s <username>\n", _("Usage:"),
+                         ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1010,20 +1123,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;
        }
@@ -1080,7 +1193,8 @@ static NTSTATUS rpc_sh_user_show_internals(struct net_context *c,
        union samr_UserInfo *info = NULL;
 
        if (argc != 0) {
-               d_fprintf(stderr, "usage: %s show <username>\n", ctx->whoami);
+               d_fprintf(stderr, "%s %s show <username>\n", _("Usage:"),
+                         ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1092,7 +1206,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);
 
@@ -1133,8 +1247,8 @@ 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",
-                         ctx->whoami);
+               d_fprintf(stderr, "%s %s <username> [new value|NULL]\n",
+                         _("Usage:"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1156,7 +1270,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;
        }
 
@@ -1178,7 +1292,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:
@@ -1222,7 +1336,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;
        }
@@ -1247,7 +1363,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;
        }
 
@@ -1262,7 +1379,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]);
        }
 
@@ -1288,34 +1405,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 }
        };
@@ -1330,16 +1447,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 }
        };
@@ -1378,7 +1495,7 @@ static int rpc_group_usage(struct net_context *c, int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_group_delete_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -1410,7 +1527,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;
         }
 
@@ -1421,7 +1538,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;
         }
 
@@ -1434,7 +1551,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;
        }
 
@@ -1447,7 +1564,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;
                }
 
@@ -1458,12 +1575,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);
                }
 
@@ -1477,7 +1597,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;
                        }
@@ -1488,14 +1609,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;
@@ -1505,8 +1629,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;
                }
@@ -1515,7 +1640,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,
@@ -1523,10 +1648,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("%s\n", _("failed"));
                                goto done;
                        }
                }
@@ -1544,7 +1669,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;
                }
 
@@ -1552,7 +1677,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;
@@ -1560,9 +1686,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));
        }
 
@@ -1598,12 +1725,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;
@@ -1630,12 +1758,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;
@@ -1652,10 +1781,10 @@ static int rpc_group_add(struct net_context *c, int argc, const char **argv)
 static NTSTATUS get_sid_from_name(struct cli_state *cli,
                                TALLOC_CTX *mem_ctx,
                                const char *name,
-                               DOM_SID *sid,
+                               struct dom_sid *sid,
                                enum lsa_SidType *type)
 {
-       DOM_SID *sids = NULL;
+       struct dom_sid *sids = NULL;
        enum lsa_SidType *types = NULL;
        struct rpc_pipe_client *pipe_hnd = NULL;
        struct policy_handle lsa_pol;
@@ -1693,7 +1822,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
 
                /* Try as S-1-5-whatever */
 
-               DOM_SID tmp_sid;
+               struct dom_sid tmp_sid;
 
                if (string_to_sid(&tmp_sid, name)) {
                        sid_copy(sid, &tmp_sid);
@@ -1707,7 +1836,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
 
 static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
                                TALLOC_CTX *mem_ctx,
-                               const DOM_SID *group_sid,
+                               const struct dom_sid *group_sid,
                                const char *member)
 {
        struct policy_handle connect_pol, domain_pol;
@@ -1718,7 +1847,7 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
        struct samr_Ids rids, rid_types;
        struct lsa_String lsa_acct_name;
 
-       DOM_SID sid;
+       struct dom_sid sid;
 
        sid_copy(&sid, group_sid);
 
@@ -1755,7 +1884,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;
        }
 
@@ -1781,7 +1911,7 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
 
 static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                TALLOC_CTX *mem_ctx,
-                               const DOM_SID *alias_sid,
+                               const struct dom_sid *alias_sid,
                                const char *member)
 {
        struct policy_handle connect_pol, domain_pol;
@@ -1789,10 +1919,10 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
        uint32 alias_rid;
        struct policy_handle alias_pol;
 
-       DOM_SID member_sid;
+       struct dom_sid member_sid;
        enum lsa_SidType member_type;
 
-       DOM_SID sid;
+       struct dom_sid sid;
 
        sid_copy(&sid, alias_sid);
 
@@ -1804,7 +1934,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;
        }
 
@@ -1851,7 +1982,7 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
 }
 
 static NTSTATUS rpc_group_addmem_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -1859,21 +1990,23 @@ static NTSTATUS rpc_group_addmem_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
-       DOM_SID group_sid;
+       struct dom_sid group_sid;
        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("%s\n%s",
+                        _("Usage:"),
+                        _("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;
        }
 
@@ -1882,7 +2015,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;
@@ -1893,14 +2026,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;
 }
@@ -1915,7 +2048,7 @@ static int rpc_group_addmem(struct net_context *c, int argc, const char **argv)
 static NTSTATUS rpc_del_groupmem(struct net_context *c,
                                struct rpc_pipe_client *pipe_hnd,
                                TALLOC_CTX *mem_ctx,
-                               const DOM_SID *group_sid,
+                               const struct dom_sid *group_sid,
                                const char *member)
 {
        struct policy_handle connect_pol, domain_pol;
@@ -1926,7 +2059,7 @@ static NTSTATUS rpc_del_groupmem(struct net_context *c,
        struct samr_Ids rids, rid_types;
        struct lsa_String lsa_acct_name;
 
-       DOM_SID sid;
+       struct dom_sid sid;
 
        sid_copy(&sid, group_sid);
 
@@ -1959,7 +2092,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;
        }
 
@@ -1983,7 +2117,7 @@ static NTSTATUS rpc_del_groupmem(struct net_context *c,
 
 static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
                                TALLOC_CTX *mem_ctx,
-                               const DOM_SID *alias_sid,
+                               const struct dom_sid *alias_sid,
                                const char *member)
 {
        struct policy_handle connect_pol, domain_pol;
@@ -1991,10 +2125,10 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
        uint32 alias_rid;
        struct policy_handle alias_pol;
 
-       DOM_SID member_sid;
+       struct dom_sid member_sid;
        enum lsa_SidType member_type;
 
-       DOM_SID sid;
+       struct dom_sid sid;
 
        sid_copy(&sid, alias_sid);
 
@@ -2005,7 +2139,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;
        }
 
@@ -2050,7 +2185,7 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
 }
 
 static NTSTATUS rpc_group_delmem_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -2058,21 +2193,23 @@ static NTSTATUS rpc_group_delmem_internals(struct net_context *c,
                                        int argc,
                                        const char **argv)
 {
-       DOM_SID group_sid;
+       struct dom_sid group_sid;
        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("%s\n%s",
+                        _("Usage:"),
+                        _("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;
        }
 
@@ -2081,7 +2218,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;
@@ -2092,14 +2229,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;
 }
@@ -2128,7 +2265,7 @@ static int rpc_group_delmem(struct net_context *c, int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_group_list_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -2145,14 +2282,16 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("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;
        }
 
@@ -2196,8 +2335,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;
@@ -2361,7 +2500,7 @@ static NTSTATUS rpc_list_group_members(struct net_context *c,
                                        struct rpc_pipe_client *pipe_hnd,
                                        TALLOC_CTX *mem_ctx,
                                        const char *domain_name,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        struct policy_handle *domain_pol,
                                        uint32 rid)
 {
@@ -2444,7 +2583,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
        struct rpc_pipe_client *lsa_pipe;
        struct policy_handle alias_pol, lsa_pol;
        uint32 num_members;
-       DOM_SID *alias_sids;
+       struct dom_sid *alias_sids;
        char **domains;
        char **names;
        enum lsa_SidType *types;
@@ -2465,7 +2604,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;
        }
 
@@ -2479,7 +2618,7 @@ 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;
        }
@@ -2488,14 +2627,14 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
                                     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);
+       alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, struct 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;
        }
@@ -2510,7 +2649,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;
        }
@@ -2521,8 +2660,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]);
@@ -2536,7 +2675,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
 }
 
 static NTSTATUS rpc_group_members_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -2583,7 +2722,7 @@ static NTSTATUS rpc_group_members_internals(struct net_context *c,
 
                /* Ok, did not find it in the global sam, try with builtin */
 
-               DOM_SID sid_Builtin;
+               struct dom_sid sid_Builtin;
 
                rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
 
@@ -2596,7 +2735,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;
                }
 
@@ -2608,13 +2748,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;
        }
 
@@ -2650,7 +2792,8 @@ 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:\n"));
+               d_printf("net rpc group rename group newname\n");
                return -1;
        }
 
@@ -2663,7 +2806,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;
@@ -2697,57 +2840,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}
        };
@@ -2764,10 +2907,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;
                }
@@ -2837,7 +2980,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));
        }
 
@@ -2988,9 +3131,11 @@ 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(  "%s\n"
+                          "net rpc share list\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("List shares on remote server"));
                return 0;
        }
 
@@ -3008,10 +3153,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]);
@@ -3021,13 +3166,19 @@ 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 (!NT_STATUS_IS_OK(cli_tcon_andx(cli, netname, "A:", "", 0))) {
-               d_printf("skipping   [%s]: not a file share.\n", netname);
+       NTSTATUS status;
+
+       status = cli_tcon_andx(cli, netname, "A:", "", 0);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf(_("skipping   [%s]: not a file share.\n"), netname);
                return false;
        }
 
-       if (!cli_tdis(cli))
+       status = cli_tdis(cli);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf(_("cli_tdis returned %s\n"), nt_errstr(status));
                return false;
+       }
 
        return true;
 }
@@ -3037,7 +3188,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;
        }
 
@@ -3048,7 +3200,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;
        }
 
@@ -3072,7 +3224,7 @@ static bool check_share_sanity(struct net_context *c, struct cli_state *cli,
  **/
 
 static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -3115,7 +3267,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,13 +3281,13 @@ static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
                                                      &result);
 
                 if (W_ERROR_V(result) == W_ERROR_V(WERR_FILE_EXISTS)) {
-                       printf("           [%s] does already exist\n",
+                       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", win_errstr(result));
+                       printf(_("cannot add share: %s\n"), win_errstr(result));
                        goto done;
                }
 
@@ -3164,14 +3317,16 @@ 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(  "%s\n"
+                          "net rpc share migrate shares\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate shares to local server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               printf("no server to migrate\n");
+               printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3231,12 +3386,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 */
@@ -3246,7 +3401,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;
@@ -3273,12 +3428,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));
 
 }
@@ -3301,13 +3457,14 @@ static bool sync_files(struct copy_clistate *cp_clistate, const char *mask)
 
        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;
        }
@@ -3341,12 +3498,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;
        }
@@ -3371,7 +3529,7 @@ bool copy_top_level_perms(struct net_context *c,
  **/
 
 static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -3412,7 +3570,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;
                }
 
@@ -3422,14 +3581,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;
@@ -3458,13 +3619,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;
                }
@@ -3488,14 +3652,16 @@ 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(  "%s\n"
+                          "net share migrate files\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate files to local server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3521,7 +3687,7 @@ static int rpc_share_migrate_files(struct net_context *c, int argc, const char *
  **/
 
 static NTSTATUS rpc_share_migrate_security_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -3563,7 +3729,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)
@@ -3581,7 +3748,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", win_errstr(result));
+                       printf(_("cannot set share-acl: %s\n"),
+                              win_errstr(result));
                        goto done;
                }
 
@@ -3611,14 +3779,16 @@ 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(  "%s\n"
+                          "net rpc share migrate security\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate share-acls to local server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3644,14 +3814,16 @@ 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(  "%s\n"
+                          "net rpc share migrate all\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrates shares including all share settings"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -3688,33 +3860,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}
        };
@@ -3725,9 +3897,9 @@ static int rpc_share_migrate(struct net_context *c, int argc, const char **argv)
 }
 
 struct full_alias {
-       DOM_SID sid;
+       struct dom_sid sid;
        uint32 num_members;
-       DOM_SID *members;
+       struct dom_sid *members;
 };
 
 static int num_server_aliases;
@@ -3753,7 +3925,7 @@ 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,
                                        struct policy_handle *connect_pol,
-                                       const DOM_SID *domain_sid)
+                                       const struct dom_sid *domain_sid)
 {
        uint32 start_idx, max_entries, num_entries, i;
        struct samr_SamArray *groups = NULL;
@@ -3810,15 +3982,15 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
                        alias.members = NULL;
 
                        if (alias.num_members > 0) {
-                               alias.members = SMB_MALLOC_ARRAY(DOM_SID, alias.num_members);
+                               alias.members = SMB_MALLOC_ARRAY(struct dom_sid, alias.num_members);
 
                                for (j = 0; j < alias.num_members; j++)
                                        sid_copy(&alias.members[j],
                                                 sid_array.sids[j].sid);
                        }
 
-                       sid_copy(&alias.sid, domain_sid);
-                       sid_append_rid(&alias.sid, groups->entries[i].idx);
+                       sid_compose(&alias.sid, domain_sid,
+                                   groups->entries[i].idx);
 
                        push_alias(mem_ctx, &alias);
                }
@@ -3837,7 +4009,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
  */
 
 static NTSTATUS rpc_aliaslist_dump(struct net_context *c,
-                               const DOM_SID *domain_sid,
+                               const struct dom_sid *domain_sid,
                                const char *domain_name,
                                struct cli_state *cli,
                                struct rpc_pipe_client *pipe_hnd,
@@ -3903,7 +4075,7 @@ static NTSTATUS rpc_aliaslist_dump(struct net_context *c,
  */
 
 static NTSTATUS rpc_aliaslist_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -3936,12 +4108,12 @@ static NTSTATUS rpc_aliaslist_internals(struct net_context *c,
        return result;
 }
 
-static void init_user_token(NT_USER_TOKEN *token, DOM_SID *user_sid)
+static void init_user_token(NT_USER_TOKEN *token, struct dom_sid *user_sid)
 {
        token->num_sids = 4;
 
-       if (!(token->user_sids = SMB_MALLOC_ARRAY(DOM_SID, 4))) {
-               d_fprintf(stderr, "malloc failed\n");
+       if (!(token->user_sids = SMB_MALLOC_ARRAY(struct dom_sid, 4))) {
+               d_fprintf(stderr, "malloc %s\n",_("failed"));
                token->num_sids = 0;
                return;
        }
@@ -3957,12 +4129,12 @@ static void free_user_token(NT_USER_TOKEN *token)
        SAFE_FREE(token->user_sids);
 }
 
-static void add_sid_to_token(NT_USER_TOKEN *token, DOM_SID *sid)
+static void add_sid_to_token(NT_USER_TOKEN *token, struct dom_sid *sid)
 {
        if (is_sid_in_token(token, sid))
                return;
 
-       token->user_sids = SMB_REALLOC_ARRAY(token->user_sids, DOM_SID, token->num_sids+1);
+       token->user_sids = SMB_REALLOC_ARRAY(token->user_sids, struct dom_sid, token->num_sids+1);
        if (!token->user_sids) {
                return;
        }
@@ -3988,7 +4160,7 @@ static void dump_user_token(struct user_token *token)
        }
 }
 
-static bool is_alias_member(DOM_SID *sid, struct full_alias *alias)
+static bool is_alias_member(struct dom_sid *sid, struct full_alias *alias)
 {
        int i;
 
@@ -4000,7 +4172,7 @@ static bool is_alias_member(DOM_SID *sid, struct full_alias *alias)
        return false;
 }
 
-static void collect_sid_memberships(NT_USER_TOKEN *token, DOM_SID sid)
+static void collect_sid_memberships(NT_USER_TOKEN *token, struct dom_sid sid)
 {
        int i;
 
@@ -4034,7 +4206,7 @@ static bool get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
        fstring full_name;
        struct wbcDomainSid wsid;
        char *sid_str = NULL;
-       DOM_SID user_sid;
+       struct dom_sid user_sid;
        uint32_t num_groups;
        gid_t *groups = NULL;
        uint32_t i;
@@ -4084,12 +4256,12 @@ static bool get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
 
        for (i = 0; i < num_groups; i++) {
                gid_t gid = groups[i];
-               DOM_SID sid;
+               struct dom_sid sid;
 
                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;
                }
@@ -4128,8 +4300,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;
        }
 
@@ -4137,7 +4309,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;
        }
@@ -4196,13 +4368,14 @@ static bool get_user_tokens_from_file(FILE *f,
                        return true;
                }
 
-               if (line[strlen(line)-1] == '\n')
+               if ((strlen(line) > 0) && (line[strlen(line)-1] == '\n')) {
                        line[strlen(line)-1] = '\0';
+               }
 
                if (line[0] == ' ') {
                        /* We have a SID */
 
-                       DOM_SID sid;
+                       struct dom_sid sid;
                        if(!string_to_sid(&sid, &line[1])) {
                                DEBUG(1,("get_user_tokens_from_file: Could "
                                        "not convert sid %s \n",&line[1]));
@@ -4249,9 +4422,9 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                        int num_tokens,
                        struct user_token *tokens)
 {
-       int fnum;
-       SEC_DESC *share_sd = NULL;
-       SEC_DESC *root_sd = NULL;
+       uint16_t fnum;
+       struct security_descriptor *share_sd = NULL;
+       struct security_descriptor *root_sd = NULL;
        struct cli_state *cli = rpc_pipe_np_smb_conn(pipe_hnd);
        int i;
        union srvsvc_NetShareInfo info;
@@ -4284,9 +4457,8 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                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);
        }
 
@@ -4320,7 +4492,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
                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;
@@ -4367,7 +4539,7 @@ static void collect_share(const char *name, uint32 m,
  **/
 
 static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -4447,9 +4619,11 @@ 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(  "%s\n"
+                          "net rpc share allowedusers\n"
+                           "    %s\n",
+                         _("Usage:"),
+                         _("List allowed users"));
                return 0;
        }
 
@@ -4497,10 +4671,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;
@@ -4522,41 +4696,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}
        };
@@ -4573,10 +4747,11 @@ 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("%s\n%s",
+                                _("Usage:"),
+                                _("net rpc share\n"
+                                  "    List shares\n"
+                                  "    Alias for net rpc share list\n"));
                        net_display_usage_from_functable(func);
                        return 0;
                }
@@ -4608,7 +4783,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;
        }
@@ -4637,7 +4812,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, "%s %s <share>\n", _("Usage:"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -4655,7 +4830,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, "%s %s <share>\n", _("Usage:"), ctx->whoami);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -4669,10 +4844,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);
@@ -4684,16 +4859,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 }
        };
@@ -4784,10 +4959,10 @@ static int rpc_file_user(struct net_context *c, int argc, const char **argv)
 
        /* Display results */
 
-       d_printf(
+       d_printf(_(
                 "\nEnumerating open files on remote server:\n\n"
                 "\nFileId  Opened by            Perms  Locks  Path"
-                "\n------  ---------            -----  -----  ---- \n");
+                "\n------  ---------            -----  -----  ---- \n"));
        for (i = 0; i < entries_read; i++) {
                display_file_info_3(&i3[i]);
        }
@@ -4811,26 +4986,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}
@@ -4848,9 +5023,9 @@ 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;
                }
@@ -4879,7 +5054,7 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv)
  **/
 
 static NTSTATUS rpc_shutdown_abort_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -4892,7 +5067,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"));
@@ -4918,7 +5093,7 @@ static NTSTATUS rpc_shutdown_abort_internals(struct net_context *c,
  **/
 
 static NTSTATUS rpc_reg_shutdown_abort_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -4931,7 +5106,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"));
@@ -4955,9 +5130,11 @@ 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(  "%s\n"
+                          "net rpc abortshutdown\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Abort a scheduled shutdown"));
                return 0;
        }
 
@@ -4992,7 +5169,7 @@ static int rpc_shutdown_abort(struct net_context *c, int argc,
  **/
 
 NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
-                                    const DOM_SID *domain_sid,
+                                    const struct dom_sid *domain_sid,
                                     const char *domain_name,
                                     struct cli_state *cli,
                                     struct rpc_pipe_client *pipe_hnd,
@@ -5001,7 +5178,7 @@ 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 lsa_StringLarge msg_string;
 
@@ -5020,7 +5197,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"));
@@ -5046,7 +5223,7 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
  **/
 
 NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
-                                   const DOM_SID *domain_sid,
+                                   const struct dom_sid *domain_sid,
                                    const char *domain_name,
                                    struct cli_state *cli,
                                    struct rpc_pipe_client *pipe_hnd,
@@ -5054,7 +5231,7 @@ 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 lsa_StringLarge msg_string;
        NTSTATUS result;
@@ -5075,7 +5252,7 @@ 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) )
@@ -5102,9 +5279,11 @@ 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(  "%s\n"
+                          "net rpc shutdown\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Shut down a remote RPC server"));
                return 0;
        }
 
@@ -5141,7 +5320,7 @@ static int rpc_shutdown(struct net_context *c, int argc, const char **argv)
  */
 
 static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
-                                               const DOM_SID *domain_sid,
+                                               const struct dom_sid *domain_sid,
                                                const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
@@ -5161,12 +5340,14 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _(" net rpc trustdom add <domain_name> "
+                          "<trust password>\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       /* 
+       /*
         * Make valid trusting domain account (ie. uppercased and with '$' appended)
         */
 
@@ -5223,7 +5404,7 @@ 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;
        }
@@ -5274,8 +5455,10 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("net rpc trustdom add <domain_name> <trust "
+                          "password>\n"));
                return -1;
        }
 }
@@ -5298,7 +5481,7 @@ static int rpc_trustdom_add(struct net_context *c, int argc, const char **argv)
  */
 
 static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -5309,12 +5492,14 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c,
        struct policy_handle connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        char *acct_name;
-       DOM_SID trust_acct_sid;
+       struct dom_sid trust_acct_sid;
        struct samr_Ids user_rids, name_types;
        struct lsa_String lsa_acct_name;
 
        if (argc != 1) {
-               d_printf("Usage: net rpc trustdom del <domain_name>\n");
+               d_printf("%s\n%s",
+                        _("Usage:"),
+                        _(" net rpc trustdom del <domain_name>\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -5357,7 +5542,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;
        }
@@ -5369,14 +5555,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: 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;
        }
 
        /* append the rid to the domain sid */
-       sid_copy(&trust_acct_sid, domain_sid);
-       if (!sid_append_rid(&trust_acct_sid, user_rids.ids[0])) {
+       if (!sid_compose(&trust_acct_sid, domain_sid, user_rids.ids[0])) {
                goto done;
        }
 
@@ -5386,7 +5572,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;
        }
@@ -5397,13 +5584,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;
        }
@@ -5427,8 +5615,9 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("net rpc trustdom del <domain>\n"));
                return -1;
        }
 }
@@ -5498,7 +5687,7 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
        struct policy_handle connect_hnd;
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
-       DOM_SID *domain_sid;
+       struct dom_sid *domain_sid;
 
        char* domain_name;
        char* acct_name;
@@ -5510,8 +5699,9 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("net rpc trustdom establish <domain_name>\n"));
                return -1;
        }
 
@@ -5596,7 +5786,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",
@@ -5653,7 +5843,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;
 }
 
@@ -5674,10 +5864,11 @@ 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("%s\n%s",
+                        _("Usage:"),
+                        _("net rpc trustdom revoke <domain_name>\n"
+                          "  Revoke trust relationship\n"
+                          "    domain_name\tName of domain to revoke trust\n"));
                return -1;
        }
 
@@ -5699,7 +5890,7 @@ done:
 }
 
 static NTSTATUS rpc_query_domain_sid(struct net_context *c,
-                                       const DOM_SID *domain_sid,
+                                       const struct dom_sid *domain_sid,
                                        const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
@@ -5708,31 +5899,27 @@ static NTSTATUS rpc_query_domain_sid(struct net_context *c,
                                        const char **argv)
 {
        fstring str_sid;
-       sid_to_fstring(str_sid, domain_sid);
+       if (!sid_to_fstring(str_sid, domain_sid)) {
+               return NT_STATUS_UNSUCCESSFUL;
+       }
        d_printf("%s\n", str_sid);
        return NT_STATUS_OK;
 }
 
-static void print_trusted_domain(DOM_SID *dom_sid, const char *trusted_dom_name)
+static void print_trusted_domain(struct dom_sid *dom_sid, const char *trusted_dom_name)
 {
-       fstring ascii_sid, padding;
-       int pad_len, col_len = 20;
+       fstring ascii_sid;
 
        /* convert sid into ascii string */
        sid_to_fstring(ascii_sid, dom_sid);
 
-       /* calculate padding space for d_printf to look nicer */
-       pad_len = col_len - strlen(trusted_dom_name);
-       padding[pad_len] = 0;
-       do padding[--pad_len] = ' '; while (pad_len);
-
-       d_printf("%s%s%s\n", trusted_dom_name, padding, ascii_sid);
+       d_printf("%-20s%s\n", trusted_dom_name, ascii_sid);
 }
 
 static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
                                      TALLOC_CTX *mem_ctx,
                                      struct policy_handle *pol,
-                                     DOM_SID dom_sid,
+                                     struct dom_sid dom_sid,
                                      const char *trusted_dom_name)
 {
        NTSTATUS nt_status;
@@ -5740,7 +5927,7 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
        char *cleartextpwd = NULL;
        uint8_t session_key[16];
        DATA_BLOB session_key_blob;
-       DATA_BLOB data;
+       DATA_BLOB data = data_blob_null;
 
        nt_status = rpccli_lsa_QueryTrustedDomainInfoBySid(pipe_hnd, mem_ctx,
                                                           pol,
@@ -5798,7 +5985,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
        struct rpc_pipe_client *pipe_hnd = NULL;
        NTSTATUS nt_status;
        const char *domain_name = NULL;
-       DOM_SID *queried_dom_sid;
+       struct dom_sid *queried_dom_sid;
        struct policy_handle connect_hnd;
        union lsa_PolicyInformation *info = NULL;
 
@@ -5809,9 +5996,11 @@ 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(  "%s\n"
+                          "net rpc trustdom vampire\n"
+                          "  %s\n",
+                        _("Usage:"),
+                        _("Vampire trust relationship from remote server"));
                return 0;
        }
 
@@ -5854,7 +6043,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",
@@ -5885,7 +6074,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,
@@ -5920,7 +6109,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));
 
@@ -5949,26 +6138,28 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
        struct rpc_pipe_client *pipe_hnd = NULL;
        NTSTATUS nt_status;
        const char *domain_name = NULL;
-       DOM_SID *queried_dom_sid;
-       fstring padding;
+       struct dom_sid *queried_dom_sid;
        int ascii_dom_name_len;
        struct policy_handle connect_hnd;
        union lsa_PolicyInformation *info = NULL;
 
        /* trusted domains listing variables */
        unsigned int num_domains, enum_ctx = 0;
-       int i, pad_len, col_len = 20;
+       int i;
        struct lsa_DomainList dom_list;
        fstring pdc_name;
+       bool found_domain;
 
        /* trusting domains listing variables */
        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(  "%s\n"
+                          "net rpc trustdom list\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("List incoming and outgoing trust relationships"));
                return 0;
        }
 
@@ -6011,7 +6202,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",
@@ -6041,8 +6232,10 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
         * Keep calling LsaEnumTrustdom over opened pipe until
         * the end of enumeration is reached
         */
-        
-       d_printf("Trusted domains list:\n\n");
+
+       d_printf(_("Trusted domains list:\n\n"));
+
+       found_domain = false;
 
        do {
                nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
@@ -6061,16 +6254,20 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
                for (i = 0; i < dom_list.count; i++) {
                        print_trusted_domain(dom_list.domains[i].sid,
                                             dom_list.domains[i].name.string);
+                       found_domain = true;
                };
 
-               /*
-                * in case of no trusted domains say something rather
-                * than just display blank line
-                */
-               if (!dom_list.count) d_printf("none\n");
 
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
+       /*
+        * in case of no trusted domains say something rather
+        * than just display blank line
+        */
+       if (!found_domain) {
+               d_printf(_("none\n"));
+       }
+
        /* close this connection before doing next one */
        nt_status = rpccli_lsa_Close(pipe_hnd, mem_ctx, &connect_hnd);
        if (NT_STATUS_IS_ERR(nt_status)) {
@@ -6087,7 +6284,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
@@ -6133,6 +6330,8 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
         * perform actual enumeration
         */
 
+       found_domain = false;
+
        enum_ctx = 0;   /* reset enumeration context from last enumeration */
        do {
 
@@ -6155,6 +6354,8 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
 
                        char *str = CONST_DISCARD(char *, trusts->entries[i].name.string);
 
+                       found_domain = true;
+
                        /*
                         * get each single domain's sid (do we _really_ need this ?):
                         *  1) connect to domain's pdc
@@ -6166,17 +6367,12 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
                        if (ascii_dom_name_len && ascii_dom_name_len < FSTRING_LEN)
                                str[ascii_dom_name_len - 1] = '\0';
 
-                       /* calculate padding space for d_printf to look nicer */
-                       pad_len = col_len - strlen(str);
-                       padding[pad_len] = 0;
-                       do padding[--pad_len] = ' '; while (pad_len);
-
                        /* set opt_* variables to remote domain */
                        strupper_m(str);
                        c->opt_workgroup = talloc_strdup(mem_ctx, str);
                        c->opt_target_workgroup = c->opt_workgroup;
 
-                       d_printf("%s%s", str, padding);
+                       d_printf("%-20s", str);
 
                        /* connect to remote domain controller */
                        nt_status = net_make_ipc_connection(c,
@@ -6189,21 +6385,24 @@ 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_printf(_("strange - 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));
-                       };
-               };
-
-               if (!num_domains) d_printf("none\n");
+                               d_printf(_("couldn't get domain's sid\n"));
+                       }
+               }
 
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
+       if (!found_domain) {
+               d_printf("none\n");
+       }
+
        /* close opened samr and domain policy handles */
        nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
@@ -6238,49 +6437,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}
        };
@@ -6331,9 +6530,11 @@ 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(  "%s\n"
+                          "net rpc samdump\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Dump remote SAM database"));
                return 0;
        }
 
@@ -6350,25 +6551,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,
-                       "Dump remote SAM database to passdb",
-                       "net rpc vampire passdb\n"
-                       "    Dump remote SAM database to passdb"
+                       N_("Dump remote SAM database to passdb"),
+                       N_("net rpc vampire passdb\n"
+                          "    Dump remote SAM database to passdb")
                },
 
                {NULL, NULL, 0, NULL, NULL}
@@ -6376,9 +6579,11 @@ 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(  "%s\n"
+                                  "net rpc vampire\n"
+                                  "    %s\n",
+                                _("Usage:"),
+                                _("Vampire remote SAM database"));
                        return 0;
                }
 
@@ -6412,14 +6617,16 @@ 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(  "%s\n"
+                          "net rpc printer migrate all\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate everything from a print server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6466,14 +6673,16 @@ 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(  "%s\n"
+                          "net rpc printer migrate drivers\n"
+                          "     %s\n",
+                        _("Usage:"),
+                        _("Migrate print-drivers from a print-server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6496,14 +6705,16 @@ 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(  "%s\n"
+                          "net rpc printer migrate forms\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate print-forms from a print-server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6526,14 +6737,16 @@ 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(  "%s\n"
+                          "net rpc printer migrate printers\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate printers from a print-server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6556,14 +6769,16 @@ 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(  "%s\n"
+                          "net rpc printer migrate security\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Migrate printer-ACLs from a print-server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6586,14 +6801,17 @@ 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(  "%s\n"
+                          "net rpc printer migrate settings\n"
+                           "    %s\n",
+                         _("Usage:"),
+                         _("Migrate printer-settings from a "
+                           "print-server"));
                return 0;
        }
 
        if (!c->opt_host) {
-               d_printf("no server to migrate\n");
+               d_printf(_("no server to migrate\n"));
                return -1;
        }
 
@@ -6623,49 +6841,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}
        };
@@ -6687,9 +6905,11 @@ 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(  "%s\n"
+                          "net rpc printer list\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("List printers on a remote RPC server"));
                return 0;
        }
 
@@ -6712,9 +6932,11 @@ 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(  "%s\n"
+                          "net rpc printer driver\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("List printer-drivers on a remote RPC server"));
                return 0;
        }
 
@@ -6737,9 +6959,11 @@ 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(  "%s\n"
+                          "net rpc printer publish publish\n"
+                          "     %s\n",
+                        _("Usage:"),
+                        _("Publish printer in ADS via MSRPC"));
                return 0;
        }
 
@@ -6761,9 +6985,11 @@ 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(  "%s\n"
+                          "net rpc printer publish update\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Update printer in ADS via MSRPC"));
                return 0;
        }
 
@@ -6786,9 +7012,11 @@ 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(  "%s\n"
+                          "net rpc printer publish unpublish\n"
+                          "    %s\n",
+                        _("Usage:\n"),
+                        _("UnPublish printer in ADS via MSRPC"));
                return 0;
        }
 
@@ -6811,9 +7039,11 @@ 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(  "%s\n"
+                          "net rpc printer publish list\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("List published printers via MSRPC"));
                return 0;
        }
 
@@ -6842,43 +7072,44 @@ 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;
                }
@@ -6902,31 +7133,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;
 }
@@ -6946,42 +7177,42 @@ 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;
                }
@@ -7004,185 +7235,201 @@ 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);
+       }
+       if (c->opt_ccache) {
+               libnetapi_set_use_ccache(c->netapi_ctx);
+       }
+
        return net_run_function(c, argc, argv, "net rpc", func);
 }