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.

156 lines
3.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: certmap.c
  7. //
  8. // Contents: Routines to call appropriate mapper, be it the system
  9. // default one (in the LSA process) or an application one (in
  10. // the application process).
  11. //
  12. // Classes:
  13. //
  14. // Functions:
  15. //
  16. // History: 12-23-96 jbanes Created.
  17. //
  18. //----------------------------------------------------------------------------
  19. #include <spbase.h>
  20. DWORD
  21. WINAPI
  22. SslReferenceMapper(HMAPPER *phMapper)
  23. {
  24. if(phMapper == NULL)
  25. {
  26. return SP_LOG_RESULT((DWORD)-1);
  27. }
  28. // System mapper.
  29. return phMapper->m_vtable->ReferenceMapper(phMapper);
  30. }
  31. DWORD
  32. WINAPI
  33. SslDereferenceMapper(HMAPPER *phMapper)
  34. {
  35. if(phMapper == NULL)
  36. {
  37. return SP_LOG_RESULT(0);
  38. }
  39. // System mapper.
  40. return phMapper->m_vtable->DeReferenceMapper(phMapper);
  41. }
  42. SECURITY_STATUS
  43. WINAPI
  44. SslGetMapperIssuerList(
  45. HMAPPER * phMapper, // in
  46. BYTE ** ppIssuerList, // out
  47. DWORD * pcbIssuerList) // out
  48. {
  49. SECURITY_STATUS Status;
  50. if(phMapper == NULL)
  51. {
  52. return SP_LOG_RESULT(SEC_E_INTERNAL_ERROR);
  53. }
  54. // System mapper.
  55. Status = phMapper->m_vtable->GetIssuerList(phMapper,
  56. 0,
  57. NULL,
  58. pcbIssuerList);
  59. if(!NT_SUCCESS(Status))
  60. {
  61. return SP_LOG_RESULT(Status);
  62. }
  63. *ppIssuerList = SPExternalAlloc(*pcbIssuerList);
  64. if(*ppIssuerList == NULL)
  65. {
  66. return SP_LOG_RESULT(SEC_E_INSUFFICIENT_MEMORY);
  67. }
  68. Status = phMapper->m_vtable->GetIssuerList(phMapper,
  69. 0,
  70. *ppIssuerList,
  71. pcbIssuerList);
  72. if(!NT_SUCCESS(Status))
  73. {
  74. SPExternalFree(*ppIssuerList);
  75. return SP_LOG_RESULT(Status);
  76. }
  77. return Status;
  78. }
  79. SECURITY_STATUS
  80. WINAPI
  81. SslGetMapperChallenge(
  82. HMAPPER * phMapper, // in
  83. BYTE * pAuthenticatorId, // in
  84. DWORD cbAuthenticatorId, // in
  85. BYTE * pChallenge, // out
  86. DWORD * pcbChallenge) // out
  87. {
  88. UNREFERENCED_PARAMETER(phMapper);
  89. UNREFERENCED_PARAMETER(pAuthenticatorId);
  90. UNREFERENCED_PARAMETER(cbAuthenticatorId);
  91. UNREFERENCED_PARAMETER(pChallenge);
  92. UNREFERENCED_PARAMETER(pcbChallenge);
  93. return SP_LOG_RESULT(SEC_E_UNSUPPORTED_FUNCTION);
  94. }
  95. SECURITY_STATUS
  96. WINAPI
  97. SslMapCredential(
  98. HMAPPER * phMapper, // in
  99. DWORD dwCredentialType, // in
  100. PCCERT_CONTEXT pCredential, // in
  101. PCCERT_CONTEXT pAuthority, // in
  102. HLOCATOR * phLocator) // out
  103. {
  104. SECURITY_STATUS scRet;
  105. if(phMapper == NULL)
  106. {
  107. return SP_LOG_RESULT(SEC_E_INTERNAL_ERROR);
  108. }
  109. // System mapper.
  110. scRet = phMapper->m_vtable->MapCredential(phMapper,
  111. dwCredentialType,
  112. pCredential,
  113. pAuthority,
  114. phLocator);
  115. return MapWinTrustError(scRet, SEC_E_NO_IMPERSONATION, 0);
  116. }
  117. SECURITY_STATUS
  118. WINAPI
  119. SslCloseLocator(
  120. HMAPPER * phMapper, // in
  121. HLOCATOR hLocator) // in
  122. {
  123. if(phMapper == NULL)
  124. {
  125. return SP_LOG_RESULT(SEC_E_INTERNAL_ERROR);
  126. }
  127. // System mapper.
  128. return phMapper->m_vtable->CloseLocator(phMapper,
  129. hLocator);
  130. }