diff options
| author | Ruslan Ermilov <ru@FreeBSD.org> | 2001-05-30 14:24:35 +0000 |
|---|---|---|
| committer | Ruslan Ermilov <ru@FreeBSD.org> | 2001-05-30 14:24:35 +0000 |
| commit | 79ec1c507a8d2a80a898d54f6f65f86c94b42caf (patch) | |
| tree | 472428b3de2fd46165c44ab143314ca3c6937bc9 /sys/netinet/libalias/alias_ftp.c | |
| parent | 39f6498da2c61d3d034ba3ec3ddcd47b014f2287 (diff) | |
Notes
Diffstat (limited to 'sys/netinet/libalias/alias_ftp.c')
| -rw-r--r-- | sys/netinet/libalias/alias_ftp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/netinet/libalias/alias_ftp.c b/sys/netinet/libalias/alias_ftp.c index d5978f9606ec..e2152ee0a66a 100644 --- a/sys/netinet/libalias/alias_ftp.c +++ b/sys/netinet/libalias/alias_ftp.c @@ -59,6 +59,9 @@ #define FTP_CONTROL_PORT_NUMBER 21 #define MAX_MESSAGE_SIZE 128 +/* FTP protocol flags. */ +#define WAIT_CRLF 0x01 + enum ftp_message_type { FTP_PORT_COMMAND, FTP_EPRT_COMMAND, @@ -82,7 +85,7 @@ struct ip *pip, /* IP packet to examine/patch */ struct alias_link *link, /* The link to go through (aliased port) */ int maxpacketsize /* The maximum size this packet can grow to (including headers) */) { - int hlen, tlen, dlen; + int hlen, tlen, dlen, pflags; char *sptr; struct tcphdr *tc; int ftp_message_type; @@ -101,7 +104,8 @@ int maxpacketsize /* The maximum size this packet can grow to (including header * Check that data length is not too long and previous message was * properly terminated with CRLF. */ - if (dlen <= MAX_MESSAGE_SIZE && GetLastLineCrlfTermed(link)) { + pflags = GetProtocolFlags(link); + if (dlen <= MAX_MESSAGE_SIZE && (pflags & WAIT_CRLF)) { ftp_message_type = FTP_UNKNOWN_MESSAGE; if (ntohs(tc->th_dport) == FTP_CONTROL_PORT_NUMBER) { @@ -131,8 +135,11 @@ int maxpacketsize /* The maximum size this packet can grow to (including header if (dlen) { /* only if there's data */ sptr = (char *) pip; /* start over at beginning */ tlen = ntohs(pip->ip_len); /* recalc tlen, pkt may have grown */ - SetLastLineCrlfTermed(link, - (sptr[tlen-2] == '\r') && (sptr[tlen-1] == '\n')); + if (sptr[tlen-2] == '\r' && sptr[tlen-1] == '\n') + pflags &= ~WAIT_CRLF; + else + pflags |= WAIT_CRLF; + SetProtocolFlags(link, pflags); } } |
