DocumentationGenerated on Thu Aug 31 00:02:27 2006 |
||
Commands.hGo to the documentation of this file.00001 00002 // $Id: Commands.h,v 1.96 2005/04/29 17:58:16 klas Exp $ 00003 // Usage: Ftp commands and data transfer functions 00004 // 00005 // A part of babyftpd, licensed under the GNU GPL, see the file 00006 // LICENSE for complete information. 00008 00009 #ifndef COMMANDS_H 00010 #define COMMANDS_H 00011 00012 #if (defined(COMMANDS_CPP) || defined(COMMANDS2_CPP)) 00013 #include "generic.h" 00014 #include "Utilities.h" 00015 #include "Configuration.h" 00016 #include "Log.h" 00017 #include "Connection.h" 00018 #include "Data.h" 00019 #include "User.h" 00020 #include "Handler.h" 00021 #include "StringTokenizer.h" 00022 #endif 00023 00024 #define BABY_COM(com) bool com(User *user, string &argument, unsigned int flag) 00025 00026 class Commands 00027 { 00028 private: 00029 string parsedir(User*, string); 00030 string mlsx(User*, string); 00031 string list_file(string); 00032 string mlst_string(User*); 00033 public: 00034 BABY_COM(user); 00035 BABY_COM(pass); 00036 BABY_COM(retr); 00037 BABY_COM(stor); 00038 BABY_COM(port); 00039 BABY_COM(quit); 00040 BABY_COM(list); 00041 BABY_COM(help); 00042 BABY_COM(mkd); 00043 BABY_COM(rmd); 00044 BABY_COM(cwd); 00045 BABY_COM(dele); 00046 BABY_COM(pasv); 00047 BABY_COM(rname); 00048 BABY_COM(opts); 00049 BABY_COM(rest); 00050 BABY_COM(abor); 00051 // functions for simple commands that don't justify an own function 00052 BABY_COM(sim1); 00053 BABY_COM(sim2); 00054 sem_t pam_lock; // pam is not threadsafe. 00055 #ifdef USE_TLS 00056 // collection of encryption commands 00057 BABY_COM(auth); 00058 #endif // USE_TLS 00059 }; 00060 00061 extern class Commands comm; 00062 00063 // the extra flags we can play with... 00064 const int COM_LONG = (1 << 0); // for list() 00065 const int COM_SHORT = (1 << 1); 00066 const int COM_MLSD = (1 << 2); 00067 00068 const int COM_FROM = (1 << 0); // for rname() 00069 const int COM_TO = (1 << 1); 00070 00071 const int COM_STOR = (1 << 0); // for stor() 00072 const int COM_APPE = (1 << 1); 00073 00074 const int COM_CDUP = (1 << 0); 00075 const int COM_CWD = (1 << 1); 00076 00077 const int COM_NOOP = (1 << 0); // for sim1() 00078 const int COM_PWD = (1 << 1); 00079 const int COM_SYST = (1 << 2); 00080 const int COM_FEAT = (1 << 3); 00081 const int COM_TYPE = (1 << 4); 00082 const int COM_MODE = (1 << 5); 00083 const int COM_STRU = (1 << 6); 00084 #ifdef USE_TLS 00085 const int COM_PBSZ = (1 << 7); 00086 const int COM_PROT = (1 << 8); 00087 const int COM_CCC = (1 << 9); 00088 const int COM_CONF = (1 << 10); 00089 const int COM_MIC = (1 << 11); 00090 const int COM_ENC = (1 << 12); 00091 #endif // USE_TLS 00092 00093 const int COM_SIZE = (1 << 0); // for sim2() 00094 const int COM_MDTM = (1 << 1); 00095 const int COM_MLST = (1 << 2); 00096 00097 const int COM_PORT = (1 << 0); // port and pasv 00098 const int COM_EPRT = (1 << 1); 00099 const int COM_PASV = (1 << 2); 00100 const int COM_EPSV = (1 << 3); 00101 00102 // remember that these are used in conunctions with those above.. 00103 const int BEFORE_USER = (1 << 31); 00104 00105 const int PROT_IPV4 = 1;// EPRT and EPSV 00106 const int PROT_IPV6 = 2; 00107 00108 00109 void *data_wrapper(void*) __attribute__ ((noreturn)); 00110 00111 extern vector<User*> user_list; 00112 00113 #ifdef USE_TLS 00114 extern gnutls_certificate_credentials x509_cred; 00115 extern int tls_db_store(void*, gnutls_datum, gnutls_datum); 00116 extern gnutls_datum tls_db_fetch(void*, gnutls_datum); 00117 extern int tls_db_delete(void*, gnutls_datum); 00118 #endif // USE_TLS 00119 00120 int pam_conversate(int, const struct pam_message**, 00121 struct pam_response**, void*); 00122 00123 struct pam_data { 00124 string user_name; 00125 string password; 00126 }; 00127 00128 #endif |
- Copyright © 2005, BabyFTPd
- Powered by: