aboutsummaryrefslogtreecommitdiffstats
path: root/testing/qpage
diff options
context:
space:
mode:
authorFrancesco Colista <francesco.colista@gmail.com>2011-02-24 16:48:39 +0000
committerFrancesco Colista <francesco.colista@gmail.com>2011-02-24 16:48:39 +0000
commitec5a0f7d9a61dfcaeb795c731ec97886fb728cc6 (patch)
tree599858eed14de44884046d5012f035027d8e2679 /testing/qpage
parentd8a2f456f91b9c46b872764d5a36902a89097317 (diff)
downloadaports-ec5a0f7d9a61dfcaeb795c731ec97886fb728cc6.tar.bz2
aports-ec5a0f7d9a61dfcaeb795c731ec97886fb728cc6.tar.xz
testing/qpage: new aport - Simple SNPP Client/Server
Diffstat (limited to 'testing/qpage')
-rw-r--r--testing/qpage/APKBUILD47
-rw-r--r--testing/qpage/config.input83
-rw-r--r--testing/qpage/qpage.initd25
-rw-r--r--testing/qpage/qpage.patch231
-rw-r--r--testing/qpage/qpage.post-install6
-rw-r--r--testing/qpage/qpage.pre-install3
6 files changed, 395 insertions, 0 deletions
diff --git a/testing/qpage/APKBUILD b/testing/qpage/APKBUILD
new file mode 100644
index 0000000000..30eff28be0
--- /dev/null
+++ b/testing/qpage/APKBUILD
@@ -0,0 +1,47 @@
+# Contributor: Francesco Colista <francesco.colista@gmail.com>
+# Maintainer: Francesco Colista <francesco.colista@gmail.com>
+pkgname=qpage
+pkgver=3.3
+pkgrel=0
+pkgdesc="Sends messages to an alphanumeric pager via TAP protocol."
+url="http://www.qpage.org/"
+arch="all"
+license="Custom"
+depends=""
+depends_dev=
+makedepends="$depends_dev"
+install="$pkgname.pre-install $pkgname.post-install"
+source="saveas-http://archive.debian.org/debian/pool/non-free/q/$pkgname/"$pkgname"_3.3final.orig.tar.gz/$pkgname-$pkgver.tar.gz
+ config.input
+ qpage.initd
+ qpage.patch
+ "
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+build() {
+ cd "$_builddir"
+ cp -f "$srcdir"/config.input "$_builddir" || return 1
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var
+ make || return 1
+}
+package() {
+ mkdir -p "$pkgdir"/usr/bin
+ mkdir -p "$pkgdir"/etc/qpage
+ install -m755 "$_builddir"/$pkgname "$pkgdir"/usr/bin/"$pkgname"
+ install -Dm644 "$_builddir"/example.cf "$pkgdir"/etc/qpage/qpage.conf.example
+}
+
+
+md5sums="eb98faaa51f89db68ecf7668f5294309 qpage-3.3.tar.gz
+3ac8c6e2aede9e195eba2555eb3b4645 config.input
+f439315da04ebdd1e1cc2840171d45d3 qpage.initd
+e8a4a6926973c940fe34dc6c4e892606 qpage.patch"
diff --git a/testing/qpage/config.input b/testing/qpage/config.input
new file mode 100644
index 0000000000..e133cb36a7
--- /dev/null
+++ b/testing/qpage/config.input
@@ -0,0 +1,83 @@
+#########################################################
+# #
+# Almost all of the QuickPage configuration options #
+# can be controlled at run-time by keywords in the #
+# configuration file. However, there is a small #
+# set of options that must be defined at compile #
+# time. #
+# #
+# Here are the compile-time configuration options. #
+# Edit these as appropriate for your environment. #
+# #
+# Note: This file is sourced by the configure script. #
+# Do not make any changes incompatible with /bin/sh. #
+# #
+#########################################################
+
+
+#
+# QPAGE_CONFIG defines the location of the configuration file.
+# See the QuickPage documentation for complete details about
+# the syntax of the configuration file.
+#
+QPAGE_CONFIG="/etc/qpage/qpage.cf"
+
+
+#
+# SNPP_SERVER defines the default name of the SNPP server.
+# The default is localhost. This is probably not appropriate
+# for most network configurations; change this to the machine
+# where you intend to run the QuickPage daemon. Multiple
+# hostnames can be specified by separating them with commas.
+#
+SNPP_SERVER="localhost"
+
+
+#
+# SNPP_SERVER_FILE defines a filename containing one or
+# more hostnames of SNPP servers. QuickPage clients
+# read this file (if it exists) to locate a server. All
+# servers listed in this file are assumed to have identical
+# copies of the configuration file. Only one filename
+# may be specified.
+#
+SNPP_SERVER_FILE="/etc/qpage/qpage.servers"
+
+
+#
+# DAEMON_USER specifies which user the QuickPage daemon
+# should run as after dropping root privileges. If a
+# userid or UID is specified and a password entry exists
+# for that user, QuickPage will assume all group privileges
+# assigned to that user.
+#
+DAEMON_USER="qpage"
+
+
+#
+# SYSLOG_FACILITY defines which syslog facility should be
+# used by QuickPage to log messages. See the syslog
+# documentation (i.e. "man syslog") for more information.
+#
+SYSLOG_FACILITY=LOG_DAEMON
+
+
+#
+# SENDMAIL_PATH defines where sendmail (or equivalent) is
+# located on your system. QuickPage uses sendmail to send
+# status messages about failed and/or high-priority pages.
+# Whatever you specify here will be invoked with exactly
+# three arguments:
+#
+# arg1: "-f"
+# arg2: "<>"
+# arg3: user@host
+#
+# The first two arguments tell sendmail to use a null return
+# path (see RFC1123 section 5.2.9) so that bogus e-mail
+# addresses will not annoy the postmaster.
+#
+# If you leave this variable commented out, "configure" will
+# attempt to locate the correct path for your system automatically.
+#
+#SENDMAIL_PATH=/usr/lib/sendmail
diff --git a/testing/qpage/qpage.initd b/testing/qpage/qpage.initd
new file mode 100644
index 0000000000..6d5528766a
--- /dev/null
+++ b/testing/qpage/qpage.initd
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+#
+# Startup for QuickPage
+#
+
+OPTS_ARGS="q10"
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+start() {
+ ebegin "Starting QuickPage daemon"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec qpage -- ${OPTS_ARGS} >/dev/null
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping QuickPage daemon"
+
+ pid=`ps -e | grep qpage | awk '{print $1}'`
+ if [ ! -z "$pid" ]; then
+ kill $pid > /dev/null 2>&1
+ fi
+ eend $?
+}
+exit 0
diff --git a/testing/qpage/qpage.patch b/testing/qpage/qpage.patch
new file mode 100644
index 0000000000..d998942d50
--- /dev/null
+++ b/testing/qpage/qpage.patch
@@ -0,0 +1,231 @@
+diff -crB a/CHANGES b/CHANGES
+*** a/CHANGES 1999-01-02 16:15:03.000000000 +1300
+--- b/CHANGES 2011-01-27 09:56:40.202300708 +1300
+***************
+*** 1,4 ****
+--- 1,15 ----
++ Changes to QuickPage from v3.3 to v3.3.1-unleash
++ ------------------------------------------------
++ Patch by Michael Fincham <michael@unleash.co.nz>
+
++ - The new "-b" option has been added to specify a bind address
++ for the qpage daemon.
++
++ - The default user the daemon runs as is now "qpage" instead
++ of "nobody".
++
++ - To be honest, the "-b" option doesn't sanitise input very well
++ so don't setuid root the qpage binary or anything dumb like that.
+
+ Changes to QuickPage from v3.2 to v3.3
+ ---------------------------------------
+diff -crB a/qpage.c b/qpage.c
+*** a/qpage.c 1999-05-09 09:47:23.000000000 +1200
+--- b/qpage.c 2011-01-21 14:50:55.995162759 +1300
+***************
+*** 17,22 ****
+--- 17,23 ----
+ static char sccsid[] = "@(#)qpage.c 3.36 07/26/98 tomiii@qpage.org";
+ #endif
+ char *ConfigFile = NULL;
++ char *BindAddress = NULL;
+ int Debug = 0;
+ int Interactive = FALSE;
+ int Silent = FALSE;
+***************
+*** 29,35 ****
+ do_version(void)
+ {
+ printf("\n");
+! printf("QuickPage v%s, Copyright 1995-98 by Thomas Dwyer III\n",
+ VERSION);
+ printf("\n");
+ }
+--- 30,36 ----
+ do_version(void)
+ {
+ printf("\n");
+! printf("QuickPage v%s, Copyright 1995-98 by Thomas Dwyer III. Modified for Unleash by Michael Fincham <michael@unleash.co.nz>.\n",
+ VERSION);
+ printf("\n");
+ }
+***************
+*** 46,51 ****
+--- 47,55 ----
+ printf("\n");
+ printf("Options:\n");
+ printf(" -a [+]hhmm send the page at the specified time\n");
++ #ifndef CLIENT_ONLY
++ printf(" -b address bind only to this address (default: 0.0.0.0)\n");
++ #endif
+ printf(" -c coverage coverage area (service name) for pager\n");
+ printf(" -C config use an alternate configuration file\n");
+ printf(" -d debug mode\n");
+***************
+*** 339,345 ****
+
+ (void)memset((char *)&p, 0, sizeof(p));
+
+! while ((c = getopt(argc, argv, "a:c:C:df:hil:mp:P:q:Qs:t:v")) != -1) {
+ switch (c) {
+ case 'a':
+ case 't':
+--- 343,349 ----
+
+ (void)memset((char *)&p, 0, sizeof(p));
+
+! while ((c = getopt(argc, argv, "a:b:c:C:df:hil:mp:P:q:Qs:t:v")) != -1) {
+ switch (c) {
+ case 'a':
+ case 't':
+***************
+*** 353,358 ****
+--- 357,367 ----
+ needpager = TRUE;
+ break;
+
++ #ifndef CLIENT_ONLY
++ case 'b':
++ BindAddress = strdup(optarg);
++ break;
++ #endif
+ case 'c':
+ my_free(coverage);
+ coverage = strdup(optarg);
+***************
+*** 503,509 ****
+ if (optind < argc)
+ port = atoi(argv[optind]);
+
+! (void)become_daemon(sleeptime, port);
+
+ /* NOT REACHED */
+ return(-1);
+--- 512,518 ----
+ if (optind < argc)
+ port = atoi(argv[optind]);
+
+! (void)become_daemon(sleeptime, port, BindAddress);
+
+ /* NOT REACHED */
+ return(-1);
+diff -crB a/qpage.h b/qpage.h
+*** a/qpage.h 1998-10-26 08:55:02.000000000 +1300
+--- b/qpage.h 2011-01-21 14:51:22.682302352 +1300
+***************
+*** 26,32 ****
+ #define fprintf (void)fprintf
+ #endif
+
+! #define VERSION "3.3"
+ #define COMMENTS_ANYWHERE
+
+ #ifndef QPAGE_CONFIG
+--- 26,32 ----
+ #define fprintf (void)fprintf
+ #endif
+
+! #define VERSION "3.3.1-unleash"
+ #define COMMENTS_ANYWHERE
+
+ #ifndef QPAGE_CONFIG
+***************
+*** 51,57 ****
+ #endif
+
+ #ifndef DAEMON_USER
+! #define DAEMON_USER "nobody"
+ #endif
+
+ #define SNPP_SVC_NAME "snpp"
+--- 51,57 ----
+ #endif
+
+ #ifndef DAEMON_USER
+! #define DAEMON_USER "qpage"
+ #endif
+
+ #define SNPP_SVC_NAME "snpp"
+***************
+*** 278,284 ****
+ extern void qpage_log(int pri, char *fmt, ...);
+ extern time_t snpptime(char *arg);
+ extern time_t parse_time(char *str);
+! extern int become_daemon(int sleeptime, short port);
+ extern int submit_page(PAGE *p, char *server);
+ extern int lock_file(int fd, int mode, int block);
+ extern int lock_queue(void);
+--- 278,284 ----
+ extern void qpage_log(int pri, char *fmt, ...);
+ extern time_t snpptime(char *arg);
+ extern time_t parse_time(char *str);
+! extern int become_daemon(int sleeptime, short port, char *BindAddress);
+ extern int submit_page(PAGE *p, char *server);
+ extern int lock_file(int fd, int mode, int block);
+ extern int lock_queue(void);
+diff -crB a/qpage.man b/qpage.man
+*** a/qpage.man 1999-05-09 10:07:31.000000000 +1200
+--- b/qpage.man 2011-01-27 09:51:44.894302942 +1300
+***************
+*** 34,39 ****
+--- 34,42 ----
+ ] [
+ .BI \-C " config
+ ]
++ ] [
++ .BI \-b " address
++ ]
+ .BI \-q " interval
+ .SH DESCRIPTION
+ .B QuickPage
+***************
+*** 91,96 ****
+--- 94,104 ----
+ century. Otherwise assume the specified time is in the current
+ century.
+ .TP
++ .BI \-b
++ Specify an address for the qpage daemon to bind to. The default is
++ to bind to INETADDR_ANY and listen on all interfaces (the old
++ behaviour)
++ .TP
+ .BI \-c
+ Use a different coverage area or paging service. This option is
+ only useful if the recipient has more than one pager and/or more
+diff -crB a/srvrsnpp.c b/srvrsnpp.c
+*** a/srvrsnpp.c 1998-10-26 08:55:05.000000000 +1300
+--- b/srvrsnpp.c 2011-01-21 14:49:17.647300794 +1300
+***************
+*** 1156,1162 ****
+ ** -1 on error, otherwise never
+ */
+ int
+! become_daemon(int sleeptime, short port)
+ {
+ struct sockaddr_in addr;
+ struct servent *svc;
+--- 1156,1162 ----
+ ** -1 on error, otherwise never
+ */
+ int
+! become_daemon(int sleeptime, short port, char *BindAddress)
+ {
+ struct sockaddr_in addr;
+ struct servent *svc;
+***************
+*** 1221,1227 ****
+ len = sizeof(on);
+ (void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, len);
+
+! addr.sin_addr.s_addr = INADDR_ANY;
+ addr.sin_family = AF_INET;
+ addr.sin_port = port;
+
+--- 1221,1227 ----
+ len = sizeof(on);
+ (void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, len);
+
+! addr.sin_addr.s_addr = BindAddress != NULL ? inet_addr(BindAddress) : INADDR_ANY;
+ addr.sin_family = AF_INET;
+ addr.sin_port = port;
+
diff --git a/testing/qpage/qpage.post-install b/testing/qpage/qpage.post-install
new file mode 100644
index 0000000000..53de3edbf5
--- /dev/null
+++ b/testing/qpage/qpage.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+mkdir -p /var/spool/qpage 2>/dev/null
+chown -R qpage:qpage /var/spool/qpage 2>/dev/null
+exit 0
+
diff --git a/testing/qpage/qpage.pre-install b/testing/qpage/qpage.pre-install
new file mode 100644
index 0000000000..c463899a16
--- /dev/null
+++ b/testing/qpage/qpage.pre-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+adduser -h /var/lib/qpage -s /bin/false -G qpage -D qpage 2>/dev/null || true