Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 239047
Collapse All | Expand All

(-)linux-ftpd-0.17/ftpd/extern.h (-1 / +1 lines)
Lines 43-49 void dologout __P((int)); Link Here
43
void	fatal __P((const char *));
43
void	fatal __P((const char *));
44
int	ftpd_pclose __P((FILE *));
44
int	ftpd_pclose __P((FILE *));
45
FILE   *ftpd_popen __P((char *, const char *));
45
FILE   *ftpd_popen __P((char *, const char *));
46
char   *ftpd_getline __P((char *, int, FILE *));
46
int	ftpd_getline __P((char *, int, FILE *));
47
void	ftpdlogwtmp __P((const char *, const char *, const char *));
47
void	ftpdlogwtmp __P((const char *, const char *, const char *));
48
void	lreply __P((int, const char *, ...));
48
void	lreply __P((int, const char *, ...));
49
void	makedir __P((char *));
49
void	makedir __P((char *));
(-)linux-ftpd-0.17/ftpd/ftpcmd.y (-6 / +22 lines)
Lines 980-986 static struct tab *lookup(struct tab *p, Link Here
980
/*
980
/*
981
 * getline - a hacked up version of fgets to ignore TELNET escape codes.
981
 * getline - a hacked up version of fgets to ignore TELNET escape codes.
982
 */
982
 */
983
char * ftpd_getline(char *s, int n, FILE *iop)
983
int ftpd_getline(char *s, int n, FILE *iop)
984
{
984
{
985
	int c;
985
	int c;
986
	register char *cs;
986
	register char *cs;
Lines 995-1001 char * ftpd_getline(char *s, int n, FILE Link Here
995
			if (debug)
995
			if (debug)
996
				syslog(LOG_DEBUG, "command: %s", s);
996
				syslog(LOG_DEBUG, "command: %s", s);
997
			tmpline[0] = '\0';
997
			tmpline[0] = '\0';
998
			return(s);
998
			return(0);
999
		}
999
		}
1000
		if (c == 0)
1000
		if (c == 0)
1001
			tmpline[0] = '\0';
1001
			tmpline[0] = '\0';
Lines 1037-1047 char * ftpd_getline(char *s, int n, FILE Link Here
1037
		    }
1037
		    }
1038
		}
1038
		}
1039
		*cs++ = c;
1039
		*cs++ = c;
1040
		if (--n <= 0 || c == '\n')
1040
		if (--n <= 0) {
1041
			/*
1042
			 * If command doesn't fit into buffer, discard the
1043
			 * rest of the command and indicate truncation.
1044
			 * This prevents the command to be split up into
1045
			 * multiple commands.
1046
			 */
1047
			while (c != '\n' && (c = getc(iop)) != EOF)
1048
				;
1049
			return (-2);
1050
		}
1051
		if (c == '\n')
1041
			break;
1052
			break;
1042
	}
1053
	}
1043
	if (c == EOF && cs == s)
1054
	if (c == EOF && cs == s)
1044
		return (NULL);
1055
		return (-1);
1045
	*cs++ = '\0';
1056
	*cs++ = '\0';
1046
	if (debug) {
1057
	if (debug) {
1047
		if (!guest && strncasecmp("pass ", s, 5) == 0) {
1058
		if (!guest && strncasecmp("pass ", s, 5) == 0) {
Lines 1061-1067 char * ftpd_getline(char *s, int n, FILE Link Here
1061
			syslog(LOG_DEBUG, "command: %.*s", len, s);
1072
			syslog(LOG_DEBUG, "command: %.*s", len, s);
1062
		}
1073
		}
1063
	}
1074
	}
1064
	return (s);
1075
	return (0);
1065
}
1076
}
1066
1077
1067
void toolong(int signo)
1078
void toolong(int signo)
Lines 1090-1098 static int yylex(void) Link Here
1090
		case CMD:
1101
		case CMD:
1091
			(void) signal(SIGALRM, toolong);
1102
			(void) signal(SIGALRM, toolong);
1092
			(void) alarm((unsigned) timeout);
1103
			(void) alarm((unsigned) timeout);
1093
			if (ftpd_getline(cbuf, sizeof(cbuf)-1, stdin)==NULL) {
1104
			n = ftpd_getline(cbuf, sizeof(cbuf)-1, stdin);
1105
			if (n == -1) {
1094
				reply(221, "You could at least say goodbye.");
1106
				reply(221, "You could at least say goodbye.");
1095
				dologout(0);
1107
				dologout(0);
1108
			} else if (n == -2) {
1109
				reply(500, "Command too long.");
1110
				alarm(0);
1111
				continue;
1096
			}
1112
			}
1097
			(void) alarm(0);
1113
			(void) alarm(0);
1098
			if ((cp = strchr(cbuf, '\r'))) {
1114
			if ((cp = strchr(cbuf, '\r'))) {
(-)linux-ftpd-0.17/ftpd/ftpd.c (-1 / +6 lines)
Lines 2210-2215 void dologout(int status) Link Here
2210
static void myoob(int signo)
2210
static void myoob(int signo)
2211
{
2211
{
2212
	char *cp;
2212
	char *cp;
2213
	int ret;
2213
	int save_errno = errno;
2214
	int save_errno = errno;
2214
2215
2215
	(void)signo;
2216
	(void)signo;
Lines 2218-2226 static void myoob(int signo) Link Here
2218
	if (!transflag)
2219
	if (!transflag)
2219
		return;
2220
		return;
2220
	cp = tmpline;
2221
	cp = tmpline;
2221
	if (ftpd_getline(cp, 7, stdin) == NULL) {
2222
	ret = ftpd_getline(cp, 7, stdin);
2223
	if (ret == -1) {
2222
		reply(221, "You could at least say goodbye.");
2224
		reply(221, "You could at least say goodbye.");
2223
		dologout(0);
2225
		dologout(0);
2226
	} else if (ret == -2) {
2227
		/* Ignore truncated command */
2228
		return;
2224
	}
2229
	}
2225
	upper(cp);
2230
	upper(cp);
2226
	if (strcmp(cp, "ABOR\r\n") == 0) {
2231
	if (strcmp(cp, "ABOR\r\n") == 0) {

Return to bug 239047