#include "lib/netapi/netapi.h"
#include "lib/netapi/netapi_private.h"
#include "lib/netapi/libnetapi.h"
-#include "../librpc/gen_ndr/cli_samr.h"
+#include "../librpc/gen_ndr/ndr_samr_c.h"
#include "rpc_client/init_lsa.h"
#include "../libcli/security/security.h"
struct NetGroupAdd *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name;
struct dom_sid2 *domain_sid = NULL;
uint32_t rid = 0;
+ struct dcerpc_binding_handle *b = NULL;
struct GROUP_INFO_0 *info0 = NULL;
struct GROUP_INFO_1 *info1 = NULL;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
break;
}
- status = rpccli_samr_CreateDomainGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_CreateDomainGroup(b, talloc_tos(),
&domain_handle,
&lsa_group_name,
SEC_STD_DELETE |
SAMR_GROUP_ACCESS_SET_INFO,
&group_handle,
- &rid);
+ &rid,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
switch (r->in.level) {
case 1:
init_lsa_String(&info.description,
info1->grpi1_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
}
break;
case 2:
init_lsa_String(&info.description,
info2->grpi2_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto failed;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto failed;
+ }
}
if (info2->grpi2_attributes != 0) {
info.attributes.attributes = info2->grpi2_attributes;
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
}
break;
init_lsa_String(&info.description,
info3->grpi3_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto failed;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto failed;
+ }
}
if (info3->grpi3_attributes != 0) {
info.attributes.attributes = info3->grpi3_attributes;
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
}
break;
default:
werr = ntstatus_to_werror(status);
goto failed;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto failed;
+ }
werr = WERR_OK;
goto done;
failed:
- rpccli_samr_DeleteDomainGroup(pipe_cli, talloc_tos(),
- &group_handle);
+ dcerpc_samr_DeleteDomainGroup(b, talloc_tos(),
+ &group_handle, &result);
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct NetGroupDel *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name;
struct dom_sid2 *domain_sid = NULL;
int i = 0;
+ struct dcerpc_binding_handle *b = NULL;
struct samr_Ids rids;
struct samr_Ids types;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_group_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_group_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
if (types.ids[0] != SID_NAME_DOM_GRP) {
werr = WERR_INVALID_DATATYPE;
goto done;
}
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SEC_STD_DELETE |
SAMR_GROUP_ACCESS_GET_MEMBERS |
SAMR_GROUP_ACCESS_ADD_MEMBER |
SAMR_GROUP_ACCESS_LOOKUP_INFO,
rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
#if 0
/* breaks against NT4 */
goto done;
}
#endif
- status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupMember(b, talloc_tos(),
&group_handle,
- &rid_array);
+ &rid_array,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
{
struct lsa_Strings names;
struct samr_Ids member_types;
- status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupRids(b, talloc_tos(),
&domain_handle,
rid_array->count,
rid_array->rids,
&names,
- &member_types);
+ &member_types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
}
for (i=0; i < rid_array->count; i++) {
- status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_DeleteGroupMember(b, talloc_tos(),
&group_handle,
- rid_array->rids[i]);
+ rid_array->rids[i],
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
}
- status = rpccli_samr_DeleteDomainGroup(pipe_cli, talloc_tos(),
- &group_handle);
+ status = dcerpc_samr_DeleteDomainGroup(b, talloc_tos(),
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
ZERO_STRUCT(group_handle);
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct NetGroupSetInfo *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name;
struct dom_sid2 *domain_sid = NULL;
+ struct dcerpc_binding_handle *b = NULL;
struct samr_Ids rids;
struct samr_Ids types;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_group_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_group_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
if (types.ids[0] != SID_NAME_DOM_GRP) {
werr = WERR_INVALID_DATATYPE;
goto done;
}
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_SET_INFO |
SAMR_GROUP_ACCESS_LOOKUP_INFO,
rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
switch (r->in.level) {
case 0:
g0 = (struct GROUP_INFO_0 *)r->in.buffer;
init_lsa_String(&info.name, g0->grpi0_name);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFONAME,
- &info);
+ &info,
+ &result);
break;
case 1:
g1 = (struct GROUP_INFO_1 *)r->in.buffer;
init_lsa_String(&info.description, g1->grpi1_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
break;
case 2:
g2 = (struct GROUP_INFO_2 *)r->in.buffer;
init_lsa_String(&info.description, g2->grpi2_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
+
info.attributes.attributes = g2->grpi2_attributes;
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
break;
case 3:
g3 = (struct GROUP_INFO_3 *)r->in.buffer;
init_lsa_String(&info.description, g3->grpi3_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
+
info.attributes.attributes = g3->grpi3_attributes;
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
break;
case 1002:
g1002 = (struct GROUP_INFO_1002 *)r->in.buffer;
init_lsa_String(&info.description, g1002->grpi1002_comment);
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFODESCRIPTION,
- &info);
+ &info,
+ &result);
break;
case 1005:
g1005 = (struct GROUP_INFO_1005 *)r->in.buffer;
info.attributes.attributes = g1005->grpi1005_attributes;
- status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &info);
+ &info,
+ &result);
break;
default:
status = NT_STATUS_INVALID_LEVEL;
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct NetGroupGetInfo *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name;
struct dom_sid2 *domain_sid = NULL;
+ struct dcerpc_binding_handle *b = NULL;
struct samr_Ids rids;
struct samr_Ids types;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_group_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_group_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
if (types.ids[0] != SID_NAME_DOM_GRP) {
werr = WERR_INVALID_DATATYPE;
goto done;
}
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_LOOKUP_INFO,
rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOALL2,
- &info);
- if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
- status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(),
+ &info,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ if (NT_STATUS_EQUAL(result, NT_STATUS_INVALID_INFO_CLASS)) {
+ status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOALL,
- &info);
+ &info,
+ &result);
group_info_all = true;
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
}
- if (!NT_STATUS_IS_OK(status)) {
- werr = ntstatus_to_werror(status);
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
goto done;
}
}
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct NetGroupAddUser *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name, lsa_user_name;
struct dom_sid2 *domain_sid = NULL;
+ struct dcerpc_binding_handle *b = NULL;
struct samr_Ids rids;
struct samr_Ids types;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_group_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_group_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!NT_STATUS_IS_OK(result)) {
werr = WERR_GROUPNOTFOUND;
goto done;
}
goto done;
}
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_ADD_MEMBER,
rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
init_lsa_String(&lsa_user_name, r->in.user_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_user_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!NT_STATUS_IS_OK(result)) {
werr = WERR_USER_NOT_FOUND;
goto done;
}
goto done;
}
- status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_AddGroupMember(b, talloc_tos(),
&group_handle,
rids.ids[0],
- 7); /* why ? */
+ 7, /* why ? */
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct NetGroupDelUser *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
- NTSTATUS status;
+ NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, group_handle;
struct lsa_String lsa_group_name, lsa_user_name;
struct dom_sid2 *domain_sid = NULL;
+ struct dcerpc_binding_handle *b = NULL;
struct samr_Ids rids;
struct samr_Ids types;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_group_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_group_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!NT_STATUS_IS_OK(result)) {
werr = WERR_GROUPNOTFOUND;
goto done;
}
goto done;
}
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_REMOVE_MEMBER,
rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
init_lsa_String(&lsa_user_name, r->in.user_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_user_name,
&rids,
- &types);
+ &types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ if (!NT_STATUS_IS_OK(result)) {
werr = WERR_USER_NOT_FOUND;
goto done;
}
goto done;
}
- status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_DeleteGroupMember(b, talloc_tos(),
&group_handle,
- rids.ids[0]);
+ rids.ids[0],
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct policy_handle domain_handle;
union samr_DispInfo info;
union samr_DomainInfo *domain_info = NULL;
+ struct dcerpc_binding_handle *b = NULL;
uint32_t total_size = 0;
uint32_t returned_size = 0;
+ NTSTATUS result = NT_STATUS_OK;
NTSTATUS status = NT_STATUS_OK;
WERROR werr, tmp_werr;
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
goto done;
}
- status = rpccli_samr_QueryDomainInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryDomainInfo(b, talloc_tos(),
&domain_handle,
2,
- &domain_info);
+ &domain_info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
if (r->out.total_entries) {
*r->out.total_entries = domain_info->general.num_groups;
}
- status = rpccli_samr_QueryDisplayInfo2(pipe_cli,
+ status = dcerpc_samr_QueryDisplayInfo2(b,
ctx,
&domain_handle,
3,
r->in.prefmaxlen,
&total_size,
&returned_size,
- &info);
- werr = ntstatus_to_werror(status);
- if (NT_STATUS_IS_ERR(status)) {
+ &info,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ werr = ntstatus_to_werror(result);
+ if (NT_STATUS_IS_ERR(result)) {
goto done;
}
done:
/* if last query */
- if (NT_STATUS_IS_OK(status) ||
- NT_STATUS_IS_ERR(status)) {
+ if (NT_STATUS_IS_OK(result) ||
+ NT_STATUS_IS_ERR(result)) {
if (ctx->disable_policy_handle_cache) {
libnetapi_samr_close_domain_handle(ctx, &domain_handle);
struct samr_RidAttrArray *rid_array = NULL;
struct lsa_Strings names;
struct samr_Ids member_types;
+ struct dcerpc_binding_handle *b = NULL;
int i;
uint32_t entries_read = 0;
NTSTATUS status = NT_STATUS_OK;
+ NTSTATUS result = NT_STATUS_OK;
WERROR werr;
ZERO_STRUCT(connect_handle);
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_account_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_account_name,
&group_rids,
- &name_types);
+ &name_types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_GET_MEMBERS,
group_rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupMember(b, talloc_tos(),
&group_handle,
- &rid_array);
+ &rid_array,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupRids(b, talloc_tos(),
&domain_handle,
rid_array->count,
rid_array->rids,
&names,
- &member_types);
+ &member_types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
for (i=0; i < names.count; i++) {
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {
struct samr_Ids group_rids, group_types;
struct samr_RidAttrArray *rid_array = NULL;
struct lsa_String *lsa_names = NULL;
+ struct dcerpc_binding_handle *b = NULL;
uint32_t *add_rids = NULL;
uint32_t *del_rids = NULL;
int i, k;
NTSTATUS status = NT_STATUS_OK;
+ NTSTATUS result = NT_STATUS_OK;
WERROR werr;
ZERO_STRUCT(connect_handle);
goto done;
}
+ b = pipe_cli->binding_handle;
+
werr = libnetapi_samr_open_domain(ctx, pipe_cli,
SAMR_ACCESS_ENUM_DOMAINS |
SAMR_ACCESS_LOOKUP_DOMAIN,
init_lsa_String(&lsa_account_name, r->in.group_name);
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
1,
&lsa_account_name,
&group_rids,
- &group_types);
+ &group_types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_OpenGroup(b, talloc_tos(),
&domain_handle,
SAMR_GROUP_ACCESS_GET_MEMBERS |
SAMR_GROUP_ACCESS_ADD_MEMBER |
SAMR_GROUP_ACCESS_REMOVE_MEMBER |
SAMR_GROUP_ACCESS_LOOKUP_INFO,
group_rids.ids[0],
- &group_handle);
+ &group_handle,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
- status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
&group_handle,
GROUPINFOATTRIBUTES,
- &group_info);
+ &group_info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
switch (r->in.level) {
case 0:
}
}
- status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_LookupNames(b, talloc_tos(),
&domain_handle,
r->in.num_entries,
lsa_names,
&user_rids,
- &name_types);
+ &name_types,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
member_rids = user_rids.ids;
- status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_QueryGroupMember(b, talloc_tos(),
&group_handle,
- &rid_array);
+ &rid_array,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
/* add list */
/* add list */
for (i=0; i < num_add_rids; i++) {
- status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_AddGroupMember(b, talloc_tos(),
&group_handle,
add_rids[i],
- 7 /* ? */);
+ 7 /* ? */,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
}
/* del list */
for (i=0; i < num_del_rids; i++) {
- status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(),
+ status = dcerpc_samr_DeleteGroupMember(b, talloc_tos(),
&group_handle,
- del_rids[i]);
+ del_rids[i],
+ &result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ werr = ntstatus_to_werror(result);
+ goto done;
+ }
}
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&group_handle)) {
- rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
+ dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
}
if (ctx->disable_policy_handle_cache) {