From 8f635506d3f0a7c8ebb85886fea8acb5ec08794a Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Sat, 11 Apr 1998 02:52:39 +0000 Subject: [PATCH] * 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10526 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/ChangeLog | 8 ++++++++ src/appl/gssftp/ftpd/ftpcmd.y | 2 -- src/appl/gssftp/ftpd/ftpd.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 7fcab65dd..fd13cf535 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,11 @@ +Fri Apr 10 20:06:31 1998 Tom Yu + + * 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 * ftpcmd.y (getline): Don't syslog passwords! (or newlines) diff --git a/src/appl/gssftp/ftpd/ftpcmd.y b/src/appl/gssftp/ftpd/ftpcmd.y index a7c400ba3..aa0aa1b31 100644 --- a/src/appl/gssftp/ftpd/ftpcmd.y +++ b/src/appl/gssftp/ftpd/ftpcmd.y @@ -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); diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index 6edeb1e17..45e561f95 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -72,6 +72,14 @@ static char sccsid[] = "@(#)ftpd.c 5.40 (Berkeley) 7/2/91"; #include #endif #include +#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 @@ -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) -- 2.26.2