twoprocess.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef VSF_TWOPROCESS_H
  2. #define VSF_TWOPROCESS_H
  3. struct mystr;
  4. struct vsf_session;
  5. /* vsf_two_process_start()
  6. * PURPOSE
  7. * Called to start FTP login processing using the two process model. This
  8. * launches the unprivileged child to process the FTP login.
  9. * PARAMETERS
  10. * p_sess - the current session object
  11. */
  12. void vsf_two_process_start(struct vsf_session* p_sess);
  13. /* vsf_two_process_login()
  14. * PURPOSE
  15. * Called to propose a login using the two process model.
  16. * PARAMETERS
  17. * p_sess - the current session object
  18. * p_pass_str - the proposed password
  19. */
  20. void vsf_two_process_login(struct vsf_session* p_sess,
  21. const struct mystr* p_pass_str);
  22. /* vsf_two_process_get_priv_data_sock()
  23. * PURPOSE
  24. * Get a privileged port 20 bound data socket using the two process model.
  25. * PARAMETERS
  26. * p_sess - the current session object
  27. * RETURNS
  28. * The file descriptor of the privileged socket
  29. */
  30. int vsf_two_process_get_priv_data_sock(struct vsf_session* p_sess);
  31. /* vsf_two_process_pasv_cleanup()
  32. * PURPOSE
  33. * Clean up any listening passive socket in the privileged side.
  34. * PARAMETERS
  35. * p_sess - the current session object
  36. */
  37. void vsf_two_process_pasv_cleanup(struct vsf_session* p_sess);
  38. /* vsf_two_process_pasv_active()
  39. * PURPOSE
  40. * Determine if the passive socket is listening on the privileged side.
  41. * PARAMETERS
  42. * p_sess - the current session object
  43. * RETURNS
  44. * 1 if active, 0 if not.
  45. */
  46. int vsf_two_process_pasv_active(struct vsf_session* p_sess);
  47. /* vsf_two_process_listen()
  48. * PURPOSE
  49. * Start listening for an incoming connection on the passive socket in the
  50. * privileged side.
  51. * PARAMETERS
  52. * p_sess - the current session object
  53. * RETURNS
  54. * The port we listened on.
  55. */
  56. unsigned short vsf_two_process_listen(struct vsf_session* p_sess);
  57. /* vsf_two_process_get_pasv_fd()
  58. * PURPOSE
  59. * Accept an incoming connection on the passive socket in the privileged
  60. * side.
  61. * PARAMETERS
  62. * p_sess - the current session object
  63. * RETURNS
  64. * The file descriptor for the incoming connection.
  65. */
  66. int vsf_two_process_get_pasv_fd(struct vsf_session* p_sess);
  67. /* vsf_two_process_chown_upload()
  68. * PURPOSE
  69. * Change ownership of an uploaded file using the two process model.
  70. * PARAMETERS
  71. * p_sess - the current session object
  72. * fd - the file descriptor to change ownership on
  73. */
  74. void vsf_two_process_chown_upload(struct vsf_session* p_sess, int fd);
  75. #endif /* VSF_TWOPROCESS_H */