summaryrefslogtreecommitdiff
path: root/net/uucp
diff options
context:
space:
mode:
authorchristos <christos@pkgsrc.org>2007-03-15 20:02:18 +0000
committerchristos <christos@pkgsrc.org>2007-03-15 20:02:18 +0000
commit4bd58b64a2f7c02ae4051f682f8ef7c251584f95 (patch)
treedc962c54c1b33c0db9f3ccf8cfebf663a6d753ee /net/uucp
parent249016455cb43d2f025790e242dceea4d1f93687 (diff)
downloadpkgsrc-4bd58b64a2f7c02ae4051f682f8ef7c251584f95.tar.gz
Add rmail and uucpd back. List code snippets that need to be added to etc files.
Diffstat (limited to 'net/uucp')
-rw-r--r--net/uucp/Makefile7
-rw-r--r--net/uucp/PLIST6
-rw-r--r--net/uucp/distinfo4
-rw-r--r--net/uucp/files/etc/daily15
-rw-r--r--net/uucp/files/etc/ftpusers1
-rw-r--r--net/uucp/files/etc/master.passwd1
-rw-r--r--net/uucp/files/etc/newsyslog.conf1
-rw-r--r--net/uucp/files/etc/rc.d/mountcritlocal1
-rw-r--r--net/uucp/files/etc/syslog.conf1
-rw-r--r--net/uucp/files/etc/weekly5
-rw-r--r--net/uucp/files/rmail/Makefile7
-rw-r--r--net/uucp/files/rmail/rmail.873
-rw-r--r--net/uucp/files/rmail/rmail.c379
-rw-r--r--net/uucp/files/uucpd/Makefile10
-rw-r--r--net/uucp/files/uucpd/pathnames.h36
-rw-r--r--net/uucp/files/uucpd/uucpd.872
-rw-r--r--net/uucp/files/uucpd/uucpd.c317
-rw-r--r--net/uucp/patches/patch-ar13
-rw-r--r--net/uucp/patches/patch-as13
19 files changed, 958 insertions, 4 deletions
diff --git a/net/uucp/Makefile b/net/uucp/Makefile
index e01e2ac5899..33672448c19 100644
--- a/net/uucp/Makefile
+++ b/net/uucp/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2006/10/30 04:12:18 jlam Exp $
+# $NetBSD: Makefile,v 1.4 2007/03/15 20:02:18 christos Exp $
DISTNAME= uucp-1.07
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GNU:=uucp/}
@@ -60,5 +60,8 @@ post-configure:
@${ECHO} "#define ${_var_} \""${UUCP_${_var_}:Q}"\"" \
>> ${WRKSRC}/policy_local.h
.endfor
+ ${MKDIR} ${WRKSRC}/rmail ${WRKSRC}/uucpd
+ ${CP} ${FILESDIR}/rmail/[a-zM]* ${WRKSRC}/rmail
+ ${CP} ${FILESDIR}/uucpd/[a-zM]* ${WRKSRC}/uucpd
.include "../../mk/bsd.pkg.mk"
diff --git a/net/uucp/PLIST b/net/uucp/PLIST
index ffb71bcb202..442f37edc5b 100644
--- a/net/uucp/PLIST
+++ b/net/uucp/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2006/04/24 23:21:46 jlam Exp $
+@comment $NetBSD: PLIST,v 1.2 2007/03/15 20:02:18 christos Exp $
bin/cu
bin/uucp
bin/uulog
@@ -7,6 +7,7 @@ bin/uupick
bin/uustat
bin/uuto
bin/uux
+bin/rmail
info/uucp.info
man/man1/cu.1
man/man1/uucp.1
@@ -14,8 +15,11 @@ man/man1/uustat.1
man/man1/uux.1
man/man8/uucico.8
man/man8/uuxqt.8
+man/man8/rmail.8
+man/man8/uucpd.8
sbin/uuchk
sbin/uucico
sbin/uuconv
sbin/uusched
sbin/uuxqt
+libexec/uucpd
diff --git a/net/uucp/distinfo b/net/uucp/distinfo
index c6d900edaa2..1b720c7263c 100644
--- a/net/uucp/distinfo
+++ b/net/uucp/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2006/10/30 03:33:59 jlam Exp $
+$NetBSD: distinfo,v 1.3 2007/03/15 20:02:19 christos Exp $
SHA1 (uucp-1.07.tar.gz) = e7c93c3aa6468f1b26dd4d9104dbbe8c2949e9ee
RMD160 (uucp-1.07.tar.gz) = e265ecd08245dd2510db20430a7a0e387ef4df51
@@ -20,3 +20,5 @@ SHA1 (patch-an) = ca1b3db734c701b7308f64e9321b08e37f75045b
SHA1 (patch-ao) = ee7145bfdd837fab74d33c20996886b803f4310a
SHA1 (patch-ap) = e2a7e4d28a7d0e911ed8432f8f3524a1eecd7398
SHA1 (patch-aq) = bb6bcaa133ddda48ad24a94ed690afb5934b96d0
+SHA1 (patch-ar) = d71d7e016d840d06c52bd88c507450111cf02e2c
+SHA1 (patch-as) = 76773cbfccec131b3eb0adfad43c6d4e9d54a99b
diff --git a/net/uucp/files/etc/daily b/net/uucp/files/etc/daily
new file mode 100644
index 00000000000..f4c85312f24
--- /dev/null
+++ b/net/uucp/files/etc/daily
@@ -0,0 +1,15 @@
+if checkyesno check_uucp && \
+ [ -d /var/spool/uucp -a -f /usr/pkg/libexec/uucp/clean.daily ]; then
+ echo ""
+ echo "Cleaning up UUCP:"
+ su daemon -c /usr/libexec/uucp/clean.daily
+fi
+
+if checkyesno check_uucp && [ -d /var/spool/uucp ]; then
+ (cd /tmp; su -m uucp -c "uustat -a") > $TMP
+ if [ -s $TMP ]; then
+ echo ""
+ echo "uucp:"
+ cat $TMP
+ fi
+fi
diff --git a/net/uucp/files/etc/ftpusers b/net/uucp/files/etc/ftpusers
new file mode 100644
index 00000000000..8b0210ae6e9
--- /dev/null
+++ b/net/uucp/files/etc/ftpusers
@@ -0,0 +1 @@
+uucp deny
diff --git a/net/uucp/files/etc/master.passwd b/net/uucp/files/etc/master.passwd
new file mode 100644
index 00000000000..9cbd4cccfeb
--- /dev/null
+++ b/net/uucp/files/etc/master.passwd
@@ -0,0 +1 @@
+uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/var/spool/uucppublic:/usr/pkg/libexec/uucp/uucico
diff --git a/net/uucp/files/etc/newsyslog.conf b/net/uucp/files/etc/newsyslog.conf
new file mode 100644
index 00000000000..67fae47896d
--- /dev/null
+++ b/net/uucp/files/etc/newsyslog.conf
@@ -0,0 +1 @@
+/var/log/aculog uucp:dialer 640 7 * 24 Z
diff --git a/net/uucp/files/etc/rc.d/mountcritlocal b/net/uucp/files/etc/rc.d/mountcritlocal
new file mode 100644
index 00000000000..c0311605a67
--- /dev/null
+++ b/net/uucp/files/etc/rc.d/mountcritlocal
@@ -0,0 +1 @@
+rm -f /var/spool/lock/LCK.* /var/spool/uucp/STST/*
diff --git a/net/uucp/files/etc/syslog.conf b/net/uucp/files/etc/syslog.conf
new file mode 100644
index 00000000000..fd7276cc24b
--- /dev/null
+++ b/net/uucp/files/etc/syslog.conf
@@ -0,0 +1 @@
+uucp.info /var/spool/uucp/ERRORS
diff --git a/net/uucp/files/etc/weekly b/net/uucp/files/etc/weekly
new file mode 100644
index 00000000000..fb9a8537bd3
--- /dev/null
+++ b/net/uucp/files/etc/weekly
@@ -0,0 +1,5 @@
+if checkyesno clean_uucp && [ -f /usr/pkg/libexec/uucp/clean.weekly ]; then
+ echo ""
+ echo "Cleaning up UUCP:"
+ su daemon -c /usr/pkg/libexec/uucp/clean.weekly
+fi
diff --git a/net/uucp/files/rmail/Makefile b/net/uucp/files/rmail/Makefile
new file mode 100644
index 00000000000..346d4d4438b
--- /dev/null
+++ b/net/uucp/files/rmail/Makefile
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile,v 1.1 2007/03/15 20:02:20 christos Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+
+PROG= rmail
+MAN= rmail.8
+
+.include <bsd.prog.mk>
diff --git a/net/uucp/files/rmail/rmail.8 b/net/uucp/files/rmail/rmail.8
new file mode 100644
index 00000000000..f1cf6c96e9f
--- /dev/null
+++ b/net/uucp/files/rmail/rmail.8
@@ -0,0 +1,73 @@
+.\" $NetBSD: rmail.8,v 1.1 2007/03/15 20:02:20 christos Exp $
+.\"
+.\" Copyright (c) 1983, 1990 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND 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 REGENTS OR 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.
+.\"
+.\" @(#)rmail.8 6.10 (Berkeley) 4/29/93
+.\"
+.Dd April 29, 1993
+.Dt RMAIL 8
+.Os BSD 4.2
+.Sh NAME
+.Nm rmail
+.Nd handle remote mail received via uucp
+.Sh SYNOPSIS
+.Nm rmail
+.Ar user ...
+.Sh DESCRIPTION
+.Nm Rmail
+interprets incoming mail received via
+.Xr uucp 1 ,
+collapsing ``From'' lines in the form generated
+by
+.Xr mail.local 8
+into a single line of the form ``return-path!sender'',
+and passing the processed mail on to
+.Xr sendmail 8 .
+.Pp
+.Nm Rmail
+is explicitly designed for use with
+.Xr uucp
+and
+.Xr sendmail .
+.Sh SEE ALSO
+.Xr uucp 1 ,
+.Xr mail.local 8 ,
+.Xr sendmail 8
+.Sh HISTORY
+The
+.Nm rmail
+program appeared in
+.Bx 4.2 .
+.Sh BUGS
+.Nm Rmail
+should not reside in
+.Pa /bin .
diff --git a/net/uucp/files/rmail/rmail.c b/net/uucp/files/rmail/rmail.c
new file mode 100644
index 00000000000..d77015831bc
--- /dev/null
+++ b/net/uucp/files/rmail/rmail.c
@@ -0,0 +1,379 @@
+/* $NetBSD: rmail.c,v 1.1 2007/03/15 20:02:20 christos Exp $ */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND 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 REGENTS OR 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.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)rmail.c 8.3 (Berkeley) 5/15/95";
+#else
+static char rcsid[] = "$NetBSD: rmail.c,v 1.1 2007/03/15 20:02:20 christos Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * RMAIL -- UUCP mail server.
+ *
+ * This program reads the >From ... remote from ... lines that UUCP is so
+ * fond of and turns them into something reasonable. It then execs sendmail
+ * with various options built from these lines.
+ *
+ * The expected syntax is:
+ *
+ * <user> := [-a-z0-9]+
+ * <date> := ctime format
+ * <site> := [-a-z0-9!]+
+ * <blank line> := "^\n$"
+ * <from> := "From" <space> <user> <space> <date>
+ * [<space> "remote from" <space> <site>]
+ * <forward> := ">" <from>
+ * msg := <from> <forward>* <blank-line> <body>
+ *
+ * The output of rmail(8) compresses the <forward> lines into a single
+ * from path.
+ *
+ * The err(3) routine is included here deliberately to make this code
+ * a bit more portable.
+ */
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#ifndef MAX
+# define MAX(a, b) ((a) < (b) ? (b) : (a))
+#endif
+
+void err __P((int, const char *, ...));
+void usage __P((void));
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ extern char *optarg;
+ extern int errno, optind;
+ FILE *fp;
+ struct stat sb;
+ size_t fplen, fptlen, len;
+ off_t offset;
+ int ch, debug, i, pdes[2], pid, status;
+ char *addrp, *domain, *p, *t;
+ char *from_path, *from_sys, *from_user;
+ char *args[100], buf[2048], lbuf[2048];
+
+ debug = 0;
+ domain = "UUCP"; /* Default "domain". */
+ while ((ch = getopt(argc, argv, "D:T")) != EOF)
+ switch (ch) {
+ case 'T':
+ debug = 1;
+ break;
+ case 'D':
+ domain = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ from_path = from_sys = from_user = NULL;
+ for (offset = 0;;) {
+
+ /* Get and nul-terminate the line. */
+ if (fgets(lbuf, sizeof(lbuf), stdin) == NULL)
+ exit (EX_DATAERR);
+ if ((p = strchr(lbuf, '\n')) == NULL)
+ err(EX_DATAERR, "line too long");
+ *p = '\0';
+
+ /* Parse lines until reach a non-"From" line. */
+ if (!strncmp(lbuf, "From ", 5))
+ addrp = lbuf + 5;
+ else if (!strncmp(lbuf, ">From ", 6))
+ addrp = lbuf + 6;
+ else if (offset == 0)
+ err(EX_DATAERR,
+ "missing or empty From line: %s", lbuf);
+ else {
+ *p = '\n';
+ break;
+ }
+
+ if (*addrp == '\0')
+ err(EX_DATAERR, "corrupted From line: %s", lbuf);
+
+ /* Use the "remote from" if it exists. */
+ for (p = addrp; (p = strchr(p + 1, 'r')) != NULL;)
+ if (!strncmp(p, "remote from ", 12)) {
+ for (t = p += 12; *t && !isspace(*t); ++t);
+ *t = '\0';
+ if (debug)
+ (void)fprintf(stderr,
+ "remote from: %s\n", p);
+ break;
+ }
+
+ /* Else use the string up to the last bang. */
+ if (p == NULL)
+ if (*addrp == '!')
+ err(EX_DATAERR,
+ "bang starts address: %s", addrp);
+ else if ((t = strrchr(addrp, '!')) != NULL) {
+ *t = '\0';
+ p = addrp;
+ addrp = t + 1;
+ if (*addrp == '\0')
+ err(EX_DATAERR,
+ "corrupted From line: %s", lbuf);
+ if (debug)
+ (void)fprintf(stderr, "bang: %s\n", p);
+ }
+
+ /* 'p' now points to any system string from this line. */
+ if (p != NULL) {
+ /* Nul terminate it as necessary. */
+ for (t = p; *t && !isspace(*t); ++t);
+ *t = '\0';
+
+ /* If the first system, copy to the from_sys string. */
+ if (from_sys == NULL) {
+ if ((from_sys = strdup(p)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+ if (debug)
+ (void)fprintf(stderr,
+ "from_sys: %s\n", from_sys);
+ }
+
+ /* Concatenate to the path string. */
+ len = t - p;
+ if (from_path == NULL) {
+ fplen = 0;
+ if ((from_path = malloc(fptlen = 256)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+ }
+ if (fplen + len + 2 > fptlen) {
+ fptlen += MAX(fplen + len + 2, 256);
+ if ((from_path =
+ realloc(from_path, fptlen)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+ }
+ memmove(from_path + fplen, p, len);
+ fplen += len;
+ from_path[fplen++] = '!';
+ from_path[fplen] = '\0';
+ }
+
+ /* Save off from user's address; the last one wins. */
+ for (p = addrp; *p && !isspace(*p); ++p);
+ *p = '\0';
+ if (*addrp == '\0')
+ addrp = "<>";
+ if (from_user != NULL)
+ free(from_user);
+ if ((from_user = strdup(addrp)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+
+ if (debug) {
+ if (from_path != NULL)
+ (void)fprintf(stderr,
+ "from_path: %s\n", from_path);
+ (void)fprintf(stderr, "from_user: %s\n", from_user);
+ }
+
+ if (offset != -1)
+ offset = (off_t)ftell(stdin);
+ }
+
+ i = 0;
+ args[i++] = _PATH_SENDMAIL; /* Build sendmail's argument list. */
+ args[i++] = "-oee"; /* No errors, just status. */
+ args[i++] = "-odq"; /* Queue it, don't try to deliver. */
+ args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
+
+ /* set from system and protocol used */
+ if (from_sys == NULL)
+ (void)snprintf(buf, sizeof(buf), "-p%s", domain);
+ else if (strchr(from_sys, '.') == NULL)
+ (void)snprintf(buf, sizeof(buf), "-p%s:%s.%s",
+ domain, from_sys, domain);
+ else
+ (void)snprintf(buf, sizeof(buf), "-p%s:%s", domain, from_sys);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+
+ /* Set name of ``from'' person. */
+ (void)snprintf(buf, sizeof(buf), "-f%s%s",
+ from_path ? from_path : "", from_user);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+
+ /*
+ * Don't copy arguments beginning with - as they will be
+ * passed to sendmail and could be interpreted as flags.
+ * To prevent confusion of sendmail wrap < and > around
+ * the address (helps to pass addrs like @gw1,@gw2:aa@bb)
+ */
+ while (*argv) {
+ if (**argv == '-')
+ err(EX_USAGE, "dash precedes argument: %s", *argv);
+ if (strchr(*argv, ',') == NULL || strchr(*argv, '<') != NULL)
+ args[i++] = *argv;
+ else {
+ if ((args[i] = malloc(strlen(*argv) + 3)) == NULL)
+ err(EX_TEMPFAIL, "Cannot malloc");
+ sprintf (args [i++], "<%s>", *argv);
+ }
+ argv++;
+ }
+ args[i] = 0;
+
+ if (debug) {
+ (void)fprintf(stderr, "Sendmail arguments:\n");
+ for (i = 0; args[i]; i++)
+ (void)fprintf(stderr, "\t%s\n", args[i]);
+ }
+
+ /*
+ * If called with a regular file as standard input, seek to the right
+ * position in the file and just exec sendmail. Could probably skip
+ * skip the stat, but it's not unreasonable to believe that a failed
+ * seek will cause future reads to fail.
+ */
+ if (!fstat(STDIN_FILENO, &sb) && S_ISREG(sb.st_mode)) {
+ if (lseek(STDIN_FILENO, offset, SEEK_SET) != offset)
+ err(EX_TEMPFAIL, "stdin seek");
+ execv(_PATH_SENDMAIL, args);
+ err(EX_OSERR, "%s", _PATH_SENDMAIL);
+ }
+
+ if (pipe(pdes) < 0)
+ err(EX_OSERR, NULL);
+
+ switch (pid = vfork()) {
+ case -1: /* Err. */
+ err(EX_OSERR, NULL);
+ case 0: /* Child. */
+ if (pdes[0] != STDIN_FILENO) {
+ (void)dup2(pdes[0], STDIN_FILENO);
+ (void)close(pdes[0]);
+ }
+ (void)close(pdes[1]);
+ execv(_PATH_SENDMAIL, args);
+ _exit(127);
+ /* NOTREACHED */
+ }
+
+ if ((fp = fdopen(pdes[1], "w")) == NULL)
+ err(EX_OSERR, NULL);
+ (void)close(pdes[0]);
+
+ /* Copy the file down the pipe. */
+ do {
+ (void)fprintf(fp, "%s", lbuf);
+ } while (fgets(lbuf, sizeof(lbuf), stdin) != NULL);
+
+ if (ferror(stdin))
+ err(EX_TEMPFAIL, "stdin: %s", strerror(errno));
+
+ if (fclose(fp))
+ err(EX_OSERR, NULL);
+
+ if ((waitpid(pid, &status, 0)) == -1)
+ err(EX_OSERR, "%s", _PATH_SENDMAIL);
+
+ if (!WIFEXITED(status))
+ err(EX_OSERR,
+ "%s: did not terminate normally", _PATH_SENDMAIL);
+
+ if (WEXITSTATUS(status))
+ err(status, "%s: terminated with %d (non-zero) status",
+ _PATH_SENDMAIL, WEXITSTATUS(status));
+ exit(EX_OK);
+}
+
+void
+usage()
+{
+ (void)fprintf(stderr, "usage: rmail [-T] [-D domain] user ...\n");
+ exit(EX_USAGE);
+}
+
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+void
+#ifdef __STDC__
+err(int eval, const char *fmt, ...)
+#else
+err(eval, fmt, va_alist)
+ int eval;
+ const char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+#if __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+ (void)fprintf(stderr, "rmail: ");
+ (void)vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ (void)fprintf(stderr, "\n");
+ exit(eval);
+}
diff --git a/net/uucp/files/uucpd/Makefile b/net/uucp/files/uucpd/Makefile
new file mode 100644
index 00000000000..318c3b7fdd1
--- /dev/null
+++ b/net/uucp/files/uucpd/Makefile
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2007/03/15 20:02:20 christos Exp $
+# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
+
+PROG= uucpd
+MAN= uucpd.8
+LDADD+= -lcrypt -lutil
+DPADD+= ${LIBCRYPT} ${LIBUTIL}
+CPPFLAGS+=-DSUPPORT_UTMP -DSUPPORT_UTMPX
+
+.include <bsd.prog.mk>
diff --git a/net/uucp/files/uucpd/pathnames.h b/net/uucp/files/uucpd/pathnames.h
new file mode 100644
index 00000000000..41ec17b86d6
--- /dev/null
+++ b/net/uucp/files/uucpd/pathnames.h
@@ -0,0 +1,36 @@
+/* $NetBSD: pathnames.h,v 1.1 2007/03/15 20:02:20 christos Exp $ */
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND 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 REGENTS OR 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.
+ *
+ * from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90
+ */
+
+#include <paths.h>
+
+#define _PATH_UUCICO "/usr/libexec/uucp/uucico"
diff --git a/net/uucp/files/uucpd/uucpd.8 b/net/uucp/files/uucpd/uucpd.8
new file mode 100644
index 00000000000..301d77a9809
--- /dev/null
+++ b/net/uucp/files/uucpd/uucpd.8
@@ -0,0 +1,72 @@
+.\" $NetBSD: uucpd.8,v 1.1 2007/03/15 20:02:20 christos Exp $
+.\"
+.\" Copyright (c) 1998 Matthew R. Green
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" 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.
+.\"
+.Dd July 4, 1998
+.Dt UUCPD 8
+.Os
+.Sh NAME
+.Nm uucpd
+.Nd unix to unix copy protocol daemon
+.Sh SYNOPSIS
+.Nm
+.Op Fl l
+.Sh DESCRIPTION
+The
+.Nm
+daemon reads a username and password, and then executes
+.Xr uucico 8 ,
+the
+.Tn UUCP
+file transfer daemon, if the following conditions are met:
+.Bl -enum
+.It
+the username and password match a valid account
+.It
+the accounts shell is
+.Dq /usr/libexec/uucp/uucico .
+.El
+.Pp
+.Nm
+is started by
+.Xr inetd 8 .
+.Sh OPTIONS
+.Bl -tag -width 12345
+.It Fl l
+The
+.Fl l
+option logs all connections via
+.Xr syslog 3 .
+.El
+.Sh SEE ALSO
+.Xr inetd 8 ,
+.Xr uucico 8
+.Sh HISTORY
+The
+.Nm
+program was first made available in
+.Bx 4.2 .
diff --git a/net/uucp/files/uucpd/uucpd.c b/net/uucp/files/uucpd/uucpd.c
new file mode 100644
index 00000000000..083e40b9dca
--- /dev/null
+++ b/net/uucp/files/uucpd/uucpd.c
@@ -0,0 +1,317 @@
+/* $NetBSD: uucpd.c,v 1.1 2007/03/15 20:02:20 christos Exp $ */
+
+/*
+ * Copyright (c) 1985 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Adams.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND 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 REGENTS OR 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.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__COPYRIGHT("@(#) Copyright (c) 1985 The Regents of the University of California.\n\
+ All rights reserved.\n");
+#if 0
+static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";
+#else
+__RCSID("$NetBSD: uucpd.c,v 1.1 2007/03/15 20:02:20 christos Exp $");
+#endif
+#endif /* not lint */
+
+/*
+ * 4.2BSD TCP/IP server for uucico
+ * uucico's TCP channel causes this server to be run at the remote end.
+ */
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <sys/syslog.h>
+
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <util.h>
+#include <time.h>
+#ifdef SUPPORT_UTMP
+#include <utmp.h>
+#endif
+#ifdef SUPPORT_UTMPX
+#include <utmpx.h>
+#endif
+
+#include "pathnames.h"
+
+struct sockaddr_storage hisctladdr;
+socklen_t hisaddrlen = sizeof hisctladdr;
+int mypid;
+
+char Logname[64], Username[64];
+char *nenv[] = {
+ Logname,
+ Username,
+ NULL,
+};
+int dolog;
+
+extern char **environ;
+
+void dologout __P((void));
+void dologin __P((struct passwd *, struct sockaddr *));
+void doit __P((struct sockaddr *));
+int readline __P((char *, int));
+int main __P((int, char **));
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, "l")) != -1)
+ switch (ch) {
+ case 'l':
+ dolog = 1;
+ break;
+ default:
+ exit(1);
+ }
+
+ if (dolog)
+ openlog("uucpd", LOG_PID, LOG_AUTH);
+ environ = nenv;
+ close(1);
+ close(2);
+ dup(0);
+ dup(0);
+ hisaddrlen = sizeof (hisctladdr);
+ if (getpeername(0, (struct sockaddr *)&hisctladdr, &hisaddrlen) < 0) {
+ fprintf(stderr, "%s: ", argv[0]);
+ perror("getpeername");
+ if (dolog)
+ syslog(LOG_ERR, "getpeername failed: %m");
+ exit(1);
+ }
+ switch (fork()) {
+ case -1:
+ break;
+ case 0:
+ doit((struct sockaddr *)&hisctladdr);
+ break;
+ default:
+ dologout();
+ }
+ exit(1);
+}
+
+void
+doit(sa)
+ struct sockaddr *sa;
+{
+ char user[64], passwd[64];
+ char *xpasswd = NULL; /* XXX gcc */
+ struct passwd *pw;
+
+ alarm(60);
+ do {
+ printf("login: ");
+ fflush(stdout);
+ if (readline(user, sizeof user) < 0) {
+ fprintf(stderr, "user read\n");
+ if (dolog)
+ syslog(LOG_ERR, "user read failed: %m");
+ return;
+ }
+ } while (user[0] == '\0');
+ /* ensure username is NUL-terminated */
+ user[sizeof(user)-1] = '\0';
+ pw = getpwnam(user);
+ if (pw == NULL || (pw->pw_passwd && *pw->pw_passwd != '\0')) {
+ printf("Password: ");
+ fflush(stdout);
+ if (readline(passwd, sizeof passwd) < 0) {
+ fprintf(stderr, "passwd read\n");
+ if (dolog)
+ syslog(LOG_ERR, "passwd read failed: %m");
+ return;
+ }
+ if (pw != NULL)
+ xpasswd = crypt(passwd, pw->pw_passwd);
+
+ if (pw == NULL || strcmp(xpasswd, pw->pw_passwd)) {
+ fprintf(stderr, "Login incorrect.\n");
+ if (dolog)
+ syslog(LOG_ERR, "incorrect password from %s",
+ user);
+ return;
+ }
+ } else
+ (void)crypt("dummy password", "PA"); /* must always crypt */
+ if (strcmp(pw->pw_shell, _PATH_UUCICO)) {
+ fprintf(stderr, "Login incorrect.\n");
+ if (dolog)
+ syslog(LOG_ERR, "incorrect shell for %s", user);
+ return;
+ }
+ alarm(0);
+ snprintf(Logname, sizeof(Logname), "LOGNAME=%s", user);
+ snprintf(Username, sizeof(Username), "USER=%s", user);
+ dologin(pw, sa);
+ if (initgroups(pw->pw_name, pw->pw_gid) < 0 ||
+ setgid(pw->pw_gid) < 0 ||
+ chdir(pw->pw_dir) < 0 ||
+ setsid() < 0 ||
+ setlogin(user) < 0 ||
+ setuid(pw->pw_uid) < 0) {
+ fprintf(stderr, "Could not set permissions.\n");
+ if (dolog)
+ syslog(LOG_ERR,"couldn't set user %s's permissions: %m",
+ user);
+ return;
+ }
+ if (dolog)
+ syslog(LOG_INFO, "%s has logged in", user);
+ execl(_PATH_UUCICO, "uucico", (char *)0);
+ perror("uucico server: execl");
+ if (dolog)
+ syslog(LOG_ERR, "execl failed: %m");
+}
+
+int
+readline(p, n)
+ char *p;
+ int n;
+{
+ char c;
+
+ while (n-- > 0) {
+ if (read(0, &c, 1) <= 0)
+ return(-1);
+ c &= 0177;
+ if (c == '\r') {
+ *p = '\0';
+ return(0);
+ }
+ if (c != '\n')
+ *p++ = c;
+ }
+ return (-1);
+}
+
+/* Note that SCPYN is only used on strings that may not be nul terminated */
+#define SCPYN(a, b) strncpy(a, b, sizeof (a))
+
+#ifdef SUPPORT_UTMP
+struct utmp utmp;
+#endif
+#ifdef SUPPORT_UTMPX
+struct utmpx utmpx;
+#endif
+
+void
+dologout()
+{
+#if defined(SUPPORT_UTMP) || defined(SUPPORT_UTMPX)
+ int status;
+ char line[MAXPATHLEN];
+ pid_t pid;
+
+ while ((pid = wait(&status)) > 0) {
+ snprintf(line, sizeof(line), "uucp%.4d", pid);
+#ifdef SUPPORT_UTMPX
+ if (logoutx(line, status, DEAD_PROCESS))
+ logwtmpx(line, "", "", status, DEAD_PROCESS);
+#endif
+#ifdef SUPPORT_UTMP
+ if (logout(line))
+ logwtmp(line, "", "");
+#endif
+ }
+#endif
+}
+
+/*
+ * Record login in wtmp file.
+ */
+void
+dologin(pw, sa)
+ struct passwd *pw;
+ struct sockaddr *sa;
+{
+#if defined(SUPPORT_UTMP) || defined(SUPPORT_UTMPX)
+ char hbuf[NI_MAXHOST];
+ struct timeval tv;
+ char line[MAXPATHLEN];
+ pid_t pid = getpid();
+
+ /* hack, but must be unique and no tty line */
+ snprintf(line, sizeof(line), "uucp%.4d", pid = getpid());
+ (void)gettimeofday(&tv, NULL);
+ if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0, 0))
+ (void)strlcpy(hbuf, "?", sizeof(hbuf));
+#endif
+#ifdef SUPPORT_UTMPX
+ SCPYN(utmpx.ut_line, line);
+ SCPYN(utmpx.ut_name, pw->pw_name);
+ SCPYN(utmpx.ut_host, hbuf);
+ if (strlen(line) > sizeof(utmpx.ut_id)) {
+ SCPYN(utmpx.ut_id, line + strlen(line) - sizeof(utmpx.ut_id));
+ } else {
+ SCPYN(utmpx.ut_id, line);
+ }
+ utmpx.ut_tv = tv;
+ utmpx.ut_type = USER_PROCESS;
+ utmpx.ut_pid = pid;
+ (void)memcpy(&utmpx.ut_ss, sa, sizeof(*sa));
+ loginx(&utmpx);
+ logwtmpx(line, pw->pw_name, hbuf, 0, USER_PROCESS);
+#endif
+#ifdef SUPPORT_UTMP
+ SCPYN(utmp.ut_line, line);
+ SCPYN(utmp.ut_name, pw->pw_name);
+ SCPYN(utmp.ut_host, hbuf);
+ utmp.ut_time = (time_t)tv.tv_sec;
+ login(&utmp);
+ logwtmp(line, pw->pw_name, hbuf);
+#endif
+}
diff --git a/net/uucp/patches/patch-ar b/net/uucp/patches/patch-ar
new file mode 100644
index 00000000000..44a80026988
--- /dev/null
+++ b/net/uucp/patches/patch-ar
@@ -0,0 +1,13 @@
+$NetBSD: patch-ar,v 1.1 2007/03/15 20:02:21 christos Exp $
+
+--- Makefile.in.orig 2003-05-29 21:31:40.000000000 -0400
++++ Makefile.in 2007-03-15 15:58:17.000000000 -0400
+@@ -82,7 +82,7 @@
+ am__quote = @am__quote@
+ install_sh = @install_sh@
+
+-SUBDIRS = lib uuconf unix
++SUBDIRS = lib uuconf unix rmail uucpd
+
+ sbin_PROGRAMS = uucico uuxqt uuchk uuconv
+ sbin_SCRIPTS = uusched
diff --git a/net/uucp/patches/patch-as b/net/uucp/patches/patch-as
new file mode 100644
index 00000000000..62bd2fb7a8c
--- /dev/null
+++ b/net/uucp/patches/patch-as
@@ -0,0 +1,13 @@
+$NetBSD: patch-as,v 1.1 2007/03/15 20:02:21 christos Exp $
+
+--- Makefile.am.orig 2003-05-29 20:10:23.000000000 -0400
++++ Makefile.am 2007-03-15 15:57:57.000000000 -0400
+@@ -1,7 +1,7 @@
+ # This is the auto-Makefile for Taylor UUCP
+ # This is processed by automake to create Makefile.in.
+
+-SUBDIRS = lib uuconf unix
++SUBDIRS = lib uuconf unix rmail uucpd
+
+ sbin_PROGRAMS = uucico uuxqt uuchk uuconv
+ sbin_SCRIPTS = uusched