Set "home" to "/" when logging in as a guest.
Don't syslog() trailing CR-LF when using -d.
Don't timestamp connect message, syslog() already does that.
Don't timestamp timeout message, syslog() already does that.
Minor whitespace cleanups.
from Craig Leres (leres@ee.lbl.gov)
SCCS-vsn: libexec/ftpd/ftpd.c 5.41
SCCS-vsn: libexec/ftpd/ftpcmd.y 5.25
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ftpcmd.y 5.24 (Berkeley) %G%
+ * @(#)ftpcmd.y 5.25 (Berkeley) %G%
-static char sccsid[] = "@(#)ftpcmd.y 5.24 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftpcmd.y 5.25 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
}
| NLST check_login SP STRING CRLF
= {
}
| NLST check_login SP STRING CRLF
= {
send_file_list((char *) $4);
if ($4 != NULL)
free((char *) $4);
send_file_list((char *) $4);
if ($4 != NULL)
free((char *) $4);
-host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
+host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER
= {
register char *a, *p;
NUMBER COMMA NUMBER
= {
register char *a, *p;
if (c == EOF && cs == s)
return (NULL);
*cs++ = '\0';
if (c == EOF && cs == s)
return (NULL);
*cs++ = '\0';
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
+ if (debug) {
+ if (!guest && strncasecmp("pass ", s, 5) == 0) {
+ /* Don't syslog passwords */
+ syslog(LOG_DEBUG, "command: %.5s ???", s);
+ } else {
+ register char *cp;
+ register int len;
+
+ /* Don't syslog trailing CR-LF */
+ len = strlen(s);
+ cp = s + len - 1;
+ while (cp >= s && (*cp == '\n' || *cp == '\r')) {
+ --cp;
+ --len;
+ }
+ syslog(LOG_DEBUG, "command: %.*s", len, s);
+ }
+ }
return (s);
}
static void
toolong()
{
return (s);
}
static void
toolong()
{
- "Timeout (%d seconds): closing control connection.", timeout);
- (void) time(&now);
- if (logging) {
- syslog(LOG_INFO,
- "User %s timed out after %d seconds at %s",
- (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
- }
+ "Timeout (%d seconds): closing control connection.", timeout);
+ if (logging)
+ syslog(LOG_INFO, "User %s timed out after %d seconds",
+ (pw ? pw -> pw_name : "unknown"), timeout);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ftpd.c 5.40 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftpd.c 5.41 (Berkeley) %G%";
if (logging)
syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s",
remotehost, passwd);
if (logging)
syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s",
remotehost, passwd);
+ home = "/"; /* guest home dir for globbing */
} else {
reply(230, "User %s logged in.", pw->pw_name);
#ifdef SETPROCTITLE
} else {
reply(230, "User %s logged in.", pw->pw_name);
#ifdef SETPROCTITLE
if (logging)
syslog(LOG_INFO, "FTP LOGIN FROM %s, %s",
remotehost, pw->pw_name);
if (logging)
syslog(LOG_INFO, "FTP LOGIN FROM %s, %s",
remotehost, pw->pw_name);
+ home = pw->pw_dir; /* home dir for globbing */
- home = pw->pw_dir; /* home dir for globbing */
(void) umask(defumask);
return;
bad:
(void) umask(defumask);
return;
bad:
{
struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
sizeof (struct in_addr), AF_INET);
{
struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
sizeof (struct in_addr), AF_INET);
- time_t t, time();
- extern char *ctime();
if (hp)
(void) strncpy(remotehost, hp->h_name, sizeof (remotehost));
if (hp)
(void) strncpy(remotehost, hp->h_name, sizeof (remotehost));
setproctitle(proctitle);
#endif /* SETPROCTITLE */
setproctitle(proctitle);
#endif /* SETPROCTITLE */
- if (logging) {
- t = time((time_t *) 0);
- syslog(LOG_INFO, "connection from %s at %s",
- remotehost, ctime(&t));
- }
+ if (logging)
+ syslog(LOG_INFO, "connection from %s", remotehost);
/*
* Note: a response of 425 is not mentioned as a possible response to
/*
* Note: a response of 425 is not mentioned as a possible response to
- * the PASV command in RFC959. However, it has been blessed as
- * a legitimate response by Jon Postel in a telephone conversation
+ * the PASV command in RFC959. However, it has been blessed as
+ * a legitimate response by Jon Postel in a telephone conversation
* with Rick Adams on 25 Jan 89.
*/
passive()
* with Rick Adams on 25 Jan 89.
*/
passive()