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_SESSION_H 18#define VSF_SESSION_H 19 20#include <stdio.h> 21 22#ifndef VSFTP_STR_H 23#include "str.h" 24#endif 25 26#ifndef VSF_FILESIZE_H 27#include "filesize.h" 28#endif 29 30struct vsf_sysutil_sockaddr; 31struct mystr_list; 32 33/* This struct contains variables specific to the state of the current FTP 34 * session 35 */ 36struct vsf_session 37{ 38 /* Details of the control connection */ 39 struct vsf_sysutil_sockaddr* p_local_addr; 40 struct vsf_sysutil_sockaddr* p_remote_addr; 41 char* p_control_line_buf; 42 43 /* Details of the data connection */ 44 int pasv_listen_fd; 45 struct vsf_sysutil_sockaddr* p_port_sockaddr; 46 int data_fd; 47 int data_progress; 48 unsigned int bw_rate_max; 49 long bw_send_start_sec; 50 long bw_send_start_usec; 51 52 /* Details of the login */ 53 int is_anonymous; 54 struct mystr user_str; 55 struct mystr anon_pass_str; 56 57 /* Details of the FTP protocol state */ 58 filesize_t restart_pos; 59 int is_ascii; 60 struct mystr rnfr_filename_str; 61 int abor_received; 62 int epsv_all; 63 64 /* Details of FTP session state */ 65 struct mystr_list* p_visited_dir_list; 66 67 /* Details of userids which are interesting to us */ 68 int anon_ftp_uid; 69 int guest_user_uid; 70 int anon_upload_chown_uid; 71 72 /* Things we need to cache before we chroot() */ 73 struct mystr banned_email_str; 74 struct mystr email_passwords_str; 75 struct mystr userlist_str; 76 struct mystr banner_str; 77 int tcp_wrapper_ok; 78 79 /* Logging related details */ 80 int xferlog_fd; 81 int vsftpd_log_fd; 82 struct mystr remote_ip_str; 83 unsigned long log_type; 84 long log_start_sec; 85 long log_start_usec; 86 struct mystr log_str; 87 filesize_t transfer_size; 88 89 /* Buffers */ 90 struct mystr ftp_cmd_str; 91 struct mystr ftp_arg_str; 92 int layer; 93 struct mystr full_path; 94 95 /* Parent<->child comms channel */ 96 int parent_fd; 97 int child_fd; 98 99 /* Other details */ 100 unsigned int num_clients; 101 unsigned int num_this_ip; 102 struct mystr home_str; 103 104 /* Secure connections state */ 105 int control_use_ssl; 106 int data_use_ssl; 107 void* p_ssl_ctx; 108 void* p_control_ssl; 109 void* p_data_ssl; 110 int ssl_slave_active; 111 int ssl_slave_fd; 112 int ssl_consumer_fd; 113 114 int write_enable; 115}; 116#endif /* VSF_SESSION_H */ 117 118