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.

195 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. wksbind.c
  5. Abstract:
  6. Routines which use RPC to bind and unbind the client to the Workstaion
  7. service.
  8. Author:
  9. Rita Wong (ritaw) 14-May-1991
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. --*/
  14. #include "wsclient.h"
  15. handle_t
  16. WKSSVC_IMPERSONATE_HANDLE_bind(
  17. WKSSVC_IMPERSONATE_HANDLE ServerName
  18. )
  19. /*++
  20. Routine Description:
  21. This routine is called from the Workstation service client stubs when
  22. it is necessary create an RPC binding to the server end with
  23. impersonation level of impersonation.
  24. Arguments:
  25. ServerName - A pointer to a string containing the name of the server
  26. to bind with.
  27. Return Value:
  28. The binding handle is returned to the stub routine. If the bind is
  29. unsuccessful, a NULL will be returned.
  30. --*/
  31. {
  32. handle_t BindHandle;
  33. RPC_STATUS RpcStatus;
  34. RpcStatus = NetpBindRpc (
  35. ServerName,
  36. WORKSTATION_INTERFACE_NAME,
  37. TEXT("Security=Impersonation Dynamic False"),
  38. &BindHandle
  39. );
  40. if (RpcStatus != RPC_S_OK) {
  41. NetpKdPrint((
  42. "WKSSVC_IMPERSONATE_HANDLE_bind failed: " FORMAT_NTSTATUS "\n",
  43. RpcStatus
  44. ));
  45. }
  46. return BindHandle;
  47. }
  48. handle_t
  49. WKSSVC_IDENTIFY_HANDLE_bind(
  50. WKSSVC_IDENTIFY_HANDLE ServerName
  51. )
  52. /*++
  53. Routine Description:
  54. This routine is called from the Workstation service client stubs when
  55. it is necessary create an RPC binding to the server end with
  56. identification level of impersonation.
  57. Arguments:
  58. ServerName - A pointer to a string containing the name of the server
  59. to bind with.
  60. Return Value:
  61. The binding handle is returned to the stub routine. If the bind is
  62. unsuccessful, a NULL will be returned.
  63. --*/
  64. {
  65. handle_t BindHandle;
  66. RPC_STATUS RpcStatus;
  67. RpcStatus = NetpBindRpc (
  68. ServerName,
  69. WORKSTATION_INTERFACE_NAME,
  70. TEXT("Security=Identification Dynamic False"),
  71. &BindHandle
  72. );
  73. if (RpcStatus != RPC_S_OK) {
  74. NetpKdPrint((
  75. "WKSSVC_IDENTIFY_HANDLE_bind failed: " FORMAT_NTSTATUS "\n",
  76. RpcStatus
  77. ));
  78. }
  79. return BindHandle;
  80. }
  81. void
  82. WKSSVC_IMPERSONATE_HANDLE_unbind(
  83. WKSSVC_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 Workstation service 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. IF_DEBUG(RPCBIND) {
  100. NetpKdPrint(("WKSSVC_IMPERSONATE_HANDLE_unbind: handle="
  101. FORMAT_HEX_DWORD "\n", BindHandle));
  102. }
  103. NetpUnbindRpc(BindHandle);
  104. }
  105. void
  106. WKSSVC_IDENTIFY_HANDLE_unbind(
  107. WKSSVC_IDENTIFY_HANDLE ServerName,
  108. handle_t BindHandle
  109. )
  110. /*++
  111. Routine Description:
  112. This routine calls a common unbind routine that is shared by all services.
  113. This routine is called from the server service client stubs when it is
  114. necessary to unbind from a server.
  115. Arguments:
  116. ServerName - This is the name of the server from which to unbind.
  117. BindingHandle - This is the binding handle that is to be closed.
  118. Return Value:
  119. None.
  120. --*/
  121. {
  122. UNREFERENCED_PARAMETER(ServerName);
  123. IF_DEBUG(RPCBIND) {
  124. NetpKdPrint(("WKSSVC_IDENTIFY_HANDLE_unbind: handle="
  125. FORMAT_HEX_DWORD "\n", BindHandle));
  126. }
  127. NetpUnbindRpc(BindHandle);
  128. }