[SAMSRV] Return correct status for existing groups and users 4282/head
authorStanislav Motylkov <x86corez@gmail.com>
Thu, 13 Jan 2022 13:38:04 +0000 (16:38 +0300)
committerStanislav Motylkov <x86corez@gmail.com>
Thu, 13 Jan 2022 13:38:04 +0000 (16:38 +0300)
[NETAPI32] NetpNtStatusToApiStatus: Update accordingly

This fixes net command output in PR #4096.

dll/win32/netapi32/misc.c
dll/win32/samsrv/domain.c

index 8fa84a0..8ad2f56 100644 (file)
@@ -301,6 +301,14 @@ NetpNtStatusToApiStatus(
             ApiStatus = NERR_BadUsername;
             break;
 
+        case STATUS_USER_EXISTS:
+            ApiStatus = NERR_UserExists;
+            break;
+
+        case STATUS_GROUP_EXISTS:
+            ApiStatus = NERR_GroupExists;
+            break;
+
         case STATUS_PASSWORD_RESTRICTION:
             ApiStatus = NERR_PasswordTooShort;
             break;
index 95080af..3e1e507 100644 (file)
@@ -157,7 +157,7 @@ SampCheckAccountNameInDomain(IN PSAM_DB_OBJECT DomainObject,
             if (Status == STATUS_SUCCESS)
             {
                 SampRegCloseKey(&NamesKey);
-                Status = STATUS_ALIAS_EXISTS;
+                Status = STATUS_GROUP_EXISTS;
             }
             else if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
                 Status = STATUS_SUCCESS;
@@ -192,7 +192,7 @@ SampCheckAccountNameInDomain(IN PSAM_DB_OBJECT DomainObject,
             if (Status == STATUS_SUCCESS)
             {
                 SampRegCloseKey(&NamesKey);
-                Status = STATUS_ALIAS_EXISTS;
+                Status = STATUS_USER_EXISTS;
             }
             else if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
                 Status = STATUS_SUCCESS;