s4-samr: Escape the username in the LDAP filter
authorAndrew Bartlett <abartlet@samba.org>
Mon, 17 Mar 2014 00:33:18 +0000 (13:33 +1300)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Apr 2014 15:12:47 +0000 (17:12 +0200)
Change-Id: I99945f0b86ea2862c88c00ad39c809ef1101ca9b
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/rpc_server/samr/samr_password.c

index 383fce1223f8473c29c7685a6f22df68c32cb157..1466decc081a4ae9451e964b19e70a1125b4ca9f 100644 (file)
@@ -102,7 +102,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
        ret = gendb_search(sam_ctx,
                           mem_ctx, NULL, &res, attrs,
                           "(&(sAMAccountName=%s)(objectclass=user))",
-                          r->in.account->string);
+                          ldb_binary_encode_string(mem_ctx, r->in.account->string));
        if (ret != 1) {
                /* Don't give the game away:  (don't allow anonymous users to prove the existance of usernames) */
                return NT_STATUS_WRONG_PASSWORD;
@@ -249,7 +249,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
        ret = gendb_search(sam_ctx,
                           mem_ctx, NULL, &res, attrs,
                           "(&(sAMAccountName=%s)(objectclass=user))",
-                          r->in.account->string);
+                          ldb_binary_encode_string(mem_ctx, r->in.account->string));
        if (ret != 1) {
                /* Don't give the game away:  (don't allow anonymous users to prove the existance of usernames) */
                status = NT_STATUS_WRONG_PASSWORD;