Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
7.1 KiB

  1. Portable Systems Group
  2. MSV1_0 SubAuthentication DLL Design Note
  3. Revision 1.3, March 7, 1996
  4. 1. INTRODUCTION
  5. 2. INTERFACE TO A SUBAUTHENTICATION DLL
  6. 3. REGISTERING A SUBAUTHENTICATION DLL
  7. 4. REQUESTING A SUBAUTHENTICATION DLL
  8. 1. Introduction
  9. This document describes the purpose of and the interface to a
  10. SubAuthentication DLL for the MSV1_0 authentication package.
  11. The MSV1_0 authentication package is the standard LSA authentication
  12. package for Windows NT. It provides or supports:
  13. Authentication of users in the SAM database.
  14. Pass-Thru authentication of users in trusted domains.
  15. Windows NT allows SubAuthentication DLLs to be used in conjunction
  16. with the MSV1_0 authentication package. A SubAuthentication DLL
  17. allows the authentication and validation criteria stored in SAM to be
  18. replaced for particular subsystems that use the MSV1_0 authentication
  19. package. For instance, a particular server might supply a SubAuthentication
  20. DLL that validates a user�s password via a different algorithm, uses a
  21. different granularity of logon hours, and/or specifies workstation restrictions
  22. in a different format.
  23. All of this can be accomplished using SubAuthentication DLLs without
  24. sacrificing use of the SAM database (and losing its administration tools) or
  25. losing pass-thru authentication.
  26. 2. Interface to a SubAuthentication DLL
  27. There are two interfaces that may be supported by SubAuthentication DLLs.
  28. The first is Msv1_0SubAuthenticationRoutine, which is called for
  29. SubAuthentication packages other than package zero. These
  30. SubAuthentication DLLs are called after the correct Domain Controller has
  31. been located and the user to be authenticated has been looked up in the
  32. SAM database. No attributes of the user will be validated by the MSV1_0
  33. authentication package. That is the responsibility of the SubAuthentication
  34. DLL. The SubAuthentication DLL must contain a procedure named
  35. Msv1_0SubAuthenticationRoutine with the following interface:
  36. NTSTATUS
  37. NTAPI
  38. Msv1_0SubAuthenticationRoutine(
  39. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  40. IN PVOID LogonInformation,
  41. IN ULONG Flags,
  42. IN PUSER_ALL_INFORMATION UserAll,
  43. OUT PULONG WhichFields,
  44. OUT PULONG UserFlags,
  45. OUT PBOOLEAN Authoritative,
  46. OUT PLARGE_INTEGER LogoffTime,
  47. OUT PLARGE_INTEGER KickoffTime
  48. );
  49. The second SubAuthentication interface is Msv1_0SubAuthenticationFilter,
  50. which is only called for SubAuthentication DLL zero. In this case, after the
  51. MSV1_0 authentication package has validated a logon (including network,
  52. interactive, service, and batch logons) it will call the filter routine to do
  53. additional validation. The filter routine may return success, indicating that
  54. the logon should proceed, or failure, indicating that the the additional
  55. validation failed. In addition, the filter routine may modify the
  56. UserParameters field in the USER_ALL_INFORMATION structure and set
  57. the USER_ALL_PARAMETRS flag in the WhichFields parameter to
  58. indicate that the change should be written to the user object.
  59. NTSTATUS
  60. NTAPI
  61. Msv1_0SubAuthenticationFilter(
  62. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  63. IN PVOID LogonInformation,
  64. IN ULONG Flags,
  65. IN PUSER_ALL_INFORMATION UserAll,
  66. OUT PULONG WhichFields,
  67. OUT PULONG UserFlags,
  68. OUT PBOOLEAN Authoritative,
  69. OUT PLARGE_INTEGER LogoffTime,
  70. OUT PLARGE_INTEGER KickoffTime
  71. );
  72. 3. Registering a SubAuthentication DLL
  73. Each SubAuthentication DLL is assigned a DLL number in the range 0
  74. through 255. The DLL number is used to associate the subsystem calling
  75. LsaLogonUser with the appropriate SubAuthentication DLL.
  76. DLL number 0 is reserved to indicate that the
  77. SubAuthentication Filter is to be used. It allows the package to
  78. do additional password or logon validation on top of what
  79. MSV1_0 normally provides. DLL numbers 1 through 127 are reserved for Microsoft.
  80. DLL numbers 128 through 255 are available to ISVs. ISVs can be assigned a DLL
  81. number by Microsoft by sending email to [email protected]. Registering
  82. your subauthentication pacakge with Microsoft prevents collision of package IDs
  83. when multiple subauthentication packages are installed on a system.
  84. Microsoft will not assign the value of 255 for any subauthentication DLL.
  85. If you are developing a subauthentication DLL for use only within your company
  86. or facility, you can use the subauthentication ID number 255. In this case,
  87. it is not necessary to register your subauthentication package with
  88. Microsoft.
  89. Once the ISV has picked a DLL number, the DLL can be registered
  90. under the registry key
  91. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0.
  92. If the key doesn't exist, the ISV's installation procedure
  93. should create it. Under that key, the ISV should create a value named
  94. AuthN where N is the DLL number (e.g., Auth128).
  95. The value should be a REG_SZ and specify the name of the DLL
  96. which must be in the default DLL load path. For instance,
  97. Auth128=SubAuth
  98. The MSV1_0 authentication package will load the named DLL
  99. the first time the SubAuthentication DLL is requested.
  100. 4. Requesting a SubAuthentication DLL
  101. A subsystem can request a particular SubAuthentication DLL when calling
  102. LsaLogonUser. The subsystem calls the MSV1_0 authentication package
  103. (as described in the LSAAUTH.HLP file in the Windows NT DDK) passing
  104. in the MSV1_0_LM20_LOGON structure.
  105. typedef struct _MSV1_0_LM20_LOGON {
  106. MSV1_0_LOGON_SUBMIT_TYPE MessageType;
  107. UNICODE_STRING LogonDomainName;
  108. UNICODE_STRING UserName;
  109. UNICODE_STRING Workstation;
  110. UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
  111. STRING CaseSensitiveChallengeResponse;
  112. STRING CaseInsensitiveChallengeResponse;
  113. ULONG ParameterControl;
  114. } MSV1_0_LM20_LOGON, * PMSV1_0_LM20_LOGON;
  115. The MessageType field must be set to MsV1_0NetworkLogon (Interactive
  116. logons may not be authenticated by a SubAuthentication DLL).
  117. The LogonDomainName field should be set to the domain name of the
  118. domain containing the SAM database to be used for authentication. The
  119. MSV1_0 authentication package and the Netlogon Service will pass thru the
  120. authentication request to that domain. The SubAuthentication DLL will be
  121. called on a domain controller in the domain.
  122. The UserName field must specify the name of a user in the SAM database
  123. on that domain.
  124. The Workstation, ChallengeToClient, CaseSensitiveChallengeResponse,
  125. and CaseInsensitiveChallengeResponse fields may be set to any
  126. SubAuthentication DLL specific values. They will be ignored by the
  127. MSV1_0 authentication package.
  128. The ParameterControl field should be set as follows. Set the various control
  129. flags as appropriate. Set the most significant byte of Parameter control to
  130. the DLL number of the SubAuthentication DLL to use.
  131. #define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x02
  132. #define MSV1_0_UPDATE_LOGON_STATISTICS 0x04
  133. #define MSV1_0_RETURN_USER_PARAMETERS 0x08
  134. #define MSV1_0_DONT_TRY_GUEST_ACCOUNT 0x10
  135. //
  136. // The high order byte is a value indicating the SubAuthentication DLL.
  137. // Zero indicates no SubAuthentication DLL.
  138. //
  139. #define MSV1_0_SUBAUTHENTICATION_DLL 0xFF000000
  140. #define MSV1_0_SUBAUTHENTICATION_DLL_SHIFT 24