struct composite_context *ctx;
struct winbind_get_idmap *req;
struct irpc_request *irpc_req;
- struct id_mapping *ids;
+ struct id_map *ids;
};
static void sids_to_xids_recv_ids(struct irpc_request *req);
struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx,
TALLOC_CTX *mem_ctx,
uint32_t count,
- struct id_mapping *ids)
+ struct id_map *ids)
{
struct composite_context *ctx;
struct wbc_idmap_state *state;
}
NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx,
- struct id_mapping **ids)
+ struct id_map **ids)
{
NTSTATUS status = composite_wait(ctx);
DEBUG(5, ("wbc_sids_to_xids_recv called\n"));
struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx,
TALLOC_CTX *mem_ctx,
uint32_t count,
- struct id_mapping *ids)
+ struct id_map *ids)
{
struct composite_context *ctx;
struct wbc_idmap_state *state;
}
NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx,
- struct id_mapping **ids)
+ struct id_map **ids)
{
NTSTATUS status = composite_wait(ctx);
DEBUG(5, ("wbc_xids_to_sids_recv called\n"));
struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx,
TALLOC_CTX *mem_ctx,
uint32_t count,
- struct id_mapping *ids);
+ struct id_map *ids);
NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx,
- struct id_mapping **ids);
+ struct id_map **ids);
struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx,
TALLOC_CTX *mem_ctx,
uint32_t count,
- struct id_mapping *ids);
+ struct id_map *ids);
NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx,
- struct id_mapping **ids);
+ struct id_map **ids);
id_type type;
} unixid;
+ typedef enum {
+ ID_UNKNOWN,
+ ID_MAPPED,
+ ID_UNMAPPED,
+ ID_EXPIRED
+ } id_mapping;
+
typedef struct {
unixid *unixid;
dom_sid *sid;
- NTSTATUS status;
- } id_mapping;
+ id_mapping status;
+ } id_map;
/* a call to get runtime informations */
void winbind_information(/* TODO */);
NTSTATUS winbind_get_idmap(
[in] winbind_get_idmap_level level,
[in] uint32 count,
- [in,out] [size_is(count)] id_mapping ids[]
+ [in,out] [size_is(count)] id_map ids[]
);
}
NTSTATUS status;
struct security_ace ace;
mode_t mode;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
*psd = security_descriptor_initialise(req);
}
sd = *psd;
- ids = talloc_zero_array(sd, struct id_mapping, 2);
+ ids = talloc_zero_array(sd, struct id_map, 2);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids[0].unixid = talloc(ids, struct unixid);
gid_t old_gid = -1;
uid_t new_uid = -1;
gid_t new_gid = -1;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
if (pvfs->acl_ops != NULL) {
return status;
}
- ids = talloc(req, struct id_mapping);
+ ids = talloc(req, struct id_map);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids->unixid = NULL;
ids->sid = NULL;
- ids->status = NT_STATUS_NONE_MAPPED;
+ ids->status = ID_UNKNOWN;
new_sd = info->set_secdesc.in.sd;
orig_sd = *sd;
struct xattr_NTACL *acl;
NTSTATUS status;
struct security_descriptor *parent_sd, *sd;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
sd = security_descriptor_initialise(req);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sd, tmp_ctx);
- ids = talloc_array(sd, struct id_mapping, 2);
+ ids = talloc_array(sd, struct id_map, 2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids, tmp_ctx);
ids[0].unixid = talloc(ids, struct unixid);
ids[0].unixid->id = geteuid();
ids[0].unixid->type = ID_TYPE_UID;
ids[0].sid = NULL;
- ids[0].status = NT_STATUS_NONE_MAPPED;
+ ids[0].status = ID_UNKNOWN;
ids[1].unixid = talloc(ids, struct unixid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids[1].unixid, tmp_ctx);
ids[1].unixid->id = getegid();
ids[1].unixid->type = ID_TYPE_GID;
ids[1].sid = NULL;
- ids[1].status = NT_STATUS_NONE_MAPPED;
+ ids[1].status = ID_UNKNOWN;
ctx = wbc_xids_to_sids_send(pvfs->wbc_ctx, ids, 2, ids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ctx, tmp_ctx);
struct nfs4acl *acl;
struct security_descriptor *sd;
int i, num_ids;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
acl = talloc_zero(mem_ctx, struct nfs4acl);
/* the number of ids to map is the acl count plus uid and gid */
num_ids = acl->a_count +2;
- ids = talloc_array(sd, struct id_mapping, num_ids);
+ ids = talloc_array(sd, struct id_map, num_ids);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids[0].unixid = talloc(ids, struct unixid);
ids[0].unixid->id = name->st.st_uid;
ids[0].unixid->type = ID_TYPE_UID;
ids[0].sid = NULL;
- ids[0].status = NT_STATUS_NONE_MAPPED;
+ ids[0].status = ID_UNKNOWN;
ids[1].unixid = talloc(ids, struct unixid);
NT_STATUS_HAVE_NO_MEMORY(ids[1].unixid);
ids[1].unixid->id = name->st.st_gid;
ids[1].unixid->type = ID_TYPE_GID;
ids[1].sid = NULL;
- ids[1].status = NT_STATUS_NONE_MAPPED;
+ ids[1].status = ID_UNKNOWN;
for (i=0;i<acl->a_count;i++) {
struct nfs4ace *a = &acl->ace[i];
ids[i+2].unixid->type = ID_TYPE_UID;
}
ids[i+2].sid = NULL;
- ids[i+2].status = NT_STATUS_NONE_MAPPED;
+ ids[i+2].status = ID_UNKNOWN;
}
/* Allocate memory for the sids from the security descriptor to be on
struct nfs4acl acl;
int i;
TALLOC_CTX *tmp_ctx;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
tmp_ctx = talloc_new(pvfs);
return NT_STATUS_NO_MEMORY;
}
- ids = talloc_array(tmp_ctx, struct id_mapping, acl.a_count);
+ ids = talloc_array(tmp_ctx, struct id_map, acl.a_count);
if (ids == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
- ids[i].status = NT_STATUS_NONE_MAPPED;
+ ids[i].status = ID_UNKNOWN;
}
ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx,ids, acl.a_count, ids);
struct unixuid_private *priv = ntvfs->private_data;
int i;
NTSTATUS status;
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
*sec = talloc(req, struct unix_sec_ctx);
return NT_STATUS_ACCESS_DENIED;
}
- ids = talloc_array(req, struct id_mapping, token->num_sids);
+ ids = talloc_array(req, struct id_map, token->num_sids);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids[0].unixid = NULL;
ids[0].sid = token->user_sid;
- ids[0].status = NT_STATUS_NONE_MAPPED;
+ ids[0].status = ID_UNKNOWN;
ids[1].unixid = NULL;
ids[1].sid = token->group_sid;
- ids[1].status = NT_STATUS_NONE_MAPPED;
+ ids[1].status = ID_UNKNOWN;
(*sec)->ngroups = token->num_sids - 2;
(*sec)->groups = talloc_array(*sec, gid_t, (*sec)->ngroups);
for (i=0;i<(*sec)->ngroups;i++) {
ids[i+2].unixid = NULL;
ids[i+2].sid = token->sids[i+2];
- ids[i+2].status = NT_STATUS_NONE_MAPPED;
+ ids[i+2].status = ID_UNKNOWN;
}
ctx = wbc_sids_to_xids_send(priv->wbc_ctx, ids, token->num_sids, ids);
struct wbc_context *wbc_ctx = talloc_get_type_abort(
dce_call->context->private_data,
struct wbc_context);
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
DEBUG(5, ("dcesrv_unixinfo_SidToUid called\n"));
- ids = talloc(mem_ctx, struct id_mapping);
+ ids = talloc(mem_ctx, struct id_map);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids->sid = &r->in.sid;
- ids->status = NT_STATUS_NONE_MAPPED;
+ ids->status = ID_UNKNOWN;
ids->unixid = NULL;
ctx = wbc_sids_to_xids_send(wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
struct wbc_context *wbc_ctx = talloc_get_type_abort(
dce_call->context->private_data,
struct wbc_context);
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
uint32_t uid;
NTSTATUS status;
return NT_STATUS_INVALID_PARAMETER;
}
- ids = talloc(mem_ctx, struct id_mapping);
+ ids = talloc(mem_ctx, struct id_map);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids->sid = NULL;
- ids->status = NT_STATUS_NONE_MAPPED;
+ ids->status = ID_UNKNOWN;
ids->unixid = talloc(ids, struct unixid);
NT_STATUS_HAVE_NO_MEMORY(ids->unixid);
struct wbc_context *wbc_ctx = talloc_get_type_abort(
dce_call->context->private_data,
struct wbc_context);
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
DEBUG(5, ("dcesrv_unixinfo_SidToGid called\n"));
- ids = talloc(mem_ctx, struct id_mapping);
+ ids = talloc(mem_ctx, struct id_map);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids->sid = &r->in.sid;
- ids->status = NT_STATUS_NONE_MAPPED;
+ ids->status = ID_UNKNOWN;
ids->unixid = NULL;
ctx = wbc_sids_to_xids_send(wbc_ctx, ids, 1, ids);
NT_STATUS_HAVE_NO_MEMORY(ctx);
struct wbc_context *wbc_ctx = talloc_get_type_abort(
dce_call->context->private_data,
struct wbc_context);
- struct id_mapping *ids;
+ struct id_map *ids;
struct composite_context *ctx;
uint32_t gid;
NTSTATUS status;
return NT_STATUS_INVALID_PARAMETER;
}
- ids = talloc(mem_ctx, struct id_mapping);
+ ids = talloc(mem_ctx, struct id_map);
NT_STATUS_HAVE_NO_MEMORY(ids);
ids->sid = NULL;
- ids->status = NT_STATUS_NONE_MAPPED;
+ ids->status = ID_UNKNOWN;
ids->unixid = talloc(ids, struct unixid);
NT_STATUS_HAVE_NO_MEMORY(ids->unixid);
NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx,
TALLOC_CTX *mem_ctx, int count,
- struct id_mapping *id)
+ struct id_map *id)
{
int i;
int error_count = 0;
+ NTSTATUS status;
for (i = 0; i < count; ++i) {
- id[i].status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
+ status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
id[i].unixid, &id[i].sid);
- if (NT_STATUS_EQUAL(id[i].status, NT_STATUS_RETRY)) {
- id[i].status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
+ status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
id[i].unixid,
&id[i].sid);
}
- if (!NT_STATUS_IS_OK(id[i].status)) {
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("idmapping xid_to_sid failed for id[%d]\n", i));
error_count++;
+ id[i].status = ID_UNMAPPED;
+ } else {
+ id[i].status = ID_MAPPED;
}
}
NTSTATUS idmap_sids_to_xids(struct idmap_context *idmap_ctx,
TALLOC_CTX *mem_ctx, int count,
- struct id_mapping *id)
+ struct id_map *id)
{
int i;
int error_count = 0;
+ NTSTATUS status;
for (i = 0; i < count; ++i) {
- id[i].status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
+ status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
id[i].sid, &id[i].unixid);
- if (NT_STATUS_EQUAL(id[i].status, NT_STATUS_RETRY)) {
- id[i].status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
+ status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
id[i].sid,
&id[i].unixid);
}
- if (!NT_STATUS_IS_OK(id[i].status)) {
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("idmapping sid_to_xid failed for id[%d]\n", i));
error_count++;
+ id[i].status = ID_UNMAPPED;
+ } else {
+ id[i].status = ID_MAPPED;
}
}
struct composite_context *result, *ctx;
struct gid2sid_state *state;
struct unixid *unixid;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_gid2sid_send called\n"));
unixid->id = gid;
unixid->type = ID_TYPE_GID;
- ids = talloc(result, struct id_mapping);
+ ids = talloc(result, struct id_map);
if (composite_nomem(ids, result)) return result;
ids->unixid = unixid;
ids->sid = NULL;
{
struct gid2sid_state *state = talloc_get_type(ctx->async.private_data,
struct gid2sid_state);
- struct id_mapping *ids = NULL;
+ struct id_map *ids = NULL;
state->ctx->status = wb_xids2sids_recv(ctx, &ids);
if (!composite_is_ok(state->ctx)) return;
- if (!NT_STATUS_IS_OK(ids->status)) {
- composite_error(state->ctx, ids->status);
+ if (ids->status != ID_MAPPED) {
+ composite_error(state->ctx, NT_STATUS_UNSUCCESSFUL);
return;
}
{
struct composite_context *result, *ctx;
struct sid2gid_state *state;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_sid2gid_send called\n"));
result->private_data = state;
state->service = service;
- ids = talloc(result, struct id_mapping);
+ ids = talloc(result, struct id_map);
if (composite_nomem(ids, result)) return result;
ids->sid = dom_sid_dup(result, sid);
struct sid2gid_state *state = talloc_get_type(ctx->async.private_data,
struct sid2gid_state);
- struct id_mapping *ids = NULL;
+ struct id_map *ids = NULL;
state->ctx->status = wb_sids2xids_recv(ctx, &ids);
if (!composite_is_ok(state->ctx)) return;
- if (!NT_STATUS_IS_OK(ids->status)) {
- composite_error(state->ctx, ids->status);
+ if (ids->status != ID_MAPPED) {
+ composite_error(state->ctx, NT_STATUS_UNSUCCESSFUL);
return;
}
{
struct composite_context *result, *ctx;
struct sid2uid_state *state;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_sid2uid_send called\n"));
result->private_data = state;
state->service = service;
- ids = talloc(result, struct id_mapping);
+ ids = talloc(result, struct id_map);
if (composite_nomem(ids, result)) return result;
ids->sid = dom_sid_dup(result, sid);
struct sid2uid_state *state = talloc_get_type(ctx->async.private_data,
struct sid2uid_state);
- struct id_mapping *ids = NULL;
+ struct id_map *ids = NULL;
state->ctx->status = wb_sids2xids_recv(ctx, &ids);
if (!composite_is_ok(state->ctx)) return;
- if (!NT_STATUS_IS_OK(ids->status)) {
- composite_error(state->ctx, ids->status);
+ if (ids->status != ID_MAPPED) {
+ composite_error(state->ctx, NT_STATUS_UNSUCCESSFUL);
return;
}
struct sids2xids_state {
struct composite_context *ctx;
struct wbsrv_service *service;
- struct id_mapping *ids;
+ struct id_map *ids;
int count;
};
struct composite_context *wb_sids2xids_send(TALLOC_CTX *mem_ctx,
struct wbsrv_service *service,
- int count, struct id_mapping *ids)
+ int count, struct id_map *ids)
{
struct composite_context *result;
struct sids2xids_state *state;
}
NTSTATUS wb_sids2xids_recv(struct composite_context *ctx,
- struct id_mapping **ids)
+ struct id_map **ids)
{
NTSTATUS status = composite_wait(ctx);
struct sids2xids_state *state = talloc_get_type(ctx->private_data,
struct composite_context *result, *ctx;
struct uid2sid_state *state;
struct unixid *unixid;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_uid2sid_send called\n"));
unixid->id = uid;
unixid->type = ID_TYPE_UID;
- ids = talloc(result, struct id_mapping);
+ ids = talloc(result, struct id_map);
if (composite_nomem(ids, result)) return result;
ids->unixid = unixid;
ids->sid = NULL;
{
struct uid2sid_state *state = talloc_get_type(ctx->async.private_data,
struct uid2sid_state);
- struct id_mapping *ids = NULL;
+ struct id_map *ids = NULL;
state->ctx->status = wb_xids2sids_recv(ctx, &ids);
if (!composite_is_ok(state->ctx)) return;
- if (!NT_STATUS_IS_OK(ids->status)) {
- composite_error(state->ctx, ids->status);
+ if (ids->status != ID_MAPPED) {
+ composite_error(state->ctx, NT_STATUS_UNSUCCESSFUL);
return;
}
struct xids2sids_state {
struct composite_context *ctx;
struct wbsrv_service *service;
- struct id_mapping *ids;
+ struct id_map *ids;
int count;
};
struct composite_context *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
struct wbsrv_service *service,
- int count, struct id_mapping *ids)
+ int count, struct id_map *ids)
{
struct composite_context *result;
struct xids2sids_state *state;
}
NTSTATUS wb_xids2sids_recv(struct composite_context *ctx,
- struct id_mapping **ids)
+ struct id_map **ids)
{
NTSTATUS status = composite_wait(ctx);
struct xids2sids_state *state = talloc_get_type(ctx->private_data,