diff --git a/comms/Makefile b/comms/Makefile index 17b52a4ebc43..009807e38700 100644 --- a/comms/Makefile +++ b/comms/Makefile @@ -142,6 +142,7 @@ SUBDIR += py-serial SUBDIR += pyla SUBDIR += qico + SUBDIR += qpage SUBDIR += qrq SUBDIR += qsstv SUBDIR += qt5-connectivity diff --git a/comms/qpage/Makefile b/comms/qpage/Makefile new file mode 100644 index 000000000000..7442d0c016b6 --- /dev/null +++ b/comms/qpage/Makefile @@ -0,0 +1,74 @@ +# Created by: joes@seaport.net +# $FreeBSD$ + +PORTNAME= qpage +PORTVERSION= 3.3 +PORTREVISION= 8 +CATEGORIES= comms +MASTER_SITES= http://www.qpage.org/download/ +MASTER_SITES= http://tomiii.com/qpage/qpage.org/download/ + +MAINTAINER= rand@iteris.com +COMMENT= SNPP client/server for sending messages to an alphanumeric pager + +USES=tar:Z +USE_RC_SUBR= qpage +GNU_CONFIGURE= yes + +OPTIONS_DEFINE= IDENT_PATCH +IDENT_PATCH_DESC= Disable libwrap ident lookups + +IDENT_PATCH_EXTRA_PATCHES=${FILESDIR}/libwrap_ident_patch-srvrsnpp.c + +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) || !defined(WITH_QPAGE_USER) +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) && !defined(WITH_QPAGE_USER) +_QPAGE_MSG= You may set the following configuration options: +.else +_QPAGE_MSG= The following additional configuration options are available: +.endif +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) +WITH_QPAGE_SYSLOG_FACILITY= LOG_DAEMON +_QPAGE_SYSLOG_MSG=1 +.endif +.if !defined(WITH_QPAGE_USER) +WITH_QPAGE_USER= uucp +_QPAGE_USER_MSG=1 +.endif +pre-patch: + @${ECHO_MSG} "" + @${ECHO_MSG} ${_QPAGE_MSG} + @if [ -n "${_QPAGE_SYSLOG_MSG}" ]; then \ + ${ECHO_MSG} ""; \ + ${ECHO_MSG} " WITH_QPAGE_SYSLOG_FACILITY=syslog_facility"; \ + ${ECHO_MSG} " Default is LOG_DAEMON"; \ + fi + @if [ -n "${_QPAGE_USER_MSG}" ]; then \ + ${ECHO_MSG} ""; \ + ${ECHO_MSG} " WITH_QPAGE_USER=userid"; \ + ${ECHO_MSG} " Default is \"uucp\"; recommended that user be in group \"dialer\""; \ + fi + @${ECHO_MSG} "" + @${ECHO_MSG} "Press ^C now to stop the build and set make options." + @${ECHO_MSG} "You may find it necessary to 'make clean' before restarting the build." + @sleep 2 +.endif + +post-patch: + ${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ + ${WRKSRC}/qpage.man \ + ${WRKSRC}/config.input \ + ${WRKSRC}/config.h.in + ${REINPLACE_CMD} \ + -e 's,%%WITH_QPAGE_SYSLOG_FACILITY%%,${WITH_QPAGE_SYSLOG_FACILITY},' \ + -e 's,%%WITH_QPAGE_USER%%,${WITH_QPAGE_USER},' \ + ${WRKSRC}/config.input + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/qpage ${STAGEDIR}${PREFIX}/bin + ${INSTALL_MAN} ${WRKSRC}/qpage.man \ + ${STAGEDIR}${MAN1PREFIX}/man/man1/qpage.1 + ${INSTALL_DATA} ${WRKSRC}/example.cf \ + ${STAGEDIR}${PREFIX}/etc/qpage.conf.sample + ${MKDIR} ${STAGEDIR}/var/spool/qpage + +.include diff --git a/comms/qpage/distinfo b/comms/qpage/distinfo new file mode 100644 index 000000000000..7dc615e97df7 --- /dev/null +++ b/comms/qpage/distinfo @@ -0,0 +1,2 @@ +SHA256 (qpage-3.3.tar.Z) = 0bbecd2908380c5d28b8beeee0d0238854162128db5ef4ea603614d52ee7d24c +SIZE (qpage-3.3.tar.Z) = 225689 diff --git a/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c b/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c new file mode 100644 index 000000000000..8cd51a09b2f7 --- /dev/null +++ b/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c @@ -0,0 +1,16 @@ +--- srvrsnpp.c.orig 2008-10-20 10:30:57.539127452 -0400 ++++ srvrsnpp.c 2008-10-20 10:35:43.096529509 -0400 +@@ -1066,7 +1066,12 @@ + + fromhost(&request); + +- ptr = eval_user(&request); ++ /* ++ ** If we aren't doing an ident request, don't ask ++ ** TCP Wrappers to do it either ++ */ ++ if (IdentTimeout) ptr = eval_user(&request); ++ else ptr = NULL; + + if (ptr && strcmp(ptr, STRING_UNKNOWN) != 0) + p->ident = strdup(ptr); diff --git a/comms/qpage/files/patch-config.c b/comms/qpage/files/patch-config.c new file mode 100644 index 000000000000..7e0d3406ba2d --- /dev/null +++ b/comms/qpage/files/patch-config.c @@ -0,0 +1,10 @@ +--- config.c.orig 1999-01-02 03:14:50 UTC ++++ config.c +@@ -1407,7 +1407,6 @@ free_pagers(pager_t *list) + my_free(list->name); + my_free(list->text); + my_free(list->pagerid); +- my_free(list->service); + free(list); + } + } diff --git a/comms/qpage/files/patch-config.h.in b/comms/qpage/files/patch-config.h.in new file mode 100644 index 000000000000..5240e0a46f5b --- /dev/null +++ b/comms/qpage/files/patch-config.h.in @@ -0,0 +1,11 @@ +--- config.h.in.orig 1998-07-26 19:38:35 UTC ++++ config.h.in +@@ -17,7 +17,7 @@ + #undef SNPP_SERVER_FILE + + /* Define as the location of the qpage configuration file. */ +-#define QPAGE_CONFIG "/etc/qpage.cf" ++#define QPAGE_CONFIG "/usr/local/etc/qpage.conf" + + /* Define as the location of the lock directory. */ + #undef DEFAULT_LOCKDIR diff --git a/comms/qpage/files/patch-config.input b/comms/qpage/files/patch-config.input new file mode 100644 index 000000000000..8bd72bc84a16 --- /dev/null +++ b/comms/qpage/files/patch-config.input @@ -0,0 +1,29 @@ +--- config.input.orig 1998-11-05 06:05:36 UTC ++++ config.input +@@ -20,7 +20,7 @@ + # See the QuickPage documentation for complete details about + # the syntax of the configuration file. + # +-QPAGE_CONFIG="/etc/qpage.cf" ++QPAGE_CONFIG="/usr/local/etc/qpage.conf" + + + # +@@ -41,7 +41,7 @@ SNPP_SERVER="localhost" + # copies of the configuration file. Only one filename + # may be specified. + # +-SNPP_SERVER_FILE="/etc/qpage.servers" ++SNPP_SERVER_FILE="/usr/local/etc/qpage.servers" + + + # +@@ -51,7 +51,7 @@ SNPP_SERVER_FILE="/etc/qpage.servers" + # for that user, QuickPage will assume all group privileges + # assigned to that user. + # +-DAEMON_USER="daemon" ++DAEMON_USER="uucp" + + + # diff --git a/comms/qpage/files/patch-ixo.c b/comms/qpage/files/patch-ixo.c new file mode 100644 index 000000000000..f4e00311433a --- /dev/null +++ b/comms/qpage/files/patch-ixo.c @@ -0,0 +1,10 @@ +--- ixo.c.orig 1999-01-02 01:59:33 UTC ++++ ixo.c +@@ -368,7 +368,6 @@ hangup_modem(int fd) + if (tcsetattr(fd, TCSANOW, &ti) < 0) { + qpage_log(LOG_DEBUG, "tcsetattr(): %s", strerror(errno)); + closemodem(fd); +- return; + } + + /* diff --git a/comms/qpage/files/patch-qpage.man b/comms/qpage/files/patch-qpage.man new file mode 100644 index 000000000000..810bd5a86fc9 --- /dev/null +++ b/comms/qpage/files/patch-qpage.man @@ -0,0 +1,11 @@ +--- qpage.man.orig 1999-05-08 22:07:31 UTC ++++ qpage.man +@@ -867,7 +867,7 @@ if more than one paging service is used + must be able to detect when it's safe to send dial commands to the modem. + .LP + .SH FILES +-/etc/qpage.cf ++/usr/local/etc/qpage.conf + .SH SEE ALSO + .B RFC-1861 + .SH KNOWN BUGS diff --git a/comms/qpage/files/patch-srvrsnpp.c b/comms/qpage/files/patch-srvrsnpp.c new file mode 100644 index 000000000000..d0241fa13e58 --- /dev/null +++ b/comms/qpage/files/patch-srvrsnpp.c @@ -0,0 +1,28 @@ +--- srvrsnpp.c.orig 2016-01-16 20:44:37 UTC ++++ srvrsnpp.c +@@ -523,6 +523,7 @@ snpp(PAGE *p) + char *errmsg; + char *a; + char *b; ++ char *m; + int i; + int badarg; + int gotpager; +@@ -701,7 +702,16 @@ snpp(PAGE *p) + + p->created = time(NULL); + (void)sprintf(buff, "%d", pagecount++); +- (void)strcat(p->messageid, buff); ++ m = (void *)malloc(sizeof(*m) * (strlen(p->messageid) + strlen(buff) + 1)); ++ if ( m == NULL ) { ++ message("554 Message failed (out of memory)"); ++ qpage_log(LOG_ERR, "snpp(): cannot allocate memory for p->messageid"); ++ clear_page(p, TRUE); ++ break; ++ } ++ (void)sprintf(m, "%s%s", p->messageid, buff); ++ my_free(p->messageid); ++ p->messageid = m; + + qpage_log(LOG_ALERT, "page submitted, id=%s, from=%s", + p->messageid, diff --git a/comms/qpage/files/patch-util.c b/comms/qpage/files/patch-util.c new file mode 100644 index 000000000000..473e86f81a3e --- /dev/null +++ b/comms/qpage/files/patch-util.c @@ -0,0 +1,11 @@ +--- util.c.orig 1998-10-25 19:55:11 UTC ++++ util.c +@@ -537,7 +537,7 @@ msgcpy(char *dst, char *src, int n) + ** Now make sure we didn't chop a word in the middle. + */ + if (*src && end) { +- *end++ = '\0'; ++ *++end = '\0'; + src = start; + } + diff --git a/comms/qpage/files/qpage.in b/comms/qpage/files/qpage.in new file mode 100644 index 000000000000..f55223805ff9 --- /dev/null +++ b/comms/qpage/files/qpage.in @@ -0,0 +1,54 @@ +#!/bin/sh + +# PROVIDE: qpage +# REQUIRE: NETWORKING +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable/configure this service: +# +# qpage_enable (bool): Set to NO by default. +# Set it to YES to enable qpage. +# qpage_queue_interval (int): Set to 10 (seconds) by default. +# qpage_cfg_file (path): Set it to an alternate configuration file path +# if desired. +# qpage_flags (str): Set it to a list of additional command-line +# parameters if desired. +# + +. /etc/rc.subr + +name="qpage" +rcvar=qpage_enable + +command=%%PREFIX%%/bin/${name} + +load_rc_config $name + +: ${qpage_enable="NO"} +: ${qpage_queue_interval="10"} + +stop_cmd=${name}_stop +extra_commands="reload" +reload_cmd=${name}_reload + +command_args="-q ${qpage_queue_interval} ${qpage_flags}" +if [ -n "${qpage_cfg_file}" ]; then + command_args="${command_args} -C ${qpage_cfg_file}" +fi + +qpage_stop() { + /usr/bin/killall qpage +} + +qpage_reload() { + # awk pattern matches master daemon process only (PPID 1 in 3rd column) + pid=`/bin/ps alcxww | /usr/bin/awk "/^ *[0-9]+ +[0-9]+ +1 .* ${name}\$/{print \\\$2}"` + + if [ -n "$pid" ]; then + kill -HUP $pid + else + echo "$0: no qpage daemon found" >& 2 + fi +} + +run_rc_command "$1" diff --git a/comms/qpage/pkg-descr b/comms/qpage/pkg-descr new file mode 100644 index 000000000000..d960681c80a0 --- /dev/null +++ b/comms/qpage/pkg-descr @@ -0,0 +1,11 @@ +QuickPage sends messages to a paging terminal using the SNPP and IXO +(also known as TAP) protocols. It is normally used with no options +other than a recipient and the message text, in which case the message +is sent to the SNPP server where it is submitted to a page queue to be +sent by a separate daemon process. + +Page groups and duty schedules are supported. Status notification +messages indicating the success or failure of a page are sent via +e-mail to submitters of high-priority (level 0) pages. + +WWW: http://www.qpage.org/ diff --git a/comms/qpage/pkg-plist b/comms/qpage/pkg-plist new file mode 100644 index 000000000000..25fc131ebf35 --- /dev/null +++ b/comms/qpage/pkg-plist @@ -0,0 +1,4 @@ +bin/qpage +@sample etc/qpage.conf.sample +man/man1/qpage.1.gz +@dir(uucp,dialer,0775) /var/spool/qpage