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.

150 lines
5.6 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 2000
  6. //
  7. // File: ctxt.h
  8. //
  9. // Contents: declarations, constants for context manager
  10. //
  11. //
  12. // History: KDamour 15Mar00 Created
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef NTDIGEST_CTXT_H
  16. #define NTDIGEST_CTXT_H
  17. #define RSPAUTH_STR "rspauth=%Z"
  18. // Hash locations for pre-calculated DS hashes
  19. #define PRECALC_NONE 0
  20. #define PRECALC_ACCOUNTNAME 1
  21. #define PRECALC_UPN 2
  22. #define PRECALC_NETBIOS 3
  23. // Number of secbuffers for each type HTTP and SASL
  24. #define ASC_HTTP_NUM_INPUT_BUFFERS 5
  25. #define ASC_SASL_NUM_INPUT_BUFFERS 1
  26. #define ASC_HTTP_NUM_OUTPUT_BUFFERS 1
  27. #define ASC_SASL_NUM_OUTPUT_BUFFERS 1
  28. // Initializes the context manager package
  29. NTSTATUS CtxtHandlerInit(VOID);
  30. // Add a Context into the Cntext List
  31. NTSTATUS CtxtHandlerInsertCred(IN PDIGEST_CONTEXT pDigestCtxt);
  32. // Initialize all the struct elements in a Context from the Credential
  33. NTSTATUS NTAPI ContextInit(IN OUT PDIGEST_CONTEXT pContext, IN PDIGEST_CREDENTIAL pCredential);
  34. // Release memory utilized by the Context
  35. NTSTATUS NTAPI ContextFree(IN PDIGEST_CONTEXT pContext);
  36. // Find the security context handle by the opaque reference
  37. NTSTATUS NTAPI CtxtHandlerOpaqueToPtr(
  38. IN PSTRING pstrOpaque,
  39. OUT PDIGEST_CONTEXT *ppContext);
  40. // Find the security context by the security context handle
  41. NTSTATUS NTAPI CtxtHandlerHandleToContext(IN ULONG_PTR ContextHandle, IN BOOLEAN RemoveContext,
  42. OUT PDIGEST_CONTEXT *ppContext);
  43. // Releases the Context by decreasing reference counter
  44. NTSTATUS CtxtHandlerRelease(
  45. PDIGEST_CONTEXT pContext,
  46. ULONG ulDereferenceCount);
  47. // Check to see if COntext is within valid lifetime
  48. BOOL CtxtHandlerTimeHasElapsed(PDIGEST_CONTEXT pContext);
  49. // From ctxtapi.cxx
  50. // Creates the Output SecBuffer for the Challenge
  51. NTSTATUS NTAPI ContextCreateChal(IN PDIGEST_CONTEXT pContext, IN PSTRING pstrRealm, OUT PSecBuffer OutBuffer);
  52. // Called for server incoming messages - verify Digest and generate sessionkey if necessary
  53. NTSTATUS NTAPI DigestProcessParameters(IN OUT PDIGEST_CONTEXT pContext,
  54. IN PDIGEST_PARAMETER pDigest,
  55. OUT PSecBuffer pFirstOutputToken,
  56. OUT PNTSTATUS pAuditLogStatus,
  57. OUT PNTSTATUS pAuditLogSubStatus,
  58. PBOOL fGenerateAudit);
  59. // Called for client outbound messages - generate the response hash
  60. NTSTATUS NTAPI DigestGenerateParameters(IN OUT PDIGEST_CONTEXT pContext,
  61. IN PDIGEST_PARAMETER pDigest, OUT PSecBuffer pFirstOutputToken);
  62. // LSA calls this function in the Generic Passthrough call
  63. NTSTATUS NTAPI DigestPackagePassthrough(IN USHORT cbMessageRequest, IN BYTE *pMessageRequest,
  64. IN OUT ULONG *pulMessageResponse, OUT PBYTE *ppMessageResponse);
  65. // Lookup passwords and perform digest cal auth (runs on the DC)
  66. NTSTATUS NTAPI DigestResponseBru(IN USHORT cbMessageRequest,
  67. IN BYTE *pDigestParamEncoded,
  68. OUT PULONG pculResponse,
  69. OUT PBYTE *ppResponse);
  70. NTSTATUS DigestEncodeResponse(IN BOOL fDigestValid,
  71. IN PDIGEST_PARAMETER pDigest,
  72. IN ULONG ulAuthDataSize,
  73. IN PUCHAR pucAuthData,
  74. OUT PULONG pulResponse,
  75. OUT PBYTE *ppResponse);
  76. NTSTATUS DigestDecodeResponse(IN ULONG ulResponseDataSize,
  77. IN PUCHAR puResponseData,
  78. OUT PBOOL pfDigestValid,
  79. OUT PULONG pulAuthDataSize,
  80. OUT PUCHAR *ppucAuthData,
  81. OUT PSTRING pstrSessionKey,
  82. OUT OPTIONAL PUNICODE_STRING pustrAccountName,
  83. OUT OPTIONAL PUNICODE_STRING pustrAccountDomain
  84. );
  85. // Formatted printout of Context
  86. NTSTATUS ContextPrint(IN PDIGEST_CONTEXT pDigest);
  87. // Create a logonSession for the Authenticated LogonToken in the SecurityContext
  88. NTSTATUS CtxtCreateLogSess(IN PDIGEST_CONTEXT pDigest);
  89. // Extract the username & domain from the Digest structure directives
  90. NTSTATUS UserCredentialsExtract(PDIGEST_PARAMETER pDigest,
  91. PUSER_CREDENTIALS pUserCreds);
  92. // Release memory allocated into UserCredentials
  93. NTSTATUS UserCredentialsFree(PUSER_CREDENTIALS pUserCreds);
  94. NTSTATUS DigestSASLResponseAuth(
  95. IN PDIGEST_PARAMETER pDigest,
  96. OUT PSecBuffer pOutputToken);
  97. NTSTATUS DigestCalculateResponseAuth(
  98. IN PDIGEST_PARAMETER pDigest,
  99. OUT PSTRING pstrHash);
  100. NTSTATUS DigestDecodeUserAccount(
  101. IN PDIGEST_PARAMETER pDigest);
  102. NTSTATUS DigestForwardRequest(
  103. IN PDIGEST_PARAMETER pDigest,
  104. OUT PBOOL pfDigestValid,
  105. OUT PULONG pulAuthDataSize,
  106. OUT PUCHAR *ppucAuthData);
  107. NTSTATUS DigestDirectiveCheck(
  108. IN PDIGEST_PARAMETER pDigest,
  109. IN DIGEST_TYPE typeDigest);
  110. // This routine selects a Buffer by indexed count in the BufferIndex
  111. BOOLEAN SspGetTokenBufferByIndex(
  112. IN PSecBufferDesc TokenDescriptor,
  113. IN ULONG BufferIndex,
  114. OUT PSecBuffer * Token,
  115. IN BOOLEAN ReadonlyOK
  116. );
  117. #endif // DNTDIGEST_CTXT_H