summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-12-04 10:24:30 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-12-04 11:24:44 +0100
commitb6750eee281427bf7c570b9b594f924583fa6bb5 (patch)
treedfb3b6eaa08a1363bc4d386d39aa8a8d22fe64d8 /source4/dsdb/common
parentb604e9425b3f1a1c4c9a627ac6f939837c9c0665 (diff)
downloadsamba-b6750eee281427bf7c570b9b594f924583fa6bb5.tar.gz
samba-b6750eee281427bf7c570b9b594f924583fa6bb5.tar.bz2
samba-b6750eee281427bf7c570b9b594f924583fa6bb5.zip
s4:dsdb/common/util_samr.c - "dsdb_enum_group_mem" - fix it up regarding non SAM members
For example contacts.
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util_samr.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source4/dsdb/common/util_samr.c b/source4/dsdb/common/util_samr.c
index 72d42cbf8e..e6c7797eac 100644
--- a/source4/dsdb/common/util_samr.c
+++ b/source4/dsdb/common/util_samr.c
@@ -409,7 +409,7 @@ NTSTATUS dsdb_enum_group_mem(struct ldb_context *ldb,
unsigned int *pnum_members)
{
struct ldb_message *msg;
- unsigned int i;
+ unsigned int i, j;
int ret;
struct dom_sid *members;
struct ldb_message_element *member_el;
@@ -443,6 +443,7 @@ NTSTATUS dsdb_enum_group_mem(struct ldb_context *ldb,
return NT_STATUS_NO_MEMORY;
}
+ j = 0;
for (i=0; i <member_el->num_values; i++) {
struct ldb_dn *member_dn = ldb_dn_from_ldb_val(tmp_ctx, ldb,
&member_el->values[i]);
@@ -455,17 +456,25 @@ NTSTATUS dsdb_enum_group_mem(struct ldb_context *ldb,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- status = dsdb_get_extended_dn_sid(member_dn, &members[i], "SID");
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("Could find SID attribute on extended DN %s\n",
- ldb_dn_get_extended_linearized(tmp_ctx, dn, 1)));
+ status = dsdb_get_extended_dn_sid(member_dn, &members[j],
+ "SID");
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ /* If we fail finding a SID then this is no error since
+ * it could be a non SAM object - e.g. a contact */
+ continue;
+ } else if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("When parsing DN %s we failed to parse our SID component, so we cannot fetch the membership: %s\n",
+ ldb_dn_get_extended_linearized(tmp_ctx, dn, 1),
+ nt_errstr(status)));
talloc_free(tmp_ctx);
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ return status;
}
+
+ ++j;
}
*members_out = talloc_steal(mem_ctx, members);
- *pnum_members = member_el->num_values;
+ *pnum_members = j;
talloc_free(tmp_ctx);
return NT_STATUS_OK;
}