#include "includes.h"
#include "utils/net.h"
+#include "../libcli/auth/libcli_auth.h"
static int net_mode_share;
static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
-extern const char *share_type[];
-
/**
* @file net_rpc.c
*
DOM_SID **domain_sid,
const char **domain_name)
{
- struct rpc_pipe_client *lsa_pipe;
- POLICY_HND pol;
+ struct rpc_pipe_client *lsa_pipe = NULL;
+ struct policy_handle pol;
NTSTATUS result = NT_STATUS_OK;
union lsa_PolicyInformation *info = NULL;
result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
&lsa_pipe);
if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Could not initialise lsa pipe\n");
+ d_fprintf(stderr, _("Could not initialise lsa pipe\n"));
return result;
}
result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, false,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
+ SEC_FLAG_MAXIMUM_ALLOWED,
&pol);
if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "open_policy failed: %s\n",
+ d_fprintf(stderr, _("open_policy failed: %s\n"),
nt_errstr(result));
return result;
}
LSA_POLICY_INFO_ACCOUNT_DOMAIN,
&info);
if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "lsaquery failed: %s\n",
+ d_fprintf(stderr, _("lsaquery failed: %s\n"),
nt_errstr(result));
return result;
}
NTSTATUS nt_status;
DOM_SID *domain_sid;
const char *domain_name;
+ int ret = -1;
/* make use of cli_state handed over as an argument, if possible */
if (!cli_arg) {
if (!(mem_ctx = talloc_init("run_rpc_command"))) {
DEBUG(0, ("talloc_init() failed\n"));
- cli_shutdown(cli);
- return -1;
+ goto fail;
}
nt_status = net_get_remote_domain_sid(cli, mem_ctx, &domain_sid,
&domain_name);
if (!NT_STATUS_IS_OK(nt_status)) {
- cli_shutdown(cli);
- return -1;
+ goto fail;
}
if (!(conn_flags & NET_FLAGS_NO_PIPE)) {
&ndr_table_netlogon.syntax_id))) {
/* Always try and create an schannel netlogon pipe. */
nt_status = cli_rpc_pipe_open_schannel(
- cli, interface,
- PIPE_AUTH_LEVEL_PRIVACY, domain_name,
+ cli, interface, NCACN_NP,
+ DCERPC_AUTH_LEVEL_PRIVACY, domain_name,
&pipe_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise schannel netlogon pipe. Error was %s\n",
nt_errstr(nt_status) ));
- cli_shutdown(cli);
- return -1;
+ goto fail;
}
} else {
if (conn_flags & NET_FLAGS_SEAL) {
nt_status = cli_rpc_pipe_open_ntlmssp(
cli, interface,
- PIPE_AUTH_LEVEL_PRIVACY,
+ (conn_flags & NET_FLAGS_TCP) ?
+ NCACN_IP_TCP : NCACN_NP,
+ DCERPC_AUTH_LEVEL_PRIVACY,
lp_workgroup(), c->opt_user_name,
c->opt_password, &pipe_hnd);
} else {
}
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise pipe %s. Error was %s\n",
- cli_get_pipe_name_from_iface(
- debug_ctx(), cli, interface),
+ get_pipe_name_from_iface(interface),
nt_errstr(nt_status) ));
- cli_shutdown(cli);
- return -1;
+ goto fail;
}
}
}
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(1, ("rpc command function failed! (%s)\n", nt_errstr(nt_status)));
} else {
+ ret = 0;
DEBUG(5, ("rpc command function succedded\n"));
}
}
}
+fail:
/* close the connection only if it was opened here */
if (!cli_arg) {
cli_shutdown(cli);
}
talloc_destroy(mem_ctx);
- return (!NT_STATUS_IS_OK(nt_status));
+ return ret;
}
/**
int argc,
const char **argv)
{
+ NTSTATUS status;
+
+ status = trust_pw_find_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_fprintf(stderr, _("Failed to change machine account password: %s\n"),
+ nt_errstr(status));
+ return status;
+ }
- return trust_pw_find_change_and_store_it(pipe_hnd, mem_ctx, c->opt_target_workgroup);
+ return NT_STATUS_OK;
}
/**
int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc changetrustpw\n"
- " Change the machine trust password\n");
+ d_printf(_("Usage:\n"
+ "net rpc changetrustpw\n"
+ " Change the machine trust password\n"));
return 0;
}
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)) {
int rc = -1;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc oldjoin\n"
- " Join a domain the old way\n");
+ d_printf(_("Usage:\n"
+ "net rpc oldjoin\n"
+ " Join a domain the old way\n"));
return 0;
}
rc = net_rpc_perform_oldjoin(c, argc, argv);
if (rc) {
- d_fprintf(stderr, "Failed to join domain\n");
+ d_fprintf(stderr, _("Failed to join domain\n"));
}
return rc;
int net_rpc_join(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc join -U <username>[%%password] <type>\n"
- " Join a domain\n"
- " username\tName of the admin user"
- " password\tPassword of the admin user, will "
- "prompt if not specified\n"
- " type\tCan be one of the following:\n"
- "\t\tMEMBER\tJoin as member server (default)\n"
- "\t\tBDC\tJoin as BDC\n"
- "\t\tPDC\tJoin as PDC\n");
+ d_printf(_("Usage:\n"
+ "net rpc join -U <username>[%%password] <type>\n"
+ " Join a domain\n"
+ " username\tName of the admin user"
+ " password\tPassword of the admin user, will "
+ "prompt if not specified\n"
+ " type\tCan be one of the following:\n"
+ "\t\tMEMBER\tJoin as member server (default)\n"
+ "\t\tBDC\tJoin as BDC\n"
+ "\t\tPDC\tJoin as PDC\n"));
return 0;
}
if (lp_server_role() == ROLE_STANDALONE) {
- d_printf("cannot join as standalone machine\n");
+ d_printf(_("cannot join as standalone machine\n"));
return -1;
}
if (strlen(global_myname()) > 15) {
- d_printf("Our netbios name can be at most 15 chars long, "
- "\"%s\" is %u chars long\n",
+ d_printf(_("Our netbios name can be at most 15 chars long, "
+ "\"%s\" is %u chars long\n"),
global_myname(), (unsigned int)strlen(global_myname()));
return -1;
}
int argc,
const char **argv)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
union samr_DomainInfo *info = NULL;
fstring sid_str;
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;
}
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;
}
2,
&info);
if (NT_STATUS_IS_OK(result)) {
- d_printf("Domain Name: %s\n", info->info2.domain_name.string);
- d_printf("Domain SID: %s\n", sid_str);
- d_printf("Sequence number: %llu\n",
- (unsigned long long)info->info2.sequence_num);
- d_printf("Num users: %u\n", info->info2.num_users);
- d_printf("Num domain groups: %u\n", info->info2.num_groups);
- d_printf("Num local groups: %u\n", info->info2.num_aliases);
+ d_printf(_("Domain Name: %s\n"),
+ info->general.domain_name.string);
+ d_printf(_("Domain SID: %s\n"), sid_str);
+ d_printf(_("Sequence number: %llu\n"),
+ (unsigned long long)info->general.sequence_num);
+ d_printf(_("Num users: %u\n"), info->general.num_users);
+ d_printf(_("Num domain groups: %u\n"),info->general.num_groups);
+ d_printf(_("Num local groups: %u\n"),info->general.num_aliases);
}
done:
int net_rpc_info(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc info\n"
- " Display information about the domain\n");
+ d_printf(_("Usage:\n"
+ "net rpc info\n"
+ " Display information about the domain\n"));
return 0;
}
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)) {
int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc getsid\n"
- " Fetch domain SID into local secrets.tdb\n");
+ d_printf(_("Usage:\n"
+ "net rpc getsid\n"
+ " Fetch domain SID into local secrets.tdb\n"));
return 0;
}
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;
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;
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;
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);
if (argv[1]) {
u1003.usri1003_password = argv[1];
} else {
- asprintf(&prompt, "Enter new password for %s:", argv[0]);
+ ret = asprintf(&prompt, _("Enter new password for %s:"),
+ argv[0]);
+ if (ret == -1) {
+ return -1;
+ }
u1003.usri1003_password = getpass(prompt);
SAFE_FREE(prompt);
}
/* 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;
status = NetUserGetGroups(c->opt_host,
argv[0],
0,
- (uint8_t **)&u0,
+ (uint8_t **)(void *)&u0,
(uint32_t)-1,
&entries_read,
&total_entries);
if (status != 0) {
- d_fprintf(stderr, "Failed to get groups for '%s' with: %s.\n",
+ d_fprintf(stderr,
+ _("Failed to get groups for '%s' with error: %s.\n"),
argv[0], libnetapi_get_error_string(c->netapi_ctx,
status));
return -1;
/* 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;
"add",
rpc_user_add,
NET_TRANSPORT_RPC,
- "Add specified user",
- "net rpc user add\n"
- " Add specified user"
+ N_("Add specified user"),
+ N_("net rpc user add\n"
+ " Add specified user")
},
{
"info",
rpc_user_info,
NET_TRANSPORT_RPC,
- "List domain groups of user",
- "net rpc user info\n"
- " Lis domain groups of user"
+ N_("List domain groups of user"),
+ N_("net rpc user info\n"
+ " Lis domain groups of user")
},
{
"delete",
rpc_user_delete,
NET_TRANSPORT_RPC,
- "Remove specified user",
- "net rpc user delete\n"
- " Remove specified user"
+ N_("Remove specified user"),
+ N_("net rpc user delete\n"
+ " Remove specified user")
},
{
"password",
rpc_user_password,
NET_TRANSPORT_RPC,
- "Change user password",
- "net rpc user password\n"
- " Change user password"
+ N_("Change user password"),
+ N_("net rpc user password\n"
+ " Change user password")
},
{
"rename",
rpc_user_rename,
NET_TRANSPORT_RPC,
- "Rename specified user",
- "net rpc user rename\n"
- " Rename specified user"
+ N_("Rename specified user"),
+ N_("net rpc user rename\n"
+ " Rename specified user")
},
{NULL, NULL, 0, NULL, NULL}
};
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n");
- d_printf("net rpc user\n"
- " List all users\n");
+ d_printf(_("Usage:\n"));
+ d_printf(_("net rpc user\n"
+ " List all users\n"));
net_display_usage_from_functable(func);
return 0;
}
TALLOC_CTX *mem_ctx,
struct rpc_sh_ctx *ctx,
struct rpc_pipe_client *pipe_hnd,
- POLICY_HND *user_hnd,
+ struct policy_handle *user_hnd,
int argc, const char **argv))
{
- POLICY_HND connect_pol, domain_pol, user_pol;
+ struct policy_handle connect_pol, domain_pol, user_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
DOM_SID sid;
uint32 rid;
enum lsa_SidType type;
if (argc == 0) {
- d_fprintf(stderr, "usage: %s <username>\n", ctx->whoami);
+ d_fprintf(stderr, _("usage: %s <username>\n"), ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
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;
}
TALLOC_CTX *mem_ctx,
struct rpc_sh_ctx *ctx,
struct rpc_pipe_client *pipe_hnd,
- POLICY_HND *user_hnd,
+ struct policy_handle *user_hnd,
int argc, const char **argv)
{
NTSTATUS result;
union samr_UserInfo *info = NULL;
if (argc != 0) {
- d_fprintf(stderr, "usage: %s show <username>\n", ctx->whoami);
+ d_fprintf(stderr, _("usage: %s show <username>\n"),ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
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);
TALLOC_CTX *mem_ctx,
struct rpc_sh_ctx *ctx,
struct rpc_pipe_client *pipe_hnd,
- POLICY_HND *user_hnd,
+ struct policy_handle *user_hnd,
int argc, const char **argv)
{
NTSTATUS result;
union samr_UserInfo *info = NULL;
if (argc > 1) {
- d_fprintf(stderr, "usage: %s <username> [new value|NULL]\n",
+ d_fprintf(stderr, _("usage: %s <username> [new value|NULL]\n"),
ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
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;
}
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:
TALLOC_CTX *mem_ctx,
struct rpc_sh_ctx *ctx,
struct rpc_pipe_client *pipe_hnd,
- POLICY_HND *user_hnd,
+ struct policy_handle *user_hnd,
int argc, const char **argv)
{
NTSTATUS result;
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;
}
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;
}
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]);
}
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 }
};
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 }
};
int argc,
const char **argv)
{
- POLICY_HND connect_pol, domain_pol, group_pol, user_pol;
+ struct policy_handle connect_pol, domain_pol, group_pol, user_pol;
bool group_is_primary = false;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32_t group_rid;
struct samr_RidTypeArray *rids = NULL;
/* char **names; */
int i;
- /* DOM_GID *user_gids; */
+ /* struct samr_RidWithAttribute *user_gids; */
struct samr_Ids group_rids, name_types;
struct lsa_String lsa_acct_name;
&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;
}
&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;
}
&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;
}
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;
}
&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);
}
&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;
}
&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;
}
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;
}
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,
if (NT_STATUS_IS_OK(result)) {
if (c->opt_verbose)
- d_printf("ok\n");
+ d_printf(_("ok\n"));
} else {
if (c->opt_verbose)
- d_printf("failed\n");
+ d_printf(_("failed\n"));
goto done;
}
}
&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;
}
&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;
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));
}
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;
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;
{
DOM_SID *sids = NULL;
enum lsa_SidType *types = NULL;
- struct rpc_pipe_client *pipe_hnd;
- POLICY_HND lsa_pol;
+ struct rpc_pipe_client *pipe_hnd = NULL;
+ struct policy_handle lsa_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
}
result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, false,
- SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol);
+ SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
const DOM_SID *group_sid,
const char *member)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result;
uint32 group_rid;
- POLICY_HND group_pol;
+ struct policy_handle group_pol;
struct samr_Ids rids, rid_types;
struct lsa_String lsa_acct_name;
&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;
}
const DOM_SID *alias_sid,
const char *member)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result;
uint32 alias_rid;
- POLICY_HND alias_pol;
+ struct policy_handle alias_pol;
DOM_SID member_sid;
enum lsa_SidType member_type;
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;
}
enum lsa_SidType group_type;
if (argc != 2 || c->display_usage) {
- d_printf("Usage:\n"
- "net rpc group addmem <group> <member>\n"
- " Add a member to a group\n"
- " group\tGroup to add member to\n"
- " member\tMember to add to group\n");
+ d_printf(_("Usage:\n"
+ "net rpc group addmem <group> <member>\n"
+ " Add a member to a group\n"
+ " group\tGroup to add member to\n"
+ " member\tMember to add to group\n"));
return NT_STATUS_UNSUCCESSFUL;
}
if (!NT_STATUS_IS_OK(get_sid_from_name(cli, mem_ctx, argv[0],
&group_sid, &group_type))) {
- d_fprintf(stderr, "Could not lookup group name %s\n", argv[0]);
+ d_fprintf(stderr, _("Could not lookup group name %s\n"),
+ argv[0]);
return NT_STATUS_UNSUCCESSFUL;
}
&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;
&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;
}
const DOM_SID *group_sid,
const char *member)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result;
uint32 group_rid;
- POLICY_HND group_pol;
+ struct policy_handle group_pol;
struct samr_Ids rids, rid_types;
struct lsa_String lsa_acct_name;
&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;
}
const DOM_SID *alias_sid,
const char *member)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result;
uint32 alias_rid;
- POLICY_HND alias_pol;
+ struct policy_handle alias_pol;
DOM_SID member_sid;
enum lsa_SidType member_type;
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;
}
enum lsa_SidType group_type;
if (argc != 2 || c->display_usage) {
- d_printf("Usage:\n"
- "net rpc group delmem <group> <member>\n"
- " Delete a member from a group\n"
- " group\tGroup to delete member from\n"
- " member\tMember to delete from group\n");
+ d_printf(_("Usage:\n"
+ "net rpc group delmem <group> <member>\n"
+ " Delete a member from a group\n"
+ " group\tGroup to delete member from\n"
+ " member\tMember to delete from group\n"));
return NT_STATUS_UNSUCCESSFUL;
}
if (!NT_STATUS_IS_OK(get_sid_from_name(cli, mem_ctx, argv[0],
&group_sid, &group_type))) {
- d_fprintf(stderr, "Could not lookup group name %s\n", argv[0]);
+ d_fprintf(stderr, _("Could not lookup group name %s\n"),
+ argv[0]);
return NT_STATUS_UNSUCCESSFUL;
}
&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;
&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;
}
int argc,
const char **argv)
{
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 start_idx=0, max_entries=250, num_entries, i, loop_count = 0;
struct samr_SamArray *groups = NULL;
bool builtin = false;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc group list [global] [local] [builtin]\n"
- " List groups on RPC server\n"
- " global\tList global groups\n"
- " local\tList local groups\n"
- " builtin\tList builtin groups\n"
- " If none of global, local or builtin is "
- "specified, all three options are considered set\n");
+ d_printf(_("Usage:\n"
+ "net rpc group list [global] [local] [builtin]\n"
+ " List groups on RPC server\n"
+ " global\tList global groups\n"
+ " local\tList local groups\n"
+ " builtin\tList builtin groups\n"
+ " If none of global, local or builtin is "
+ "specified, all three options are considered "
+ "set\n"));
return NT_STATUS_OK;
}
/* 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;
if (c->opt_long_list_entries) {
- POLICY_HND alias_pol;
+ struct policy_handle alias_pol;
union samr_AliasInfo *info = NULL;
if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
if (c->opt_long_list_entries) {
- POLICY_HND alias_pol;
+ struct policy_handle alias_pol;
union samr_AliasInfo *info = NULL;
if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
TALLOC_CTX *mem_ctx,
const char *domain_name,
const DOM_SID *domain_sid,
- POLICY_HND *domain_pol,
+ struct policy_handle *domain_pol,
uint32 rid)
{
NTSTATUS result;
- POLICY_HND group_pol;
+ struct policy_handle group_pol;
uint32 num_members, *group_rids;
int i;
struct samr_RidTypeArray *rids = NULL;
static NTSTATUS rpc_list_alias_members(struct net_context *c,
struct rpc_pipe_client *pipe_hnd,
TALLOC_CTX *mem_ctx,
- POLICY_HND *domain_pol,
+ struct policy_handle *domain_pol,
uint32 rid)
{
NTSTATUS result;
struct rpc_pipe_client *lsa_pipe;
- POLICY_HND alias_pol, lsa_pol;
+ struct policy_handle alias_pol, lsa_pol;
uint32 num_members;
DOM_SID *alias_sids;
char **domains;
&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;
}
&ndr_table_lsarpc.syntax_id,
&lsa_pipe);
if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Couldn't open LSA pipe. Error was %s\n",
+ d_fprintf(stderr, _("Couldn't open LSA pipe. Error was %s\n"),
nt_errstr(result) );
return result;
}
result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, true,
- SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol);
+ SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol);
if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Couldn't open LSA policy handle\n");
+ d_fprintf(stderr, _("Couldn't open LSA policy handle\n"));
TALLOC_FREE(lsa_pipe);
return result;
}
alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members);
if (!alias_sids) {
- d_fprintf(stderr, "Out of memory\n");
+ d_fprintf(stderr, _("Out of memory\n"));
TALLOC_FREE(lsa_pipe);
return NT_STATUS_NO_MEMORY;
}
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;
}
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]);
const char **argv)
{
NTSTATUS result;
- POLICY_HND connect_pol, domain_pol;
+ struct policy_handle connect_pol, domain_pol;
struct samr_Ids rids, rid_types;
struct lsa_String lsa_acct_name;
&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;
}
&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;
}
uint32_t parm_err;
if (argc != 2) {
- d_printf("Usage: 'net rpc group rename group newname'\n");
+ d_printf(_("Usage: 'net rpc group rename group newname'\n"));
return -1;
}
&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;
"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}
};
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;
}
(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));
}
if (c->opt_long_list_entries) {
d_printf("%-12s %-8.8s %-50s\n",
r->shi1_netname,
- share_type[r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)],
+ net_share_type_str(r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)),
r->shi1_remark);
} else {
d_printf("%s\n", r->shi1_netname);
uint32_t i, level = 1;
if (c->display_usage) {
- d_printf("Usage\n"
- "net rpc share list\n"
- " List shares on remote server\n");
+ d_printf(_("Usage\n"
+ "net rpc share list\n"
+ " List shares on remote server\n"));
return 0;
}
status = NetShareEnum(c->opt_host,
level,
- (uint8_t **)&i1,
+ (uint8_t **)(void *)&i1,
(uint32_t)-1,
&entries_read,
&total_entries,
/* 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]);
static bool check_share_availability(struct cli_state *cli, const char *netname)
{
- if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
- d_printf("skipping [%s]: not a file share.\n", netname);
+ if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, netname, "A:", "", 0))) {
+ d_printf(_("skipping [%s]: not a file share.\n"), netname);
return false;
}
{
/* 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;
}
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;
}
/* 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;
&parm_error,
&result);
- if (W_ERROR_V(result) == W_ERROR_V(WERR_ALREADY_EXISTS)) {
- printf(" [%s] does already exist\n",
+ if (W_ERROR_V(result) == W_ERROR_V(WERR_FILE_EXISTS)) {
+ printf(_(" [%s] does already exist\n"),
info502.name);
continue;
}
if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
- printf("cannot add share: %s\n", dos_errstr(result));
+ printf(_("cannot add share: %s\n"), win_errstr(result));
goto done;
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc share migrate shares\n"
- " Migrate shares to local server\n");
+ d_printf(_("Usage:\n"
+ "net rpc share migrate shares\n"
+ " Migrate shares to local server\n"));
return 0;
}
if (!c->opt_host) {
- printf("no server to migrate\n");
+ printf(_("no server to migrate\n"));
return -1;
}
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 */
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;
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));
}
DEBUG(3,("calling cli_list with mask: %s\n", mask));
- if ( !cli_resolve_path(talloc_tos(), "", cp_clistate->cli_share_src,
+ if ( !cli_resolve_path(talloc_tos(), "", NULL, cp_clistate->cli_share_src,
mask, &targetcli, &targetpath ) ) {
- d_fprintf(stderr, "cli_resolve_path %s failed with error: %s\n",
+ d_fprintf(stderr, _("cli_resolve_path %s failed with error: "
+ "%s\n"),
mask, cli_errstr(cp_clistate->cli_share_src));
return false;
}
if (cli_list(targetcli, targetpath, cp_clistate->attribute, copy_fn, cp_clistate) == -1) {
- d_fprintf(stderr, "listing %s failed with error: %s\n",
+ d_fprintf(stderr, _("listing %s failed with error: %s\n"),
mask, cli_errstr(targetcli));
return false;
}
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;
}
/* 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;
}
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;
}
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;
}
static int rpc_share_migrate_files(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net share migrate files\n"
- " Migrate files to local server\n");
+ d_printf(_("Usage:\n"
+ "net share migrate files\n"
+ " Migrate files to local server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
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)
&parm_error,
&result);
if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
- printf("cannot set share-acl: %s\n", dos_errstr(result));
+ printf(_("cannot set share-acl: %s\n"),
+ win_errstr(result));
goto done;
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc share migrate security\n"
- " Migrate share-acls to local server\n");
+ d_printf(_("Usage:\n"
+ "net rpc share migrate security\n"
+ " Migrate share-acls to local server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
int ret;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc share migrate all\n"
- " Migrates shares including all share settings\n");
+ d_printf(_("Usage:\n"
+ "net rpc share migrate all\n"
+ " Migrates shares including all share settings\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
"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}
};
static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
TALLOC_CTX *mem_ctx,
- POLICY_HND *connect_pol,
+ struct policy_handle *connect_pol,
const DOM_SID *domain_sid)
{
uint32 start_idx, max_entries, num_entries, i;
struct samr_SamArray *groups = NULL;
NTSTATUS result;
- POLICY_HND domain_pol;
+ struct policy_handle domain_pol;
/* Get domain policy handle */
&num_entries);
for (i = 0; i < num_entries; i++) {
- POLICY_HND alias_pol;
+ struct policy_handle alias_pol;
struct full_alias alias;
struct lsa_SidArray sid_array;
int j;
{
int i;
NTSTATUS result;
- POLICY_HND lsa_pol;
+ struct policy_handle lsa_pol;
result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
+ SEC_FLAG_MAXIMUM_ALLOWED,
&lsa_pol);
if (!NT_STATUS_IS_OK(result))
return result;
const char **argv)
{
NTSTATUS result;
- POLICY_HND connect_pol;
+ struct policy_handle connect_pol;
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
pipe_hnd->desthost,
token->num_sids = 4;
if (!(token->user_sids = SMB_MALLOC_ARRAY(DOM_SID, 4))) {
- d_fprintf(stderr, "malloc failed\n");
+ d_fprintf(stderr, _("malloc failed\n"));
token->num_sids = 0;
return;
}
SAFE_FREE(token->user_sids);
}
-static bool is_sid_in_token(NT_USER_TOKEN *token, DOM_SID *sid)
-{
- int i;
-
- for (i=0; i<token->num_sids; i++) {
- if (sid_compare(sid, &token->user_sids[i]) == 0)
- return true;
- }
- return false;
-}
-
static void add_sid_to_token(NT_USER_TOKEN *token, DOM_SID *sid)
{
if (is_sid_in_token(token, sid))
return false;
}
- string_to_sid(&user_sid, sid_str);
+ if (!string_to_sid(&user_sid, sid_str)) {
+ DEBUG(1,("Could not convert sid %s from string\n", sid_str));
+ return false;
+ }
+
wbcFreeMemory(sid_str);
sid_str = NULL;
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;
}
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;
}
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;
}
/* We have a SID */
DOM_SID sid;
- string_to_sid(&sid, &line[1]);
+ if(!string_to_sid(&sid, &line[1])) {
+ DEBUG(1,("get_user_tokens_from_file: Could "
+ "not convert sid %s \n",&line[1]));
+ return false;
+ }
if (token == NULL) {
DEBUG(0, ("File does not begin with username"));
int num_tokens,
struct user_token *tokens)
{
- int fnum;
+ uint16_t fnum;
SEC_DESC *share_sd = NULL;
SEC_DESC *root_sd = NULL;
struct cli_state *cli = rpc_pipe_np_smb_conn(pipe_hnd);
cnum = cli->cnum;
- if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
+ if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, netname, "A:", "", 0))) {
return;
}
- fnum = cli_nt_create(cli, "\\", READ_CONTROL_ACCESS);
-
- if (fnum != -1) {
+ if (!NT_STATUS_IS_OK(cli_ntcreate(cli, "\\", 0, READ_CONTROL_ACCESS, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
root_sd = cli_query_secdesc(cli, fnum, mem_ctx);
}
uint32 acc_granted;
if (share_sd != NULL) {
- if (!se_access_check(share_sd, &tokens[i].token,
- 1, &acc_granted, &status)) {
+ status = se_access_check(share_sd, &tokens[i].token,
+ 1, &acc_granted);
+
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not check share_sd for "
"user %s\n",
tokens[i].name));
continue;
}
-
- if (!NT_STATUS_IS_OK(status))
- continue;
}
if (root_sd == NULL) {
continue;
}
- if (!se_access_check(root_sd, &tokens[i].token,
- 1, &acc_granted, &status)) {
+ status = se_access_check(root_sd, &tokens[i].token,
+ 1, &acc_granted);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not check root_sd for user %s\n",
tokens[i].name));
continue;
}
-
- if (!NT_STATUS_IS_OK(status))
- continue;
-
d_printf(" %s\n", tokens[i].name);
}
- if (fnum != -1)
+ if (fnum != (uint16_t)-1)
cli_close(cli, fnum);
cli_tdis(cli);
cli->cnum = cnum;
{
int ret;
bool r;
- ENUM_HND hnd;
uint32 i;
FILE *f;
for (i=0; i<num_tokens; i++)
collect_alias_memberships(&tokens[i].token);
- init_enum_hnd(&hnd, 0);
-
share_list.num_shares = 0;
share_list.shares = NULL;
int result;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc share allowedusers\n"
- " List allowed users\n");
+ d_printf(_("Usage:\n"
+ "net rpc share allowedusers\n"
+ " List allowed users\n"));
return 0;
}
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;
"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}
};
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc share\n"
- " List shares\n"
- " Alias for net rpc share list\n");
+ d_printf(_("Usage:\n"
+ "net rpc share\n"
+ " List shares\n"
+ " Alias for net rpc share list\n"));
net_display_usage_from_functable(func);
return 0;
}
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;
}
int argc, const char **argv)
{
if (argc != 1) {
- d_fprintf(stderr, "usage: %s <share>\n", ctx->whoami);
+ d_fprintf(stderr, _("usage: %s <share>\n"), ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
NTSTATUS status;
if (argc != 1) {
- d_fprintf(stderr, "usage: %s <share>\n", ctx->whoami);
+ d_fprintf(stderr, _("usage: %s <share>\n"), ctx->whoami);
return NT_STATUS_INVALID_PARAMETER;
}
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);
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 }
};
/**
* Formatted print of open file info
*
- * @param r struct srvsvc_NetFileInfo3 contents
+ * @param r struct FILE_INFO_3 contents
**/
-static void display_file_info_3(struct srvsvc_NetFileInfo3 *r)
+static void display_file_info_3(struct FILE_INFO_3 *r)
{
d_printf("%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
- r->fid, r->user, r->permissions, r->num_locks, r->path);
+ r->fi3_id, r->fi3_username, r->fi3_permissions,
+ r->fi3_num_locks, r->fi3_pathname);
}
/**
- * List open files on a remote RPC server.
- *
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passed through.
+ * List files for a user on a remote RPC server.
*
- * @param c A net_context structure.
- * @param domain_sid The domain sid acquired from the remote server.
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destroyed on completion of the function.
* @param argc Standard main() style argc.
* @param argv Standard main() style argv. Initial components are already
* stripped.
*
- * @return Normal NTSTATUS return.
+ * @return A shell status integer (0 for success)..
**/
-static NTSTATUS rpc_file_list_internals(struct net_context *c,
- const DOM_SID *domain_sid,
- const char *domain_name,
- struct cli_state *cli,
- struct rpc_pipe_client *pipe_hnd,
- TALLOC_CTX *mem_ctx,
- int argc,
- const char **argv)
+static int rpc_file_user(struct net_context *c, int argc, const char **argv)
{
- struct srvsvc_NetFileInfoCtr info_ctr;
- struct srvsvc_NetFileCtr3 ctr3;
- WERROR result;
- NTSTATUS status;
+ NET_API_STATUS status;
uint32 preferred_len = 0xffffffff, i;
const char *username=NULL;
uint32_t total_entries = 0;
+ uint32_t entries_read = 0;
uint32_t resume_handle = 0;
+ struct FILE_INFO_3 *i3 = NULL;
+
+ if (c->display_usage) {
+ return rpc_file_usage(c, argc, argv);
+ }
/* if argc > 0, must be user command */
- if (argc > 0)
+ if (argc > 0) {
username = smb_xstrdup(argv[0]);
+ }
- ZERO_STRUCT(info_ctr);
- ZERO_STRUCT(ctr3);
-
- info_ctr.level = 3;
- info_ctr.ctr.ctr3 = &ctr3;
-
- status = rpccli_srvsvc_NetFileEnum(pipe_hnd, mem_ctx,
- pipe_hnd->desthost,
- NULL,
- username,
- &info_ctr,
- preferred_len,
- &total_entries,
- &resume_handle,
- &result);
+ status = NetFileEnum(c->opt_host,
+ NULL,
+ username,
+ 3,
+ (uint8_t **)(void *)&i3,
+ preferred_len,
+ &entries_read,
+ &total_entries,
+ &resume_handle);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result))
+ if (status != 0) {
goto done;
+ }
/* Display results */
- d_printf(
+ d_printf(_(
"\nEnumerating open files on remote server:\n\n"
"\nFileId Opened by Perms Locks Path"
- "\n------ --------- ----- ----- ---- \n");
- for (i = 0; i < total_entries; i++)
- display_file_info_3(&info_ctr.ctr.ctr3->array[i]);
- done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-}
-
-/**
- * List files for a user on a remote RPC server.
- *
- * @param argc Standard main() style argc.
- * @param argv Standard main() style argv. Initial components are already
- * stripped.
- *
- * @return A shell status integer (0 for success)..
- **/
-
-static int rpc_file_user(struct net_context *c, int argc, const char **argv)
-{
- if (argc < 1 || c->display_usage) {
- return rpc_file_usage(c, argc, argv);
+ "\n------ --------- ----- ----- ---- \n"));
+ for (i = 0; i < entries_read; i++) {
+ display_file_info_3(&i3[i]);
}
-
- return run_rpc_command(c, NULL, &ndr_table_srvsvc.syntax_id, 0,
- rpc_file_list_internals,
- argc, argv);
+ done:
+ return status;
}
/**
"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}
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n");
- d_printf("net rpc file\n"
- " List opened files\n");
+ d_printf(_("Usage:\n"));
+ d_printf(_("net rpc file\n"
+ " List opened files\n"));
net_display_usage_from_functable(func);
return 0;
}
- return run_rpc_command(c, NULL, &ndr_table_srvsvc.syntax_id, 0,
- rpc_file_list_internals,
- argc, argv);
+ return rpc_file_user(c, argc, argv);
}
return net_run_function(c, argc, argv, "net rpc file", func);
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"));
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"));
int rc = -1;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc abortshutdown\n"
- " Abort a scheduled shutdown\n");
+ d_printf(_("Usage:\n"
+ "net rpc abortshutdown\n"
+ " Abort a scheduled shutdown\n"));
return 0;
}
const char **argv)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- const char *msg = "This machine will be shutdown shortly";
+ const char *msg = N_("This machine will be shutdown shortly");
uint32 timeout = 20;
- struct initshutdown_String msg_string;
- struct initshutdown_String_sub s;
+ struct lsa_StringLarge msg_string;
if (c->opt_comment) {
msg = c->opt_comment;
timeout = c->opt_timeout;
}
- s.name = msg;
- msg_string.name = &s;
+ msg_string.string = msg;
/* create an entry */
result = rpccli_initshutdown_Init(pipe_hnd, mem_ctx, NULL,
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"));
int argc,
const char **argv)
{
- const char *msg = "This machine will be shutdown shortly";
+ const char *msg = N_("This machine will be shutdown shortly");
uint32 timeout = 20;
- struct initshutdown_String msg_string;
- struct initshutdown_String_sub s;
+ struct lsa_StringLarge msg_string;
NTSTATUS result;
WERROR werr;
if (c->opt_comment) {
msg = c->opt_comment;
}
- s.name = msg;
- msg_string.name = &s;
+ msg_string.string = msg;
if (c->opt_timeout) {
timeout = c->opt_timeout;
&werr);
if (NT_STATUS_IS_OK(result)) {
- d_printf("\nShutdown of remote machine succeeded\n");
+ d_printf(_("\nShutdown of remote machine succeeded\n"));
} else {
d_fprintf(stderr, "\nShutdown of remote machine failed\n");
if ( W_ERROR_EQUAL(werr, WERR_MACHINE_LOCKED) )
d_fprintf(stderr, "\nMachine locked, use -f switch to force\n");
else
- d_fprintf(stderr, "\nresult was: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "\nresult was: %s\n", win_errstr(werr));
}
return result;
int rc = -1;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc shutdown\n"
- " Shut down a remote RPC server\n");
+ d_printf(_("Usage:\n"
+ "net rpc shutdown\n"
+ " Shut down a remote RPC server\n"));
return 0;
}
int argc,
const char **argv)
{
- POLICY_HND connect_pol, domain_pol, user_pol;
+ struct policy_handle connect_pol, domain_pol, user_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
struct lsa_String lsa_acct_name;
unsigned int orig_timeout;
if (argc != 2) {
- d_printf("Usage: net rpc trustdom add <domain_name> "
- "<trust password>\n");
+ d_printf(_("Usage: net rpc trustdom add <domain_name> "
+ "<trust password>\n"));
return NT_STATUS_INVALID_PARAMETER;
}
rpccli_set_timeout(pipe_hnd, orig_timeout);
if (!NT_STATUS_IS_OK(result)) {
- d_printf("net rpc trustdom add: create user %s failed %s\n",
+ d_printf(_("net rpc trustdom add: create user %s failed %s\n"),
acct_name, nt_errstr(result));
goto done;
}
{
- NTTIME notime;
- struct samr_LogonHours hours;
- struct lsa_BinaryString parameters;
- const int units_per_week = 168;
struct samr_CryptPassword crypt_pwd;
- ZERO_STRUCT(notime);
- ZERO_STRUCT(hours);
- ZERO_STRUCT(parameters);
-
- hours.bits = talloc_array(mem_ctx, uint8_t, units_per_week);
- if (!hours.bits) {
- result = NT_STATUS_NO_MEMORY;
- goto done;
- }
- hours.units_per_week = units_per_week;
- memset(hours.bits, 0xFF, units_per_week);
+ ZERO_STRUCT(info.info23);
init_samr_CryptPassword(argv[1],
&cli->user_session_key,
&crypt_pwd);
- init_samr_user_info23(&info.info23,
- notime, notime, notime,
- notime, notime, notime,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, ¶meters,
- 0, 0, ACB_DOMTRUST, SAMR_FIELD_ACCT_FLAGS,
- hours,
- 0, 0, 0, 0, 0, 0, 0,
- crypt_pwd.data, 24);
+ info.info23.info.fields_present = SAMR_FIELD_ACCT_FLAGS |
+ SAMR_FIELD_NT_PASSWORD_PRESENT;
+ info.info23.info.acct_flags = ACB_DOMTRUST;
+ info.info23.password = crypt_pwd;
result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
&user_pol,
return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id, 0,
rpc_trustdom_add_internals, argc, argv);
} else {
- d_printf("Usage:\n"
- "net rpc trustdom add <domain_name> <trust password>\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom add <domain_name> <trust "
+ "password>\n"));
return -1;
}
}
int argc,
const char **argv)
{
- POLICY_HND connect_pol, domain_pol, user_pol;
+ struct policy_handle connect_pol, domain_pol, user_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
DOM_SID trust_acct_sid;
struct lsa_String lsa_acct_name;
if (argc != 1) {
- d_printf("Usage: net rpc trustdom del <domain_name>\n");
+ d_printf(_("Usage: net rpc trustdom del <domain_name>\n"));
return NT_STATUS_INVALID_PARAMETER;
}
&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;
}
&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;
}
&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;
}
&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;
}
return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id, 0,
rpc_trustdom_del_internals, argc, argv);
} else {
- d_printf("Usage:\n"
- "net rpc trustdom del <domain>\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom del <domain>\n"));
return -1;
}
}
struct cli_state *cli = NULL;
struct sockaddr_storage server_ss;
struct rpc_pipe_client *pipe_hnd = NULL;
- POLICY_HND connect_hnd;
+ struct policy_handle connect_hnd;
TALLOC_CTX *mem_ctx;
NTSTATUS nt_status;
DOM_SID *domain_sid;
*/
if (argc != 1 || c->display_usage) {
- d_printf("Usage:\n"
- "net rpc trustdom establish <domain_name>\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom establish <domain_name>\n"));
return -1;
}
strupper_m(domain_name);
/* account name used at first is our domain's name with '$' */
- asprintf(&acct_name, "%s$", lp_workgroup());
+ if (asprintf(&acct_name, "%s$", lp_workgroup()) == -1) {
+ return -1;
+ }
strupper_m(acct_name);
/*
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",
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;
}
int rc = -1;
if (argc < 1 || c->display_usage) {
- d_printf("Usage:\n"
- "net rpc trustdom revoke <domain_name>\n"
- " Revoke trust relationship\n"
- " domain_name\tName of domain to revoke trust\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom revoke <domain_name>\n"
+ " Revoke trust relationship\n"
+ " domain_name\tName of domain to revoke trust\n"));
return -1;
}
static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
TALLOC_CTX *mem_ctx,
- POLICY_HND *pol,
+ struct policy_handle *pol,
DOM_SID dom_sid,
const char *trusted_dom_name)
{
NTSTATUS nt_status;
union lsa_TrustedDomainInfo *info = NULL;
char *cleartextpwd = NULL;
- uint8_t nt_hash[16];
- DATA_BLOB data;
+ uint8_t session_key[16];
+ DATA_BLOB session_key_blob;
+ DATA_BLOB data = data_blob_null;
nt_status = rpccli_lsa_QueryTrustedDomainInfoBySid(pipe_hnd, mem_ctx,
pol,
data = data_blob(info->password.password->data,
info->password.password->length);
- if (!rpccli_get_pwd_hash(pipe_hnd, nt_hash)) {
+ if (!rpccli_get_pwd_hash(pipe_hnd, session_key)) {
DEBUG(0, ("Could not retrieve password hash\n"));
goto done;
}
- cleartextpwd = decrypt_trustdom_secret(nt_hash, &data);
+ session_key_blob = data_blob_const(session_key, sizeof(session_key));
+ cleartextpwd = sess_decrypt_string(mem_ctx, &data, &session_key_blob);
if (cleartextpwd == NULL) {
DEBUG(0,("retrieved NULL password\n"));
NTSTATUS nt_status;
const char *domain_name = NULL;
DOM_SID *queried_dom_sid;
- POLICY_HND connect_hnd;
+ struct policy_handle connect_hnd;
union lsa_PolicyInformation *info = NULL;
/* trusted domains listing variables */
fstring pdc_name;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc trustdom vampire\n"
- " Vampire trust relationship from remote server\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom vampire\n"
+ " Vampire trust relationship from remote server\n"));
return 0;
}
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",
* 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,
* 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));
DOM_SID *queried_dom_sid;
fstring padding;
int ascii_dom_name_len;
- POLICY_HND connect_hnd;
+ struct policy_handle connect_hnd;
union lsa_PolicyInformation *info = NULL;
/* trusted domains listing variables */
fstring pdc_name;
/* trusting domains listing variables */
- POLICY_HND domain_hnd;
+ struct policy_handle domain_hnd;
struct samr_SamArray *trusts = NULL;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc trustdom list\n"
- " List trust relationships\n");
+ d_printf(_("Usage:\n"
+ "net rpc trustdom list\n"
+ " List in- and outgoing trust relationships\n"));
return 0;
}
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",
* the end of enumeration is reached
*/
- d_printf("Trusted domains list:\n\n");
+ d_printf(_("Trusted domains list:\n\n"));
do {
nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
* 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));
* 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
/* SamrConnect2 */
nt_status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
pipe_hnd->desthost,
- SA_RIGHT_SAM_OPEN_DOMAIN,
+ SAMR_ACCESS_LOOKUP_DOMAIN,
&connect_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Couldn't open SAMR policy handle. Error was %s\n",
able to enumerate accounts*/
nt_status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
&connect_hnd,
- SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+ SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS,
queried_dom_sid,
&domain_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
&ndr_table_lsarpc.syntax_id, 0,
rpc_query_domain_sid, argc,
argv))
- d_fprintf(stderr, "couldn't get domain's sid\n");
+ d_fprintf(stderr,
+ _("couldn't get domain's sid\n"));
cli_shutdown(remote_cli);
} else {
- d_fprintf(stderr, "domain controller is not "
- "responding: %s\n",
+ d_fprintf(stderr, _("domain controller is not "
+ "responding: %s\n"),
nt_errstr(nt_status));
};
};
"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}
};
if (!attempt_netbios_session_request(&cli, global_myname(),
server_name, &server_ss))
goto done;
- if (!cli_negprot(cli))
+ status = cli_negprot(cli);
+ if (!NT_STATUS_IS_OK(status))
goto done;
if (cli->protocol < PROTOCOL_NT1)
goto done;
/* dump sam database via samsync rpc calls */
static int rpc_samdump(struct net_context *c, int argc, const char **argv) {
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc samdump\n"
- " Dump remote SAM database\n");
+ d_printf(_("Usage:\n"
+ "net rpc samdump\n"
+ " Dump remote SAM database\n"));
return 0;
}
"ldif",
rpc_vampire_ldif,
NET_TRANSPORT_RPC,
- "Dump remote SAM database to ldif",
- "net rpc vampire ldif\n"
- " Dump remote SAM database to LDIF file or stdout"
+ N_("Dump remote SAM database to ldif"),
+ N_("net rpc vampire ldif\n"
+ " Dump remote SAM database to LDIF file or "
+ "stdout")
},
{
"keytab",
rpc_vampire_keytab,
NET_TRANSPORT_RPC,
- "Dump remote SAM database to Kerberos Keytab",
- "net rpc vampire keytab\n"
- " Dump remote SAM database to Kerberos keytab file"
+ N_("Dump remote SAM database to Kerberos Keytab"),
+ N_("net rpc vampire keytab\n"
+ " Dump remote SAM database to Kerberos keytab "
+ "file")
+ },
+ {
+ "passdb",
+ rpc_vampire_passdb,
+ NET_TRANSPORT_RPC,
+ N_("Dump remote SAM database to passdb"),
+ N_("net rpc vampire passdb\n"
+ " Dump remote SAM database to passdb")
},
{NULL, NULL, 0, NULL, NULL}
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc vampire\n"
- " Vampire remote SAM database\n");
+ d_printf(_("Usage:\n"
+ "net rpc vampire\n"
+ " Vampire remote SAM database\n"));
return 0;
}
int ret;
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate all\n"
- " Migrate everything from a print server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate all\n"
+ " Migrate everything from a print server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_printers_internals, argc,
argv);
if (ret)
return ret;
- ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_drivers_internals, argc,
argv);
if (ret)
return ret;
- ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_forms_internals, argc, argv);
if (ret)
return ret;
- ret = run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ ret = run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_settings_internals, argc,
argv);
if (ret)
return ret;
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_security_internals, argc,
argv);
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate drivers\n"
- " Migrate print-drivers from a print-server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate drivers\n"
+ " Migrate print-drivers from a print-server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_drivers_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate forms\n"
- " Migrate print-forms from a print-server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate forms\n"
+ " Migrate print-forms from a print-server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_forms_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate printers\n"
- " Migrate printers from a print-server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate printers\n"
+ " Migrate printers from a print-server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_printers_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate security\n"
- " Migrate printer-ACLs from a print-server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate security\n"
+ " Migrate printer-ACLs from a print-server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_security_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer migrate settings\n"
- " Migrate printer-settings from a print-server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer migrate settings\n"
+ " Migrate printer-settings from a "
+ "print-server\n"));
return 0;
}
if (!c->opt_host) {
- d_printf("no server to migrate\n");
+ d_printf(_("no server to migrate\n"));
return -1;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_migrate_settings_internals,
argc, argv);
}
"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}
};
static int rpc_printer_list(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer list\n"
- " List printers on a remote RPC server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer list\n"
+ " List printers on a remote RPC server\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_list_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer driver\n"
- " List printer-drivers on a remote RPC server\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer driver\n"
+ " List printer-drivers on a remote RPC server\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_driver_list_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer publish publish\n"
- " Publish printer in ADS via MSRPC\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer publish publish\n"
+ " Publish printer in ADS via MSRPC\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_publish_publish_internals,
argc, argv);
}
static int rpc_printer_publish_update(struct net_context *c, int argc, const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer publish update\n"
- " Update printer in ADS via MSRPC\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer publish update\n"
+ " Update printer in ADS via MSRPC\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_publish_update_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer publish unpublish\n"
- " UnPublish printer in ADS via MSRPC\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer publish unpublish\n"
+ " UnPublish printer in ADS via MSRPC\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_publish_unpublish_internals,
argc, argv);
}
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net rpc printer publish list\n"
- " List published printers via MSRPC\n");
+ d_printf(_("Usage:\n"
+ "net rpc printer publish list\n"
+ " List published printers via MSRPC\n"));
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_publish_list_internals,
argc, argv);
}
"publish",
rpc_printer_publish_publish,
NET_TRANSPORT_RPC,
- "Publish printer in AD",
- "net rpc printer publish publish\n"
- " Publish printer in AD"
+ N_("Publish printer in AD"),
+ N_("net rpc printer publish publish\n"
+ " Publish printer in AD")
},
{
"update",
rpc_printer_publish_update,
NET_TRANSPORT_RPC,
- "Update printer in AD",
- "net rpc printer publish update\n"
- " Update printer in AD"
+ N_("Update printer in AD"),
+ N_("net rpc printer publish update\n"
+ " Update printer in AD")
},
{
"unpublish",
rpc_printer_publish_unpublish,
NET_TRANSPORT_RPC,
- "Unpublish printer",
- "net rpc printer publish unpublish\n"
- " Unpublish printer"
+ N_("Unpublish printer"),
+ N_("net rpc printer publish unpublish\n"
+ " Unpublish printer")
},
{
"list",
rpc_printer_publish_list,
NET_TRANSPORT_RPC,
- "List published printers",
- "net rpc printer publish list\n"
- " List published printers"
+ N_("List published printers"),
+ N_("net rpc printer publish list\n"
+ " List published printers")
},
{NULL, NULL, 0, NULL, NULL}
};
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n");
- d_printf("net rpc printer publish\n"
- " List published printers\n"
- " Alias of net rpc printer publish list\n");
+ d_printf(_("Usage:\n"));
+ d_printf(_("net rpc printer publish\n"
+ " List published printers\n"
+ " Alias of net rpc printer publish "
+ "list\n"));
net_display_usage_from_functable(func);
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_publish_list_internals,
argc, argv);
}
**/
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;
}
"list",
rpc_printer_list,
NET_TRANSPORT_RPC,
- "List all printers on print server",
- "net rpc printer list\n"
- " List all printers on print server"
+ N_("List all printers on print server"),
+ N_("net rpc printer list\n"
+ " List all printers on print server")
},
{
"migrate",
rpc_printer_migrate,
NET_TRANSPORT_RPC,
- "Migrate printer to local server",
- "net rpc printer migrate\n"
- " Migrate printer to local server"
+ N_("Migrate printer to local server"),
+ N_("net rpc printer migrate\n"
+ " Migrate printer to local server")
},
{
"driver",
rpc_printer_driver_list,
NET_TRANSPORT_RPC,
- "List printer drivers",
- "net rpc printer driver\n"
- " List printer drivers"
+ N_("List printer drivers"),
+ N_("net rpc printer driver\n"
+ " List printer drivers")
},
{
"publish",
rpc_printer_publish,
NET_TRANSPORT_RPC,
- "Publish printer in AD",
- "net rpc printer publish\n"
- " Publish printer in AD"
+ N_("Publish printer in AD"),
+ N_("net rpc printer publish\n"
+ " Publish printer in AD")
},
{NULL, NULL, 0, NULL, NULL}
};
if (argc == 0) {
if (c->display_usage) {
- d_printf("Usage:\n");
- d_printf("net rpc printer\n"
- " List printers\n");
+ d_printf(_("Usage:\n"));
+ d_printf(_("net rpc printer\n"
+ " List printers\n"));
net_display_usage_from_functable(func);
return 0;
}
- return run_rpc_command(c, NULL, &syntax_spoolss, 0,
+ return run_rpc_command(c, NULL, &ndr_table_spoolss.syntax_id, 0,
rpc_printer_list_internals,
argc, argv);
}
int net_rpc(struct net_context *c, int argc, const char **argv)
{
+ NET_API_STATUS status;
+
struct functable func[] = {
{
"audit",
net_rpc_audit,
NET_TRANSPORT_RPC,
- "Modify global audit settings",
- "net rpc audit\n"
- " Modify global audit settings"
+ N_("Modify global audit settings"),
+ N_("net rpc audit\n"
+ " Modify global audit settings")
},
{
"info",
net_rpc_info,
NET_TRANSPORT_RPC,
- "Show basic info about a domain",
- "net rpc info\n"
- " Show basic info about a domain"
+ N_("Show basic info about a domain"),
+ N_("net rpc info\n"
+ " Show basic info about a domain")
},
{
"join",
net_rpc_join,
NET_TRANSPORT_RPC,
- "Join a domain",
- "net rpc join\n"
- " Join a domain"
+ N_("Join a domain"),
+ N_("net rpc join\n"
+ " Join a domain")
},
{
"oldjoin",
net_rpc_oldjoin,
NET_TRANSPORT_RPC,
- "Join a domain created in server manager",
- "net rpc oldjoin\n"
- " Join a domain created in server manager"
+ N_("Join a domain created in server manager"),
+ N_("net rpc oldjoin\n"
+ " Join a domain created in server manager")
},
{
"testjoin",
net_rpc_testjoin,
NET_TRANSPORT_RPC,
- "Test that a join is valid",
- "net rpc testjoin\n"
- " Test that a join is valid"
+ N_("Test that a join is valid"),
+ N_("net rpc testjoin\n"
+ " Test that a join is valid")
},
{
"user",
net_rpc_user,
NET_TRANSPORT_RPC,
- "List/modify users",
- "net rpc user\n"
- " List/modify users"
+ N_("List/modify users"),
+ N_("net rpc user\n"
+ " List/modify users")
},
{
"password",
rpc_user_password,
NET_TRANSPORT_RPC,
- "Change a user password",
- "net rpc password\n"
- " Change a user password\n"
- " Alias for net rpc user password"
+ N_("Change a user password"),
+ N_("net rpc password\n"
+ " Change a user password\n"
+ " Alias for net rpc user password")
},
{
"group",
net_rpc_group,
NET_TRANSPORT_RPC,
- "List/modify groups",
- "net rpc group\n"
- " List/modify groups"
+ N_("List/modify groups"),
+ N_("net rpc group\n"
+ " List/modify groups")
},
{
"share",
net_rpc_share,
NET_TRANSPORT_RPC,
- "List/modify shares",
- "net rpc share\n"
- " List/modify shares"
+ N_("List/modify shares"),
+ N_("net rpc share\n"
+ " List/modify shares")
},
{
"file",
net_rpc_file,
NET_TRANSPORT_RPC,
- "List open files",
- "net rpc file\n"
- " List open files"
+ N_("List open files"),
+ N_("net rpc file\n"
+ " List open files")
},
{
"printer",
net_rpc_printer,
NET_TRANSPORT_RPC,
- "List/modify printers",
- "net rpc printer\n"
- " List/modify printers"
+ N_("List/modify printers"),
+ N_("net rpc printer\n"
+ " List/modify printers")
},
{
"changetrustpw",
net_rpc_changetrustpw,
NET_TRANSPORT_RPC,
- "Change trust account password",
- "net rpc changetrustpw\n"
- " Change trust account password"
+ N_("Change trust account password"),
+ N_("net rpc changetrustpw\n"
+ " Change trust account password")
},
{
"trustdom",
rpc_trustdom,
NET_TRANSPORT_RPC,
- "Modify domain trusts",
- "net rpc trustdom\n"
- " Modify domain trusts"
+ N_("Modify domain trusts"),
+ N_("net rpc trustdom\n"
+ " Modify domain trusts")
},
{
"abortshutdown",
rpc_shutdown_abort,
NET_TRANSPORT_RPC,
- "Abort a remote shutdown",
- "net rpc abortshutdown\n"
- " Abort a remote shutdown"
+ N_("Abort a remote shutdown"),
+ N_("net rpc abortshutdown\n"
+ " Abort a remote shutdown")
},
{
"shutdown",
rpc_shutdown,
NET_TRANSPORT_RPC,
- "Shutdown a remote server",
- "net rpc shutdown\n"
- " Shutdown a remote server"
+ N_("Shutdown a remote server"),
+ N_("net rpc shutdown\n"
+ " Shutdown a remote server")
},
{
"samdump",
rpc_samdump,
NET_TRANSPORT_RPC,
- "Dump SAM data of remote NT PDC",
- "net rpc samdump\n"
- " Dump SAM data of remote NT PDC"
+ N_("Dump SAM data of remote NT PDC"),
+ N_("net rpc samdump\n"
+ " Dump SAM data of remote NT PDC")
},
{
"vampire",
rpc_vampire,
NET_TRANSPORT_RPC,
- "Sync a remote NT PDC's data into local passdb",
- "net rpc vampire\n"
- " Sync a remote NT PDC's data into local passdb"
+ N_("Sync a remote NT PDC's data into local passdb"),
+ N_("net rpc vampire\n"
+ " Sync a remote NT PDC's data into local passdb")
},
{
"getsid",
net_rpc_getsid,
NET_TRANSPORT_RPC,
- "Fetch the domain sid into local secrets.tdb",
- "net rpc getsid\n"
- " Fetch the domain sid into local secrets.tdb"
+ N_("Fetch the domain sid into local secrets.tdb"),
+ N_("net rpc getsid\n"
+ " Fetch the domain sid into local secrets.tdb")
},
{
"rights",
net_rpc_rights,
NET_TRANSPORT_RPC,
- "Manage privileges assigned to SID",
- "net rpc rights\n"
- " Manage privileges assigned to SID"
+ N_("Manage privileges assigned to SID"),
+ N_("net rpc rights\n"
+ " Manage privileges assigned to SID")
},
{
"service",
net_rpc_service,
NET_TRANSPORT_RPC,
- "Start/stop/query remote services",
- "net rpc service\n"
- " Start/stop/query remote services"
+ N_("Start/stop/query remote services"),
+ N_("net rpc service\n"
+ " Start/stop/query remote services")
},
{
"registry",
net_rpc_registry,
NET_TRANSPORT_RPC,
- "Manage registry hives",
- "net rpc registry\n"
- " Manage registry hives"
+ N_("Manage registry hives"),
+ N_("net rpc registry\n"
+ " Manage registry hives")
},
{
"shell",
net_rpc_shell,
NET_TRANSPORT_RPC,
- "Open interactive shell on remote server",
- "net rpc shell\n"
- " Open interactive shell on remote server"
+ N_("Open interactive shell on remote server"),
+ N_("net rpc shell\n"
+ " Open interactive shell on remote server")
},
{NULL, NULL, 0, NULL, NULL}
};
+
+ status = libnetapi_init(&c->netapi_ctx);
+ if (status != 0) {
+ return -1;
+ }
+ libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
+ libnetapi_set_password(c->netapi_ctx, c->opt_password);
+ if (c->opt_kerberos) {
+ libnetapi_set_use_kerberos(c->netapi_ctx);
+ }
+
return net_run_function(c, argc, argv, "net rpc", func);
}