1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

source4: Use wbc_sids_to_xids

Signed-off-by: Volker Lendecke <vl@samba.org>

Change-Id: I86ea6587c436247ce66207c517f9c8d567ecac1d
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Volker Lendecke 2014-01-30 20:12:07 +00:00 committed by Andreas Schneider
parent 22dabda4c6
commit 7289d1c30b
4 changed files with 8 additions and 29 deletions

View File

@ -36,7 +36,6 @@ NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
uint32_t s, g;
NTSTATUS status;
struct id_map *ids;
struct composite_context *ctx;
/* we can't do unix security without a user and group */
if (token->num_sids < 2) {
@ -56,10 +55,7 @@ NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
ids[s].status = ID_UNKNOWN;
}
ctx = wbc_sids_to_xids_send(wbc_ctx, ids, token->num_sids, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(wbc_ctx->event_ctx, ids, token->num_sids);
NT_STATUS_NOT_OK_RETURN(status);
g = token->num_sids;

View File

@ -287,7 +287,6 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs,
uid_t new_uid = -1;
gid_t new_gid = -1;
struct id_map *ids;
struct composite_context *ctx;
if (pvfs->acl_ops != NULL) {
status = pvfs->acl_ops->acl_load(pvfs, name, fd, req, &sd);
@ -318,9 +317,8 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs,
}
if (!dom_sid_equal(sd->owner_sid, new_sd->owner_sid)) {
ids->sid = new_sd->owner_sid;
ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(pvfs->wbc_ctx->event_ctx,
ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||
@ -337,9 +335,8 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs,
}
if (!dom_sid_equal(sd->group_sid, new_sd->group_sid)) {
ids->sid = new_sd->group_sid;
ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(pvfs->wbc_ctx->event_ctx,
ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||

View File

@ -124,7 +124,6 @@ static NTSTATUS pvfs_acl_save_nfs4(struct pvfs_state *pvfs, struct pvfs_filename
int i;
TALLOC_CTX *tmp_ctx;
struct id_map *ids;
struct composite_context *ctx;
tmp_ctx = talloc_new(pvfs);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
@ -159,12 +158,7 @@ static NTSTATUS pvfs_acl_save_nfs4(struct pvfs_state *pvfs, struct pvfs_filename
ids[i].status = ID_UNKNOWN;
}
ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx,ids, acl.a_count, ids);
if (ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(pvfs->wbc_ctx->event_ctx, ids, acl.a_count);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(tmp_ctx);
return status;

View File

@ -50,7 +50,6 @@ static NTSTATUS dcesrv_unixinfo_SidToUid(struct dcesrv_call_state *dce_call,
dce_call->context->private_data,
struct wbc_context);
struct id_map *ids;
struct composite_context *ctx;
DEBUG(5, ("dcesrv_unixinfo_SidToUid called\n"));
@ -60,10 +59,7 @@ static NTSTATUS dcesrv_unixinfo_SidToUid(struct dcesrv_call_state *dce_call,
ids->sid = &r->in.sid;
ids->status = ID_UNKNOWN;
ZERO_STRUCT(ids->xid);
ctx = wbc_sids_to_xids_send(wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||
@ -123,7 +119,6 @@ static NTSTATUS dcesrv_unixinfo_SidToGid(struct dcesrv_call_state *dce_call,
dce_call->context->private_data,
struct wbc_context);
struct id_map *ids;
struct composite_context *ctx;
DEBUG(5, ("dcesrv_unixinfo_SidToGid called\n"));
@ -133,10 +128,7 @@ static NTSTATUS dcesrv_unixinfo_SidToGid(struct dcesrv_call_state *dce_call,
ids->sid = &r->in.sid;
ids->status = ID_UNKNOWN;
ZERO_STRUCT(ids->xid);
ctx = wbc_sids_to_xids_send(wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
status = wbc_sids_to_xids_recv(ctx, &ids);
status = wbc_sids_to_xids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||