summaryrefslogtreecommitdiff
path: root/comms
diff options
context:
space:
mode:
authorfredb <fredb@pkgsrc.org>2003-02-26 21:45:43 +0000
committerfredb <fredb@pkgsrc.org>2003-02-26 21:45:43 +0000
commit6b9c6cc6b60bcd07e92a19cb4e369797500a1da2 (patch)
tree3a26194c62a6fdaa6ffebf351cd22a1baf17325e /comms
parent8a0a4c637ff257386b7cf7abb8eed83091c00124 (diff)
downloadpkgsrc-6b9c6cc6b60bcd07e92a19cb4e369797500a1da2.tar.gz
Add support for /var/run/utmpx on NetBSD 1.6B or newer, including
building on a suggestion by Gert Doering, filling ut_pid with the pid of the uucp-style lock holder. This should fix PR pkg/12261, although you will need today's "w" to see any results. Bump PKGREVSION.
Diffstat (limited to 'comms')
-rw-r--r--comms/mgetty+sendfax/Makefile4
-rw-r--r--comms/mgetty+sendfax/distinfo5
-rw-r--r--comms/mgetty+sendfax/patches/patch-ak35
-rw-r--r--comms/mgetty+sendfax/patches/patch-al135
-rw-r--r--comms/mgetty+sendfax/patches/patch-am14
5 files changed, 190 insertions, 3 deletions
diff --git a/comms/mgetty+sendfax/Makefile b/comms/mgetty+sendfax/Makefile
index 7540df6a53d..7e195ece1b7 100644
--- a/comms/mgetty+sendfax/Makefile
+++ b/comms/mgetty+sendfax/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.24 2002/10/09 14:42:28 wiz Exp $
+# $NetBSD: Makefile,v 1.25 2003/02/26 21:45:43 fredb Exp $
# FreeBSD Id: Makefile,v 1.25 1998/07/16 06:44:37 vanilla Exp
#
DISTNAME= mgetty1.1.28-Jan10
PKGNAME= mgetty-1.1.28
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= comms
MASTER_SITES= ftp://ftp.leo.org/pub/comp/os/unix/networking/mgetty/ \
ftp://alpha.greenie.net/pub/mgetty/source/1.1/
diff --git a/comms/mgetty+sendfax/distinfo b/comms/mgetty+sendfax/distinfo
index 7e37bf368d2..21b2ca4cb6a 100644
--- a/comms/mgetty+sendfax/distinfo
+++ b/comms/mgetty+sendfax/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2002/07/27 10:47:29 fredb Exp $
+$NetBSD: distinfo,v 1.9 2003/02/26 21:45:44 fredb Exp $
SHA1 (mgetty1.1.28-Jan10.tar.gz) = b0c33bf5f5137f17f8d1fbd529c5ba6f0afb9dbc
Size (mgetty1.1.28-Jan10.tar.gz) = 964610 bytes
@@ -11,3 +11,6 @@ SHA1 (patch-ag) = 943aa837a285663ff6cf5ab07c3f908f499c2074
SHA1 (patch-ah) = 7724a401625d25b00ba88782eeffc3cdc03387c6
SHA1 (patch-ai) = 98eba401e1b422e2f759eca00132a75e68518f4d
SHA1 (patch-aj) = 25e809417d438dfd1f33daeb0dcae307eaaae867
+SHA1 (patch-ak) = 18f9570f35909089a4083fa24903dfea14dcc475
+SHA1 (patch-al) = 7dc2be52ca8ed6b035a0f0d4afcd3d1a949e5182
+SHA1 (patch-am) = 6b7516b3f857f65c0ecc7963f39e433e4ef8771d
diff --git a/comms/mgetty+sendfax/patches/patch-ak b/comms/mgetty+sendfax/patches/patch-ak
new file mode 100644
index 00000000000..bc5c9ef8b31
--- /dev/null
+++ b/comms/mgetty+sendfax/patches/patch-ak
@@ -0,0 +1,35 @@
+$NetBSD: patch-ak,v 1.1 2003/02/26 21:45:44 fredb Exp $
+
+--- mg_utmp.h.orig 1997-01-12 08:53:42.000000000 -0600
++++ mg_utmp.h
+@@ -4,6 +4,22 @@
+ * highly SysV / BSD dependent
+ */
+
++#if __NetBSD_Version__ >= 106020000 /* NetBSD >= 1.6B has SVR4-style utmpx */
++# define NETBSD_UTMPX
++# include <util.h> /* for loginx */
++# define login loginx
++# define utmp utmpx
++# define getutent getutxent
++# define getutid getutxid
++# define pututline pututxline
++# define setutent setutxent
++# define endutent endutxent
++
++# define UT_INIT INIT_PROCESS
++# define UT_LOGIN LOGIN_PROCESS
++# define UT_USER USER_PROCESS
++
++#else
+ #if !defined(sunos4) && !defined(BSD) && !defined(ultrix) /* SysV style */
+
+ #ifdef SVR4 /* on SVR4, use extended utmpx file */
+@@ -42,6 +58,7 @@
+ #define UT_USER 2
+
+ #endif /* SysV vs. BSD */
++#endif /* NetBSD with utmpx */
+
+ /* prototypes */
+
diff --git a/comms/mgetty+sendfax/patches/patch-al b/comms/mgetty+sendfax/patches/patch-al
new file mode 100644
index 00000000000..a2c48f8a4be
--- /dev/null
+++ b/comms/mgetty+sendfax/patches/patch-al
@@ -0,0 +1,135 @@
+$NetBSD: patch-al,v 1.1 2003/02/26 21:45:45 fredb Exp $
+
+--- utmp.c.orig 2001-12-17 16:43:25.000000000 -0600
++++ utmp.c
+@@ -7,7 +7,7 @@
+
+ #include "mgetty.h"
+
+-#if defined(sunos4) || defined(BSD)
++#if defined(sunos4) || ( defined(BSD) && !defined(NETBSD_UTMPX) )
+
+ #include <stdio.h>
+ #include <string.h>
+@@ -20,10 +20,11 @@
+ #include <time.h>
+ #include <string.h>
+ #include <sys/types.h>
+-#include <sys/stat.h>
+-
+-#ifndef ENOENT
+-#include <errno.h>
++#if !defined(SVR4) && !defined(NETBSD_UTMPX) && __GLIBC__ < 2
++# include <sys/stat.h>
++# ifndef ENOENT
++# include <errno.h>
++# endif
+ #endif
+
+ #if defined(_3B1_) || defined(MEIBE) || defined(ISC)
+@@ -42,8 +43,14 @@
+ # endif
+ #endif
+
++#ifndef WTMPX_FILE
++# ifdef _PATH_WTMPX
++# define WTMPX_FILE _PATH_WTMPX /* NetBSD */
++# endif
++#endif
++
+
+-#if defined(sunos4) || defined(BSD) || defined(ultrix)
++#if ( defined(sunos4) || defined(BSD) || defined(ultrix) ) && !defined(NETBSD_UTMPX)
+ /* on SunOS (and other BSD-derived systems), the getty process does *
+ * not have to care for the utmp entries, login and init do all the work
+ * Anyway, we have to _read_ it to get the number of users logged in.
+@@ -109,26 +116,68 @@
+ {
+ struct utmp *utmp;
+ pid_t pid;
++#ifdef NETBSD_UTMPX
++char id[4];
++struct utmpx ut;
++#else
++# if !(defined(SVR4) || (defined(__GLIBC__) && __GLIBC__ >= 2)
+ struct stat st;
++# endif
++#endif
+ FILE * fp;
+
++#ifdef NETBSD_UTMPX
++ id[0] = line[0];
++ id[1] = line[strlen(line) - 2];
++ id[2] = line[strlen(line) - 1];
++ id[3] = '\0';
++ if ( ut_type == UT_INIT ) {
++ lprintf(L_JUNK, "creating initial utmp entry... (id: %s)", id);
++
++ memset(&ut, 0, sizeof( ut ));
++ memcpy(ut.ut_id, id, 4);
++ strncpy(ut.ut_line, line, sizeof( ut.ut_line ));
++ gettimeofday(&ut.ut_tv, NULL );
++ ut.ut_type = INIT_PROCESS;
++ login( &ut );
++
++ lprintf(L_NOISE, "initial utmp + wtmp entry made");
++ return;
++ }
++ if ((pid = checklock( line )) == NO_LOCK) {
++ pid = getpid();
++ }
++ lprintf(L_JUNK, "looking for utmp entry... (my ID: %s)", id);
++#else
+ pid = getpid();
+ lprintf(L_JUNK, "looking for utmp entry... (my PID: %d)", pid);
++#endif
+
++ setutent();
+ while ((utmp = getutent()) != (struct utmp *) NULL)
+ {
++#ifdef NETBSD_UTMPX
++ if (memcmp(utmp->ut_id, id, 4) == 0 &&
++#else
+ if (utmp->ut_pid == pid &&
++#endif
+ (utmp->ut_type == INIT_PROCESS || utmp->ut_type == LOGIN_PROCESS))
+ {
+- strcpy(utmp->ut_line, line );
++ strncpy(utmp->ut_line, line, sizeof( utmp->ut_line) );
+
++#ifdef NETBSD_UTMPX
++ utmp->ut_pid = pid;
++ gettimeofday( &utmp->ut_tv, NULL );
++#else
+ utmp->ut_time = time( NULL );
++#endif
+
+ utmp->ut_type = ut_type; /* {INIT,LOGIN,USER}_PROCESS */
+- /* "LOGIN", "uugetty", "dialout" */
++
+ strncpy( utmp->ut_user, ut_user, sizeof( utmp->ut_user ) );
++ /* "LOGIN", "uugetty", "dialout" */
+
+-#if defined(SVR4) || defined(linux)
++#if defined(SVR4) || defined(linux) || defined(NETBSD_UTMPX)
+ if (ut_host != NULL)
+ {
+ strncpy( utmp->ut_host, ut_host, sizeof( utmp->ut_host ) - 1);
+@@ -138,7 +187,7 @@
+ }
+ #endif /* SVR4 */
+
+-#if defined(M_UNIX) || defined(__GLIBC__)
++#if defined(M_UNIX) || defined(__GLIBC__) || defined(NETBSD_UTMPX)
+ if ( pututline(utmp) == NULL )
+ {
+ lprintf( L_ERROR, "cannot create utmp entry" );
+@@ -151,7 +200,7 @@
+ /* write same record to end of wtmp
+ * if wtmp file exists
+ */
+-#ifdef SVR4
++#if defined(SVR4) || defined(NETBSD_UTMPX)
+ updwtmpx(WTMPX_FILE, utmp);
+ #else
+ # if defined(__GLIBC__) && __GLIBC__ >= 2
diff --git a/comms/mgetty+sendfax/patches/patch-am b/comms/mgetty+sendfax/patches/patch-am
new file mode 100644
index 00000000000..1a97c9e97c2
--- /dev/null
+++ b/comms/mgetty+sendfax/patches/patch-am
@@ -0,0 +1,14 @@
+$NetBSD: patch-am,v 1.1 2003/02/26 21:45:46 fredb Exp $
+
+--- mgetty.c.orig 2002-12-05 05:54:03.000000000 -0600
++++ mgetty.c
+@@ -512,7 +512,8 @@
+
+ rmlocks();
+
+-#if ( defined(linux) && defined(NO_SYSVINIT) ) || defined(sysV68)
++#if ( defined(linux) && defined(NO_SYSVINIT) ) || defined(sysV68) \
++ || defined(NETBSD_UTMPX)
+ /* on linux, "simple init" does not make a wtmp entry when you
+ * log so we have to do it here (otherwise, "who" won't work) */
+ make_utmp_wtmp( Device, UT_INIT, "uugetty", NULL );