summaryrefslogtreecommitdiffstats
path: root/source/n/biff+comsat
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/biff+comsat')
-rw-r--r--source/n/biff+comsat/biff+comsat-0.17.diff10
-rwxr-xr-xsource/n/biff+comsat/biff+comsat.SlackBuild79
-rw-r--r--source/n/biff+comsat/biff+comsat.badutmp.diff43
-rw-r--r--source/n/biff+comsat/biff+comsat.offset.diff93
-rw-r--r--source/n/biff+comsat/slack-desc19
5 files changed, 244 insertions, 0 deletions
diff --git a/source/n/biff+comsat/biff+comsat-0.17.diff b/source/n/biff+comsat/biff+comsat-0.17.diff
new file mode 100644
index 000000000..ed615eb00
--- /dev/null
+++ b/source/n/biff+comsat/biff+comsat-0.17.diff
@@ -0,0 +1,10 @@
+--- ./comsat/comsat.c.orig Sun Feb 25 18:05:33 2001
++++ ./comsat/comsat.c Sun Feb 25 18:05:54 2001
+@@ -62,6 +62,7 @@
+ #include <paths.h> /* used for _PATH_MAILDIR, _PATH_UTMP, etc. */
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <time.h>
+
+ #include "../version.h"
+
diff --git a/source/n/biff+comsat/biff+comsat.SlackBuild b/source/n/biff+comsat/biff+comsat.SlackBuild
new file mode 100755
index 000000000..b50da5aa6
--- /dev/null
+++ b/source/n/biff+comsat/biff+comsat.SlackBuild
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+VERSION=0.17
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-1}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-biff+comsat
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+cd $TMP
+rm -rf biff+comsat-$VERSION
+tar xvf $CWD/biff+comsat-$VERSION.tar.gz || exit 1
+cd biff+comsat-$VERSION || exit 1
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+zcat $CWD/biff+comsat-0.17.diff.gz | patch -p1 --verbose || exit
+zcat $CWD/biff+comsat.offset.diff.gz | patch -p1 --verbose || exit
+zcat $CWD/biff+comsat.badutmp.diff.gz | patch -p1 --verbose || exit
+
+./configure --prefix=/usr
+make || exit 1
+
+cd biff
+strip biff
+mkdir -p $PKG/usr/bin
+cat biff > $PKG/usr/bin/biff
+chmod 755 $PKG/usr/bin/biff
+mkdir -p $PKG/usr/man/man{1,8}
+cat biff.1 | gzip -9c > $PKG/usr/man/man1/biff.1.gz
+cd ../comsat
+strip comsat
+mkdir -p $PKG/usr/sbin
+cat comsat > $PKG/usr/sbin/in.comsat
+chmod 755 $PKG/usr/sbin/in.comsat
+cat comsat.8 | gzip -9c > $PKG/usr/man/man8/in.comsat.8.gz
+
+cd ..
+mkdir -p $PKG/usr/doc/biff+comsat-$VERSION
+cp -a README $PKG/usr/doc/biff+comsat-$VERSION
+chown root:root $PKG/usr/doc/biff+comsat-$VERSION/*
+chmod 644 $PKG/usr/doc/biff+comsat-$VERSION/*
+
+# Finish up the package:
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/biff+comsat-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/n/biff+comsat/biff+comsat.badutmp.diff b/source/n/biff+comsat/biff+comsat.badutmp.diff
new file mode 100644
index 000000000..2cb79b590
--- /dev/null
+++ b/source/n/biff+comsat/biff+comsat.badutmp.diff
@@ -0,0 +1,43 @@
+--- ./comsat/comsat.c.orig 2004-06-21 13:50:09.000000000 -0700
++++ ./comsat/comsat.c 2004-06-21 13:50:52.000000000 -0700
+@@ -69,6 +69,8 @@
+ static int debug = 0;
+ #define dsyslog if (debug) syslog
+
++
++
+ #define MAXIDLE 120
+
+ static char hostname[MAXHOSTNAMELEN];
+@@ -331,6 +333,7 @@
+ char line[sizeof(utp->ut_line) + 1]; /* tty name */
+ const char *cr; /* line delimiter */
+ sigset_t sigset; /* scratch signal mask */
++ struct passwd *pwbuf; /* passwd information buffer */
+
+ #ifdef USER_PROCESS
+ if (utp->ut_type != USER_PROCESS) {
+@@ -371,6 +374,23 @@
+ dsyslog(LOG_DEBUG, "%s: wrong mode on %s", name, tty);
+ return;
+ }
++ /*
++ * Ensure the tty is owned by the uid of 'name' to prevent old
++ * unremoved utmp records referring to user 'x' leading to
++ * biffage of user 'x''s email to user 'y' where user 'y' is
++ * logged onto the same terminal that user 'x' previously
++ * used. T.Crane, 8th June 2004.
++ */
++ if ((pwbuf=getpwnam(name))==NULL) {
++ syslog(LOG_ERR, "get pwname(%s) failed", name);
++ exit(1);
++ }
++ if (pwbuf->pw_uid != stb.st_uid) {
++ dsyslog(LOG_DEBUG, "Warning: tty uid %d != uid %d for %s on %s\n",
++ stb.st_uid, pwbuf->pw_uid, name, tty);
++ return;
++ }
++
+ dsyslog(LOG_DEBUG, "notify %s on %s\n", name, tty);
+
+ /*
diff --git a/source/n/biff+comsat/biff+comsat.offset.diff b/source/n/biff+comsat/biff+comsat.offset.diff
new file mode 100644
index 000000000..11cd1eb76
--- /dev/null
+++ b/source/n/biff+comsat/biff+comsat.offset.diff
@@ -0,0 +1,93 @@
+--- ./comsat/comsat.c.orig Sun Jun 3 01:31:30 2001
++++ ./comsat/comsat.c Sun Jun 3 01:31:34 2001
+@@ -77,8 +77,8 @@
+ static int nutmp;
+
+ static void mailfor(char *name);
+-static void notify(struct utmp *utp, off_t offset);
+-static void jkfprintf(FILE *, const char *name, off_t offset, const char *cr);
++static void notify(struct utmp *utp, off_t offset, const char *mailfile);
++static void jkfprintf(FILE *, const char *name, off_t offset, const char *cr, const char *mailfile);
+ static void onalrm(int);
+
+ int main(void) {
+@@ -273,20 +273,27 @@
+ static void mailfor(char *name)
+ {
+ struct utmp *utp;
+- char *cp;
++ char *cp, *cp2;
+ off_t offset;
+
++ dsyslog(LOG_DEBUG, "mailfor: name = %s\n", name); /* T.Crane 29/06/2001 */
++
++ /* Eg. name is "tom@5990326:/var/spool/mail/tom.wien" */
+ /* Break off the file offset part and convert it to an integer. */
+ cp = strchr(name, '@');
++ /* First, get the actual filename, ie. the part after the ':' */
++ cp2 = strchr(name, ':')+1; /* If it does not exist cp2==NULL */
+ if (!cp) return;
+ *cp = 0;
+ offset = atol(cp + 1);
++ dsyslog(LOG_DEBUG, "mailfor: offset = %d\n", offset); /* T.Crane 29/06/2001 */
++ dsyslog(LOG_DEBUG, "mailfor: mailfile = %s\n", cp2); /* T.Crane 29/06/2001 */
+
+ /* Look through the utmp and call notify() for each matching login. */
+ utp = &utmp[nutmp];
+ while (--utp >= utmp) {
+ if (!strncmp(utp->ut_name, name, sizeof(utmp[0].ut_name)))
+- notify(utp, offset);
++ notify(utp, offset, cp2);
+ }
+ }
+
+@@ -314,7 +321,7 @@
+ /*
+ * This actually writes to the user's terminal.
+ */
+-static void notify(struct utmp *utp, off_t offset)
++static void notify(struct utmp *utp, off_t offset, const char *mailfile)
+ {
+ FILE *tp; /* file open on tty */
+ struct stat stb;
+@@ -427,7 +434,7 @@
+ /*
+ * Print the first few lines of the message.
+ */
+- jkfprintf(tp, name, offset, cr);
++ jkfprintf(tp, name, offset, cr, mailfile);
+
+ /*
+ * Close up and quit the child process.
+@@ -439,8 +446,11 @@
+ /*
+ * This prints a few lines from the mailbox of the user "name" at offset
+ * "offset", using "cr" as the line break string, to the file "tp".
++ * Added mailfile variable to take the name of the actual mailfile
++ * passed to us rather than the defalt mailfile of the user "name",
++ * T.Crane (T.Crane@rhul.ac.uk), 29/05/2001.
+ */
+-static void jkfprintf(FILE *tp, const char *name, off_t offset, const char *cr)
++static void jkfprintf(FILE *tp, const char *name, off_t offset, const char *cr, const char *mailfile)
+ {
+ char *cp, ch;
+ FILE *fi;
+@@ -473,7 +483,17 @@
+ /*
+ * Open the user's mailbox (recall we're already in the mail spool dir)
+ */
+- fi = fopen(name, "r");
++
++ /* If mailfile == NULL, then use name (ie. users' username instead) */
++ if (mailfile != NULL) {
++ dsyslog(LOG_DEBUG, "jkfprint: actual mailbox = %s\n",mailfile);
++ fi = fopen(mailfile, "r");
++ }
++ else {
++ dsyslog(LOG_DEBUG, "jkfprint: actual mailbox==NULL, using name %s\n",name);
++ fi = fopen(name, "r");
++ }
++
+ if (fi == NULL) return;
+
+ /* Move to requested offset */
diff --git a/source/n/biff+comsat/slack-desc b/source/n/biff+comsat/slack-desc
new file mode 100644
index 000000000..1c27bf328
--- /dev/null
+++ b/source/n/biff+comsat/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+biff+comsat: biff+comsat (mail arrival notification daemon)
+biff+comsat:
+biff+comsat: Comsat is the server process which receives reports of incoming mail
+biff+comsat: and notifies users if they have requested this service. "biff" is
+biff+comsat: the program that requests comsat service "biff y", and may be placed
+biff+comsat: in a user's startup file if they'd like to hear a beep and trash
+biff+comsat: their console with each new piece of junk mail. ;-)
+biff+comsat:
+biff+comsat: Biff was the name of Heidi Stettner's dog, who barked when the
+biff+comsat: mailman came. Biff was well known to many of the early BSD developers
+biff+comsat: living in Evans Hall at U.C. Berkeley.