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.

93 lines
2.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: defusage.cpp
  8. //
  9. // Contents: Microsoft Internet Security Authenticode Policy Provider
  10. //
  11. // Functions:
  12. //
  13. // History: 18-Sep-1997 pberkman created
  14. //
  15. //--------------------------------------------------------------------------
  16. #include "global.hxx"
  17. BOOL WINAPI SoftpubLoadDefUsageCallData(const char *pszUsageOID, CRYPT_PROVIDER_DEFUSAGE *psDefUsage)
  18. {
  19. if (!(pszUsageOID) ||
  20. !(psDefUsage) ||
  21. !(_ISINSTRUCT(CRYPT_PROVIDER_DEFUSAGE, psDefUsage->cbStruct, pDefSIPClientData)))
  22. {
  23. SetLastError(ERROR_INVALID_PARAMETER);
  24. return(FALSE);
  25. }
  26. HTTPSPolicyCallbackData polHttps;
  27. memset(&polHttps, 0x00, sizeof(HTTPSPolicyCallbackData));
  28. polHttps.cbStruct = sizeof(HTTPSPolicyCallbackData);
  29. polHttps.fdwChecks = INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
  30. psDefUsage->pDefPolicyCallbackData = NULL;
  31. psDefUsage->pDefSIPClientData = NULL;
  32. if (strcmp(pszUsageOID, szOID_PKIX_KP_SERVER_AUTH) == 0)
  33. {
  34. polHttps.dwAuthType = AUTHTYPE_SERVER;
  35. }
  36. if (strcmp(pszUsageOID, szOID_PKIX_KP_CLIENT_AUTH) == 0)
  37. {
  38. polHttps.dwAuthType = AUTHTYPE_CLIENT;
  39. }
  40. if (strcmp(pszUsageOID, szOID_SERVER_GATED_CRYPTO) == 0)
  41. {
  42. polHttps.dwAuthType = AUTHTYPE_SERVER;
  43. }
  44. if (strcmp(pszUsageOID, szOID_SGC_NETSCAPE) == 0)
  45. {
  46. polHttps.dwAuthType = AUTHTYPE_SERVER;
  47. }
  48. if (polHttps.dwAuthType == 0)
  49. {
  50. return(TRUE);
  51. }
  52. if (!(psDefUsage->pDefPolicyCallbackData = (HTTPSPolicyCallbackData *)malloc(sizeof(HTTPSPolicyCallbackData))))
  53. {
  54. SetLastError(ERROR_NOT_ENOUGH_MEMORY);
  55. return(FALSE);
  56. }
  57. memset(psDefUsage->pDefPolicyCallbackData, 0x00, sizeof(HTTPSPolicyCallbackData));
  58. memcpy(psDefUsage->pDefPolicyCallbackData, &polHttps, sizeof(HTTPSPolicyCallbackData));
  59. return(TRUE);
  60. }
  61. BOOL WINAPI SoftpubFreeDefUsageCallData(const char *pszUsageOID, CRYPT_PROVIDER_DEFUSAGE *psDefUsage)
  62. {
  63. if (!(pszUsageOID) ||
  64. !(psDefUsage) ||
  65. !(_ISINSTRUCT(CRYPT_PROVIDER_DEFUSAGE, psDefUsage->cbStruct, pDefSIPClientData)))
  66. {
  67. SetLastError(ERROR_INVALID_PARAMETER);
  68. return(FALSE);
  69. }
  70. if (psDefUsage->pDefPolicyCallbackData)
  71. {
  72. free(psDefUsage->pDefPolicyCallbackData);
  73. }
  74. return(TRUE);
  75. }