From haymanR@icefog.uacn.alaska.edu Thu Jun 15 12:25:39 1995 Return-Path: haymanR@icefog.uacn.alaska.edu Received: from orca.alaska.edu (orca.alaska.edu [137.229.10.36]) by locust.net.ohio-state.edu (8.6.10/8.6.9) with ESMTP id MAA07332 for ; Thu, 15 Jun 1995 12:25:32 -0400 From: haymanR@icefog.uacn.alaska.edu Received: from icefog.uacn.alaska.edu by VMS.ORCA.ALASKA.EDU (PMDF V4.3-13 #8271) id <01HRQ8GBJOHS8X1ICA@VMS.ORCA.ALASKA.EDU>; Thu, 15 Jun 1995 08:24:03 -0800 Received: from localhost by icefog.uacn.alaska.edu; (5.65/1.1.8.2/02Feb95-0309PM) id AA13526; Thu, 15 Jun 1995 08:25:57 -0800 Date: Thu, 15 Jun 1995 08:25:57 -0800 Subject: OSF/1 v3.2 mods for sendpage4a To: maf@net.ohio-state.edu Message-id: <9506151625.AA13526@icefog.uacn.alaska.edu> Content-transfer-encoding: 7BIT X-Mts: smtp Status: RO Mark - I'm now working on sendmail configuration and the learning curve is steep - would you have any helpful suggestions? I've got the O'Reilly Sendmail book and that's what I'm reading now (770+ pages)... Here are my mods to the code (mainly added debug statements and took out a bit of white space). There were two items which needed to be changed for clean compilation on Digital UNIX (aka OSF/1) v3.2 in compat.c I added #include , and in queue.c I removed an ampersand (my compiler (cc) warned me it was unnecessary and it was ignoring it). Having said that, here are my diffs for compat.c, config.c, io.c, queue.c, sendpage.h, and testpet.c: *** compat.c Thu Jun 01 14:35:10 1995 --- compat.c.orig Thu Jun 01 14:34:45 1995 *************** *** 5,11 **** /* Copyright (c) 1995 Mark Fullmer and The Ohio State University /***************************************************************************/ - #include #include "sendpage.h" #ifdef NEED_BZERO --- 5,10 ---- *** io.c Thu Jun 15 08:14:08 1995 --- io.c.orig Thu Jun 01 14:23:47 1995 *************** *** 43,53 **** #endif /* NEED_MALLOC_H */ #ifdef NEED_IOCTL_H - #ifdef __osf__ - #include - #else #include - #endif /* __osf__ */ #endif /* NEED_IOCTL_H */ #ifdef hpux --- 43,49 ---- *************** *** 76,91 **** #endif /* DEBUG */ /* open the modem device */ ! #if defined(hpux) || defined(__osf__) ! if (debug > 90) ! report (LOG_INFO, "opened %s as O_RDWR | O_NOCTTY", pcinfo->modemdev); if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NOCTTY, 0)) == -1) { #else - if (debug > 90) - report (LOG_INFO, "opened %s as O_RDWR | O_NDELAY", pcinfo->modemdev); if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NDELAY, 0)) == -1) { ! ! #endif /* hpux || osf */ report(LOG_ERR, "open (%.512s): %s", pcinfo->modemdev, strerror(errno)); return 1; /* bad */ } --- 72,82 ---- #endif /* DEBUG */ /* open the modem device */ ! #ifdef hpux 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 */ report(LOG_ERR, "open (%.512s): %s", pcinfo->modemdev, strerror(errno)); return 1; /* bad */ } *************** *** 160,175 **** #ifdef TOGGLE_DTR - if (debug >90) - report (LOG_INFO, "Toggle DTR enter"); - /* first toggle DTR - some modems will go to command state when doing this */ /* get the current modem control lines */ - if (debug >90) - report (LOG_INFO, "Get current Modem Control lines"); - #ifdef hpux if (ioctl(fd, MCGETA, &modem) == -1) { report (LOG_ERR, "ioctl (modem, MCGETA): %s", strerror(errno)); --- 151,160 ---- *************** *** 190,204 **** sleep (1); /* tell the modem */ - if (debug >90) - report (LOG_INFO, "Tell Modem to Turn Off DTR"); - #ifdef hpux if (ioctl(fd, MCSETA, &modem) == -1) { report (LOG_ERR, "ioctl (modem, MCSETA): %s", strerror(errno)); #else - if (debug >90) - report (LOG_INFO, "Setting current Modem Control lines"); if (ioctl(fd, TIOCMSET, &modem) == -1) { report (LOG_ERR, "ioctl (modem, TIOCMSET): %s", strerror(errno)); #endif /* hpux */ --- 175,184 ---- *************** *** 214,222 **** #endif /* hpux */ /* tell the modem */ - if (debug >90) - report (LOG_INFO, "Tell Modem to Turn On DTR"); - #ifdef hpux if (ioctl(fd, MCSETA, &modem) == -1) { report (LOG_ERR, "ioctl (modem, MCSETA): %s", strerror(errno)); --- 194,199 ---- *************** *** 226,235 **** #endif /* hpux */ return 1; /* bad */ } - - if (debug >90) - report (LOG_INFO, "Toggle DTR exit"); - #endif /* TOGGLE_DTR */ /* give the modem a chance to recover */ --- 203,208 ---- *************** *** 236,260 **** sleep (1); /* now send the +++ wait ath */ - if (debug >90) - report (LOG_INFO, "Send Modem "); - if (SendString (fd, " ")) return 1; sleep (2); - if (debug >90) - report (LOG_INFO, "Send Modem +++"); - if (SendString(fd, MODEM_PLUS)) return 1; sleep (3); - if (debug >90) - report (LOG_INFO, "Send Modem "); - if (SendString (fd, "\r")) return 1; --- 209,224 ---- *************** *** 264,286 **** code here, instead just go ahead and send the init command */ sleep (1); ! ! if (debug >90) ! report (LOG_INFO, "Send Modem init sequence"); ! if (SendString(fd, pcinfo->modeminit)) return 1; - if (debug >90) - report (LOG_INFO, "Send Modem "); - if (SendString(fd, "\r")) return 1; /* Now wait for the OK short result code */ - if (debug >90) - report (LOG_INFO, "Wait for 0"); - if (WaitString(fd, "0\r", cbuf)) return 1; --- 228,241 ---- code here, instead just go ahead and send the init command */ sleep (1); ! if (SendString(fd, pcinfo->modeminit)) return 1; if (SendString(fd, "\r")) return 1; /* Now wait for the OK short result code */ if (WaitString(fd, "0\r", cbuf)) return 1; *************** *** 287,315 **** /* the previous result code could of been from a few sources */ /* sync up us to the modem by setting the return code to the word /* form, then the number form */ - if (debug >90) - report (LOG_INFO, "Send Modem Word Form ret code init"); - if (SendString (fd, MODEM_WORDS)) return 1; /* should get an OK\r */ - if (debug >90) - report (LOG_INFO, "Wait for OK"); - if (WaitString (fd, MODEM_WORD_OK, cbuf)) return 1; - if (debug >90) - report (LOG_INFO, "Send Modem Number form ret code init"); - if (SendString (fd, MODEM_NUMS)) return 1; /* should get an 0\r */ - if (debug >90) - report (LOG_INFO, "Wait for 0"); - if (WaitString (fd, MODEM_NUM_OK, cbuf)) return 1; --- 242,258 ---- *************** *** 428,434 **** /* if bytes were actually read, keep trying a little longer */ if (n && retries2) ! --retries2, ++retries; } /* for retries */ --- 371,377 ---- /* if bytes were actually read, keep trying a little longer */ if (n && retries2) ! -- retries2, ++retries; } /* for retries */ *************** *** 712,717 **** --- 655,661 ---- gotlogin = 1; break; } + /* my spec says this is wrong, ofcourse that means nothing when /* paging central goes ahead and does it anyways */ if (res == PET_REPLY_GOAHEAD) { *************** *** 797,806 **** /* protocol allows optional linefeeds after carriage returns - just ignore them all. */ ! if (cbuf->buf[x] == ASCII_LF) { ! if (debug >90) report (LOG_INFO, "Ignoring ASCII_LF"); continue; - } for (pet = 0; pet < PET_REPLIES; ++pet) { --- 741,748 ---- /* protocol allows optional linefeeds after carriage returns - just ignore them all. */ ! if (cbuf->buf[x] == ASCII_LF) continue; for (pet = 0; pet < PET_REPLIES; ++pet) { *************** *** 979,991 **** len1 = strlen(field1); len2 = strlen(field2); csum = 0; - i = 0; if ((len1 + len2 + 8) > *buflen) return 1; /* start with a STX */ ! buf[i++] = ASCII_STX; /* add field 1 */ bcopy(field1, &buf[i], len1); --- 921,933 ---- len1 = strlen(field1); len2 = strlen(field2); csum = 0; if ((len1 + len2 + 8) > *buflen) return 1; /* start with a STX */ ! buf[0] = ASCII_STX; ! i = 1; /* add field 1 */ bcopy(field1, &buf[i], len1); *** queue.c Tue Jun 06 14:37:56 1995 --- queue.c.orig Tue Jun 06 14:37:23 1995 *************** *** 102,108 **** fd = -1; err = 1; /* bad */ nullbyte = 0; ! *qfname2 = (char*)qfname; /* make sure entry->*len are set correctly */ entry->recipientlen = strlen(recipient); --- 102,108 ---- fd = -1; err = 1; /* bad */ nullbyte = 0; ! *qfname2 = (char*)&qfname; /* make sure entry->*len are set correctly */ entry->recipientlen = strlen(recipient); *** sendpage.h Wed Jun 14 10:46:45 1995 --- sendpage.h.orig Tue May 23 08:14:35 1995 *************** *** 1,9 **** #include ! #define PATH_SENDPAGE_CONFIG "/usr/local/etc/sendpage.cf" #define PATH_SENDMAIL "/usr/lib/sendmail" ! #define PATH_SENDPAGE_PIDFILE "/usr/local/var/pqueue/sendpage.pid" ! #define PATH_QUEUE "/usr/local/var/pqueue" #define QUEUE_HEAD "sendpageQ" /* does your system not include bcopy() in libc? (yes for Solaris) */ --- 1,9 ---- #include ! #define PATH_SENDPAGE_CONFIG "/etc/sendpage.cf" #define PATH_SENDMAIL "/usr/lib/sendmail" ! #define PATH_SENDPAGE_PIDFILE "/var/pqueue/sendpage.pid" ! #define PATH_QUEUE "/var/pqueue" #define QUEUE_HEAD "sendpageQ" /* does your system not include bcopy() in libc? (yes for Solaris) */ *************** *** 18,25 **** /* does your system require malloc.h? */ #define NEED_MALLOC_H ! /* does your system require ioctl.h -- (yes for AIX yes for Digital UNIX) */ ! #define NEED_IOCTL_H /* does your system support posix style signals -- specifically sigaction()? */ #define POSIX_SIGNALS --- 18,25 ---- /* does your system require malloc.h? */ #define NEED_MALLOC_H ! /* does your system require ioctl.h -- (yes for AIX) */ ! /* #define NEED_IOCTL_H */ /* does your system support posix style signals -- specifically sigaction()? */ #define POSIX_SIGNALS *************** *** 28,34 **** /* it's important not to make this address the same as where a page would /* be sent to, to prevent mail loops. I use 'sendpage' at some other host, /* and just have 'sendpage' aliased to root */ ! #define FROM_HEADER "sendpage@icefog.alaska.edu ( Pager Gateway )" /* how long in seconds to wait between queue runs if the queue is not empty */ /* ie, the modem was busy so the queue run failed how long should it wait --- 28,34 ---- /* it's important not to make this address the same as where a page would /* be sent to, to prevent mail loops. I use 'sendpage' at some other host, /* and just have 'sendpage' aliased to root */ ! #define FROM_HEADER "sendpage@net.ohio-state.edu (OSU Pager Gateway )" /* how long in seconds to wait between queue runs if the queue is not empty */ /* ie, the modem was busy so the queue run failed how long should it wait *************** *** 47,53 **** #define PIPE_READ_SECONDS 30 /* a few extra lines in the e-mail response */ ! #define VERBOSE_MAIL_REPLY /* use a less strict lookup table for the pet protocol, this shouldn't /* hurt anything */ --- 47,53 ---- #define PIPE_READ_SECONDS 30 /* a few extra lines in the e-mail response */ ! /* #define VERBOSE_MAIL_REPLY */ /* use a less strict lookup table for the pet protocol, this shouldn't /* hurt anything */ *************** *** 62,68 **** 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 --- 62,68 ---- 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 *************** *** 81,87 **** /* &C1 DCD tracks carrier of remote modem /* &D1 return to command state on DTR transition /* E inhibit command echo ! /* L3 high speaker volume (not on MultiModem V32s, so I've removed it) /* M1 turn speaker off when modem is receiving remote carrier /* Q enable result codes /* V result codes are numbers --- 81,87 ---- /* &C1 DCD tracks carrier of remote modem /* &D1 return to command state on DTR transition /* E inhibit command echo ! /* L3 high speaker volume /* M1 turn speaker off when modem is receiving remote carrier /* Q enable result codes /* V result codes are numbers *************** *** 90,107 **** */ /* defaults */ ! #define MODEM_DEV "/dev/ttyd0" /* #define MODEM_DEV "/dev/tty00" /* HP/UX */ ! #define MODEM_INIT "at&F&C1&D1&Q1EM1QVX4H$mb300" /* #define MODEM_INIT "atEQVX4H" /* Simple */ /* c_cflag hardware settings... set to 0 for none */ /* see io.c */ #define C_FLAG CRTSCTS|HUPCL /* enable RTS/CTS flow control */ ! /* #define C_FLAG HUPCL */ /* try to get modems attention with DTR toggle? */ ! /* #define TOGGLE_DTR */ /* /* --- 90,107 ---- */ /* defaults */ ! #define MODEM_DEV "/dev/ttyb" /* #define MODEM_DEV "/dev/tty00" /* HP/UX */ ! #define MODEM_INIT "at&F&C1&D1EL3M1QVX4H" /* #define MODEM_INIT "atEQVX4H" /* Simple */ /* c_cflag hardware settings... set to 0 for none */ /* see io.c */ #define C_FLAG CRTSCTS|HUPCL /* enable RTS/CTS flow control */ ! /* #define C_FLAG HUPCL /**/ /* try to get modems attention with DTR toggle? */ ! #define TOGGLE_DTR /* /* *************** *** 149,155 **** #define PET_REPLY_GOODBYE 3 #define PET_REPLY_GOAHEAD 4 #define PET_ERROR 9999 ! #define PET_REPLIES 5 #define PET_START_SEQ1 "\033PG1" #define PET_START_SEQ3 "\033PG3" --- 149,155 ---- #define PET_REPLY_GOODBYE 3 #define PET_REPLY_GOAHEAD 4 #define PET_ERROR 9999 ! #define PET_REPLIES 5 #define PET_START_SEQ1 "\033PG1" #define PET_START_SEQ3 "\033PG3" *************** *** 174,183 **** "\006\015", 2, /* accept */ "\025\015", 2, /* reject */ "\036\015", 2, /* abandon */ ! "\033\004\015", 3, /* goodbye */ ! "\033[p\015", 4, /* goahead */ ! #else /* PET_STRICT_LOOKUP */ "\015\006\015", 3, /* accept */ "\015\025\015", 3, /* reject */ --- 174,183 ---- "\006\015", 2, /* accept */ "\025\015", 2, /* reject */ "\036\015", 2, /* abandon */ ! "\033\004\015", 3, /* goodbye */ ! "\033[p\015", 4, /* goahead */ ! #else /* PET_LESS_STRICT_LOOKUP */ "\015\006\015", 3, /* accept */ "\015\025\015", 3, /* reject */ *************** *** 211,217 **** #define RUN_CLIENT 0 #define RUN_DAEMON 1 ! #define RUN_PRINTQUEUE 2 #define RUN_VERIFY 3 #define RUN_UNKNOWN 999 --- 211,217 ---- #define RUN_CLIENT 0 #define RUN_DAEMON 1 ! #define RUN_PRINTQUEUE 2 #define RUN_VERIFY 3 #define RUN_UNKNOWN 999 *** testpet.c Tue Jun 13 14:31:12 1995 --- testpet.c.orig Mon Jun 12 14:33:32 1995 *************** *** 76,82 **** pcinfo.parity = PARENB; pcinfo.speed = B1200; pcinfo.databits = CS7; ! pcinfo.protocol = PC_PET1; pcinfo.msgretries = 30; strcpy(pcinfo.password, "000000"); --- 76,82 ---- pcinfo.parity = PARENB; pcinfo.speed = B1200; pcinfo.databits = CS7; ! pcinfo.protocol = PC_PET3; pcinfo.msgretries = 30; strcpy(pcinfo.password, "000000");