1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License as
4 * published by the Free Software Foundation; either version 2 of
5 * the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
15 * MA 02111-1307 USA
16 */
17#ifndef VSF_PRIVOPS_H
18#define VSF_PRIVOPS_H
19
20struct mystr;
21struct vsf_session;
22
23/* vsf_privop_get_ftp_port_sock()
24 * PURPOSE
25 * Return a network socket bound to a privileged port (less than 1024).
26 * PARAMETERS
27 * p_sess       - the current session object
28 * RETURNS
29 * A file descriptor which is a socket bound to the privileged port.
30 */
31int vsf_privop_get_ftp_port_sock(struct vsf_session* p_sess);
32
33/* vsf_privop_do_file_chown()
34 * PURPOSE
35 * Takes a file owned by the unprivileged FTP user, and change the ownership
36 * to the value defined in the config file.
37 * PARAMETERS
38 * p_sess       - the current session object
39 * fd           - the file descriptor of the regular file
40 */
41void vsf_privop_do_file_chown(struct vsf_session* p_sess, int fd);
42
43enum EVSFPrivopLoginResult
44{
45  kVSFLoginNull = 0,
46  kVSFLoginFail,
47  kVSFLoginAnon,
48  kVSFLoginReal
49};
50/* vsf_privop_do_login()
51 * PURPOSE
52 * Check if the supplied username/password combination is valid. This
53 * interface caters for checking both anonymous and real logins.
54 * PARAMETERS
55 * p_sess       - the current session object
56 * p_pass_str   - the proposed password
57 * RETURNS
58 * kVSFLoginFail - access denied
59 * kVSFLoginAnon - anonymous login credentials OK
60 * kVSFLoginReal - real login credentials OK
61 */
62enum EVSFPrivopLoginResult vsf_privop_do_login(
63  struct vsf_session* p_sess, const struct mystr* p_pass_str);
64
65#endif /* VSF_PRIVOPS_H */
66
67