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