Paul Vriens : netapi32/tests: Adding a user with a too long name succeeds on NT4.

Alexandre Julliard julliard at winehq.org
Fri Feb 15 05:35:58 CST 2008


Module: wine
Branch: master
Commit: dd8fe5a97301bf3dc6b981910a45da8067c827d6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dd8fe5a97301bf3dc6b981910a45da8067c827d6

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Thu Feb 14 14:35:47 2008 +0100

netapi32/tests: Adding a user with a too long name succeeds on NT4.

---

 dlls/netapi32/tests/access.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/netapi32/tests/access.c b/dlls/netapi32/tests/access.c
index 3861768..202c259 100644
--- a/dlls/netapi32/tests/access.c
+++ b/dlls/netapi32/tests/access.c
@@ -244,7 +244,17 @@ static void run_userhandling_tests(void)
     usri.usri1_password = sTestUserOldPass;
 
     ret = pNetUserAdd(NULL, 1, (LPBYTE)&usri, NULL);
-    ok(ret == NERR_BadUsername, "Adding user with too long username returned 0x%08x\n", ret);
+    if (ret == NERR_Success || ret == NERR_UserExists)
+    {
+        /* Windows NT4 does create the user. Delete the user and also if it already existed
+         * due to a previous test run on NT4.
+         */
+        trace("We are on NT4, we have to delete the user with the too long username\n");
+        ret = pNetUserDel(NULL, sTooLongName);
+        ok(ret == NERR_Success, "Deleting the user failed : %d\n", ret);
+    }
+    else
+        ok(ret == NERR_BadUsername, "Adding user with too long username returned 0x%08x\n", ret);
 
     usri.usri1_name = sTestUserName;
     usri.usri1_password = sTooLongPassword;
@@ -256,7 +266,10 @@ static void run_userhandling_tests(void)
     usri.usri1_password = sTooLongPassword;
 
     ret = pNetUserAdd(NULL, 1, (LPBYTE)&usri, NULL);
-    ok(ret == NERR_BadUsername,
+    /* NT4 doesn't have a problem with the username so it will report the too long password
+     * as the error. NERR_PasswordTooShort is reported for all kind of password related errors.
+     */
+    ok(ret == NERR_BadUsername || ret == NERR_PasswordTooShort,
             "Adding user with too long username/password returned 0x%08x\n", ret);
 
     usri.usri1_name = sTestUserName;




More information about the wine-cvs mailing list