--- libexec/ftpd/extern.h.orig 2015-03-10 20:41:45.000000000 +0700 +++ libexec/ftpd/extern.h 2015-03-10 20:41:56.000000000 +0700 @@ -80,6 +80,7 @@ extern int epsvall; extern int form; extern int ftpdebug; extern int guest; +extern int do_iac; extern union sockunion his_addr; extern char *homedir; extern int hostinfo; --- libexec/ftpd/ftpcmd.y.orig 2015-03-10 20:41:45.000000000 +0700 +++ libexec/ftpd/ftpcmd.y 2015-03-10 20:41:56.000000000 +0700 @@ -1191,7 +1191,7 @@ getline(char *s, int n, FILE *iop) sigprocmask(SIG_BLOCK, &sset, &osset); while ((c = getc(iop)) != EOF) { c &= 0377; - if (c == IAC) { + if (do_iac && c == IAC) { if ((c = getc(iop)) == EOF) goto got_eof; c &= 0377; --- libexec/ftpd/ftpd.c.orig 2015-03-10 20:41:45.000000000 +0700 +++ libexec/ftpd/ftpd.c 2015-03-10 20:45:23.000000000 +0700 @@ -127,6 +127,7 @@ int paranoid = 1; /* be extra careful int anon_only = 0; /* Only anonymous ftp allowed */ int assumeutf8 = 0; /* Assume that server file names are in UTF-8 */ int guest; +int do_iac; int dochroot; char *chrootdir; int dowtmp = 1; @@ -1014,6 +1015,7 @@ user(char *name) } guest = 0; + do_iac = 1; #ifdef VIRTUAL_HOSTING pw = sgetpwnam(thishost->anonuser); #else @@ -1203,6 +1205,7 @@ end_login(void) #endif logged_in = 0; guest = 0; + do_iac = 1; dochroot = 0; } @@ -1459,6 +1462,7 @@ skip: pw = NULL; return; } + do_iac = !login_getcapbool(lc, "noiac", 1); } setusercontext(lc, pw, 0, LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|