summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/rpc_server/samr/samr_password.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 2b04903ebd..acbb02a795 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -836,13 +836,14 @@ NTSTATUS samdb_set_password_sid(struct ldb_context *ctx, TALLOC_CTX *mem_ctx,
NTSTATUS nt_status;
struct ldb_dn *user_dn;
struct ldb_message *msg;
- int count;
int ret;
user_dn = samdb_search_dn(ctx, mem_ctx, NULL,
- "((objectSid=%s)(objectClass=user))",
+ "(&(objectSid=%s)(objectClass=user))",
ldap_encode_ndr_dom_sid(mem_ctx, user_sid));
- if (count != 1) {
+ if (!user_dn) {
+ DEBUG(3, ("samdb_set_password_sid: SID %s not found in samdb, returning NO_SUCH_USER\n",
+ dom_sid_string(mem_ctx, user_sid)));
return NT_STATUS_NO_SUCH_USER;
}