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