[SAMSRV]
authorEric Kohl <eric.kohl@reactos.org>
Tue, 16 Sep 2014 10:32:04 +0000 (10:32 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 16 Sep 2014 10:32:04 +0000 (10:32 +0000)
SampRemoveUserFromAllGroups:
- Do not treat a STATUS_MEMBER_NOT_IN_GROUP, returned by SampRemoveMemberFromGroup, as error but as success.
- Clear the Groups attribute at the end.

svn path=/trunk/; revision=64169

reactos/dll/win32/samsrv/user.c

index 04ca49f..a442780 100644 (file)
@@ -361,6 +361,8 @@ SampRemoveUserFromAllGroups(IN PSAM_DB_OBJECT UserObject)
 
         Status = SampRemoveMemberFromGroup(GroupObject,
                                            UserObject->RelativeId);
+        if (Status == STATUS_MEMBER_NOT_IN_GROUP)
+            Status = STATUS_SUCCESS;
 
         SampCloseDbObject(GroupObject);
 
@@ -370,6 +372,13 @@ SampRemoveUserFromAllGroups(IN PSAM_DB_OBJECT UserObject)
         }
     }
 
+    /* Remove all groups from the Groups attribute */
+    Status = SampSetObjectAttribute(UserObject,
+                                    L"Groups",
+                                    REG_BINARY,
+                                    NULL,
+                                    0);
+
 done:
     if (GroupsBuffer != NULL)
         midl_user_free(GroupsBuffer);