[SAMSRV]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 27 Jul 2013 17:59:28 +0000 (17:59 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 27 Jul 2013 17:59:28 +0000 (17:59 +0000)
SamrCreateUserInDomain and SamrCreateUser2InDomain: Implement the user name length limit of 20 characters.

svn path=/trunk/; revision=59589

reactos/dll/win32/samsrv/samrpc.c

index 385187c..fabed2d 100644 (file)
@@ -2128,6 +2128,12 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
         return Status;
     }
 
+    if (Name->Length > 20 * sizeof(WCHAR))
+    {
+        TRACE("User name is too long!\n");
+        return STATUS_INVALID_ACCOUNT_NAME;
+    }
+
     /* Check if the user name already exists in the domain */
     Status = SampCheckAccountNameInDomain(DomainObject,
                                           Name->Buffer);
@@ -8091,6 +8097,12 @@ SamrCreateUser2InDomain(IN SAMPR_HANDLE DomainHandle,
         return Status;
     }
 
+    if (Name->Length > 20 * sizeof(WCHAR))
+    {
+        TRACE("User name is too long!\n");
+        return STATUS_INVALID_ACCOUNT_NAME;
+    }
+
     /* Check if the user name already exists in the domain */
     Status = SampCheckAccountNameInDomain(DomainObject,
                                           Name->Buffer);