summaryrefslogtreecommitdiff
path: root/source4/winbind/idmap.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-05-24 14:58:07 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-05-24 23:08:57 +1000
commitdceca3d8ae0220bb8d23325a0a771533bf946217 (patch)
tree8a963ebcca833b570190977364128e8cfd6cb4f6 /source4/winbind/idmap.c
parent9573c35636806a0ce013c32e611603c0e8a480fd (diff)
downloadsamba-dceca3d8ae0220bb8d23325a0a771533bf946217.tar.gz
samba-dceca3d8ae0220bb8d23325a0a771533bf946217.tar.bz2
samba-dceca3d8ae0220bb8d23325a0a771533bf946217.zip
s4:winbind Change idmap API to match that used by the source3/ idmap subsystem
This makes it much easier to write an idmap module that bridges the gap. We should finish the change to the new API, but for the moment this choke point works for the conversion. Andrew Bartlett
Diffstat (limited to 'source4/winbind/idmap.c')
-rw-r--r--source4/winbind/idmap.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index 1b2d358b8b..b5a01ae6a1 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -613,31 +613,31 @@ failed:
*/
NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx,
- TALLOC_CTX *mem_ctx, int count,
- struct id_map *id)
+ TALLOC_CTX *mem_ctx,
+ struct id_map **id)
{
- int i;
- int error_count = 0;
+ unsigned int i, error_count = 0;
NTSTATUS status;
- for (i = 0; i < count; ++i) {
+ for (i = 0; id && id[i]; i++) {
status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
- &id[i].xid, &id[i].sid);
+ &id[i]->xid, &id[i]->sid);
if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
status = idmap_xid_to_sid(idmap_ctx, mem_ctx,
- &id[i].xid,
- &id[i].sid);
+ &id[i]->xid,
+ &id[i]->sid);
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("idmapping xid_to_sid failed for id[%d]\n", i));
+ DEBUG(1, ("idmapping xid_to_sid failed for id[%d]=%lu: %s\n",
+ i, (unsigned long)id[i]->xid.id, nt_errstr(status)));
error_count++;
- id[i].status = ID_UNMAPPED;
+ id[i]->status = ID_UNMAPPED;
} else {
- id[i].status = ID_MAPPED;
+ id[i]->status = ID_MAPPED;
}
}
- if (error_count == count) {
+ if (error_count == i) {
/* Mapping did not work at all. */
return NT_STATUS_NONE_MAPPED;
} else if (error_count > 0) {
@@ -662,31 +662,33 @@ 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_map *id)
+ TALLOC_CTX *mem_ctx,
+ struct id_map **id)
{
- int i;
- int error_count = 0;
+ unsigned int i, error_count = 0;
NTSTATUS status;
- for (i = 0; i < count; ++i) {
+ for (i = 0; id && id[i]; i++) {
status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
- id[i].sid, &id[i].xid);
+ id[i]->sid, &id[i]->xid);
if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
status = idmap_sid_to_xid(idmap_ctx, mem_ctx,
- id[i].sid,
- &id[i].xid);
+ id[i]->sid,
+ &id[i]->xid);
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("idmapping sid_to_xid failed for id[%d]\n", i));
+ char *str = dom_sid_string(mem_ctx, id[i]->sid);
+ DEBUG(1, ("idmapping sid_to_xid failed for id[%d]=%s: %s\n",
+ i, str, nt_errstr(status)));
+ talloc_free(str);
error_count++;
- id[i].status = ID_UNMAPPED;
+ id[i]->status = ID_UNMAPPED;
} else {
- id[i].status = ID_MAPPED;
+ id[i]->status = ID_MAPPED;
}
}
- if (error_count == count) {
+ if (error_count == i) {
/* Mapping did not work at all. */
return NT_STATUS_NONE_MAPPED;
} else if (error_count > 0) {