summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c78
-rw-r--r--source3/rpcclient/cmd_samr.c4
-rw-r--r--source3/rpcclient/rpcclient.c38
3 files changed, 63 insertions, 57 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 3d14a66cfe..16d29fc763 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -26,10 +26,10 @@ extern int DEBUGLEVEL;
extern pstring server;
/* Look up domain related information on a remote host */
-static uint32 cmd_lsa_query_info_policy(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_lsa_query_info_policy(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_policy_hnd = False;
DOM_SID dom_sid;
fstring sid_str, domain_name;
@@ -38,7 +38,7 @@ static uint32 cmd_lsa_query_info_policy(struct cli_state *cli, int argc, char **
if (argc > 2) {
printf("Usage: %s [info_class]\n", argv[0]);
- return 0;
+ return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@@ -57,9 +57,10 @@ static uint32 cmd_lsa_query_info_policy(struct cli_state *cli, int argc, char **
return NT_STATUS_UNSUCCESSFUL;
}
- if ((result = cli_lsa_open_policy(cli, mem_ctx, True,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
- &pol)) != NT_STATUS_OK) {
+ result = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED,
+ &pol);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -67,9 +68,9 @@ static uint32 cmd_lsa_query_info_policy(struct cli_state *cli, int argc, char **
/* Lookup info policy */
- if ((result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class,
- domain_name, &dom_sid))
- != NT_STATUS_OK) {
+ result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class,
+ domain_name, &dom_sid);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -95,10 +96,10 @@ done:
/* Resolve a list of names to a list of sids */
-static uint32 cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_policy_hnd = False;
DOM_SID *sids;
uint32 *types;
@@ -107,7 +108,7 @@ static uint32 cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
if (argc == 1) {
printf("Usage: %s [name1 [name2 [...]]]\n", argv[0]);
- return 0;
+ return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@@ -123,9 +124,10 @@ static uint32 cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
}
- if ((result = cli_lsa_open_policy(cli, mem_ctx, True,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
- &pol)) != NT_STATUS_OK) {
+ result = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED,
+ &pol);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -133,9 +135,9 @@ static uint32 cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
/* Lookup the names */
- if ((result = cli_lsa_lookup_names(cli, mem_ctx, &pol, argc - 1,
- &argv[1], &sids, &types, &num_names) !=
- NT_STATUS_OK)) {
+ result = cli_lsa_lookup_names(cli, mem_ctx, &pol, argc - 1,
+ &argv[1], &sids, &types, &num_names);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -163,10 +165,10 @@ static uint32 cmd_lsa_lookup_names(struct cli_state *cli, int argc, char **argv)
/* Resolve a list of SIDs to a list of names */
-static uint32 cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_policy_hnd = False;
DOM_SID *sids;
char **names;
@@ -176,7 +178,7 @@ static uint32 cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
if (argc == 1) {
printf("Usage: %s [sid1 [sid2 [...]]]\n", argv[0]);
- return 0;
+ return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@@ -191,9 +193,10 @@ static uint32 cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
return NT_STATUS_UNSUCCESSFUL;
}
- if ((result = cli_lsa_open_policy(cli, mem_ctx, True,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
- &pol)) != NT_STATUS_OK) {
+ result = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED,
+ &pol);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -214,9 +217,9 @@ static uint32 cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
/* Lookup the SIDs */
- if ((result = cli_lsa_lookup_sids(cli, mem_ctx, &pol, argc - 1, sids,
- &names, &types, &num_names) !=
- NT_STATUS_OK)) {
+ result = cli_lsa_lookup_sids(cli, mem_ctx, &pol, argc - 1, sids,
+ &names, &types, &num_names);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -255,10 +258,10 @@ static uint32 cmd_lsa_lookup_sids(struct cli_state *cli, int argc, char **argv)
/* Enumerate list of trusted domains */
-static uint32 cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_policy_hnd = False;
DOM_SID *domain_sids;
char **domain_names;
@@ -269,7 +272,7 @@ static uint32 cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **arg
if (argc != 1) {
printf("Usage: %s\n", argv[0]);
- return 0;
+ return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@@ -284,9 +287,10 @@ static uint32 cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **arg
return NT_STATUS_UNSUCCESSFUL;
}
- if ((result = cli_lsa_open_policy(cli, mem_ctx, True,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
- &pol)) != NT_STATUS_OK) {
+ result = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED,
+ &pol);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -294,10 +298,10 @@ static uint32 cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **arg
/* Lookup list of trusted domains */
- if ((result = cli_lsa_enum_trust_dom(cli, mem_ctx, &pol, &enum_ctx,
- &num_domains, &domain_names,
- &domain_sids)
- != NT_STATUS_OK)) {
+ result = cli_lsa_enum_trust_dom(cli, mem_ctx, &pol, &enum_ctx,
+ &num_domains, &domain_names,
+ &domain_sids);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index fb0916b4a5..69f6e77cba 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -141,8 +141,8 @@ void display_sam_info_1(SAM_ENTRY1 *e1, SAM_STR1 *s1)
static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND connect_pol, domain_pol, user_pol;
- uint32 result = NT_STATUS_UNSUCCESSFUL,
- info_level = 21;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ uint32 info_level = 21;
BOOL got_connect_pol = False,
got_domain_pol = False,
got_user_pol = False;
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 572b6cc620..57ae56521d 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -192,7 +192,8 @@ static void get_username (char *username)
void fetch_domain_sid(struct cli_state *cli)
{
POLICY_HND pol;
- uint32 result = 0, info_class = 5;
+ NTSTATUS result = NT_STATUS_OK;
+ uint32 info_class = 5;
fstring domain_name;
static BOOL got_domain_sid;
TALLOC_CTX *mem_ctx;
@@ -211,15 +212,16 @@ void fetch_domain_sid(struct cli_state *cli)
goto error;
}
- if ((result = cli_lsa_open_policy(cli, mem_ctx, True,
- SEC_RIGHTS_MAXIMUM_ALLOWED,
- &pol) != NT_STATUS_OK)) {
+ result = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED,
+ &pol);
+ if (!NT_STATUS_IS_OK(result)) {
goto error;
}
- if ((result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class,
- domain_name, &domain_sid))
- != NT_STATUS_OK) {
+ result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class,
+ domain_name, &domain_sid);
+ if (!NT_STATUS_IS_OK(result)) {
goto error;
}
@@ -234,7 +236,7 @@ void fetch_domain_sid(struct cli_state *cli)
error:
fprintf(stderr, "could not obtain sid for domain %s\n", cli->domain);
- if (result != NT_STATUS_OK) {
+ if (!NT_STATUS_IS_OK(result)) {
fprintf(stderr, "error: %s\n", get_nt_error_msg(result));
}
@@ -323,7 +325,7 @@ static uint32 cmd_help(struct cli_state *cli, int argc, char **argv)
/* Change the debug level */
-static uint32 cmd_debuglevel(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_debuglevel(struct cli_state *cli, int argc, char **argv)
{
if (argc > 2) {
printf("Usage: %s [debuglevel]\n", argv[0]);
@@ -339,7 +341,7 @@ static uint32 cmd_debuglevel(struct cli_state *cli, int argc, char **argv)
return NT_STATUS_OK;
}
-static uint32 cmd_quit(struct cli_state *cli, int argc, char **argv)
+static NTSTATUS cmd_quit(struct cli_state *cli, int argc, char **argv)
{
exit(0);
return NT_STATUS_OK; /* NOTREACHED */
@@ -403,10 +405,10 @@ void add_command_set(struct cmd_set *cmd_set)
DLIST_ADD(cmd_list, entry);
}
-static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd)
+static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd)
{
char *p = cmd, **argv = NULL;
- uint32 result;
+ NTSTATUS result;
pstring buf;
int argc = 0, i;
@@ -430,7 +432,7 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd
if (!argv) {
fprintf(stderr, "out of memory\n");
- return 0;
+ return NT_STATUS_OK;
}
p = cmd;
@@ -461,20 +463,20 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd
/* Process a command entered at the prompt or as part of -c */
-static uint32 process_cmd(struct cli_state *cli, char *cmd)
+static NTSTATUS process_cmd(struct cli_state *cli, char *cmd)
{
struct cmd_list *temp_list;
BOOL found = False;
pstring buf;
char *p = cmd;
- uint32 result=0;
+ NTSTATUS result = NT_STATUS_OK;
int len = 0;
if (cmd[strlen(cmd) - 1] == '\n')
cmd[strlen(cmd) - 1] = '\0';
if (!next_token(&p, buf, " ", sizeof(buf))) {
- return 0;
+ return NT_STATUS_OK;
}
/* strip the trainly \n if it exsists */
@@ -500,10 +502,10 @@ static uint32 process_cmd(struct cli_state *cli, char *cmd)
done:
if (!found && buf[0]) {
printf("command not found: %s\n", buf);
- return 0;
+ return NT_STATUS_OK;
}
- if (result != 0) {
+ if (!NT_STATUS_IS_OK(result)) {
printf("result was %s\n", get_nt_error_msg(result));
}