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.

117 lines
4.9 KiB

  1. //--------------------------------------------------------------------------
  2. // S I C I L Y . H
  3. //--------------------------------------------------------------------------
  4. #pragma once
  5. //--------------------------------------------------------------------------
  6. // Depends
  7. //--------------------------------------------------------------------------
  8. #ifndef SECURITY_WIN32
  9. #define SECURITY_WIN32 1
  10. #endif
  11. #include <sspi.h>
  12. #include <spseal.h>
  13. #include <rpcdce.h>
  14. #include <issperr.h>
  15. #include <imnxport.h>
  16. //--------------------------------------------------------------------------
  17. // Forward Decls
  18. //--------------------------------------------------------------------------
  19. interface ITransportCallback;
  20. //--------------------------------------------------------------------------
  21. // Constants
  22. //--------------------------------------------------------------------------
  23. #define SSP_SSPS_DLL "msnsspc.dll"
  24. #define CBMAX_SSPI_BUFFER 1042
  25. #define SSPI_BASE64 TRUE
  26. #define SSPI_UUENCODE FALSE
  27. //--------------------------------------------------------------------------
  28. // SSPIBUFFERTYPE
  29. //--------------------------------------------------------------------------
  30. typedef enum tagSSPIBUFFERTYPE {
  31. SSPI_STRING,
  32. SSPI_BLOB
  33. } SSPIBUFFERTYPE;
  34. //--------------------------------------------------------------------------
  35. // SSPICONTEXTSTATE
  36. //--------------------------------------------------------------------------
  37. typedef enum tagSSPICONTEXTSTATE {
  38. SSPI_STATE_USE_CACHED,
  39. SSPI_STATE_USE_SUPPLIED,
  40. SSPI_STATE_PROMPT_USE_PACKAGE,
  41. SSPI_STATE_PROMPT_USE_OWN,
  42. } SSPICONTEXTSTATE;
  43. //--------------------------------------------------------------------------
  44. // SSPICONTEXT
  45. //--------------------------------------------------------------------------
  46. typedef struct tagSSPICONTEXT {
  47. DWORD tyState;
  48. DWORD tyRetry;
  49. DWORD tyRetryState;
  50. DWORD cRetries;
  51. BYTE fPromptCancel;
  52. HWND hwndLogon;
  53. BYTE fCredential;
  54. CredHandle hCredential;
  55. BYTE fContext;
  56. CtxtHandle hContext;
  57. BOOL fBase64;
  58. LPSTR pszServer;
  59. LPSTR pszPackage;
  60. LPSTR pszUserName;
  61. LPSTR pszPassword;
  62. LPSTR pszDomain;
  63. BOOL fService;
  64. BOOL fUsedSuppliedCreds;
  65. ITransportCallback *pCallback;
  66. } SSPICONTEXT, *LPSSPICONTEXT;
  67. //--------------------------------------------------------------------------
  68. // SSPIBUFFER
  69. //--------------------------------------------------------------------------
  70. typedef struct tagSSPIBUFFER {
  71. CHAR szBuffer[CBMAX_SSPI_BUFFER];
  72. DWORD cbBuffer;
  73. BOOL fContinue;
  74. } SSPIBUFFER, *LPSSPIBUFFER;
  75. //--------------------------------------------------------------------------
  76. // SSPIPACKAGE
  77. //--------------------------------------------------------------------------
  78. typedef struct tagSSPIPACKAGE {
  79. ULONG ulCapabilities;
  80. WORD wVersion;
  81. ULONG cbMaxToken;
  82. LPSTR pszName;
  83. LPSTR pszComment;
  84. } SSPIPACKAGE, *LPSSPIPACKAGE;
  85. //--------------------------------------------------------------------------
  86. // Prototypes
  87. //--------------------------------------------------------------------------
  88. HRESULT SSPIIsInstalled(void);
  89. HRESULT SSPIGetPackages(LPSSPIPACKAGE *pprgPackage, ULONG *pcPackages);
  90. HRESULT SSPILogon(LPSSPICONTEXT pContext, BOOL fRetry, BOOL fBase64, LPCSTR szPackage, LPINETSERVER pServer, ITransportCallback *pCallback);
  91. HRESULT SSPIGetNegotiate(LPSSPICONTEXT pContext, LPSSPIBUFFER pNegotiate);
  92. HRESULT SSPIResponseFromChallenge(LPSSPICONTEXT pContext, LPSSPIBUFFER pChallenge, LPSSPIBUFFER pResponse);
  93. HRESULT SSPIUninitialize(void);
  94. HRESULT SSPIFreeContext(LPSSPICONTEXT pContext);
  95. HRESULT SSPIReleaseContext(LPSSPICONTEXT pContext);
  96. HRESULT SSPIMakeOutboundMessage(LPSSPICONTEXT pContext, DWORD dwFlags, LPSSPIBUFFER pBuffer, PSecBufferDesc pInDescript);
  97. HRESULT SSPIEncodeBuffer(BOOL fBase64, LPSSPIBUFFER pBuffer);
  98. HRESULT SSPIDecodeBuffer(BOOL fBase64, LPSSPIBUFFER pBuffer);
  99. HRESULT SSPISetBuffer(LPCSTR pszString, SSPIBUFFERTYPE tyBuffer, DWORD cbBytes, LPSSPIBUFFER pBuffer);
  100. HRESULT SSPIFindCredential(LPSSPICONTEXT pContext, SEC_WINNT_AUTH_IDENTITY *pAuth, ITransportCallback *pCallback);
  101. //--------------------------------------------------------------------------
  102. // FIsSicilyInstalled
  103. //--------------------------------------------------------------------------
  104. inline HRESULT SSPIFreePackages(LPSSPIPACKAGE *pprgPackage, ULONG cPackages) { return(S_OK); }
  105. inline BOOL FIsSicilyInstalled(void) {
  106. return (S_OK == SSPIIsInstalled()) ? TRUE : FALSE;
  107. }