Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / vsftpd / privops.h
blob3af1306345f6024b2fc3bda8ace36ddf42995ed3
1 #ifndef VSF_PRIVOPS_H
2 #define VSF_PRIVOPS_H
4 struct mystr;
5 struct vsf_session;
7 /* vsf_privop_get_ftp_port_sock()
8 * PURPOSE
9 * Return a network socket potentially bound to a privileged port (less than
10 * 1024) and connected to the remote.
11 * PARAMETERS
12 * p_sess - the current session object
13 * remote_port - the remote port to connect to
14 * use_port_sockaddr - true if we should use the specific sockaddr for connect
15 * RETURNS
16 * A file descriptor which is a socket bound to the privileged port, and
17 * connected to the remote on the specified port.
18 * Kills the process / session if the bind() fails.
19 * Returns -1 if the bind() worked but the connect() was not possible.
21 int vsf_privop_get_ftp_port_sock(struct vsf_session* p_sess,
22 unsigned short remote_port,
23 int use_port_sockaddr);
25 /* vsf_privop_pasv_cleanup()
26 * PURPOSE
27 * Makes sure any listening passive socket is closed.
28 * PARAMETERS
29 * p_sess - the current session object
31 void vsf_privop_pasv_cleanup(struct vsf_session* p_sess);
33 /* vsf_privop_pasv_listen()
34 * PURPOSE
35 * Start listening for an FTP data connection.
36 * PARAMETERS
37 * p_sess - the current session object
38 * RETURNS
39 * The port we ended up listening on.
41 unsigned short vsf_privop_pasv_listen(struct vsf_session* p_sess);
43 /* vsf_privop_pasv_active()
44 * PURPOSE
45 * Determine whether there is a passive listening socket active.
46 * PARAMETERS
47 * p_sess - the current session object
48 * RETURNS
49 * 1 if active, 0 if not.
51 int vsf_privop_pasv_active(struct vsf_session* p_sess);
53 /* vsf_privop_accept_pasv()
54 * PURPOSE
55 * Accept a connection on the listening data socket.
56 * PARAMETERS
57 * p_sess - the current session object
58 * RETURNS
59 * The file descriptor of the accepted incoming connection; or -1 if a
60 * network error occurred or -2 if the incoming connection was from the
61 * wrong IP (security issue).
63 int vsf_privop_accept_pasv(struct vsf_session* p_sess);
65 /* vsf_privop_do_file_chown()
66 * PURPOSE
67 * Takes a file owned by the unprivileged FTP user, and change the ownership
68 * to the value defined in the config file.
69 * PARAMETERS
70 * p_sess - the current session object
71 * fd - the file descriptor of the regular file
73 void vsf_privop_do_file_chown(struct vsf_session* p_sess, int fd);
75 enum EVSFPrivopLoginResult
77 kVSFLoginNull = 0,
78 kVSFLoginFail,
79 kVSFLoginAnon,
80 kVSFLoginReal
82 /* vsf_privop_do_login()
83 * PURPOSE
84 * Check if the supplied username/password combination is valid. This
85 * interface caters for checking both anonymous and real logins.
86 * PARAMETERS
87 * p_sess - the current session object
88 * p_pass_str - the proposed password
89 * RETURNS
90 * kVSFLoginFail - access denied
91 * kVSFLoginAnon - anonymous login credentials OK
92 * kVSFLoginReal - real login credentials OK
94 enum EVSFPrivopLoginResult vsf_privop_do_login(
95 struct vsf_session* p_sess, const struct mystr* p_pass_str);
97 #endif /* VSF_PRIVOPS_H */