From 7b87c499b81116e116de4b91d3eb40ff7849dd82 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 15 Jul 2018 02:55:34 -0500 Subject: user/libutempter: new package --- user/libutempter/APKBUILD | 30 +++++++++++ user/libutempter/port-to-utmpx.patch | 100 +++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 user/libutempter/APKBUILD create mode 100644 user/libutempter/port-to-utmpx.patch (limited to 'user/libutempter') diff --git a/user/libutempter/APKBUILD b/user/libutempter/APKBUILD new file mode 100644 index 000000000..5d4a3841c --- /dev/null +++ b/user/libutempter/APKBUILD @@ -0,0 +1,30 @@ +# Maintainer: A. Wilcox +pkgname=libutempter +pkgver=1.1.6 +pkgrel=0 +pkgdesc="Library to record virtual terminal sessions in login files" +url="No URL" +arch="all" +options="!check" # No test suite. +license="LGPL-2.1+" +depends="" +makedepends="utmps-dev" +subpackages="$pkgname-dev $pkgname-doc" +source="ftp://ftp.altlinux.org/pub/people/ldv/utempter/$pkgname-$pkgver.tar.bz2 + port-to-utmpx.patch + " + +build() { + cd "$builddir" + make +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install + # utmps allows us to log without root! + chmod 0755 "$pkgdir"/usr/lib/utempter/utempter +} + +sha512sums="6ada410b981d157ae20b578de8ce20997ec0446ec6de6859549b080aa65976fc9900d211600dab09dc3d0d109daabad0994a648b093b8781b442ff26ca17fede libutempter-1.1.6.tar.bz2 +b2d0bc9075bda0dc3404458547ee2d190855d6d8b2c209ae70b763ea11baa0569bd3b167589ad09f77c82075430ca60ffe758a925b9fd4124b5945b93c19a10d port-to-utmpx.patch" diff --git a/user/libutempter/port-to-utmpx.patch b/user/libutempter/port-to-utmpx.patch new file mode 100644 index 000000000..d715c42ab --- /dev/null +++ b/user/libutempter/port-to-utmpx.patch @@ -0,0 +1,100 @@ +--- libutempter-1.1.6/utempter.c.old 2010-11-04 17:14:53.000000000 +0000 ++++ libutempter-1.1.6/utempter.c 2018-07-15 07:52:35.620000000 +0000 +@@ -32,15 +32,8 @@ + #include + #include + #include +-#include +- +-#ifdef __GLIBC__ +-# include +-#elif defined(__FreeBSD__) +-# include +-#else +-# error Unsupported platform +-#endif /* __GLIBC__ || __FreeBSD__ */ ++#include /* _PATH_WTMP */ ++#include + + #define DEV_PREFIX "/dev/" + #define DEV_PREFIX_LEN (sizeof(DEV_PREFIX)-1) +@@ -106,17 +99,12 @@ + + static int + write_uwtmp_record(const char *user, const char *term, const char *host, +-#ifdef __GLIBC__ + pid_t pid, +-#endif + int add) + { +- struct utmp ut; ++ struct utmpx ut; + struct timeval tv; +- +-#ifdef __GLIBC__ + size_t offset; +-#endif + + memset(&ut, 0, sizeof(ut)); + +@@ -128,8 +116,6 @@ + if (host) + strncpy(ut.ut_host, host, sizeof(ut.ut_host)); + +-#ifdef __GLIBC__ +- + offset = (strlen(term) <= sizeof(ut.ut_id)) ? 0 : + strlen(term) - sizeof(ut.ut_id); + strncpy(ut.ut_id, term + offset, sizeof(ut.ut_id)); +@@ -144,38 +130,17 @@ + ut.ut_tv.tv_sec = tv.tv_sec; + ut.ut_tv.tv_usec = tv.tv_usec; + +- setutent(); +- if (!pututline(&ut)) ++ setutxent(); ++ if (!pututxline(&ut)) + { + #ifdef UTEMPTER_DEBUG + fprintf(stderr, "utempter: pututline: %s\n", strerror(errno)); + #endif + exit(EXIT_FAILURE); + } +- endutent(); +- +- (void) updwtmp(_PATH_WTMP, &ut); +- +-#elif defined(__FreeBSD__) +- +- ut.ut_time = tv.tv_sec; +- +- if (add) +- { +- login(&ut); +- } else +- { +- if (logout(term) != 1) +- { +-#ifdef UTEMPTER_DEBUG +- fprintf(stderr, "utempter: logout: %s\n", +- strerror(errno)); +-#endif +- exit(EXIT_FAILURE); +- } +- } ++ endutxent(); + +-#endif /* __GLIBC__ || __FreeBSD__ */ ++ (void) updwtmpx(_PATH_WTMP, &ut); + + #ifdef UTEMPTER_DEBUG + fprintf(stderr, +@@ -255,8 +220,6 @@ + validate_device(device); + + return write_uwtmp_record(pw->pw_name, device + DEV_PREFIX_LEN, host, +-#ifdef __GLIBC__ + pid, +-#endif + add); + } -- cgit v1.2.3-60-g2f50