received in ASCII mode and print warning; correct test in status() code
so ip address is printed as well as hostname
SCCS-vsn: libexec/ftpd/ftpd.c 5.29
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ftpd.c 5.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftpd.c 5.29 (Berkeley) %G%";
if ((int)signal(SIGURG, myoob) < 0)
syslog(LOG_ERR, "signal: %m");
if ((int)signal(SIGURG, myoob) < 0)
syslog(LOG_ERR, "signal: %m");
- /* handle urgent data inline */
- /* Sequent defines this, but it doesn't work */
+ /* Try to handle urgent data inline */
#ifdef SO_OOBINLINE
if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)) < 0)
syslog(LOG_ERR, "setsockopt: %m");
#endif
#ifdef SO_OOBINLINE
if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)) < 0)
syslog(LOG_ERR, "setsockopt: %m");
#endif
#ifdef F_SETOWN
if (fcntl(fileno(stdin), F_SETOWN, getpid()) == -1)
syslog(LOG_ERR, "fcntl F_SETOWN: %m");
#ifdef F_SETOWN
if (fcntl(fileno(stdin), F_SETOWN, getpid()) == -1)
syslog(LOG_ERR, "fcntl F_SETOWN: %m");
"FTP LOGIN REFUSED FROM %s, %s",
remotehost, name);
pw = (struct passwd *) NULL;
"FTP LOGIN REFUSED FROM %s, %s",
remotehost, name);
pw = (struct passwd *) NULL;
}
reply(331, "Password required for %s.", name);
askpasswd = 1;
}
reply(331, "Password required for %s.", name);
askpasswd = 1;
FILE *instr, *outstr;
{
register int c;
FILE *instr, *outstr;
{
register int c;
char buf[BUFSIZ];
transflag++;
char buf[BUFSIZ];
transflag++;
case TYPE_A:
while ((c = getc(instr)) != EOF) {
byte_count++;
case TYPE_A:
while ((c = getc(instr)) != EOF) {
byte_count++;
+ if (c == '\n')
+ bare_lfs++;
while (c == '\r') {
if (ferror(outstr))
goto data_err;
while (c == '\r') {
if (ferror(outstr))
goto data_err;
if (ferror(outstr))
goto file_err;
transflag = 0;
if (ferror(outstr))
goto file_err;
transflag = 0;
+ if (bare_lfs) {
+ lreply(230, "WARNING! %d bare linefeeds received in ASCII mode", bare_lfs);
+ printf(" File may not have transferred correctly.\r\n");
+ }
return (0);
default:
reply(550, "Unimplemented TYPE %d in receive_data", type);
return (0);
default:
reply(550, "Unimplemented TYPE %d in receive_data", type);
lreply(211, "%s FTP server status:", hostname, version);
printf(" %s\r\n", version);
printf(" Connected to %s", remotehost);
lreply(211, "%s FTP server status:", hostname, version);
printf(" %s\r\n", version);
printf(" Connected to %s", remotehost);
- if (isdigit(remotehost[0]))
+ if (!isdigit(remotehost[0]))
printf(" (%s)", inet_ntoa(his_addr.sin_addr));
printf("\r\n");
if (logged_in) {
printf(" (%s)", inet_ntoa(his_addr.sin_addr));
printf("\r\n");
if (logged_in) {