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.

186 lines
3.7 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 Browser
  7. service.
  8. Author:
  9. Rita Wong (ritaw) 14-May-1991
  10. Larry Osterman (larryo) 23-Mar-1992
  11. Environment:
  12. User Mode -Win32
  13. Revision History:
  14. --*/
  15. #include "brclient.h"
  16. handle_t
  17. BROWSER_IMPERSONATE_HANDLE_bind(
  18. BROWSER_IMPERSONATE_HANDLE ServerName
  19. )
  20. /*++
  21. Routine Description:
  22. This routine is called from the Browser service client stubs when
  23. it is necessary create an RPC binding to the server end with
  24. impersonation level of impersonation.
  25. Arguments:
  26. ServerName - A pointer to a string containing the name of the server
  27. to bind with.
  28. Return Value:
  29. The binding handle is returned to the stub routine. If the bind is
  30. unsuccessful, a NULL will be returned.
  31. --*/
  32. {
  33. handle_t BindHandle;
  34. RPC_STATUS RpcStatus;
  35. RpcStatus = NetpBindRpc (
  36. ServerName,
  37. BROWSER_INTERFACE_NAME,
  38. TEXT("Security=Impersonation Dynamic False"),
  39. &BindHandle
  40. );
  41. if (RpcStatus != RPC_S_OK) {
  42. KdPrint((
  43. "BROWSER_IMPERSONATE_HANDLE_bind failed: " FORMAT_NTSTATUS "\n",
  44. RpcStatus
  45. ));
  46. }
  47. return BindHandle;
  48. }
  49. handle_t
  50. BROWSER_IDENTIFY_HANDLE_bind(
  51. BROWSER_IDENTIFY_HANDLE ServerName
  52. )
  53. /*++
  54. Routine Description:
  55. This routine is called from the Browser service client stubs when
  56. it is necessary create an RPC binding to the server end with
  57. identification level of impersonation.
  58. Arguments:
  59. ServerName - A pointer to a string containing the name of the server
  60. to bind with.
  61. Return Value:
  62. The binding handle is returned to the stub routine. If the bind is
  63. unsuccessful, a NULL will be returned.
  64. --*/
  65. {
  66. handle_t BindHandle;
  67. RPC_STATUS RpcStatus;
  68. RpcStatus = NetpBindRpc (
  69. ServerName,
  70. BROWSER_INTERFACE_NAME,
  71. TEXT("Security=Identification Dynamic False"),
  72. &BindHandle
  73. );
  74. if (RpcStatus != RPC_S_OK) {
  75. KdPrint((
  76. "BROWSER_IDENTIFY_HANDLE_bind failed: " FORMAT_NTSTATUS "\n",
  77. RpcStatus
  78. ));
  79. }
  80. return BindHandle;
  81. }
  82. void
  83. BROWSER_IMPERSONATE_HANDLE_unbind(
  84. BROWSER_IMPERSONATE_HANDLE ServerName,
  85. handle_t BindHandle
  86. )
  87. /*++
  88. Routine Description:
  89. This routine calls a common unbind routine that is shared by all services.
  90. This routine is called from the Browser service client stubs when it is
  91. necessary to unbind from the server end.
  92. Arguments:
  93. ServerName - This is the name of the server from which to unbind.
  94. BindingHandle - This is the binding handle that is to be closed.
  95. Return Value:
  96. None.
  97. --*/
  98. {
  99. UNREFERENCED_PARAMETER(ServerName);
  100. NetpUnbindRpc(BindHandle);
  101. }
  102. void
  103. BROWSER_IDENTIFY_HANDLE_unbind(
  104. BROWSER_IDENTIFY_HANDLE ServerName,
  105. handle_t BindHandle
  106. )
  107. /*++
  108. Routine Description:
  109. This routine calls a common unbind routine that is shared by all services.
  110. This routine is called from the server service client stubs when it is
  111. necessary to unbind from 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. NetpUnbindRpc(BindHandle);
  121. }