https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cde633915563bf2c4a937…
commit cde633915563bf2c4a93726f7025baa268ea6c8a
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Thu Jan 13 16:38:04 2022 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Thu Jan 13 16:38:04 2022 +0300
[SAMSRV] Return correct status for existing groups and users
[NETAPI32] NetpNtStatusToApiStatus: Update accordingly
This fixes net command output in PR #4096.
---
dll/win32/netapi32/misc.c | 8 ++++++++
dll/win32/samsrv/domain.c | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dll/win32/netapi32/misc.c b/dll/win32/netapi32/misc.c
index 8fa84a07c6b..8ad2f566513 100644
--- a/dll/win32/netapi32/misc.c
+++ b/dll/win32/netapi32/misc.c
@@ -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;
diff --git a/dll/win32/samsrv/domain.c b/dll/win32/samsrv/domain.c
index 95080af777e..3e1e507f0c0 100644
--- a/dll/win32/samsrv/domain.c
+++ b/dll/win32/samsrv/domain.c
@@ -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;