* ftpd.c (receive_data):
authorTom Yu <tlyu@mit.edu>
Sat, 11 Apr 1998 02:52:39 +0000 (02:52 +0000)
committerTom Yu <tlyu@mit.edu>
Sat, 11 Apr 1998 02:52:39 +0000 (02:52 +0000)
(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.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10526 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/gssftp/ftpd/ChangeLog
src/appl/gssftp/ftpd/ftpcmd.y
src/appl/gssftp/ftpd/ftpd.c

index 7fcab65dd9052f65cc322a87425f5f0df0069e1a..fd13cf5350bffca16eb2933dfe9cc2ac4f024b52 100644 (file)
@@ -1,3 +1,11 @@
+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)
index a7c400ba3c745f68f8823c77136f4c2fffc8431c..aa0aa1b31c5cc60269964a940457eb048dc280c0 100644 (file)
@@ -243,8 +243,6 @@ cmd:                USER SP username CRLF
                        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);
index 6edeb1e17cf666d2820323de23ad67d75d1049f2..45e561f955b250571304b614d22cd0effcc69443 100644 (file)
@@ -72,6 +72,14 @@ static char sccsid[] = "@(#)ftpd.c   5.40 (Berkeley) 7/2/91";
 #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>
@@ -159,7 +167,8 @@ struct      sockaddr_in his_addr;
 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;
@@ -414,9 +423,21 @@ nextopt:
        (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
@@ -1159,7 +1180,7 @@ void send_data(instr, outstr, blksize)
        int ret = 0;
 
        transflag++;
-       if (setjmp(urgcatch)) {
+       if (sigsetjmp(urgcatch, 1)) {
                transflag = 0;
                return;
        }
@@ -1241,7 +1262,7 @@ receive_data(instr, outstr)
        int ret = 0;
 
        transflag++;
-       if (setjmp(urgcatch)) {
+       if (sigsetjmp(urgcatch, 1)) {
                transflag = 0;
                return (-1);
        }
@@ -1718,7 +1739,7 @@ myoob()
                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)