summaryrefslogtreecommitdiff
path: root/source4/winbind
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2009-04-23 16:37:11 +0200
committerKai Blin <kai@samba.org>2010-02-11 23:56:35 +0100
commitea055e8c7905ec5d229fd5b50ca9ec8f60073b53 (patch)
tree1fbb879a3bb2ff7b273c512dbec6e4b86b694521 /source4/winbind
parent86d70ae94425c34fcb7cc7791a6e54b1a47f21cc (diff)
downloadsamba-ea055e8c7905ec5d229fd5b50ca9ec8f60073b53.tar.gz
samba-ea055e8c7905ec5d229fd5b50ca9ec8f60073b53.tar.bz2
samba-ea055e8c7905ec5d229fd5b50ca9ec8f60073b53.zip
s4: Switch to S3-style id mapping data types.
Diffstat (limited to 'source4/winbind')
-rw-r--r--source4/winbind/idmap.c28
-rw-r--r--source4/winbind/wb_gid2sid.c10
-rw-r--r--source4/winbind/wb_sid2gid.c10
-rw-r--r--source4/winbind/wb_sid2uid.c10
-rw-r--r--source4/winbind/wb_sids2xids.c6
-rw-r--r--source4/winbind/wb_uid2sid.c10
-rw-r--r--source4/winbind/wb_xids2sids.c6
7 files changed, 44 insertions, 36 deletions
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index b37de8810b..fc7b8d447d 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -638,22 +638,26 @@ failed:
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;
}
}
@@ -683,22 +687,26 @@ NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx,
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;
}
}
diff --git a/source4/winbind/wb_gid2sid.c b/source4/winbind/wb_gid2sid.c
index e569ceaca5..1cd34fce18 100644
--- a/source4/winbind/wb_gid2sid.c
+++ b/source4/winbind/wb_gid2sid.c
@@ -38,7 +38,7 @@ struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
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"));
@@ -57,7 +57,7 @@ struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
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;
@@ -73,12 +73,12 @@ static void gid2sid_recv_sid(struct composite_context *ctx)
{
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;
}
diff --git a/source4/winbind/wb_sid2gid.c b/source4/winbind/wb_sid2gid.c
index eb4d6b0d21..9d9fabbbf8 100644
--- a/source4/winbind/wb_sid2gid.c
+++ b/source4/winbind/wb_sid2gid.c
@@ -38,7 +38,7 @@ struct composite_context *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
{
struct composite_context *result, *ctx;
struct sid2gid_state *state;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_sid2gid_send called\n"));
@@ -52,7 +52,7 @@ struct composite_context *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
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);
@@ -70,13 +70,13 @@ static void sid2gid_recv_gid(struct composite_context *ctx)
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;
}
diff --git a/source4/winbind/wb_sid2uid.c b/source4/winbind/wb_sid2uid.c
index ee5b09c7fa..7431601038 100644
--- a/source4/winbind/wb_sid2uid.c
+++ b/source4/winbind/wb_sid2uid.c
@@ -38,7 +38,7 @@ struct composite_context *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
{
struct composite_context *result, *ctx;
struct sid2uid_state *state;
- struct id_mapping *ids;
+ struct id_map *ids;
DEBUG(5, ("wb_sid2uid_send called\n"));
@@ -52,7 +52,7 @@ struct composite_context *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
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);
@@ -70,13 +70,13 @@ static void sid2uid_recv_uid(struct composite_context *ctx)
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;
}
diff --git a/source4/winbind/wb_sids2xids.c b/source4/winbind/wb_sids2xids.c
index 51fa2212ee..617318ce52 100644
--- a/source4/winbind/wb_sids2xids.c
+++ b/source4/winbind/wb_sids2xids.c
@@ -27,13 +27,13 @@
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;
@@ -61,7 +61,7 @@ struct composite_context *wb_sids2xids_send(TALLOC_CTX *mem_ctx,
}
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,
diff --git a/source4/winbind/wb_uid2sid.c b/source4/winbind/wb_uid2sid.c
index 4c3feb735d..98198674b0 100644
--- a/source4/winbind/wb_uid2sid.c
+++ b/source4/winbind/wb_uid2sid.c
@@ -38,7 +38,7 @@ struct composite_context *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
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"));
@@ -57,7 +57,7 @@ struct composite_context *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
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;
@@ -73,13 +73,13 @@ static void uid2sid_recv_sid(struct composite_context *ctx)
{
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;
}
diff --git a/source4/winbind/wb_xids2sids.c b/source4/winbind/wb_xids2sids.c
index 7cb57929cb..9d95ac012c 100644
--- a/source4/winbind/wb_xids2sids.c
+++ b/source4/winbind/wb_xids2sids.c
@@ -27,13 +27,13 @@
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;
@@ -61,7 +61,7 @@ struct composite_context *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
}
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,