(MS Samr) PDF
(MS Samr) PDF
(MS Samr) PDF
Tools. The Open Specifications documentation does not require the use of Microsoft programming
tools or programming environments in order for you to develop an implementation. If you have access
to Microsoft programming tools and environments, you are free to take advantage of them. Certain
Open Specifications documents are intended for use in conjunction with publicly available standards
specifications and network programming art and, as such, assume that the reader either is familiar
with the aforementioned material or has immediate access to it.
1 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Revision Summary
Revision Revision
Date History Class Comments
8/10/2007 3.0.1 Editorial Changed language and formatting in the technical content.
9/28/2007 3.0.2 Editorial Changed language and formatting in the technical content.
5/16/2008 4.1.1 Editorial Changed language and formatting in the technical content.
2 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Revision Revision
Date History Class Comments
3 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Table of Contents
1 Introduction .......................................................................................................... 11
1.1 Glossary ......................................................................................................... 11
1.2 References ...................................................................................................... 15
1.2.1 Normative References ................................................................................. 15
1.2.2 Informative References ............................................................................... 17
1.3 Overview ........................................................................................................ 17
1.3.1 Object-Based Perspective ............................................................................ 18
1.3.2 Method-Based Perspective ........................................................................... 21
1.4 Relationship to Other Protocols .......................................................................... 25
1.5 Prerequisites/Preconditions ............................................................................... 26
1.6 Applicability Statement ..................................................................................... 26
1.7 Versioning and Capability Negotiation ................................................................. 26
1.7.1 Method Introduction.................................................................................... 26
1.7.2 Method Versioning ...................................................................................... 26
1.7.3 Introduction to Information Levels ................................................................ 27
1.8 Vendor-Extensible Fields ................................................................................... 27
1.9 Standards Assignments..................................................................................... 27
2 Messages ............................................................................................................... 28
2.1 Transport ........................................................................................................ 28
2.2 Common Data Types ........................................................................................ 28
2.2.1 Constant Value Definitions ........................................................................... 29
2.2.1.1 Common ACCESS_MASK Values.............................................................. 29
2.2.1.2 Generic ACCESS_MASK Values ............................................................... 29
2.2.1.3 Server ACCESS_MASK Values ................................................................. 30
2.2.1.4 Domain ACCESS_MASK Values ............................................................... 30
2.2.1.5 Group ACCESS_MASK Values ................................................................. 31
2.2.1.6 Alias ACCESS_MASK Values ................................................................... 32
2.2.1.7 User ACCESS_MASK Values .................................................................... 33
2.2.1.8 USER_ALL Values .................................................................................. 34
2.2.1.9 ACCOUNT_TYPE Values .......................................................................... 35
2.2.1.10 SE_GROUP Attributes ............................................................................ 36
2.2.1.11 GROUP_TYPE Codes .............................................................................. 37
2.2.1.12 USER_ACCOUNT Codes .......................................................................... 37
2.2.1.13 UF_FLAG Codes .................................................................................... 39
2.2.1.14 Predefined RIDs .................................................................................... 40
2.2.1.15 STATUS_ Codes .................................................................................... 41
2.2.1.16 Transport Error Code ............................................................................. 41
2.2.1.17 AD ACCESS_MASK ................................................................................ 42
2.2.2 Basic Data Types ........................................................................................ 42
2.2.2.1 RPC_STRING, PRPC_STRING .................................................................. 42
2.2.2.2 OLD_LARGE_INTEGER ........................................................................... 42
2.2.2.3 SID_NAME_USE .................................................................................... 43
2.2.2.4 RPC_SHORT_BLOB ................................................................................ 43
2.2.3 Miscellaneous Protocol-Specific Types............................................................ 44
2.2.3.1 PSAMPR_SERVER_NAME ........................................................................ 44
2.2.3.2 SAMPR_HANDLE ................................................................................... 44
2.2.3.3 ENCRYPTED_LM_OWF_PASSWORD, ENCRYPTED_NT_OWF_PASSWORD ....... 44
2.2.3.4 SAMPR_ULONG_ARRAY .......................................................................... 45
2.2.3.5 SAMPR_SID_INFORMATION ................................................................... 45
2.2.3.6 SAMPR_PSID_ARRAY ............................................................................. 45
2.2.3.7 SAMPR_PSID_ARRAY_OUT ..................................................................... 45
2.2.3.8 SAMPR_RETURNED_USTRING_ARRAY ...................................................... 46
2.2.3.9 SAMPR_RID_ENUMERATION ................................................................... 46
2.2.3.10 SAMPR_ENUMERATION_BUFFER ............................................................. 46
4 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.3.11 SAMPR_SR_SECURITY_DESCRIPTOR ....................................................... 46
2.2.3.12 GROUP_MEMBERSHIP ............................................................................ 47
2.2.3.13 SAMPR_GET_GROUPS_BUFFER ............................................................... 47
2.2.3.14 SAMPR_GET_MEMBERS_BUFFER ............................................................. 47
2.2.3.15 SAMPR_REVISION_INFO_V1 .................................................................. 48
2.2.3.16 SAMPR_REVISION_INFO ........................................................................ 48
2.2.3.17 USER_DOMAIN_PASSWORD_INFORMATION ............................................. 48
2.2.4 Domain Query/Set Data Types ..................................................................... 49
2.2.4.1 Domain Fields ....................................................................................... 49
2.2.4.2 DOMAIN_SERVER_ENABLE_STATE .......................................................... 51
2.2.4.3 DOMAIN_STATE_INFORMATION .............................................................. 51
2.2.4.4 DOMAIN_SERVER_ROLE ........................................................................ 51
2.2.4.5 DOMAIN_PASSWORD_INFORMATION ...................................................... 51
2.2.4.6 DOMAIN_LOGOFF_INFORMATION ........................................................... 52
2.2.4.7 DOMAIN_SERVER_ROLE_INFORMATION .................................................. 52
2.2.4.8 DOMAIN_MODIFIED_INFORMATION ........................................................ 52
2.2.4.9 DOMAIN_MODIFIED_INFORMATION2 ...................................................... 52
2.2.4.10 SAMPR_DOMAIN_GENERAL_INFORMATION .............................................. 53
2.2.4.11 SAMPR_DOMAIN_GENERAL_INFORMATION2 ............................................ 53
2.2.4.12 SAMPR_DOMAIN_OEM_INFORMATION ..................................................... 54
2.2.4.13 SAMPR_DOMAIN_NAME_INFORMATION ................................................... 54
2.2.4.14 SAMPR_DOMAIN_REPLICATION_INFORMATION ........................................ 54
2.2.4.15 SAMPR_DOMAIN_LOCKOUT_INFORMATION .............................................. 54
2.2.4.16 DOMAIN_INFORMATION_CLASS ............................................................. 54
2.2.4.17 SAMPR_DOMAIN_INFO_BUFFER .............................................................. 55
2.2.5 Group Query/Set Data Types ....................................................................... 56
2.2.5.1 Common Group Fields ........................................................................... 56
2.2.5.2 GROUP_ATTRIBUTE_INFORMATION ......................................................... 57
2.2.5.3 SAMPR_GROUP_GENERAL_INFORMATION ................................................ 57
2.2.5.4 SAMPR_GROUP_NAME_INFORMATION ..................................................... 57
2.2.5.5 SAMPR_GROUP_ADM_COMMENT_INFORMATION ...................................... 57
2.2.5.6 GROUP_INFORMATION_CLASS ............................................................... 57
2.2.5.7 SAMPR_GROUP_INFO_BUFFER ............................................................... 58
2.2.6 Alias Query/Set Data Types ......................................................................... 58
2.2.6.1 Common Alias Fields ............................................................................. 59
2.2.6.2 SAMPR_ALIAS_GENERAL_INFORMATION ................................................. 59
2.2.6.3 SAMPR_ALIAS_NAME_INFORMATION ...................................................... 59
2.2.6.4 SAMPR_ALIAS_ADM_COMMENT_INFORMATION ........................................ 59
2.2.6.5 ALIAS_INFORMATION_CLASS ................................................................. 60
2.2.6.6 SAMPR_ALIAS_INFO_BUFFER ................................................................. 60
2.2.7 User Query/Set Data Types .......................................................................... 60
2.2.7.1 Common User Fields.............................................................................. 61
2.2.7.2 USER_PRIMARY_GROUP_INFORMATION .................................................. 62
2.2.7.3 USER_CONTROL_INFORMATION ............................................................. 62
2.2.7.4 USER_EXPIRES_INFORMATION ............................................................... 63
2.2.7.5 SAMPR_LOGON_HOURS ......................................................................... 63
2.2.7.6 SAMPR_USER_ALL_INFORMATION .......................................................... 63
2.2.7.7 SAMPR_USER_GENERAL_INFORMATION .................................................. 65
2.2.7.8 SAMPR_USER_PREFERENCES_INFORMATION ........................................... 65
2.2.7.9 SAMPR_USER_PARAMETERS_INFORMATION ............................................ 65
2.2.7.10 SAMPR_USER_LOGON_INFORMATION ..................................................... 65
2.2.7.11 SAMPR_USER_ACCOUNT_INFORMATION ................................................. 66
2.2.7.12 SAMPR_USER_A_NAME_INFORMATION.................................................... 66
2.2.7.13 SAMPR_USER_F_NAME_INFORMATION .................................................... 66
2.2.7.14 SAMPR_USER_NAME_INFORMATION ....................................................... 67
2.2.7.15 SAMPR_USER_HOME_INFORMATION ....................................................... 67
2.2.7.16 SAMPR_USER_SCRIPT_INFORMATION ..................................................... 67
2.2.7.17 SAMPR_USER_PROFILE_INFORMATION ................................................... 67
5 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.7.18 SAMPR_USER_ADMIN_COMMENT_INFORMATION ...................................... 68
2.2.7.19 SAMPR_USER_WORKSTATIONS_INFORMATION ........................................ 68
2.2.7.20 SAMPR_USER_LOGON_HOURS_INFORMATION ......................................... 68
2.2.7.21 SAMPR_ENCRYPTED_USER_PASSWORD ................................................... 68
2.2.7.22 SAMPR_ENCRYPTED_USER_PASSWORD_NEW .......................................... 69
2.2.7.23 SAMPR_USER_INTERNAL1_INFORMATION ............................................... 70
2.2.7.24 SAMPR_USER_INTERNAL4_INFORMATION ............................................... 70
2.2.7.25 SAMPR_USER_INTERNAL4_INFORMATION_NEW ....................................... 70
2.2.7.26 SAMPR_USER_INTERNAL5_INFORMATION ............................................... 71
2.2.7.27 SAMPR_USER_INTERNAL5_INFORMATION_NEW ....................................... 71
2.2.7.28 USER_INFORMATION_CLASS .................................................................. 71
2.2.7.29 SAMPR_USER_INFO_BUFFER .................................................................. 73
2.2.8 Selective Enumerate Associated Structures .................................................... 74
2.2.8.1 Common Selective Enumerate Fields ....................................................... 74
2.2.8.2 SAMPR_DOMAIN_DISPLAY_USER ............................................................ 75
2.2.8.3 SAMPR_DOMAIN_DISPLAY_MACHINE ...................................................... 75
2.2.8.4 SAMPR_DOMAIN_DISPLAY_GROUP ......................................................... 75
2.2.8.5 SAMPR_DOMAIN_DISPLAY_OEM_USER .................................................... 76
2.2.8.6 SAMPR_DOMAIN_DISPLAY_OEM_GROUP ................................................. 76
2.2.8.7 SAMPR_DOMAIN_DISPLAY_USER_BUFFER ............................................... 76
2.2.8.8 SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER.......................................... 77
2.2.8.9 SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER ............................................. 77
2.2.8.10 SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER ....................................... 77
2.2.8.11 SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER ..................................... 77
2.2.8.12 DOMAIN_DISPLAY_INFORMATION ........................................................... 78
2.2.8.13 SAMPR_DISPLAY_INFO_BUFFER ............................................................. 78
2.2.9 SamrValidatePassword Data Types ............................................................... 79
2.2.9.1 SAM_VALIDATE_PASSWORD_HASH ........................................................ 79
2.2.9.2 SAM_VALIDATE_PERSISTED_FIELDS ....................................................... 79
2.2.9.3 SAM_VALIDATE_VALIDATION_STATUS .................................................... 80
2.2.9.4 SAM_VALIDATE_STANDARD_OUTPUT_ARG .............................................. 81
2.2.9.5 SAM_VALIDATE_AUTHENTICATION_INPUT_ARG ....................................... 81
2.2.9.6 SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG .................................. 82
2.2.9.7 SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG ..................................... 82
2.2.9.8 PASSWORD_POLICY_VALIDATION_TYPE .................................................. 83
2.2.9.9 SAM_VALIDATE_INPUT_ARG .................................................................. 83
2.2.9.10 SAM_VALIDATE_OUTPUT_ARG ............................................................... 83
2.2.10 Supplemental Credentials Structures ............................................................. 84
2.2.10.1 USER_PROPERTIES ............................................................................... 84
2.2.10.2 USER_PROPERTY .................................................................................. 85
2.2.10.3 Primary:WDigest - WDIGEST_CREDENTIALS ............................................ 85
2.2.10.4 Primary:Kerberos - KERB_STORED_CREDENTIAL ...................................... 89
2.2.10.5 KERB_KEY_DATA .................................................................................. 91
2.2.10.6 Primary:Kerberos-Newer-Keys - KERB_STORED_CREDENTIAL_NEW............ 91
2.2.10.7 KERB_KEY_DATA_NEW .......................................................................... 93
2.2.10.8 Kerberos Encryption Algorithm Identifiers ................................................ 94
2.2.10.9 NTLM-Strong-NTOWF ............................................................................ 94
2.2.11 Common Algorithms ................................................................................... 94
2.2.11.1 DES-ECB-LM ........................................................................................ 94
2.2.11.1.1 Encrypting an NT or LM Hash Value with a Specified Key ...................... 95
2.2.11.1.2 Encrypting a 64-Bit Block with a 7-Byte Key ....................................... 95
2.2.11.1.3 Deriving Key1 and Key2 from a Little-Endian, Unsigned Integer Key ...... 96
2.2.11.1.4 Deriving Key1 and Key2 from a 16-Byte Key....................................... 96
2.3 Directory Service Schema Elements ................................................................... 96
3 Protocol Details ..................................................................................................... 97
3.1 Server Details .................................................................................................. 97
3.1.1 Abstract Data Model .................................................................................... 97
6 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.1.1 String Handling ..................................................................................... 98
3.1.1.2 String Matching .................................................................................... 98
3.1.1.3 Attribute Listing .................................................................................... 99
3.1.1.4 Object Class List ..................................................................................101
3.1.1.5 Password Settings Attributes for Originating Update Constraints ................101
3.1.1.6 Attribute Constraints for Originating Updates ...........................................102
3.1.1.7 Additional Update Constraints ................................................................106
3.1.1.7.1 General Password Policy ..................................................................106
3.1.1.7.2 Cleartext Password Policy ................................................................107
3.1.1.8 Attribute Triggers for Originating Updates ...............................................110
3.1.1.8.1 objectClass ....................................................................................110
3.1.1.8.2 primaryGroupID .............................................................................111
3.1.1.8.3 lockoutTime ...................................................................................112
3.1.1.8.4 sAMAccountName ...........................................................................112
3.1.1.8.5 clearTextPassword ..........................................................................112
3.1.1.8.6 dBCSPwd .......................................................................................113
3.1.1.8.7 unicodePwd ...................................................................................113
3.1.1.8.8 pwdLastSet....................................................................................113
3.1.1.8.9 member ........................................................................................113
3.1.1.8.10 userAccountControl ........................................................................114
3.1.1.8.11 supplementalCredentials .................................................................116
3.1.1.8.11.1 Processing ...............................................................................117
3.1.1.8.11.1.1 USER_PROPERTIES Processing ..............................................117
3.1.1.8.11.1.2 USER_PROPERTY Processing .................................................117
3.1.1.8.11.2 Packages Property ....................................................................117
3.1.1.8.11.3 Primary:WDigest Property ..........................................................118
3.1.1.8.11.3.1 WDIGEST_CREDENTIALS Construction ...................................118
3.1.1.8.11.4 Primary:Kerberos Property .........................................................119
3.1.1.8.11.5 Primary:CLEARTEXT Property .....................................................120
3.1.1.8.11.6 Primary:Kerberos-Newer-Keys Property .......................................120
3.1.1.8.11.7 Primary:NTLM-Strong-NTOWF Property .......................................121
3.1.1.9 Additional Update Triggers ....................................................................121
3.1.1.9.1 Password History Update .................................................................121
3.1.1.9.2 objectSid Value Generation ..............................................................121
3.1.1.9.2.1 DC Configuration ......................................................................122
3.1.1.9.2.2 Non-DC Configuration................................................................122
3.1.1.10 SamContextHandle Data Model ..............................................................123
3.1.2 Security Model ..........................................................................................123
3.1.2.1 Standard Handle-Based Access Checks ...................................................123
3.1.2.2 AD Access Checks in DC Configuration ....................................................129
3.1.2.3 Acquiring an SMB Session Key ...............................................................129
3.1.3 Timers .....................................................................................................129
3.1.4 Initialization ..............................................................................................129
3.1.4.1 Default Access .....................................................................................129
3.1.4.2 Default Accounts ..................................................................................129
3.1.5 Message Processing Events and Sequencing Rules .........................................132
3.1.5.1 Open Pattern .......................................................................................137
3.1.5.1.1 SamrConnect5 (Opnum 64) .............................................................137
3.1.5.1.2 SamrConnect4 (Opnum 62) .............................................................139
3.1.5.1.3 SamrConnect2 (Opnum 57) .............................................................140
3.1.5.1.4 SamrConnect (Opnum 0) .................................................................140
3.1.5.1.5 SamrOpenDomain (Opnum 7) ..........................................................141
3.1.5.1.6 Common Processing for Group, Alias, and User ..................................143
3.1.5.1.7 SamrOpenGroup (Opnum 19) ..........................................................144
3.1.5.1.8 SamrOpenAlias (Opnum 27) ............................................................145
3.1.5.1.9 SamrOpenUser (Opnum 34) ............................................................147
3.1.5.2 Enumerate Pattern ...............................................................................148
3.1.5.2.1 SamrEnumerateDomainsInSamServer (Opnum 6) ..............................148
7 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.5.2.2 Common Processing for Enumeration of Users, Groups, and Aliases ......150
3.1.5.2.3 SamrEnumerateGroupsInDomain (Opnum 11) ...................................151
3.1.5.2.4 SamrEnumerateAliasesInDomain (Opnum 15) ....................................151
3.1.5.2.5 SamrEnumerateUsersInDomain (Opnum 13) .....................................152
3.1.5.3 Selective Enumerate Pattern .................................................................153
3.1.5.3.1 SamrQueryDisplayInformation3 (Opnum 51) .....................................153
3.1.5.3.2 SamrQueryDisplayInformation2 (Opnum 48) .....................................155
3.1.5.3.3 SamrQueryDisplayInformation (Opnum 40) .......................................156
3.1.5.3.4 SamrGetDisplayEnumerationIndex2 (Opnum 49) ................................157
3.1.5.3.5 SamrGetDisplayEnumerationIndex (Opnum 41) .................................158
3.1.5.4 Create Pattern .....................................................................................159
3.1.5.4.1 Common Processing for Group and Alias Creation ...............................159
3.1.5.4.2 SamrCreateGroupInDomain (Opnum 10) ...........................................159
3.1.5.4.3 SamrCreateAliasInDomain (Opnum 14) .............................................160
3.1.5.4.4 SamrCreateUser2InDomain (Opnum 50) ...........................................161
3.1.5.4.5 SamrCreateUserInDomain (Opnum 12) .............................................163
3.1.5.5 Query Pattern ......................................................................................164
3.1.5.5.1 SamrQueryInformationDomain2 (Opnum 46) .....................................164
3.1.5.5.1.1 DomainGeneralInformation ........................................................165
3.1.5.5.1.2 DomainServerRoleInformation ....................................................166
3.1.5.5.1.3 DomainStateInformation ............................................................166
3.1.5.5.1.4 DomainGeneralInformation2 ......................................................166
3.1.5.5.2 SamrQueryInformationDomain (Opnum 8) ........................................166
3.1.5.5.3 SamrQueryInformationGroup (Opnum 20) .........................................167
3.1.5.5.3.1 GroupReplicationInformation ......................................................168
3.1.5.5.4 SamrQueryInformationAlias (Opnum 28) ...........................................168
3.1.5.5.5 SamrQueryInformationUser2 (Opnum 47) .........................................169
3.1.5.5.5.1 Common Processing ..................................................................170
3.1.5.5.5.2 UserAllInformation ....................................................................171
3.1.5.5.6 SamrQueryInformationUser (Opnum 36) ...........................................172
3.1.5.6 Set Pattern..........................................................................................172
3.1.5.6.1 SamrSetInformationDomain (Opnum 9) ............................................173
3.1.5.6.1.1 DomainServerRoleInformation ....................................................174
3.1.5.6.1.2 DomainStateInformation............................................................174
3.1.5.6.1.3 DomainPasswordInformation ......................................................174
3.1.5.6.2 SamrSetInformationGroup (Opnum 21).............................................174
3.1.5.6.3 SamrSetInformationAlias (Opnum 29)...............................................175
3.1.5.6.4 SamrSetInformationUser2 (Opnum 58) .............................................176
3.1.5.6.4.1 Common Processing ..................................................................176
3.1.5.6.4.2 UserAllInformation (Common) ....................................................179
3.1.5.6.4.3 UserAllInformation ....................................................................180
3.1.5.6.4.4 UserInternal4Information ...........................................................181
3.1.5.6.4.5 UserInternal4InformationNew .....................................................181
3.1.5.6.5 SamrSetInformationUser (Opnum 37) ...............................................181
3.1.5.7 Delete Pattern .....................................................................................182
3.1.5.7.1 SamrDeleteGroup (Opnum 23) .........................................................182
3.1.5.7.2 SamrDeleteAlias (Opnum 30) ...........................................................183
3.1.5.7.3 SamrDeleteUser (Opnum 35) ...........................................................183
3.1.5.8 Membership Pattern .............................................................................184
3.1.5.8.1 SamrAddMemberToGroup (Opnum 22) ..............................................184
3.1.5.8.2 SamrRemoveMemberFromGroup (Opnum 24) ....................................185
3.1.5.8.3 SamrGetMembersInGroup (Opnum 25) .............................................186
3.1.5.8.4 SamrAddMemberToAlias (Opnum 31) ................................................186
3.1.5.8.5 SamrRemoveMemberFromAlias (Opnum 32) ......................................187
3.1.5.8.6 SamrGetMembersInAlias (Opnum 33) ...............................................188
3.1.5.8.7 SamrRemoveMemberFromForeignDomain (Opnum 45) .......................188
3.1.5.8.8 SamrAddMultipleMembersToAlias (Opnum 52) ...................................189
3.1.5.8.9 SamrRemoveMultipleMembersFromAlias (Opnum 53) ..........................189
8 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.5.9 Membership-Of Pattern .........................................................................189
3.1.5.9.1 SamrGetGroupsForUser (Opnum 39).................................................190
3.1.5.9.2 SamrGetAliasMembership (Opnum 16) ..............................................190
3.1.5.10 Change Password Pattern ......................................................................191
3.1.5.10.1 SamrChangePasswordUser (Opnum 38) ............................................192
3.1.5.10.2 SamrOemChangePasswordUser2 (Opnum 54) ....................................195
3.1.5.10.3 SamrUnicodeChangePasswordUser2 (Opnum 55) ...............................196
3.1.5.11 Lookup Pattern ....................................................................................197
3.1.5.11.1 SamrLookupDomainInSamServer (Opnum 5) .....................................198
3.1.5.11.2 SamrLookupNamesInDomain (Opnum 17) .........................................198
3.1.5.11.3 SamrLookupIdsInDomain (Opnum 18) ..............................................200
3.1.5.12 Security Pattern ...................................................................................201
3.1.5.12.1 SamrSetSecurityObject (Opnum 2) ...................................................202
3.1.5.12.1.1 SamrSetSecurityObject (DC Configuration) ..................................203
3.1.5.12.1.2 SamrSetSecurityObject (Non-DC Configuration) ...........................204
3.1.5.12.2 SamrQuerySecurityObject (Opnum 3) ...............................................205
3.1.5.12.2.1 SamrQuerySecurityObject (DC Configuration) ..............................206
3.1.5.12.2.2 SamrQuerySecurityObject (Non-DC Configuration) ........................208
3.1.5.13 Miscellaneous ......................................................................................209
3.1.5.13.1 SamrCloseHandle (Opnum 1) ...........................................................209
3.1.5.13.2 SamrSetMemberAttributesOfGroup (Opnum 26) .................................210
3.1.5.13.3 SamrGetUserDomainPasswordInformation (Opnum 44) .......................210
3.1.5.13.4 SamrGetDomainPasswordInformation (Opnum 56) .............................211
3.1.5.13.5 SamrRidToSid (Opnum 65) ..............................................................211
3.1.5.13.6 SamrSetDSRMPassword (Opnum 66) ................................................212
3.1.5.13.7 SamrValidatePassword (Opnum 67) ..................................................213
3.1.5.13.7.1 SamValidateAuthentication ........................................................214
3.1.5.13.7.2 SamValidatePasswordChange .....................................................215
3.1.5.13.7.3 SamValidatePasswordReset ........................................................217
3.1.5.14 Supplemental Message Processing .........................................................218
3.1.5.14.1 distinguishedName Generation .........................................................218
3.1.5.14.2 userAccountControl Mapping Table ...................................................219
3.1.5.14.3 PasswordCanChange Generation ......................................................220
3.1.5.14.4 PasswordMustChange Generation .....................................................220
3.1.5.14.5 Account Lockout Enforcement and Reset ...........................................220
3.1.5.14.6 Account Lockout State Maintenance ..................................................220
3.1.5.14.7 Attributes Field Handling .................................................................221
3.1.5.14.8 Domain Field to Attribute Name Mapping ...........................................221
3.1.5.14.9 Group Field to Attribute Name Mapping .............................................222
3.1.5.14.10 Alias Field to Attribute Name Mapping ...............................................222
3.1.5.14.11 User Field to Attribute Name Mapping ...............................................223
3.1.6 Timer Events .............................................................................................224
3.1.7 Other Local Events .....................................................................................224
3.1.7.1 Domain Join Processing ........................................................................224
3.1.7.2 Domain Unjoin Processing .....................................................................225
3.2 Client Details ..................................................................................................225
3.2.1 Abstract Data Model ...................................................................................225
3.2.2 Security Model ..........................................................................................225
3.2.2.1 RC4 Cipher Usage ................................................................................225
3.2.2.2 MD5 Usage..........................................................................................225
3.2.2.3 Acquiring an SMB Session Key ...............................................................226
3.2.3 Timers .....................................................................................................226
3.2.4 Initialization ..............................................................................................226
3.2.5 Message Processing Events and Sequencing Rules .........................................226
3.2.6 Timer Events .............................................................................................226
3.2.7 Other Local Events .....................................................................................227
4 Protocol Examples ............................................................................................... 228
9 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4.1 Creating a User Account ...................................................................................228
4.2 Enabling a User Account ..................................................................................230
4.3 Encrypting an NT or LM Hash ............................................................................232
5 Security ............................................................................................................... 235
5.1 Security Considerations for Implementers ..........................................................235
5.2 Index of Security Parameters ...........................................................................235
6 Appendix A: Full IDL ............................................................................................ 236
7 Appendix B: Product Behavior ............................................................................. 257
8 Change Tracking .................................................................................................. 271
9 Index ................................................................................................................... 272
10 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1 Introduction
The Security Account Manager (SAM) Remote Protocol (Client-to-Server) provides management
functionality for an account store or directory containing users and groups. Users should familiarize
themselves with the following documents: Windows System Overview [MS-SYS-ARCHIVE], Windows
Protocols Overview [MS-WPO], and Active Directory Technical Specification [MS-ADTS].
This protocol exposes the "account database" referred to in [MS-AUTHSOD] section 1.1.1.5, both for
local and remote domains. This document specifies the behavior for local and remote domains by
having a common data model for both scenarios: the Active Directory data model, as specified in
[MS-ADTS]. In addition, this document specifies the differences in behavior between these scenarios
when necessary.
Sections 1.5, 1.8, 1.9, 2, and 3 of this specification are normative. All other sections and examples in
this specification are informative.
1.1 Glossary
access check: A verification to determine whether a specific access type is allowed by checking a
security context against a security descriptor.
access control entry (ACE): An entry in an access control list (ACL) that contains a set of user
rights and a security identifier (SID) that identifies a principal for whom the rights are
allowed, denied, or audited.
access mask: A 32-bit value present in an access control entry (ACE) that specifies the allowed
or denied rights to manipulate an object.
account: A user (including machine account), group, or alias object. Also a synonym for security
principal or principal.
account domain object (account domain): A domain object that represents an issuing
authority in which user objects can be created. For more information about the concept of an
issuing authority, see [MS-AUTHSOD] section 1.1.1.5.
account domain security identifier: The security identifier (SID) of the account domain
object.
account group: A group object whose members always include the security identifier (SID) of
the group in the authorization context.
ACID: A term that refers to the four properties that any database system must achieve in order to
be considered transactional: Atomicity, Consistency, Isolation, and Durability [GRAY].
Active Directory: The Windows implementation of a general-purpose directory service, which uses
LDAP as its primary access protocol. Active Directory stores information about a variety of
objects in the network such as user accounts, computer accounts, groups, and all related
credential information used by Kerberos [MS-KILE]. Active Directory is either deployed as
Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services
(AD LDS), which are both described in [MS-ADOD]: Active Directory Protocols Overview.
11 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
administrator: A user who has complete and unrestricted access to the computer or domain.
authorization context: The set of identities for groups and the identity of the user made available
to a server for the purpose of determining authorization to a resource.
built-in domain: The security identifier (SID) namespace defined by the fixed SID S-1-5-32.
Contains groups that define roles on a local machine such as Backup Operators.
control access right: An extended access right that can be granted or denied on an access
control list (ACL).
database object: A representation of a named set of attribute value pairs that a protocol exposes.
delta time: A negative FILETIME. It represents a period of time, expressed in a negative number
of 100-nanosecond time slices. For example, a period of 20 minutes is represented as -
12000000000.
discretionary access control list (DACL): An access control list (ACL) that is controlled by the
owner of an object and that specifies the access particular users or groups can have to the
object.
domain: A set of users and computers sharing a common namespace and management
infrastructure. At least one computer member of the set must act as a domain controller (DC)
and host a member list that identifies all members of the domain, as well as optionally hosting
the Active Directory service. The domain controller provides authentication of members,
creating a unit of trust for its members. Each domain has an identifier that is shared among its
members. For more information, see [MS-AUTHSOD] section 1.1.1.5 and [MS-ADTS].
domain admins: A group with a security identifier (SID) with the relative ID value of 512 in
the account domain.
domain controller (DC): The service, running on a server, that implements Active Directory, or
the server hosting this service. The service hosts the data store for objects and interoperates
with other DCs to ensure that a local change to an object replicates correctly across all DCs.
When Active Directory is operating as Active Directory Domain Services (AD DS), the DC
contains full NC replicas of the configuration naming context (config NC), schema naming
context (schema NC), and one of the domain NCs in its forest. If the AD DS DC is a global
catalog server (GC server), it contains partial NC replicas of the remaining domain NCs in its
forest. For more information, see [MS-AUTHSOD] section 1.1.1.5.2 and [MS-ADTS]. When
Active Directory is operating as Active Directory Lightweight Directory Services (AD LDS),
several AD LDS DCs can run on one server. When Active Directory is operating as AD DS, only
one AD DS DC can run on one server. However, several AD LDS DCs can coexist with one AD
DS DC on one server. The AD LDS DC contains full NC replicas of the config NC and the schema
NC in its forest. The domain controller is the server side of Authentication Protocol Domain
Support [MS-APDS].
domain functional level: A specification of functionality available in a domain. Must be less than
or equal to the DC functional level of every domain controller (DC) that hosts a replica of the
domain's naming context (NC). For information on defined levels, corresponding features,
information on how the domain functional level is determined, and supported domain
controllers, see [MS-ADTS] sections 6.1.4.2 and 6.1.4.3. When Active Directory is operating
as Active Directory Lightweight Directory Services (AD LDS), domain functional level does not
exist.
12 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
domain object: A unit of data storage in a domain that is maintained and made available to
domain members by a domain controller (DC).
domain prefix: A security identifier (SID) of a domain without the relative identifier (RID)
portion. The domain prefix refers to the issuing authority SID. For example, the domain prefix
of S-1-5-21-397955417-626881126-188441444-1010 is S-1-5-21-397955417-626881126-
188441444.
dsname: A tuple that contains between one and three identifiers for an object. The term dsname
does not stand for anything. The possible identifiers are the object's GUID (attribute
objectGuid), security identifier (SID) (attribute objectSid), and distinguished name (DN)
(attribute distinguishedName). A dsname can appear in a protocol message and as an attribute
value (for example, a value of an attribute with syntax Object(DS-DN)). Given a DSName, an
object can be identified within a set of NC replicas according to the matching rules defined in
[MS-DRSR] section 5.49.
forest: In the Active Directory directory service, a forest is a set of naming contexts (NCs)
consisting of one schema NC, one config NC, and one or more domain NCs. Because a set of
NCs can be arranged into a tree structure, a forest is also a set of one or several trees of NCs.
fully qualified domain name (FQDN): In Active Directory, a fully qualified domain name
(FQDN) that identifies a domain.
globally unique identifier (GUID): A term used interchangeably with universally unique
identifier (UUID) in Microsoft protocol technical documents (TDs). Interchanging the usage of
these terms does not imply or require a specific algorithm or mechanism to generate the value.
Specifically, the use of this term does not imply or require that the algorithms described in
[RFC4122] or [C706] must be used for generating the GUID. See also universally unique
identifier (UUID).
group object: In Active Directory, a group object has an object class group. A group has a
forward link attribute member; the values of this attribute either represent elements of the
group (for example, objects of class user or computer) or subsets of the group (objects of class
group). The representation of group subsets is called "nested group membership". The back link
attribute memberOf enables navigation from group members to the groups containing them.
Some groups represent groups of security principals and some do not and are, for instance,
used to represent email distribution lists.
machine account: An account that is associated with individual client or server machines in an
Active Directory domain.
mixed mode: A state of an Active Directory domain that supports domain controllers (DCs)
running Windows NT Server 4.0 operating system. Mixed mode does not allow organizations to
take advantage of new Active Directory features such as universal groups, nested group
membership, and interdomain group membership. See also native mode.
native mode: A state of an Active Directory domain in which all current and future domain
controllers (DCs) use AD style domains. Native mode allows organizations to take advantage
of the new Active Directory features such as universal groups, nested group membership, and
interdomain group membership.
Network Data Representation (NDR): A specification that defines a mapping from Interface
Definition Language (IDL) data types onto octet streams. NDR also refers to the runtime
environment that implements the mapping facilities (for example, data provided to NDR). For
more information, see [MS-RPCE] and [C706] section 14.
13 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
NT hash: An MD4- or MD5-based cryptographic hash of a clear text password. For more
information, see [MS-NLMP] section 3.3.1 (NTOWFv1, NTLM v1 Authentication), for a normative
definition.
original equipment manufacturer (OEM) code page: A code page used to translate between
non-Unicode encoded strings and UTF-16 encoded strings.
primary domain controller (PDC): A domain controller (DC) designated to track changes
made to the accounts of all computers on a domain. It is the only computer to receive these
changes directly, and is specialized so as to ensure consistency and to eliminate the potential for
conflicting entries in the Active Directory database. A domain has only one PDC.
RC4: A variable key-length symmetric encryption algorithm. For more information, see
[SCHNEIER] section 17.1.
read-only domain controller (RODC): A domain controller (DC) that does not accept
originating updates. Additionally, an RODC does not perform outbound replication. An RODC
cannot be the primary domain controller (PDC) for its domain.
relative distinguished name (RDN): The name of an object relative to its parent. This is the
leftmost attribute-value pair in the distinguished name (DN) of an object. For example, in the
DN "cn=Peter Houston, ou=NTDEV, dc=microsoft, dc=com", the RDN is "cn=Peter Houston".
For more information, see [RFC2251].
relative identifier (RID): The last item in the series of SubAuthority values in a security
identifier (SID) [SIDD]. It distinguishes one account or group from all other accounts and
groups in the domain. No two accounts or groups in any domain share the same RID.
resource group: A group object whose membership is added to the authorization context only if
the server receiving the context is a member of the same domain as the resource group.
RPC transfer syntax: A method for encoding messages defined in an Interface Definition
Language (IDL) file. Remote procedure call (RPC) can support different encoding methods or
transfer syntaxes. For more information, see [C706].
salt: A value consisting of random bits used to increase the complexity of dictionary attacks
against secret data that is protected through cryptographic means. For details, see [MENEZES]
section 10.2.1.
security descriptor: A data structure containing the security information associated with a
securable object. A security descriptor identifies an object's owner by its security identifier
(SID). If access control is configured for the object, its security descriptor contains a
discretionary access control list (DACL) with SIDs for the security principals who are
allowed or denied access. Applications use this structure to set and query an object's security
status. The security descriptor is used to guard access to an object as well as to control which
type of auditing takes place when the object is accessed. The security descriptor format is
specified in [MS-DTYP] section 2.4.6; a string representation of security descriptors, called
SDDL, is specified in [MS-DTYP] section 2.5.1.
security identifier (SID): An identifier for security principals that is used to identify an account
or a group. Conceptually, the SID is composed of an account authority portion (typically a
domain) and a smaller integer representing an identity relative to the account authority,
termed the relative identifier (RID). The SID format is specified in [MS-DTYP] section 2.4.2;
a string representation of SIDs is specified in [MS-DTYP] section 2.4.2 and [MS-AZOD] section
1.1.1.2.
security principal: A unique entity, also referred to as a principal, that can be authenticated by
Active Directory. It frequently corresponds to a human user, but also can be a service that
offers a resource to other security principals. Other security principals might be a group, which
is a set of principals. Groups are supported by Active Directory.
14 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
server object: The database object in the account domain with an object class of samServer.
system access control list (SACL): An access control list (ACL) that controls the generation of
audit messages for attempts to access a securable object. The ability to get or set an object's
SACL is controlled by a privilege typically held only by system administrators.
UAS Compatibility: A configuration mode that affects protocol behavior constraints specified in
this document. "UAS" is an acronym for "User Account Security (Database)" and refers to
products that are no longer supported, such as Microsoft NT LAN Manager. The default setting in
Windows is "on".
universal group: An Active Directory group that allows user objects, global groups, and
universal groups from anywhere in the forest as members. A group object g is a universal
group if and only if GROUP_TYPE_UNIVERSAL_GROUP is present in g! groupType. A security-
enabled universal group is valid for inclusion within ACLs anywhere in the forest. If a domain is
in mixed mode, then a universal group cannot be created in that domain. See also domain
local group, security-enabled group.
universally unique identifier (UUID): A 128-bit value. UUIDs can be used for multiple
purposes, from tagging objects with an extremely short lifetime, to reliably identifying very
persistent objects in cross-process communication such as client and server interfaces, manager
entry-point vectors, and RPC objects. UUIDs are highly likely to be unique. UUIDs are also
known as globally unique identifiers (GUIDs) and these terms are used interchangeably in
the Microsoft protocol technical documents (TDs). Interchanging the usage of these terms does
not imply or require a specific algorithm or mechanism to generate the UUID. Specifically, the
use of this term does not imply or require that the algorithms described in [RFC4122] or [C706]
must be used for generating the UUID.
user object: An object of class user. A user object is a security principal object; the principal is a
person or service entity running on the computer. The shared secret allows the person or
service entity to authenticate itself, as described in ([MS-AUTHSOD] section 1.1.1.1).
user profile: A collection of attributes on a user object used to customize an end-user experience.
MAY, SHOULD, MUST, SHOULD NOT, MUST NOT: These terms (in all caps) are used as defined
in [RFC2119]. All statements of optional behavior use either MAY, SHOULD, or SHOULD NOT.
1.2 References
Links to a document in the Microsoft Open Specifications library point to the correct section in the
most recently published version of the referenced document. However, because individual documents
in the library are not updated at the same time, the section numbers in the documents may not
match. You can confirm the correct section numbering by checking the Errata.
We conduct frequent surveys of the normative references to assure their continued availability. If you
have any issue with finding a normative reference, please contact [email protected]. We will
assist you in finding the relevant information.
[C706] The Open Group, "DCE 1.1: Remote Procedure Call", C706, August 1997,
https://www2.opengroup.org/ogsys/catalog/c706
[E164] ITU-T, "The International Public Telecommunication Numbering Plan", Recommendation E.164,
February 2005, http://www.itu.int/rec/T-REC-E.164/e
15 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Note There is a charge to download the specification.
[FIPS46-2] FIPS PUBS, "Data Encryption Standard (DES)", FIPS PUB 46-2, December 1993,
http://my.fit.edu/~gmarin/CSE5636/FIPS46-2DES.htm
[GRAY] Gray, J., and Reuter, A., "Transaction Processing: Concepts and Techniques", The Morgan
Kaufmann Series in Data Management Systems, San Francisco: Morgan Kaufmann Publishers, 1992,
Hardcover ISBN: 9781558601901.
[MS-LSAD] Microsoft Corporation, "Local Security Authority (Domain Policy) Remote Protocol".
[MS-LSAT] Microsoft Corporation, "Local Security Authority (Translation Methods) Remote Protocol".
[MS-SMB2] Microsoft Corporation, "Server Message Block (SMB) Protocol Versions 2 and 3".
[MSKB-3072595] Microsoft Corporation, "Vulnerability in Active Directory service could allow denial of
service, September 2015", https://support.microsoft.com/en-us/kb/3072595
[MSKB-3149090] Microsoft Corporation, "MS16-047: Description of the security update for SAM and
LSAD remote protocols", April 2016, https://support.microsoft.com/en-us/kb/3149090
[RFC1123] Braden, R., "Requirements for Internet Hosts - Application and Support", RFC 1123,
October 1989, http://www.ietf.org/rfc/rfc1123.txt
[RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April 1992,
http://www.ietf.org/rfc/rfc1321.txt
16 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC
2119, March 1997, http://www.rfc-editor.org/rfc/rfc2119.txt
[RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., et al., "HTTP Authentication: Basic and Digest
Access Authentication", RFC 2617, June 1999, http://www.rfc-editor.org/rfc/rfc2617.txt
[RFC3961] Raeburn, K., "Encryption and Checksum Specifications for Kerberos 5", RFC 3961,
February 2005, http://www.ietf.org/rfc/rfc3961.txt
[RFC3962] Raeburn, K., "Advanced Encryption Standard (AES) Encryption for Kerberos 5", RFC 3962,
February 2005, http://www.ietf.org/rfc/rfc3962.txt
[RFC4120] Neuman, C., Yu, T., Hartman, S., and Raeburn, K., "The Kerberos Network Authentication
Service (V5)", RFC 4120, July 2005, https://www.rfc-editor.org/rfc/rfc4120.txt
[RFC4122] Leach, P., Mealling, M., and Salz, R., "A Universally Unique Identifier (UUID) URN
Namespace", RFC 4122, July 2005, http://www.rfc-editor.org/rfc/rfc4122.txt
[X501] ITU-T, "Information Technology - Open Systems Interconnection - The Directory: The Models",
Recommendation X.501, August 2005, http://www.itu.int/rec/T-REC-X.501-200508-S/en
[LAMPORT] Lamport, L., "Time, Clocks, and the Ordering of Events in a Distributed System", July
1978, http://portal.acm.org/citation.cfm?id=359563
[SCHNEIER] Schneier, B., "Applied Cryptography, Second Edition", John Wiley and Sons, 1996, ISBN:
0471117099, http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471117099.html
1.3 Overview
The goal of this protocol is to enable IT administrators and end users to manage users, groups, and
computers. IT administrators and their delegates generally have full access control to these entities,
and consequently can manage the entities' life cycles. End users are allowed to make changes to their
own data (in most cases, limited to just their passwords).
17 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol achieves its goal by enabling the creation, reading, updating, and deleting of security
principal information. These security principals could be in any account store. Windows implements
this protocol, for example, in a directory service (Active Directory) and in a computer-local security
account database. In this specification, normative differences in the protocol between these two cases
are indicated by referring to the configuration of the server as a "DC" or "non-DC" configuration,
respectively, where "DC" stands for domain controller (DC).
It is helpful to consider the following two perspectives when understanding and implementing this
protocol:
The object-based perspective shows that the protocol exposes five main object abstractions: a server
object, a domain object, a group object, an alias object (an "alias" being a type of group), and a
user object. A client obtains a "handle" (an RPC context handle) to one of these objects and then
performs one or more actions on the object.
The following is a brief listing of methods that operate on each of the respective object types.
Server Object:
SamrSetSecurityObject
SamrQuerySecurityObject
SamrEnumerateDomainsInSamServer
SamrOpenDomain
SamrLookupDomainInSamServer
SamrCloseHandle
Domain Object:
SamrSetSecurityObject
SamrQuerySecurityObject
SamrLookupNamesInDomain
SamrLookupIdsInDomain
SamrEnumerateGroupsInDomain
SamrEnumerateUsersInDomain
SamrEnumerateAliasesInDomain
SamrOpenGroup
SamrOpenAlias
SamrOpenUser
SamrQueryInformationDomain
SamrQueryInformationDomain2
18 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrCreateGroupInDomain
SamrCreateAliasInDomain
SamrCreateUserInDomain
SamrCreateUser2InDomain
SamrSetInformationDomain
SamrGetAliasMembership
SamrGetDisplayEnumerationIndex
SamrGetDisplayEnumerationIndex2
SamrQueryDisplayInformation
SamrQueryDisplayInformation2
SamrQueryDisplayInformation3
SamrCloseHandle
SamrRemoveMemberFromForeignDomain
SamrRidToSid
Group Object:
SamrSetSecurityObject
SamrQuerySecurityObject
SamrQueryInformationGroup
SamrSetInformationGroup
SamrDeleteGroup
SamrAddMemberToGroup
SamrRemoveMemberFromGroup
SamrGetMembersInGroup
SamrCloseHandle
SamrSetMemberAttributesOfGroup
SamrRidToSid
Alias Object:
SamrSetSecurityObject
SamrQuerySecurityObject
SamrQueryInformationAlias
SamrSetInformationAlias
SamrDeleteAlias
19 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrAddMemberToAlias
SamrRemoveMemberFromAlias
SamrGetMembersInAlias
SamrAddMultipleMembersToAlias
SamrRemoveMultipleMembersFromAlias
SamrRidToSid
User Object:
SamrSetSecurityObject
SamrQuerySecurityObject
SamrQueryInformationUser
SamrQueryInformationUser2
SamrSetInformationUser
SamrSetInformationUser2
SamrDeleteUser
SamrGetGroupsForUser
SamrChangePasswordUser
SamrGetUserDomainPasswordInformation
SamrCloseHandle
SamrRidToSid
For example, to set a policy that limits the minimum length of passwords to eight characters for all
users, a client opens a handle to a domain object and updates the minimum length password policy
setting via a parameter field called MinPasswordLength. The call sequence from the client appears as
follows (with the parameter information removed for brevity):
Step (a): Using the network address of a server that implements this protocol, a client makes a
SamrConnect5 request to obtain a handle to a server object. This server handle is necessary to obtain
a subsequent handle to a domain object.
Step (b): Using the handle returned from SamrConnect5, the client makes a SamrOpenDomain
request to obtain a handle to a domain object.
20 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Step (c): Using the handle returned from SamrOpenDomain, the client makes a
SamrSetInformationDomain request, setting the MinPasswordLength parameter field to eight.
Steps (d) and (e): The client closes the handles returned from SamrOpenDomain and SamrConnect5
by using SamrCloseHandle. These steps release server resources associated with the handle; the
order in which the handles are released is not important.
The method-based perspective is used to show a common set of operations for each object type. The
operations fall into patterns. A list of the patterns and associated methods, along with a description of
each pattern, is shown below.
Open Pattern
This pattern returns an RPC context handle that references a specific object type. A client uses this
pattern by specifying a specific access for the handle in the request, and using the returned handle
to call other methods that require the returned handle along with the associated access. For
example, calling the method SamrSetInformationDomain requires a domain handle that has been
opened with DOMAIN_WRITE_PASSWORD_PARAMS. For more information on the range of
accesses for a domain object, see section 2.2.1.4.
SamrConnect2, SamrConnect4, and SamrConnect5 are distinguished from the other methods in
this pattern in that they are the first methods that a client calls prior to a calling any other handle-
based methods.
SamrConnect5
SamrConnect4
SamrConnect2
SamrOpenDomain
SamrOpenGroup
SamrOpenAlias
SamrOpenUser
Enumerate Pattern
This pattern allows a client to obtain a complete list of all objects of a certain type (domain, group,
alias, or user).
SamrEnumerateDomainsInSamServer
SamrEnumerateGroupsInDomain
SamrEnumerateAliasesInDomain
SamrEnumerateUsersInDomain
21 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This pattern allows a client to obtain a partial list of objects based on the name of the objects.
These methods, for example, allow a client to obtain a bounded number of objects from a virtual
list of objects sorted alphabetically by name starting with a client-specified prefix, such as "Chr".
User interface programs use these methods to allow the end user to quickly find an object, given
partial knowledge of the object's name.
The methods that follow the selective enumerate pattern are as follows:
SamrQueryDisplayInformation3
SamrQueryDisplayInformation2
SamrQueryDisplayInformation
SamrGetDisplayEnumerationIndex2
SamrGetDisplayEnumerationIndex
Create Pattern
This pattern allows specified objects to be created. A handle to the newly created object is
returned.
SamrCreateGroupInDomain
SamrCreateAliasInDomain
SamrCreateUser2InDomain
SamrCreateUserInDomain
Query Pattern
This pattern allows specified attributes of an object to be returned. The client specifies which
attributes to return by using an "information level". The information level is an enumeration that
the server understands and translates into a specific structure to return; the structure contains the
attributes indicated by the information level.
To retrieve the name of a user, for example, a client specifies the "UserAccountNameInformation"
information level in the SamrQueryInformationUser method.
SamrQueryInformationDomain2
SamrQueryInformationDomain
SamrQueryInformationGroup
SamrQueryInformationAlias
SamrQueryInformationUser2
SamrQueryInformationUser
Set Pattern
This pattern allows specified object attributes to be set. The client indicates the attributes that are
to be updated by specifying an "information level". Similar to the query pattern of methods, the
information level specifies the attributes that are being sent in the request.
22 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The methods that follow the set pattern are as follows:
SamrSetInformationDomain
SamrSetInformationGroup
SamrSetInformationAlias
SamrSetInformationUser2
SamrSetInformationUser
Delete Pattern
SamrDeleteGroup
SamrDeleteAlias
SamrDeleteUser
Membership Pattern
This pattern allows a client to add to, remove from, or query the membership list for either a
group or an alias object.
SamrAddMemberToGroup
SamrRemoveMemberFromGroup
SamrAddMemberToAlias
SamrRemoveMemberFromAlias
SamrRemoveMemberFromForeignDomain
SamrGetMembersInGroup
SamrGetMembersInAlias
SamrAddMultipleMembersToAlias
SamrRemoveMultipleMembersFromAlias
Membership-Of Pattern
This pattern allows a client to obtain the groups or aliases that a user or collection of security
identifiers (SIDs) is a member of.
SamrGetGroupsForUser
SamrGetAliasMembership
23 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This pattern allows a client to change a password on a user object. The client provides the
current password and new password, and the server verifies that the client-presented current
password matches the server-persisted current password for the user. If there is a match, the new
password is persisted.
The methods that follow the change password pattern are as follows:
SamrChangePasswordUser
SamrOemChangePasswordUser2
SamrUnicodeChangePasswordUser2
Lookup Pattern
This pattern allows a client to translate between a relative identifier (RID) or SID, and a user-
friendly display name (the name of the object).
SamrLookupDomainInSamServer
SamrLookupNamesInDomain
SamrLookupIdsInDomain
Security Pattern
This pattern allows a client to specify or query access control with a granularity of individual
objects.
SamrSetSecurityObject
SamrQuerySecurityObject
Miscellaneous
The following methods do not fall into a general pattern; see the message processing sections for
details about each one. A brief description of each method follows:
SamrRidToSid: This method returns a SID given a RID returned by any of the methods in this
interface.<1>
SamrSetDSRMPassword: This method allows a client to set the password on a local account
(an account not stored in Active Directory) on a DC. This is useful for recovery scenarios
where Active Directory does not start.
SamrValidatePassword: This method allows applications that store passwords to validate the
strength of the passwords against the account domain policy.
24 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrSetMemberAttributesOfGroup: This method allows a server to configure extra
authorization information associated with a group membership. This method is ignored in DC
scenarios.
SamrCloseHandle: This method releases server resources associated with the RPC context
handle that is passed as a parameter.
This protocol depends on the RPC protocol because it uses RPC as a transport.
The server-side protocol relationships for non-domain controller and domain controller
configurations are illustrated in the following diagrams:
25 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Figure 2: Server-side protocol relationships for a domain controller configuration
In the DC configuration, the data manipulated by the server of this protocol is stored in Active
Directory and is therefore replicated by the replication protocol (described in [MS-DRSR]), made
available through the LDAP interface (see [MS-ADTS] section 3.1.1.3), and replicated by the
NETLOGON replication interface (as specified in [MS-NRPC]). The data manipulated by the server of
this protocol is used as a security principal database for authentication protocols such as NTLM [MS-
NLMP] and Kerberos [MS-KILE].
1.5 Prerequisites/Preconditions
An original equipment manufacturer (OEM) code page has to be configured in the server
implementation. This requirement enables the server to accept data that is encoded in an OEM code
page, as well as to return select results that are encoded in an OEM code page.
The client implementation must know the network address of the server. The network address must
satisfy the requirements of a network address for the underlying transport of RPC. When using RPC
over SMB, for example, the network address must be a network address that is compatible with the
Server Message Block (SMB) Protocol ([MS-SMB] or [MS-SMB2]), such as a NETBIOS name.
This protocol is useful for manipulating an account database consisting of users, groups, and other
security principals. This protocol can be used equally well for a database that is backed by a
distributed, replicated system, as well as a small, single-instance scenario, such as a single
machine.<2><3>
See the following product-behavior citation for a timeline of when each method was introduced.<4>
26 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1.7.2 Method Versioning
Clients determine whether a method is supported by attempting to invoke the method. If the
transport, RPC, returns the error RPC_S_PROCNUM_OUT_OF_RANGE (defined in section 2.2.1.16), the
client tries the deprecated equivalent of the invoked method if there is one. The following table
describes the deprecated method to invoke if the current method is not supported.<5>
SamrQueryInformationDomain2 SamrQueryInformationDomain
SamrCreateUser2InDomain SamrCreateUserInDomain
SamrQueryDisplayInformation3 SamrQueryDisplayInformation2
SamrQueryDisplayInformation
SamrGetDisplayEnumerationIndex2 SamrGetDisplayEnumerationIndex
SamrSetInformationUser2 SamrSetInformationUser
SamrConnect5 SamrConnect4
SamrConnect2
The set, query, and selective enumerate patterns of methods use information levels to communicate
the set of object attributes that are to be set or queried in the method request. Information levels are
enumerations (that is, numerical values).
It is possible that future versions of the protocol will introduce new information levels, creating a
situation in which a client can specify an information level that is not supported by the server. This
situation can occur, for example, when a later client communicates with an earlier server.<6>
None.
None.
27 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2 Messages
2.1 Transport
This protocol configures the RPC runtime to perform a strict Network Data Representation (NDR)
data consistency check at target level 5.0, as specified in [MS-RPCE] section 3.
This protocol enables the ms_union extension that is specified in [MS-RPCE] section 2.2.4.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles that are created by a method of a different RPC interface than this one, as specified in
[MS-RPCE] section 3.
This protocol uses the pipe name "\PIPE\samr" for the endpoint name.<9>
This protocol MUST indicate to the RPC runtime that it is to support both the Network Data
Representation (NDR) and 64-bit Network Data Representation (NDR64) transfer syntaxes and
provide a negotiation mechanism for determining which RPC transfer syntax will be used, as specified
in [MS-RPCE] section 3.
This protocol MUST use the UUID as specified previously. The RPC version number is 1.0.
The protocol uses the underlying RPC protocol to retrieve the identity of the client that made the
method call, as specified in [MS-RPCE] section 3.3.3.4.3. The server SHOULD use this identity to
perform method-specific access checks, as specified in the message processing section of each
method.<11>
The server SHOULD<12> reject calls that do not use an authentication level of either
RPC_C_AUTHN_LEVEL_NONE or RPC_C_AUTHN_LEVEL_PKT_PRIVACY (see [MS-RPCE] section
2.2.1.1.8).
RPC clients for this protocol MUST use RPC over TCP/IP for the SamrValidatePassword method and
MUST use RPC over SMB for the SamrSetDSRMPassword method.
RPC clients MUST use only RPC over SMB for the SamrSetInformationUser and
SamrSetInformationUser2 methods when UserInformationClass is UserAllInformation,
UserInternal1Information, UserInternal4Information, UserInternal4InformationNew,
UserInternal5Information, or UserInternal5InformationNew.
For the SamrValidatePassword method, the client SHOULD use transport security to encrypt the
message because the message contents contain cleartext password data. That is, the client SHOULD
use an SPNEGO security provider, as specified in [MS-RPCE] section 2.2.1.1.7, and SHOULD use the
packet authentication level, as specified in [MS-RPCE] section 3.3.1.5.2.<13>
In addition to RPC base types and definitions specified in [C706] and [MS-DTYP], additional data types
are defined in the following subsections.
28 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol MUST indicate to the RPC runtime that it is to support both the NDR and NDR64
transfer syntaxes, and provide a negotiation mechanism for determining which transfer syntax will be
used, as specified in [MS-RPCE] section 3.
This section is used as a reference from one or more message syntax and message processing
sections.
These values specify an access control that is applicable to all object types exposed by this protocol.
These values can appear in the Mask field of an access control entry (ACE) or in methods to obtain
a handle (for example, SamrConnect5).
Constant/value Description
WRITE_DAC Specifies the ability to update the discretionary access control list (DACL) of
0x00040000 the security descriptor.
WRITE_OWNER Specifies the ability to update the Owner field of the security descriptor.
0x00080000
ACCESS_SYSTEM_SECURITY Specifies access to the system security portion of the security descriptor.
0x01000000
MAXIMUM_ALLOWED Indicates that the caller is requesting the most access possible to the object.
0x02000000
For more information, see [MS-DTYP] section 2.4.3. Values that are not listed have no meaning in this
protocol.
These values appear in methods that are used to obtain a handle (for example, SamrConnect5). They
are translated by the server into specific ACCESS_MASK values. For more information on object-
specific semantics, see sections 2.2.1.3, 2.2.1.4, 2.2.1.5, 2.2.1.6, and 2.2.1.7.
Constant/value Description
GENERIC_WRITE Specifies access control suitable for updating attributes on the object.
0x40000000
GENERIC_EXECUTE Specifies access control suitable for executing an action on the object.
0x20000000
29 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
0x10000000
These are the specific values available to describe the access control on a server object. A bitwise OR
operation can be performed on these values, along with values from section 2.2.1.1. For more
information on the message processing of these values, see section 3.1.5.1.1.
Constant/value Description
These are the specific values available to describe the access control on a domain object. A bitwise
OR operation can be performed on these values, along with values from section 2.2.1.1. For more
information on the message processing of these values, see section 3.1.5.1.2.
Constant/value Description
30 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
These are the specific values available to describe the access control on a group object. A bitwise OR
operation can be performed on these values, along with values from section 2.2.1.1. For more
information on the message processing of these values, see section 3.1.5.1.6.
Constant/value Description
GROUP_WRITE_ACCOUNT Specifies the ability to write various attributes, not including the member
31 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
0x00000002 attribute.
GROUP_REMOVE_MEMBER Specifies the ability to remove a value from the member attribute.
0x00000008
GROUP_LIST_MEMBERS Specifies the ability to read the values of the member attribute.
0x00000010
These are the specific values available to describe the access control on an alias object. A bitwise OR
operation can be performed on these values, along with values from section 2.2.1.1. For more
information on the message processing of these values, see section 3.1.5.1.8.
Constant/value Description
ALIAS_REMOVE_MEMBER Specifies the ability to remove a value from the member attribute.
0x00000002
ALIAS_READ_INFORMATION Specifies the ability to read various attributes, not including the member
0x00000008 attribute.
ALIAS_WRITE_ACCOUNT Specifies the ability to write various attributes, not including the member
0x00000010 attribute.
32 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
These are the specific values available to describe the access control on a user object. A bitwise OR
operation can be performed on these values, along with values from section 2.2.1.1. For more
information on the message processing of these values, see section 3.1.5.1.9.
Constant/value Description
USER_READ_ACCOUNT Specifies the ability to read attributes related to the administration of the
0x00000010 user object.
USER_WRITE_ACCOUNT Specifies the ability to write attributes related to the administration of the
0x00000020 user object.
USER_LIST_GROUPS Specifies the ability to query the membership of the user object.
0x00000100
33 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
0x00020041
USER_ALL values are used in the WhichFields bit field in the SAMPR_USER_ALL_INFORMATION
structure. All bits can be combined with a logical OR in any combination that is in accordance with the
processing instructions specified in sections 3.1.5.6.5, 3.1.5.6.4, 3.1.5.5.6 and 3.1.5.5.5. If a bit is
set, the associated field of SAMPR_USER_ALL_INFORMATION MUST be processed by the server. If a
bit is not set, the server MUST ignore the associated field. The last column of the following table
indicates the bit-to-field association.
Constant/value Description
USER_ALL_USERNAME UserName
0x00000001
USER_ALL_FULLNAME FullName
0x00000002
USER_ALL_USERID UserId
0x00000004
USER_ALL_PRIMARYGROUPID PrimaryGroupId
0x00000008
USER_ALL_ADMINCOMMENT AdminComment
0x00000010
USER_ALL_USERCOMMENT UserComment
0x00000020
USER_ALL_HOMEDIRECTORY HomeDirectory
0x00000040
USER_ALL_HOMEDIRECTORYDRIVE HomeDirectoryDrive
0x00000080
USER_ALL_SCRIPTPATH ScriptPath
0x00000100
USER_ALL_PROFILEPATH ProfilePath
0x00000200
USER_ALL_WORKSTATIONS WorkStations
0x00000400
USER_ALL_LASTLOGON LastLogon
0x00000800
USER_ALL_LASTLOGOFF LastLogoff
0x00001000
USER_ALL_LOGONHOURS LogonHours
0x00002000
34 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
USER_ALL_BADPASSWORDCOUNT BadPasswordCount
0x00004000
USER_ALL_LOGONCOUNT LogonCount
0x00008000
USER_ALL_PASSWORDCANCHANGE PasswordCanChange
0x00010000
USER_ALL_PASSWORDMUSTCHANGE PasswordMustChange
0x00020000
USER_ALL_PASSWORDLASTSET PasswordLastSet
0x00040000
USER_ALL_ACCOUNTEXPIRES AccountExpires
0x00080000
USER_ALL_USERACCOUNTCONTROL UserAccountControl
0x00100000
USER_ALL_PARAMETERS Parameters
0x00200000
USER_ALL_COUNTRYCODE CountryCode
0x00400000
USER_ALL_CODEPAGE CodePage
0x00800000
USER_ALL_NTPASSWORDPRESENT NtPasswordPresent
0x01000000
USER_ALL_LMPASSWORDPRESENT LmPasswordPresent
0x02000000
USER_ALL_PRIVATEDATA PrivateData
0x04000000
USER_ALL_PASSWORDEXPIRED PasswordExpired
0x08000000
USER_ALL_SECURITYDESCRIPTOR SecurityDescriptor
0x10000000
Account type values are associated with accounts and indicate the type of account. These values are
not to be combined through logical operations.
35 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
SAM_NON_SECURITY_GROUP_OBJECT Represents a group object that is not used for authorization context
0x10000001 generation.
SAM_NON_SECURITY_ALIAS_OBJECT Represents an alias object that is not used for authorization context
0x20000001 generation.
These values are attributes of a security group membership and can be combined by using the bitwise
OR operation. They are used by an access check mechanism to specify whether the membership is to
be used in an access check decision. The values can be set by using the
SamrSetMemberAttributesOfGroup method.
Constant/value Description
SE_GROUP_ENABLED_BY_DEFAULT The SID is enabled by default (rather than being added by an application).
0x00000002
36 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.1.11 GROUP_TYPE Codes
These values specify the type of a group object. They are used in the groupType attribute. The
values are mutually exclusive, except for the GROUP_TYPE_SECURITY_ENABLED bit, which can be
combined using a logical OR with any other value.
Constant/value Description
GROUP_TYPE_SECURITY_ACCOUNT A combination of two of the bits shown above for the purposes of this
0x80000002 specification.
GROUP_TYPE_SECURITY_RESOURCE A combination of two of the bits shown above for the purposes of this
0x80000004 specification.
GROUP_TYPE_SECURITY_UNIVERSAL A combination of two of the bits shown above for the purposes of this
0x80000008 specification.
These values are attributes of a user account and can be combined by using a bitwise OR operation.
They are used in the UserAccountControl field for user objects. For more information, see section
2.2.7.1.
Constant/value Description
37 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
38 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.1.13 UF_FLAG Codes
These values are attributes of a user account, as expressed at the data model level (see section 3.1.1
for the data model). Unless otherwise specified in the table, see section 3.1.5.14.2 to map these
values to USER_ACCOUNT values, and then see section 2.2.1.12 for a description.
Constant/value Description
39 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Constant/value Description
These are predefined RIDs of users and groups. The description column briefly describes what the
user or group is used for.
Constant/value Description
40 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.1.15 STATUS_ Codes
These values are return status codes from the server. This section is provided as a reference for the
message processing sections in section 3.1.5.
Constant/value Description
STATUS_ACCOUNT_LOCKED_OUT Returned when the user account has been automatically locked
0xC0000234 because too many invalid logon attempts or password change
attempts have been requested.
STATUS_LM_CROSS_ENCRYPTION_REQUIRED Returned when the client is to retry the request using the
0xC000017F current password LM hash as an encryption key. See section
3.1.5.10.1 for details.
STATUS_NT_CROSS_ENCRYPTION_REQUIRED Returned when the client is to retry the request using the
0xC000015D current password NT hash as an encryption key. See section
3.1.5.10.1 for details.
41 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.1.17 AD ACCESS_MASK
These access mask values are specific to ACEs that apply to Active Directory objects. More
information about these values is specified in [MS-ADTS] section 5.1.3.
Constant/value Description
ACTRL_DS_LIST Indicates the ability to read the children of an object in Active Directory.
0x00000004
The following basic types are elementary to the SAM Remote Protocol (Client-to-Server) and are used
in many methods. These types also appear in other protocols.
The RPC_STRING structure holds a counted string encoded in the OEM code page.
Length: The size, in bytes, not including a terminating null character, of the string contained in
Buffer.
Buffer: A buffer containing a string encoded in the OEM code page. The string is counted (by the
Length member), and therefore is not null-terminated.
2.2.2.2 OLD_LARGE_INTEGER
The OLD_LARGE_INTEGER structure defines a 64-bit value that is accessible in two 4-byte chunks.
long HighPart;
42 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
} OLD_LARGE_INTEGER,
*POLD_LARGE_INTEGER;
2.2.2.3 SID_NAME_USE
The SID_NAME_USE enumeration specifies the type of account that a SID references.
SidTypeUnknown: Indicates that the type of object could not be determined. For example, no object
with that SID exists.
2.2.2.4 RPC_SHORT_BLOB
43 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Length: The number of bytes of data contained in the Buffer member.
These types are specific to the SAM Remote Protocol (Client-to-Server). Many types are used by
multiple methods, while others are used by only one method. This section is useful when used as a
reference while reading the method syntax in section 3.1.5.
2.2.3.1 PSAMPR_SERVER_NAME
2.2.3.2 SAMPR_HANDLE
An RPC context handle, as specified in [C706] section 6, that is used to share a session between
method calls.
For more information on this protocol's usage of RPC context handles, see section 3.1.1.10.
data: 16 bytes of unstructured data used to hold an encrypted 16-byte hash (either an LM hash or
an NT hash). The encryption algorithm is specified in section 2.2.11.1. The methods specified in
sections 3.1.5.10 and 3.1.5.13.6 use this structure and specify the type of hash and the
encryption key.
2.2.3.4 SAMPR_ULONG_ARRAY
44 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _SAMPR_ULONG_ARRAY {
unsigned long Count;
[size_is(Count)] unsigned long* Element;
} SAMPR_ULONG_ARRAY,
*PSAMPR_ULONG_ARRAY;
Count: The number of elements in Element. If zero, Element MUST be ignored. If nonzero,
Element MUST point to at least Count * sizeof(unsigned long) bytes of memory.
Element: A pointer to an array of unsigned integers with Count elements. The semantic meaning is
dependent on the method in which the structure is being used.
2.2.3.5 SAMPR_SID_INFORMATION
2.2.3.6 SAMPR_PSID_ARRAY
Count: The number of elements in Sids. If zero, Sids MUST be ignored. If nonzero, Sids MUST point
to at least Count * sizeof(SAMPR_SID_INFORMATION) bytes of memory.
Sids: An array of pointers to SID values. For more information, see section 2.2.3.5.
2.2.3.7 SAMPR_PSID_ARRAY_OUT
Count: The number of elements in Sids. If zero, Sids MUST be ignored. If nonzero, Sids MUST point
to at least Count * sizeof(SAMPR_SID_INFORMATION) bytes of memory.
Sids: An array of pointers to SID values. For more information, see section 2.2.3.5.
45 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.3.8 SAMPR_RETURNED_USTRING_ARRAY
Count: The number of elements in Element. If zero, Element MUST be ignored. If nonzero,
Element MUST point to at least Count * sizeof(RPC_UNICODE_STRING) bytes of memory.
Element: Array of counted strings (see RPC_UNICODE_STRING in [MS-DTYP] section 2.3.10). The
semantic meaning is method-dependent.
2.2.3.9 SAMPR_RID_ENUMERATION
The SAMPR_RID_ENUMERATION structure holds the name and RID information about an account.
RelativeId: A RID.
Name: The UTF-16 encoded name of the account that is associated with RelativeId.
2.2.3.10 SAMPR_ENUMERATION_BUFFER
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead * sizeof(SAMPR_RID_ENUMERATION) bytes of memory.
2.2.3.11 SAMPR_SR_SECURITY_DESCRIPTOR
46 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Length: The size, in bytes, of SecurityDescriptor. If zero, SecurityDescriptor MUST be ignored. The
maximum size of 256 * 1024 is an arbitrary value chosen to limit the amount of memory a client
can force the server to allocate.
2.2.3.12 GROUP_MEMBERSHIP
Attributes: Characteristics about the membership represented as a bitmask. Values are defined in
section 2.2.1.10.
2.2.3.13 SAMPR_GET_GROUPS_BUFFER
2.2.3.14 SAMPR_GET_MEMBERS_BUFFER
MemberCount: The number of elements in Members and Attributes. If zero, Members and
Attributes MUST be ignored. If nonzero, Members and Attributes MUST point to at least
MemberCount * sizeof(unsigned long) bytes of memory.
47 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Attributes: Characteristics about the membership, represented as a bitmask. Values are defined in
section 2.2.1.10.
2.2.3.15 SAMPR_REVISION_INFO_V1
Revision: The revision of the client or server side of this protocol (depending on which side sends the
structure). The value MUST be set to 3 and MUST be ignored.
SupportedFeatures: A bit field. When sent from the client, this field MUST be zero and ignored on
receipt by the server. When returned from the server, the following fields are handled by the
client; all other bits are ignored by the client and MUST be zero when returned from the server.
Value Meaning
0x00000001 On receipt by the client, this value, when set, indicates that RID values returned from the
server MUST NOT be concatenated with the domain SID to create the SID for the account
referenced by the RID. Instead, the client MUST call SamrRidToSid to obtain the SID. This
field can be combined with other bits using a logical OR.
See the product behavior citation at the end of this section for more information (about
Windows implementations).
0x00000002 Reserved. See the product behavior citation at the end of this section for additional details.
0x00000004 Reserved. See the product behavior citation at the end of this section for additional details.
2.2.3.16 SAMPR_REVISION_INFO
The SAMPR_REVISION_INFO union holds revision information structures that are used in the
SamrConnect5 method.
typedef
[switch_type(unsigned long)]
union {
[case(1)]
SAMPR_REVISION_INFO_V1 V1;
} SAMPR_REVISION_INFO,
*PSAMPR_REVISION_INFO;
2.2.3.17 USER_DOMAIN_PASSWORD_INFORMATION
48 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned long PasswordProperties;
} USER_DOMAIN_PASSWORD_INFORMATION,
*PUSER_DOMAIN_PASSWORD_INFORMATION;
SamrQueryInformationDomain
SamrQueryInformationDomain2
SamrSetInformationDomain
The model of the methods is for the client to specify an enumeration that indicates the attributes to be
either set or queried. There is duplication among the structures that contain the attributes. For a
description of each attribute that is common among structures, see section 2.2.4.1.
There are a number of domain-related structures that use the same fields, as denoted by their field
names. This section specifies all such fields. The structures group the available set of domain
attributes in different ways to allow the client to control which attributes are queried or set. Although
each structure can have a different subset of these attributes, they all draw from this same set of
attributes, detailed as follows.
AliasCount: A 32-bit unsigned integer indicating the number of alias objects in the domain. This
field is read-only.
CreationTime: A 64-bit time stamp, equivalent to a FILETIME, indicating the time of creation for the
domain in 100-nanosecond intervals from 12:00 A.M., January 1, 1601 (UTC). This field is read-
only.
ForceLogoff: A 64-bit value, with delta time syntax, indicating the policy setting for the amount of
time that an interactive logon session is allowed to continue.
GroupCount: A 32-bit unsigned integer indicating the number of group accounts. This field is read-
only.
49 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
LockoutDuration: A 64-bit value, with delta time syntax, indicating the duration for which an
account is locked out before being automatically reset to an unlocked state.
LockoutObservationWindow: A 64-bit value, with delta time syntax, indicating the time period in
which failed password attempts are counted without resetting the count to zero.
LockoutThreshold: A 16-bit unsigned integer indicating the number of bad password attempts within
a LockoutObservationWindow that will cause an account to be locked out.
MaxPasswordAge: A 64-bit value, with delta time syntax, indicating the policy setting for the
maximum time allowed before a password reset or change is required.
MinPasswordAge: A 64-bit value, with delta time syntax, indicating the policy setting for the
minimum time allowed before a password change operation is allowed.
MinPasswordLength: A 16-bit unsigned integer indicating the minimum password length policy
setting.
OemInformation: A counted Unicode string of type RPC_UNICODE_STRING that clients can set to
any value. There are no known scenarios that use this field.
PasswordHistoryLength: A 16-bit unsigned integer indicating the policy setting for the password
history length.
PasswordProperties: A 32-bit bit field indicating the password properties policy setting. The defined
bits are shown in the following table. All bits can be combined using a logical OR in any
combination. Undefined bits SHOULD be persisted by the server (that is, stored in its database)
and returned to future queries. Clients SHOULD ignore undefined bits.
Name/value Description
DOMAIN_PASSWORD_STORE_CLEARTEXT The server MUST store the cleartext password, not just the
0x00000010 computed hashes.
50 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
UasCompatibilityRequired: A 1-byte value that, if nonzero, indicates that UAS Compatibility
mode is effective; if zero, UAS Compatibility mode is not effective. This field is read-only and the
default value is nonzero.
UserCount: A 32-bit unsigned integer indicating the number of user accounts. This field is read-only.
2.2.4.2 DOMAIN_SERVER_ENABLE_STATE
2.2.4.3 DOMAIN_STATE_INFORMATION
2.2.4.4 DOMAIN_SERVER_ROLE
2.2.4.5 DOMAIN_PASSWORD_INFORMATION
51 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
OLD_LARGE_INTEGER MaxPasswordAge;
OLD_LARGE_INTEGER MinPasswordAge;
} DOMAIN_PASSWORD_INFORMATION,
*PDOMAIN_PASSWORD_INFORMATION;
2.2.4.6 DOMAIN_LOGOFF_INFORMATION
2.2.4.7 DOMAIN_SERVER_ROLE_INFORMATION
2.2.4.8 DOMAIN_MODIFIED_INFORMATION
2.2.4.9 DOMAIN_MODIFIED_INFORMATION2
52 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.4.10 SAMPR_DOMAIN_GENERAL_INFORMATION
Note In section 2.2.4.1, the types for the DomainServerState and DomainServerRole members
are the DOMAIN_SERVER_ENABLE_STATE and DOMAIN_SERVER_ROLE enumerations, respectively.
These fields have the same purpose as the enumeration values, but the data types are different. The
following tables show the corresponding mappings.
For DomainServerState:
DomainServerEnabled 1
DomainServerDisabled 2
For DomainServerRole:
DomainServerRoleBackup 2
DomainServerRolePrimary 3
2.2.4.11 SAMPR_DOMAIN_GENERAL_INFORMATION2
For information on each field, see section 2.2.4.1, except for I1, which is specified in section 2.2.4.10.
53 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.4.12 SAMPR_DOMAIN_OEM_INFORMATION
2.2.4.13 SAMPR_DOMAIN_NAME_INFORMATION
2.2.4.14 SAMPR_DOMAIN_REPLICATION_INFORMATION
2.2.4.15 SAMPR_DOMAIN_LOCKOUT_INFORMATION
2.2.4.16 DOMAIN_INFORMATION_CLASS
The DOMAIN_INFORMATION_CLASS enumeration indicates how to interpret the Buffer parameter for
SamrSetInformationDomain and SamrQueryInformationDomain. For a list of associated structures,
see section 2.2.4.17.
54 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DomainPasswordInformation = 1,
DomainGeneralInformation = 2,
DomainLogoffInformation = 3,
DomainOemInformation = 4,
DomainNameInformation = 5,
DomainReplicationInformation = 6,
DomainServerRoleInformation = 7,
DomainModifiedInformation = 8,
DomainStateInformation = 9,
DomainGeneralInformation2 = 11,
DomainLockoutInformation = 12,
DomainModifiedInformation2 = 13
} DOMAIN_INFORMATION_CLASS;
2.2.4.17 SAMPR_DOMAIN_INFO_BUFFER
typedef
[switch_type(DOMAIN_INFORMATION_CLASS)]
union _SAMPR_DOMAIN_INFO_BUFFER {
[case(DomainPasswordInformation)]
55 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DOMAIN_PASSWORD_INFORMATION Password;
[case(DomainGeneralInformation)]
SAMPR_DOMAIN_GENERAL_INFORMATION General;
[case(DomainLogoffInformation)]
DOMAIN_LOGOFF_INFORMATION Logoff;
[case(DomainOemInformation)]
SAMPR_DOMAIN_OEM_INFORMATION Oem;
[case(DomainNameInformation)]
SAMPR_DOMAIN_NAME_INFORMATION Name;
[case(DomainServerRoleInformation)]
DOMAIN_SERVER_ROLE_INFORMATION Role;
[case(DomainReplicationInformation)]
SAMPR_DOMAIN_REPLICATION_INFORMATION Replication;
[case(DomainModifiedInformation)]
DOMAIN_MODIFIED_INFORMATION Modified;
[case(DomainStateInformation)]
DOMAIN_STATE_INFORMATION State;
[case(DomainGeneralInformation2)]
SAMPR_DOMAIN_GENERAL_INFORMATION2 General2;
[case(DomainLockoutInformation)]
SAMPR_DOMAIN_LOCKOUT_INFORMATION Lockout;
[case(DomainModifiedInformation2)]
DOMAIN_MODIFIED_INFORMATION2 Modified2;
} SAMPR_DOMAIN_INFO_BUFFER,
*PSAMPR_DOMAIN_INFO_BUFFER;
The structures and fields in this section relate to the following methods:
SamrQueryInformationGroup
SamrSetInformationGroup
The model of the methods is for the client to specify an enumeration that indicates the attributes to be
either set or queried. There is duplication among the structures that contain the attributes. For a
description of each attribute that is common among structures, see section 2.2.5.1.
There are a number of group-related structures that use the same fields, as denoted by their field
names. This section specifies all such fields.
The structures group the available set of group attributes in different ways to allow the client to
control which attributes are queried or set. While each structure might have a different subset of these
attributes, they all draw from this same set of attributes, detailed as follows.
Attributes: A 32-bit bit field containing characteristics about a group; for possible values, see section
2.2.1.10.
MemberCount: A 32-bit unsigned integer indicating the number of members in the group object. This
field is read-only.
Name: A counted Unicode string of type RPC_UNICODE_STRING, indicating the name of the group
object.
56 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.5.2 GROUP_ATTRIBUTE_INFORMATION
2.2.5.3 SAMPR_GROUP_GENERAL_INFORMATION
2.2.5.4 SAMPR_GROUP_NAME_INFORMATION
2.2.5.5 SAMPR_GROUP_ADM_COMMENT_INFORMATION
2.2.5.6 GROUP_INFORMATION_CLASS
The GROUP_INFORMATION_CLASS enumeration indicates how to interpret the Buffer parameter for
SamrSetInformationGroup and SamrQueryInformationGroup. For a list of associated structures, see
section 2.2.5.7.
57 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
{
GroupGeneralInformation = 1,
GroupNameInformation,
GroupAttributeInformation,
GroupAdminCommentInformation,
GroupReplicationInformation
} GROUP_INFORMATION_CLASS;
2.2.5.7 SAMPR_GROUP_INFO_BUFFER
typedef
[switch_type(GROUP_INFORMATION_CLASS)]
union _SAMPR_GROUP_INFO_BUFFER {
[case(GroupGeneralInformation)]
SAMPR_GROUP_GENERAL_INFORMATION General;
[case(GroupNameInformation)]
SAMPR_GROUP_NAME_INFORMATION Name;
[case(GroupAttributeInformation)]
GROUP_ATTRIBUTE_INFORMATION Attribute;
[case(GroupAdminCommentInformation)]
SAMPR_GROUP_ADM_COMMENT_INFORMATION AdminComment;
[case(GroupReplicationInformation)]
SAMPR_GROUP_GENERAL_INFORMATION DoNotUse;
} SAMPR_GROUP_INFO_BUFFER,
*PSAMPR_GROUP_INFO_BUFFER;
As specified in section 3.1.5.5.3.1, the General field (instead of DoNotUse) MUST be used by the
server when GroupReplicationInformation is received. GroupReplicationInformation is not valid for
a set operation.
The structures and fields in this section relate to the following methods:
SamrQueryInformationAlias
SamrSetInformationAlias
58 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The model of the methods is for the client to specify an enumeration that indicates the attributes to be
either set or queried. There is duplication among the structures that contain the attributes. For a
description of each attribute that is common among structures, see section 2.2.6.1.
There are a number of alias-related structures that use the same fields, as denoted by their field
names. This section specifies all such fields.
The structures group the available set of alias attributes in different ways to allow the client to control
which attributes are queried or set. While each structure might have a different subset of these
attributes, they all draw from this same set of attributes, detailed as follows.
MemberCount: A 32-bit unsigned integer indicating the number of members in the alias object. This
field is read-only.
Name: A counted Unicode string of type RPC_UNICODE_STRING, indicating the name of the alias
object.
2.2.6.2 SAMPR_ALIAS_GENERAL_INFORMATION
2.2.6.3 SAMPR_ALIAS_NAME_INFORMATION
2.2.6.4 SAMPR_ALIAS_ADM_COMMENT_INFORMATION
59 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
For information on each field, see section 2.2.6.1.
2.2.6.5 ALIAS_INFORMATION_CLASS
The ALIAS_INFORMATION_CLASS enumeration indicates how to interpret the Buffer parameter for
SamrQueryInformationAlias and SamrSetInformationAlias. For a list of the structures associated with
each enumeration, see section 2.2.6.6.
2.2.6.6 SAMPR_ALIAS_INFO_BUFFER
typedef
[switch_type(ALIAS_INFORMATION_CLASS)]
union _SAMPR_ALIAS_INFO_BUFFER {
[case(AliasGeneralInformation)]
SAMPR_ALIAS_GENERAL_INFORMATION General;
[case(AliasNameInformation)]
SAMPR_ALIAS_NAME_INFORMATION Name;
[case(AliasAdminCommentInformation)]
SAMPR_ALIAS_ADM_COMMENT_INFORMATION AdminComment;
} SAMPR_ALIAS_INFO_BUFFER,
*PSAMPR_ALIAS_INFO_BUFFER;
The structures and fields in this section relate to the following methods:
SamrQueryInformationUser
SamrQueryInformationUser2
SamrSetInformationUser
SamrSetInformationUser2
The model of the methods is for the client to specify an enumeration that indicates the attributes to be
either set or queried. There is duplication among the structures that contain the attributes. For a
description of each attribute that is common among structures, see section 2.2.7.1.
60 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.7.1 Common User Fields
There are a number of user-related structures that use the same fields, as denoted by their field
names. This section specifies all such fields.
These structures group the available set of user attributes in different ways to allow the client greater
control over which attributes are queried or set. While each structure might have a different subset of
these attributes, they all draw from this same set of attributes, detailed as follows.
There are a number of fields that are of type "user profile information" (as indicated in their
descriptions). The server does not enforce any format restrictions on these values during an update.
These values are used by authentication protocols—Kerberos, for example, as specified in [MS-PAC]
section 2.5—to communicate end-user environment values to an interactive-logon application running
on a member workstation or server. For clarity, Windows behavior is cited in this section to describe
the expectations of such Windows interactive-logon applications with respect to these values. If no
Windows behavior is cited, there is no expectation of a specific format.
The mapping between the fields described below and the actual attributes in the database is defined in
section 3.1.5.14.11.
AccountExpires: A 64-bit value, equivalent to a FILETIME, indicating the time at which an account
is no longer permitted to log on.
BadPasswordCount: A 16-bit unsigned integer indicating the number of bad password attempts.
This field is read-only.
CodePage: A 16-bit unsigned integer indicating a code page preference specific to this user object.
The space of values is the Microsoft code page designation. For more information, see [MSDN-CP].
CountryCode: A 16-bit unsigned integer indicating a country preference specific to this user. The
space of values is the international country calling code, as specified in [E164]. For example, the
country code of the United Kingdom, in decimal notation, is 44.
FullName: A counted Unicode string of type RPC_UNICODE_STRING, indicating a free format string
for any name type (for example, "Akers, Kim").
LastLogoff: A 64-bit value, equivalent to a FILETIME, indicating the time at which the account last
logged off. This field is read-only.<17>
LastLogon: A 64-bit value, equivalent to a FILETIME, indicating the time at which the account last
logged on. This field is read-only.<18>
LogonCount: A 16-bit unsigned integer indicating the number of times that the user account has
been authenticated. This field is read-only.<19>
LogonHours: A binary value with the structure SAMPR_LOGON_HOURS, indicating a logon policy
describing the time periods during which the user can authenticate. This policy is specified in detail
in section 2.2.7.5.
Parameters: A binary value stored in the Buffer field of a RPC_UNICODE_STRING for per-user
application state. Per-user application state is any binary data that an application associates with a
user. However, because there is no requirement for the server of this protocol to enforce any
61 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
format, application developers are discouraged from using this mechanism in order to avoid the
chance of one application overwriting another application's data.
PasswordExpired: A 1-byte value. On receipt at the server, a nonzero value for this field indicates
that the password MUST be expired immediately (see
SamrSetInformationUser2 (section 3.1.5.6.4) for details). On receipt at the client, a nonzero value
for this field indicates that the password has expired; a value of zero indicates that the password
has not expired.
PasswordLastSet: A 64-bit value, equivalent to a FILETIME, indicating the time at which a password
was last updated. This field is read-only.
PrimaryGroupId: A 32-bit unsigned integer indicating the primary group ID of the user.
UserAccountControl: A 32-bit bit field specifying characteristics of the account. See section 2.2.1.12
for possible values.
UserId: A 32-bit unsigned integer representing the RID of the account. This field is read-only.
UserName: A counted Unicode string of type RPC_UNICODE_STRING containing the name of the
account.
2.2.7.2 USER_PRIMARY_GROUP_INFORMATION
2.2.7.3 USER_CONTROL_INFORMATION
62 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _USER_CONTROL_INFORMATION {
unsigned long UserAccountControl;
} USER_CONTROL_INFORMATION,
*PUSER_CONTROL_INFORMATION;
2.2.7.4 USER_EXPIRES_INFORMATION
2.2.7.5 SAMPR_LOGON_HOURS
The SAMPR_LOGON_HOURS structure contains logon policy information that describes when a user
account is permitted to authenticate.
UnitsPerWeek: A division of the week (7 days). For example, the value 7 means that each unit is a
day; a value of (7*24) means that the units are hours. The minimum granularity of time is one
minute, where the UnitsPerWeek would be 10080; therefore, the maximum size of LogonHours is
10080/8, or 1,260 bytes.
LogonHours: A pointer to a bit field containing at least UnitsPerWeek number of bits. The leftmost
bit represents the first unit, starting at Sunday, 12 A.M. If a bit is set, authentication is allowed to
occur; otherwise, authentication is not allowed to occur.
For example, if the UnitsPerWeek value is 168 (that is, the units per week is hours, resulting in a
21-byte bit field), and if the leftmost bit is set and the rightmost bit is set, the user is able to log
on for two consecutive hours between Saturday, 11 P.M. and Sunday, 1 A.M.
2.2.7.6 SAMPR_USER_ALL_INFORMATION
The SAMPR_USER_ALL_INFORMATION structure contains user attribute information. Most fields are
described in section 2.2.7.1. The exceptions are described below.
63 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
RPC_UNICODE_STRING FullName;
RPC_UNICODE_STRING HomeDirectory;
RPC_UNICODE_STRING HomeDirectoryDrive;
RPC_UNICODE_STRING ScriptPath;
RPC_UNICODE_STRING ProfilePath;
RPC_UNICODE_STRING AdminComment;
RPC_UNICODE_STRING WorkStations;
RPC_UNICODE_STRING UserComment;
RPC_UNICODE_STRING Parameters;
RPC_SHORT_BLOB LmOwfPassword;
RPC_SHORT_BLOB NtOwfPassword;
RPC_UNICODE_STRING PrivateData;
SAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor;
unsigned long UserId;
unsigned long PrimaryGroupId;
unsigned long UserAccountControl;
unsigned long WhichFields;
SAMPR_LOGON_HOURS LogonHours;
unsigned short BadPasswordCount;
unsigned short LogonCount;
unsigned short CountryCode;
unsigned short CodePage;
unsigned char LmPasswordPresent;
unsigned char NtPasswordPresent;
unsigned char PasswordExpired;
unsigned char PrivateDataSensitive;
} SAMPR_USER_ALL_INFORMATION,
*PSAMPR_USER_ALL_INFORMATION;
PrivateData: Not used. Ignored on receipt at the server and client. Clients MUST set to zero when
sent, and servers MUST set to zero on return.
SecurityDescriptor: Not used. Ignored on receipt at the server and client. Clients MUST set to zero
when sent, and servers MUST set to zero on return.
WhichFields: A 32-bit bit field indicating which fields within the SAMPR_USER_ALL_INFORMATION
structure will be processed by the server. Section 2.2.1.8 specifies the valid bits and also specifies
the structure field to which each bit corresponds.
Note If a given bit is set, the associated field MUST be processed; if a given bit is not set, then
the associated field MUST be ignored.
64 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.7.7 SAMPR_USER_GENERAL_INFORMATION
2.2.7.8 SAMPR_USER_PREFERENCES_INFORMATION
Reserved1: Ignored by the client and server and MUST be a zero-length string when sent and
returned.
2.2.7.9 SAMPR_USER_PARAMETERS_INFORMATION
2.2.7.10 SAMPR_USER_LOGON_INFORMATION
65 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
OLD_LARGE_INTEGER LastLogoff;
OLD_LARGE_INTEGER PasswordLastSet;
OLD_LARGE_INTEGER PasswordCanChange;
OLD_LARGE_INTEGER PasswordMustChange;
SAMPR_LOGON_HOURS LogonHours;
unsigned short BadPasswordCount;
unsigned short LogonCount;
unsigned long UserAccountControl;
} SAMPR_USER_LOGON_INFORMATION,
*PSAMPR_USER_LOGON_INFORMATION;
2.2.7.11 SAMPR_USER_ACCOUNT_INFORMATION
2.2.7.12 SAMPR_USER_A_NAME_INFORMATION
2.2.7.13 SAMPR_USER_F_NAME_INFORMATION
66 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
*PSAMPR_USER_F_NAME_INFORMATION;
2.2.7.14 SAMPR_USER_NAME_INFORMATION
2.2.7.15 SAMPR_USER_HOME_INFORMATION
2.2.7.16 SAMPR_USER_SCRIPT_INFORMATION
2.2.7.17 SAMPR_USER_PROFILE_INFORMATION
67 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.7.18 SAMPR_USER_ADMIN_COMMENT_INFORMATION
2.2.7.19 SAMPR_USER_WORKSTATIONS_INFORMATION
2.2.7.20 SAMPR_USER_LOGON_HOURS_INFORMATION
2.2.7.21 SAMPR_ENCRYPTED_USER_PASSWORD
Buffer: An array to carry encrypted cleartext password data. The encryption key is method-specific,
while the algorithm specified in section 3.2.2.1 is common for all methods that use this structure.
See the message syntax for SamrOemChangePasswordUser2 (section 3.1.5.10.2) and
SamrUnicodeChangePasswordUser2 (section 3.1.5.10.3), and the message processing for
SamrSetInformationUser2 (section 3.1.5.6.4), for details on the encryption key selection. The size
of (256 * 2) + 4 for Buffer is determined by the size of the structure that is encrypted,
SAMPR_USER_PASSWORD; see below for more details.
For all protocol uses, the decrypted format of Buffer is the following structure.
68 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned long Length;
} SAMPR_USER_PASSWORD, *PSAMPR_USER_PASSWORD;
Buffer: This array contains the cleartext value at the end of the buffer. The start of the string is
Length number of bytes from the end of the buffer. The cleartext value can be no more than 512
bytes. The unused portions of SAMPR_USER_PASSWORD.Buffer SHOULD be filled with random
bytes by the client. The value 512 is chosen because that is the longest password allowed by this
protocol (and enforced by the server).
Length: An unsigned integer, in little-endian byte order, that indicates the number of bytes of the
cleartext value located in SAMPR_USER_PASSWORD.Buffer.
2.2.7.22 SAMPR_ENCRYPTED_USER_PASSWORD_NEW
For all protocol uses, the decrypted format of Buffer is the following structure.
Buffer: This array contains the cleartext value at the end of the buffer. The cleartext value can be
no more than 512 bytes. The start of the string is Length number of bytes from the end of the
buffer. The unused portions of SAMPR_USER_PASSWORD_NEW.Buffer SHOULD be filled with
random bytes by the client.
Length: An unsigned integer, in little-endian byte order, that indicates the number of bytes of the
cleartext value (located in SAMPR_USER_PASSWORD_NEW.Buffer).
ClearSalt: This value (a salt) MUST be filled with random bytes by the client and MUST NOT be
encrypted. The length of 16 was chosen in particular because 128 bits of randomness was deemed
sufficiently secure when this protocol was introduced (circa 1998).
The first 516 bytes are defined as the first 516 bytes of the SAMPR_USER_PASSWORD_NEW structure
defined previously. The last 16 bytes of the SAMPR_ENCRYPTED_USER_PASSWORD_NEW structure
69 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
are defined as the last 16 bytes of the SAMPR_USER_PASSWORD_NEW structure and MUST NOT be
encrypted or decrypted.
2.2.7.23 SAMPR_USER_INTERNAL1_INFORMATION
EncryptedNtOwfPassword: An NT hash encrypted with the 16-byte SMB session key obtained as
specified in either section 3.1.2.3 or section 3.2.2.3.
EncryptedLmOwfPassword: An LM hash encrypted with the 16-byte SMB session key obtained as
specified in either section 3.1.2.3 or section 3.2.2.3.
2.2.7.24 SAMPR_USER_INTERNAL4_INFORMATION
2.2.7.25 SAMPR_USER_INTERNAL4_INFORMATION_NEW
70 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
*PSAMPR_USER_INTERNAL4_INFORMATION_NEW;
2.2.7.26 SAMPR_USER_INTERNAL5_INFORMATION
This structure is used to carry a new password for a particular account from the client to the server,
encrypted in a way that protects it from disclosure or tampering while in transit.
2.2.7.27 SAMPR_USER_INTERNAL5_INFORMATION_NEW
This structure is used to carry a new password for a particular account from the client to the server,
encrypted in a way that protects it from disclosure or tampering while in transit. A random value, a
salt, is used by the client to seed the encryption routine; see section 2.2.7.22 for details.
2.2.7.28 USER_INFORMATION_CLASS
The USER_INFORMATION_CLASS enumeration indicates how to interpret the Buffer parameter for
SamrSetInformationUser, SamrQueryInformationUser, SamrSetInformationUser2, and
SamrQueryInformationUser2. For a list of associated structures, see section 2.2.7.29.
71 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
UserGeneralInformation = 1,
UserPreferencesInformation = 2,
UserLogonInformation = 3,
UserLogonHoursInformation = 4,
UserAccountInformation = 5,
UserNameInformation = 6,
UserAccountNameInformation = 7,
UserFullNameInformation = 8,
UserPrimaryGroupInformation = 9,
UserHomeInformation = 10,
UserScriptInformation = 11,
UserProfileInformation = 12,
UserAdminCommentInformation = 13,
UserWorkStationsInformation = 14,
UserControlInformation = 16,
UserExpiresInformation = 17,
UserInternal1Information = 18,
UserParametersInformation = 20,
UserAllInformation = 21,
UserInternal4Information = 23,
UserInternal5Information = 24,
UserInternal4InformationNew = 25,
UserInternal5InformationNew = 26
} USER_INFORMATION_CLASS,
*PUSER_INFORMATION_CLASS;
72 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
UserAdminCommentInformation: Indicates the Buffer parameter is to be interpreted as a
SAMPR_USER_ADMIN_COMMENT_INFORMATION structure (see section 2.2.7.18).
2.2.7.29 SAMPR_USER_INFO_BUFFER
typedef
[switch_type(USER_INFORMATION_CLASS)]
union _SAMPR_USER_INFO_BUFFER {
[case(UserGeneralInformation)]
SAMPR_USER_GENERAL_INFORMATION General;
[case(UserPreferencesInformation)]
SAMPR_USER_PREFERENCES_INFORMATION Preferences;
[case(UserLogonInformation)]
SAMPR_USER_LOGON_INFORMATION Logon;
[case(UserLogonHoursInformation)]
SAMPR_USER_LOGON_HOURS_INFORMATION LogonHours;
[case(UserAccountInformation)]
SAMPR_USER_ACCOUNT_INFORMATION Account;
[case(UserNameInformation)]
SAMPR_USER_NAME_INFORMATION Name;
[case(UserAccountNameInformation)]
SAMPR_USER_A_NAME_INFORMATION AccountName;
[case(UserFullNameInformation)]
SAMPR_USER_F_NAME_INFORMATION FullName;
[case(UserPrimaryGroupInformation)]
USER_PRIMARY_GROUP_INFORMATION PrimaryGroup;
[case(UserHomeInformation)]
SAMPR_USER_HOME_INFORMATION Home;
73 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[case(UserScriptInformation)]
SAMPR_USER_SCRIPT_INFORMATION Script;
[case(UserProfileInformation)]
SAMPR_USER_PROFILE_INFORMATION Profile;
[case(UserAdminCommentInformation)]
SAMPR_USER_ADMIN_COMMENT_INFORMATION AdminComment;
[case(UserWorkStationsInformation)]
SAMPR_USER_WORKSTATIONS_INFORMATION WorkStations;
[case(UserControlInformation)]
USER_CONTROL_INFORMATION Control;
[case(UserExpiresInformation)]
USER_EXPIRES_INFORMATION Expires;
[case(UserInternal1Information)]
SAMPR_USER_INTERNAL1_INFORMATION Internal1;
[case(UserParametersInformation)]
SAMPR_USER_PARAMETERS_INFORMATION Parameters;
[case(UserAllInformation)]
SAMPR_USER_ALL_INFORMATION All;
[case(UserInternal4Information)]
SAMPR_USER_INTERNAL4_INFORMATION Internal4;
[case(UserInternal5Information)]
SAMPR_USER_INTERNAL5_INFORMATION Internal5;
[case(UserInternal4InformationNew)]
SAMPR_USER_INTERNAL4_INFORMATION_NEW Internal4New;
[case(UserInternal5InformationNew)]
SAMPR_USER_INTERNAL5_INFORMATION_NEW Internal5New;
} SAMPR_USER_INFO_BUFFER,
*PSAMPR_USER_INFO_BUFFER;
The structures and fields in this section relate to the following methods:
SamrQueryDisplayInformation3
SamrQueryDisplayInformation2
SamrQueryDisplayInformation
SamrGetDisplayEnumerationIndex2
SamrGetDisplayEnumerationIndex
The model of the methods is for the client to specify an enumeration that indicates the attributes that
are to be queried. There is duplication among the structures that contain the attributes. For a
description of each attribute that is common among structures, see section 2.2.8.1.
There are a number of selective enumerate–related structures that use the same fields, as denoted by
their field names. This section describes all such fields, and subsequent sections specify the fields in
protocol structures. While each structure might have a different subset of these attributes, they all
draw from this same set of attributes, detailed as follows.
When specified in a given structure, these fields all contain information about the same user or
machine account, or group. The selective enumerate methods return an array of structures, thereby
returning information about a set of users, machines, or groups.
74 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
AccountName: A counted Unicode string of type RPC_UNICODE_STRING. When this field is used with
a group object, it represents the Name field as described in section 2.2.5.1 (common group
fields). Otherwise, this field represents the UserName field as described in section 2.2.7.1
(common user fields).
AdminComment: A counted Unicode string of type RPC_UNICODE_STRING. When this field is used
with a group object, it represents the AdminComment field as described in section 2.2.5.1
(common group fields). Otherwise, this field represents the AdminComment field as described in
section 2.2.7.1 (common user fields).
Attributes: A 32-bit bit field representing the Attributes field, as described in section 2.2.5.1
(common group fields).
2.2.8.2 SAMPR_DOMAIN_DISPLAY_USER
2.2.8.3 SAMPR_DOMAIN_DISPLAY_MACHINE
2.2.8.4 SAMPR_DOMAIN_DISPLAY_GROUP
75 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned long Index;
unsigned long Rid;
unsigned long Attributes;
RPC_UNICODE_STRING AccountName;
RPC_UNICODE_STRING AdminComment;
} SAMPR_DOMAIN_DISPLAY_GROUP,
*PSAMPR_DOMAIN_DISPLAY_GROUP;
2.2.8.5 SAMPR_DOMAIN_DISPLAY_OEM_USER
2.2.8.6 SAMPR_DOMAIN_DISPLAY_OEM_GROUP
2.2.8.7 SAMPR_DOMAIN_DISPLAY_USER_BUFFER
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead number of elements.
76 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.8.8 SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead number of elements.
2.2.8.9 SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead number of elements.
2.2.8.10 SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead number of elements.
2.2.8.11 SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER
77 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER {
unsigned long EntriesRead;
[size_is(EntriesRead)] PSAMPR_DOMAIN_DISPLAY_OEM_GROUP Buffer;
} SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER,
*PSAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER;
EntriesRead: The number of elements in Buffer. If zero, Buffer MUST be ignored. If nonzero,
Buffer MUST point to at least EntriesRead number of elements.
2.2.8.12 DOMAIN_DISPLAY_INFORMATION
*PDOMAIN_DISPLAY_INFORMATION;
2.2.8.13 SAMPR_DISPLAY_INFO_BUFFER
typedef
[switch_type(DOMAIN_DISPLAY_INFORMATION)]
union _SAMPR_DISPLAY_INFO_BUFFER {
[case(DomainDisplayUser)]
SAMPR_DOMAIN_DISPLAY_USER_BUFFER UserInformation;
[case(DomainDisplayMachine)]
SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER MachineInformation;
[case(DomainDisplayGroup)]
SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER GroupInformation;
78 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[case(DomainDisplayOemUser)]
SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER OemUserInformation;
[case(DomainDisplayOemGroup)]
SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER OemGroupInformation;
} SAMPR_DISPLAY_INFO_BUFFER,
*PSAMPR_DISPLAY_INFO_BUFFER;
The following structures are used exclusively for the SamrValidatePassword method.
As stated in section 2.1, all structures SHOULD be encrypted by the client using transport layer
security to hide any cleartext data embedded in the structures.
The authentication, password change, and password reset structures (sections 2.2.9.5, 2.2.9.6, and
2.2.9.7) refer to a password-related operation that occurs in an application external to this protocol. A
canonical scenario is an application, such as Microsoft SQL Server, that might maintain its own
account database (independent of an operating system's account data) and might require that the
passwords of those accounts be subject to the same policy as the policy enforced by the server of this
protocol (such as Active Directory). Such an application uses the SamrValidatePassword method and
these structures to accomplish this goal. Said application is also responsible for storing, in whatever
manner it chooses, the SAM_VALIDATE_PERSISTED_FIELDS (section 2.2.9.2) structure returned by
SamrValidatePassword.
2.2.9.1 SAM_VALIDATE_PASSWORD_HASH
2.2.9.2 SAM_VALIDATE_PERSISTED_FIELDS
79 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
PresentFields: A bitmask to indicate which of the fields are valid. The following table shows the
defined values. If a bit is set, the corresponding field is valid; if a bit is not set, the field is not
valid.
Value Meaning
SAM_VALIDATE_PASSWORD_LAST_SET PasswordLastSet
0x00000001
SAM_VALIDATE_BAD_PASSWORD_TIME BadPasswordTime
0x00000002
SAM_VALIDATE_LOCKOUT_TIME LockoutTime
0x00000004
SAM_VALIDATE_BAD_PASSWORD_COUNT BadPasswordCount
0x00000008
SAM_VALIDATE_PASSWORD_HISTORY_LENGTH PasswordHistoryLength
0x00000010
SAM_VALIDATE_PASSWORD_HISTORY PasswordHistory
0x00000020
PasswordLastSet: This field represents the time at which the password was last reset or changed. It
uses FILETIME syntax.
BadPasswordTime: This field represents the time at which an invalid password was presented to
either a password change request or an authentication request. It uses FILETIME syntax.
LockoutTime: This field represents the time at which the owner of the password data was locked
out. It uses FILETIME syntax.
BadPasswordCount: Indicates how many invalid passwords have accumulated (see message
processing for details).
2.2.9.3 SAM_VALIDATE_VALIDATION_STATUS
80 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
*PSAM_VALIDATE_VALIDATION_STATUS;
See the message processing of SamrValidatePassword (section 3.1.5.13.7) for the semantic meanings
of the enumeration values.
2.2.9.4 SAM_VALIDATE_STANDARD_OUTPUT_ARG
ChangedPersistedFields: The password state that has changed. See section 2.2.9.2.
2.2.9.5 SAM_VALIDATE_AUTHENTICATION_INPUT_ARG
PasswordMatched: A nonzero value indicates that a valid password was presented to the change-
password request.
81 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.9.6 SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG
HashedPassword: A binary value containing a hashed form of the value contained in the
ClearPassword field. The structure of this binary value is specified in section 2.2.9.1. The hash
function used to generate this value is chosen by the client. An example hash function might be
MD5 (as specified in [RFC1321]). The server implementation is independent of that choice; that is,
through this protocol, the server is exposed to a sequence of bytes formatted per section 2.2.9.1
and is, therefore, not exposed to the hash function chosen by the client. Furthermore, there is no
processing by the server that requires knowledge of the specific hash function chosen. Section
2.2.9 contains more information about a scenario in which this field is used.
PasswordMatch: A nonzero value indicates that a valid password was presented to the change-
password request.
2.2.9.7 SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG
UserAccountName: The application-specific logon name of the account performing the reset-
password operation.
82 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
PasswordMustChangeAtNextLogon: Nonzero indicates that a password change MUST occur before
an authentication request can succeed.
2.2.9.8 PASSWORD_POLICY_VALIDATION_TYPE
2.2.9.9 SAM_VALIDATE_INPUT_ARG
typedef
[switch_type(PASSWORD_POLICY_VALIDATION_TYPE)]
union _SAM_VALIDATE_INPUT_ARG {
[case(SamValidateAuthentication)]
SAM_VALIDATE_AUTHENTICATION_INPUT_ARG ValidateAuthenticationInput;
[case(SamValidatePasswordChange)]
SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG ValidatePasswordChangeInput;
[case(SamValidatePasswordReset)]
SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG ValidatePasswordResetInput;
} SAM_VALIDATE_INPUT_ARG,
*PSAM_VALIDATE_INPUT_ARG;
2.2.9.10 SAM_VALIDATE_OUTPUT_ARG
typedef
[switch_type(PASSWORD_POLICY_VALIDATION_TYPE)]
union _SAM_VALIDATE_OUTPUT_ARG {
[case(SamValidateAuthentication)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidateAuthenticationOutput;
[case(SamValidatePasswordChange)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidatePasswordChangeOutput;
[case(SamValidatePasswordReset)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidatePasswordResetOutput;
83 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
} SAM_VALIDATE_OUTPUT_ARG,
*PSAM_VALIDATE_OUTPUT_ARG;
These structures define the format of the supplementalCredentials attribute in Active Directory
that the server of this protocol updates in the DC configuration. The structures are not part of the SAM
Remote Protocol (Client-to-Server) but are listed here in normative detail because the persisted value
(in the supplementalCredentials attribute) is replicated in Active Directory. See section 3.1.1.8.11
for details on how this attribute is updated.
2.2.10.1 USER_PROPERTIES
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Reserved1
Length
Reserved2 Reserved3
...
...
UserProperties (variable)
...
Reserved5
Reserved1 (4 bytes): This value MUST be set to zero and MUST be ignored by the recipient.
Length (4 bytes): This value MUST be set to the length, in bytes, of the entire structure, starting
from the Reserved4 field.
Reserved2 (2 bytes): This value MUST be set to zero and MUST be ignored by the recipient.
Reserved3 (2 bytes): This value MUST be set to zero and MUST be ignored by the recipient.
Reserved4 (96 bytes): This value MUST be ignored by the recipient and MAY<20> contain arbitrary
values.
84 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
PropertySignature (2 bytes): This field MUST be the value 0x50, in little-endian byte order. This is
an arbitrary value used to indicate whether the structure is corrupt. That is, if this value is not
0x50 on read, the structure is considered corrupt, processing MUST be aborted, and an error code
MUST be returned.
Reserved5 (1 byte): This value SHOULD<21> be set to zero and MUST be ignored by the recipient.
2.2.10.2 USER_PROPERTY
The USER_PROPERTY structure defines an array element that contains a single property name and
value for the supplementalCredentials attribute.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
NameLength ValueLength
...
PropertyValue (variable)
...
NameLength (2 bytes): The number of bytes, in little-endian byte order, of PropertyName. The
property name is located at an offset of zero bytes just following the Reserved field. For more
information, see the message processing section for supplementalCredentials (section 3.1.1.8.11).
Reserved (2 bytes): This value MUST be ignored by the recipient and MAY<22> be set to arbitrary
values on update.
PropertyValue (variable): The value of this property. The value MUST be hexadecimal-encoded
using an 8-bit character size, and the values '0' through '9' inclusive and 'a' through 'f' inclusive
(the specification of 'a' through 'f' is case-sensitive).
The WDIGEST_CREDENTIALS structure defines the format of the Primary:WDigest property within the
supplementalCredentials attribute. This structure is stored as a property value in a
USER_PROPERTY structure.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
85 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Reserved3
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
86 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
87 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
88 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Hash25 (16 bytes)
...
...
...
...
...
...
...
...
...
...
Reserved1 (1 byte): This value MUST be ignored by the recipient and MAY<23> be set to arbitrary
values upon an update to the supplementalCredentials attribute.
Reserved2 (1 byte): This value MUST be ignored by the recipient and MUST be set to zero.
NumberOfHashes (1 byte): This value MUST be set to 29 because there are 29 hashes in the array.
Reserved3 (12 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
The KERB_STORED_CREDENTIAL structure is a variable-length structure that defines the format of the
Primary:Kerberos property within the supplementalCredentials attribute. For information on how
this structure is created, see section 3.1.1.8.11.4.
89 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Revision Flags
CredentialCount OldCredentialCount
DefaultSaltLength DefaultSaltMaximumLength
DefaultSaltOffset
Credentials (variable)
...
OldCredentials (variable)
...
DefaultSalt (variable)
...
KeyValues (variable)
...
CredentialCount (2 bytes): This is the count of elements in the Credentials array. This value MUST
be set to 2.
OldCredentialCount (2 bytes): This is the count of elements in the OldCredentials array that
contain the keys for the previous password. This value MUST be set to 0 or 2.
This value is in little-endian byte order. This value SHOULD be ignored on read.
DefaultSaltMaximumLength (2 bytes): The length, in bytes, of the buffer containing the salt value.
This value is in little-endian byte order. This value SHOULD be ignored on read.
DefaultSaltOffset (4 bytes): An offset, in little-endian byte order, from the beginning of the
attribute value (that is, from the beginning of the Revision field of KERB_STORED_CREDENTIAL)
to where the salt value starts. This value SHOULD be ignored on read.
90 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
KeyValues (variable): An array of CredentialCount + OldCredentialCount key values. Each key
value MUST be located at the offset specified by the corresponding KeyOffset values specified in
Credentials and OldCredentials.
2.2.10.5 KERB_KEY_DATA
The KERB_KEY_DATA structure holds a cryptographic key. This structure is used in conjunction with
KERB_STORED_CREDENTIAL. For more information, see section 3.1.1.8.11.4.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Reserved1 Reserved2
Reserved3
KeyType
KeyLength
KeyOffset
Reserved1 (2 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
Reserved2 (2 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
Reserved3 (4 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
KeyType (4 bytes): Indicates the type of key, stored as a 32-bit unsigned integer in little-endian
byte order. This MUST be set to one of the following values, which are defined in section 2.2.10.8.
Value Meaning
1 dec-cbc-crc
3 des-cbc-md5
KeyLength (4 bytes): The length, in bytes, of the value beginning at KeyOffset. The value of this
field is stored in little-endian byte order.
KeyOffset (4 bytes): An offset, in little-endian byte order, from the beginning of the property value
(that is, from the beginning of the Revision field of KERB_STORED_CREDENTIAL) to where the
key value starts. The key value is the hash value specified according to the KeyType.
91 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Revision Flags
CredentialCount ServiceCredentialCount
OldCredentialCount OlderCredentialCount
DefaultSaltLength DefaultSaltMaximumLength
DefaultSaltOffset
DefaultIterationCount
Credentials (variable)
...
ServiceCredentials (variable)
...
OldCredentials (variable)
...
OlderCredentials (variable)
...
DefaultSalt (variable)
...
KeyValues (variable)
...
OldCredentialCount (2 bytes): This is the count of elements in the OldCredentials field that
contain the keys for the previous password.
OlderCredentialCount (2 bytes): This is the count of elements in the OlderCredentials field that
contain the keys for the previous password.
92 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DefaultSaltLength (2 bytes): The length, in bytes, of a salt value.
This value is in little-endian byte order. This value SHOULD be ignored on read.
DefaultSaltMaximumLength (2 bytes): The length, in bytes, of the buffer containing the salt value.
This value is in little-endian byte order. This value SHOULD be ignored on read.
DefaultSaltOffset (4 bytes): An offset, in little-endian byte order, from the beginning of the
attribute value (that is, from the beginning of the Revision field of KERB_STORED_CREDENTIAL)
to where DefaultSalt starts. This value SHOULD be ignored on read.
DefaultIterationCount (4 bytes): The default iteration count used to calculate the password
hashes.
2.2.10.7 KERB_KEY_DATA_NEW
The KERB_KEY_DATA_NEW structure holds a cryptographic key. This structure is used in conjunction
with KERB_STORED_CREDENTIAL_NEW. For more information, see section 3.1.1.8.11.6.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Reserved1 Reserved2
Reserved3
IterationCount
KeyType
KeyLength
KeyOffset
Reserved1 (2 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
Reserved2 (2 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
93 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Reserved3 (4 bytes): This value MUST be ignored by the recipient and MUST be set to zero.
IterationCount (4 bytes): Indicates the iteration count used to calculate the password hashes.
KeyType (4 bytes): Indicates the type of key, stored as a 32-bit unsigned integer in little-endian
byte order. This MUST be one of the values listed in section 2.2.10.8.
KeyLength (4 bytes): The length, in bytes, of the value beginning at KeyOffset. The value of this
field is stored in little-endian byte order.
KeyOffset (4 bytes): An offset, in little-endian byte order, from the beginning of the property value
(that is, from the beginning of the Revision field of KERB_STORED_CREDENTIAL_NEW) to where
the key value starts.
The following table identifies the various algorithms that can be used in the KERB_KEY_DATA and
KERB_KEY_DATA_NEW structures.<24>
Value Meaning
2.2.10.9 NTLM-Strong-NTOWF
The NTLM-Strong-NTOWF structure holds a cryptographic key. For more information, see section
3.1.1.8.11.7.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
NTLMStrongNTOWF
Reserved2
…
2.2.11.1 DES-ECB-LM
This section specifies an algorithm to encrypt and decrypt NT and LM hashes that is used throughout
the processing of this protocol. The structure that holds an encrypted hash value is found in section
94 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2.2.3.3, which contains references to the methods that use that structure, and therefore specify the
encryption key to use for processing.
The base algorithm is the DES [FIPS46-2] in ECB mode [FIPS81]. This section specifies how to
generate the 64-bit data blocks and 7-byte keys necessary for [FIPS81] from the hash value and the
key specified in the referring sections.
For simplicity, this section specifies just the encryption processing. The processing is the same for
encryption and decryption; the only exception is when the DES algorithm is invoked in ECB mode. In
this case, the implementer MUST specify whether the operation is encryption or decryption. (For more
information, see [FIPS81].)
This protocol provides two types of encryption and decryption keys: an unsigned integer and an array
of 16 bytes. The exact key is specified in the message processing or syntax sections that reference
this section indirectly through section 2.2.3.3.
First, the way to encrypt the hash value is specified, followed by the way to generate the 7-byte keys.
Split the hash value into two blocks, Block1 and Block2. Block1 is the first 8 bytes of the hash
(starting from the left); Block2 is the remaining 8 bytes.
Each block is encrypted with a different 7-byte key; call them Key1 and Key2.
If the specified key is an unsigned integer, see section 2.2.11.1.3 for the way to derive Key1 and
Key2.
If the specified key is a 16-byte value, see section 2.2.11.1.4 for the way to derive Key1 and Key2.
Let EncryptedBlock1 be the result of applying the algorithm in section 2.2.11.1.2 over Block1 with
Key1.
Let EncryptedBlock2 be the result of applying the algorithm in section 2.2.11.1.2 over Block2 with
Key2.
95 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The 7-byte InputKey is expanded to 8 bytes by inserting a 0-bit after every seventh bit.
4. Let the least-significant bit of each byte of OutputKey be a parity bit. That is, if the sum of the
preceding seven bits is odd, the eighth bit is 0; otherwise, the eighth bit is 1. The processing
starts at the leftmost bit of OutputKey.
Use [FIPS81] to encrypt the 64-bit block using OutputKey. If the higher-level operation is decryption
instead of encryption, this is the point at which an implementer MUST specify the decryption intent to
[FIPS81].
2.2.11.1.3 Deriving Key1 and Key2 from a Little-Endian, Unsigned Integer Key
Let I[X] be the Xth byte of I, where I is interpreted as a zero-base-index array of bytes. Note that
because I is in little-endian byte order, I[0] is the least significant byte.
Key1 is a concatenation of the following values: I[0], I[1], I[2], I[3], I[0], I[1], I[2].
Key2 is a concatenation of the following values: I[3], I[0], I[1], I[2], I[3], I[0], I[1].
Let Key2 be the next 7 bytes of the 16-byte value. For example, consider a zero-base-index array of
16 bytes called KeyArray that contains the 16-byte key. Key2 is composed of the bytes KeyArray[7]
through KeyArray[13], inclusive.
Note A consequence of this derivation is that the fifteenth and sixteenth bytes are ignored.
This protocol is part of the Active Directory core family of protocols. In order to be fully compliant
with Active Directory, an implementation of this protocol MUST be used in conjunction with the full
Active Directory schema, containing all the schema attributes and classes specified in [MS-ADA1],
[MS-ADA2], [MS-ADA3], and [MS-ADSC].
96 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3 Protocol Details
This protocol enables create, read, update, and delete semantics over an account domain, as
described in [MS-AUTHSOD] section 1.1.1.5. Five abstract objects are exposed through this protocol:
server, domain, group, alias, and user. User, group, and alias objects can be created and deleted;
all objects can be updated and read.
This specification uses the Active Directory data model, as specified in the entire document of [MS-
ADTS], for the server of this protocol. The attribute names specified in this section are normative for
the DC configuration. Section 3.1.1 contains a brief overview of that data model that is relevant to
this protocol.
Because the behavior of this protocol is very similar between the DC and non-DC configurations, the
Active Directory data model is also used for the non-DC configuration. However, when implementing
this protocol for the non-DC scenario, the names of attributes in the data model are not normative.
For example, it is conceivable that the backing store in a non-DC configuration could be a text file
written and read solely by the server of this protocol.
In the DC configuration, this protocol operates over a directory database that is composed of a set of
named objects. The name format is an X.501 name [X501]; therefore, the objects are arranged in a
hierarchy by name. Each object's name MUST be unique within the directory. In a non-DC
configuration, the name format of X.501 is not normative; this specification assumes that the format
is X.501 for consistency between the two configurations. This protocol is based largely on the use of
RPC context handles to maintain session state between the client and server. The basic context-handle
programming model is described in [C706] section 6.1.6. In the Security Account Manager (SAM)
Remote Protocol (Client-to-Server), for the context handles that have been returned to clients, the
server MUST maintain information that maps those handles to the internal objects they represent.
Each object possesses a collection of attributes. Attributes can be multivalued. Each attribute is
identified by a value called ldapDisplayName. For example, the X.501 name of the object is a single-
valued attribute with the ldapDisplayName: distinguishedName. This specification describes the
constraints on the attributes for behaviors relevant to this protocol. For the DC configuration, [MS-
ADTS] section 3.1.1.5 contains additional constraints.
Objects are retrieved from the directory database by specifying attribute-value constraints that the
object's attributes (and their values) MUST satisfy. Attribute values are updated by identifying the
target object by distinguishedName and specifying the new set of attribute-value pairs. Section
3.1.1.3 and section 3.1.1.4 contain a list of the Active Directory attributes and classes relevant to
this protocol.
Implementations MUST support creating, reading, updating, and deleting multiple objects, attributes,
and attribute values with ACID (atomic, consistent, isolated, and durable) properties [GRAY]. Such an
update is referred to as a transaction in this specification.
A user object refers to a database object whose objectClass attribute is user or derived from user.
A computer object refers to a database object whose objectClass attribute is computer or derived
from computer.
A group object refers to a database object whose objectClass attribute is group or derived from
group, and whose groupType contains GROUP_TYPE_ACCOUNT_GROUP or
GROUP_TYPE_UNIVERSAL_GROUP.
97 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
An alias object refers to a database object whose objectClass attribute is group or derived from
group, and whose groupType contains GROUP_TYPE_RESOURCE_GROUP.
Two domains are exposed from a given server: an account domain and a built-in domain; this fact
is true for both DC and non-DC configurations. The account domain refers to the object with
objectClass domainDNS. The built-in domain refers to the object with the objectClass
builtinDomain. The built-in domain has the characteristic that its objectSid value is invariant (S-1-5-
32) through all deployments and only contains aliases. There is exactly one built-in domain for every
account domain. When opening a domain object (through SamrOpenDomain (section 3.1.5.1.5)) a
client selects the domain to open based on the DomainId parameter. A domain can be in either mixed
mode or native mode, as specified in [MS-ADTS] section 6.1.4.1.
Domain object refers to either the account domain or the built-in domain.
Server object refers to the single object in the account domain with the samServer objectClass.
The following sections normatively describe the database constraints and triggers required for the
message processing of this protocol.
Constraints are relationships between attributes that MUST be satisfied for a database update to
be successful. The constraints are specified in section 3.1.1.6.
Triggers are actions that MUST be executed for a database update to be successful. An attribute-
scoped trigger is a trigger that is executed when a particular attribute is updated. The attribute-
scoped triggers are specified in section 3.1.1.8.
The methods that make up this RPC interface MUST all return STATUS_SUCCESS (0x00000000) on
success. Error statuses (also called error codes) generated by a failure to comply with a constraint are
in the NTSTATUS space (a long data type), as specified in [MS-ERREF] section 2.3. Unless specifically
called out, error codes are returned to the client of the protocol and are not handled by any special
processing at the client; therefore, the exact error code is implementation-specific. Cases in which the
client might handle a specific error code are called out. The set of such error codes is found in section
2.2.1.15.
The data model for storing an attribute of syntax "string" is a UTF-16 encoded string not including the
terminating null character. In this protocol, a string is represented within an RPC_UNICODE_STRING
structure, which is a counted string.
When a string to be stored in the database arrives through this protocol, it MUST be processed such
that the database attribute is updated with RPC_UNICODE_STRING.Length bytes of
RPC_UNICODE_STRING.Buffer.
When string matching is required by the message processing (for example, when processing a
SamrCreateGroupInDomain method and the data model checks for uniqueness of the name property),
the following string matching rules apply:
1. On a DC configuration, refer to [MS-ADTS] section 6.5 for how strings are compared.
98 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. When comparing two strings on a non-DC configuration, they MUST be compared in a case-
insensitive manner by transforming them to uppercase, per [UNICODE3.1], and then performing a
byte-comparison on their values.
The following attributes are referenced by this protocol (listed by ldapDisplayName). For a normative
description of the syntax, see [MS-ADA1], [MS-ADA2], and [MS-ADA3].
accountExpires
badPasswordTime
badPwdCount
codePage
countryCode
dBCSPwd
description
displayName
domainReplica
forceLogoff
groupType
homeDirectory
homeDrive
memberOf
lastLogoff
lastLogon
lmPwdHistory
lockOutObservationWindow
lockoutDuration
lockoutThreshold
lockoutTime
logonCount
logonHours
maxPwdAge
member
minPwdAge
minPwdLength
99 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
mS-DS-CreatorSID
mS-DS-MachineAccountQuota
msDS-LockoutObservationWindow
msDS-LockoutDuration
msDS-LockoutThreshold
msDS-MaximumPasswordAge
msDS-MinimumPasswordAge
msDS-MinimumPasswordLength
msDS-PasswordComplexityEnabled
msDS-PasswordHistoryLength
msDS-PasswordReversibleEncryptionEnabled
ntPwdHistory
nTSecurityDescriptor
objectClass
objectSid
oEMInformation
primaryGroupID
profilePath
pwdHistoryLength
pwdLastSet
pwdProperties
rIDAllocationPool
rIDPreviousAllocationPool
rIDSetReferences
sAMAccountName
sAMAccountType
scriptPath
serverState
supplementalCredentials
uASCompat
unicodePwd
userAccountControl
100 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
comment
userParameters
userWorkstations
objectClass
clearTextPassword*
*This attribute is not directly persisted. It has triggers that are applied when an update occurs that, in
turn, can update other attributes. As such, it is not found in the Active Directory schema.
The following classes are referenced by this protocol (listed by ldapDisplayName). For a normative
description of these classes, see [MS-ADSC].
user
computer
domainDNS
samServer
builtinDomain
group
The following computed attributes are defined for each user object. These attributes are read-only.
Effective-LockoutObservationWindow: A 64-bit value with delta time syntax, indicating the time
period in which bad password attempts are counted without resetting the count to zero.
Effective-LockoutDuration: A 64-bit value with delta time syntax, indicating the duration for which an
account is locked out before being automatically reset to an unlocked state.
Effective-MaximumPasswordAge: A 64-bit value with delta time syntax, indicating the policy setting
for the maximum time allowed before a password reset or change is required.
Effective-MinimumPasswordAge: A 64-bit value with delta time syntax, indicating the policy setting for
the minimum time allowed before a password change operation is allowed.
Effective-MinimumPasswordLength: A 16-bit unsigned integer indicating the policy setting for the
minimum number of characters allowed in a password.
Effective-PasswordHistoryLength: A 16-bit unsigned integer indicating the policy setting for the
password history length.
101 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The values for these attributes on user objects are computed according to the following algorithm:
1. If the server is in a DC configuration and the msDS-ResultantPSO computed attribute (as specified
in [MS-ADTS] section 3.1.1.4.5.36) on the user object has value O, values are calculated as
follows using attribute values on object O:<25>
1. Effective-LockoutObservationWindow = msDS-LockoutObservationWindow
2. Effective-LockoutDuration = msDS-LockoutDuration
3. Effective-LockoutThreshold = msDS-LockoutThreshold
4. Effective-MaximumPasswordAge = msDS-MaximumPasswordAge
5. Effective-MinimumPasswordAge = msDS-MinimumPasswordAge
6. Effective-MinimumPasswordLength = msDS-MinimumPasswordLength
7. Effective-PasswordComplexityEnabled = msDS-PasswordComplexityEnabled
8. Effective-PasswordHistoryLength = msDS-PasswordHistoryLength
Otherwise, false.
2. Otherwise, values are calculated as follows using attribute values on the domain object:
The following attribute constraints MUST be enforced during originating updates to the database.
The term "previous" refers to the value at the beginning of the transaction before any updates
occurred. Unless otherwise specified, other attributes referenced for a particular constraint refer to the
attribute on the same object as the attribute whose constraint is currently being satisfied. An
exception to this rule is for Password Settings Attributes (section 3.1.1.5).
102 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
A client implementation MUST treat all failure codes as complete failures of the requested operation
unless explicitly noted in this section. The possible status codes used for these explicit return codes
are found in section 2.2.1.15.
6. minPwdLength MUST be less than or equal to 256 unless uASCompat is nonzero, in which case
minPwdLength MUST be less than or equal to 14; on error, return a failure code.
7. pwdHistoryLength MUST be less than or equal to 1024; on error, return a failure code.
8. sAMAccountName MUST contain at least one non-blank character; on error, return a failure code.
9. sAMAccountName MUST NOT end with a '.' (period) character; on error, return a failure code.
10. sAMAccountName MUST NOT contain any of the following characters (shown here as the binary
values of UTF-16 encoded characters):
Characters 0x0000 through 0x001F, inclusive, and the characters in the following table.
0x0022 "
0x002F /
0x005C \
0x005B [
0x005D ]
0x003A :
0x007C |
0x003C <
0x003E >
0x002B +
0x003D =
0x003B ;
0x003F ?
0x002C ,
0x002A *
103 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
11. sAMAccountName MUST contain less than or equal to 20 characters if the object's objectClass is
user; on error, return a failure code.
12. sAMAccountName MUST contain less than or equal to 256 characters if the object's objectClass is
group; on error, return a failure code.
13. sAMAccountName MUST be the value "krbtgt" (UTF-16 encoded) if the RID of the objectSid
attribute is DOMAIN_USER_RID_KRBTGT; on error, return a failure code.
14. accountExpires MUST be equal to 0 if the RID of the objectSid attribute value is
DOMAIN_USER_RID_ADMIN; on error, return a failure code.
15. logonHours MUST conform to the binary structure of SAMPR_LOGON_HOURS (section 2.2.7.5),
and SAMPR_LOGON_HOURS.UnitsPerWeek MUST be less than or equal to 10080.
16. userWorkstations MUST conform to the following constraints, with the value interpreted as a UTF-
16 encoded string:
1. The string MUST be composed of substrings separated by a ',' (comma) character; therefore, a
substring cannot contain a comma character. Specifically:
1. If no comma is present, there is one substring, and it is equal to the string itself.
3. If a comma is present, the first substring MUST be the characters starting from the start of
the value to the character just preceding the first comma; the final substring MUST be the
characters starting just after the final comma to the final character in the string.
1. Satisfy the DNS naming syntax for a full DNS host name, as specified in [RFC1123] section
2.1.
2. Have a length greater than 1 character and less than or equal to 20 characters, not have a
leading or trailing blank character (0x0020), and not contain any of the following
characters:
Characters of the value 0x0000 through 0x001F, inclusive, and the characters in the
following table.
0x0022 "
0x002F /
0x005C \
0x005B [
0x005D ]
0x003A :
0x007C |
0x003C <
0x003E >
104 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Hexadecimal value Character encoded
0x002B +
0x003D =
0x003B ;
0x003F ?
0x002C ,
0x002A *
18. userAccountControl MUST contain only the following bits, as defined in section 2.2.1.13. Note that
constraints in this section further limit the possible variations that are legal.
Bits
UF_ACCOUNTDISABLE
UF_HOMEDIR_REQUIRED
UF_PASSWD_NOTREQD
UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED
UF_NORMAL_ACCOUNT
UF_INTERDOMAIN_TRUST_ACCOUNT
UF_WORKSTATION_TRUST_ACCOUNT
UF_SERVER_TRUST_ACCOUNT
UF_DONT_EXPIRE_PASSWD
UF_MNS_LOGON_ACCOUNT
UF_SMARTCARD_REQUIRED
UF_TRUSTED_FOR_DELEGATION
UF_NOT_DELEGATED
UF_USE_DES_KEY_ONLY
UF_DONT_REQUIRE_PREAUTH
UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
UF_NO_AUTH_DATA_REQUIRED
UF_PARTIAL_SECRETS_ACCOUNT
UF_USE_AES_KEYS
105 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
19. userAccountControl MUST contain one and only one of the following bits, as defined in section
2.2.1.13; on error, return a failure code.
Bits
UF_NORMAL_ACCOUNT
UF_INTERDOMAIN_TRUST_ACCOUNT
UF_WORKSTATION_TRUST_ACCOUNT
UF_SERVER_TRUST_ACCOUNT
20. An existing userAccountControl attribute SHOULD NOT be modified such that the
UF_WORKSTATION_TRUST_ACCOUNT bit is removed and the UF_NORMAL_ACCOUNT bit is added,
or vice-versa; on error, return a failure code. This modification, however, MUST be allowed if the
client is a member of the Domain Administrators group.<26>
21. userAccountControl MUST NOT contain the UF_ACCOUNTDISABLE bit if the RID of objectSid has
the value DOMAIN_USER_RID_ADMIN or DOMAIN_USER_RID_KRBTGT; on error, return a failure
code.
22. objectClass MUST be of type computer or derived from computer if userAccountControl contains
the following bit: UF_SERVER_TRUST_ACCOUNT.
2. If a value is present, the first 16 bytes MUST be equal to the current value of dBCSPwd.
2. If a value is present, the first 16 bytes MUST be equal to the current value of unicodePwd.
28. groupType MUST NOT contain GROUP_TYPE_UNIVERSAL if the account domain is in mixed mode.
29. groupType MUST NOT be changed after it has been added if the account domain is in mixed mode.
The following constraints MUST be satisfied; on error, the server MUST return a processing error. For
more information on error codes, see section 3.1.5.
1. Minimum Password Length Constraint: If all of the following conditions are true, the following
constraint MUST be satisfied:
106 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. Conditions:
2. The objectSid attribute value does not have the DOMAIN_USER_RID_KRBTGT value as
the RID.
5. The requesting protocol message is a password change (as compared to a password set).
2. Constraint:
2. Minimum Password Age Constraint: If all of the following conditions are true, the following
constraint MUST be satisfied:
1. Conditions:
2. At least one of the dBCSPwd or unicodePwd attribute values is present and not equal to
a hash value of a zero-length string.
2. Constraint:
1. The pwdLastSet attribute MUST be less than the current time plus the value of the
Effective-MinimumPasswordAge attribute (see section 3.1.1.5).
3. Password History Length Constraint: If all of the following conditions are true, the following
constraints MUST be satisfied:
1. Conditions:
5. The requesting protocol message is a password change (as compared to a password set).
2. Constraints:
1. If the unicodePwd attribute is being updated, the value of the unicodePwd MUST NOT be
present in the first N hashes stored in the ntPwdHistory attribute value, where N is the
value of the Effective-PasswordHistoryLength attribute (see section 3.1.1.5). For details on
how ntPwdHistory is maintained, see section 3.1.1.9.1.
2. If the dBCSPwd attribute is being updated, the value of the dBCSPwd MUST NOT be
present in the first N hashes stored in the lmPwdHistory attribute value, where N is the
value of the Effective-PasswordHistoryLength attribute (see section 3.1.1.5). For details on
how lmPwdHistory is maintained, see section 3.1.1.9.1.
107 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This constraint is referenced when a cleartext password is updated.
The following constraints MUST be satisfied; on error, the server MUST return a processing error. For
more information on error codes, see section 3.1.5.
1. The value MUST be interpreted as a UTF-16 encoded string. If the length of the value is an odd-
byte count, ignore the final byte, interpret the remaining characters as a UTF-16 encoded string,
and ignore the last constraint (starting with the text "If the Effective-PasswordComplexityEnabled
value...").
2. The value MUST be less than or equal to 256 characters (this constraint is called the "maximum
password length constraint").
3. The value MUST satisfy all of the following constraints if all of the following conditions are met:
1. Conditions:
2. Constraints:
1. The number of characters in the value MUST not be smaller than the value of the
Effective-MinimumPasswordLength attribute (see section 3.1.1.5). This constraint is called
the "minimum password length constraint".
2. The value MUST NOT contain the sAMAccountName attribute value as a case-insensitive
substring if that value contains more than two characters.
3. The value MUST NOT contain any case-insensitive portion of the displayName attribute
value that is greater than two characters and delimited by one or more of the following
characters.
0x0020 [SP]
0x002c ,
0x002e .
0x0009 [HT]
0x002d -
0x005f _ (underscore)
0x0023 #
4. Any character from [UNICODE3.1] that is categorized as Lu, LI, Lt, Lm, Lo.
108 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
5. The following characters.
0x0028 (
0x0060 `
0x007e ~
0x0021 !
0x0040 @
0x0023 #
0x0024 $
0x0025 %
0x005e ^
0x0026 &
0x002a *
0x005f _ (underscore)
0x002d -
0x002b +
0x003d =
0x007c |
0x005c \
0x007b {
0x007d }
0x005b [
0x005d ]
0x003a :
0x003b ;
0x0022 "
0x0027 '
0x003c <
0x003e >
0x002c ,
0x002e .
0x003f ?
0x0029 )
109 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Hexadecimal value Character encoded
0x002f /
The following attribute-scoped triggers MUST be executed during originating updates to the database.
The term "previous" refers to the value at the beginning of the transaction, before any updates
occurred. Unless otherwise specified, other attributes referenced for a particular trigger refer to the
attribute on the same object as the attribute whose trigger is currently being executed.
3.1.1.8.1 objectClass
1. If the objectClass attribute value is user or computer, or derived from either of these classes, all
of the following constraints MUST be satisfied:
1. The objectSid attribute MUST be updated according to the supplemental trigger specified in
section 3.1.1.9.2.
2. The following attributes MUST be updated with the associated values if no value is present in
the database.
Attribute Value
badPwdCount 0
codePage 0
countryCode 0
badPasswordTime 0
lastLogoff 0
lastLogon 0
pwdLastSet 0
logonCount 0
3. If the value of the userAccountControl attribute in the database contains a bit that is
specified in the following table, the sAMAccountType attribute MUST be updated with the
corresponding value.
userAccountControl sAMAccountType
UF_NORMAL_ACCOUNT SAM_USER_OBJECT
UF_INTERDOMAIN_TRUST_ACCOUNT SAM_TRUST_ACCOUNT
UF_WORKSTATION_TRUST_ACCOUNT SAM_MACHINE_ACCOUNT
UF_SERVER_TRUST_ACCOUNT SAM_MACHINE_ACCOUNT
110 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. If the value of the userAccountControl attribute in the database contains a bit or bit
combination that is specified in the following table, the primaryGroupId attribute MUST be
updated with the corresponding value.
userAccountControl primaryGroupId
UF_NORMAL_ACCOUNT DOMAIN_GROUP_RID_USERS
UF_INTERDOMAIN_TRUST_ACCOUNT DOMAIN_GROUP_RID_USERS
UF_WORKSTATION_TRUST_ACCOUNT DOMAIN_GROUP_RID_COMPUTERS
UF_SERVER_TRUST_ACCOUNT DOMAIN_GROUP_RID_CONTROLLERS
5. If the value of the userAccountControl attribute in the database contains a bit that is
specified in the following table, the userAccountControl attribute MUST be updated with the
corresponding bit(s) using a bitwise OR.
UF_NORMAL_ACCOUNT UF_ACCOUNTDISABLE
UF_PASSWD_NOTREQD
2. If the objectClass attribute value is group or is derived from this class, all of the following
constraints MUST be satisfied:
1. The objectSid attribute MUST be updated according to the supplemental trigger specified in
section 3.1.1.9.2.
2. The groupType attribute MUST be updated, if no value is present in the database, with the
value GROUP_TYPE_SECURITY_ACCOUNT.
3. The sAMAccountType attribute MUST be updated with the value dictated by an exact match
with the value in the groupType attribute.
groupType sAMAccountType
GROUP_TYPE_SECURITY_ACCOUNT SAM_GROUP_OBJECT
GROUP_TYPE_ACCOUNT_GROUP SAM_NON_SECURITY_GROUP_OBJECT
GROUP_TYPE_SECURITY_RESOURCE SAM_ALIAS_OBJECT
GROUP_TYPE_RESOURCE_GROUP SAM_NON_SECURITY_ALIAS_OBJECT
GROUP_TYPE_SECURITY_UNIVERSAL SAM_GROUP_OBJECT
GROUP_TYPE_UNIVERSAL_GROUP SAM_NON_SECURITY_GROUP_OBJECT
3.1.1.8.2 primaryGroupID
Let G be the group object such that the value of the primaryGroupId attribute of O contains the
RID of the objectSid attribute of G prior to the update.
111 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Let G' be the group object such that the value of the primaryGroupId attribute of O contains the RID
of the objectSid attribute of G' after the update.
If the update to the primaryGroupID attribute of O is NOT a result of an internal trigger, all of the
following constraints MUST be satisfied after the update:
3.1.1.8.3 lockoutTime
If the lockoutTime attribute value is 0, badPwdCount MUST be updated to the value of 0.<27>
3.1.1.8.4 sAMAccountName
1. If the objectSid attribute has a RID of DOMAIN_USER_RID_KRBTGT and there is already a value
present in the sAMAccountName attribute, the server MUST return an error status.
2. If the sAMAccountName attribute value is NOT unique with respect to the union of all
sAMAccountName and msDS-AdditionalSamAccountName attribute values for all other
objects within the scope of the account and built-in domain, the server MUST return an error
status, according to the following conditions.
Otherwise: STATUS_USER_EXISTS
3.1.1.8.5 clearTextPassword
1. If the pwdProperties attribute value on the account domain object contains the
DOMAIN_PASSWORD_NO_CLEAR_CHANGE bit, the server MUST abort the request and return an
error status.
2. If the RID of the objectSid attribute is DOMAIN_USER_RID_KRBTGT and the requesting protocol
is a change-password protocol, the server MUST abort the request and return an error status.
3. If the RID of the objectSid attribute is DOMAIN_USER_RID_KRBTGT and the requesting protocol
is a set-password protocol, the value of clearTextPassword MUST be replaced with a randomly
generated value that satisfies all criteria in section 3.1.1.7.2.
112 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. The constraints in section 3.1.1.7.2 MUST be satisfied.
5. The unicodePwd attribute MUST be updated with the NT hash of new value.
6. The dBCSPwd attribute MUST be updated with the LM hash of new value.
3.1.1.8.6 dBCSPwd
2. The new value MUST be encrypted before being persisted. Encryption is accomplished using the
algorithm specified in section 2.2.11.1, with the RID (an unsigned integer) as the encryption key.
3. If the client has access to the Unexpire-Password control access right ([MS-ADTS] section
5.1.3.2.1) on the domain object, pwdLastSet MUST be updated to the current time; otherwise,
pwdLastSet MUST be updated to the value zero, which causes the new password to expire
immediately.
4. If the update to this attribute is not from an internal trigger, the supplementalCredential
attribute MUST be removed.
5. The lmPwdHistory attribute MUST be updated with the new dBCSPwd attribute value
(encrypted with the RID, according to constraint 2) according to the constraints in section
3.1.1.9.1.
3.1.1.8.7 unicodePwd
2. The new value MUST be encrypted before being persisted. Encryption is accomplished using the
algorithm specified in section 2.2.11.1, with the RID (an unsigned integer) as the encryption key.
3. If the client has access to the Unexpire-Password control access right ([MS-ADTS] section
5.1.3.2.1) on the domain object, pwdLastSet MUST be updated to the current time; otherwise,
pwdLastSet MUST be updated to the value zero, which causes the new password to expire
immediately.
4. If the update to this attribute is not from an internal trigger, the supplementalCredential
attribute MUST be removed.
5. The ntPwdHistory attribute MUST be updated with the new unicodePwd attribute value
(encrypted with the RID, according to constraint 2) according to the constraints in section
3.1.1.9.1.
3.1.1.8.8 pwdLastSet
3.1.1.8.9 member
1. If all of the following conditions are true, the subsequent constraint MUST be satisfied:
1. Conditions:
113 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. The dsname value does not resolve to an existing object in the domain NC.
3. The server is in a DC configuration, and the domain prefix of the SID value is not equal
to any domain SID in the forest; or the server is in a non-DC configuration, and the value
is different than the account domain security identifier.
2. Constraint:
1. A new object with the following characteristics MUST be created with the following
attributes and values. The dsname value added to the member attribute MUST reference
this object.
Attribute Value
objectClass foreignSecurityPrincipal
distinguishedName The parent MUST be the well-known object container for foreign principal
objects. (More information about this container is specified in [MS-ADTS]
section 6.1.1.4.) There is no constraint on the relative distinguished
name (RDN) value.
1. If the domain is in mixed mode, the member values MUST refer to user objects (or objects
derived from user).
2. If the domain is in native mode, the member values MUST satisfy at least one of the
following criteria:
1. If the domain is in mixed mode, the member values MUST either refer to user objects (or
objects derived from user) or refer to group objects whose groupType is
GROUP_TYPE_SECURITY_ACCOUNT.
2. If the domain is in native mode, the constraint shown above is relaxed to include member
values that refer to group objects whose groupType is GROUP_TYPE_SECURITY_RESOURCE.
1. The value refers to a user object (or an object derived from user).
2. The value refers to a group object (or an object derived from group) with a groupType
attribute that contains GROUP_TYPE_ACCOUNT_GROUP or GROUP_TYPE_UNIVERSAL_GROUP.
3.1.1.8.10 userAccountControl
114 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. If the UF_LOCKOUT bit (section 2.2.1.13) is set and the lockoutTime attribute is nonzero, the
lockoutTime attribute MUST be updated to a value of zero.
2. The following bits, if set, MUST be unset before committing the transaction: UF_LOCKOUT and
UF_PASSWORD_EXPIRED.
3. If the UF_SERVER_TRUST_ACCOUNT bit is set, all of the following constraints MUST be satisfied:
5. If any of the following bits are set, the client MUST have the associated control access right
(defined in [MS-ADTS] section 5.1.3.2.1) on the ntSecurityDescriptor for the account domain
object, per an access check. (Information about the access check mechanism is specified in
[MS-ADTS] section 5.1.3.3.) If this constraint fails, the server MUST abort processing and return
STATUS_ACCESS_DENIED.
UF_PASSWD_NOTREQD Update-Password-Not-Required-Bit
UF_DONT_EXPIRE_PASSWD Unexpire-Password
UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED Enable-Per-User-Reversibly-Encrypted-Password
UF_SERVER_TRUST_ACCOUNT DS-Install-Replica
UF_PARTIAL_SECRETS_ACCOUNT DS-Install-Replica
6. If the UF_SMARTCARD_REQUIRED bit is set and is NOT present in the previous value, the
dBCSPwd and unicodePwd attributes MUST be updated with 16 bytes of random bytes, and all
USER_PROPERTY elements MUST be removed from the supplementalCredentials attribute.
7. If the UF_PASSWD_NOTREQD bit is removed from the userAccountControl value, the server
MUST abort processing and return an error status if all of the following conditions are true:
8. If the UF_INTERDOMAIN_TRUST_ACCOUNT bit is set, and the write request did not originate over
the MS-LSAD protocol (see [MS-ADTS] section 6.1.6.9.7), the server MUST abort processing and
return an error status.
115 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
10. If UF_USER_PARTIAL_SECRETS_ACCOUNT is set and UF_WORKSTATION_TRUST_ACCOUNT is not
set, the server MUST abort processing and return an error status.
11. If more than one of the following bits are set, the server MUST abort processing and return an
error status.
userAccountControlBit
UF_NORMAL_ACCOUNT
UF_INTERDOMAIN_TRUST_ACCOUNT
UF_WORKSTATION_TRUST_ACCOUNT
UF_SERVER_TRUST_ACCOUNT
12. If the UF_TEMP_DUPLICATE_ACCOUNT is set, the server MUST abort processing and return an
error status.
13. If none of the following bits are set, the server MUST set the UF_NORMAL_ACCOUNT bit.
userAccountControlBit
UF_NORMAL_ACCOUNT
UF_INTERDOMAIN_TRUST_ACCOUNT
UF_WORKSTATION_TRUST_ACCOUNT
UF_SERVER_TRUST_ACCOUNT
3.1.1.8.11 supplementalCredentials
Each property name is a UTF-16 encoded string; each value has its own unique binary format. The
properties that are in supplementalCredentials are listed in the following table.
Packages A list of the credential types that are stored as properties 3.1.1.8.11.2
in supplementalCredentials.
116 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Property name Property value format
(normative) Property value semantic specification section
3.1.1.8.11.1 Processing
Section 3.1.1.8.11.1.1 describes how to update the USER_PROPERTIES structure when properties are
added or removed.
When a new property-value pair is added (as a result of an update, for example), the PropertyCount
field of the USER_PROPERTIES structure MUST be incremented by one, and the property structure (a
USER_PROPERTY structure) MUST be added to the variable-length array of USER_PROPERTY
structures that follow USER_PROPERTIES. The order of the USER_PROPERTY entries is not important.
When a property-value pair is removed and the property-value is present in the USER_PROPERTIES
structure, the PropertyCount field of the USER_PROPERTIES structure MUST be decremented by
one, and the property structure (a USER_PROPERTY structure) MUST be removed from the variable-
length array of USER_PROPERTY structures that follow USER_PROPERTIES.
When the last property-value pair is removed, the PropertyCount field is no longer included in the
USER_PROPERTIES structure. In this state, the absence of any user properties MUST be inferred from
the structure’s total length (0x6F bytes).
This section describes how to structure a given property-value pair in a USER_PROPERTY structure.
The NameLength field MUST be set to the size, in bytes, of the property name. The property
name "WDigest", for example, has a NameLength of 14.
The ValueLength field MUST be set to the size, in bytes, of the value of the property after
hexadecimal-encoding the value per the specification in section 2.2.10.2.
The property name MUST follow the Reserved field of the USER_PROPERTY structure.
The property value is a UTF-16 encoded string. The string itself is composed of a set of substrings
separated by a NULL Unicode character value, as defined in [UNICODE3.1]. The final character does
117 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
not need to be a NULL Unicode character. Each substring is the name of a credential type stored as a
property in the supplementalCredentials value.
When an update occurs, if a credential-type property (that is, a property that represents a credential
type) is successfully computed, this value MUST be updated with the associated credential name. The
following table shows the legal values of names to be used as strings in the property value of the
"Packages" property along with their associated credential type.
Primary:WDigest WDigest
Primary:Kerberos Kerberos
Primary:CLEARTEXT CLEARTEXT
Primary:Kerberos-Newer-Keys Kerberos-Newer-Keys
Primary:NTLM-Strong-NTOWF NTLM-Strong-NTOWF
The WDigest property contains pre-calculated hash forms that are used in the digest authentication
protocols ([RFC2617]). A normative description of the hashes used by the protocol is specified in
[RFC2617] section 3.2.2.2.
The following notation is used to describe how the hash values are constructed. All strings are
converted from UTF-16 encoding to ISO 8859-1 Latin I code page ([MS-UCODEREF] section 2.2.1,
Codepage ID 28591, and [MS-UCODEREF] section 2.2.2) prior to the hashing.
Notation Description
UPPER(x) The uppercase version of the string as defined in the Unicode standard ([UNICODE3.1]).
LOWER(x) The lowercase version of the string as defined in the Unicode standard ([UNICODE3.1]).
118 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Hash4: MD5(sAMAccountName, UPPER(NETBIOSDomainName), password)
119 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
by a salt value and two or four key values. The salt and key values are referenced from the
KERB_STORED_CREDENTIAL and KERB_KEY_DATA structures.
The server MUST calculate two hash forms of the cleartext password, as specified in [RFC3961]
sections 6.2.1 and 6.2.3. Call these values Key1 and Key2.
The first two KERB_KEY_DATA MUST be set to hold Key1 and Key2. Key1 and Key2 MUST be added to
the end of the structure.
If there are existing KERB_KEY_DATA elements in the property prior to the current update, these
elements MUST be copied into the third and fourth KERB_KEY_DATA elements. Call the associated key
values of these KERB_KEY_DATA structures Key3 and Key4. Key3 and Key4 MUST be added to the
end of the structure.<31>
If there are no existing KERB_KEY_DATA elements in the property prior to the current update, the
resulting KERB_STORED_CREDENTIAL in the third and fourth optional KERB_KEY_DATA elements are
excluded from the resulting value (and Key3 and Key4, from the preceding paragraph, are also
excluded).
This credential type is the cleartext password. The value format is the UTF-16 encoded cleartext
password.
Storage of the cleartext password for an object is configured when the Effective-
PasswordReversibleEncryptionEnabled value (section 3.1.1.5) is set or when the current object's
userAccountControl contains the USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED bit.
When an update to supplementalCredentials occurs, and the current domain functional level is
DS_BEHAVIOR_WIN2008 or greater, the server MUST create a KERB_STORED_CREDENTIAL_NEW-
structured value as specified in section 2.2.10.6. This value MUST then be placed in a
USER_PROPERTY structure along with the property name "Primary:Kerberos-Newer-Keys". Finally, the
resulting USER_PROPERTY-structured value MUST be added to the list of properties within
supplementalCredentials according to section 3.1.1.8.11.1.1.
The server MUST calculate four hash forms of the cleartext password, as specified in [RFC3961]
sections 6.2.1 and 6.2.3, and as specified in [RFC3962] section 6. Call these values Key1, Key2, Key3,
and Key4.
120 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The Credentials field MUST be set to hold Key1, Key2, Key3, and Key4. If there are existing keys in
the Credentials field, they MUST be moved to the OldCredentials field. If there are existing keys in
the OldCredentials field, they MUST be moved to the OlderCredentials field. Any existing keys in
the OlderCredentials field MUST be discarded.<32>
The following constraints MUST be satisfied for ntPwdHistory and lmPwdHistory. The term "history
attribute" refers to one or the other in the following constraints, and the term "associated password"
refers to dBCSPwd when the history attribute is lmPwdHistory, and unicodePwd when the history
attribute is ntPwdHistory.
1. If the Password-History-Length is greater than 0 and the history attribute is zero length, the
history attribute MUST be updated with the previous associated password if the old associated
password's length is nonzero.
2. If the Password-History-Length is zero, the history attribute MUST be updated with a zero-length
value.
3. If the Password-History-Length is nonzero, the associated password value MUST be placed at the
beginning of the history attribute, and existing values MUST be shifted by 16 bytes to the right. If
the size of the attribute exceeds Password-History-Length * 16, the attribute value MUST be
truncated to not exceed Password-History-Length * 16 bytes.
This section is referenced by object creation triggers to update the objectSid attribute with a SID
value. The SID value is generated by first generating a 32-bit unsigned integer value (the RID) and
then concatenating that value with the account domain security identifier.
The key part of this section is how the RID is generated, because it MUST be unique for all time and
space for a given domain. For all algorithms, once the RID is generated, the SID value is generated
as specified in the previous sentence, and the objectSid attribute is updated with that value.
The simplest RID-generation algorithm is to maintain a counter and increment the counter for each
RID that is issued. This algorithm is entirely sufficient for the non–domain controller case for this
protocol. In a distributed environment, where any domain controller might be creating a security
principal and therefore needs to assign a RID to that principal, the algorithm becomes more
121 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
complicated. Many schemes are possible, up to and including a distributed counter, as described in
[LAMPORT].
The following specifications present the constraints that MUST be satisfied when generating a RID.
Generating RIDs in a monotonically increasing manner when possible (in addition to satisfying the
constraints) is one implementation choice, but is not required.
3.1.1.9.2.1 DC Configuration
Let Rid-Set be the directory object referenced in the rIDSetReferences attribute, as stored on the
configured computer object for the host server.
Let Rid-Range be the range specified by the rIDPreviousAllocationPool attribute of the Rid-Set
object. The lower bound of the Rid-Range is the first 32-bit integer (in little-endian byte order) of the
rIDPreviousAllocationPool attribute value. The upper bound of the Rid-Range is the second 32-bit
integer (in little-endian byte order).
1. The server MUST generate a 32-bit integer value subject to all of the following constraints:
2. Any value chosen from the Rid-Range that is used for an objectSid value that is successfully
committed in a transaction MUST NOT ever be used again for objectSid generation within the
current domain.
1. If the rIDAllocationPool attribute of the Rid-Set object exists and has a value different from
that of rIDPreviousAllocationPool, the server copies the value of rIDAllocationPool to
rIDPreviousAllocationPool, and attempts to generate a 32-bit value according to the
constraints in step 1.
2. If the rIDAllocationPool attribute of the Rid-Set object does not exist or has a value identical
to that of rIDPreviousAllocationPool, the server MUST call the IDL_DRSGetNCChanges
method (as specified in [MS-DRSR] section 4.1.10) to obtain a (new) value for
rIDAllocationPool, copy this value to rIDPreviousAllocationPool, and attempt to generate
a 32-bit value according to the constraints in step 1. The server MAY also return an error code
if the constraints in step 1 cannot be satisfied.<34>
The following steps are used to generate a unique RID on a non-DC configuration.
1. The server MUST generate a 32-bit integer value subject to all of the following constraints:
2. Any value chosen by this algorithm that is successfully committed in a transaction MUST NOT
ever be used again for objectSid generation within the current domain.
2. If the constraints in step 1 cannot be satisfied, the server MUST abort processing and return an
error status.
122 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.1.10 SamContextHandle Data Model
This protocol is based largely on the use of RPC context handles to maintain session state between the
client and the server. The basic context-handle programming model is described in [C706] section
6.1.6.
The server MUST maintain the following data elements for each context handle that is returned to a
client.
Name Type
GrantedAccess ACCESS_MASK
Server
Domain
Group
Alias
User
For methods that accept a context handle, the security model is a handle-based security model. A
client obtains a handle with a client-specified access for that handle. The handle can then be used for
operations that require the granted access. The access is encoded in a 32-bit value (an access
mask). Note that some methods MUST enforce additional security requirements based on the input.
The security model assumes that whenever a context handle is presented to a method, the identity of
the client is the same as the identity of the client that originally opened the handle.<35>
The following tables specify the required access for the RPC methods that enforce required access on a
handle parameter.
SamrCloseHandle
SamrLookupDomainInSamServer
N/A SAM_SERVER_LOOKUP_DOMAIN
SamrEnumerateDomainsInSamServer
123 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Information level Required access
N/A SAM_SERVER_ENUMERATE_DOMAINS
SamrOpenDomain
N/A SAM_SERVER_LOOKUP_DOMAIN
SamrQueryInformationDomain
SamrQueryInformationDomain2
DomainPasswordInformation DOMAIN_READ_PASSWORD_PARAMETERS
DomainLockoutInformation: DOMAIN_READ_PASSWORD_PARAMETERS
DomainGeneralInformation DOMAIN_READ_OTHER_PARAMETERS
DomainLogoffInformation DOMAIN_READ_OTHER_PARAMETERS
DomainOemInformation DOMAIN_READ_OTHER_PARAMETERS
DomainNameInformation DOMAIN_READ_OTHER_PARAMETERS
DomainServerRoleInformation DOMAIN_READ_OTHER_PARAMETERS
DomainReplicationInformation DOMAIN_READ_OTHER_PARAMETERS
DomainModifiedInformation DOMAIN_READ_OTHER_PARAMETERS
DomainStateInformation DOMAIN_READ_OTHER_PARAMETERS
DomainModifiedInformation2 DOMAIN_READ_OTHER_PARAMETERS
DomainGeneralInformation2 DOMAIN_READ_PASSWORD_PARAMETERS |
DOMAIN_READ_OTHER_PARAMETERS
SamrSetInformationDomain
DomainPasswordInformation DOMAIN_WRITE_PASSWORD_PARAMS
DomainLockoutInformation DOMAIN_WRITE_PASSWORD_PARAMS
DomainLogoffInformation DOMAIN_WRITE_OTHER_PARAMETERS
DomainOemInformation DOMAIN_WRITE_OTHER_PARAMETERS
DomainReplicationInformation DOMAIN_ADMINISTER_SERVER
DomainStateInformation DOMAIN_ADMINISTER_SERVER
DomainServerRoleInformation DOMAIN_ADMINISTER_SERVER
SamrCreateGroupInDomain
124 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Information level Required access
N/A DOMAIN_CREATE_GROUP
SamrEnumerateGroupsInDomain
N/A DOMAIN_LIST_ACCOUNTS
SamrCreateUserInDomain
SamrCreateUser2InDomain
N/A DOMAIN_CREATE_USER
SamrEnumerateUsersInDomain
N/A DOMAIN_LIST_ACCOUNTS
SamrCreateAliasInDomain
N/A DOMAIN_CREATE_ALIAS
SamrEnumerateAliasesInDomain
N/A DOMAIN_LIST_ACCOUNTS
SamrGetAliasMembership
N/A DOMAIN_GET_ALIAS_MEMBERSHIP
SamrLookupNamesInDomain
N/A DOMAIN_LOOKUP
SamrLookupIdsInDomain
N/A DOMAIN_LOOKUP
SamrOpenGroup
125 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Information level Required access
N/A DOMAIN_LOOKUP
SamrQueryInformationGroup
GroupGeneralInformation GROUP_READ_INFORMATION
GroupNameInformation GROUP_READ_INFORMATION
GroupAttributeInformation GROUP_READ_INFORMATION
GroupAdminCommentInformation GROUP_READ_INFORMATION
GroupReplicationInformation GROUP_READ_INFORMATION
SamrSetInformationGroup
GroupNameInformation GROUP_WRITE_ACCOUNT
GroupAttributeInformation GROUP_WRITE_ACCOUNT
GroupAdminCommentInformation GROUP_WRITE_ACCOUNT
SamrAddMemberToGroup
N/A GROUP_ADD_MEMBER
SamrDeleteGroup
N/A DELETE
SamrRemoveMemberFromGroup
N/A GROUP_REMOVE_MEMBER
SamrGetMembersInGroup
N/A GROUP_LIST_MEMBERS
SamrSetMemberAttributesOfGroup
N/A GROUP_ADD_MEMBER
126 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrOpenAlias
N/A DOMAIN_LOOKUP
SamrQueryInformationAlias
AliasGeneralInformation ALIAS_READ_INFORMATION
AliasNameInformation ALIAS_READ_INFORMATION
AliasAdminCommentInformation ALIAS_READ_INFORMATION
AliasReplicationInformation ALIAS_READ_INFORMATION
SamrSetInformationAlias
AliasNameInformation ALIAS_WRITE_ACCOUNT
AliasAdminCommentInformation ALIAS_WRITE_ACCOUNT
SamrDeleteAlias
N/A DELETE
SamrAddMemberToAlias
N/A ALIAS_ADD_MEMBER
SamrRemoveMemberFromAlias
N/A ALIAS_REMOVE_MEMBER
SamrGetMembersInAlias
N/A ALIAS_LIST_MEMBERS
SamrOpenUser
N/A DOMAIN_LOOKUP
SamrDeleteUser
127 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Information level Required access
N/A DELETE
SamrChangePasswordUser
SamrGetGroupsForUser
N/A USER_LIST_GROUPS
SamrQueryDisplayInformation
SamrQueryDisplayInformation2
SamrQueryDisplayInformation3
N/A DOMAIN_LIST_ACCOUNTS
SamrGetDisplayEnumerationIndex
SamrGetDisplayEnumerationIndex2
N/A DOMAIN_LIST_ACCOUNTS
SamrRemoveMemberFromForeignDomain
N/A DOMAIN_LOOKUP
SamrAddMultipleMembersToAlias
N/A ALIAS_ADD_MEMBER
SamrRemoveMultipleMembersFromAlias
N/A ALIAS_REMOVE_MEMBER
SamrRidToSid
128 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Information level Required access
Unless otherwise specified, the create, update, delete, and read access checks enforced by the MS-
ADTS data model (specified in [MS-ADTS] section 5.1.3) are not enforced during the message
processing of this protocol.
The server MUST retrieve the SMB session key as specified in [MS-CIFS] section 3.5.4.4.
3.1.3 Timers
This protocol does not introduce any timers. Information about any transport-level timers is specified
in [MS-RPCE].
3.1.4 Initialization
This section covers the default users and groups that the server MUST have and the default access
control on the data manipulated by this protocol.
Information about the default access control (expressed in the default security descriptor) on user,
group, alias, domain, and server objects is specified in [MS-ADTS] section 3.1.1.2. This is
significant because this server MUST use the security descriptor from the [MS-ADTS] data model to
determine whether the client has access to perform the requested operation. If, for example, a client
opens a domain object with SamrOpenDomain (section 3.1.5.1.5) requesting
DOMAIN_READ_PASSWORD_PROPERTIES, SamrOpenDomain uses the [MS-ADTS] data model security
descriptor to determine whether the client has access to read password-related properties. For more
information related to this example, see the message processing section of SamrOpenDomain.
129 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Name Domain Rid Member
130 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Name Domain Rid Member
131 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Name Domain Rid Member
Denied RODC Password Replication Group Account 572 Group Policy Creator Owners,
Domain Admins,
Cert Publishers,
Domain Controllers,
Krbtgt,
Enterprise Admins,
Schema Admins,
Read-only Domain Controllers
* The information about Pre-Windows 2000 Compatible Access is qualified by the following product
behavior note.<37>
This section specifies the methods of the protocol along with their processing.
The return value space of all methods is the NTSTATUS type, specified in [MS-ERREF] section 2.3.
Unless specifically called out, error codes are returned to the client of the protocol and are not handled
by any special processing at the client; therefore, the exact error code is implementation-specific.
Cases in which the client might handle a specific error code are called out. The set of such error codes
are found in section 2.2.1.15.
Method Description
SamrCloseHandle Closes any context handle obtained from this RPC interface.
Opnum: 1
SamrSetSecurityObject Sets the access control on a server, domain, user, group, or alias
object.
Opnum: 2
SamrQuerySecurityObject Queries the access control on a server, domain, user, group, or alias
object.
Opnum: 3
132 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Method Description
Opnum: 6
SamrGetAliasMembership Obtains the union of all aliases of which a given set of SIDs is a
member.
Opnum: 16
133 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Method Description
134 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Method Description
135 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Method Description
In the preceding table, the phrase "Reserved for local use" means that the client MUST NOT send the
opnum, and the server behavior is undefined<38> because it does not affect interoperability.
The SAM Remote Protocol (Client-to-Server) recognizes five types of handles: Server, Domain, Group,
Alias, and User. A handle of each type can be obtained only by calling one of a well-defined set of
methods. These handles are listed in the following table.
Server SamrConnect
SamrConnect2
SamrConnect4
SamrConnect5
Domain SamrOpenDomain
Group SamrOpenGroup
Alias SamrOpenAlias
User SamrOpenUser
For example, to obtain any context handle to the server, one of the following methods MUST be
called: SamrConnect, SamrConnect2, SamrConnect4, or SamrConnect5. With the ServerHandle
parameter returned from these methods, it is possible to obtain other context handles and call any
associated methods on the handle. See section 4.1 for an example.
The server MUST keep track of all handles of each type that every caller opens, from the moment of
creation until the handle has been closed (by calling SamrCloseHandle, SamrDeleteGroup,
SamrDeleteAlias, or SamrDeleteUser) or until the client disconnects. The object referenced by a
handle can be edited, queried, deleted, or closed for as long as the handle is open, but not before or
after this state.
136 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The RPC protocol provides a mechanism to clean up any resources related to a context handle if a
client that is holding the context handle exits, dies, disconnects, or reboots. An implementation of this
protocol SHOULD use this functionality, as specified in [C706] section 5.1.6, Context Handle Rundown.
Note Except for the methods listed in the preceding table, all other methods listed in this section can
be called in any sequence to perform operations on the referenced object as long as its handle is
open.
Note The following methods do not require a context handle and can be called directly; they also do
not return any context handle:
SamrGetDomainPasswordInformation
SamrSetDSRMPassword
SamrValidatePassword
SamrOemChangePasswordUser2
SamrUnicodeChangePasswordUser2
Note A user account MUST be enabled by clearing the UF_ACCOUNTDISABLE bit from the
userAccountControl attribute before that account will be able to authenticate, as specified in [MS-
KILE] section 3.3.5.7.1.
These methods enable a client to obtain an RPC context handle to an existing object.
See section 1.7.2 for details on how to choose between SamrConnect variations.
On success, each of these methods returns a handle that references a database object in the
server's implementation.
long SamrConnect5(
[in, unique, string] PSAMPR_SERVER_NAME ServerName,
[in] unsigned long DesiredAccess,
[in] unsigned long InVersion,
[in] [switch_is(InVersion)] SAMPR_REVISION_INFO* InRevisionInfo,
[out] unsigned long* OutVersion,
[out, switch_is(*OutVersion)] SAMPR_REVISION_INFO* OutRevisionInfo,
[out] SAMPR_HANDLE* ServerHandle
);
ServerName: The null-terminated NETBIOS name of the server; this parameter MAY<39> be ignored
on receipt.
DesiredAccess: An ACCESS_MASK that indicates the access requested for ServerHandle on output.
For a listing of possible values, see section 2.2.1.3.
137 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
OutVersion: Indicates which field of the OutRevisionInfo union is used.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. The server MUST translate the following bits in DesiredAccess according to the following table.
Translate means to remove the "Incoming Bit" and replace with the "Translated Bits".
GENERIC_READ SAM_SERVER_READ
GENERIC_WRITE SAM_SERVER_WRITE
GENERIC_EXECUTE SAM_SERVER_EXECUTE
GENERIC_ALL SAM_SERVER_ALL_ACCESS
3. Let GrantedAccess be the union of all bits in the DesiredAccess column in the following table,
where the client has the specified access (shown in the Access Mask column) on the
ntSecurityDescriptor on S. [MS-ADTS] section 5.1.3.3.3 specifies how to determine the client's
access.
SAM_SERVER_CONNECT ACTRL_DS_READ_PROP
SAM_SERVER_SHUTDOWN ACTRL_DS_WRITE_PROP
SAM_SERVER_INITIALIZE ACTRL_DS_WRITE_PROP
SAM_SERVER_CREATE_DOMAIN ACTRL_DS_WRITE_PROP
SAM_SERVER_ENUMERATE_DOMAINS ACTRL_DS_READ_PROP
SAM_SERVER_LOOKUP_DOMAIN ACTRL_DS_READ_PROP
ACCESS_SYSTEM_SECURITY ACCESS_SYSTEM_SECURITY
WRITE_OWNER WRITE_OWNER
WRITE_DAC WRITE_DAC
DELETE DELETE
5. If DesiredAccess contains the MAXIMUM_ALLOWED bit, the server MUST create and return a
SamContextHandle (section 3.1.1.10) via ServerHandle, with its fields initialized as follows:
SamContextHandle.HandleType = "Server"
SamContextHandle.Object = S
SamContextHandle.GrantedAccess = GrantedAccess
138 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
6. If DesiredAccess does not contain the MAXIMUM_ALLOWED bit, the following constraint MUST be
satisfied:
SamContextHandle.HandleType = "Server"
SamContextHandle.Object = S
SamContextHandle.GrantedAccess = DesiredAccess
8. The server MUST set OutVersion to 1 and OutRevisionInfo.Revision to 3. The remaining fields of
OutRevisionInfo MUST be set to zero.
9. If any processing error occurred, the server MUST return that error. Otherwise, the server MUST
return STATUS_SUCCESS.
long SamrConnect4(
[in, unique, string] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE* ServerHandle,
[in] unsigned long ClientRevision,
[in] unsigned long DesiredAccess
);
ServerName: The null-terminated NETBIOS name of the server; this parameter MAY<40> be ignored
on receipt.
ClientRevision: Indicates the revision (for this protocol) of the client. The value MUST be set to 2 and
MUST be ignored.
DesiredAccess: An ACCESS_MASK that indicates the access requested for ServerHandle on output.
See section 2.2.1.3 for a listing of possible values.
The server MUST behave as with a call to SamrConnect5, with the following parameter values.
ServerName SamrConnect4.ServerName
DesiredAccess SamrConnect4.DesiredAccess
InVersion 1
139 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter name Parameter value
ServerHandle SamrConnect4.ServerHandle
long SamrConnect2(
[in, unique, string] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE* ServerHandle,
[in] unsigned long DesiredAccess
);
ServerName: The null-terminated NETBIOS name of the server; this parameter MAY<41> be ignored
on receipt.
DesiredAccess: An ACCESS_MASK that indicates the access requested for ServerHandle on output.
See section 2.2.1.3 for a listing of possible values.
The server MUST behave as with a call to SamrConnect5, with the following parameter values.
ServerName SamrConnect2.ServerName
DesiredAccess SamrConnect2.DesiredAccess
InVersion 1
ServerHandle SamrConnect2.ServerHandle
long SamrConnect(
[in, unique] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE* ServerHandle,
[in] unsigned long DesiredAccess
);
ServerName: The first character of the NETBIOS name of the server; this parameter MAY<42> be
ignored on receipt.
140 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
ServerHandle: An RPC context handle, as specified in section 2.2.3.2.
DesiredAccess: An ACCESS_MASK that indicates the access requested for ServerHandle upon output.
See section 2.2.1.3 for a listing of possible values.
The server MUST behave as with a call to SamrConnect5, with the following parameter values.
ServerName SamrConnect.ServerName
DesiredAccess SamrConnect.DesiredAccess
InVersion 1
ServerHandle SamrConnect.ServerHandle
long SamrOpenDomain(
[in] SAMPR_HANDLE ServerHandle,
[in] unsigned long DesiredAccess,
[in] PRPC_SID DomainId,
[out] SAMPR_HANDLE* DomainHandle
);
ServerHandle: An RPC context handle, as specified in section 2.2.3.2, representing a server object.
DesiredAccess: An ACCESS_MASK. See section 2.2.1.4 for a list of domain access values.
DomainId: A SID value of a domain hosted by the server side of this protocol.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints in no particular order:
3. The server MUST translate the following bits in DesiredAccess according to the following table.
Translate means to remove the "Incoming bit" and replace with the "Translated bits", as follows.
141 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Incoming bit Translated bits
GENERIC_READ DOMAIN_READ
GENERIC_WRITE DOMAIN_WRITE
GENERIC_EXECUTE DOMAIN_EXECUTE
GENERIC_ALL DOMAIN_ALL_ACCESS
4. Let D be the domain object whose objectSid is DomainId. If no such object exists, the server
MUST return an error code.
5. Let GrantedAccess be the union of all bits in the "DesiredAccess" column in the following table
where the client has the specified access (shown in the "Access mask" column) on the
ntSecurityDescriptor on D. A missing value in the "Object ACE type" column means that the
access mask applies to the entire object. [MS-ADTS] section 5.1.3.3.3 specifies how to
determine the client's access.
Object ACE
DesiredAccess Access mask type
DOMAIN_LIST_ACCOUNTS ACTRL_DS_LIST
DOMAIN_LOOKUP ACTRL_DS_LIST
ACCESS_SYSTEM_SECURITY ACCESS_SYSTEM_SECURITY
WRITE_OWNER WRITE_OWNER
142 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Object ACE
DesiredAccess Access mask type
WRITE_DAC WRITE_DAC
DELETE DELETE
7. If DesiredAccess contains the MAXIMUM_ALLOWED bit, the server MUST create and return a
SamContextHandle (section 3.1.1.10) via DomainHandle with its fields initialized as follows:
SamContextHandle.HandleType = "Domain"
SamContextHandle.Object = D
SamContextHandle.GrantedAccess = GrantedAccess
8. If DesiredAccess does not contain the MAXIMUM_ALLOWED bit, the following constraint MUST be
satisfied:
SamContextHandle.HandleType = "Domain"
SamContextHandle.Object = D
SamContextHandle.GrantedAccess = DesiredAccess
9. If any processing error occurred, the server MUST return that error. Otherwise, the server MUST
return STATUS_SUCCESS to the client.
This section specifies the message processing for SamrOpenGroup (section 3.1.5.1.7),
SamrOpenAlias (section 3.1.5.1.8), and SamrOpenUser (section 3.1.5.1.9). Each one of these
methods specifies the following "input" parameters for this common processing:
Desired-Access-Mapping-Table: A table that maps access masks specific to this protocol to object
ACE values. An example access mask specific to this protocol is USER_READ (section 2.2.1.7).
Output-Handle: An RPC context handle returned to the client that represents the object that is
requested to be opened.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
143 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3. The server MUST translate the bits in DesiredAccess according to the Generic-Access-Mask-
Mapping-Table.
5. Let GrantedAccess be the union of all bits in the "DesiredAccess" column in the Desired-Access-
Mapping-Table, where the client has the specified access (shown in the "Access mask" column) on
the ntSecurityDescriptor on Target-Object. A missing value in the "Object ACE type" column
means that the access mask applies to the entire object. [MS-ADTS] section 5.1.3.3.3 specifies
how to determine the client's access.
6. If DesiredAccess contains the MAXIMUM_ALLOWED bit, the server MUST create and return a
SamContextHandle (section 3.1.1.10) via Output-Handle with its fields initialized as follows:
SamContextHandle.Object = A
SamContextHandle.GrantedAccess = GrantedAccess
7. If DesiredAccess does not contain the MAXIMUM_ALLOWED bit, the following constraint MUST be
satisfied:
SamContextHandle.Object = A
SamContextHandle.GrantedAccess = DesiredAccess
8. If any processing error occurred, the server MUST return that error. Otherwise, the server MUST
return STATUS_SUCCESS to the client.
long SamrOpenGroup(
[in] SAMPR_HANDLE DomainHandle,
[in] unsigned long DesiredAccess,
[in] unsigned long GroupId,
[out] SAMPR_HANDLE* GroupHandle
);
DesiredAccess: An ACCESS_MASK that indicates the requested access for the returned handle. See
section 2.2.1.5 for a list of group access values.
144 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message according to the
constraints in section 3.1.5.1.6, with the following values:
Target-Rid: GroupId
Target-Object-Type: a group object (that is, a database with the objectClass group or derived
from group) and groupType containing GROUP_TYPE_ACCOUNT_GROUP or
GROUP_TYPE_UNIVERSAL_GROUP.
Generic-Access-Mask-Mapping-Table:
GENERIC_READ GROUP_READ
GENERIC_WRITE GROUP_WRITE
GENERIC_EXECUTE GROUP_EXECUTE
GENERIC_ALL GROUP_ALL_ACCESS
Desired-Access-Mapping-Table:
ACCESS_SYSTEM_SECURITY ACCESS_SYSTEM_SECURITY
WRITE_OWNER WRITE_OWNER
WRITE_DAC WRITE_DAC
DELETE DELETE
Output-Handle: GroupHandle
long SamrOpenAlias(
[in] SAMPR_HANDLE DomainHandle,
[in] unsigned long DesiredAccess,
[in] unsigned long AliasId,
[out] SAMPR_HANDLE* AliasHandle
);
145 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DomainHandle: An RPC context handle, as specified in section 2.2.3.2, representing a domain
object.
DesiredAccess: An ACCESS_MASK that indicates the requested access for the returned handle. See
section 2.2.1.6 for a list of alias access values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message according to the
constraints in section 3.1.5.1.6, with the following values:
Target-Rid: AliasId
Target-Object-Type: A group object (that is, a database with the objectClass group or derived
from group) and groupType containing GROUP_TYPE_RESOURCE_GROUP.
Generic-Access-Mask-Mapping-Table:
GENERIC_READ ALIAS_READ
GENERIC_WRITE ALIAS_WRITE
GENERIC_EXECUTE ALIAS_EXECUTE
GENERIC_ALL ALIAS_ALL_ACCESS
Desired-Access-Mapping-Table:
ACCESS_SYSTEM_SECURITY ACCESS_SYSTEM_SECURITY
WRITE_OWNER WRITE_OWNER
WRITE_DAC WRITE_DAC
DELETE DELETE
Output-Handle: AliasHandle
146 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
long SamrOpenUser(
[in] SAMPR_HANDLE DomainHandle,
[in] unsigned long DesiredAccess,
[in] unsigned long UserId,
[out] SAMPR_HANDLE* UserHandle
);
DesiredAccess: An ACCESS_MASK that indicates the requested access for the returned handle. See
section 2.2.1.7 for a list of user access values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message according to the
constraints in section 3.1.5.1.6, with the following values:
Target-Rid: UserId
Target-Object-Type: A user object (that is, a database with the objectClass user or derived from
user).
Generic-Access-Mask-Mapping-Table:
GENERIC_READ USER_READ
GENERIC_WRITE USER_WRITE
GENERIC_EXECUTE USER_EXECUTE
GENERIC_ALL USER_ALL_ACCESS
Desired-Access-Mapping-Table:
147 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DesiredAccess Access mask Object ACE type
00c04fc2d3cf
USER_READ_GROUP_INFORMATION ACTRL_DS_READ_PROP
USER_WRITE_GROUP_INFORMATION ACTRL_DS_WRITE_PROP
ACCESS_SYSTEM_SECURITY ACCESS_SYSTEM_SECURITY
WRITE_OWNER WRITE_OWNER
WRITE_DAC WRITE_DAC
DELETE DELETE
Output-Handle: UserHandle
These methods enable a client to obtain a listing of all objects of a certain type. With the exception of
SamrEnumerateDomainsInSamServer, which requires a server handle, these methods require a
domain handle from the "open" pattern of methods (section 3.1.5.1).
long SamrEnumerateDomainsInSamServer(
[in] SAMPR_HANDLE ServerHandle,
[in, out] unsigned long* EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER* Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long* CountReturned
);
ServerHandle: An RPC context handle, as specified in section 2.2.3.2, representing a server object.
EnumerationContext: This value is a cookie that the server can use to continue an enumeration on a
subsequent call. It is an opaque value to the client. To initiate a new enumeration, the client sets
EnumerationContext to zero. Otherwise the client sets EnumerationContext to a value returned by
a previous call to the method.
148 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Buffer: A listing of domain information, as described in section 2.2.3.10.
This method asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. The server MUST enable a client to obtain a listing, without duplicates, of the following two values:
the name attribute of the account domain object and the name attribute of the built-in
domain object.
4. EnumerationContext MUST be used to allow the client implementation to pass back to the server,
on a subsequent call, information on the last database object that was returned using
EnumerationContext.
5. Servers SHOULD<43> validate that EnumerationContext is an expected value for the server's
implementation.
6. The server SHOULD<44> fill Buffer.Buffer with as many entries as possible, such that not more
than PreferedMaximumLength bytes are returned in Buffer.Buffer. If the server returns more than
PreferedMaximumLength bytes, the difference between PreferedMaximumLength and the actual
number of bytes returned MUST be less than the maximum size, in bytes, of one entry in the
array Buffer.Buffer.
7. Each element of Buffer.Buffer MUST represent one database object that matches the criteria from
item 2 above, and MUST be filled as follows:
2. Buffer.Buffer.RelativeId is 0.
9. STATUS_MORE_ENTRIES MUST be returned if the server returns less than all of the database
objects in Buffer.Buffer because of the PreferedMaximumLength restriction described above. Note
that this return value is not an error status.
10. If there are no entries or Buffer.Buffer contains all matching database objects that remain, the
server MUST return STATUS_SUCCESS.
Let the term "session" refer to a set of sequential enumerate method calls made by a client, starting
with an EnumerationContext parameter of value 0 and ending with an enumerate method that returns
STATUS_SUCCESS. The methods MUST be the same type; for example, a session is a sequence of
149 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrEnumerateGroupsInDomain method calls, not a SamrEnumerateGroupsInDomain method call
followed by a SamrEnumerateUsersInDomain method call.
As an example, recall that EnumerationContext is a 32-bit value. Because of this fact, a possible
choice of cookie could be the RID of the last account that was returned. Upon receiving a nonzero
cookie, the server can determine the next account that needs to be returned. Note that this example
depends on the server returning the accounts in RID sort order; however, this method has no
constraint about sort order.
[MS-DRSR] section 4.1.11.3 has information on another IDL method, IDL_DRSGetNT4ChangeLog, that
uses a "cookie" mechanism.
Upon receipt of one of the messages, the server MUST process the data from the message, subject to
the following constraints:
3. The server MUST enable a client to obtain a listing, without duplicates, of all database objects
that satisfy the criteria of Enumerate-Filter.
4. The server MUST use EnumerationContext to allow the client implementation to pass back to the
server, on a subsequent call, information on the last database object that was returned using
EnumerationContext.
If an object that satisfies Enumerate-Filter is added between successive Enumerate method calls
in a session, and said object has a RID that is greater than the RIDs of all objects returned in
previous calls, the server MUST return said object before the enumeration is complete.
If an object that satisfies Enumerate-Filter is deleted between successive Enumerate method calls
in a session, and said object has not already been returned by a previous method call in the
session, the server MUST NOT return said object before the enumeration is complete.
5. The server SHOULD<45> validate that EnumerationContext is an expected value for the server's
implementation.
6. The server SHOULD<46> fill Buffer.Buffer with as many entries as possible, such that not more
than PreferedMaximumLength bytes are returned in Buffer.Buffer. If the server returns more than
PreferedMaximumLength bytes, the difference between PreferedMaximumLength and the actual
number of bytes returned MUST be less than the maximum size, in bytes, of one entry in the
array Buffer.Buffer.
7. Each element of Buffer.Buffer MUST represent one database object that matches the Enumerate-
Filter and MUST be set as follows:
9. STATUS_MORE_ENTRIES MUST be returned if the server returns less than all of the database
objects in Buffer.Buffer because of the PreferedMaximumLength restriction described above. Note
that this return value is not an error status.
150 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
10. If there are no entries or if Buffer.Buffer contains all matching database objects that remain, the
server MUST return STATUS_SUCCESS.
long SamrEnumerateGroupsInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, out] unsigned long* EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER* Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long* CountReturned
);
EnumerationContext: This value is a cookie that the server can use to continue an enumeration on a
subsequent call. It is an opaque value to the client. To initiate a new enumeration, the client sets
EnumerationContext to zero. Otherwise, the client sets EnumerationContext to a value returned by
a previous call to the method.
This method asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
This method MUST be processed per the specifications in section 3.1.5.2.2 using the following object
selection filter:
3. The objectSid attribute value MUST have the domain prefix of the domain referenced by
DomainHandle.
long SamrEnumerateAliasesInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, out] unsigned long* EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER* Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long* CountReturned
);
151 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
EnumerationContext: This value is a cookie that the server can use to continue an enumeration on a
subsequent call. It is an opaque value to the client. To initiate a new enumeration the client sets
EnumerationContext to zero. Otherwise the client sets EnumerationContext to a value returned by
a previous call to the method.
This method asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
This method MUST be processed per the specifications in section 3.1.5.2.2 using the following object
selection filter:
3. The objectSid attribute value MUST have the domain prefix of the domain referenced by
DomainHandle.
long SamrEnumerateUsersInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, out] unsigned long* EnumerationContext,
[in] unsigned long UserAccountControl,
[out] PSAMPR_ENUMERATION_BUFFER* Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long* CountReturned
);
EnumerationContext: This value is a cookie that the server can use to continue an enumeration on a
subsequent call. It is an opaque value to the client. To initiate a new enumeration the client sets
EnumerationContext to zero. Otherwise the client sets EnumerationContext to a value returned by
a previous call to the method.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
This method MUST be processed per the specifications in section 3.1.5.2.2, using the following object
selection filter:
152 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. The objectClass attribute value MUST be user or derived from user.
2. The userAccountControl attribute value MUST contain all the bits in the method parameter
UserAccountControl.
3. The objectSid attribute value MUST have the domain prefix of the domain referenced by
DomainHandle.
In addition, all of the following constraints MUST be satisfied before the constraints of section
3.1.5.2.2 are satisfied:
1. If DomainHandle.Object is a reference to the account domain and the configuration is DC, the
client MUST have the SAM-Enumerate-Entire-Domain control access right ([MS-ADTS] section
5.1.3.2.1) on the domain's ntSecurityDescriptor attribute value.
2. The server MUST ignore the UF_LOCKOUT and UF_PASSWORD_EXPIRED bits in the
UserAccountControl parameter.
The client use pattern for these methods is a call to SamrGetDisplayEnumerationIndex2, followed by a
call to SamrQueryDisplayInformation3, passing in the state returned by
SamrGetDisplayEnumerationIndex2. This state is used as an index to indicate the account at which
SamrQueryDisplayInformation3 will start its enumeration. The client can also choose to skip the call to
SamrGetDisplayEnumerationIndex2 and begin the enumeration by calling
SamrQueryDisplayInformation3, specifying an index of zero. With either use pattern, the client can
continue the enumeration process by calling SamrQueryDisplayInformation3 repeatedly, specifying on
each call the Index value of the last account returned in the previous call.
These methods require a domain handle from the "open" pattern of methods (section 3.1.5.1).
The server MAY<47> cache implementation-specific details about the ongoing state of the
enumeration on the domain handle; clients therefore MUST follow one of the use patterns described
previously in order to produce deterministic results.
See section 1.7.2 for details on how to choose between SamrQueryDisplayInformation and
SamrGetDisplayEnumerationIndex variations.
See section 1.3 for a description of the "selective enumerate" pattern of methods.
long SamrQueryDisplayInformation3(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
153 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DisplayInformationClass: An enumeration (see section 2.2.8.12) that indicates the type of
accounts, as well as the type of attributes on the accounts, to return via the Buffer parameter.
PreferredMaximumLength: The requested maximum number of bytes to return in Buffer; this value
overrides EntryCount if this value is reached before EntryCount is reached.
TotalAvailable: The number of bytes required to see a complete listing of accounts specified by the
DisplayInformationClass parameter.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. This method MUST return a set of database objects, sorted by their sAMAccountName
attribute value, that match the following criteria for the given DisplayInformationClass.
DomainDisplayUser All user objects (or those derived from user) in the domain referenced by
DomainHandle.Object with userAccountControl containing the
UF_NORMAL_ACCOUNT bit.
DomainDisplayMachine All user objects (or those derived from user) in the domain referenced by
DomainHandle.Object with userAccountControl containing the
UF_WORKSTATION_TRUST_ACCOUNT or UF_SERVER_TRUST_ACCOUNT bit.
DomainDisplayGroup All group objects (or those derived from group) in the domain referenced by
DomainHandle.Object with groupType equal to
GROUP_TYPE_SECURITY_UNIVERSAL or GROUP_TYPE_SECURITY_ACCOUNT.
DomainDisplayOemUser All user objects (or those derived from user) in both the account domain and the
built-in domain with userAccountControl containing the UF_NORMAL_ACCOUNT
bit.
DomainDisplayOemGroup All group objects (or those derived from group) in both the account domain and the
built-in domain with groupType equal to GROUP_TYPE_SECURITY_UNIVERSAL or
GROUP_TYPE_SECURITY_ACCOUNT.
4. Let L be a list of accounts, sorted by sAMAccountName, that match the above criteria. If the
Index parameter is nonzero, the server MUST return objects starting from the position in L implied
by the implementation-specific cookie (carried in the Index parameter). If the Index parameter is
zero, the server MUST start at the beginning of L. If the implementation-specific cookie refers to
an object that has been deleted since the time at which the cookie was created, the server MUST
return objects, if any, starting from the next position in L.
154 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
5. For each candidate object to return, the server MUST fill an element in the Buffer output
parameter according to the following table.
Index Any unsigned integer such that there are no duplicates in the set of values returned in Buffer;
that is, each element has a unique Index. There is no requirement on the ordering of Index
values.<49>
6. If a processing error occurs, the server MUST return that error. Otherwise, the server MUST return
STATUS_SUCCESS.
long SamrQueryDisplayInformation2(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
[in] unsigned long PreferredMaximumLength,
[out] unsigned long* TotalAvailable,
[out] unsigned long* TotalReturned,
[out, switch_is(DisplayInformationClass)]
PSAMPR_DISPLAY_INFO_BUFFER Buffer
);
See the description of SamrQueryDisplayInformation3 (section 3.1.5.3.1) for details, because the
method-interface arguments and message processing are identical.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrQueryDisplayInformation3, with the following
parameter values.
155 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter name Parameter value
DomainHandle SamrQueryDisplayInformation2.DomainHandle
DisplayInformationClass SamrQueryDisplayInformation2.DisplayInformationClass
Index SamrQueryDisplayInformation2.Index
EntryCount SamrQueryDisplayInformation2.EntryCount
PreferredMaximumLength SamrQueryDisplayInformation2.PreferredMaximumLength
TotalAvailable SamrQueryDisplayInformation2.TotalAvailable
TotalReturned SamrQueryDisplayInformation2.TotalReturned
Buffer SamrQueryDisplayInformation2.Buffer
long SamrQueryDisplayInformation(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
[in] unsigned long PreferredMaximumLength,
[out] unsigned long* TotalAvailable,
[out] unsigned long* TotalReturned,
[out, switch_is(DisplayInformationClass)]
PSAMPR_DISPLAY_INFO_BUFFER Buffer
);
See the description of SamrQueryDisplayInformation3 (section 3.1.5.3.1) for details, because the
method interface arguments and message processing are identical.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrQueryDisplayInformation3, with the following
parameter values.
DomainHandle SamrQueryDisplayInformation.DomainHandle
DisplayInformationClass SamrQueryDisplayInformation.DisplayInformationClass
Index SamrQueryDisplayInformation.Index
EntryCount SamrQueryDisplayInformation.EntryCount
PreferredMaximumLength SamrQueryDisplayInformation.PreferredMaximumLength
TotalAvailable SamrQueryDisplayInformation.TotalAvailable
156 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter name Parameter value
TotalReturned SamrQueryDisplayInformation.TotalReturned
Buffer SamrQueryDisplayInformation.Buffer
long SamrGetDisplayEnumerationIndex2(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] PRPC_UNICODE_STRING Prefix,
[out] unsigned long* Index
);
Prefix: A string matched against the account name to find a starting point for an enumeration. The
Prefix parameter enables the client to obtain a listing of an account from
SamrQueryDisplayInformation3 such that the accounts are returned in alphabetical order with
respect to their account name, starting with the account name that most closely matches Prefix.
See details later in this section.
Index: A value to use as input to SamrQueryDisplayInformation3 in order to control the accounts that
are returned from that method.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. If DisplayInformationClass is not one of the following values, the server MUST return an error
code: DomainDisplayUser, DomainDisplayMachine, DomainDisplayGroup.
4. If no accounts exist of the type specified in DisplayInformationClass, the server MUST return
STATUS_NO_MORE_ENTRIES.
5. The output parameter called Index MUST be returned as an index into a one-based-indexed list of
database objects sorted by their sAMAccountName attribute value. The index is the position of
the element that just precedes the element whose sAMAccountName generates the longest
substring match starting at the beginning of the string with the Prefix input parameter. If no such
element exists, the server MUST return STATUS_NO_MORE_ENTRIES.
157 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
6. The list of directory objects MUST correspond to DisplayInformationClass as follows.
DomainDisplayUser All user objects (or those derived from user) with userAccountControl
containing the UF_NORMAL_ACCOUNT bit.
DomainDisplayMachine All user objects (or those derived from user) with userAccountControl containing
the UF_WORKSTATION_TRUST_ACCOUNT or UF_SERVER_TRUST_ACCOUNT bit.
long SamrGetDisplayEnumerationIndex(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] PRPC_UNICODE_STRING Prefix,
[out] unsigned long* Index
);
See the description of SamrGetDisplayEnumerationIndex2 (section 3.1.5.3.4) for details, because the
method-interface arguments and processing are identical.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrGetDisplayEnumerationIndex2, with the following
parameter values.
DomainHandle SamrGetDisplayEnumerationIndex.DomainHandle
DisplayInformationClass SamrGetDisplayEnumerationIndex.DisplayInformationClass
Prefix SamrGetDisplayEnumerationIndex.Prefix
Index SamrGetDisplayEnumerationIndex.Index
These methods enable a client to create a group, alias, or user object. These methods require a
domain handle from the "open" pattern of methods (section 3.1.5.1).
See section 1.7.2 for details on how to choose between the SamrCreateUserInDomain and
SamrCreateUser2InDomain variations.
158 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This section specifies message processing that is common for SamrCreateAliasInDomain and
SamrCreateGroupInDomain. The explanation of each method specifies a groupType attribute to use
during group and alias creation, and a section containing valid access mask values; these values are
referred to in this section by the terms Provided-Group-Type and Provided-Access-Mask-Section.
Upon receiving this message, the server MUST process the data from the message, subject to the
following constraints:
3. If DomainHandle.Object refers to the built-in domain, the server MUST abort the request and
return a failure code.
4. All updates caused by this request MUST be performed in the same transaction.
5. On successful completion of this method, a new database object MUST be created (subsequent
constraints specify attributes for this new object).
6. The following database attribute MUST be updated from the values provided in the message per
the following table.
sAMAccountName Name
7. The distinguishedName database attribute MUST be updated with a value that conforms to the
constraints as specified in section 3.1.5.14.1.
8. The objectClass database attribute MUST be updated with the value group.
9. The groupType database attribute MUST be updated with the value Provided-Group-Type.
10. The security model for object creation specified in [MS-ADTS] section 5.1.3 MUST be adhered to.
11. Granted access MUST be set to DesiredAccess if DesiredAccess contains only valid access masks,
according to Provided-Access-Mask-Section and section 2.2.1.1 (common Access Masks);
otherwise, the request MUST be aborted and STATUS_ACCESS_DENIED MUST be returned.
12. If DesiredAccess contains the ACCESS_SYSTEM_SECURITY bit, the client's token MUST be
retrieved using the method described in [MS-RPCE] section 3.3.3.4.3. The
RpcImpersonationAccessToken.Privileges[] field MUST have the SE_SECURITY_NAME
privilege (defined in [MS-LSAD] section 3.1.1.2.1). Otherwise, the server MUST abort processing
and return STATUS_ACCESS_DENIED.
long SamrCreateGroupInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE* GroupHandle,
[out] unsigned long* RelativeId
);
159 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DomainHandle: An RPC context handle, as specified in section 2.2.3.2, representing a domain
object.
Name: The value to use as the name of the group. Details on how this value maps to the data model
are provided later in this section.
DesiredAccess: The access requested on the GroupHandle on output. See section 2.2.1.5 for a listing
of possible values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
This method MUST be processed per the specifications in section 3.1.5.4.1, using a group type of
GROUP_TYPE_SECURITY_ACCOUNT and using access mask values from section 2.2.1.5.
long SamrCreateAliasInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING AccountName,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE* AliasHandle,
[out] unsigned long* RelativeId
);
AccountName: The value to use as the name of the alias. Details on how this value maps to the data
model are provided later in this section.
DesiredAccess: The access requested on the AliasHandle on output. See section 2.2.1.6 for a listing
of possible values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
This method MUST be processed per the specifications in section 3.1.5.4.1, using a group type of
GROUP_TYPE_SECURITY_RESOURCE and using access mask values from section 2.2.1.6.
long SamrCreateUser2InDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long AccountType,
160 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE* UserHandle,
[out] unsigned long* GrantedAccess,
[out] unsigned long* RelativeId
);
Name: The value to use as the name of the user. See the message processing shown later in this
section for details on how this value maps to the data model.
AccountType: A 32-bit value indicating the type of account to create. See the message processing
shown later in this section for possible values.
DesiredAccess: The access requested on the UserHandle on output. See section 2.2.1.7 for a listing
of possible values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. If DomainHandle.Object refers to the built-in domain, the server MUST abort the request and
return a failure code.
4. The AccountType parameter from the message MUST be equal to exactly one value from the
following list. If there is no match, an error status MUST be returned.
USER_NORMAL_ACCOUNT
USER_WORKSTATION_TRUST_ACCOUNT
USER_SERVER_TRUST_ACCOUNT
5. All updates caused by this request MUST be performed in the same transaction.
6. On successful completion of this method, a new database object MUST be created (subsequent
constraints specify attributes for this new object).
7. The following database attribute MUST be updated from the values provided in the message
according to the following table.
sAMAccountName Name
161 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
8. The distinguishedName attribute MUST be updated with a value that conforms to the constraints
as specified in section 3.1.5.14.1. Let the term Container-Object be the object with the
distinguishedName of the suffix chosen in section 3.1.5.14.1 for the new object. For a computer
object, for example, Container-Object is, by default, the object with the distinguishedName
CN=Computers,<DN of account domain object>.
9. The objectClass database attribute MUST be updated with a value determined as follows:
10. The client's token MUST be retrieved using the method described in [MS-RPCE] section 3.3.3.4.3.
11. The userAccountControl attribute MUST be updated with a value from the following table.
AccountType is the AccountType parameter from the message.
AccountType userAccountControl
*If all the following conditions hold true, then the userAccountControl attribute MUST be
updated only with the UF_WORKSTATION_TRUST_ACCOUNT value.
The client does not have the ACTRL_DS_CREATE_CHILD access on the Container-Object
object.
12. The security model for object creation specified in [MS-ADTS] section 5.1.3 MUST NOT be adhered
to.
13. If the client does not have the ACTRL_DS_CREATE_CHILD access right on the Container-Object
object, the client is not otherwise denied access due to an explicit DENY ACE<50>, and the
AccountType parameter is USER_WORKSTATION_TRUST_ACCOUNT, then:
1. On a DC configuration:
2. Else:
1. Let CallerSid be
RpcImpersonationAccessToken.Sids[RpcImpersonationAccessToken.UserIndex].
162 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. The number of computer objects in the domain with msDS-creatorSID equal to
CallerSid MUST be less than the value of ms-DS-MachineAccountQuota on the
account domain object. On error, abort and return a failure code.
1. If the domain SID portion of CallerSid is different from the current domain SID,
return a failure code.
2. The server MUST compute the sum of all computer objects in the domain created
by CallerSid and transitively created by other computer objects created by
CallerSid. This sum MUST be less than the value of ms-DS-MachineAccountQuota
on the account domain object. On error, abort and return a failure code.
2. The owner and group of the default security descriptor MUST be the Domain
Admins SID for the domain in which the account is created.
2. On a non-DC configuration:
14. The return parameter of GrantedAccess MUST be set to DesiredAccess if DesiredAccess contains
only valid access masks for the user object (see section 2.2.1.7); otherwise, the request MUST
be aborted and STATUS_ACCESS_DENIED MUST be returned. Additionally, on a DC configuration,
if the creation occurred because of a privilege (see step 13.1), the returned GrantedAccess MUST
be restricted by the intersection of DesiredAccess and the following bits:
DELETE
USER_WRITE
USER_FORCE_PASSWORD_CHANGE
long SamrCreateUserInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE* UserHandle,
[out] unsigned long* RelativeId
);
Name: The value to use as the name of the user. See the message processing shown later in this
section for details on how this value maps to the data model.
163 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DesiredAccess: The access requested on the UserHandle on output. See section 2.2.1.7 for a listing
of possible values.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrCreateUser2InDomain with the following parameter
values.
DomainHandle SamrCreateUserInDomain.DomainHandle
Name SamrCreateUserInDomain.Name
AccountType USER_NORMAL_ACCOUNT
DesiredAccess SamrCreateUserInDomain.DesiredAccess
UserHandle SamrCreateUserInDomain.UserHandle
RelativeId SamrCreateUserInDomain.RelativeId
These methods enable a client to read attributes about a domain, group, alias, or user object.
A client MUST first obtain a handle to the object through an "open" or a "create" method. See sections
3.1.5.1 and 3.1.5.4.
See section 1.7.2 for details on how to choose between SamrQueryInformationDomain and
SamrQueryInformationDomain2 variations.
long SamrQueryInformationDomain2(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[out, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER* Buffer
);
164 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Buffer: The requested attributes on output. See section 2.2.4.17 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. The following information levels MUST be processed by setting the appropriate output field name
to the associated database attribute, as specified in section 3.1.5.14.8. Processing is completed by
returning 0 on success.
DomainInformationClass
DomainPasswordInformation
DomainLockoutInformation
DomainLogoffInformation
DomainOemInformation
DomainNameInformation
DomainModifiedInformation
DomainModifiedInformation2
DomainReplicationInformation
4. If DomainInformationClass does not meet the criteria of constraint 3, the constraints associated
with the DomainInformationClass input value in the following subsections MUST be satisfied; if
there is no subsection for the DomainInformationClass value, an error MUST be returned to the
client.
3.1.5.5.1.1 DomainGeneralInformation
If the server is a DC and the fsmoRoleOwner attribute value of the account domain object is
equal to the distinguishedName attribute value of the server's computer object, the
Buffer.General.DomainServerRole field MUST be set to DomainServerRolePrimary.
4. The Buffer.General.UserCount field SHOULD<52> be the count of objects with the objectClass
user (or derived from user).
165 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
5. The Buffer.General.GroupCount field SHOULD<53> be the count of objects with the objectClass
group (or derived from group) and a groupType attribute value of
GROUP_TYPE_SECURITY_ACCOUNT.
6. The Buffer.General.AliasCount field SHOULD<54> be the count of objects with the objectClass
group (or derived from group) and a groupType attribute value of
GROUP_TYPE_SECURITY_RESOURCE.
7. The server MUST use the database attribute value on the directory object referred to by
DomainHandle.Object to set the Buffer fields not already set in the steps above, according to the
table in section 3.1.5.14.8.
3.1.5.5.1.2 DomainServerRoleInformation
If the server is not a domain controller (DC), the Buffer.Role.DomainServerRole field MUST be
set to DomainServerRolePrimary.
If the server is a DC and the fsmoRoleOwner attribute value of the account domain object is equal
to the distinguishedName attribute value of the server's computer object, the
Buffer.Role.DomainServerRole field MUST be set to DomainServerRolePrimary.
3.1.5.5.1.3 DomainStateInformation
3.1.5.5.1.4 DomainGeneralInformation2
The server MUST process this call as two calls to SamrQueryInformationDomain with the information
levels of DomainGeneralInformation and DomainLockoutTime, but all in the same transaction. The
output fields MUST be set as follows.
Buffer.General2.I1 SAMPR_DOMAIN_GENERAL_INFORMATION
Buffer.General2.LockoutDuration SAMPR_DOMAIN_LOCKOUT_INFORMATION.LockoutDuration
Buffer.General2.LockoutObservationWindo SAMPR_DOMAIN_LOCKOUT_INFORMATION.LockoutObservationWind
w ow
Buffer.General2.LockoutThreshold SAMPR_DOMAIN_LOCKOUT_INFORMATION.LockoutThreshold
long SamrQueryInformationDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[out, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER* Buffer
);
See the description of SamrQueryInformationDomain2 (section 3.1.5.5.1) for details, because the
method interface arguments and message processing are identical.
166 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrQueryInformationDomain2, with the following
parameter values.
DomainHandle SamrQueryInformationDomain.DomainHandle
DomainInformationClass SamrQueryInformationDomain.DomainInformationClass
Buffer SamrQueryInformationDomain.Buffer
long SamrQueryInformationGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] GROUP_INFORMATION_CLASS GroupInformationClass,
[out, switch_is(GroupInformationClass)]
PSAMPR_GROUP_INFO_BUFFER* Buffer
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
Buffer: The requested attributes on output. See section 2.2.5.7 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. The following information levels MUST be processed by setting the appropriate output field name
to either the associated database attribute or the value resulting from the associated processing
rules, as specified in section 3.1.5.14.9. Processing is completed by returning 0 on success.
GroupInformationClass
GroupGeneralInformation
GroupNameInformation
GroupAttributeInformation
GroupAdminCommentInformation
167 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. If GroupInformationClass does not meet the criteria of constraint 3, the constraints associated
with the GroupInformationClass input value in the following subsections MUST be satisfied; if there
is no subsection for the GroupInformationClass value, an error MUST be returned to the client.
3.1.5.5.3.1 GroupReplicationInformation
This information level is an anomaly in that it sets the Buffer fields for General, whereas in the union
structure of SAMPR_GROUP_INFO_BUFFER (section 2.2.5.7) the information level is associated with a
different field (named DoNotUse).
The server MUST use the database attribute value on the directory object referred to by
GroupHandle.Object to set the outgoing method parameters as shown in the following table.
Buffer.General.Name sAMAccountName
Buffer.General.AdminComment description
Buffer.General.MemberCount 0
long SamrQueryInformationAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] ALIAS_INFORMATION_CLASS AliasInformationClass,
[out, switch_is(AliasInformationClass)]
PSAMPR_ALIAS_INFO_BUFFER* Buffer
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
AliasInformationClass: An enumeration indicating which attributes to return. See section 2.2.6.5 for
a listing of possible values.
Buffer: The requested attributes on output. See section 2.2.6.6 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
3. The following information levels MUST be processed by setting the appropriate output field name
to the associated database attribute, as specified in section 3.1.5.14.10. Processing is completed
by returning 0 on success. If the presented information level is not in the following table, the
server MUST return an error.
168 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
AliasInformationClass
AliasGeneralInformation
AliasNameInformation
AliasAdminCommentInformation
long SamrQueryInformationUser2(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[out, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER* Buffer
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
Buffer: The requested attributes on output. See section 2.2.7.29 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
4. The following bits in Buffer.All.WhichFields, and their corresponding field values, MUST never be
returned by the server.
WhichFields bits
USER_ALL_NTPASSWORDPRESENT
0x01000000
USER_ALL_LMPASSWORDPRESENT
0x02000000
USER_ALL_PRIVATEDATA
0x04000000
USER_ALL_PASSWORDEXPIRED
169 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
WhichFields bits
0x08000000
USER_ALL_SECURITYDESCRIPTOR
0x10000000
1. UserHandle.GrantedAccess MUST have the required access shown in the following table; on error,
the server MUST return STATUS_ACCESS_DENIED. If there is no match on Information Level, the
server MUST return an error.
UserGeneralInformation USER_READ_GENERAL
UserPrimaryGroupInformation USER_READ_GENERAL
UserNameInformation USER_READ_GENERAL
UserAccountNameInformation USER_READ_GENERAL
UserFullNameInformation USER_READ_GENERAL
UserAdminCommentInformation USER_READ_GENERAL
UserLogonHoursInformation USER_READ_LOGON
UserHomeInformation USER_READ_LOGON
UserScriptInformation USER_READ_LOGON
UserProfileInformation USER_READ_LOGON
UserWorkStationsInformation USER_READ_LOGON
UserControlInformation USER_READ_ACCOUNT
UserExpiresInformation USER_READ_ACCOUNT
(*) In the DC configuration, this handle-based check MUST be relaxed if the client has
ACTRL_DS_READ_PROP access on the userParameters attribute (globally unique identifier
(GUID) bf967a6d-0de6-11d0-a285-00aa003049e2).
170 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
requested. On return, the requested fields MUST be set to the value of the field with the same
name in the SAMPR_USER_ALL_INFORMATION structure.
General.UserName UserName
General.FullName FullName
General.PrimaryGroupId PrimaryGroupId
General.AdminComment AdminComment
General.UserComment UserComment
3.1.5.5.5.2 UserAllInformation
1. The server MUST set the fields of Buffer.All based on the access granted in
UserHandle.GrantedAccess. The following table normatively specifies the value that the server
MUST set in the Buffer.All.WhichFields field. If UserHandle.GrantedAccess does not have any of
the Access Granted bits from this table, the server MUST return STATUS_ACCESS_DENIED.
USER_READ_GENERAL USER_ALL_USERNAME
USER_ALL_FULLNAME
USER_ALL_USERID
USER_ALL_PRIMARYGROUPID
USER_ALL_ADMINCOMMENT
USER_ALL_USERCOMMENT
USER_READ_LOGON USER_ALL_HOMEDIRECTORY
USER_ALL_HOMEDIRECTORYDRIVE
USER_ALL_SCRIPTPATH
USER_ALL_PROFILEPATH
USER_ALL_WORKSTATIONS
USER_ALL_LASTLOGON
USER_ALL_LASTLOGOFF
USER_ALL_LOGONHOURS
USER_ALL_BADPASSWORDCOUNT
USER_ALL_LOGONCOUNT
USER_ALL_PASSWORDCANCHANGE
USER_ALL_PASSWORDMUSTCHANGE
USER_READ_ACCOUNT USER_ALL_PASSWORDLASTSET
USER_ALL_ACCOUNTEXPIRES
USER_ALL_USERACCOUNTCONTROL
USER_ALL_PARAMETERS
USER_READ_PREFERENCES USER_ALL_COUNTRYCODE
171 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Access granted WhichFields
USER_ALL_CODEPAGE
2. Using the tables in sections 2.2.1.8 and 3.1.5.14.11, the server MUST set the appropriate fields in
the Buffer parameter. The first table (section 2.2.1.8) lists the WhichFields-to-field-name
mapping, and the second table (section 3.1.5.14.11) specifies the field-name-to-database-
attribute mapping.
long SamrQueryInformationUser(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[out, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER* Buffer
);
See the description of SamrQueryInformationUser2 (section 3.1.5.5.5) for details, because the
method interface arguments and message processing are identical.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrQueryInformationUser2, with the following parameter
values.
UserHandle SamrQueryInformationUser.UserHandle
UserInformationClass SamrQueryInformationUser.UserInformationClass
Buffer SamrQueryInformationUser.Buffer
These methods enable a client to set attributes on a domain, group, alias, or user object.
A client MUST first obtain a handle to the object through an "open" or a "create" method. See sections
3.1.5.1 and 3.1.5.4.
See section 1.7.2 for details on how to choose between SamrSetInformationUser and
SamrSetInformationUser2.
long SamrSetInformationDomain(
[in] SAMPR_HANDLE DomainHandle,
172 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[in, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER DomainInformation
);
DomainInformation: The requested attributes and values to update. See section 2.2.4.17 for
structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints.
3. The following information levels MUST be processed by setting the database attribute on the
domain object associated with DomainHandle.Object to the associated input field-name value
using the mapping in section 3.1.5.14.8. All updates MUST be performed in the same transaction.
DomainInformationClass
DomainLockoutInformation
DomainLogoffInformation
DomainOemInformation
DomainReplicationInformation
4. If DomainInformationClass does not meet the criteria of constraint 3, the constraints associated
with the DomainInformationClass input value in the following subsections MUST be satisfied. If
there is no subsection for the DomainInformationClass value, an error MUST be returned to the
client.
3.1.5.6.1.1 DomainServerRoleInformation
2. If DomainHandle.Object refers to the built-in domain, the server MUST abort and return
STATUS_SUCCESS.
4. The fsmoRoleOwner attribute of the account domain object is set to the value of the
distinguishedName attribute of the server's computer object, and any resulting processing
errors MUST be returned. Otherwise, return STATUS_SUCCESS.
173 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.5.6.1.2 DomainStateInformation
3.1.5.6.1.3 DomainPasswordInformation
1. If DomainInformation.Password.MaxPasswordAge or
DomainInformation.Password.MinPasswordAge is not a valid delta time, then an error
MUST be returned.
4. The operation to update the password attributes on the domain object MUST be processed by
setting the database attribute on the domain object associated with DomainHandle.Object to the
associated input field-name value using the mapping in section 3.1.5.14.8. All updates MUST be
performed in the same transaction. Any resulting processing errors MUST be returned. Otherwise,
return STATUS_SUCCESS.
long SamrSetInformationGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] GROUP_INFORMATION_CLASS GroupInformationClass,
[in, switch_is(GroupInformationClass)]
PSAMPR_GROUP_INFO_BUFFER Buffer
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
Buffer: The requested attributes and values to update. See section 2.2.5.7 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. The following information levels MUST be processed by setting the database attribute on the group
object associated with GroupHandle.Object to the associated input field-name value using the
mapping in section 3.1.5.14.9. All updates MUST be performed in the same transaction.
GroupInformationClass
GroupNameInformation
174 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
GroupInformationClass
GroupAttributeInformation
GroupAdminCommentInformation
4. If GroupInformationClass does not meet the criteria of constraint 2, the server MUST return an
error code.
long SamrSetInformationAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] ALIAS_INFORMATION_CLASS AliasInformationClass,
[in, switch_is(AliasInformationClass)]
PSAMPR_ALIAS_INFO_BUFFER Buffer
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
Buffer: The requested attributes and values to update. See section 2.2.6.6 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
3. The following information levels MUST be processed by setting the database attribute on the alias
object associated with AliasHandle.Object to the associated input field-name value using the
mapping in section 3.1.5.14.10. All updates MUST be performed in the same transaction.
AliasInformationClass
AliasNameInformation
AliasAdminInformation
4. If AliasInformationClass does not meet the criteria of constraint 2, the server MUST return an
error code.
long SamrSetInformationUser2(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
175 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER Buffer
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
Buffer: The requested attributes and values to update. See section 2.2.7.29 for structure details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. The constraints in the following sections MUST be satisfied based on the UserInformationClass
parameter. If there is no match in the table, the constraints of section 3.1.5.6.4.1 MUST be used.
UserAllInformation 3.1.5.6.4.3
UserInternal4Information 3.1.5.6.4.4
UserInternal4InformationNew 3.1.5.6.4.5
1. If the value of UserInformationClass is present in the following table, the message MUST be
processed exactly as a call to SamrSetInformationUser2 with UserInformationClass set to
UserAllInformation and Buffer of type SAMPR_USER_ALL_INFORMATION.
UserInformationClass value
UserPreferencesInformation
UserLogonHoursInformation
UserParametersInformation
UserNameInformation
UserAccountNameInformation
UserFullNameInformation
UserPrimaryGroupInformation
UserHomeInformation
176 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
UserInformationClass value
UserScriptInformation
UserProfileInformation
UserAdminCommentInformation
UserWorkStationsInformation
UserControlInformation
UserExpiresInformation
UserInternal1Information
All SAMPR_USER_ALL_INFORMATION fields with the same name as the fields in the incoming
structure MUST be set with the same value. Furthermore, the WhichFields field MUST be updated
according to the table in section 2.2.1.8. All SAMPR_USER_ALL_INFORMATION fields not covered
MUST be zero.
As an example, the following table shows how a request for UserPreferencesInformation MUST be
handled.
Target: SAMPR_USER_ALL_INFORMATION
WhichFields USER_ALL_USERCOMMENT |
USER_ALL_COUNTRYCODE |
USER_ALL_CODEPAGE
UserComment Preferences.UserComment
CountryCode Preferences.CountryCode
CodePage Preferences.CodePage
A request for Internal1Information is a slight exception and thus is shown explicitly in the
following table.
Target: SAMPR_USER_ALL_INFORMATION
WhichFields USER_ALL_NTPASSWORDPRESENT |
USER_ALL_LMPASSWORDPRESENT |
USER_ALL_PASSWORDEXPIRED
NtPasswordPresent Internal1.NtPasswordPresent
LmPasswordPresent Internal1.LmPasswordPresent
PasswordExpired Internal1.PasswordExpired
LmOwfPassword.Length 0x10
177 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Source UserInformationClass value: UserInternal1Information
LmOwfPassword.MaximumLength 0x10
LmOwfPassword.Buffer Internal1.LmOwfPassword
NtOwfPassword.Length 0x10
NtOwfPassword.MaximumLength 0x10
NtOwfPassword.Buffer Internal1.NtOwfPassword
Target: SAMPR_USER_INTERNAL4_INFORMATION_NEW
I1.WhichFields USER_ALL_NTPASSWORDPRESENT |
USER_ALL_LMPASSWORDPRESENT |
USER_ALL_PASSWORDEXPIRED
I1.PasswordExpired Internal5.PasswordExpired
UserPassword Internal5.UserPassword
Target: SAMPR_USER_INTERNAL4_INFORMATION
I1.WhichFields USER_ALL_NTPASSWORDPRESENT |
USER_ALL_LMPASSWORDPRESENT |
USER_ALL_PASSWORDEXPIRED
I1.PasswordExpired Internal5.PasswordExpired
UserPassword Internal5.UserPassword
4. If the value of UserInformationClass was not found in the previous three constraints, the server
MUST return an error.
The server MUST process the message subject to the following constraints on the
SAMPR_USER_ALL_INFORMATION message parameter:
178 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. If the WhichFields field is 0 or contains any of the following bits, the server MUST abort and
return an error.
Bit
USER_ALL_USERID
USER_ALL_PASSWORDCANCHANGE
USER_ALL_PASSWORDMUSTCHANGE
USER_ALL_UNDEFINED_MASK
USER_ALL_LASTLOGON
USER_ALL_LASTLOGOFF
USER_ALL_BADPASSWORDCOUNT
USER_ALL_LOGONCOUNT
USER_ALL_PASSWORDLASTSET
USER_ALL_SECURITYDESCRIPTOR
USER_ALL_PRIVATEDATA
2. The UserHandle MUST be granted the following access based on the value of the WhichFields
field.
USER_ALL_USERNAME USER_WRITE_ACCOUNT
USER_ALL_FULLNAME USER_WRITE_ACCOUNT
USER_ALL_PRIMARYGROUPID USER_WRITE_ACCOUNT
USER_ALL_HOMEDIRECTORY USER_WRITE_ACCOUNT
USER_ALL_HOMEDIRECTORYDRIVE USER_WRITE_ACCOUNT
USER_ALL_SCRIPTPATH USER_WRITE_ACCOUNT
USER_ALL_PROFILEPATH USER_WRITE_ACCOUNT
USER_ALL_ADMINCOMMENT USER_WRITE_ACCOUNT
USER_ALL_WORKSTATIONS USER_WRITE_ACCOUNT
USER_ALL_LOGONHOURS USER_WRITE_ACCOUNT
USER_ALL_ACCOUNTEXPIRES USER_WRITE_ACCOUNT
USER_ALL_USERACCOUNTCONTROL USER_WRITE_ACCOUNT
USER_ALL_PARAMETERS USER_WRITE_ACCOUNT
USER_ALL_USERCOMMENT USER_WRITE_PREFERENCES
USER_ALL_COUNTRYCODE USER_WRITE_PREFERENCES
USER_ALL_CODEPAGE USER_WRITE_PREFERENCES
179 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
WhichFields Required access
USER_ALL_NTPASSWORDPRESENT USER_FORCE_PASSWORD_CHANGE
USER_ALL_LMPASSWORDPRESENT USER_FORCE_PASSWORD_CHANGE
USER_ALL_PASSWORDEXPIRED USER_FORCE_PASSWORD_CHANGE
3. The server MUST update the corresponding database attributes for each bit that is present in the
WhichFields field. In addition, the server MUST enforce that the client has
ACTRL_DS_READ_PROP access to the database attribute being updated, according to the
UserHandle passed into the method. Section 2.2.1.8 specifies a WhichFields-to-field mapping, and
section 3.1.5.14.11 specifies a field-to-database-attribute mapping.
1. Enforce that the client has ACTRL_DS_READ_PROP access to the database attribute of
userAccountControl, according to the UserHandle.GrantedAccess passed into the method.
2. Translate the bits according to the table in section 3.1.5.14.2. If a bit does not translate, abort
with a processing error.
5. If the USER_ALL_PASSWORDEXPIRED flag is present in the WhichFields field, the server MUST:
2. If Buffer.All.PasswordExpired is 0 and the value of the current time minus the pwdLastSet
attribute is greater than the Effective-MaximumPasswordAge (see section 3.1.1.5), then:
3. Enforce that this update to pwdLastSet MUST take precedence over any other writes to this
attribute during the message processing and associated triggers.
3.1.5.6.4.3 UserAllInformation
The server MUST process the message subject to the following constraints:
1. If Buffer.All.NtPasswordPresent is true:
2. If Buffer.All.NtPasswordPresent is false:
180 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. If the USER_ALL_LMPASSWORDPRESENT flag is present in the WhichFields field, the server
MUST:
3.1.5.6.4.4 UserInternal4Information
The server MUST process the message subject to the following constraints:
3.1.5.6.4.5 UserInternal4InformationNew
The server MUST process the message subject to the following constraints:
long SamrSetInformationUser(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[in, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER Buffer
);
See the description of SamrSetInformationUser2 (section 3.1.5.6.4) for details, because the method
interface arguments and message processing are identical.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with a call to SamrSetInformationUser2, with the following parameter
values.
UserHandle SamrSetInformationUser.UserHandle
181 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter name Parameter value
UserInformationClass SamrSetInformationUser.UserInformationClass
Buffer SamrSetInformationUser.Buffer
A client MUST first obtain a handle to the object through an "open" or a "create" method. See sections
3.1.5.1 and 3.1.5.4.
long SamrDeleteGroup(
[in, out] SAMPR_HANDLE* GroupHandle
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
5. If the RID of G's objectSid attribute is less than 1000, an error MUST be returned.
6. In the non-DC configuration, if G has any values in the member attribute, an error MUST be
returned.
7. If any user in the same domain as G has, as its primaryGroupId attribute, the RID of G's
objectSid attribute, an error MUST be returned.
10. The server MUST delete the SamContextHandle ADM element (section 3.1.1.10) represented by
GroupHandle, and then MUST return 0 for the value of GroupHandle and a return code of
STATUS_SUCCESS.
182 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.1.5.7.2 SamrDeleteAlias (Opnum 30)
long SamrDeleteAlias(
[in, out] SAMPR_HANDLE* AliasHandle
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
5. If the RID of A's objectSid attribute value is less than 1000, an error MUST be returned.
8. The server MUST delete the SamContextHandle ADM element (section 3.1.1.10) represented by
AliasHandle, and then MUST return 0 for the value of AliasHandle and a return code of
STATUS_SUCCESS.
long SamrDeleteUser(
[in, out] SAMPR_HANDLE* UserHandle
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. UserHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
183 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. All database operations MUST occur in a single transaction.
5. If the RID of U's objectSid attribute value is less than 1000, an error MUST be returned.
8. The server MUST delete the SamContextHandle ADM element (section 3.1.1.10) represented by
UserHandle, and then MUST return 0 for the value of UserHandle and a return code of
STATUS_SUCCESS.
These methods enable a client to set and query the membership of a group or alias.
A client MUST first obtain a handle to the group or alias object through an "open" or a "create"
method. See sections 3.1.5.1 and 3.1.5.4.
long SamrAddMemberToGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId,
[in] unsigned long Attributes
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
Attributes: The characteristics of the membership relationship. See section 2.2.1.10 for legal values
and semantics.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
5. Let TargetSid be the SID composed by making the MemberId a suffix to the domain prefix of G's
objectSid.
6. If there is no object whose objectSid attribute is TargetSid, the server MUST return
STATUS_NO_SUCH_USER.
184 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
7. If G's member attribute already has as a dsname value that references the object whose
objectSid is TargetSid, the server MUST return an error.
8. G's member attribute MUST be updated to add a dsname value that references the object with the
objectSid value TargetSid.
9. The message processing specified in section 3.1.5.14.7 for the Attributes parameter MUST be
adhered to.
long SamrRemoveMemberFromGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
MemberId: A RID representing an account to remove from the group's membership list.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
5. Let TargetSid be the SID composed by making the MemberId a suffix to the domain prefix of G's
objectSid.
6. If G's member attribute does not have a dsname value that references the object whose
objectSid is TargetSid, the server MUST return an error.
7. G's member attribute MUST be updated to remove a dsname value that references the object with
the objectSid value TargetSid.
long SamrGetMembersInGroup(
[in] SAMPR_HANDLE GroupHandle,
[out] PSAMPR_GET_MEMBERS_BUFFER* Members
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
185 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
4. Let M be the set of values of G's member attribute such that the groupType of the object
referenced by each value is GROUP_TYPE_SECURITY_ACCOUNT or
GROUP_TYPE_SECURITY_UNIVERSAL. Objects with groupType
GROUP_TYPE_SECURITY_RESOURCE are ignored.
5. If the domain prefix of the objectSid attribute of any object in set M is different from the
domain prefix of G's objectSid, the server SHOULD<58> return
STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER.
6. On output:
2. The Members.Members array MUST contain the RelativeIds of the objectSid attribute
values for all objects in set M.
3. For each element in the Members.Members array, see section 3.1.5.14.7 for a message
processing specification of each element in the Members.Attributes array.
long SamrAddMemberToAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PRPC_SID MemberId
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1 Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
186 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. Let A be the alias referenced by AliasHandle.Object.
5. If the domain prefix of MemberId is the same domain prefix as the account domain and there is
no object whose objectSid attribute is MemberId, the server MUST return an error.
6. If A's member attribute already has a dsname value that references the object whose objectSid
is MemberId, the server MUST return an error.
7. A's member attribute MUST be updated to add a dsname value that references the object with the
objectSid value MemberId.
long SamrRemoveMemberFromAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PRPC_SID MemberId
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
5. If A's member attribute does not have a dsname value that references the object whose
objectSid is MemberId, the server MUST return an error.
6. A's member attribute MUST be updated to remove a dsname value that references the object with
the objectSid value MemberId.
long SamrGetMembersInAlias(
[in] SAMPR_HANDLE AliasHandle,
[out] PSAMPR_PSID_ARRAY_OUT Members
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
Members: A structure containing an array of SIDs that represent the membership list of the alias
referenced by AliasHandle.
187 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. AliasHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
3. On output, Members.Count MUST be equal to the number of values in the member attribute, and
Members.Sids MUST have Member.Count number of elements. Each element MUST contain the
objectSid value of the object referenced in the member attribute.
long SamrRemoveMemberFromForeignDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_SID MemberSid
);
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
4. If the server is not a domain controller, for all alias objects in the domain referenced by
DomainHandle.Object, the server MUST remove any member value that references the object with
the objectSid attribute value of MemberSid.
5. If the server is a domain controller, the server MUST return STATUS_SUCCESS without making
any modifications to any alias objects.
long SamrAddMultipleMembersToAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PSAMPR_PSID_ARRAY MembersBuffer
);
188 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with N successive message calls to SamrAddMemberToAlias, once for
each SID value in MembersBuffer, where MembersBuffer contains N elements. The server MUST ignore
the processing error of a member value already being present in the member attribute and abort the
request on any other processing error.
long SamrRemoveMultipleMembersFromAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PSAMPR_PSID_ARRAY MembersBuffer
);
AliasHandle: An RPC context handle, as specified in section 2.2.3.2, representing an alias object.
MembersBuffer: A structure containing a list of SIDs to remove from the alias's membership list.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
The server MUST behave as with N successive message calls to SamrRemoveMemberFromAlias, once
for each SID value in MembersBuffer, where MembersBuffer contains N elements. The server MUST
ignore the processing error triggered by a value not existing in the member attribute's values and
abort the request on any other processing error.
These methods enable a client to obtain the group membership of a user or the alias membership of a
set of SIDs. In mixed mode domains, these methods are useful in approximating the authorization
data associated with an authentication request for a given user. However, in native mode domains,
these methods are not accurate because the authorization building process is more complex than what
these methods enable. This means that in native mode domains, these methods MUST NOT be used to
approximate the authorization data for a given user accessing a resource.
A client MUST first obtain a handle to the user or domain, depending on the method.
The SamrGetGroupsForUser method obtains a listing of groups that a user is a member of.
long SamrGetGroupsForUser(
[in] SAMPR_HANDLE UserHandle,
[out] PSAMPR_GET_GROUPS_BUFFER* Groups
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
189 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Groups: An array of RIDs of the groups that the user referenced by UserHandle is a member of.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. UserHandle.GrantedAccess MUST have the required access specified in section 3.1.2.1. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.
3. The server MUST determine the union of all database objects that meet the following criteria:
Their member value contains the SID of the user referenced by UserHandle.Object.
The union MUST also contain the group identified by the primaryGroupId attribute of the user
that is referenced by UserHandle.Object.
4. The returned Groups.MembershipCount MUST be set to the cardinality that the union
determined from step 3.
5. For each group in the union determined from step 3, the server MUST set a corresponding element
in Groups.Groups as follows:
1. RelativeId MUST contain the RID of the SID of the dsname member value.
2. Set the Attributes field according to the message processing rules in section 3.1.5.14.7.
The SamrGetAliasMembership method obtains the union of all aliases that a given set of SIDs is a
member of.
long SamrGetAliasMembership(
[in] SAMPR_HANDLE DomainHandle,
[in] PSAMPR_PSID_ARRAY SidArray,
[out] PSAMPR_ULONG_ARRAY Membership
);
Membership: The union of all aliases (represented by RIDs) that all SIDs in SidArray are a member
of.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
190 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. For each SID value in SidArray, the server MUST determine the union of all database objects in
the domain referenced by DomainHandle.Object with class group and groupType
GROUP_TYPE_SECURITY_RESOURCE whose member value contains the SID.
4. The returned Membership parameter MUST contain the RIDs of the objectSid attribute of the
union of all groups found by constraint 2.
The "change password" methods enable a client to change the password of a user object. All these
methods require that the client has knowledge of the current password in order for the message to be
processed successfully.
In the following descriptions, when a value is said to be "presented by the client", that value is
provided by the client side of the protocol. In a canonical password-change scenario, an end user
enters his or her old and new passwords into a password-change application. That application acts as
a client for this method.
To encrypt password data, these methods use the fact that the client (an end user in the canonical
scenario) and the server (a DC in the canonical scenario) share a common secret: the user's existing
password. The LM and/or NT hash (specified in the following sections) of the existing password's
cleartext value is used as an encryption key. Because the DC stores the existing password as well, the
DC is able to decrypt the data sent by the client. Of course, if the end user did not enter the correct
existing password, the decryption does not result in meaningful data, and an error is returned.
long SamrChangePasswordUser(
[in] SAMPR_HANDLE UserHandle,
[in] unsigned char LmPresent,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm,
[in] unsigned char NtPresent,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt,
[in] unsigned char NtCrossEncryptionPresent,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm,
[in] unsigned char LmCrossEncryptionPresent,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt
191 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
OldLmEncryptedWithNewLm: The LM hash of the target user's existing password (as presented by
the client) encrypted according to the specification of
ENCRYPTED_LM_OWF_PASSWORD (section 2.2.3.3), where the key is the LM hash of the new
password for the target user (as presented by the client in the NewLmEncryptedWithOldLm
parameter).
NewLmEncryptedWithOldLm: The LM hash of the target user's new password (as presented by the
client) encrypted according to the specification of ENCRYPTED_LM_OWF_PASSWORD, where the
key is the LM hash of the existing password for the target user (as presented by the client in the
OldLmEncryptedWithNewLm parameter).
OldNtEncryptedWithNewNt: The NT hash of the target user's existing password (as presented by
the client) encrypted according to the specification of
ENCRYPTED_NT_OWF_PASSWORD (section 2.2.3.3), where the key is the NT hash of the new
password for the target user (as presented by the client).
NewNtEncryptedWithOldNt: The NT hash of the target user's new password (as presented by the
client) encrypted according to the specification of ENCRYPTED_NT_OWF_PASSWORD, where the
key is the NT hash of the existing password for the target user (as presented by the client).
NewNtEncryptedWithNewLm: The NT hash of the target user's new password (as presented by the
client) encrypted according to the specification of ENCRYPTED_NT_OWF_PASSWORD, where the
key is the LM hash of the new password for the target user (as presented by the client).
NewLmEncryptedWithNewNt: The LM hash of the target user's new password (as presented by the
client) encrypted according to the specification of ENCRYPTED_LM_OWF_PASSWORD, where the
key is the NT hash of the new password for the target user (as presented by the client).
The processing for this method is quite complex. To aid comprehension, a brief, non-normative
description of the method's intent follows.
The method requires that the client presents both the NT and the LM hash of the new password (and
will fail otherwise). However, because the old password might not be stored in either the NT or LM
hash format on the receiver, and thus the new hash values cannot be decrypted using the old hash
values, the method allows for the new NT and LM hashes to be "cross-encrypted" using the new LM or
NT hash value (instead of the old values). As such, there are three combinations that can lead to
successful processing, which are listed below.
1. NtPresent is nonzero, LmPresent is nonzero, and both the LM and NT hashes are present in the
database. No "cross-encryption" is required. The cross-encryption–related parameters are ignored.
192 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. LmPresent is nonzero, NtCrossEncryptionPresent is nonzero, and the LM hash is present in the
database. This combination is used when the NT hash is not stored at the server; the client can
send the NT hash encrypted with the new LM hash instead. The NT-hash–related parameters are
ignored.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints applied in the presented order:
7. If LmPresent and NtPresent are zero, the server MUST return an error.
9. Let Stored-LM-Hash be the value of the dBCSPwd attribute from the database decrypted using
the algorithm specified in section 2.2.11.1, using U's RelativeId (an unsigned integer) as the key.
If the dBCSPwd attribute does not exist, let Stored-LM-Hash be "NULL".
10. Let Stored-NT-Hash be the value of the unicodePwd attribute from the database decrypted using
the algorithm specified in section 2.2.11.1, using U's RelativeId (an unsigned integer) as the key.
If the unicodePwd attribute does not exist, let Stored-NT-Hash be "NULL".
13. If all of the following conditions are true, the server MUST abort processing and return the error
status STATUS_LM_CROSS_ENCRYPTION_REQUIRED:
1. NtPresent is nonzero.
193 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. LmPresent is zero.
3. LmCrossEncryptionPresent is zero.
14. If all of the following conditions are true, the server MUST abort processing and return the error
status STATUS_NT_CROSS_ENCRYPTION_REQUIRED.
1. NtPresent is nonzero.
2. LmPresent is nonzero.
3. NtCrossEncryptionPresent is zero.
4. Stored-NT-Hash is NULL.
15. Exactly one of the three following conditions MUST be true; otherwise, the server MUST satisfy the
constraints in section 3.1.5.14.6 and then return STATUS_WRONG_PASSWORD.
16. If LmPresent is nonzero, the dBCSPwd attribute MUST be updated with Presented-New-LM-Hash.
17. If LmPresent is zero and LmCrossEncryptionPresent is nonzero, the dBCSPwd attribute MUST be
updated with the value of NewLmEncryptedWithNewNt, decrypted using the algorithm specified in
section 2.2.11.1, using Presented-New-NT-Hash as the decryption key.
18. If NtPresent is nonzero, the unicodePwd attribute MUST be updated with Presented-New-NT-
Hash.
19. If NtPresent is zero and NtCrossEncryptionPresent is nonzero, the unicodePwd attribute MUST be
updated with the value of NewNtEncryptedWithNewLm, decrypted using the algorithm specified in
section 2.2.11.1, using Presented-New-LM-Hash as the decryption key.
20. On database error, the server MUST return the data error; on general processing error, the server
MUST return STATUS_WRONG_PASSWORD; otherwise, return STATUS_SUCCESS.
long SamrOemChangePasswordUser2(
[in] handle_t BindingHandle,
[in, unique] PRPC_STRING ServerName,
[in] PRPC_STRING UserName,
[in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm
);
194 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
BindingHandle: An RPC binding handle parameter as specified in [C706] section 1.
ServerName: A counted string, encoded in the OEM character set, containing the NETBIOS name of
the server; this parameter MAY<59> be ignored by the server.
UserName: A counted string, encoded in the OEM character set, containing the name of the user
whose password is to be changed; see message processing later in this section for details on how
this value is used as a database key to locate the account that is the target of this password
change operation.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. On a DC configuration if Active Directory is not running, the server MUST abort the request and
return an error status.
3. The server MUST encode the UserName parameter into UTF-16 using the OEM code page.
4. Let U be the user account with the sAMAccountName attribute value of UserName. The server
MUST return STATUS_WRONG_PASSWORD if no such account exists.
5. Let Stored-LM-Hash be the value of the dBCSPwd attribute from the database decrypted using
the algorithm specified in section 2.2.11.1, using U's RelativeId as the key. If this attribute does
not exist, STATUS_WRONG_PASSWORD MUST be returned.
6. Let Presented-Clear-Text be the cleartext value sent by the client. This value is obtained by
decrypting NewPasswordEncryptedWithOldLm according to the specification of
SAMPR_ENCRYPTED_USER_PASSWORD using Stored-LM-Hash as the key, and then translating
the result into a UTF-16 encoded string (using the OEM code page).
8. If Presented-Old-LM-Hash is not equal to Stored-LM-Hash, the server MUST satisfy the constraints
in section 3.1.5.14.6, abort processing, and return STATUS_WRONG_PASSWORD.
long SamrUnicodeChangePasswordUser2(
[in] handle_t BindingHandle,
[in, unique] PRPC_UNICODE_STRING ServerName,
[in] PRPC_UNICODE_STRING UserName,
[in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt,
195 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in, unique] PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt,
[in] unsigned char LmPresent,
[in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewNt
);
ServerName: A null-terminated string containing the NETBIOS name of the server; this parameter
MAY<60> be ignored by the server.
UserName: The name of the user. See the message processing later in this section for details on how
this value is used as a database key to locate the account that is the target of this password
change operation.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. On a DC configuration if Active Directory is not running, the server MUST abort the request and
return an error status.
3. Let U be the user account with the sAMAccountName attribute value of UserName. The server
MUST return STATUS_WRONG_PASSWORD if no such account exists.
4. Let Stored-NT-Hash be the value of the unicodePwd attribute from the database decrypted using
the algorithm specified in section 2.2.11.1, using U's RelativeId as the key. If the attribute does
not exist, let Stored-NT-Hash be "NULL".
5. Let Stored-LM-Hash be the value of the dBCSPwd attribute from the database decrypted using
the algorithm specified in section 2.2.11.1, using U's RelativeId as the key. If the attribute does
not exist, let Stored-LM-Hash be "NULL".
6. If Stored-NT-Hash is NULL and LmPresent is zero or Stored-LM-Hash is NULL, the server MUST
abort processing and return STATUS_WRONG_PASSWORD.
196 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
7. If Stored-NT-Hash is not NULL, then:
1. Let Presented-Clear-Text be the cleartext value sent by the client, obtained by decrypting
NewPasswordEncryptedWithOldNt according to the specification of
SAMPR_ENCRYPTED_USER_PASSWORD, using Stored-NT-Hash as the key, AND
1. Let Presented-Clear-Text be the cleartext value sent by the client, obtained by decrypting
NewPasswordEncryptedWithOldLm according to the specification of
SAMPR_ENCRYPTED_USER_PASSWORD, using Stored-LM-Hash as the key, AND
9. Exactly one of the two following conditions MUST be true; otherwise, the server MUST satisfy the
constraints in section 3.1.5.14.6 and return STATUS_WRONG_PASSWORD.
10. The server MUST update the clearTextPassword attribute with Presented-Clear-Text.
These methods enable a client to translate from a security ID (either a SID or a RID) to a user-
friendly name, and vice versa. This action is useful when an end user is setting access control via a
security descriptor. However, the translation methods specified in [MS-LSAT] sections 3.1.4.5 and
3.1.4.9 are superior because they translate a wider range of SIDs.
A client MUST first obtain a handle to the object of interest through an "open" method. See section
3.1.5.1.
The SamrLookupDomainInSamServer method obtains the SID of a domain object, given the object's
name.
long SamrLookupDomainInSamServer(
[in] SAMPR_HANDLE ServerHandle,
[in] PRPC_UNICODE_STRING Name,
[out] PRPC_SID* DomainId
);
ServerHandle: An RPC context handle, as specified in section 2.2.3.2, representing a server object.
197 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DomainId: A SID value of a domain that corresponds to the Name passed in. The match MUST be
exact (no wildcard characters are permitted). See message processing later in this section for
more details.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. If the Name input parameter matches an attribute value as shown in the following table, the
associated value in the "Return attribute" column MUST be returned via the DomainId parameter.
The SamrLookupNamesInDomain method translates a set of account names into a set of RIDs.
long SamrLookupNamesInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, range(0,1000)] unsigned long Count,
[in, size_is(1000), length_is(Count)]
RPC_UNICODE_STRING Names[*],
[out] PSAMPR_ULONG_ARRAY RelativeIds,
[out] PSAMPR_ULONG_ARRAY Use
);
Count: The number of elements in Names. The maximum value of 1,000 is chosen to limit the
amount of memory that the client can force the server to allocate.
Use: An array of SID_NAME_USE enumeration values that describe the type of account for each entry
in RelativeIds.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
198 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. The server MUST return an error if DomainHandle.HandleType is not equal to "Domain".
3. Let U be the set of all database objects whose objectSid's domain prefix matches the domain
prefix of the domain referenced by DomainHandle.Object.
4. For each element in Names that matches a database object's sAMAccountName attribute value
in the set U, the server MUST fill in RelativeIds and Use as follows:
Group Any value not matching the above criteria for Group SidTypeAlias
5. For each element in Names that does not match a database object's sAMAccountName attribute
value in the set U, the server MUST fill in RelativeIds and Use as follows:
2. RelativeIds.Element[i] is 0.
3. Use.Element[i] is SidTypeUnknown.
6. Otherwise:
2. Use.Count MUST be set to the input parameter Count on successful completion of the
method.
3. If the number of matched accounts is equal to the input parameter Count, STATUS_SUCCESS
MUST be returned.
4. If the number of matched accounts is less than the input parameter Count but greater than 0,
STATUS_SOME_NOT_MAPPED MUST be returned. Note that this is not an error condition.
long SamrLookupIdsInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, range(0,1000)] unsigned long Count,
[in, size_is(1000), length_is(Count)]
unsigned long* RelativeIds,
[out] PSAMPR_RETURNED_USTRING_ARRAY Names,
199 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[out] PSAMPR_ULONG_ARRAY Use
);
Count: The number of elements in RelativeIds. The maximum value of 1,000 is chosen to limit the
amount of memory that the client can force the server to allocate.
Names: A structure containing an array of account names that correspond to the elements in
RelativeIds.
Use: A structure containing an array of SID_NAME_USE enumeration values that describe the type of
account for each entry in RelativeIds.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. Let U be the set of all database objects whose objectSid's domain prefix matches the domain
prefix of the domain referenced by DomainHandle.Object.
4. For each element in RelativeIds that matches the RID of a database object's objectSid attribute
value in the set U, the server MUST fill in Names and Use as follows:
Group Any value not matching the above criteria for Group SidTypeAlias
5. For each element in RelativeIds that does not match the RID of a database object's objectSid
attribute value, the server MUST fill in Names and Use as follows:
3. Use.Element[i] is SidTypeUnknown.
200 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
6. Otherwise:
1. Names.Count MUST be set to the input parameter Count on successful completion of the
method.
2. Use.Count MUST be set to the input parameter Count on successful completion of the
method.
3. If the number of matched accounts is equal to the input parameter Count, 0 MUST be
returned.
4. If the number of matched accounts is less than the input parameter Count but greater than 0,
STATUS_SOME_NOT_MAPPED MUST be returned. Note that this is not an error condition.
These methods enable a client to set the access control on a server, domain, group, alias, or user
object.
These methods require a handle obtained from an "open" or a "create" method. See sections 3.1.5.1
and 3.1.5.4.
A non-normative description of these methods is helpful to understand the intent of the message
processing. The remainder of this section contains such a description.
1. The message processing requirements between DC and non-DC configurations are very different.
2. All known clients use a very small subset of the functionality exposed in these methods.
The DC message processing requirements differ from the non-DC case because the database objects
on which the server operates are also exposed through the LDAP model for read and update, and have
a different ACE format than what this protocol exposes. Specifically, in the DC case, the database
objects have security descriptors with an object ACE format (specified in [MS-ADTS] section 5.1.3),
whereas these methods expect and return security descriptors with a simple ACE format (specified in
[MS-ADTS] section 5.1.3). Therefore, the message processing for these methods converts between
these two models. In general, this would be an intractable problem because new access masks and
object ACE types can be added that are not expressible through this protocol.
Fortunately, all known clients use a small subset of the functionality exposed through these methods.
Specifically, all known clients use SamrQuerySecurityObject and SamrSetSecurityObject only to
control whether a password can be changed for a user account (the relevant access mask is
USER_CHANGE_PASSWORD, specified in section 2.2.1.7). Accordingly, the server of these methods is
required to support only this narrow request; other requests can be safely ignored.
In the DC case, general security-descriptor manipulation is best achieved through LDAP. [MS-ADTS]
section 5 specifies the Active Directory security model in detail.
For the non-DC case, because the security descriptor on the database objects is not exposed through
any other protocol, a server implementation has much greater breadth in implementing the access
control specified in the security descriptor presented in a method call to SamrSetSecurityObject.
Furthermore, because no other protocol can modify the security descriptor on the database objects in
a non-DC configuration, it is possible to translate an object ACE format security descriptor to a simple
ACE format. Non-DC servers have the requirement to return, via SamrQuerySecurityObject, the same
access control specification that was specified to a previous call to SamrSetSecurityObject, and to
enforce all access control permissions specified through SamrSetSecurityObject.
201 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
See section 1.3 for a description of the "security" pattern of methods.
The SamrSetSecurityObject method sets the access control on a server, domain, user, group, or
alias object.
long SamrSetSecurityObject(
[in] SAMPR_HANDLE ObjectHandle,
[in] SECURITY_INFORMATION SecurityInformation,
[in] PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
);
ObjectHandle: An RPC context handle, as specified in section 2.2.3.2, representing a server, domain,
user, group, or alias object.
SecurityInformation: A bit field that indicates the fields of SecurityDescriptor that are requested to
be set.
The SECURITY_INFORMATION type is defined in [MS-DTYP] section 2.4.7. The following bits are
valid; all other bits MUST be zero when sent and ignored on receipt. If none of the bits below are
present, the server MUST return STATUS_INVALID_PARAMETER.
Value Meaning
SACL_SECURITY_INFORMATION Refers to the system access control list (SACL) of the security
0x00000008 descriptor.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Message processing for this method is specified in the following two sections.
Upon receiving this message, the server MUST process the data from the message subject to all of the
following constraints:
1. The access control specified in SecurityDescriptor MUST be a valid security descriptor containing
simple ACEs; otherwise the server MUST return an error status. [MS-DTYP] section 2.4.6 contains
the specification for a valid security descriptor. On error, the server MUST abort processing and
return an error.
2. ObjectHandle.GrantedAccess MUST have the required access specified in the following table, based
on the set bits in the SecurityInformation parameter. The server MUST ignore set bits in
202 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SecurityInformation that are not specified in the table. On error, the server MUST abort processing
and return STATUS_ACCESS_DENIED.
SACL_SECURITY_INFORMATION ACCESS_SYSTEM_SECURITY
OWNER_SECURITY_INFORMATION WRITE_OWNER
GROUP_SECURITY_INFORMATION WRITE_OWNER
DACL_SECURITY_INFORMATION WRITE_DAC
DACL a.
AdministratorSid USER_ALL_ACCESS
AccountOperatorsSid USER_ALL_ACCESS
Self USER_WRITE
DACL b.
AdministratorSid USER_ALL_ACCESS
AccountOperatorsSid USER_ALL_ACCESS
DACL c.
AdministratorSid USER_ALL_ACCESS
AccountOperatorsSid USER_ALL_ACCESS
DACL d.
AdministratorSid USER_ALL_ACCESS
203 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SID Access mask
Self USER_WRITE
4. If there is no match from the preceding constraint, the server MUST silently ignore the request by
aborting processing and returning 0.
5. If the matching DACL grants USER_CHANGE_PASSWORD to World, the server MUST update the
ntSecurityDescriptor attribute for the target user such that the target user has the ability to
change his or her password; otherwise, the server MUST update the ntSecurityDescriptor
attribute for the target user such that the target does not have the ability to change his or her
password. For an example of how to do this, see the following citation in Appendix B: Product
Behavior.<61>
Upon receiving this message, the server MUST process the data from the message subject to all the
following constraints:
1. The access control specified in SecurityDescriptor MUST be a valid security descriptor containing
simple ACEs; otherwise the server MUST return an error status. [MS-DTYP] section 2.4.6 contains
the specification for a valid security descriptor.
2. ObjectHandle.GrantedAccess MUST have the required access specified in the following table, based
on the set bits in the SecurityInformation parameter. The server MUST ignore set bits in
SecurityInformation that are not specified in the table. On error, the server MUST abort processing
and return STATUS_ACCESS_DENIED.
SACL_SECURITY_INFORMATION ACCESS_SYSTEM_SECURITY
OWNER_SECURITY_INFORMATION WRITE_OWNER
GROUP_SECURITY_INFORMATION WRITE_OWNER
DACL_SECURITY_INFORMATION WRITE_DAC
3. The server MUST update the ntSecurityDescriptor attribute value on the object referenced by
ObjectHandle.Object such that all of the following constraints are satisfied:
1. All accesses granted and denied in the input security descriptor (SecurityDescriptor) are
granted and denied during subsequent method calls across this interface (for all time).
3. If the target object is a user object, all ACEs containing the specified access mask in the
following table MUST grant or deny (depending on the type of ACE) the trustee to update
associated attributes.
USER_WRITE_ACCOUNT sAMAccountName
displayName
204 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Access mask Attribute
primaryGroupId
homeDirectory
homeDrive
scriptPath
profilePath
Description
userWorkstations
logonHours
accountExpires
userAccountControl
userParameters
USER_WRITE_PREFERENCE comment
countryCode
codePage
USER_FORCE_PASSWORD_CHANGE clearTextPassword
pwdLastSet
dBCSPwd
unicodePwd
The SamrQuerySecurityObject method queries the access control on a server, domain, user, group,
or alias object.
long SamrQuerySecurityObject(
[in] SAMPR_HANDLE ObjectHandle,
[in] SECURITY_INFORMATION SecurityInformation,
[out] PSAMPR_SR_SECURITY_DESCRIPTOR* SecurityDescriptor
);
ObjectHandle: An RPC context handle, as specified in section 2.2.3.2, representing a server, domain,
user, group, or alias object.
SecurityInformation: A bit field that specifies which fields of SecurityDescriptor the client is
requesting to be returned.
The SECURITY_INFORMATION type is defined in [MS-DTYP] section 2.4.7. The following bits are
valid; all other bits MUST be zero when sent and ignored on receipt.
Value Meaning
OWNER_SECURITY_INFORMATION If this bit is set, the client requests that the Owner member be
0x00000001 returned.
If this bit is not set, the client requests that the Owner member not
be returned.
GROUP_SECURITY_INFORMATION If this bit is set, the client requests that the Group member be
0x00000002 returned.
If this bit is not set, the client requests that the Group member not be
returned.
205 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Value Meaning
DACL_SECURITY_INFORMATION If this bit is set, the client requests that the DACL be returned.
0x00000004 If this bit is not set, the client requests that the DACL not be returned.
SACL_SECURITY_INFORMATION If this bit is set, the client requests that the SACL be returned.
0x00000008 If this bit is not set, the client requests that the SACL not be returned.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Message processing for this method is specified in the following two sections.
Let Self denote the objectSid attribute value, if any, of the object referenced by ObjectHandle.Object.
Upon receiving this message, the server MUST process the data from the message subject to all of the
following constraints:
1. ObjectHandle.GrantedAccess MUST have the required access specified in the following table, based
on the bits contained in the SecurityInformation parameter. On error, the server MUST abort
processing and return STATUS_ACCESS_DENIED.
SACL_SECURITY_INFORMATION ACCESS_SYSTEM_SECURITY
OWNER_SECURITY_INFORMATION READ_CONTROL
GROUP_SECURITY_INFORMATION READ_CONTROL
DACL_SECURITY_INFORMATION READ_CONTROL
2. The server MUST return, via the SecurityDescriptor parameter, a security descriptor that only
contains fields based on the bits contained in the SecurityInformation parameter (the fields of the
security descriptor that are not returned are set to zero) and that satisfies all of the following
constraints:
1. The Owner and Group fields of the security descriptor MUST be the administrator's SID (S-1-
5-32-544).
If ObjectHandle.Object refers to the server object, the DACL MUST contain the following
ACEs.
WorldSid SAM_SERVER_EXECUTE |
SAM_SERVER_READ
AdministratorSid SAM_SERVER_ALL_ACCESS
206 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Else, if ObjectHandle.Object refers to a domain object, the DACL MUST contain the following
ACEs.
WorldSid DOMAIN_EXECUTE |
DOMAIN_READ
AdministratorSid DOMAIN_ALL_ACCESS
AccountOperatorsSid DOMAIN_EXECUTE |
DOMAIN_READ |
DOMAIN_CREATE_USER |
DOMAIN_CREATE_GROUP |
DOMAIN_CREATE_ALIAS
Else, if ObjectHandle.Object refers to a group or alias object that is the Domain Admins
group (Domain Admins) or Administrators alias, or a member of Domain Admins or
Administrators, the DACL MUST contain the following ACEs.
WorldSid GROUP_EXECUTE |
GROUP_READ
AdministratorSid GROUP_ALL_ACCESS
Else, if ObjectHandle.Object refers to any group object that does not satisfy the previous
condition, the DACL MUST contain the following ACEs.
WorldSid GROUP_EXECUTE |
GROUP_READ
AdministratorSid GROUP_ALL_ACCESS
AccountOperatorsSid GROUP_ALL_ACCESS
Else, if ObjectHandle.Object refers to any alias object that does not satisfy the previous
condition, the DACL MUST contain the following ACEs.
WorldSid ALIAS_EXECUTE |
ALIAS_READ
AdministratorSid ALIAS_ALL_ACCESS
AccountOperatorsSid ALIAS_ALL_ACCESS
WorldSid USER_EXECUTE |
207 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SID Access mask
USER_READ
AdministratorSid USER_ALL_ACCESS
WorldSid USER_EXECUTE |
USER_READ |
~USER_CHANGE_PASSWORD
AdministratorSid USER_ALL_ACCESS
AccountOperatorsSid USER_ALL_ACCESS
WorldSid USER_EXECUTE |
USER_READ
AdministratorSid USER_ALL_ACCESS
AccountOperatorsSid USER_ALL_ACCESS
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. ObjectHandle.GrantedAccess MUST have the required access specified in the following table, based
on the bits contained in the SecurityInformation parameter. On error, the server MUST abort
processing and return STATUS_ACCESS_DENIED.
SACL_SECURITY_INFORMATION ACCESS_SYSTEM_SECURITY
OWNER_SECURITY_INFORMATION READ_CONTROL
GROUP_SECURITY_INFORMATION READ_CONTROL
DACL_SECURITY_INFORMATION READ_CONTROL
208 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. The server MUST return, via the SecurityDescriptor parameter, a security descriptor that only
contains fields based on the bits contained in the SecurityInformation parameter; the fields of the
security descriptor that are not returned are set to zero. The security descriptor expresses the
owner and group of the referenced object and an access control (SACL and DACL) that has been
specified either by default settings or by previous calls to SamrSetSecurityObject. The security
descriptor MUST be in terms of simple ACEs and ACCESS_MASK values as specified in the
following table, based on the object type that ObjectHandle.HandleType references.
Server 2.2.1.1
Domain 2.2.1.4
Group 2.2.1.5
Alias 2.2.1.6
User 2.2.1.7
3.1.5.13 Miscellaneous
The SamrCloseHandle method closes (that is, releases server-side resources used by) any context
handle obtained from this RPC interface.
long SamrCloseHandle(
[in, out] SAMPR_HANDLE* SamHandle
);
SamHandle: An RPC context handle, as specified in section 2.2.3.2, representing any context handle
returned from this interface.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. Otherwise, the server MUST delete the SamContextHandle (section 3.1.1.10) represented by
SamHandle, and then MUST return 0 for the value of SamHandle and a return code of
STATUS_SUCCESS.
long SamrSetMemberAttributesOfGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId,
209 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] unsigned long Attributes
);
GroupHandle: An RPC context handle, as specified in section 2.2.3.2, representing a group object.
MemberId: A RID that represents a member of a group (which is a user or machine account).
Attributes: The characteristics of the membership relationship. For legal values, see section 2.2.1.10.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. In a non-DC configuration, the MemberId parameter MUST be a member of the group referenced
by GroupHandle.Object; otherwise, processing MUST be aborted and an error returned.
4. For a message processing specification of the Attributes parameter, see section 3.1.5.14.7.
long SamrGetUserDomainPasswordInformation(
[in] SAMPR_HANDLE UserHandle,
[out] PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation
);
UserHandle: An RPC context handle, as specified in section 2.2.3.2, representing a user object.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
3. If the RelativeId of the objectSid attribute of the user object referenced by UserHandle.Object is
DOMAIN_USER_RID_KRBTGT, or if the userAccountControl attribute contains
UF_INTERDOMAIN_TRUST_ACCOUNT, UF_WORKSTATION_TRUST_ACCOUNT, or
UF_SERVER_TRUST_ACCOUNT, then PasswordInformation MUST be set to all zeros, and the
server MUST end processing and return STATUS_SUCCESS.
210 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. The output parameter PasswordInformation.MinPasswordLength MUST be set to the
Effective-MinimumPasswordLength attribute value (see section 3.1.1.5).
long SamrGetDomainPasswordInformation(
[in] handle_t BindingHandle,
[in, unique] PRPC_UNICODE_STRING Unused,
[out] PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation
);
Unused: A string value that is unused by the protocol. It is ignored by the server. The client
MAY<62> set any value.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
long SamrRidToSid(
[in] SAMPR_HANDLE ObjectHandle,
[in] unsigned long Rid,
[out] PRPC_SID* Sid
);
ObjectHandle: An RPC context handle, as specified in section 2.2.3.2. The message processing
shown later in this section contains details on which types of ObjectHandle are accepted by the
server.
211 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Rid: A RID of an account.
This protocol asks the RPC runtime, via the strict_context_handle attribute, to reject the use of
context handles created by a method of a different RPC interface than this one, as specified in [MS-
RPCE] section 3.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
2. The output parameter Sid MUST be set to a SID whose domain SID prefix is equal to the domain
SID prefix of the objectSid attribute of the object identified by ObjectHandle, and whose RID
suffix is equal to the Rid parameter.
long SamrSetDSRMPassword(
[in] handle_t BindingHandle,
[in, unique] PRPC_UNICODE_STRING Unused,
[in] unsigned long UserId,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
);
Unused: A string value. This value is not used in the protocol and is ignored by the server.
UserId: A RID of a user account. See the message processing later in this section for details on
restrictions on this value.
EncryptedNtOwfPassword: The NT hash of the new password (as presented by the client)
encrypted according to the specification of ENCRYPTED_NT_OWF_PASSWORD, where the key is
the UserId.
Upon receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. The client MUST be a member of the Administrators alias, which is an alias object with the
security identifier (SID) S-1-5-32-544.
4. The server MAY<64> decrypt EncryptedNtOwfPassword using UserId as a key and use the result
to store the password of a local recovery account.
The SamrValidatePassword method validates an application password against the locally stored policy.
long SamrValidatePassword(
[in] handle_t Handle,
[in] PASSWORD_POLICY_VALIDATION_TYPE ValidationType,
[in, switch_is(ValidationType)]
212 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
PSAM_VALIDATE_INPUT_ARG InputArg,
[out, switch_is(ValidationType)]
PSAM_VALIDATE_OUTPUT_ARG* OutputArg
);
On receiving this message, the server MUST process the data from the message subject to the
following constraints:
1. The client MUST have SAM_SERVER_LOOKUP_DOMAIN access on the server object and
DOMAIN_READ_PASSWORD_PARAMETERS on the account domain object. To implement the
SAM_SERVER_LOOKUP_DOMAIN access check, the server MUST internally invoke
SamrConnect5 (section 3.1.5.1.1) with DesiredAccess set to SAM_SERVER_LOOKUP_DOMAIN. To
implement the DOMAIN_READ_PASSWORD_PARAMETERS access check, the server MUST
internally invoke SamrOpenDomain (section 3.1.5.1.5) with ServerHandle set to the handle
returned by SamrConnect5, and with DesiredAccess set to
DOMAIN_READ_PASSWORD_PARAMETERS. If both calls succeed, the client is granted access.
2. Let the following symbolic names correspond to the values specified in the table.
DomainPasswordHistoryLength pwdHistoryLength
DomainLockoutDuration lockoutDuration
DomainLockoutObservationWindow lockOutObservationWindow
DomainLockoutThreshold lockoutThreshold
DomainMinimumPasswordLength minPwdLength
DomainMaximumPasswordAge maxPwdAge
DomainMinimumPasswordAge minPwdAge
3. Any field of OutputArg that is modified MUST cause the associated bit in PresentFields (in the
SAM_VALIDATE_PERSISTED_FIELDS structure) to be set according to the following table.
SAM_VALIDATE_PASSWORD_LAST_SET PasswordLastSet
SAM_VALIDATE_BAD_PASSWORD_TIME BadPasswordTime
SAM_VALIDATE_LOCKOUT_TIME LockoutTime
SAM_VALIDATE_BAD_PASSWORD_COUNT BadPasswordCount
SAM_VALIDATE_PASSWORD_HISTORY PasswordHistoryLength
213 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4. Additional constraints in the following sections MUST be satisfied based on the ValidationType
input parameter according to the following table. If the ValidationType input parameter does not
match a row in the table, an error MUST be returned.
ValidationType Section
SamValidateAuthentication 3.1.5.13.7.1
SamValidatePasswordChange 3.1.5.13.7.2
SamValidatePasswordReset 3.1.5.13.7.3
3.1.5.13.7.1 SamValidateAuthentication
The following table lists the constraints that MUST be satisfied (in the order presented) in order to
return the associated output parameters to the client. All fields of ValidateAuthenticationOutput MUST
be set to 0 before any constraints are met.
2 If the current time is greater than LockoutTime MUST be set to 0 (and continue
LockoutTime plus processing).
DomainLockoutDuration.
214 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Condition (fields based on
Constraint ValidateAuthenticationInput) ValidateAuthenticationOutput changes
SamValidatePasswordMustChange.
7 PasswordMatched is nonzero.
1. ValidationStatus MUST be set to
SamValidateSuccess.
2. If BadPasswordCount is nonzero,
BadPasswordCount MUST be set to 0.
1The order in which these conditions are tested SHOULD<65> follow the order shown in the preceding
table.
3.1.5.13.7.2 SamValidatePasswordChange
The following table lists the constraints that MUST be satisfied (in the order presented) in order to
return the associated output parameters to the client. All fields of ValidatePasswordChangeOutput
MUST be set to 0 before any constraints are met.
215 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Condition (fields based on
Constrain ValidatePasswordChangeInpu
t t) ValidatePasswordChangeOutput changes
7 PasswordMatch is nonzero.
1. The constraints in section 3.1.1.8.5 MUST be satisfied,
where sAMAccountName is
ValidatePasswordChangeInput.UserAccountName and
userAccountControl is UF_NORMAL_ACCOUNT; on error,
ValidationStatus MUST be set as follows:
6. BadPasswordCount is set to 0.
216 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Condition (fields based on
Constrain ValidatePasswordChangeInpu
t t) ValidatePasswordChangeOutput changes
3.1.5.13.7.3 SamValidatePasswordReset
The following table lists the constraints that MUST be satisfied (in the order presented) in order to
return the associated output parameters to the client. All fields of ValidatePasswordResetOutput MUST
be set to 0 before any constraints are met.
1 Always
1. The constraints in section 3.1.1.8.5 MUST be satisfied,
where sAMAccountName is
ValidatePasswordChangeInput.UserAccountName and
userAccountControl is UF_NORMAL_ACCOUNT; on error,
ValidationStatus MUST be set as follows:
4 ClearLockout is nonzero.
1. LockoutTime MUST be set to 0.
2. If
ValidatePasswordResetInput.InputPersistedFields.BadPassw
ordCount is nonzero, BadPasswordCount MUST be set to 0.
217 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Condition (fields based on
Constrain ValidatePasswordResetInput
t ) ValidatePasswordResetOutput changes
5 Always
1. PasswordHistory MUST be updated such that
ValidatePasswordResetInput.HashedPassword is the first
element in PasswordHistory and
ValidatePasswordResetInput.InputPersistedFields.PasswordH
istory elements are used, starting from the left, to fill the
remaining elements of PasswordHistory such that
PasswordHistory contains as many elements as possible up
to DomainPasswordHistoryLength elements.
This section contains constraints pertaining to the generation of a distinguishedName attribute value
for objects created through this protocol. This section is referenced by the "create" pattern of
methods, section 3.1.5.4. The constraints refer to an AccountType parameter from the referring
section; if the object being created has the objectClass of a group, there is no AccountType parameter
in the message. In this case, use an Account Type value of USER_NORMAL_ACCOUNT.
1. If the wellKnownObjects attribute on the account domain object exists and contains a value that
matches the GUID associated with Account Type, where Account Type is the AccountType
parameter from the message referencing this section, the distinguishedName MUST be suffixed
with the associated value from the wellKnownObject attribute. Information about the syntax of the
wellKnownObject attribute is specified in [MS-ADTS] section 6.1.1.4. Unless otherwise specified,
GUIDs in this document are represented using the string form of a universally unique identifier
(UUID), as specified in [RFC4122] section 3.
USER_NORMAL_ACCOUNT a9d1ca15-7688-11d1-aded-00c04fd8d5cd
USER_WORKSTATION_TRUST_ACCOUNT aa312825-7688-11d1-aded-00c04fd8d5cd
USER_SERVER_TRUST_ACCOUNT a361b2ff-ffd2-11d1-aa4b-00c04fd7d83a
2. If the wellKnownObjects attribute does not exist or if there is no match according to constraint 1,
the distinguishedName MUST be suffixed with the associated value according to the following
table.
218 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
AccountType distinguishedName suffix
3. The server MUST prefix the RDN directly in front of the suffix determined from steps 1 and 2.
Implementations SHOULD<68> use the sAMAccountName as the value for the RDN, with the
component type of "CN", if this choice matches the constraints of the distinguishedName attribute.
USER_ACCOUNT_DISABLED UF_ACCOUNTDISABLE
USER_HOME_DIRECTORY_REQUIRED UF_HOMEDIR_REQUIRED
USER_PASSWORD_NOT_REQUIRED UF_PASSWD_NOTREQD
USER_TEMP_DUPLICATE_ACCOUNT UF_TEMP_DUPLICATE_ACCOUNT
USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED
USER_NORMAL_ACCOUNT UF_NORMAL_ACCOUNT
USER_INTERDOMAIN_TRUST_ACCOUNT UF_INTERDOMAIN_TRUST_ACCOUNT
USER_WORKSTATION_TRUST_ACCOUNT UF_WORKSTATION_TRUST_ACCOUNT
USER_SERVER_TRUST_ACCOUNT UF_SERVER_TRUST_ACCOUNT
USER_DONT_EXPIRE_PASSWORD UF_DONT_EXPIRE_PASSWD
USER_MNS_LOGON_ACCOUNT UF_MNS_LOGON_ACCOUNT
USER_SMARTCARD_REQUIRED UF_SMARTCARD_REQUIRED
USER_TRUSTED_FOR_DELEGATION UF_TRUSTED_FOR_DELEGATION
USER_NOT_DELEGATED UF_NOT_DELEGATED
USER_USE_DES_KEY_ONLY UF_USE_DES_KEY_ONLY
USER_DONT_REQUIRE_PREAUTH UF_DONT_REQUIRE_PREAUTH
USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
USER_NO_AUTH_DATA_REQUIRED UF_NO_AUTH_DATA_REQUIRED
USER_ACCOUNT_AUTO_LOCKED UF_LOCKOUT
USER_PASSWORD_EXPIRED UF_PASSWORD_EXPIRED
USER_PARTIAL_SECRETS_ACCOUNT UF_PARTIAL_SECRETS_ACCOUNT
USER_USE_AES_KEYS UF_USE_AES_KEYS
219 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
The PasswordCanChange value is computed as follows:
1. If either the dBCSPwd attribute or the unicodePwd attribute does not have a value, or if either of
these is equal to the respective hash of a zero-length string, PasswordCanChange MUST be 0.
2. Otherwise, the PasswordCanChange value MUST be the pwdLastSet attribute value on the user
object plus the Effective-MinimumPasswordAge attribute value (see section 3.1.1.5).
1. If the userAccountControl attribute value on the target user object contains any of the following
bits: UF_DONT_EXPIRE_PASSWD, UF_SMARTCARD_REQUIRED,
UF_INTERDOMAIN_TRUST_ACCOUNT, UF_WORKSTATION_TRUST_ACCOUNT, or
UF_SERVER_TRUST_ACCOUNT, the PasswordMustChange value MUST be 0x7FFFFFFF FFFFFFFF.
2. Else, if the pwdLastSet attribute value on the user object is 0, the PasswordMustChange value
MUST be 0.
4. Otherwise, the PasswordMustChange value MUST be the pwdLastSet attribute value on the user
object plus the Effective-MaximumPasswordAge attribute value (see section 3.1.1.5).
1. Let U be the user account that is the subject of a change password request.
2. If U's lockoutTime attribute value plus the attribute value of Effective-LockoutDuration (see
section 3.1.1.5) is less than the current time, the server MUST abort the request and return
STATUS_ACCOUNT_LOCKED_OUT.
1. Let U be the user account that is the subject of a change password request.
2. If the Effective-LockoutThreshold attribute value (see section 3.1.1.5) is greater than zero and U's
lockoutTime attribute value is zero or nonexistent, all of the following constraints apply:
1. If the time period between U's badPwdTime attribute value and the current time is greater
than the attribute value of the Effective-LockoutObservationWindow (see section 3.1.1.5), the
server MUST set U's badPwdCount attribute value to one. Otherwise, the server MUST
increment U's badPwdCount attribute value by one.
2. The server MUST update U's badPwdTime attribute value to the current time (with FILETIME
syntax).
3. If the Effective-LockoutThreshold attribute value (see section 3.1.1.5) is greater than zero,
and BadPasswordCount is greater than or equal to lockoutThreshold, the server MUST update
U's lockoutTime attribute to the current time (with FILETIME syntax).
This protocol associates a field called "Attributes" with a group object and a user membership for a
group. This field is a bit field that uses values from the space specified in section 2.2.1.10.
220 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
For a group object, this field can be set via SamrSetInformationGroup and queried via
SamrQueryInformationGroup and the SamrQueryDisplayInformation family of methods.
For a user membership, this field can be set via SamrAddMemberToGroup and
SamrSetMemberAttributesOfGroup and queried via SamrGetGroupsForUser and
SamrGetMembersInGroup.
This section specifies the message processing for this field for the aforementioned methods.
On a DC configuration:
On query, the returned value MUST be a logical union of the following bits:
SE_GROUP_MANDATORY, SE_GROUP_ENABLED_BY_DEFAULT, and SE_GROUP_ENABLED.
On set, this field is ignored. The client SHOULD<69> set the value to the logical union of the
following bits: SE_GROUP_MANDATORY, SE_GROUP_ENABLED_BY_DEFAULT, and
SE_GROUP_ENABLED.
On a non-DC configuration:
Any value set via SamrSetInformationGroup MUST be returned via a subsequent call to
SamrQueryInformationGroup or the SamrQueryDisplayInformation family of methods at any time
in the future (not just within the current session). If no such SamrSetInformationGroup call has
been made, a default value of zero MUST be returned.
This table specifies the field-to-database-attribute mapping, where the field is a field in a domain-
related structure such as SAMPR_DOMAIN_GENERAL_INFORMATION (section 2.2.4.10) and the
database attribute is an attribute defined on a domain object. These attributes are from the data
model specified in section 3.1.1.
CreationTime creationTime
DomainModifiedCount modifiedCount
DomainName Name
ForceLogoff forceLogoff
LockoutDuration lockoutDuration
LockoutObservationWindow lockOutObservationWindow
LockoutThreshold lockoutThreshold
ModifiedCountAtLastPromotion modifiedCountAtLastProm
MaxPasswordAge maxPwdAge
MinPasswordAge minPwdAge
MinPasswordLength minPwdLength
PasswordHistoryLength pwdHistoryLength
221 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Field name Database attribute
PasswordProperties pwdProperties
OemInformation oEMInformation
ReplicaSourceNodeName domainReplica
UasCompatibilityRequired uASCompat
This table specifies the field-to-database-attribute mapping, where the field is a field in a group-
related structure such as SAMPR_GROUP_GENERAL_INFORMATION (section 2.2.5.3) and the database
attribute is an attribute defined on a group object. These attributes are from the data model
specified in section 3.1.1.
AdminComment Description
Name sAMAccountName
This table specifies the field-to-database-attribute mapping, where the field is a field in a group-
related structure such as SAMPR_ALIAS_GENERAL_INFORMATION (section 2.2.6.2) and the database
attribute is an attribute defined on an alias object. These attributes are from the data model
specified in section 3.1.1.
AdminComment Description
Name sAMAccountName
This table specifies the field-to-database-attribute mapping, where the field is a field in a user-related
structure such as SAMPR_USER_ALL_INFORMATION (section 2.2.7.6) and the database attribute is an
attribute defined on a user object. These attributes are from the data model specified in section
3.1.1.
LastLogon lastLogon
222 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Field name Database attribute
LastLogoff lastLogoff
PasswordLastSet pwdLastSet
AccountExpires accountExpires
UserName sAMAccountName
FullName displayName
HomeDirectory homeDirectory
HomeDirectoryDrive homeDrive
ScriptPath scriptPath
ProfilePath profilePath
AdminComment description
WorkStations userWorkstations
UserComment comment
Parameters userParameters
PrimaryGroupId primaryGroupId
UserAccountControl* userAccountControl
LogonHours logonHours
BadPasswordCount badPwdCount
LogonCount logonCount
CountryCode countryCode
CodePage codePage
NtOwfPassword** unicodePwd
LmOwfPassword** dBCSPwd
SecurityDescriptor** ntSecurityDescriptor
223 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
1. Augmented with the UF_LOCKOUT bit if the lockoutTime attribute value on the target object is
nonzero and if its value plus the Effective-LockoutDuration attribute value (section 3.1.1.5) is less
than the current time.
None.
DomainSID: A SID ([MS-DTYP] section 2.4.2) that identifies the domain being joined.
Upon invocation of this event, the server MUST perform the following processing:
1. Let A be the database object whose objectSid is S-1-5-32-544, whose database object type is
group (that is, an object with objectClass group or derived from group), and with groupType
containing GROUP_TYPE_RESOURCE_GROUP. A's member attribute MUST be updated to add a
dsname value that references the object whose objectSid specifies the SID for the Domain
Administrators group. The SID for the Domain Administrators group is constructed by joining the
DomainSID parameter with the well-known RID for Domain Administrators ([MS-ADTS] section
6.1.1.6.5).
2. Let B be the database object whose objectSid is S-1-5-32-545, whose database object type is
group (that is, an object with objectClass group or derived from group), and with groupType
containing GROUP_TYPE_RESOURCE_GROUP. B's member attribute MUST be updated to add a
dsname value that references the object whose objectSid specifies the SID for the Domain Users
group. The SID for the Domain Users group is constructed by joining the DomainSID parameter
with the well-known RID for Domain Users ([MS-ADTS] section 6.1.1.6.9).
DomainSID: A SID ([MS-DTYP] section 2.4.2) identifying the domain being joined.
Upon invocation of this event, the server MUST perform the following processing:
1. Let A be the database object whose objectSid is S-1-5-32-544, whose database object type is
group (that is, an object with objectClass group or derived from group), and with groupType
containing GROUP_TYPE_RESOURCE_GROUP. If A's member attribute contains a dsname value
that references the object whose objectSid specifies the SID for the Domain Administrators
group, the server MUST remove that value. The SID for the Domain Administrators group is
constructed by joining the DomainSID parameter with the well-known RID for Domain
Administrators ([MS-ADTS] section 6.1.1.6.5).
224 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
2. Let B be the database object whose objectSid is S-1-5-32-545, whose database object type is
group (that is, an object with objectClass group or derived from group), and with groupType
containing GROUP_TYPE_RESOURCE_GROUP. If B's member attribute contains a dsname value
that references the object whose objectSid specifies the SID for the Domain Users group, the
server MUST remove that value. The SID for the Domain Users group is constructed by joining the
DomainSID parameter with the well-known RID for Domain Users ([MS-ADTS] section 6.1.1.6.9).
As discussed in section 1.5, an original equipment manufacturer (OEM) code page MUST be
configured in the server implementation for the server to accept data that is encoded in an OEM code
page and to return select results that are encoded in an OEM code page. In particular, the client MUST
use an OEM code page to encode or decode an RPC_STRING structure when participating in the SAM
Remote Protocol (Client-to-Server).
The client MUST create a secure RPC session such that the server can identify and determine the
authorization for the client. (For more information on secure RPC, see [MS-RPCE].) This requirement
exists so that the server can implement its security model (section 3.1.2).
The data MUST be encrypted and decrypted using the RC4 algorithm (for more information about
RC4, see [SCHNEIER] section 17.1). The key, required during runtime by the RC4 algorithm, MUST be
the 16-byte key specified by the method using this structure (for examples, see sections 3.1.5.10.2
and 3.1.5.10.3). The encrypted portion of the SAMPR_ENCRYPTED_USER_PASSWORD_NEW.Buffer
structure MUST be protected in the same way, but the 16-byte key is specified in section 3.2.2.2.
The key required during runtime by the RC4 encryption algorithm that encrypts and decrypts the
protected portion of the SAMPR_ENCRYPTED_USER_PASSWORD_NEW.Buffer is specified by the
following pseudocode.
CALL MD5Init(md5context)
CALL MD5Update(md5context, SAMPR_USER_PASSWORD_NEW.ClearSalt, 16)
CALL MD5Update(md5context, user-session-key, 16)
CALL MD5Final(md5context)
Where:
user-session-key is the 16-byte SMB session key obtained as specified in section 3.2.2.3.
The client MUST retrieve the SMB session key as specified in [MS-CIFS] section 3.4.4.6.
225 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
3.2.3 Timers
None.
3.2.4 Initialization
None.
To obtain any context handle to the server, one of the following methods MUST be called initially:
SamrConnect2, SamrConnect4, or SamrConnect5. With the ServerHandle parameter returned from
these methods, it is possible to obtain other context handles and call any associated methods on the
handle. See section 4.1 for an example.
Note The following methods do not require a context handle and can be called directly; they also do
not return any context handle:
SamrGetDomainPasswordInformation
SamrSetDSRMPassword
SamrValidatePassword
SamrOemChangePasswordUser2
SamrUnicodeChangePasswordUser2
Note A user account MUST be enabled by clearing the UF_ACCOUNTDISABLE bit from the
userAccountControl attribute before that account will be able to authenticate, as specified in [MS-
KILE] section 3.3.5.7.1.
The protocol does not include its own timer events. Information about any transport-level timers is
specified in [MS-RPCE].
None.
226 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
4 Protocol Examples
The following sequence of methods and parameters creates a user account given a network address of
"msdc-1", a domain name of "ms", and a user name of "testuser".
1. Send SamrConnect.
ServerName msdc-1
DesiredAccess 0x31
2. Receive SamrConnect.
Status 0
3. Send SamrLookupDomainInSamServer.
ServerHandle serverHandle
Name.Length 4
Name.MaximumLength 4
Name.Buffer ms
4. Receive SamrLookupDomainInSamServer.
Parameter
field Parameter value
Status 0
5. Send SamrOpenDomain.
ServerHandle serverHandle
DesiredAccess 0x00000010
DomainId S-1-5-21-3448151421-356457007-600757626
6. Receive SamrOpenDomain.
227 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter field Parameter value
Status 0
7. Send SamrCreateUser2InDomain.
DomainHandle domainHandle
Name.Length 16
Name.MaximumLength 16
Name.Buffer testuser
AccountType 0x00000080
DesiredAccess 0x02000000
8. Receive SamrCreateUser2InDomain.
Status 0
GrantedAccess 0xf07ff
RelativeId 2810
9. Send SamrCloseHandle.
Handle userHandle
Status 0
Handle 0
Handle domainHandle
Status 0
228 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter field Parameter value
Handle 0
Handle serverHandle
Status 0
Handle 0
The following sequence of methods and parameters enables the user account created in the previous
example. This is performed on the machine with the network address of "msdc-1", a domain name of
"ms", and a user name of "testuser" with Relative ID = 2810.
1. Send SamrConnect.
ServerName msdc-1
DesiredAccess 0x31
2. Receive SamrConnect.
Status 0
3. Send SamrLookupDomainInSamServer.
ServerHandle serverHandle
Name.Length 4
Name.MaximumLength 4
Name.Buffer ms
4. Receive SamrLookupDomainInSamServer.
229 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Parameter
field Parameter value
Status 0
5. Send SamrOpenDomain.
ServerHandle serverHandle
DesiredAccess 0x00000200
DomainId S-1-5-21-3448151421-356457007-600757626
6. Receive SamrOpenDomain.
Status 0
7. Send SamrOpenUser.
DomainHandle domainHandle
DesiredAccess 0x02000000
UserId 2810
8. Receive SamrOpenUser.
Status 0
9. Send SamrSetInformationUser2.
UserHandle userHandle
UserInformationClass 16
Status 0
230 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
11. Send SamrCloseHandle.
Handle userHandle
Status 0
Handle 0
Handle domainHandle
Status 0
Handle 0
Handle serverHandle
Status 0
Handle 0
The following example shows actual values for the cleartext passwords and password hashes as well
as the key derivations necessary to apply [FIPS81].
LM hash of "OLDPASSWORD":
c9 b8 1d 93 9d 6f d8 0c d4 08 e6 b1 05 74 18 64
NT hash of "OLDPASSWORD":
231 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
66 77 b2 c3 94 31 13 55 b5 4f 25 ee c5 bf ac f5
LM hash of "NEWPASSWORD":
09 ee ab 5a a4 15 d6 e4 d4 08 e6 b1 05 74 18 64
NT hash of "NEWPASSWORD":
25 67 81 a6 20 31 28 9d 3c 2c 98 c1 4f 1e fc 8c
To demonstrate sample data values for the 7-byte InputKey and 8-byte OutputKey used in section
2.2.11.1.2, the following values are used for the encryption of the old NT hash with the new NT hash
shown above.
1. Split the NT hash of the old password into two blocks (2.2.11.1.1).
Block 1: 66 77 b2 c3 94 31 13 55
Block 2: b5 4f 25 ee c5 bf ac f5
2. Split the NT hash of the new password into two blocks (2.2.11.1.1).
Block 1: 25 67 81 a6 20 31 28 9d
Block 2: 3c 2c 98 c1 4f 1e fc 8c
3. The 7-byte keys are derived as stated in section 2.2.11.1.4 using the 16-byte hash value. Apply
the algorithm in section 2.2.11.1.2 to transform the 7-byte key into an 8-byte key.
OldNtOwfEncryptedWithNewNt:
da 39 84 64 27 f5 e6 c9 48 2c 8f e9 b3 3a 16 07
Likewise, the following values are used for encryption of the old LM hash with the new NT hash.
1. Split the LM hash of the old password into two blocks (2.2.11.1.1).
Block 1: c9 b8 1d 93 9d 6f d8 0c
Block 2: d4 08 e6 b1 05 74 18 64
2. As before, split the NT hash of the new password into two blocks (2.2.11.1.1).
232 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Block 1: 25 67 81 a6 20 31 28 9d
Block 2: 3c 2c 98 c1 4f 1e fc 8c
OldLmOwfEncryptedWithNewNt:
80 45 7a 72 72 5a 37 9c ed 8b 07 d2 fd 6f 46 ff
233 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
5 Security
Sensitive information, such as the cleartext password for accounts, is communicated through this
protocol; therefore, implementers have to pay special attention to the secrecy of this data. Although
this protocol does not use transport-level encryption (with the exception of SamrValidatePassword), it
does rely on the key strength of the SMB transport for encrypting cleartext data.
Creating a user object is a multi-step process in this protocol. These steps are outlined in the
example in section 4.1. After completing these steps correctly, the server creates a user object in its
abstract database. However, the user object is not usable for authentication in this state. The user
object needs to be enabled for authentication. The steps for enabling a user object are outlined in the
example in section 4.2. Optionally, a password can be set on the user object. As specified in the
previous paragraph, SamrSetInformationUser2 with UserInternal4InformationNew and
UserInternal5InformationNew is the best choice for setting a cleartext password in this protocol.
234 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
6 Appendix A: Full IDL
For ease of implementation, the full IDL is provided below, where "ms-dtyp.idl" is the IDL specified in
[MS-DTYP] Appendix A.
import "ms-dtyp.idl";
[
uuid(12345778-1234-ABCD-EF00-0123456789AC),
version(1.0),
ms_union,
pointer_default(unique)
]
interface samr{
235 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SidTypeDomain,
SidTypeAlias,
SidTypeWellKnownGroup,
SidTypeDeletedAccount,
SidTypeInvalid,
SidTypeUnknown,
SidTypeComputer, // Not used.
SidTypeLabel // Not used.
} SID_NAME_USE, *PSID_NAME_USE;
236 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _DOMAIN_STATE_INFORMATION {
DOMAIN_SERVER_ENABLE_STATE DomainServerState;
} DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION;
#pragma pack(4)
typedef struct _SAMPR_DOMAIN_GENERAL_INFORMATION {
OLD_LARGE_INTEGER ForceLogoff;
RPC_UNICODE_STRING OemInformation;
RPC_UNICODE_STRING DomainName;
RPC_UNICODE_STRING ReplicaSourceNodeName;
OLD_LARGE_INTEGER DomainModifiedCount;
unsigned long DomainServerState;
unsigned long DomainServerRole;
unsigned char UasCompatibilityRequired;
unsigned long UserCount;
unsigned long GroupCount;
unsigned long AliasCount;
} SAMPR_DOMAIN_GENERAL_INFORMATION,
*PSAMPR_DOMAIN_GENERAL_INFORMATION;
#pragma pack()
#pragma pack(4)
typedef struct _SAMPR_DOMAIN_GENERAL_INFORMATION2 {
SAMPR_DOMAIN_GENERAL_INFORMATION I1;
LARGE_INTEGER LockoutDuration;
LARGE_INTEGER LockoutObservationWindow;
unsigned short LockoutThreshold;
} SAMPR_DOMAIN_GENERAL_INFORMATION2,
*PSAMPR_DOMAIN_GENERAL_INFORMATION2;
#pragma pack()
237 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _SAMPR_DOMAIN_NAME_INFORMATION {
RPC_UNICODE_STRING DomainName;
} SAMPR_DOMAIN_NAME_INFORMATION, *PSAMPR_DOMAIN_NAME_INFORMATION;
RPC_UNICODE_STRING ReplicaSourceNodeName;
} SAMPR_DOMAIN_REPLICATION_INFORMATION,
*PSAMPR_DOMAIN_REPLICATION_INFORMATION;
238 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned long Index;
unsigned long Rid;
unsigned long AccountControl;
RPC_UNICODE_STRING AccountName;
RPC_UNICODE_STRING AdminComment;
RPC_UNICODE_STRING FullName;
} SAMPR_DOMAIN_DISPLAY_USER, *PSAMPR_DOMAIN_DISPLAY_USER;
239 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[case(DomainDisplayMachine)]
SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER MachineInformation;
[case(DomainDisplayGroup)]
SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER GroupInformation;
[case(DomainDisplayOemUser)]
SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER OemUserInformation;
[case(DomainDisplayOemGroup)]
SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER OemGroupInformation;
} SAMPR_DISPLAY_INFO_BUFFER, *PSAMPR_DISPLAY_INFO_BUFFER;
240 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef enum _ALIAS_INFORMATION_CLASS {
AliasGeneralInformation = 1,
AliasNameInformation,
AliasAdminCommentInformation
} ALIAS_INFORMATION_CLASS;
_SAMPR_ALIAS_INFO_BUFFER {
[case(AliasGeneralInformation)]
SAMPR_ALIAS_GENERAL_INFORMATION General;
[case(AliasNameInformation)]
SAMPR_ALIAS_NAME_INFORMATION Name;
[case(AliasAdminCommentInformation)]
SAMPR_ALIAS_ADM_COMMENT_INFORMATION AdminComment;
} SAMPR_ALIAS_INFO_BUFFER, *PSAMPR_ALIAS_INFO_BUFFER;
241 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned long WhichFields;
SAMPR_LOGON_HOURS LogonHours;
unsigned short BadPasswordCount;
unsigned short LogonCount;
unsigned short CountryCode;
unsigned short CodePage;
unsigned char LmPasswordPresent;
unsigned char NtPasswordPresent;
unsigned char PasswordExpired;
unsigned char PrivateDataSensitive;
} SAMPR_USER_ALL_INFORMATION, *PSAMPR_USER_ALL_INFORMATION;
242 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
unsigned short BadPasswordCount;
unsigned short LogonCount;
OLD_LARGE_INTEGER PasswordLastSet;
OLD_LARGE_INTEGER AccountExpires;
unsigned long UserAccountControl;
} SAMPR_USER_ACCOUNT_INFORMATION, *PSAMPR_USER_ACCOUNT_INFORMATION;
243 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
typedef struct _SAMPR_USER_INTERNAL5_INFORMATION {
SAMPR_ENCRYPTED_USER_PASSWORD UserPassword;
unsigned char PasswordExpired;
} SAMPR_USER_INTERNAL5_INFORMATION,
*PSAMPR_USER_INTERNAL5_INFORMATION;
244 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SAMPR_USER_WORKSTATIONS_INFORMATION WorkStations;
[case(UserControlInformation)]
USER_CONTROL_INFORMATION Control;
[case(UserExpiresInformation)]
USER_EXPIRES_INFORMATION Expires;
[case(UserInternal1Information)]
SAMPR_USER_INTERNAL1_INFORMATION Internal1;
[case(UserParametersInformation)]
SAMPR_USER_PARAMETERS_INFORMATION Parameters;
[case(UserAllInformation)]
SAMPR_USER_ALL_INFORMATION All;
[case(UserInternal4Information)]
SAMPR_USER_INTERNAL4_INFORMATION Internal4;
[case(UserInternal5Information)]
SAMPR_USER_INTERNAL5_INFORMATION Internal5;
[case(UserInternal4InformationNew)]
SAMPR_USER_INTERNAL4_INFORMATION_NEW Internal4New;
[case(UserInternal5InformationNew)]
SAMPR_USER_INTERNAL5_INFORMATION_NEW Internal5New;
} SAMPR_USER_INFO_BUFFER, *PSAMPR_USER_INFO_BUFFER;
245 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
*PSAM_VALIDATE_AUTHENTICATION_INPUT_ARG;
typedef
[switch_type(PASSWORD_POLICY_VALIDATION_TYPE)]
union _SAM_VALIDATE_INPUT_ARG{
[case(SamValidateAuthentication)]
SAM_VALIDATE_AUTHENTICATION_INPUT_ARG
ValidateAuthenticationInput;
[case(SamValidatePasswordChange)]
SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG
ValidatePasswordChangeInput;
[case(SamValidatePasswordReset)]
SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG
ValidatePasswordResetInput;
} SAM_VALIDATE_INPUT_ARG, *PSAM_VALIDATE_INPUT_ARG;
typedef
[switch_type(PASSWORD_POLICY_VALIDATION_TYPE)]
union _SAM_VALIDATE_OUTPUT_ARG{
[case(SamValidateAuthentication)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG
ValidateAuthenticationOutput;
[case(SamValidatePasswordChange)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG
ValidatePasswordChangeOutput;
[case(SamValidatePasswordReset)]
SAM_VALIDATE_STANDARD_OUTPUT_ARG
ValidatePasswordResetOutput;
} SAM_VALIDATE_OUTPUT_ARG, *PSAM_VALIDATE_OUTPUT_ARG;
// opnum 0
long SamrConnect(
[in, unique] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE * ServerHandle,
[in] unsigned long DesiredAccess
);
// opnum 1
long
SamrCloseHandle(
[in,out] SAMPR_HANDLE * SamHandle
);
// opnum 2
long
SamrSetSecurityObject(
[in] SAMPR_HANDLE ObjectHandle,
[in] SECURITY_INFORMATION SecurityInformation,
246 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
);
// opnum 3
long
SamrQuerySecurityObject(
[in] SAMPR_HANDLE ObjectHandle,
[in] SECURITY_INFORMATION SecurityInformation,
[out] PSAMPR_SR_SECURITY_DESCRIPTOR * SecurityDescriptor
);
// opnum 4
void Opnum4NotUsedOnWire(void);
// opnum 5
long
SamrLookupDomainInSamServer(
[in] SAMPR_HANDLE ServerHandle,
[in] PRPC_UNICODE_STRING Name,
[out] PRPC_SID * DomainId
);
// opnum 6
long
SamrEnumerateDomainsInSamServer(
[in] SAMPR_HANDLE ServerHandle,
[in,out] unsigned long * EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER * Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long * CountReturned
);
// opnum 7
long
SamrOpenDomain(
[in] SAMPR_HANDLE ServerHandle,
[in] unsigned long DesiredAccess,
[in] PRPC_SID DomainId,
[out] SAMPR_HANDLE * DomainHandle
);
// opnum 8
long
SamrQueryInformationDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[out, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER * Buffer
);
// opnum 9
long
SamrSetInformationDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[in, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER DomainInformation
);
// opnum 10
long
SamrCreateGroupInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE * GroupHandle,
[out] unsigned long * RelativeId
);
247 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
// opnum 11
long
SamrEnumerateGroupsInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in,out] unsigned long * EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER * Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long * CountReturned
);
// opnum 12
long
SamrCreateUserInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE * UserHandle,
[out] unsigned long * RelativeId
);
// opnum 13
long
SamrEnumerateUsersInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in,out] unsigned long * EnumerationContext,
[in] unsigned long UserAccountControl,
[out] PSAMPR_ENUMERATION_BUFFER * Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long * CountReturned
);
// opnum 14
long
SamrCreateAliasInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING AccountName,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE * AliasHandle,
[out] unsigned long * RelativeId
);
// opnum 15
long
SamrEnumerateAliasesInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in,out] unsigned long * EnumerationContext,
[out] PSAMPR_ENUMERATION_BUFFER * Buffer,
[in] unsigned long PreferedMaximumLength,
[out] unsigned long * CountReturned
);
// opnum 16
long
SamrGetAliasMembership(
[in] SAMPR_HANDLE DomainHandle,
[in] PSAMPR_PSID_ARRAY SidArray,
[out] PSAMPR_ULONG_ARRAY Membership
);
// opnum 17
long
SamrLookupNamesInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, range(0, 1000)] unsigned long Count,
[in, size_is(1000), length_is(Count)] RPC_UNICODE_STRING Names[*],
[out] PSAMPR_ULONG_ARRAY RelativeIds,
[out] PSAMPR_ULONG_ARRAY Use
248 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
);
// opnum 18
long
SamrLookupIdsInDomain(
[in] SAMPR_HANDLE DomainHandle,
[in, range(0, 1000)] unsigned long Count,
[in, size_is(1000), length_is(Count)] unsigned long *RelativeIds,
[out] PSAMPR_RETURNED_USTRING_ARRAY Names,
[out] PSAMPR_ULONG_ARRAY Use
);
// opnum 19
long
SamrOpenGroup(
[in] SAMPR_HANDLE DomainHandle,
// opnum 20
long
SamrQueryInformationGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] GROUP_INFORMATION_CLASS GroupInformationClass,
[out, switch_is(GroupInformationClass)]
PSAMPR_GROUP_INFO_BUFFER * Buffer
);
// opnum 21
long
SamrSetInformationGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] GROUP_INFORMATION_CLASS GroupInformationClass,
[in, switch_is(GroupInformationClass)]
PSAMPR_GROUP_INFO_BUFFER Buffer
);
// opnum 22
long
SamrAddMemberToGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId,
[in] unsigned long Attributes
);
// opnum 23
long
SamrDeleteGroup(
[in,out] SAMPR_HANDLE * GroupHandle
);
// opnum 24
long
SamrRemoveMemberFromGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId
);
// opnum 25
long
SamrGetMembersInGroup(
[in] SAMPR_HANDLE GroupHandle,
[out] PSAMPR_GET_MEMBERS_BUFFER * Members
);
// opnum 26
249 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
long
SamrSetMemberAttributesOfGroup(
[in] SAMPR_HANDLE GroupHandle,
[in] unsigned long MemberId,
[in] unsigned long Attributes
);
// opnum 27
long
SamrOpenAlias(
[in] SAMPR_HANDLE DomainHandle,
[in] unsigned long DesiredAccess,
[in] unsigned long AliasId,
[out] SAMPR_HANDLE * AliasHandle
);
// opnum 28
long
SamrQueryInformationAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] ALIAS_INFORMATION_CLASS AliasInformationClass,
[out, switch_is(AliasInformationClass)]
PSAMPR_ALIAS_INFO_BUFFER * Buffer
);
// opnum 29
long
SamrSetInformationAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] ALIAS_INFORMATION_CLASS AliasInformationClass,
[in, switch_is(AliasInformationClass)]
PSAMPR_ALIAS_INFO_BUFFER Buffer
);
// opnum 30
long
SamrDeleteAlias(
[in, out] SAMPR_HANDLE * AliasHandle
);
// opnum 31
long
SamrAddMemberToAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PRPC_SID MemberId
);
// opnum 32
long
SamrRemoveMemberFromAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PRPC_SID MemberId
);
// opnum 33
long
SamrGetMembersInAlias(
[in] SAMPR_HANDLE AliasHandle,
[out] PSAMPR_PSID_ARRAY_OUT Members
);
// opnum 34
long
SamrOpenUser(
[in] SAMPR_HANDLE DomainHandle,
[in] unsigned long DesiredAccess,
[in] unsigned long UserId,
[out] SAMPR_HANDLE * UserHandle
250 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
);
// opnum 35
long
SamrDeleteUser(
[in,out] SAMPR_HANDLE * UserHandle
);
// opnum 36
long
SamrQueryInformationUser(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[out, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER * Buffer
);
// opnum 37
long
SamrSetInformationUser(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[in, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER Buffer
);
// opnum 38
long
SamrChangePasswordUser(
[in] SAMPR_HANDLE UserHandle,
[in] unsigned char LmPresent,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm,
[in] unsigned char NtPresent,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt,
[in] unsigned char NtCrossEncryptionPresent,
[in, unique] PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm,
[in] unsigned char LmCrossEncryptionPresent,
[in, unique] PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt
);
// opnum 39
long
SamrGetGroupsForUser(
[in] SAMPR_HANDLE UserHandle,
[out] PSAMPR_GET_GROUPS_BUFFER * Groups
);
// opnum 40
long
SamrQueryDisplayInformation (
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
[in] unsigned long PreferredMaximumLength,
[out] unsigned long * TotalAvailable,
[out] unsigned long * TotalReturned,
[out, switch_is(DisplayInformationClass)]
PSAMPR_DISPLAY_INFO_BUFFER Buffer
);
// opnum 41
long
SamrGetDisplayEnumerationIndex (
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
251 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] PRPC_UNICODE_STRING Prefix,
[out] unsigned long * Index
);
// opnum 42
void Opnum42NotUsedOnWire(void);
// opnum 43
void Opnum43NotUsedOnWire(void);
// opnum 44
long
SamrGetUserDomainPasswordInformation (
[in] SAMPR_HANDLE UserHandle,
[out] PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation
);
// opnum 45
long
SamrRemoveMemberFromForeignDomain (
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_SID MemberSid
);
// opnum 46
long
SamrQueryInformationDomain2(
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_INFORMATION_CLASS DomainInformationClass,
[out, switch_is(DomainInformationClass)]
PSAMPR_DOMAIN_INFO_BUFFER * Buffer
);
// opnum 47
long
SamrQueryInformationUser2(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[out, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER * Buffer
);
// opnum 48
long
SamrQueryDisplayInformation2 (
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
[in] unsigned long PreferredMaximumLength,
[out] unsigned long *TotalAvailable,
[out] unsigned long *TotalReturned,
[out, switch_is(DisplayInformationClass)]
PSAMPR_DISPLAY_INFO_BUFFER Buffer
);
// opnum 49
long
SamrGetDisplayEnumerationIndex2 (
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] PRPC_UNICODE_STRING Prefix,
[out] unsigned long * Index
);
// opnum 50
long
SamrCreateUser2InDomain(
252 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] SAMPR_HANDLE DomainHandle,
[in] PRPC_UNICODE_STRING Name,
[in] unsigned long AccountType,
[in] unsigned long DesiredAccess,
[out] SAMPR_HANDLE * UserHandle,
[out] unsigned long * GrantedAccess,
[out] unsigned long * RelativeId
);
// opnum 51
long
SamrQueryDisplayInformation3 (
[in] SAMPR_HANDLE DomainHandle,
[in] DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
[in] unsigned long Index,
[in] unsigned long EntryCount,
[in] unsigned long PreferredMaximumLength,
[out] unsigned long * TotalAvailable,
[out] unsigned long * TotalReturned,
[out, switch_is(DisplayInformationClass)]
PSAMPR_DISPLAY_INFO_BUFFER Buffer
);
// opnum 52
long
SamrAddMultipleMembersToAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PSAMPR_PSID_ARRAY MembersBuffer
);
// opnum 53
long
SamrRemoveMultipleMembersFromAlias(
[in] SAMPR_HANDLE AliasHandle,
[in] PSAMPR_PSID_ARRAY MembersBuffer
);
// opnum 54
long
SamrOemChangePasswordUser2(
[in] handle_t BindingHandle,
[in,unique] PRPC_STRING ServerName,
[in] PRPC_STRING UserName,
[in,unique]
PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
[in,unique]
PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm
);
// opnum 55
long
SamrUnicodeChangePasswordUser2(
[in] handle_t BindingHandle,
[in,unique] PRPC_UNICODE_STRING ServerName,
[in] PRPC_UNICODE_STRING UserName,
[in,unique]
PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt,
[in,unique]
PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt,
[in] unsigned char LmPresent,
[in,unique]
PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
[in,unique]
PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewNt
);
// opnum 56
long
253 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SamrGetDomainPasswordInformation (
[in] handle_t BindingHandle,
[in,unique] PRPC_UNICODE_STRING Unused,
[out] PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation
);
// opnum 57
long
SamrConnect2(
[in,unique,string] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE *ServerHandle,
[in] unsigned long DesiredAccess
);
// opnum 58
long
SamrSetInformationUser2(
[in] SAMPR_HANDLE UserHandle,
[in] USER_INFORMATION_CLASS UserInformationClass,
[in, switch_is(UserInformationClass)]
PSAMPR_USER_INFO_BUFFER Buffer
);
// opnum 59
void Opnum59NotUsedOnWire(void);
// opnum 60
void Opnum60NotUsedOnWire(void);
// opnum 61
void Opnum61NotUsedOnWire(void);
// opnum 62
long
SamrConnect4(
[in,unique,string] PSAMPR_SERVER_NAME ServerName,
[out] SAMPR_HANDLE *ServerHandle,
[in] unsigned long ClientRevision,
[in] unsigned long DesiredAccess
);
// opnum 63
void Opnum63NotUsedOnWire(void);
// opnum 64
long
SamrConnect5(
[in,unique,string] PSAMPR_SERVER_NAME ServerName,
[in] unsigned long DesiredAccess,
[in] unsigned long InVersion,
[in] [switch_is(InVersion)] SAMPR_REVISION_INFO *InRevisionInfo,
[out] unsigned long *OutVersion,
[out] [switch_is(*OutVersion)]
SAMPR_REVISION_INFO *OutRevisionInfo,
[out] SAMPR_HANDLE *ServerHandle
);
// opnum 65
long
SamrRidToSid(
[in] SAMPR_HANDLE ObjectHandle,
[in] unsigned long Rid,
[out] PRPC_SID * Sid
);
// opnum 66
long
SamrSetDSRMPassword(
254 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
[in] handle_t BindingHandle,
[in,unique] PRPC_UNICODE_STRING Unused,
[in] unsigned long UserId,
[in,unique] PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
);
// opnum 67
long
SamrValidatePassword(
[in] handle_t Handle,
[in] PASSWORD_POLICY_VALIDATION_TYPE ValidationType,
[in, switch_is(ValidationType)] PSAM_VALIDATE_INPUT_ARG InputArg,
[out, switch_is(ValidationType)]
PSAM_VALIDATE_OUTPUT_ARG * OutputArg
);
// Opnum 68
void Opnum68NotUsedOnWire(void);
// Opnum 69
void Opnum69NotUsedOnWire(void);
255 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
7 Appendix B: Product Behavior
The information in this specification is applicable to the following Microsoft products or supplemental
software. References to product versions include updates to those products.
The terms "earlier" and "later", when used with a product version, refer to either all preceding
versions or all subsequent versions, respectively. The term "through" refers to the inclusive range of
versions. Applicable Microsoft products are listed chronologically in this section.
The following tables show the relationships between Microsoft product versions or supplemental
software and the roles they perform.
256 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Windows Server releases Client role Server role
Exceptions, if any, are noted in this section. If an update version, service pack or Knowledge Base
(KB) number appears with a product name, the behavior changed in that update. The new behavior
also applies to subsequent updates unless otherwise specified. If a product edition appears with the
product version, behavior is different in that product edition.
Unless otherwise specified, any statement of optional behavior in this specification that is prescribed
using the terms "SHOULD" or "SHOULD NOT" implies product behavior in accordance with the
SHOULD or SHOULD NOT prescription. Unless otherwise specified, the term "MAY" implies that the
product does not follow the prescription.
<1> Section 1.3.2: There is no supported configuration in which this method is called from Windows
clients. See section 2.2.3.15 for details on the conditions under which this method is called from a
client.
<2> Section 1.6: The DC implementation of this protocol is largely for backward compatibility with
Windows NT 4.0–style applications. The LDAP protocol can be used to access a superset of the
information exposed in this protocol (see [MS-ADTS] section 3.1.1.3). The notable exceptions to this
rule are that Windows clients use this protocol to join a domain ([MS-ADOD] sections 2.7.7 and 3.1)
and that they use the SamrUnicodeChangePasswordUser2 method to change passwords.
<3> Section 1.6: Windows clients depend on this protocol in order to perform an end-user password
change and join computers to a domain (as specified in [MS-ADTS] section 6.4).
<4> Section 1.7.1: The following table depicts a timeline of when each method was introduced. The
Product column indicates the Windows version in which each method was introduced. Unless otherwise
noted, all methods listed in the table continue to be supported in subsequent versions of Windows
according to the applicability lists at the beginning of this section.
257 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Opnum Friendly name Product
258 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Opnum Friendly name Product
<5> Section 1.7.2: Windows clients call deprecated methods under the following conditions. There is
no benefit in doing so.
SamrQueryInformationDomain Windows clients call this method for information levels less than or equal to
DomainStateInformation (see section 2.2.4.16 for a description of the
information levels).
259 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Deprecated method Condition
SamrQueryDisplayInformation Windows clients call this method for information levels less than or equal to
DomainDisplayMachine (see section 2.2.8.12 for a description of the
information levels).
SamrQueryDisplayInformation2 Windows clients call this method for information levels less than or equal to
DomainDisplayGroup (see section 2.2.8.12 for a description of the
information levels).
SamrGetDisplayEnumerationIndex Windows clients call this method for information levels less than or equal to
DomainDisplayMachine (see section 2.2.8.12 for a description of the
information levels).
SamrQueryInformationUser Windows clients call this method under all conditions; even though
SamrQueryInformationUser2 is available to be called, it is not called from
any Windows clients.
SamrSetInformationUser Windows clients call this method for information levels other than
UserInternal4InformationNew and UserInternal5InformationNew (see section
2.2.7.28 for a description of the information levels).
<6> Section 1.7.3: All information levels are supported in Windows NT 4.0, Windows 2000 Server,
and later with the exception of GroupReplicationInformation for SamrQueryInformationGroup. This
information level is supported in Windows Server 2003, and later.
<7> Section 2.1: Windows NT operating system, Windows 2000, Windows Server 2003, and Windows
Server 2003 R2 operating system implementations of the server for this protocol can be configured to
use the SPX (NCACN_SPX) protocol, as specified in [MS-RPCE] section 2.1.1.3; the AppleTalk
(NCACN_AT_DSP) protocol, as specified in [MS-RPCE] section 2.1.1.7; and the Banyan VINES
protocol. This configuration can be enabled by adding the following registry values of type
REG_DWORD and by modifying the value to be nonzero:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA
In addition, none of the Windows implementations of the client for this protocol can be configured to
use protocols that are not listed in section 2.1.
<8> Section 2.1: Windows 2000, Windows XP, Windows Server 2003, and Windows Server 2003 R2
process calls for all opnums over the RPC-over-named-pipes (NCACN_NP) protocol. Windows Vista
operating system with Service Pack 2 (SP2), Windows 7, and later, and Windows Server 2008
operating system with Service Pack 2 (SP2), Windows Server 2008 R2, and later behave in the same
way, except that calls made to SamrValidatePassword using NCACN_NP are rejected with
RPC_S_ACCESS_DENIED.
<9> Section 2.1: By default, the endpoint "\PIPE\samr" allows anonymous access on Windows NT 3.1,
Windows NT 3.5, Windows NT 3.51, Windows 2000, Windows XP, Windows Server 2003, Windows
Server 2003 R2, and Windows Vista. Anonymous access to this pipe on non–domain controller
machines is removed by default on Windows Vista operating system with Service Pack 1 (SP1),
Windows 7, and later, and on Windows Server 2008 and later. The pipe access check happens before
any other access check, and therefore overrides any other access.
260 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
<10> Section 2.1: Windows 2000, Windows XP, Windows Server 2003, and Windows Server 2003 R2
process calls for all opnums over TCP (NCACN_IP_TCP). Windows Vista SP2, Windows 7, and later,
and Windows Server 2008 with SP2, Windows Server 2008 R2, and later behave in the same way,
except that calls made to SamrSetDSRMPassword using NCACN_IP_TCP are rejected with
RPC_S_ACCESS_DENIED.
<11> Section 2.1: A service-specific service principal name is not registered for this protocol.
Windows-based clients use the host-based service principal name to identify the server for mutual
authentication for the SMB and TCP RPC transports.
<12> Section 2.1: Servers running Windows 2000, Windows XP, and Windows Server 2003 accept
calls at any authentication level. Without [MSKB-3149090] installed, servers running Windows Vista,
Windows Server 2008, Windows 7, Windows Server 2008 R2, Windows 8, Windows Server 2012,
Windows 8.1, Windows Server 2012 R2, Windows 10 v1507 operating system, or Windows 10 v1511
operating system also accept calls at any authentication level.
<13> Section 2.1: The Windows-based client uses transport security to encrypt the message for
SamrValidatePassword.
<14> Section 2.2.3.15: There is no supported configuration in which Windows implementations of the
server of this protocol (for example, a DC) return nonzero values for the SupportedFeatures field.
However, Windows protocol clients running Windows XP and later are implemented to behave as
specified in the description for the SupportedFeatures field. For example, after calling
SamrCreateUser2InDomain (section 3.1.5.4.4), Windows NT 4.0–style client applications assume that
the RID returned by SamrCreateUser2InDomain can be concatenated with the domain SID in which
the user was created to obtain the SID of the newly created user. This assumption limits the server's
ability to create SIDs that differ in format from this assumption, and thus limits the number of
accounts ever created to 2^32 (the maximum size of an unsigned integer, which is the datatype of a
RID). For more information about the extensible structure of SIDs, see [MS-AZOD] section 1.1.1.2.
To allow servers (in future implementations) to generate SIDs such that the RID is not an unsigned
integer (for example, a 64-bit value), the SupportedFeatures value of 1 specifies to the client that the
SamrRidToSid method is to be called to obtain the SID of a RID value returned from this protocol. In
this scenario, the RID returned from the protocol is modeled as a "handle" to the account that
SamrRidToSid uses to return the SID value.
The two reserved values (0x00000002 and 0x00000004) have no effect on the protocol; however,
when these values are set, the Windows NET API ([MSDN-NMF]) on the client behaves as shown in the
following table. These values are mutually exclusive with each other, though they can be combined
using a logical OR with other bits.
Value Description
0x00000002 All fields that return a RID value return the value 0 instead of the RID value returned from the
SAM Remote Protocol (Client-to-Server).
0x00000004 All method calls that accept information levels that return a RID fail with a Windows error code of
ERROR_NOT_SUPPORTED (defined in [MS-ERREF] section 2.2).
<15> Section 2.2.7.1: Windows interactive-logon applications expect this value to be a UNC path (for
example, \\machine-name\share-name\directory-name), or a fully qualified local path, including the
drive letter (for example, "c:\directory\folder").
<16> Section 2.2.7.1: Windows interactive-logon applications expect this value to be either a zero-
length string or a string with two characters: an alphabetic character, 'a' through 'z', in lower- or
uppercase, followed by a colon (':').
261 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
<17> Section 2.2.7.1: This value is not accurate in multiple-DC configurations, as this value is not
replicated among DCs. Therefore, this field is not to be used by clients. Windows clients do not use
this field.
<18> Section 2.2.7.1: This value is not accurate in multiple-DC configurations, because this value is
not replicated among DCs. Windows clients do not use this field.
<19> Section 2.2.7.1: This value is not accurate in multiple-DC configurations, because this value is
not replicated among DCs. Therefore, this field is not to be used by clients. Windows clients do not use
this field.
<20> Section 2.2.10.1: Windows sets this buffer to the repeating pattern 0x20 0x00 on update.
<21> Section 2.2.10.1: Windows implementations of the protocol server set the Reserved5 field to
arbitrary values.
<22> Section 2.2.10.2: Windows sets this value to 1 or 2, but does not use the value.
<23> Section 2.2.10.3: Windows sets this value to 0x31 and ignores it on read.
<24> Section 2.2.10.8: When the current domain functional level is DS_BEHAVIOR_WIN2003 or less,
a Windows Server 2008 and later DC includes a KeyType of -140 in each of
KERB_STORED_CREDENTIAL and KERB_STORED_CREDENTIAL_NEW, which is not needed and can be
ignored; it is a dummy type in the supplemental credentials that is not present when the domain
functional level is raised to DS_BEHAVIOR_WIN2008 or greater. The key data is the NT hash of the
password.
<25> Section 3.1.1.5: Windows 2000 Server, Windows Server 2003, and Windows Server 2003 R2 do
not support the msDS-ResultantPSO attribute.
<26> Section 3.1.1.6: This modification is always allowed in Windows 2000 and in the following
products that do NOT have [MSKB-3072595] installed: Windows Server 2003, Windows Server 2003
R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server
2012 R2.
<30> Section 3.1.1.8.11.4: Windows uses the account's userPrincipalName as the DefaultSalt value.
However, it does not use this value in any calculation.
<31> Section 3.1.1.8.11.4: Windows implementations of the protocol server include irrelevant bytes
in the KERB_STORED_CREDENTIAL structure for a single KERB_KEY_DATA structure (20 bytes). The
bytes appear directly prior to the start of DefaultSalt. They are not referenced by any offset value or
necessary for interoperability. All bits in these bytes are 0.
<32> Section 3.1.1.8.11.6: Windows implementations of the protocol server include irrelevant bytes
in the KERB_STORED_CREDENTIAL_NEW structure for a single KERB_KEY_DATA_NEW structure (24
bytes). The bytes appear directly prior to the start of DefaultSalt. They are not referenced by any
offset value or necessary for interoperability. All bits in these bytes are 0.
262 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
<33> Section 3.1.1.8.11.7: Windows 2000 Server, Windows Server 2003, Windows Server 2003 R2,
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2
do not set the NTLM-Strong-NTOWF property.
<34> Section 3.1.1.9.2.1: If the constraints in step 1 cannot be satisfied, the server returns an error
code to the client and initiates an asynchronous call to IDL_DRSGetNCChanges to obtain a new
rIDAllocationPool, if such an asynchronous call is not already active.
<35> Section 3.1.2: In Windows 2000 operating system Service Pack 4 (SP4), Windows Server 2003
operating system with Service Pack 1 (SP1), Windows Server 2003 R2, and Windows XP operating
system Service Pack 2 (SP2), the Windows implementation of RPC does not satisfy this requirement.
Consequently, a security check is enforced by the server of this protocol to ensure this constraint.
Specifically, the server ensures that the SID of the client matches the SID of the client that opened
the handle. If this condition is not met, a processing error is returned to the client.
<36> Section 3.1.4.2: The following tables list the Windows versions in which various accounts were
introduced. All accounts continue to exist in subsequent versions of Windows according to the
applicability lists at the beginning of this section.
263 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Name Revision introduced
264 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Name Revision introduced
<37> Section 3.1.4.2: In Windows 2000 Server, Windows Server 2003, and Windows Server 2003 R2,
the initial membership of this group depends on the version of Windows running on the first DC of the
domain and on the administrator's choice between "Pre-Windows 2000–compatible permissions mode"
and "Windows 2000–only permissions mode".
Membership of the "Pre-Windows 2000 Compatible Access" group in Windows 2000 Server, Windows
Server 2003, and Windows Server 2003 R2 is shown in the following table.
265 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Operating system "Pre-Windows 2000-compatible "Windows 2000-only permissions
version permissions mode" mode"
Membership of the "Pre-Windows 2000 Compatible Access" group in Windows Server 2008 and later is
"Authenticated Users" (S-1-5-11).
<38> Section 3.1.5: Opnums reserved for local use apply to Windows as follows.
Opnum Description
<43> Section 3.1.5.2.1: Windows does NOT validate the input, though the result of malformed
information merely results in inconsistent output to the client.
<44> Section 3.1.5.2.1: Windows estimates the number of entries to return by dividing
PreferedMaximumLength by the number of bytes of a maximum-sized entry.
<45> Section 3.1.5.2.2: Windows does not validate the input, though the result of malformed
information merely results in inconsistent output to the client.
<46> Section 3.1.5.2.2: Windows estimates the number of entries to return by dividing
PreferedMaximumLength by the number of bytes of a maximum-sized entry.
<47> Section 3.1.5.3: Non-DC configurations do not cache implementation-specific enumeration state
on the domain handle; DC configurations do.
266 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
<48> Section 3.1.5.3.1: This value is estimated and is not accurate. Windows clients do not rely on
the accuracy of this value.
On a DC, this value is an implementation-specific value that satisfies the requirement shown earlier.
<50> Section 3.1.5.4.4: The test for an explicit DENY ACE is NOT performed in Windows 2000. This
test is also NOT performed in the following products that do not have [MSKB-3072595] installed:
Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2,
Windows Server 2012, and Windows Server 2012 R2.
<51> Section 3.1.5.4.4: This behavior is NOT performed in Windows 2000, and is also NOT performed
in the following products that do not have [MSKB-3072595] installed: Windows Server 2003, Windows
Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and
Windows Server 2012 R2. In these cases, the server behaves as if CallerPrimaryGroup is NOT equal to
DOMAIN_GROUP_RID_COMPUTERS.
<55> Section 3.1.5.7.1: Applicable Windows Server releases return error STATUS_DS_BUSY
(0xc00002a5).
<56> Section 3.1.5.7.2: Applicable Windows Server releases return error STATUS_DS_BUSY
(0xc00002a5).
<57> Section 3.1.5.7.3: Applicable Windows Server releases return error STATUS_DS_BUSY
(0xc00002a5).
<58> Section 3.1.5.8.3: Servers running Windows 2000 Server, Windows Server 2003, Windows
Server 2003 R2, and Windows Server 2008 do not check whether the domain prefixes of objectSid
attributes from objects in M and G match.
<59> Section 3.1.5.10.2: Windows implementations of the protocol server ignore the ServerName
parameter.
<60> Section 3.1.5.10.3: Windows implementations of the protocol server ignore the ServerName
parameter.
SID PRINCIPAL_SELF_SID
ObjectGuid ab721a53-1e2f-11d0-9819-00aa0040529b
267 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
Field name Value
SID World
ObjectGuid ab721a53-1e2f-11d0-9819-00aa0040529b
If USER_CHANGE_PASSWORD is granted to Self or World on receipt, Windows removes the above two
ACEs (if present) and adds the following two ACEs, if not already present.
SID Self
ObjectGuid ab721a53-1e2f-11d0-9819-00aa0040529b
SID World
ObjectGuid ab721a53-1e2f-11d0-9819-00aa0040529b
<62> Section 3.1.5.13.4: Windows clients set this value to be the null-terminated NETBIOS name of
the server.
<63> Section 3.1.5.13.6: Windows 2000 Server and later enforce that the UserId parameter is 0x1F4.
<64> Section 3.1.5.13.6: Windows does not decrypt the value but stores the encrypted value directly
in an implementation-specific store.
<65> Section 3.1.5.13.7.1: Windows Server 2003, Windows Server 2003 R2, and Windows Server
2008 test the PasswordLastSet conditions (constraints 5 and 6) immediately after testing the
LockoutTime conditions (constraints 1 and 2).
<66> Section 3.1.5.13.7.2: Starting with Windows 2000 Server, if there is a custom password filter
installed, and that password filter fails to validate the password, Windows implementations of the
protocol server set ValidationStatus to SamValidatePasswordFilterError.
<67> Section 3.1.5.13.7.3: Starting with Windows 2000 Server, if there is a custom password filter
installed, and that password filter fails to validate the password, Windows implementations of the
protocol server set ValidationStatus to SamValidatePasswordFilterError.
<68> Section 3.1.5.14.1: Windows uses the sAMAccountName attribute unless the sAMAccountName
attribute contains characters that are not allowed for an RDN (RDN syntax is specified in [MS-ADTS]
268 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
section 3.1.1.1.4), in which case the objectSid is used (in string form). If the sAMAccountName is not
a unique RDN for the given container, the server returns STATUS_USER_EXISTS to the client.
269 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
8 Change Tracking
This section identifies changes that were made to this document since the last release. Changes are
classified as Major, Minor, or None.
The revision class Major means that the technical content in the document was significantly revised.
Major changes affect protocol interoperability or implementation. Examples of major changes are:
The revision class Minor means that the meaning of the technical content was clarified. Minor changes
do not affect protocol interoperability or implementation. Examples of minor changes are updates to
clarify ambiguity at the sentence, paragraph, or table level.
The revision class None means that no new technical changes were introduced. Minor editorial and
formatting changes may have been made, but the relevant technical content is identical to the last
released version.
The changes made to this document are listed in the following table. For more information, please
contact [email protected].
Revision
Section Description
class
270 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
9 Index
A Constant value definitions 29
Constraints - attributes 102
Abstract data model Create pattern 159
client 225 Create Pattern method 159
server 97 Creating a user account example 228
Access - default 129 Creating user account example 228
Access checks Credentials structures - supplemental 84
Active Directory in DC configuration 129
standard handle-based 123 D
ACCESS_SYSTEM_SECURITY 29
Accounts - default 129 Data model
ACTRL_DS_CONTROL_ACCESS 42 abstract
ACTRL_DS_DELETE_TREE 42 client 225
ACTRL_DS_LIST 42 server 97
ACTRL_DS_READ_PROP 42 SamContextHandle 123
ACTRL_DS_WRITE_PROP 42 Data model - abstract
Algorithms client 225
DES-ECB-LM 94 server 97
Kerberos encryption 94 Data types
Alias alias query/set 58
creating 159 basic 42
fields 59 common - overview 28
query/set data types 58 constant value definitions 29
ALIAS_ADD_MEMBER 32 domain query/set 49
ALIAS_ALL_ACCESS 32 group query/set 56
ALIAS_EXECUTE 32 protocol-specific types 44
ALIAS_INFORMATION_CLASS enumeration 60 SamrValidatePassword 79
ALIAS_LIST_MEMBERS 32 selective enumerate associated structures 74
ALIAS_READ 32 supplemental credentials structures 84
ALIAS_READ_INFORMATION 32 user query/set 60
ALIAS_REMOVE_MEMBER 32 Default access 129
ALIAS_WRITE 32 Default accounts 129
ALIAS_WRITE_ACCOUNT 32 DELETE 29
Applicability 26 Delete pattern 182
Attributes Delete Pattern method 182
constraints 102 Directory service schema elements 96
listing 99 Domain
password settings 101 fields 49
triggers for originating updates 110 query/set data types 49
DOMAIN_ADMINISTER_SERVER 30
B DOMAIN_ALIAS_RID_ADMINS 40
DOMAIN_ALL_ACCESS 30
Basic data types 42 DOMAIN_CREATE_ALIAS 30
DOMAIN_CREATE_GROUP 30
C DOMAIN_CREATE_USER 30
DOMAIN_DISPLAY_INFORMATION enumeration 78
Capability negotiation 26 DOMAIN_EXECUTE 30
Change password pattern 191 DOMAIN_GET_ALIAS_MEMBERSHIP 30
Change Password Pattern method 191 DOMAIN_GROUP_RID_COMPUTERS 40
Change tracking 271 DOMAIN_GROUP_RID_CONTROLLERS 40
Classes - object class list 101 DOMAIN_GROUP_RID_READONLY_CONTROLLERS 40
Client DOMAIN_GROUP_RID_USERS 40
abstract data model 225 DOMAIN_INFORMATION_CLASS enumeration 54
initialization 226 DOMAIN_LIST_ACCOUNTS 30
local events 227 DOMAIN_LOGOFF_INFORMATION structure 52
message processing 226 DOMAIN_LOOKUP 30
security model 225 DOMAIN_MODIFIED_INFORMATION structure 52
sequencing rules 226 DOMAIN_MODIFIED_INFORMATION2 structure 52
timer events 226 DOMAIN_PASSWORD_INFORMATION structure 51
timers 226 DOMAIN_READ 30
Common data types 28 DOMAIN_READ_OTHER_PARAMETERS 30
271 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
DOMAIN_READ_PASSWORD_PARAMETERS 30 GROUP_READ 31
DOMAIN_SERVER_ENABLE_STATE enumeration 51 GROUP_READ_INFORMATION 31
DOMAIN_SERVER_ROLE enumeration 51 GROUP_REMOVE_MEMBER 31
DOMAIN_SERVER_ROLE_INFORMATION structure 52 GROUP_TYPE_ACCOUNT_GROUP 37
DOMAIN_STATE_INFORMATION structure 51 GROUP_TYPE_RESOURCE_GROUP 37
DOMAIN_USER_RID_ADMIN 40 GROUP_TYPE_SECURITY_ACCOUNT 37
DOMAIN_USER_RID_GUEST 40 GROUP_TYPE_SECURITY_ENABLED 37
DOMAIN_USER_RID_KRBTGT 40 GROUP_TYPE_SECURITY_RESOURCE 37
DOMAIN_WRITE 30 GROUP_TYPE_SECURITY_UNIVERSAL 37
DOMAIN_WRITE_OTHER_PARAMETERS 30 GROUP_TYPE_UNIVERSAL_GROUP 37
DOMAIN_WRITE_PASSWORD_PARAMS 30 GROUP_WRITE 31
GROUP_WRITE_ACCOUNT 31
E
H
Elements - directory service schema 96
Enabling a user account example 230 Handle-based access checks 123
Enabling user account example 230 Handling strings 98
ENCRYPTED_LM_OWF_PASSWORD structure 44
ENCRYPTED_NT_OWF_PASSWORD 44 I
Encrypting an nt or lm hash example 232
Encrypting NT or LM hash example 232 IDL 236
Enumerate pattern 148 Implementer - security considerations 235
Enumerate Pattern method 148 Index of security parameters 235
Events Information levels - methods 27
local - client 227 Informative references 17
timer - client 226 Initialization
timer - server 224 client 226
Examples server 129
creating a user account 228 Introduction 11
creating user account example 228
enabling a user account 230 K
enabling user account example 230
encrypting an nt or lm hash 232 KERB_KEY_DATA packet 91
encrypting NT or LM hash 232 KERB_KEY_DATA_NEW packet 93
KERB_STORED_CREDENTIAL packet 89
F KERB_STORED_CREDENTIAL_NEW packet 91
Kerberos encryption algorithm identifiers 94
Fields
alias 59 L
domain 49
group 56 Listing attributes 99
selective enumerate 74 LM hash - encrypting - example 232
user 61 Local events
vendor-extensible 27 client 227
Fields - vendor-extensible 27 server
Full IDL 236 domain join processing 224
domain unjoin processing 225
G Lookup pattern 197
Lookup Pattern method 197
GENERIC_ALL 29
GENERIC_EXECUTE 29 M
GENERIC_READ 29
GENERIC_WRITE 29 Matching strings 98
Glossary 11 MAXIMUM_ALLOWED 29
Group MD5 usage 225
creating 159 Membership pattern 184
fields 56 Membership Pattern method 184
query/set data types 56 Membership-of pattern 189
GROUP_ADD_MEMBER 31 Membership-Of Pattern method 189
GROUP_ALL_ACCESS 31 Message processing
GROUP_ATTRIBUTE_INFORMATION structure 57 client 226
GROUP_EXECUTE 31 server 132
GROUP_INFORMATION_CLASS enumeration 57 supplemental - server 218
GROUP_LIST_MEMBERS 31 Messages
GROUP_MEMBERSHIP structure 47
272 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
common data types 28 PENCRYPTED_LM_OWF_PASSWORD 44
data types 28 PENCRYPTED_NT_OWF_PASSWORD 44
transport 28 PGROUP_ATTRIBUTE_INFORMATION 57
Method-based perspective 21 PGROUP_MEMBERSHIP 47
Methods POLD_LARGE_INTEGER 42
Change Password Pattern 191 Preconditions 26
Create Pattern 159 Prerequisites 26
Delete Pattern 182 Processing for group and alias creation 159
Enumerate Pattern 148 Product behavior 257
information levels 27 Protocol-specific data types 44
Lookup Pattern 197 PRPC_SHORT_BLOB 43
Membership Pattern 184 PRPC_STRING 42
Membership-Of Pattern 189 PSAM_VALIDATE_AUTHENTICATION_INPUT_ARG 81
Miscellaneous 209 PSAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG
Open Pattern 137 82
overview 26 PSAM_VALIDATE_PASSWORD_HASH 79
Query Pattern 164 PSAM_VALIDATE_PASSWORD_RESET_INPUT_ARG
Security Pattern 201 82
Selective Enumerate Pattern 153 PSAM_VALIDATE_PERSISTED_FIELDS 79
Set Pattern 172 PSAM_VALIDATE_STANDARD_OUTPUT_ARG 81
versioning 26 PSAMPR_ALIAS_ADM_COMMENT_INFORMATION 59
Miscellaneous method 209 PSAMPR_ALIAS_GENERAL_INFORMATION 59
Miscellaneous patterns 209 PSAMPR_ALIAS_NAME_INFORMATION 59
PSAMPR_DOMAIN_DISPLAY_GROUP 75
N PSAMPR_DOMAIN_DISPLAY_GROUP_BUFFER 77
PSAMPR_DOMAIN_DISPLAY_MACHINE 75
Normative references 15 PSAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER 77
NT hash - encrypting - example 232 PSAMPR_DOMAIN_DISPLAY_OEM_GROUP 76
PSAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER
O 77
PSAMPR_DOMAIN_DISPLAY_OEM_USER 76
Object class list 101 PSAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER 77
Object-based perspective 18 PSAMPR_DOMAIN_DISPLAY_USER 75
OLD_LARGE_INTEGER structure 42 PSAMPR_DOMAIN_DISPLAY_USER_BUFFER 76
Open pattern 137 PSAMPR_DOMAIN_GENERAL_INFORMATION 53
Open Pattern method 137 PSAMPR_DOMAIN_GENERAL_INFORMATION2 53
Overview (synopsis) 17 PSAMPR_DOMAIN_LOCKOUT_INFORMATION 54
PSAMPR_DOMAIN_NAME_INFORMATION 54
P PSAMPR_DOMAIN_OEM_INFORMATION 54
PSAMPR_DOMAIN_REPLICATION_INFORMATION 54
Parameter index - security 235 PSAMPR_ENCRYPTED_USER_PASSWORD 68
Parameters - security index 235 PSAMPR_ENCRYPTED_USER_PASSWORD_NEW 69
Password settings - attributes 101 PSAMPR_ENUMERATION_BUFFER 46
PASSWORD_POLICY_VALIDATION_TYPE PSAMPR_GET_GROUPS_BUFFER 47
enumeration 83 PSAMPR_GET_MEMBERS_BUFFER 47
Pattern PSAMPR_GROUP_ADM_COMMENT_INFORMATION 57
change password 191 PSAMPR_GROUP_GENERAL_INFORMATION 57
create 159 PSAMPR_GROUP_NAME_INFORMATION 57
delete 182 PSAMPR_LOGON_HOURS 63
enumerate 148 PSAMPR_PSID_ARRAY 45
lookup 197 PSAMPR_PSID_ARRAY_OUT 45
membership 184 PSAMPR_RETURNED_USTRING_ARRAY 46
membership-of 189 PSAMPR_REVISION_INFO_V1 48
miscellaneous 209 PSAMPR_RID_ENUMERATION 46
open 137 PSAMPR_SID_INFORMATION 45
query 164 PSAMPR_SR_SECURITY_DESCRIPTOR 46
security 201 PSAMPR_ULONG_ARRAY 45
selective enumerate 153 PSAMPR_USER_A_NAME_INFORMATION 66
set 172 PSAMPR_USER_ACCOUNT_INFORMATION 66
PDOMAIN_LOGOFF_INFORMATION 52 PSAMPR_USER_ADMIN_COMMENT_INFORMATION 68
PDOMAIN_MODIFIED_INFORMATION 52 PSAMPR_USER_ALL_INFORMATION 63
PDOMAIN_MODIFIED_INFORMATION2 52 PSAMPR_USER_F_NAME_INFORMATION 66
PDOMAIN_PASSWORD_INFORMATION 51 PSAMPR_USER_GENERAL_INFORMATION 65
PDOMAIN_SERVER_ROLE_INFORMATION 52 PSAMPR_USER_HOME_INFORMATION 67
PDOMAIN_STATE_INFORMATION 51 PSAMPR_USER_INTERNAL1_INFORMATION 70
273 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
PSAMPR_USER_INTERNAL4_INFORMATION 70 SAM_VALIDATE_STANDARD_OUTPUT_ARG structure
PSAMPR_USER_INTERNAL4_INFORMATION_NEW 70 81
PSAMPR_USER_INTERNAL5_INFORMATION 71 SAM_VALIDATE_VALIDATION_STATUS enumeration
PSAMPR_USER_INTERNAL5_INFORMATION_NEW 71 80
PSAMPR_USER_LOGON_HOURS_INFORMATION 68 SamContextHandle data model 123
PSAMPR_USER_LOGON_INFORMATION 65 SAMPR_ALIAS_ADM_COMMENT_INFORMATION
PSAMPR_USER_NAME_INFORMATION 67 structure 59
PSAMPR_USER_PARAMETERS_INFORMATION 65 SAMPR_ALIAS_GENERAL_INFORMATION structure
PSAMPR_USER_PREFERENCES_INFORMATION 65 59
PSAMPR_USER_PROFILE_INFORMATION 67 SAMPR_ALIAS_NAME_INFORMATION structure 59
PSAMPR_USER_SCRIPT_INFORMATION 67 SAMPR_DOMAIN_DISPLAY_GROUP structure 75
PSAMPR_USER_WORKSTATIONS_INFORMATION 68 SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER
PUSER_CONTROL_INFORMATION 62 structure 77
PUSER_DOMAIN_PASSWORD_INFORMATION 48 SAMPR_DOMAIN_DISPLAY_MACHINE structure 75
PUSER_EXPIRES_INFORMATION 63 SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER
PUSER_PRIMARY_GROUP_INFORMATION 62 structure 77
SAMPR_DOMAIN_DISPLAY_OEM_GROUP structure
Q 76
SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER
Query pattern 164 structure 77
Query Pattern method 164 SAMPR_DOMAIN_DISPLAY_OEM_USER structure 76
SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER
R structure 77
SAMPR_DOMAIN_DISPLAY_USER structure 75
RC4 cipher usage 225 SAMPR_DOMAIN_DISPLAY_USER_BUFFER structure
READ_CONTROL 29 76
References 15 SAMPR_DOMAIN_GENERAL_INFORMATION structure
informative 17 53
normative 15 SAMPR_DOMAIN_GENERAL_INFORMATION2
Relationship to other protocols 25 structure 53
RPC_S_PROCNUM_OUT_OF_RANGE 41 SAMPR_DOMAIN_LOCKOUT_INFORMATION structure
RPC_SHORT_BLOB structure 43 54
RPC_STRING structure 42 SAMPR_DOMAIN_NAME_INFORMATION structure 54
SAMPR_DOMAIN_OEM_INFORMATION structure 54
S SAMPR_DOMAIN_REPLICATION_INFORMATION
structure 54
SAM_ALIAS_OBJECT 35 SAMPR_ENCRYPTED_USER_PASSWORD structure 68
SAM_APP_BASIC_GROUP 35 SAMPR_ENCRYPTED_USER_PASSWORD_NEW
SAM_APP_QUERY_GROUP 35 structure 69
SAM_DOMAIN_OBJECT 35 SAMPR_ENUMERATION_BUFFER structure 46
SAM_GROUP_OBJECT 35 SAMPR_GET_GROUPS_BUFFER structure 47
SAM_MACHINE_ACCOUNT 35 SAMPR_GET_MEMBERS_BUFFER structure 47
SAM_NON_SECURITY_ALIAS_OBJECT 35 SAMPR_GROUP_ADM_COMMENT_INFORMATION
SAM_NON_SECURITY_GROUP_OBJECT 35 structure 57
SAM_SERVER_ALL_ACCESS 30 SAMPR_GROUP_GENERAL_INFORMATION structure
SAM_SERVER_CONNECT 30 57
SAM_SERVER_CREATE_DOMAIN 30 SAMPR_GROUP_NAME_INFORMATION structure 57
SAM_SERVER_ENUMERATE_DOMAINS 30 SAMPR_LOGON_HOURS structure 63
SAM_SERVER_EXECUTE 30 SAMPR_PSID_ARRAY structure 45
SAM_SERVER_INITIALIZE 30 SAMPR_PSID_ARRAY_OUT structure 45
SAM_SERVER_LOOKUP_DOMAIN 30 SAMPR_RETURNED_USTRING_ARRAY structure 46
SAM_SERVER_READ 30 SAMPR_REVISION_INFO_V1 structure 48
SAM_SERVER_SHUTDOWN 30 SAMPR_RID_ENUMERATION structure 46
SAM_SERVER_WRITE 30 SAMPR_SID_INFORMATION structure 45
SAM_TRUST_ACCOUNT 35 SAMPR_SR_SECURITY_DESCRIPTOR structure 46
SAM_USER_OBJECT 35 SAMPR_ULONG_ARRAY structure 45
SAM_VALIDATE_AUTHENTICATION_INPUT_ARG SAMPR_USER_A_NAME_INFORMATION structure 66
structure 81 SAMPR_USER_ACCOUNT_INFORMATION structure 66
SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG SAMPR_USER_ADMIN_COMMENT_INFORMATION
structure 82 structure 68
SAM_VALIDATE_PASSWORD_HASH structure 79 SAMPR_USER_ALL_INFORMATION structure 63
SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG SAMPR_USER_F_NAME_INFORMATION structure 66
structure 82 SAMPR_USER_GENERAL_INFORMATION structure 65
SAM_VALIDATE_PERSISTED_FIELDS structure 79 SAMPR_USER_HOME_INFORMATION structure 67
274 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
SAMPR_USER_INTERNAL1_INFORMATION structure SamrQueryInformationGroup method 167
70 SamrQueryInformationUser method 172
SAMPR_USER_INTERNAL4_INFORMATION structure SamrQueryInformationUser2 method 169
70 SamrQuerySecurityObject method 205
SAMPR_USER_INTERNAL4_INFORMATION_NEW SamrRemoveMemberFromAlias method 187
structure 70 SamrRemoveMemberFromForeignDomain method
SAMPR_USER_INTERNAL5_INFORMATION structure 188
71 SamrRemoveMemberFromGroup method 185
SAMPR_USER_INTERNAL5_INFORMATION_NEW SamrRemoveMultipleMembersFromAlias method 189
structure 71 SamrRidToSid method 211
SAMPR_USER_LOGON_HOURS_INFORMATION SamrSetDSRMPassword method 212
structure 68 SamrSetInformationAlias method 175
SAMPR_USER_LOGON_INFORMATION structure 65 SamrSetInformationDomain method 173
SAMPR_USER_NAME_INFORMATION structure 67 SamrSetInformationGroup method 174
SAMPR_USER_PARAMETERS_INFORMATION SamrSetInformationUser method 181
structure 65 SamrSetInformationUser2 method 176
SAMPR_USER_PREFERENCES_INFORMATION SamrSetMemberAttributesOfGroup method 210
structure 65 SamrSetSecurityObject method 202
SAMPR_USER_PROFILE_INFORMATION structure 67 SamrUnicodeChangePasswordUser2 method 196
SAMPR_USER_SCRIPT_INFORMATION structure 67 SamrValidatePassword data types 79
SAMPR_USER_WORKSTATIONS_INFORMATION SamrValidatePassword method 213
structure 68 Schema elements - directory service 96
SamrAddMemberToAlias method 186 SE_GROUP_ENABLED 36
SamrAddMemberToGroup method 184 SE_GROUP_ENABLED_BY_DEFAULT 36
SamrAddMultipleMembersToAlias method 189 SE_GROUP_MANDATORY 36
SamrChangePasswordUser method 192 Security
SamrCloseHandle method 209 implementer considerations 235
SamrConnect method 140 parameter index 235
SamrConnect2 method 140 Security model
SamrConnect4 method 139 client 225
SamrConnect5 method 137 server 123
SamrCreateAliasInDomain method 160 Security pattern 201
SamrCreateGroupInDomain method 159 Security Pattern method 201
SamrCreateUser2InDomain method 161 Selective enumerate associated structures 74
SamrCreateUserInDomain method 163 Selective enumerate fields 74
SamrDeleteAlias method 183 Selective enumerate pattern 153
SamrDeleteGroup method 182 Selective Enumerate Pattern method 153
SamrDeleteUser method 183 Sequencing rules
SamrEnumerateAliasesInDomain method 151 client 226
SamrEnumerateDomainsInSamServer method 148 server 132
SamrEnumerateGroupsInDomain method 151 Server
SamrEnumerateUsersInDomain method 152 abstract data model 97
SamrGetAliasMembership method 190 Change Password Pattern method 191
SamrGetDisplayEnumerationIndex method 158 Create Pattern method 159
SamrGetDisplayEnumerationIndex2 method 157 Delete Pattern method 182
SamrGetDomainPasswordInformation method 211 Enumerate Pattern method 148
SamrGetGroupsForUser method 190 initialization 129
SamrGetMembersInAlias method 188 local events
SamrGetMembersInGroup method 186 domain join processing 224
SamrGetUserDomainPasswordInformation method domain unjoin processing 225
210 Lookup Pattern method 197
SamrLookupDomainInSamServer method 198 Membership Pattern method 184
SamrLookupIdsInDomain method 200 Membership-Of Pattern method 189
SamrLookupNamesInDomain method 198 message processing 132
SamrOemChangePasswordUser2 method 195 Miscellaneous method 209
SamrOpenAlias method 145 Open Pattern method 137
SamrOpenDomain method 141 overview 97
SamrOpenGroup method 144 Query Pattern method 164
SamrOpenUser method 147 security model 123
SamrQueryDisplayInformation method 156 Security Pattern method 201
SamrQueryDisplayInformation2 method 155 Selective Enumerate Pattern method 153
SamrQueryDisplayInformation3 method 153 sequencing rules 132
SamrQueryInformationAlias method 168 Set Pattern method 172
SamrQueryInformationDomain method 166 supplemental message processing 218
SamrQueryInformationDomain2 method 164 timer events 224
275 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
timers 129 attributes (section 3.1.1.5 101, section 3.1.1.6
Set pattern 172 102)
Set Pattern method 172 referenced from other constraints or triggers 106
SID_NAME_USE enumeration 43 User
Standards assignments 27 fields 61
STATUS_ACCESS_DENIED 41 query/set data types 60
STATUS_ACCOUNT_LOCKED_OUT 41 User account
STATUS_GROUP_EXISTS 41 creating - example 228
STATUS_LM_CROSS_ENCRYPTION_REQUIRED 41 enabling - example 230
STATUS_MORE_ENTRIES 41 USER_ACCOUNT_AUTO_LOCKED 37
STATUS_NO_MORE_ENTRIES 41 USER_ACCOUNT_DISABLED 37
STATUS_NONE_MAPPED 41 USER_ALL_ACCESS 33
STATUS_NT_CROSS_ENCRYPTION_REQUIRED 41 USER_ALL_ACCOUNTEXPIRES 34
STATUS_SOME_NOT_MAPPED 41 USER_ALL_ADMINCOMMENT 34
STATUS_USER_EXISTS 41 USER_ALL_BADPASSWORDCOUNT 34
STATUS_WRONG_PASSWORD 41 USER_ALL_CODEPAGE 34
String USER_ALL_COUNTRYCODE 34
handling 98 USER_ALL_FULLNAME 34
matching 98 USER_ALL_HOMEDIRECTORY 34
USER_ALL_HOMEDIRECTORYDRIVE 34
T USER_ALL_LASTLOGOFF 34
USER_ALL_LASTLOGON 34
Timer events USER_ALL_LMPASSWORDPRESENT 34
client 226 USER_ALL_LOGONCOUNT 34
server 224 USER_ALL_LOGONHOURS 34
Timers USER_ALL_NTPASSWORDPRESENT 34
client 226 USER_ALL_PARAMETERS 34
server 129 USER_ALL_PASSWORDCANCHANGE 34
Tracking changes 271 USER_ALL_PASSWORDEXPIRED 34
Transport 28 USER_ALL_PASSWORDLASTSET 34
Triggers USER_ALL_PASSWORDMUSTCHANGE 34
attribute - originating updates 110 USER_ALL_PRIMARYGROUPID 34
referenced from other constraints or triggers 121 USER_ALL_PRIVATEDATA 34
USER_ALL_PROFILEPATH 34
U USER_ALL_SCRIPTPATH 34
USER_ALL_SECURITYDESCRIPTOR 34
UF_ACCOUNTDISABLE 39 USER_ALL_UNDEFINED_MASK 34
UF_DONT_EXPIRE_PASSWD 39 USER_ALL_USERACCOUNTCONTROL 34
UF_DONT_REQUIRE_PREAUTH 39 USER_ALL_USERCOMMENT 34
UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 39 USER_ALL_USERID 34
UF_HOMEDIR_REQUIRED 39 USER_ALL_USERNAME 34
UF_INTERDOMAIN_TRUST_ACCOUNT 39 USER_ALL_WORKSTATIONS 34
UF_LOCKOUT 39 USER_CHANGE_PASSWORD 33
UF_MNS_LOGON_ACCOUNT 39 USER_CONTROL_INFORMATION structure 62
UF_NO_AUTH_DATA_REQUIRED 39 USER_DOMAIN_PASSWORD_INFORMATION
UF_NORMAL_ACCOUNT 39 structure 48
UF_NOT_DELEGATED 39 USER_DONT_EXPIRE_PASSWORD 37
UF_PARTIAL_SECRETS_ACCOUNT 39 USER_DONT_REQUIRE_PREAUTH 37
UF_PASSWD_CANT_CHANGE 39 USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED 37
UF_PASSWD_NOTREQD 39 USER_EXECUTE 33
UF_PASSWORD_EXPIRED 39 USER_EXPIRES_INFORMATION structure 63
UF_SCRIPT 39 USER_FORCE_PASSWORD_CHANGE 33
UF_SERVER_TRUST_ACCOUNT 39 USER_HOME_DIRECTORY_REQUIRED 37
UF_SMARTCARD_REQUIRED 39 USER_INFORMATION_CLASS enumeration 71
UF_TEMP_DUPLICATE_ACCOUNT 39 USER_INTERDOMAIN_TRUST_ACCOUNT 37
UF_TRUSTED_FOR_DELEGATION 39 USER_LIST_GROUPS 33
UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATIO USER_MNS_LOGON_ACCOUNT 37
N 39 USER_NO_AUTH_DATA_REQUIRED 37
UF_USE_AES_KEYS 39 USER_NORMAL_ACCOUNT 37
UF_USE_DES_KEY_ONLY 39 USER_NOT_DELEGATED 37
UF_WORKSTATION_TRUST_ACCOUNT 39 USER_PARTIAL_SECRETS_ACCOUNT 37
Update constraints USER_PASSWORD_EXPIRED 37
additional triggers 121 USER_PASSWORD_NOT_REQUIRED 37
attribute triggers 110 USER_PRIMARY_GROUP_INFORMATION structure 62
USER_PROPERTIES packet 84
276 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018
USER_PROPERTY packet 85
USER_READ 33
USER_READ_ACCOUNT 33
USER_READ_GENERAL 33
USER_READ_GROUP_INFORMATION 33
USER_READ_LOGON 33
USER_READ_PREFERENCES 33
USER_SERVER_TRUST_ACCOUNT 37
USER_SMARTCARD_REQUIRED 37
USER_TEMP_DUPLICATE_ACCOUNT 37
USER_TRUSTED_FOR_DELEGATION 37
USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGAT
ION 37
USER_USE_AES_KEYS 37
USER_USE_DES_KEY_ONLY 37
USER_WORKSTATION_TRUST_ACCOUNT 37
USER_WRITE 33
USER_WRITE_ACCOUNT 33
USER_WRITE_GROUP_INFORMATION 33
USER_WRITE_PREFERENCES 33
Vendor-extensible fields 27
Versioning 26
WDIGEST_CREDENTIALS packet 85
WRITE_DAC 29
WRITE_OWNER 29
277 / 277
[MS-SAMR] - v20180912
Security Account Manager (SAM) Remote Protocol (Client-to-Server)
Copyright © 2018 Microsoft Corporation
Release: September 12, 2018