+Fri Apr 10 20:06:31 1998 Tom Yu <tlyu@mit.edu>
+
+ * ftpd.c (receive_data):
+ (send_data): Add support for sigsetjmp().
+ (main): Use sigaction() if we can to avoid SysV lossage.
+
+ * ftpcmd.y (PBSZ): Remove restriction on shrinking buffer size.
+
Thu Mar 5 13:59:47 1998 Dan Winship <danw@mit.edu>
* ftpcmd.y (getline): Don't syslog passwords! (or newlines)
else if (strlen($3) > 10 ||
strlen($3) == 10 && strcmp($3,"4294967296") >= 0)
reply(501, "Bad value for PBSZ: %s", $3);
- else if (actualbuf >= (maxbuf =(unsigned int) atol($3)))
- reply(200, "PBSZ=%u", actualbuf);
else {
if (ucbuf) (void) free(ucbuf);
actualbuf = (unsigned int) atol($3);
#include <shadow.h>
#endif
#include <setjmp.h>
+#ifndef POSIX_SETJMP
+#undef sigjmp_buf
+#undef sigsetjmp
+#undef siglongjmp
+#define sigjmp_buf jmp_buf
+#define sigsetjmp(j,s) setjmp(j)
+#define siglongjmp longjmp
+#endif
#ifndef KRB5_KRB4_COMPAT
/* krb.h gets this, and Ultrix doesn't protect vs multiple inclusion */
#include <netdb.h>
struct sockaddr_in pasv_addr;
int data;
-jmp_buf errcatch, urgcatch;
+jmp_buf errcatch;
+sigjmp_buf urgcatch;
int logged_in;
struct passwd *pw;
int debug;
(void) signal(SIGPIPE, lostconn);
(void) signal(SIGCHLD, SIG_IGN);
#ifdef SIGURG
+#ifdef POSIX_SIGNALS
+ {
+ struct sigaction sa;
+
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = myoob;
+ if (sigaction(SIGURG, &sa, NULL) < 0)
+ syslog(LOG_ERR, "signal: %m");
+ }
+#else
if ((long)signal(SIGURG, myoob) < 0)
syslog(LOG_ERR, "signal: %m");
-#endif
+#endif /* POSIX_SIGNALS */
+#endif /* SIGURG */
/* Try to handle urgent data inline */
#ifdef SO_OOBINLINE
int ret = 0;
transflag++;
- if (setjmp(urgcatch)) {
+ if (sigsetjmp(urgcatch, 1)) {
transflag = 0;
return;
}
int ret = 0;
transflag++;
- if (setjmp(urgcatch)) {
+ if (sigsetjmp(urgcatch, 1)) {
transflag = 0;
return (-1);
}
tmpline[0] = '\0';
reply(426, "Transfer aborted. Data connection closed.");
reply(226, "Abort successful");
- longjmp(urgcatch, 1);
+ siglongjmp(urgcatch, 1);
}
if (strcmp(cp, "STAT") == 0) {
if (file_size != (off_t) -1)