From 1a5584d22162f6d62e257bdfd67ca55a54ffc7df Mon Sep 17 00:00:00 2001 From: pjoe Date: Fri, 3 Oct 2008 14:22:48 -0500 Subject: [PATCH] BUG 5806: Return success from idmap_passwd only whe the id was mapped to a SID. Previous code only erturned NT_STATUS_OK when all uids/gids were successfully mapped. The returns to similar semantics which allows the search to continue to other backends. --- source/winbindd/idmap_passdb.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/winbindd/idmap_passdb.c b/source/winbindd/idmap_passdb.c index 4dcf744..e1080bf 100644 --- a/source/winbindd/idmap_passdb.c +++ b/source/winbindd/idmap_passdb.c @@ -40,6 +40,7 @@ static NTSTATUS idmap_pdb_init(struct idmap_domain *dom, const char *params) static NTSTATUS idmap_pdb_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids) { int i; + NTSTATUS nt_status = NT_STATUS_NONE_MAPPED; for (i = 0; ids[i]; i++) { @@ -50,11 +51,13 @@ static NTSTATUS idmap_pdb_unixids_to_sids(struct idmap_domain *dom, struct id_ma case ID_TYPE_UID: if (pdb_uid_to_sid((uid_t)ids[i]->xid.id, ids[i]->sid)) { ids[i]->status = ID_MAPPED; + nt_status = NT_STATUS_OK; } break; case ID_TYPE_GID: if (pdb_gid_to_sid((gid_t)ids[i]->xid.id, ids[i]->sid)) { ids[i]->status = ID_MAPPED; + nt_status = NT_STATUS_OK; } break; default: /* ?? */ @@ -62,7 +65,7 @@ static NTSTATUS idmap_pdb_unixids_to_sids(struct idmap_domain *dom, struct id_ma } } - return NT_STATUS_OK; + return nt_status; } /********************************** @@ -72,6 +75,7 @@ static NTSTATUS idmap_pdb_unixids_to_sids(struct idmap_domain *dom, struct id_ma static NTSTATUS idmap_pdb_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids) { int i; + NTSTATUS nt_status = NT_STATUS_NONE_MAPPED; for (i = 0; ids[i]; i++) { enum lsa_SidType type; @@ -83,6 +87,7 @@ static NTSTATUS idmap_pdb_sids_to_unixids(struct idmap_domain *dom, struct id_ma ids[i]->xid.id = id.uid; ids[i]->xid.type = ID_TYPE_UID; ids[i]->status = ID_MAPPED; + nt_status = NT_STATUS_OK; break; case SID_NAME_DOM_GRP: @@ -91,6 +96,7 @@ static NTSTATUS idmap_pdb_sids_to_unixids(struct idmap_domain *dom, struct id_ma ids[i]->xid.id = id.gid; ids[i]->xid.type = ID_TYPE_GID; ids[i]->status = ID_MAPPED; + nt_status = NT_STATUS_OK; break; default: /* ?? */ @@ -104,7 +110,7 @@ static NTSTATUS idmap_pdb_sids_to_unixids(struct idmap_domain *dom, struct id_ma } } - return NT_STATUS_OK; + return nt_status; } /********************************** -- 1.5.4.3