1 /* 2 * wzdftpd - a modular and cool ftp server 3 * Copyright (C) 2002-2004 Pierre Chifflier 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * As a special exemption, Pierre Chifflier 20 * and other respective copyright holders give permission to link this program 21 * with OpenSSL, and distribute the resulting executable, without including 22 * the source code for OpenSSL in the source distribution. 23 */ 24 25 #ifndef __WZD_CLIENT_THREAD__ 26 #define __WZD_CLIENT_THREAD__ 27 28 #include "wzd_string.h" 29 30 int clear_read(fd_t sock, char *msg, size_t length, int flags, unsigned int timeout, void * vcontext); 31 int clear_write(fd_t sock, const char *msg, size_t length, int flags, unsigned int timeout, void * vcontext); 32 33 void * clientThreadProc(void *arg); 34 35 void client_die(wzd_context_t * context); 36 37 #define FEAT_COMMON " NON-FREE FTPD SUCKS\n" \ 38 " MDTM\n" \ 39 " SIZE\n" \ 40 " SITE\n" \ 41 " REST STREAM\n" \ 42 " PRET\n" \ 43 " XCRC\n" \ 44 " XMD5\n" \ 45 " MODA modify*;accessed*;\n" 46 47 #define FEAT_MLST " MLST Type*;Size*;Modify*;Perm*;Unique*;UNIX.mode;\n" 48 49 #if defined(HAVE_OPENSSL) || defined(HAVE_GNUTLS) 50 #define FEAT_TLS " AUTH TLS\n PBSZ\n PROT\n SSCN\n CPSV\n" 51 #else 52 #define FEAT_TLS 53 #endif 54 55 #ifdef HAVE_UTF8 56 #define FEAT_UTF8 " UTF8\n" 57 #else 58 #define FEAT_UTF8 59 #endif 60 61 #define SUPPORTED_FEATURES (FEAT_COMMON FEAT_MLST FEAT_TLS FEAT_UTF8 "End") 62 63 64 65 int do_chdir(const char * wanted_path, wzd_context_t *context); 66 67 int do_type(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 68 int do_port(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 69 int do_pasv(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 70 int do_eprt(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 71 int do_epsv(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 72 int do_abor(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 73 int do_print_message(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 74 int do_rnfr(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 75 int do_rnto(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 76 int do_cwd(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 77 int do_list(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 78 int do_mlst(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 79 int do_mlsd(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 80 int do_stat(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 81 int do_mkdir(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 82 int do_rmdir(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 83 int do_retr(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 84 int do_stor(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 85 int do_rest(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 86 int do_mdtm(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 87 int do_size(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 88 int do_dele(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 89 int do_pret(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 90 int do_xcrc(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 91 int do_xmd5(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 92 int do_opts(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 93 int do_quit(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 94 int do_pbsz(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 95 int do_prot(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 96 int do_sscn(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 97 int do_mic(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 98 int do_help(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 99 100 int do_moda(wzd_string_t *name, wzd_string_t *param, wzd_context_t * context); 101 102 /** \brief Get current context from Thread Local Storage (TLS) 103 * 104 * \return 105 * - a valid wzd_context_t structure if found 106 * - NULL if the value was not found in TLS 107 */ 108 wzd_context_t * _tls_get_context(void); 109 110 /** \brief Store context in Thread Local Store (TLS) 111 * 112 * \param[in] context Client context 113 * \return 0 if ok 114 */ 115 int _tls_store_context(wzd_context_t * context); 116 117 /** \brief Remove current context from Thread Local Storage (TLS) 118 * 119 * This is used by threads to release properly TLS resources used 120 * to store context pointer. 121 * 122 * \return 0 if ok 123 */ 124 int _tls_remove_context(void); 125 126 #endif /* __WZD_CLIENT_THREAD__ */ 127