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.

187 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. ftpbind.c
  5. Abstract:
  6. Routines which use RPC to bind and unbind the client to the FTP Daemon
  7. service.
  8. Author:
  9. Murali R. Krishnan (MuraliK) 15-Nov-1995 (completely rewritten)
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. MuraliK 21-Dec-1995 Support for TCP/IP binding added.
  14. --*/
  15. #define UNICODE
  16. #include <nt.h>
  17. #include <ntrtl.h>
  18. #include <nturtl.h>
  19. #include <windef.h>
  20. #include <ftpsvc.h>
  21. #include "apiutil.h"
  22. handle_t
  23. FTP_IMPERSONATE_HANDLE_bind(
  24. FTP_IMPERSONATE_HANDLE ServerName
  25. )
  26. /*++
  27. Routine Description:
  28. This routine is called from the FTP Daemon client stubs when
  29. it is necessary create an RPC binding to the server end with
  30. impersonation level of security
  31. Arguments:
  32. ServerName - A pointer to a string containing the name of the server
  33. to bind with.
  34. Return Value:
  35. The binding handle is returned to the stub routine. If the bind is
  36. unsuccessful, a NULL will be returned.
  37. --*/
  38. {
  39. handle_t BindingHandle;
  40. RPC_STATUS RpcStatus;
  41. RpcStatus = RpcBindHandleForServer(&BindingHandle,
  42. ServerName,
  43. FTP_INTERFACE_NAME,
  44. PROT_SEQ_NP_OPTIONS_W
  45. );
  46. return BindingHandle;
  47. } // FTP_IMPERSONATE_HANDLE_bind()
  48. handle_t
  49. FTP_IDENTIFY_HANDLE_bind(
  50. FTP_IDENTIFY_HANDLE ServerName
  51. )
  52. /*++
  53. Routine Description:
  54. This routine is called from the FTP Daemon 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 BindingHandle;
  66. RPC_STATUS RpcStatus;
  67. RpcStatus = RpcBindHandleForServer(&BindingHandle,
  68. ServerName,
  69. FTP_INTERFACE_NAME,
  70. PROT_SEQ_NP_OPTIONS_W
  71. );
  72. return BindingHandle;
  73. } // FTP_IDENTIFY_HANDLE_bind()
  74. void
  75. FTP_IMPERSONATE_HANDLE_unbind(
  76. FTP_IMPERSONATE_HANDLE ServerName,
  77. handle_t BindingHandle
  78. )
  79. /*++
  80. Routine Description:
  81. This routine calls a common unbind routine that is shared by all services.
  82. This routine is called from the FTP Daemon client stubs when it is
  83. necessary to unbind from the server end.
  84. Arguments:
  85. ServerName - This is the name of the server from which to unbind.
  86. BindingHandle - This is the binding handle that is to be closed.
  87. Return Value:
  88. None.
  89. --*/
  90. {
  91. UNREFERENCED_PARAMETER(ServerName);
  92. (VOID ) RpcBindHandleFree(&BindingHandle);
  93. return;
  94. } // FTP_IMPERSONATE_HANDLE_unbind()
  95. void
  96. FTP_IDENTIFY_HANDLE_unbind(
  97. FTP_IDENTIFY_HANDLE ServerName,
  98. handle_t BindingHandle
  99. )
  100. /*++
  101. Routine Description:
  102. This routine calls a common unbind routine that is shared by all services.
  103. This routine is called from the FTP Daemon client stubs when it is
  104. necessary to unbind from a server.
  105. Arguments:
  106. ServerName - This is the name of the server from which to unbind.
  107. BindingHandle - This is the binding handle that is to be closed.
  108. Return Value:
  109. None.
  110. --*/
  111. {
  112. UNREFERENCED_PARAMETER(ServerName);
  113. (VOID ) RpcBindHandleFree(&BindingHandle);
  114. return;
  115. } // FTP_IDENTIFY_HANDLE_unbind()
  116. /****************************** End Of File ******************************/