diff options
author | Kai Blin <kai@samba.org> | 2009-08-10 20:38:33 +0200 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2009-08-11 09:34:24 +0200 |
commit | 3eeb988248db7d99e4392eb4bc3d05e953944ddb (patch) | |
tree | 7710eeeb13adc480b090c9b596c5dbc56288d4b3 /source3/utils | |
parent | d8af037aab60ddd34c673feeccd02085db9e46e6 (diff) | |
download | samba-3eeb988248db7d99e4392eb4bc3d05e953944ddb.tar.gz samba-3eeb988248db7d99e4392eb4bc3d05e953944ddb.tar.bz2 samba-3eeb988248db7d99e4392eb4bc3d05e953944ddb.zip |
s3 net: i18n support for net rpc shell
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_rpc_sh_acct.c | 93 | ||||
-rw-r--r-- | source3/utils/net_rpc_shell.c | 32 |
2 files changed, 63 insertions, 62 deletions
diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index af0b426bbc..83ce3551d1 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -75,7 +75,7 @@ static NTSTATUS rpc_sh_acct_do(struct net_context *c, &info1); if (!NT_STATUS_IS_OK(result)) { - d_fprintf(stderr, "query_domain_info level 1 failed: %s\n", + d_fprintf(stderr, _("query_domain_info level 1 failed: %s\n"), nt_errstr(result)); goto done; } @@ -86,7 +86,7 @@ static NTSTATUS rpc_sh_acct_do(struct net_context *c, &info3); if (!NT_STATUS_IS_OK(result)) { - d_fprintf(stderr, "query_domain_info level 3 failed: %s\n", + d_fprintf(stderr, _("query_domain_info level 3 failed: %s\n"), nt_errstr(result)); goto done; } @@ -97,7 +97,7 @@ static NTSTATUS rpc_sh_acct_do(struct net_context *c, &info12); if (!NT_STATUS_IS_OK(result)) { - d_fprintf(stderr, "query_domain_info level 12 failed: %s\n", + d_fprintf(stderr, _("query_domain_info level 12 failed: %s\n"), nt_errstr(result)); goto done; } @@ -130,7 +130,7 @@ static NTSTATUS rpc_sh_acct_do(struct net_context *c, info12); break; default: - d_fprintf(stderr, "Got unexpected info level %d\n", store); + d_fprintf(stderr, _("Got unexpected info level %d\n"), store); result = NT_STATUS_INTERNAL_ERROR; goto done; } @@ -154,55 +154,56 @@ static int account_show(struct net_context *c, int argc, const char **argv) { if (argc != 0) { - d_fprintf(stderr, "usage: %s\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s\n"), ctx->whoami); return -1; } - d_printf("Minimum password length: %d\n", i1->min_password_length); - d_printf("Password history length: %d\n", i1->password_history_length); + d_printf(_("Minimum password length: %d\n"), i1->min_password_length); + d_printf(_("Password history length: %d\n"), + i1->password_history_length); - d_printf("Minimum password age: "); + d_printf(_("Minimum password age: ")); if (!nt_time_is_zero((NTTIME *)&i1->min_password_age)) { time_t t = nt_time_to_unix_abs((NTTIME *)&i1->min_password_age); - d_printf("%d seconds\n", (int)t); + d_printf(_("%d seconds\n"), (int)t); } else { - d_printf("not set\n"); + d_printf(_("not set\n")); } - d_printf("Maximum password age: "); + d_printf(_("Maximum password age: ")); if (nt_time_is_set((NTTIME *)&i1->max_password_age)) { time_t t = nt_time_to_unix_abs((NTTIME *)&i1->max_password_age); - d_printf("%d seconds\n", (int)t); + d_printf(_("%d seconds\n"), (int)t); } else { - d_printf("not set\n"); + d_printf(_("not set\n")); } - d_printf("Bad logon attempts: %d\n", i12->lockout_threshold); + d_printf(_("Bad logon attempts: %d\n"), i12->lockout_threshold); if (i12->lockout_threshold != 0) { - d_printf("Account lockout duration: "); + d_printf(_("Account lockout duration: ")); if (nt_time_is_set(&i12->lockout_duration)) { time_t t = nt_time_to_unix_abs(&i12->lockout_duration); - d_printf("%d seconds\n", (int)t); + d_printf(_("%d seconds\n"), (int)t); } else { - d_printf("not set\n"); + d_printf(_("not set\n")); } - d_printf("Bad password count reset after: "); + d_printf(_("Bad password count reset after: ")); if (nt_time_is_set(&i12->lockout_window)) { time_t t = nt_time_to_unix_abs(&i12->lockout_window); - d_printf("%d seconds\n", (int)t); + d_printf(_("%d seconds\n"), (int)t); } else { - d_printf("not set\n"); + d_printf(_("not set\n")); } } - d_printf("Disconnect users when logon hours expire: %s\n", - nt_time_is_zero(&i3->force_logoff_time) ? "yes" : "no"); + d_printf(_("Disconnect users when logon hours expire: %s\n"), + nt_time_is_zero(&i3->force_logoff_time) ? _("yes") : _("no")); - d_printf("User must logon to change password: %s\n", - (i1->password_properties & 0x2) ? "yes" : "no"); + d_printf(_("User must logon to change password: %s\n"), + (i1->password_properties & 0x2) ? _("yes") : _("no")); return 0; /* Don't save */ } @@ -224,12 +225,12 @@ static int account_set_badpw(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } i12->lockout_threshold = atoi(argv[0]); - d_printf("Setting bad password count to %d\n", + d_printf(_("Setting bad password count to %d\n"), i12->lockout_threshold); return 12; @@ -254,12 +255,12 @@ static int account_set_lockduration(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } unix_to_nt_time_abs(&i12->lockout_duration, atoi(argv[0])); - d_printf("Setting lockout duration to %d seconds\n", + d_printf(_("Setting lockout duration to %d seconds\n"), (int)nt_time_to_unix_abs(&i12->lockout_duration)); return 12; @@ -284,12 +285,12 @@ static int account_set_resetduration(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } unix_to_nt_time_abs(&i12->lockout_window, atoi(argv[0])); - d_printf("Setting bad password reset duration to %d seconds\n", + d_printf(_("Setting bad password reset duration to %d seconds\n"), (int)nt_time_to_unix_abs(&i12->lockout_window)); return 12; @@ -314,12 +315,12 @@ static int account_set_minpwage(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } unix_to_nt_time_abs((NTTIME *)&i1->min_password_age, atoi(argv[0])); - d_printf("Setting minimum password age to %d seconds\n", + d_printf(_("Setting minimum password age to %d seconds\n"), (int)nt_time_to_unix_abs((NTTIME *)&i1->min_password_age)); return 1; @@ -344,12 +345,12 @@ static int account_set_maxpwage(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } unix_to_nt_time_abs((NTTIME *)&i1->max_password_age, atoi(argv[0])); - d_printf("Setting maximum password age to %d seconds\n", + d_printf(_("Setting maximum password age to %d seconds\n"), (int)nt_time_to_unix_abs((NTTIME *)&i1->max_password_age)); return 1; @@ -374,12 +375,12 @@ static int account_set_minpwlen(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } i1->min_password_length = atoi(argv[0]); - d_printf("Setting minimum password length to %d\n", + d_printf(_("Setting minimum password length to %d\n"), i1->min_password_length); return 1; @@ -404,12 +405,12 @@ static int account_set_pwhistlen(struct net_context *c, int argc, const char **argv) { if (argc != 1) { - d_fprintf(stderr, "usage: %s <count>\n", ctx->whoami); + d_fprintf(stderr, _("usage: %s <count>\n"), ctx->whoami); return -1; } i1->password_history_length = atoi(argv[0]); - d_printf("Setting password history length to %d\n", + d_printf(_("Setting password history length to %d\n"), i1->password_history_length); return 1; @@ -430,22 +431,22 @@ struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx, { static struct rpc_sh_cmd cmds[9] = { { "show", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_pol_show, - "Show current account policy settings" }, + N_("Show current account policy settings") }, { "badpw", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_badpw, - "Set bad password count before lockout" }, + N_("Set bad password count before lockout") }, { "lockduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_lockduration, - "Set account lockout duration" }, + N_("Set account lockout duration") }, { "resetduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_resetduration, - "Set bad password count reset duration" }, + N_("Set bad password count reset duration") }, { "minpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwage, - "Set minimum password age" }, + N_("Set minimum password age") }, { "maxpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_maxpwage, - "Set maximum password age" }, + N_("Set maximum password age") }, { "minpwlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwlen, - "Set minimum password length" }, + N_("Set minimum password length") }, { "pwhistlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_pwhistlen, - "Set the password history length" }, + N_("Set the password history length") }, { NULL, NULL, 0, NULL, NULL } }; diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c index 3aaed1ed18..e78af142fa 100644 --- a/source3/utils/net_rpc_shell.c +++ b/source3/utils/net_rpc_shell.c @@ -74,14 +74,14 @@ static NTSTATUS net_sh_run(struct net_context *c, mem_ctx = talloc_new(ctx); if (mem_ctx == NULL) { - d_fprintf(stderr, "talloc_new failed\n"); + d_fprintf(stderr, _("talloc_new failed\n")); return NT_STATUS_NO_MEMORY; } status = cli_rpc_pipe_open_noauth(ctx->cli, cmd->interface, &pipe_hnd); if (!NT_STATUS_IS_OK(status)) { - d_fprintf(stderr, "Could not open pipe: %s\n", + d_fprintf(stderr, _("Could not open pipe: %s\n"), nt_errstr(status)); return status; } @@ -141,13 +141,13 @@ static bool net_sh_process(struct net_context *c, if (cmd->name == NULL) { /* None found */ - d_fprintf(stderr, "%s: unknown cmd\n", argv[0]); + d_fprintf(stderr,_( "%s: unknown cmd\n"), argv[0]); return true; } new_ctx = TALLOC_P(ctx, struct rpc_sh_ctx); if (new_ctx == NULL) { - d_fprintf(stderr, "talloc failed\n"); + d_fprintf(stderr, _("talloc failed\n")); return false; } new_ctx->cli = ctx->cli; @@ -179,7 +179,7 @@ static bool net_sh_process(struct net_context *c, status = net_sh_run(c, new_ctx, cmd, argc, argv); if (!NT_STATUS_IS_OK(status)) { - d_fprintf(stderr, "%s failed: %s\n", new_ctx->whoami, + d_fprintf(stderr, _("%s failed: %s\n"), new_ctx->whoami, nt_errstr(status)); } @@ -189,19 +189,19 @@ static bool net_sh_process(struct net_context *c, static struct rpc_sh_cmd sh_cmds[6] = { { "info", NULL, &ndr_table_samr.syntax_id, rpc_sh_info, - "Print information about the domain connected to" }, + N_("Print information about the domain connected to") }, { "rights", net_rpc_rights_cmds, 0, NULL, - "List/Grant/Revoke user rights" }, + N_("List/Grant/Revoke user rights") }, { "share", net_rpc_share_cmds, 0, NULL, - "List/Add/Remove etc shares" }, + N_("List/Add/Remove etc shares") }, { "user", net_rpc_user_cmds, 0, NULL, - "List/Add/Remove user info" }, + N_("List/Add/Remove user info") }, { "account", net_rpc_acct_cmds, 0, NULL, - "Show/Change account policy settings" }, + N_("Show/Change account policy settings") }, { NULL, NULL, 0, NULL, NULL } }; @@ -212,8 +212,8 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv) struct rpc_sh_ctx *ctx; if (argc != 0 || c->display_usage) { - d_printf("Usage:\n" - "net rpc shell\n"); + d_printf(_("Usage:\n" + "net rpc shell\n")); return -1; } @@ -228,13 +228,13 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv) ctx = TALLOC_P(NULL, struct rpc_sh_ctx); if (ctx == NULL) { - d_fprintf(stderr, "talloc failed\n"); + d_fprintf(stderr, _("talloc failed\n")); return -1; } status = net_make_ipc_connection(c, 0, &(ctx->cli)); if (!NT_STATUS_IS_OK(status)) { - d_fprintf(stderr, "Could not open connection: %s\n", + d_fprintf(stderr, _("Could not open connection: %s\n"), nt_errstr(status)); return -1; } @@ -249,7 +249,7 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv) return -1; } - d_printf("Talking to domain %s (%s)\n", ctx->domain_name, + d_printf(_("Talking to domain %s (%s)\n"), ctx->domain_name, sid_string_tos(ctx->domain_sid)); this_ctx = ctx; @@ -276,7 +276,7 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv) continue; } if (ret != 0) { - d_fprintf(stderr, "cmdline invalid: %s\n", + d_fprintf(stderr, _("cmdline invalid: %s\n"), poptStrerror(ret)); SAFE_FREE(line); return false; |