accountsservice: Pullin patch by Alan Coopersmith (Solaris)

This commit is contained in:
Kamil Rytarowski 2015-12-15 04:10:34 +01:00
parent 93ad5cd3dc
commit 681a36ec17
3 changed files with 51 additions and 85 deletions

View file

@ -3,6 +3,6 @@ $NetBSD: distinfo,v 1.1 2015/06/06 13:52:41 krytarowski Exp $
SHA1 (accountsservice-0.6.40.tar.xz) = 2afbcddf6e1d1a97b4cc5c4c7897201f06378ec3
RMD160 (accountsservice-0.6.40.tar.xz) = 83c148f750058039728397b5c8d058058557d519
Size (accountsservice-0.6.40.tar.xz) = 367772 bytes
SHA1 (patch-configure.ac) = 106b5e515632fb7de8d53718ce1fc46887dce66b
SHA1 (patch-configure.ac) = 0bf7a0d574f1902a9e33cacb3da3d36bfd017b85
SHA1 (patch-data_Makefile.am) = b059cd214a346adb371e4a006f497d652c9d9234
SHA1 (patch-src_wtmp-helper.c) = f3a4a1c77cfef244391efb91fe952e45986f6235
SHA1 (patch-src_wtmp-helper.c) = c90e24ec7d1f1c99176e5ce6ab36c896f6dd06fb

View file

@ -2,39 +2,39 @@ $NetBSD$
--- configure.ac.orig 2015-01-22 21:25:12.000000000 +0000
+++ configure.ac
@@ -289,6 +289,29 @@ if test "x$with_systemdsystemunitdir" !=
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
@@ -185,9 +185,33 @@ fi
+dnl ---------------------------------------------------------------------------
+dnl - check OS
+dnl ---------------------------------------------------------------------------
+AC_MSG_CHECKING([checking OS type])
+case "$host_os" in
+ *freebsd*)
+ AC_MSG_RESULT([FreeBSD])
+ AC_DEFINE([HAVE_FREEBSD], 1, [Is this a FreeBSD system?])
+ ;;
+ *linux*)
+ AC_MSG_RESULT([Linux])
+ AC_DEFINE([HAVE_LINUX], 1, [Is this a Linux system?])
+ ;;
+ *netbsd*)
+ AC_MSG_RESULT([NetBSD])
+ AC_DEFINE([HAVE_NETBSD], 1, [Is this a NetBSD system?])
+ ;;
+ *solaris*)
+ AC_MSG_RESULT([Solaris])
+ AC_DEFINE([HAVE_SOLARIS], 1, [Is this a Solaris system?])
+ ;;
+esac
AC_SUBST(WARN_CFLAGS)
-AC_CHECK_HEADERS([shadow.h utmpx.h])
+AC_CHECK_HEADERS([paths.h shadow.h utmpx.h])
-AC_CHECK_FUNCS([fgetpwent])
+AC_CHECK_FUNCS([fgetpwent setutxdb])
+
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
@@ -313,5 +336,3 @@ else
fi
AC_MSG_NOTICE([** Administrator group: $enable_admin_group])
echo
-
-
+wtmpx_found="no"
+AC_CHECK_DECLS([WTMPX_FILENAME], [wtmpx_found="WTMPX_FILENAME"],
+ [], [AC_INCLUDES_DEFAULT
+#include <utmpx.h>
+ ])
+if test "$wtmpx_found" = "no" ; then
+ AC_CHECK_DECLS([_PATH_WTMPX], [wtmpx_found="_PATH_WTMPX"],
+ [], [AC_INCLUDES_DEFAULT
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
+ ])
+ if test "$wtmpx_found" = "no" ; then
+ AC_CHECK_FILE([/var/log/utx.log], [wtmpx_found='"/var/log/utx.log"'])
+ if test "$wtmpx_found" = "no" ; then
+ AC_MSG_FAILURE([Do not know which filename to watch for wtmp changes])
+ fi
+ fi
+fi
+AC_DEFINE_UNQUOTED([PATH_WTMP], [$wtmpx_found], [Path to wtmpx file])
dnl ---------------------------------------------------------------------------
dnl - gtk-doc Documentation

View file

@ -2,68 +2,34 @@ $NetBSD$
--- src/wtmp-helper.c.orig 2014-11-04 03:46:00.000000000 +0000
+++ src/wtmp-helper.c
@@ -56,21 +56,32 @@ user_previous_login_free (UserPreviousLo
@@ -56,12 +56,12 @@ user_previous_login_free (UserPreviousLo
static gboolean
wtmp_helper_start (void)
{
-#if defined(UTXDB_LOG)
- if (setutxdb (UTXDB_LOG, NULL) != 0) {
- return FALSE;
- }
+#if defined(HAVE_SETUTXDB)
if (setutxdb (UTXDB_LOG, NULL) != 0) {
return FALSE;
}
-#elif defined(WTMPX_FILENAME)
- if (utmpxname (WTMPX_FILENAME) != 0) {
- return FALSE;
- }
+#if HAVE_FREEBSD
+ if (setutxdb (UTXDB_LOG, NULL) != 0) {
+ return FALSE;
+ }
+#elif HAVE_LINUX
+ if (utmpxname (WTMPX_FILENAME) != 0) {
+ return FALSE;
+ }
+
+ setutxent ();
+#elif HAVE_NETBSD
+ if (utmpxname (_PATH_WTMPX) != 0) {
+ return FALSE;
+ }
+#elif defined(PATH_WTMP)
+ if (utmpxname (PATH_WTMP) != 0) {
return FALSE;
}
- setutxent ();
+ setutxent ();
+#elif HAVE_SOLARIS
+ if (utmpxname (WTMPX_FILE) != 0) {
+ return FALSE;
+ }
+
+ setutxent ();
#else
#error You have utmpx.h, but no known way to use it for wtmp entries
#endif
-
- return TRUE;
+ return TRUE;
}
struct passwd *
@@ -212,12 +223,16 @@ wtmp_helper_entry_generator (GHashTable
@@ -212,13 +212,7 @@ wtmp_helper_entry_generator (GHashTable
const gchar *
wtmp_helper_get_path_for_monitor (void)
{
-#if defined(WTMPX_FILENAME)
- return WTMPX_FILENAME;
-#elif defined(__FreeBSD__)
+#if HAVE_FREEBSD
return "/var/log/utx.log";
+#elif HAVE_LINUX
+ return WTMPX_FILENAME;
+#elif HAVE_NETBSD
+ return _PATH_WTMPX;
+#elif HAVE_SOLARIS
+ return WTMPX_FILE;
#else
- return "/var/log/utx.log";
-#else
-#error Do not know which filename to watch for wtmp changes
+#error You have utmpx.h, but no known way to use it for wtmp entries
#endif
-#endif
+ return PATH_WTMP;
}
#else /* HAVE_UTMPX_H */