+Wed Aug 19 06:47:46 1998 Geoffrey King <gjking@mit.edu>
+
+ * ftpd.c: Add a new command line option, -c, which tells the
+ server to accept the CCC command.
+
+ * ftpcmd.y: If the -c option was given, check to make sure the CCC
+ command itself was integrity protected, and then set ccc_ok to
+ allow future commands to be transmitted as cleartext.
+ (getline): Now that CCC is potentially allowed, we must check to
+ see if we are parsing an unprotected command even if a security
+ context is established (i.e. auth_type is set).
+
Wed Aug 12 02:57:07 1998 Geoffrey King <gjking@mit.edu>
* ftpcmd.y, ftpd.c: Replace global variable level with clevel and
extern int form;
extern int clevel;
extern int debug;
+
+
+extern int allow_ccc;
+extern int ccc_ok;
extern int timeout;
extern int maxtimeout;
extern int pdata;
}
| CCC CRLF
= {
- reply(534, "CCC not supported");
+ if (!allow_ccc) {
+ reply(534, "CCC not supported");
+ }
+ else {
+ if(clevel == PROT_C && !ccc_ok) {
+ reply(533, "CCC command must be integrity protected");
+ } else {
+ reply(200, "CCC command successful.");
+ ccc_ok = 1;
+ }
+ }
}
| PBSZ SP STRING CRLF
= {
char out[sizeof(cbuf)], *cp;
int len, mic;
- if ((cs = strpbrk(s, " \r\n")))
- *cs++ = '\0';
+
+ /* Check to see if we have a protected command. */
+ if (!((mic = strncmp(s, "ENC", 3)) && strncmp(s, "MIC", 3)
+#ifndef NOCONFIDENTIAL
+ && strncmp(s, "CONF", 4)
+#endif
+ ) && (cs = strpbrk(s, " \r\n"))) {
+ *cs++ = '\0'; /* If so, split it into s and cs. */
+ } else { /* If not, check if unprotected commands are allowed. */
+ if(ccc_ok) {
+ clevel = PROT_C;
+ upper(s);
+ return(s);
+ } else {
+ reply(533, "All commands must be protected.");
+ syslog(LOG_ERR, "Unprotected command received");
+ *s = '\0';
+ return(s);
+ }
+ }
upper(s);
+ if (debug)
+ syslog(LOG_INFO, "command %s received (mic=%d)", s, mic);
#ifdef NOCONFIDENTIAL
if (!strcmp(s, "CONF")) {
reply(537, "CONF protected commands not supported.");
return(s);
}
#endif
- if ((mic = strcmp(s, "ENC")) && strcmp(s, "MIC")
-#ifndef NOCONFIDENTIAL
- && strcmp(s, "CONF")
-#endif
- ) {
- reply(533, "All commands must be protected.");
- syslog(LOG_ERR, "Unprotected command received");
- *s = '\0';
- return(s);
- } else if (debug)
- syslog(LOG_INFO, "command %s received (mic=%d)", s, mic);
/* Some paranoid sites may want to require that commands be encrypted. */
#ifdef PARANOID
if (mic) {