7 /* vsf_privop_get_ftp_port_sock()
9 * Return a network socket potentially bound to a privileged port (less than
10 * 1024) and connected to the remote.
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
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()
27 * Makes sure any listening passive socket is closed.
29 * p_sess - the current session object
31 void vsf_privop_pasv_cleanup(struct vsf_session
* p_sess
);
33 /* vsf_privop_pasv_listen()
35 * Start listening for an FTP data connection.
37 * p_sess - the current session object
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()
45 * Determine whether there is a passive listening socket active.
47 * p_sess - the current session object
49 * 1 if active, 0 if not.
51 int vsf_privop_pasv_active(struct vsf_session
* p_sess
);
53 /* vsf_privop_accept_pasv()
55 * Accept a connection on the listening data socket.
57 * p_sess - the current session object
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()
67 * Takes a file owned by the unprivileged FTP user, and change the ownership
68 * to the value defined in the config file.
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
82 /* vsf_privop_do_login()
84 * Check if the supplied username/password combination is valid. This
85 * interface caters for checking both anonymous and real logins.
87 * p_sess - the current session object
88 * p_pass_str - the proposed password
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 */