1 /*
2  * ProFTPD - FTP server daemon
3  * Copyright (c) 1997, 1998 Public Flood Software
4  * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
5  * Copyright (c) 2001-2017 The ProFTPD Project team
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20  *
21  * As a special exemption, Public Flood Software/MacGyver aka Habeeb J. Dihu
22  * and other respective copyright holders give permission to link this program
23  * with OpenSSL, and distribute the resulting executable, without including
24  * the source code for OpenSSL in the source distribution.
25  */
26 
27 /* FTP commands and responses (may not all be implemented) */
28 
29 #ifndef PR_FTP_H
30 #define PR_FTP_H
31 
32 /* Commands (minimum required supported level) */
33 #define C_USER	"USER"		/* Specify a username */
34 #define C_PASS	"PASS"		/* Specify a password */
35 #define C_ACCT	"ACCT"		/* Specify an account (not implemented) */
36 #define C_CWD	"CWD"		/* Change working directory */
37 #define C_XCWD	"XCWD"		/* Change working directory */
38 #define C_CDUP	"CDUP"		/* Change CWD up one level */
39 #define C_XCUP	"XCUP"		/* Change CWD up one level */
40 #define C_SMNT	"SMNT"		/* Mount different file system data structure (not implemented) */
41 #define C_REIN	"REIN"		/* Reinitialize account information (not supported) */
42 #define C_QUIT	"QUIT"		/* Close control connection and logout (if no transfer pending) */
43 #define C_PORT	"PORT"		/* PORT h1,h2,h3,h4,p1,p2 (specify User address/port for data connection) */
44 #define	C_EPRT	"EPRT"		/* Extended PORT */
45 #define C_PASV	"PASV"		/* Next transfer data connection is from client to server */
46 #define	C_EPSV	"EPSV"		/* Extended PASV */
47 #define C_TYPE	"TYPE"		/* A = ASCII, E = EBCDIC, I = Image, L<byte size> = Local byte size */
48 #define C_STRU	"STRU"		/* File structure (not implemented) */
49 #define C_MODE	"MODE"		/* Transfer Mode (S - Stream, B - Block, C - Compressed (not supported) */
50 #define C_RETR	"RETR"		/* Retrieve a file (RETR name) */
51 #define C_STOR	"STOR"		/* Store a file (STOR name) */
52 #define C_STOU	"STOU"		/* Store unique */
53 #define C_APPE	"APPE"		/* Append to the end of a file */
54 #define C_ALLO	"ALLO"		/* Allocate storage space (not used) */
55 #define C_REST	"REST"		/* Restart a transfer (REST marker) */
56 #define C_RNFR	"RNFR"		/* Rename from (RNFR filename) */
57 #define C_RNTO	"RNTO"		/* Rename to (RNTO filename) */
58 #define C_ABOR	"ABOR"		/* Abort current operation */
59 #define C_DELE	"DELE"		/* Delete a file */
60 #define C_MDTM	"MDTM"		/* Modification time, NOT in RFC959. */
61 #define C_RMD	"RMD"		/* Remove a directory */
62 #define C_XRMD	"XRMD"		/* Remove a directory */
63 #define C_MKD	"MKD"		/* Create a directory */
64 #define C_MLSD	"MLSD"		/* List a directory (RFC3659) */
65 #define C_MLST	"MLST"		/* List a path (RFC3659) */
66 #define C_XMKD	"XMKD"		/* Create a directory */
67 #define C_PWD	"PWD"		/* Return current working directory */
68 #define C_XPWD	"XPWD"		/* Return current working directory */
69 #define C_SIZE	"SIZE"		/* Return the number of octets in a file */
70 #define C_LIST	"LIST"		/* Return contents of PWD or specified dir */
71 #define C_NLST	"NLST"		/* As list but returns names only */
72 #define C_SITE	"SITE"		/* Site specific command */
73 #define C_SYST	"SYST"		/* The type of OS (UNIX Type: L8) */
74 #define C_STAT	"STAT"		/* Status */
75 #define C_HELP	"HELP"		/* Help */
76 #define C_NOOP	"NOOP"		/* Returns 200 and does nothing */
77 #define C_FEAT	"FEAT"		/* Request list of server-supported features */
78 #define C_OPTS	"OPTS"		/* Specify options for FTP commands */
79 #define C_LANG	"LANG"		/* Request a specific language */
80 #define C_HOST	"HOST"		/* Request a named server */
81 #define C_CLNT	"CLNT"		/* Client-offered identification */
82 #define C_RANG	"RANG"		/* Range of bytes to transfer */
83 
84 /* RFC2228 FTP Security commands */
85 #define C_ADAT  "ADAT"		/* Authentication/security data */
86 #define C_AUTH  "AUTH"		/* Authentication/security mechanism */
87 #define C_CCC   "CCC"		/* Clear command channel */
88 #define C_CONF  "CONF"		/* Confidentiality protected command */
89 #define C_ENC   "ENC"		/* Privacy protected command */
90 #define C_MIC   "MIC"		/* Integrity protected command */
91 #define C_PBSZ  "PBSZ"		/* Protection buffer size */
92 #define C_PROT  "PROT"		/* Data channel protection level */
93 
94 /* Proposed commands */
95 #define C_MFF	"MFF"		/* Modify File Fact (RFC3659) */
96 #define C_MFMT	"MFMT"		/* Modify File Modify-Type (RFC3659) */
97 
98 #define C_ANY	"*"		/* Special "wildcard" matching command */
99 
100 /* Command groupings */
101 
102 #define G_NONE	NULL
103 #define G_DIRS	"DIRS"		/* LIST, NLST */
104 #define G_READ	"READ"		/* RETR, etc */
105 #define G_WRITE "WRITE"		/* WRITE, etc */
106 
107 /* Responses */
108 
109 #define R_110	"110"		/* Restart marker reply (MARK yyyy = mmmm) */
110 #define R_120	"120"		/* Svc ready in nnn minutes */
111 #define R_125	"125"		/* Data connection already open; starting */
112 #define R_150	"150"		/* File status ok; opening data conn */
113 #define R_200	"200"		/* 'Generic' command ok */
114 #define R_202	"202"		/* Command not implemented, superfluous at this site */
115 #define R_211	"211"		/* System status or system help reply */
116 #define R_212	"212"		/* Directory status */
117 #define R_213	"213"		/* File status */
118 #define R_214	"214"		/* Help message (how to use server or non-standard command) */
119 #define R_215	"215"		/* NAME system type.  NAME == Official system name */
120 #define R_220	"220"		/* Service ready for new user. */
121 #define R_221	"221"		/* Service closing control connection, as per normal */
122 #define R_225	"225"		/* Data connection open; no transfer in progress */
123 #define R_226	"226"		/* Closing data connection.  File transfer/abort successful */
124 #define R_227	"227"		/* Entering passive mode (h1,h2,h3,h4,p1,p2) */
125 #define	R_229	"229"		/* Entering extended passive mode (|||p|) */
126 #define R_230	"230"		/* User logged in, proceed */
127 #define R_232   "232"		/* User logged in, authorized by security data */
128 #define R_234   "234"		/* Security data exchange complete */
129 #define R_235   "235"		/* Security exchange successful */
130 
131 #define R_250	"250"		/* Requested file action okay, completed. */
132 #define R_257	"257"		/* "PATHNAME" created. */
133 #define R_331	"331"		/* User name okay, need password. */
134 #define R_332	"332"		/* Need account for login. */
135 #define R_334   "334"		/* Security data required */
136 #define R_335   "335"		/* Additional security data required */
137 #define R_336   "336"		/* Username OK, need password; presenting challenge */
138 #define R_350	"350"		/* Requested file action pending further info */
139 #define R_421	"421"		/* Service not available, closing control connection (service is about to be shutdown) */
140 #define R_425	"425"		/* Can't open data connection */
141 #define R_426	"426"		/* Connection closed; transfer aborted */
142 #define R_431   "431"		/* Necessary security resource is unavailable */
143 #define R_450	"450"		/* Requested file action not taken (file unavailable; busy) */
144 #define R_451	"451"		/* Requested action aborted; local error in processing */
145 #define R_452	"452"		/* Requested action not taken; insufficient storage space */
146 #define	R_500	"500"		/* Syntax error, command unrecognized */
147 #define R_501	"501"		/* Syntax error in parameters or arguments */
148 #define R_502	"502"		/* Command not implemented */
149 #define R_503	"503"		/* Bad sequence of commands */
150 #define R_504	"504"		/* Command not implemented for that parameter */
151 #define	R_522	"522"		/* Extended port failure: unknown network protocol */
152 #define R_530	"530"		/* Not logged in */
153 #define R_532	"532"		/* Need account for storing files */
154 #define R_533   "533"		/* Integrity protected command required by policy */
155 #define R_534   "534"		/* Unwilling to accept security arguments */
156 #define R_535   "535"		/* Data failed security check */
157 #define R_536   "536"		/* Unsupported data channel protection level */
158 #define R_537   "537"		/* Unsupported command protection by security mechanism */
159 #define R_550	"550"		/* Requested action not taken. No access, etc */
160 #define R_551	"551"		/* Requested action not taken, page type unknown */
161 #define R_552	"552"		/* Requested file action aborted, exceeding storage allocation */
162 #define	R_553	"553"		/* Requested action not taken, file name not allowed */
163 #define R_554   "554"           /* Requested action not taken, invalid REST parameter (RFC 1123) */
164 #define R_631	"631"		/* Integrity protected response (RFC 2228) */
165 #define R_632	"632"		/* Privacy protected response (RFC 2228) */
166 #define R_633	"633"		/* Confidentiality protected response (RFC 2228) */
167 #define R_DUP	NULL		/* Duplicate last numeric in ml response */
168 
169 #endif /* PR_FTP_H */
170