Source code of Windows XP (NT5)
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.

188 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. srvbind.c
  5. Abstract:
  6. Contains the RPC bind and un-bind routines for the Server
  7. Service.
  8. Author:
  9. Dan Lafferty (danl) 01-Mar-1991
  10. Environment:
  11. User Mode -Win32
  12. Revision History
  13. Madan Appiah (madana) 10-Oct-1995 Created.
  14. Murali R. Krishnan (MuraliK) 15-Nov-1995 Remove Netp routines
  15. Murali R. Krishnan (MuraliK) 21-Nov-1995 Support TCP/IP binding
  16. Rohan Phillips (rohanp) 26-Feb-1997 Moved from K2 tree for smtp
  17. --*/
  18. //
  19. // INCLUDES
  20. //
  21. #define UNICODE
  22. #include <nt.h>
  23. #include <ntrtl.h>
  24. #include <nturtl.h>
  25. #include <windef.h>
  26. #include <smtpinet.h>
  27. #include <smtpsvc.h>
  28. #include <inetinfo.h>
  29. #include "apiutil.h"
  30. handle_t
  31. NNTP_IMPERSONATE_HANDLE_bind(
  32. SMTP_IMPERSONATE_HANDLE ServerName
  33. )
  34. /*++
  35. Routine Description:
  36. This routine is called from the inet info admin client stubs when
  37. it is necessary create an RPC binding to the server end with
  38. impersonation level of security
  39. Arguments:
  40. ServerName - A pointer to a string containing the name of the server
  41. to bind with.
  42. Return Value:
  43. The binding handle is returned to the stub routine. If the bind is
  44. unsuccessful, a NULL will be returned.
  45. --*/
  46. {
  47. handle_t BindHandle;
  48. RPC_STATUS RpcStatus;
  49. RpcStatus = RpcBindHandleForServer(&BindHandle,
  50. ServerName,
  51. SMTP_INTERFACE_NAME,
  52. PROT_SEQ_NP_OPTIONS_W
  53. );
  54. return BindHandle;
  55. } // SMTP_IMPERSONATE_HANDLE_bind()
  56. handle_t
  57. SMTP_HANDLE_bind (
  58. SMTP_HANDLE ServerName)
  59. /*++
  60. Routine Description:
  61. This routine calls a common bind routine that is shared by all services.
  62. This routine is called from the server service client stubs when
  63. it is necessary to bind to a server.
  64. Arguments:
  65. ServerName - A pointer to a string containing the name of the server
  66. to bind with.
  67. Return Value:
  68. The binding handle is returned to the stub routine. If the
  69. binding is unsuccessful, a NULL will be returned.
  70. --*/
  71. {
  72. handle_t BindingHandle;
  73. RPC_STATUS status;
  74. status = RpcBindHandleForServer(&BindingHandle,
  75. ServerName,
  76. SMTP_INTERFACE_NAME,
  77. PROT_SEQ_NP_OPTIONS_W
  78. );
  79. return( BindingHandle);
  80. }
  81. void
  82. NNTP_IMPERSONATE_HANDLE_unbind(
  83. SMTP_IMPERSONATE_HANDLE ServerName,
  84. handle_t BindHandle
  85. )
  86. /*++
  87. Routine Description:
  88. This routine calls a common unbind routine that is shared by all services
  89. This routine is called from the inet admin client stubs when it is
  90. necessary to unbind from the server end.
  91. Arguments:
  92. ServerName - This is the name of the server from which to unbind.
  93. BindingHandle - This is the binding handle that is to be closed.
  94. Return Value:
  95. None.
  96. --*/
  97. {
  98. UNREFERENCED_PARAMETER(ServerName);
  99. (VOID ) RpcBindHandleFree(&BindHandle);
  100. return;
  101. } // SMTP_IMPERSONATE_HANDLE_unbind()
  102. void
  103. SMTP_HANDLE_unbind (
  104. SMTP_HANDLE ServerName,
  105. handle_t BindingHandle)
  106. /*++
  107. Routine Description:
  108. This routine calls a common unbind routine that is shared by
  109. all services.
  110. This routine is called from the server service client stubs when
  111. it is necessary to unbind to a server.
  112. Arguments:
  113. ServerName - This is the name of the server from which to unbind.
  114. BindingHandle - This is the binding handle that is to be closed.
  115. Return Value:
  116. none.
  117. --*/
  118. {
  119. UNREFERENCED_PARAMETER(ServerName);
  120. (VOID ) RpcBindHandleFree(&BindingHandle);
  121. }