From dd8fe5a97301bf3dc6b981910a45da8067c827d6 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Thu, 14 Feb 2008 14:35:47 +0100 Subject: [PATCH] netapi32/tests: Adding a user with a too long name succeeds on NT4. --- dlls/netapi32/tests/access.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/netapi32/tests/access.c b/dlls/netapi32/tests/access.c index 3861768ef23..202c2598b4f 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;