summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-18 16:08:05 +0100
committerGünther Deschner <gd@samba.org>2011-02-02 19:02:35 +0100
commit36cd79f14b31b571b3be01656190210a8171e281 (patch)
tree7eaf9a0415767f533954ecce4b972d4f4280d03d /source3/rpcclient
parent707d572f622b2144702d1c616ad9662382dfda82 (diff)
downloadsamba-36cd79f14b31b571b3be01656190210a8171e281.tar.gz
samba-36cd79f14b31b571b3be01656190210a8171e281.tar.bz2
samba-36cd79f14b31b571b3be01656190210a8171e281.zip
s3-rpcclient: prefer dcerpc_lsa_X functions.
Guenther
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c566
1 files changed, 390 insertions, 176 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index ec8a7471cc..4b065d0dd2 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -24,7 +24,7 @@
#include "rpcclient.h"
#include "../libcli/auth/libcli_auth.h"
#include "../librpc/gen_ndr/ndr_lsa.h"
-#include "../librpc/gen_ndr/cli_lsa.h"
+#include "../librpc/gen_ndr/ndr_lsa_c.h"
#include "rpc_client/cli_lsarpc.h"
#include "rpc_client/init_lsa.h"
#include "../libcli/security/security.h"
@@ -37,8 +37,9 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *cli,
{
struct policy_handle pol;
enum lsa_SidType *sid_types;
- NTSTATUS status;
+ NTSTATUS status, result;
struct dom_sid *sids;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
/* maybe its a raw SID */
if (strncmp(name, "S-", 2) == 0 &&
@@ -56,7 +57,7 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
*sid = sids[0];
@@ -156,8 +157,9 @@ static NTSTATUS cmd_lsa_query_info_policy(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
union lsa_PolicyInformation *info = NULL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
uint32 info_class = 3;
@@ -178,10 +180,11 @@ static NTSTATUS cmd_lsa_query_info_policy(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_QueryInfoPolicy2(cli, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy2(b, mem_ctx,
&pol,
info_class,
- &info);
+ &info,
+ &result);
break;
default:
status = rpccli_lsa_open_policy(cli, mem_ctx, True,
@@ -191,17 +194,22 @@ static NTSTATUS cmd_lsa_query_info_policy(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_QueryInfoPolicy(cli, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
info_class,
- &info);
+ &info,
+ &result);
}
- if (NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
+ status = result;
+ if (NT_STATUS_IS_OK(result)) {
display_lsa_query_info(info, info_class);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
@@ -214,10 +222,11 @@ static NTSTATUS cmd_lsa_lookup_names(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct dom_sid *sids;
enum lsa_SidType *types;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc == 1) {
printf("Usage: %s [name1 [name2 [...]]]\n", argv[0]);
@@ -249,7 +258,7 @@ static NTSTATUS cmd_lsa_lookup_names(struct rpc_pipe_client *cli,
sid_type_lookup(types[i]), types[i]);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
@@ -262,10 +271,11 @@ static NTSTATUS cmd_lsa_lookup_names_level(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct dom_sid *sids;
enum lsa_SidType *types;
int i, level;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3) {
printf("Usage: %s [level] [name1 [name2 [...]]]\n", argv[0]);
@@ -299,7 +309,7 @@ static NTSTATUS cmd_lsa_lookup_names_level(struct rpc_pipe_client *cli,
sid_type_lookup(types[i]), types[i]);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
@@ -309,7 +319,7 @@ static NTSTATUS cmd_lsa_lookup_names4(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
uint32_t num_names;
struct lsa_String *names;
@@ -317,6 +327,7 @@ static NTSTATUS cmd_lsa_lookup_names4(struct rpc_pipe_client *cli,
struct lsa_TransSidArray3 sids;
uint32_t count = 0;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc == 1) {
printf("Usage: %s [name1 [name2 [...]]]\n", argv[0]);
@@ -333,7 +344,7 @@ static NTSTATUS cmd_lsa_lookup_names4(struct rpc_pipe_client *cli,
init_lsa_String(&names[i], argv[i+1]);
}
- status = rpccli_lsa_LookupNames4(cli, mem_ctx,
+ status = dcerpc_lsa_LookupNames4(b, mem_ctx,
num_names,
names,
&domains,
@@ -341,10 +352,14 @@ static NTSTATUS cmd_lsa_lookup_names4(struct rpc_pipe_client *cli,
1,
&count,
0,
- 0);
+ 0,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ return result;
+ }
for (i = 0; i < sids.count; i++) {
fstring sid_str;
@@ -363,12 +378,13 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem
int argc, const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct dom_sid *sids;
char **domains;
char **names;
enum lsa_SidType *types;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc == 1) {
printf("Usage: %s [sid1 [sid2 [...]]]\n", argv[0]);
@@ -419,7 +435,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem
names[i] ? names[i] : "*unknown*", types[i]);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
@@ -431,12 +447,13 @@ static NTSTATUS cmd_lsa_lookup_sids3(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result;
int i;
struct lsa_SidArray sids;
struct lsa_RefDomainList *domains;
struct lsa_TransNameArray2 names;
uint32_t count = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc == 1) {
printf("Usage: %s [sid1 [sid2 [...]]]\n", argv[0]);
@@ -467,18 +484,23 @@ static NTSTATUS cmd_lsa_lookup_sids3(struct rpc_pipe_client *cli,
}
/* Lookup the SIDs */
- status = rpccli_lsa_LookupSids3(cli, mem_ctx,
+ status = dcerpc_lsa_LookupSids3(b, mem_ctx,
&sids,
&domains,
&names,
1,
&count,
0,
- 0);
-
- if (!NT_STATUS_IS_OK(status) && NT_STATUS_V(status) !=
- NT_STATUS_V(STATUS_SOME_UNMAPPED))
+ 0,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
goto done;
+ }
+ if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
+ NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
+ status = result;
+ goto done;
+ }
status = NT_STATUS_OK;
@@ -505,8 +527,9 @@ static NTSTATUS cmd_lsa_enum_trust_dom(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_DomainList domain_list;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
/* defaults, but may be changed using params */
uint32 enum_ctx = 0;
@@ -535,15 +558,21 @@ static NTSTATUS cmd_lsa_enum_trust_dom(struct rpc_pipe_client *cli,
/* Lookup list of trusted domains */
- status = rpccli_lsa_EnumTrustDom(cli, mem_ctx,
+ status = dcerpc_lsa_EnumTrustDom(b, mem_ctx,
&pol,
&enum_ctx,
&domain_list,
- max_size);
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES) &&
- !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES))
+ max_size,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
+ if (!NT_STATUS_IS_OK(result) &&
+ !NT_STATUS_EQUAL(result, NT_STATUS_NO_MORE_ENTRIES) &&
+ !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) {
+ status = result;
goto done;
+ }
/* Print results: list of names and sids returned in this
* response. */
@@ -558,7 +587,7 @@ static NTSTATUS cmd_lsa_enum_trust_dom(struct rpc_pipe_client *cli,
}
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -570,8 +599,9 @@ static NTSTATUS cmd_lsa_enum_privilege(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_PrivArray priv_array;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
@@ -595,13 +625,18 @@ static NTSTATUS cmd_lsa_enum_privilege(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_EnumPrivs(cli, mem_ctx,
+ status = dcerpc_lsa_EnumPrivs(b, mem_ctx,
&pol,
&enum_context,
&priv_array,
- pref_max_length);
+ pref_max_length,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
printf("found %d privileges\n\n", priv_array.count);
@@ -615,7 +650,7 @@ static NTSTATUS cmd_lsa_enum_privilege(struct rpc_pipe_client *cli,
priv_array.privs[i].luid.low);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -627,7 +662,8 @@ static NTSTATUS cmd_lsa_get_dispname(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
uint16 lang_id=0;
uint16 lang_id_sys=0;
@@ -649,21 +685,25 @@ static NTSTATUS cmd_lsa_get_dispname(struct rpc_pipe_client *cli,
init_lsa_String(&lsa_name, argv[1]);
- status = rpccli_lsa_LookupPrivDisplayName(cli, mem_ctx,
+ status = dcerpc_lsa_LookupPrivDisplayName(b, mem_ctx,
&pol,
&lsa_name,
lang_id,
lang_id_sys,
&description,
- &lang_id_desc);
-
+ &lang_id_desc,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
printf("%s -> %s (language: 0x%x)\n", argv[1], description->string, lang_id_desc);
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -675,7 +715,8 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
@@ -700,14 +741,18 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_EnumAccounts(cli, mem_ctx,
+ status = dcerpc_lsa_EnumAccounts(b, mem_ctx,
&pol,
&enum_context,
&sid_array,
- pref_max_length);
-
+ pref_max_length,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
printf("found %d SIDs\n\n", sid_array.num_sids);
@@ -719,7 +764,7 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client *cli,
printf("%s\n", sid_str);
}
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -732,8 +777,9 @@ static NTSTATUS cmd_lsa_create_account(struct rpc_pipe_client *cli,
{
struct policy_handle dom_pol;
struct policy_handle user_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
uint32 des_access = 0x000f000f;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
struct dom_sid sid;
@@ -753,19 +799,23 @@ static NTSTATUS cmd_lsa_create_account(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_CreateAccount(cli, mem_ctx,
+ status = dcerpc_lsa_CreateAccount(b, mem_ctx,
&dom_pol,
&sid,
des_access,
- &user_pol);
-
+ &user_pol,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
printf("Account for SID %s successfully created\n\n", argv[1]);
status = NT_STATUS_OK;
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -779,11 +829,12 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
{
struct policy_handle dom_pol;
struct policy_handle user_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
uint32 access_desired = 0x000f000f;
struct dom_sid sid;
struct lsa_PrivilegeSet *privs = NULL;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc != 2 ) {
printf("Usage: %s SID\n", argv[0]);
@@ -801,21 +852,29 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_OpenAccount(cli, mem_ctx,
+ status = dcerpc_lsa_OpenAccount(b, mem_ctx,
&dom_pol,
&sid,
access_desired,
- &user_pol);
-
+ &user_pol,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- status = rpccli_lsa_EnumPrivsAccount(cli, mem_ctx,
+ status = dcerpc_lsa_EnumPrivsAccount(b, mem_ctx,
&user_pol,
- &privs);
-
+ &privs,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
printf("found %d privileges for SID %s\n\n", privs->count, argv[1]);
@@ -828,7 +887,7 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
privs->set[i].attribute);
}
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -841,9 +900,10 @@ static NTSTATUS cmd_lsa_enum_acct_rights(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle dom_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct dom_sid sid;
struct lsa_RightSet rights;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
int i;
@@ -863,13 +923,17 @@ static NTSTATUS cmd_lsa_enum_acct_rights(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_EnumAccountRights(cli, mem_ctx,
+ status = dcerpc_lsa_EnumAccountRights(b, mem_ctx,
&dom_pol,
&sid,
- &rights);
-
+ &rights,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
printf("found %d privileges for SID %s\n", rights.count,
sid_string_tos(&sid));
@@ -878,7 +942,7 @@ static NTSTATUS cmd_lsa_enum_acct_rights(struct rpc_pipe_client *cli,
printf("\t%s\n", rights.names[i].string);
}
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -891,10 +955,11 @@ static NTSTATUS cmd_lsa_add_acct_rights(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle dom_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_RightSet rights;
struct dom_sid sid;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3 ) {
printf("Usage: %s SID [rights...]\n", argv[0]);
@@ -923,15 +988,19 @@ static NTSTATUS cmd_lsa_add_acct_rights(struct rpc_pipe_client *cli,
init_lsa_StringLarge(&rights.names[i], argv[i+2]);
}
- status = rpccli_lsa_AddAccountRights(cli, mem_ctx,
+ status = dcerpc_lsa_AddAccountRights(b, mem_ctx,
&dom_pol,
&sid,
- &rights);
-
+ &rights,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -944,10 +1013,11 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle dom_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_RightSet rights;
struct dom_sid sid;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3 ) {
printf("Usage: %s SID [rights...]\n", argv[0]);
@@ -976,16 +1046,20 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
init_lsa_StringLarge(&rights.names[i], argv[i+2]);
}
- status = rpccli_lsa_RemoveAccountRights(cli, mem_ctx,
+ status = dcerpc_lsa_RemoveAccountRights(b, mem_ctx,
&dom_pol,
&sid,
false,
- &rights);
-
+ &rights,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
@@ -999,9 +1073,10 @@ static NTSTATUS cmd_lsa_lookup_priv_value(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_LUID luid;
struct lsa_String name;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc != 2 ) {
printf("Usage: %s name\n", argv[0]);
@@ -1017,19 +1092,23 @@ static NTSTATUS cmd_lsa_lookup_priv_value(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_LookupPrivValue(cli, mem_ctx,
+ status = dcerpc_lsa_LookupPrivValue(b, mem_ctx,
&pol,
&name,
- &luid);
-
+ &luid,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
printf("%u:%u (0x%x:0x%x)\n", luid.high, luid.low, luid.high, luid.low);
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -1041,9 +1120,10 @@ static NTSTATUS cmd_lsa_query_secobj(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct sec_desc_buf *sdb;
uint32 sec_info = SECINFO_DACL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 1 || argc > 2) {
printf("Usage: %s [sec_info]\n", argv[0]);
@@ -1060,18 +1140,23 @@ static NTSTATUS cmd_lsa_query_secobj(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_QuerySecurity(cli, mem_ctx,
+ status = dcerpc_lsa_QuerySecurity(b, mem_ctx,
&pol,
sec_info,
- &sdb);
+ &sdb,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
display_sec_desc(sdb->sd);
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -1122,12 +1207,13 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct dom_sid dom_sid;
uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
union lsa_TrustedDomainInfo *info = NULL;
enum lsa_TrustDomInfoEnum info_class = 1;
uint8_t nt_hash[16];
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3 || argc < 2) {
printf("Usage: %s [sid] [info_class]\n", argv[0]);
@@ -1145,13 +1231,18 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_QueryTrustedDomainInfoBySid(cli, mem_ctx,
+ status = dcerpc_lsa_QueryTrustedDomainInfoBySid(b, mem_ctx,
&pol,
&dom_sid,
info_class,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
if (!rpccli_get_pwd_hash(cli, nt_hash)) {
d_fprintf(stderr, "Could not get pwd hash\n");
@@ -1161,7 +1252,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
display_trust_dom_info(mem_ctx, info, info_class, nt_hash);
done:
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
return status;
}
@@ -1171,12 +1262,13 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
union lsa_TrustedDomainInfo *info = NULL;
enum lsa_TrustDomInfoEnum info_class = 1;
struct lsa_String trusted_domain;
uint8_t nt_hash[16];
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3 || argc < 2) {
printf("Usage: %s [name] [info_class]\n", argv[0]);
@@ -1193,13 +1285,18 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
init_lsa_String(&trusted_domain, argv[1]);
- status = rpccli_lsa_QueryTrustedDomainInfoByName(cli, mem_ctx,
+ status = dcerpc_lsa_QueryTrustedDomainInfoByName(b, mem_ctx,
&pol,
&trusted_domain,
info_class,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
if (!rpccli_get_pwd_hash(cli, nt_hash)) {
d_fprintf(stderr, "Could not get pwd hash\n");
@@ -1209,7 +1306,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
display_trust_dom_info(mem_ctx, info, info_class, nt_hash);
done:
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
return status;
}
@@ -1219,12 +1316,13 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol, trustdom_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
union lsa_TrustedDomainInfo *info = NULL;
struct dom_sid dom_sid;
enum lsa_TrustDomInfoEnum info_class = 1;
uint8_t nt_hash[16];
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3 || argc < 2) {
printf("Usage: %s [sid] [info_class]\n", argv[0]);
@@ -1243,22 +1341,30 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(status))
goto done;
- status = rpccli_lsa_OpenTrustedDomain(cli, mem_ctx,
+ status = dcerpc_lsa_OpenTrustedDomain(b, mem_ctx,
&pol,
&dom_sid,
access_mask,
- &trustdom_pol);
-
+ &trustdom_pol,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- status = rpccli_lsa_QueryTrustedDomainInfo(cli, mem_ctx,
+ status = dcerpc_lsa_QueryTrustedDomainInfo(b, mem_ctx,
&trustdom_pol,
info_class,
- &info);
-
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status))
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
if (!rpccli_get_pwd_hash(cli, nt_hash)) {
d_fprintf(stderr, "Could not get pwd hash\n");
@@ -1268,7 +1374,7 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
display_trust_dom_info(mem_ctx, info, info_class, nt_hash);
done:
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
return status;
}
@@ -1278,10 +1384,11 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
const char *servername = cli->desthost;
struct lsa_String *account_name = NULL;
struct lsa_String *authority_name = NULL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 2) {
printf("Usage: %s servername\n", argv[0]);
@@ -1296,13 +1403,18 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli,
goto done;
}
- status = rpccli_lsa_GetUserName(cli, mem_ctx,
+ status = dcerpc_lsa_GetUserName(b, mem_ctx,
servername,
&account_name,
- &authority_name);
+ &authority_name,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
/* Print results */
@@ -1310,7 +1422,7 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli,
account_name->string, authority_name ? authority_name->string :
"");
- rpccli_lsa_Close(cli, mem_ctx, &pol);
+ dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
done:
return status;
}
@@ -1320,11 +1432,12 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle dom_pol, user_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_PrivilegeSet privs;
struct lsa_LUIDAttribute *set = NULL;
struct dom_sid sid;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
ZERO_STRUCT(privs);
@@ -1346,15 +1459,19 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
goto done;
}
- status = rpccli_lsa_OpenAccount(cli, mem_ctx,
+ status = dcerpc_lsa_OpenAccount(b, mem_ctx,
&dom_pol,
&sid,
SEC_FLAG_MAXIMUM_ALLOWED,
- &user_pol);
-
+ &user_pol,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
for (i=2; i<argc; i++) {
@@ -1363,13 +1480,18 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
init_lsa_String(&priv_name, argv[i]);
- status = rpccli_lsa_LookupPrivValue(cli, mem_ctx,
+ status = dcerpc_lsa_LookupPrivValue(b, mem_ctx,
&dom_pol,
&priv_name,
- &luid);
+ &luid,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
continue;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ continue;
+ }
privs.count++;
set = TALLOC_REALLOC_ARRAY(mem_ctx, set,
@@ -1385,16 +1507,20 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
privs.set = set;
- status = rpccli_lsa_AddPrivilegesToAccount(cli, mem_ctx,
+ status = dcerpc_lsa_AddPrivilegesToAccount(b, mem_ctx,
&user_pol,
- &privs);
-
+ &privs,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- rpccli_lsa_Close(cli, mem_ctx, &user_pol);
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &user_pol, &result);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -1404,11 +1530,12 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
const char **argv)
{
struct policy_handle dom_pol, user_pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
struct lsa_PrivilegeSet privs;
struct lsa_LUIDAttribute *set = NULL;
struct dom_sid sid;
int i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
ZERO_STRUCT(privs);
@@ -1430,15 +1557,19 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
goto done;
}
- status = rpccli_lsa_OpenAccount(cli, mem_ctx,
+ status = dcerpc_lsa_OpenAccount(b, mem_ctx,
&dom_pol,
&sid,
SEC_FLAG_MAXIMUM_ALLOWED,
- &user_pol);
-
+ &user_pol,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
for (i=2; i<argc; i++) {
@@ -1447,13 +1578,18 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
init_lsa_String(&priv_name, argv[i]);
- status = rpccli_lsa_LookupPrivValue(cli, mem_ctx,
+ status = dcerpc_lsa_LookupPrivValue(b, mem_ctx,
&dom_pol,
&priv_name,
- &luid);
+ &luid,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
continue;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ continue;
+ }
privs.count++;
set = TALLOC_REALLOC_ARRAY(mem_ctx, set,
@@ -1470,17 +1606,21 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
privs.set = set;
- status = rpccli_lsa_RemovePrivilegesFromAccount(cli, mem_ctx,
+ status = dcerpc_lsa_RemovePrivilegesFromAccount(b, mem_ctx,
&user_pol,
false,
- &privs);
-
+ &privs,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- rpccli_lsa_Close(cli, mem_ctx, &user_pol);
- rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
+ dcerpc_lsa_Close(b, mem_ctx, &user_pol, &result);
+ dcerpc_lsa_Close(b, mem_ctx, &dom_pol, &result);
done:
return status;
}
@@ -1489,9 +1629,10 @@ static NTSTATUS cmd_lsa_create_secret(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, sec_handle;
struct lsa_String name;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2) {
printf("Usage: %s name\n", argv[0]);
@@ -1508,21 +1649,26 @@ static NTSTATUS cmd_lsa_create_secret(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_CreateSecret(cli, mem_ctx,
+ status = dcerpc_lsa_CreateSecret(b, mem_ctx,
&handle,
name,
SEC_FLAG_MAXIMUM_ALLOWED,
- &sec_handle);
+ &sec_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&sec_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &sec_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &sec_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1532,9 +1678,10 @@ static NTSTATUS cmd_lsa_delete_secret(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, sec_handle;
struct lsa_String name;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2) {
printf("Usage: %s name\n", argv[0]);
@@ -1551,27 +1698,37 @@ static NTSTATUS cmd_lsa_delete_secret(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_OpenSecret(cli, mem_ctx,
+ status = dcerpc_lsa_OpenSecret(b, mem_ctx,
&handle,
name,
SEC_FLAG_MAXIMUM_ALLOWED,
- &sec_handle);
+ &sec_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- status = rpccli_lsa_DeleteObject(cli, mem_ctx,
- &sec_handle);
+ status = dcerpc_lsa_DeleteObject(b, mem_ctx,
+ &sec_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&sec_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &sec_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &sec_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1581,7 +1738,7 @@ static NTSTATUS cmd_lsa_query_secret(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, sec_handle;
struct lsa_String name;
struct lsa_DATA_BUF_PTR new_val;
@@ -1592,6 +1749,7 @@ static NTSTATUS cmd_lsa_query_secret(struct rpc_pipe_client *cli,
DATA_BLOB new_blob = data_blob_null;
DATA_BLOB old_blob = data_blob_null;
char *new_secret, *old_secret;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2) {
printf("Usage: %s name\n", argv[0]);
@@ -1608,27 +1766,37 @@ static NTSTATUS cmd_lsa_query_secret(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_OpenSecret(cli, mem_ctx,
+ status = dcerpc_lsa_OpenSecret(b, mem_ctx,
&handle,
name,
SEC_FLAG_MAXIMUM_ALLOWED,
- &sec_handle);
+ &sec_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
ZERO_STRUCT(new_val);
ZERO_STRUCT(old_val);
- status = rpccli_lsa_QuerySecret(cli, mem_ctx,
+ status = dcerpc_lsa_QuerySecret(b, mem_ctx,
&sec_handle,
&new_val,
&new_mtime,
&old_val,
- &old_mtime);
+ &old_mtime,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
status = cli_get_session_key(mem_ctx, cli, &session_key);
if (!NT_STATUS_IS_OK(status)) {
@@ -1653,10 +1821,10 @@ static NTSTATUS cmd_lsa_query_secret(struct rpc_pipe_client *cli,
done:
if (is_valid_policy_hnd(&sec_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &sec_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &sec_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1666,13 +1834,14 @@ static NTSTATUS cmd_lsa_set_secret(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, sec_handle;
struct lsa_String name;
struct lsa_DATA_BUF new_val;
struct lsa_DATA_BUF old_val;
DATA_BLOB enc_key;
DATA_BLOB session_key;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3) {
printf("Usage: %s name secret\n", argv[0]);
@@ -1689,14 +1858,19 @@ static NTSTATUS cmd_lsa_set_secret(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_OpenSecret(cli, mem_ctx,
+ status = dcerpc_lsa_OpenSecret(b, mem_ctx,
&handle,
name,
SEC_FLAG_MAXIMUM_ALLOWED,
- &sec_handle);
+ &sec_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
ZERO_STRUCT(new_val);
ZERO_STRUCT(old_val);
@@ -1712,20 +1886,25 @@ static NTSTATUS cmd_lsa_set_secret(struct rpc_pipe_client *cli,
new_val.size = enc_key.length;
new_val.data = enc_key.data;
- status = rpccli_lsa_SetSecret(cli, mem_ctx,
+ status = dcerpc_lsa_SetSecret(b, mem_ctx,
&sec_handle,
&new_val,
- NULL);
+ NULL,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&sec_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &sec_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &sec_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1735,13 +1914,14 @@ static NTSTATUS cmd_lsa_retrieve_private_data(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle;
struct lsa_String name;
struct lsa_DATA_BUF *val;
DATA_BLOB session_key;
DATA_BLOB blob = data_blob_null;
char *secret;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2) {
printf("Usage: %s name\n", argv[0]);
@@ -1760,13 +1940,18 @@ static NTSTATUS cmd_lsa_retrieve_private_data(struct rpc_pipe_client *cli,
ZERO_STRUCT(val);
- status = rpccli_lsa_RetrievePrivateData(cli, mem_ctx,
+ status = dcerpc_lsa_RetrievePrivateData(b, mem_ctx,
&handle,
&name,
- &val);
+ &val,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
status = cli_get_session_key(mem_ctx, cli, &session_key);
if (!NT_STATUS_IS_OK(status)) {
@@ -1784,7 +1969,7 @@ static NTSTATUS cmd_lsa_retrieve_private_data(struct rpc_pipe_client *cli,
done:
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1794,12 +1979,13 @@ static NTSTATUS cmd_lsa_store_private_data(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle;
struct lsa_String name;
struct lsa_DATA_BUF val;
DATA_BLOB session_key;
DATA_BLOB enc_key;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3) {
printf("Usage: %s name secret\n", argv[0]);
@@ -1829,17 +2015,22 @@ static NTSTATUS cmd_lsa_store_private_data(struct rpc_pipe_client *cli,
val.size = enc_key.length;
val.data = enc_key.data;
- status = rpccli_lsa_StorePrivateData(cli, mem_ctx,
+ status = dcerpc_lsa_StorePrivateData(b, mem_ctx,
&handle,
&name,
- &val);
+ &val,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1849,10 +2040,11 @@ static NTSTATUS cmd_lsa_create_trusted_domain(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, trustdom_handle;
struct dom_sid sid;
struct lsa_DomainInfo info;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 3) {
printf("Usage: %s name sid\n", argv[0]);
@@ -1871,22 +2063,27 @@ static NTSTATUS cmd_lsa_create_trusted_domain(struct rpc_pipe_client *cli,
info.sid = &sid;
string_to_sid(&sid, argv[2]);
- status = rpccli_lsa_CreateTrustedDomain(cli, mem_ctx,
+ status = dcerpc_lsa_CreateTrustedDomain(b, mem_ctx,
&handle,
&info,
SEC_FLAG_MAXIMUM_ALLOWED,
- &trustdom_handle);
+ &trustdom_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&trustdom_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &trustdom_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &trustdom_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;
@@ -1896,10 +2093,11 @@ static NTSTATUS cmd_lsa_delete_trusted_domain(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- NTSTATUS status;
+ NTSTATUS status, result;
struct policy_handle handle, trustdom_handle;
struct lsa_String name;
struct dom_sid *sid = NULL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2) {
printf("Usage: %s name\n", argv[0]);
@@ -1916,12 +2114,13 @@ static NTSTATUS cmd_lsa_delete_trusted_domain(struct rpc_pipe_client *cli,
init_lsa_String(&name, argv[1]);
- status = rpccli_lsa_OpenTrustedDomainByName(cli, mem_ctx,
+ status = dcerpc_lsa_OpenTrustedDomainByName(b, mem_ctx,
&handle,
name,
SEC_FLAG_MAXIMUM_ALLOWED,
- &trustdom_handle);
- if (NT_STATUS_IS_OK(status)) {
+ &trustdom_handle,
+ &result);
+ if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(result)) {
goto delete_object;
}
@@ -1930,14 +2129,19 @@ static NTSTATUS cmd_lsa_delete_trusted_domain(struct rpc_pipe_client *cli,
struct lsa_DomainList domains;
int i;
- status = rpccli_lsa_EnumTrustDom(cli, mem_ctx,
+ status = dcerpc_lsa_EnumTrustDom(b, mem_ctx,
&handle,
&resume_handle,
&domains,
- 0xffff);
+ 0xffff,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
for (i=0; i < domains.count; i++) {
if (strequal(domains.domains[i].name.string, argv[1])) {
@@ -1951,29 +2155,39 @@ static NTSTATUS cmd_lsa_delete_trusted_domain(struct rpc_pipe_client *cli,
}
}
- status = rpccli_lsa_OpenTrustedDomain(cli, mem_ctx,
+ status = dcerpc_lsa_OpenTrustedDomain(b, mem_ctx,
&handle,
sid,
SEC_FLAG_MAXIMUM_ALLOWED,
- &trustdom_handle);
+ &trustdom_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
delete_object:
- status = rpccli_lsa_DeleteObject(cli, mem_ctx,
- &trustdom_handle);
+ status = dcerpc_lsa_DeleteObject(b, mem_ctx,
+ &trustdom_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (is_valid_policy_hnd(&trustdom_handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &trustdom_handle);
+ dcerpc_lsa_Close(b, mem_ctx, &trustdom_handle, &result);
}
if (is_valid_policy_hnd(&handle)) {
- rpccli_lsa_Close(cli, mem_ctx, &handle);
+ dcerpc_lsa_Close(b, mem_ctx, &handle, &result);
}
return status;