diff options
| author | Tom Yu <tlyu@mit.edu> | 1999-03-24 22:14:02 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 1999-03-24 22:14:02 +0000 |
| commit | f818840fea93cbbcb349aa426459e2849deab42c (patch) | |
| tree | eca4b26e2fae53a616881af5d3a6296fd07fff75 /src/appl | |
| parent | 445026066d16416a5a8342e741da1eda82d82898 (diff) | |
| download | krb5-f818840fea93cbbcb349aa426459e2849deab42c.tar.gz krb5-f818840fea93cbbcb349aa426459e2849deab42c.tar.xz krb5-f818840fea93cbbcb349aa426459e2849deab42c.zip | |
* ftpcmd.y (urgsafe_getc): New function; like getc() except it
retries once if SIOCATMARK returns TRUE.
(getline): Use urgsafe_getc() rather than getc() to avoid problems
with certain Mac clients that cause the urgent pointer to end up
in a location that results in EOF from getc().
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11306 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl')
| -rw-r--r-- | src/appl/gssftp/ftpd/ChangeLog | 8 | ||||
| -rw-r--r-- | src/appl/gssftp/ftpd/ftpcmd.y | 35 |
2 files changed, 39 insertions, 4 deletions
diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index ead623aefd..3c77278832 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,11 @@ +Wed Mar 24 17:11:32 1999 Tom Yu <tlyu@mit.edu> + + * ftpcmd.y (urgsafe_getc): New function; like getc() except it + retries once if SIOCATMARK returns TRUE. + (getline): Use urgsafe_getc() rather than getc() to avoid problems + with certain Mac clients that cause the urgent pointer to end up + in a location that results in EOF from getc(). + Fri Mar 12 07:35:01 1999 Tom Yu <tlyu@mit.edu> * ftpd.c (user): Remove extra "%s" in call to sprintf() to avoid diff --git a/src/appl/gssftp/ftpd/ftpcmd.y b/src/appl/gssftp/ftpd/ftpcmd.y index 5b75a4600a..acd187112e 100644 --- a/src/appl/gssftp/ftpd/ftpcmd.y +++ b/src/appl/gssftp/ftpd/ftpcmd.y @@ -49,6 +49,10 @@ static char sccsid[] = "@(#)ftpcmd.y 5.24 (Berkeley) 2/25/91"; #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> +#include <sys/ioctl.h> +#ifdef HAVE_SYS_SOCKIO_H +#include <sys/sockio.h> +#endif #include <sys/stat.h> #include <netinet/in.h> #include <arpa/ftp.h> @@ -942,6 +946,26 @@ lookup(p, cmd) return (0); } +/* + * urgsafe_getc - hacked up getc to ignore EOF if SIOCATMARK returns TRUE + */ +int +urgsafe_getc(f) + FILE *f; +{ + register int c; + int atmark; + + c = getc(f); + if (c == EOF) { + if (ioctl(fileno(f), SIOCATMARK, &atmark) != -1) { + c = getc(f); + syslog(LOG_DEBUG, "atmark: c=%d", c); + } + } + return c; +} + #include <arpa/telnet.h> /* @@ -954,6 +978,7 @@ getline(s, n, iop) { register c; register char *cs; + int atmark; cs = s; /* tmpline may contain saved command from urgent mode interruption */ @@ -969,21 +994,23 @@ getline(s, n, iop) if (c == 0) tmpline[0] = '\0'; } - while ((c = getc(iop)) != EOF) { + while ((c = urgsafe_getc(iop)) != EOF) { c &= 0377; if (c == IAC) { - if ((c = getc(iop)) != EOF) { + if (debug) syslog(LOG_DEBUG, "got IAC"); + if ((c = urgsafe_getc(iop)) != EOF) { c &= 0377; + if (debug) syslog(LOG_DEBUG, "got IAC %d", c); switch (c) { case WILL: case WONT: - c = getc(iop); + c = urgsafe_getc(iop); printf("%c%c%c", IAC, DONT, 0377&c); (void) fflush(stdout); continue; case DO: case DONT: - c = getc(iop); + c = urgsafe_getc(iop); printf("%c%c%c", IAC, WONT, 0377&c); (void) fflush(stdout); continue; |
