Commit e76cf763 authored by Olivier Duchateau's avatar Olivier Duchateau
Browse files

Update to 0.6.43

parent 8b951603
# Created by: Koop Mast <kwm@FreeBSD.org>
# $FreeBSD: head/sysutils/accountsservice/Makefile 517057 2019-11-08 13:11:05Z tobik $
PORTNAME= accountsservice
PORTVERSION= 0.6.43
CATEGORIES= sysutils devel
MASTER_SITES= http://www.freedesktop.org/software/${PORTNAME}/
MAINTAINER= kwm@FreeBSD.org
COMMENT= D-Bus interface for user account query and manipulation
LICENSE= GPLv3+
LICENSE_FILE= ${WRKSRC}/COPYING
LIB_DEPENDS= libpolkit-gobject-1.so:sysutils/polkit
USE_GNOME= glib20 intltool introspection:build libxslt
USES= cpe gettext gmake gnome libtool localbase:ldflags pathfix \
pkgconfig tar:xz
CPE_VENDOR= ray_stode
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
CONFIGURE_ARGS= --disable-systemd \
--without-html-dir \
--localstatedir=/var/
INSTALL_TARGET= install-strip
# XXX HACK! this file isn't present on the pristine jails of the builders
# and configure breaks without it. Beter solutions welcome.
.if defined(PACKAGE_BUILDING)
CONFIGURE_ENV+= ac_cv_file__var_log_utx_log=yes
.endif
post-patch:
@${REINPLACE_CMD} -e 's|/etc/gdm/custom.conf|${LOCALBASE}/etc/gdm/custom.conf|g' \
${WRKSRC}/src/daemon.c
@${REINPLACE_CMD} -e 's|/lib/AccountsService|/db/AccountsService|g' \
${WRKSRC}/src/Makefile.in
.include <bsd.port.mk>
TIMESTAMP = 1600418890
SHA256 (accountsservice-0.6.43.tar.xz) = ed3ba94aa38ceb822a0e1a1ac71bf1a8123babf90be049397b3a00900e48d6cc
SIZE (accountsservice-0.6.43.tar.xz) = 381008
--- configure.orig 2014-03-15 15:02:28.000000000 +0100
+++ configure 2014-03-15 15:03:01.000000000 +0100
@@ -14527,6 +14527,18 @@
done
+for ac_func in fgetpwent
+do :
+ ac_fn_c_check_func "$LINENO" "fgetpwent" "ac_cv_func_fgetpwent"
+if test "x$ac_cv_func_fgetpwent" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_FGETPWENT 1
+_ACEOF
+
+fi
+done
+
+
--- src/daemon.c.orig 2016-09-06 19:48:50 UTC
+++ src/daemon.c
@@ -78,7 +78,11 @@ struct DaemonPrivate {
GHashTable *extension_ifaces;
};
+#ifdef HAVE_SHADOW_H
typedef struct passwd * (* EntryGeneratorFunc) (GHashTable *, gpointer *, struct spwd **shadow_entry);
+#else
+typedef struct passwd * (* EntryGeneratorFunc) (GHashTable *, gpointer *);
+#endif
static void daemon_accounts_accounts_iface_init (AccountsAccountsIface *iface);
@@ -140,16 +144,23 @@ error_get_type (void)
#endif
static struct passwd *
+#ifdef HAVE_SHADOW_H
entry_generator_fgetpwent (GHashTable *users,
gpointer *state,
struct spwd **spent)
+#else
+entry_generator_fgetpwent (GHashTable *users,
+ gpointer *state)
+#endif
{
struct passwd *pwent;
+#ifdef HAVE_SHADOW_H
struct {
struct spwd spbuf;
char buf[1024];
} *shadow_entry_buffers;
+#endif
struct {
FILE *fp;
@@ -160,6 +171,7 @@ entry_generator_fgetpwent (GHashTable *users,
if (*state == NULL) {
GHashTable *shadow_users = NULL;
FILE *fp;
+#ifdef HAVE_SHADOW_H
struct spwd *shadow_entry;
fp = fopen (PATH_SHADOW, "r");
@@ -193,6 +205,7 @@ entry_generator_fgetpwent (GHashTable *users,
g_clear_pointer (&shadow_users, g_hash_table_unref);
return NULL;
}
+#endif
fp = fopen (PATH_PASSWD, "r");
if (fp == NULL) {
@@ -214,12 +227,17 @@ entry_generator_fgetpwent (GHashTable *users,
if (g_hash_table_size (users) < MAX_LOCAL_USERS) {
pwent = fgetpwent (generator_state->fp);
if (pwent != NULL) {
+#ifdef HAVE_SHADOW_H
shadow_entry_buffers = g_hash_table_lookup (generator_state->users, pwent->pw_name);
if (shadow_entry_buffers != NULL) {
*spent = &shadow_entry_buffers->spbuf;
return pwent;
}
+#else
+ if (!generator_state->users || g_hash_table_lookup (generator_state->users, pwent->pw_name))
+ return pwent;
+#endif
}
}
@@ -233,9 +251,14 @@ entry_generator_fgetpwent (GHashTable *users,
}
static struct passwd *
+#ifdef HAVE_SHADOW_H
entry_generator_cachedir (GHashTable *users,
gpointer *state,
struct spwd **shadow_entry)
+#else
+entry_generator_cachedir (GHashTable *users,
+ gpointer *state)
+#endif
{
struct passwd *pwent;
const gchar *name;
@@ -280,7 +303,9 @@ entry_generator_cachedir (GHashTable *users,
if (pwent == NULL) {
g_debug ("user '%s' in cache dir but not present on system", name);
} else {
+#ifdef HAVE_SHADOW_H
*shadow_entry = getspnam (pwent->pw_name);
+#endif
return pwent;
}
@@ -312,19 +337,29 @@ load_entries (Daemon *daemon,
{
gpointer generator_state = NULL;
struct passwd *pwent;
+#ifdef HAVE_SHADOW_H
struct spwd *spent = NULL;
+#endif
User *user = NULL;
g_assert (entry_generator != NULL);
for (;;) {
+#ifdef HAVE_SHADOW_H
spent = NULL;
pwent = entry_generator (users, &generator_state, &spent);
+#else
+ pwent = entry_generator (users, &generator_state);
+#endif
if (pwent == NULL)
break;
/* Skip system users... */
+#ifdef HAVE_SHADOW_H
if (!user_classify_is_human (pwent->pw_uid, pwent->pw_name, pwent->pw_shell, spent? spent->sp_pwdp : NULL)) {
+#else
+ if (!user_classify_is_human (pwent->pw_uid, pwent->pw_name, pwent->pw_shell, NULL)) {
+#endif
g_debug ("skipping user: %s", pwent->pw_name);
continue;
}
@@ -343,7 +378,11 @@ load_entries (Daemon *daemon,
/* freeze & update users not already in the new list */
g_object_freeze_notify (G_OBJECT (user));
+#ifdef HAVE_SHADOW_H
user_update_from_pwent (user, pwent, spent);
+#else
+ user_update_from_pwent (user, pwent);
+#endif
g_hash_table_insert (users, g_strdup (user_get_user_name (user)), user);
g_debug ("loaded user: %s", user_get_user_name (user));
@@ -715,14 +754,23 @@ throw_error (GDBusMethodInvocation *context,
}
static User *
+#ifdef HAVE_SHADOW_H
add_new_user_for_pwent (Daemon *daemon,
struct passwd *pwent,
struct spwd *spent)
+#else
+add_new_user_for_pwent (Daemon *daemon,
+ struct passwd *pwent)
+#endif
{
User *user;
user = user_new (daemon, pwent->pw_uid);
+#ifdef HAVE_SHADOW_H
user_update_from_pwent (user, pwent, spent);
+#else
+ user_update_from_pwent (user, pwent);
+#endif
user_register (user);
g_hash_table_insert (daemon->priv->users,
@@ -750,9 +798,13 @@ daemon_local_find_user_by_id (Daemon *daemon,
user = g_hash_table_lookup (daemon->priv->users, pwent->pw_name);
if (user == NULL) {
+#ifdef HAVE_SHADOW_H
struct spwd *spent;
spent = getspnam (pwent->pw_name);
user = add_new_user_for_pwent (daemon, pwent, spent);
+#else
+ user = add_new_user_for_pwent (daemon, pwent);
+#endif
}
return user;
@@ -774,9 +826,13 @@ daemon_local_find_user_by_name (Daemon *daemon,
user = g_hash_table_lookup (daemon->priv->users, pwent->pw_name);
if (user == NULL) {
+#ifdef HAVE_SHADOW_H
struct spwd *spent;
spent = getspnam (pwent->pw_name);
user = add_new_user_for_pwent (daemon, pwent, spent);
+#else
+ user = add_new_user_for_pwent (daemon, pwent);
+#endif
}
return user;
@@ -972,20 +1028,18 @@ daemon_create_user_authorized_cb (Daemon
sys_log (context, "create user '%s'", cd->user_name);
- argv[0] = "/usr/sbin/useradd";
- argv[1] = "-m";
- argv[2] = "-c";
- argv[3] = cd->real_name;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "useradd";
+ argv[2] = cd->user_name;
+ argv[3] = "-m";
+ argv[4] = "-c";
+ argv[5] = cd->real_name;
if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR) {
- argv[4] = "-G";
- argv[5] = ADMIN_GROUP;
- argv[6] = "--";
- argv[7] = cd->user_name;
+ argv[6] = "-G";
+ argv[7] = ADMIN_GROUP;
argv[8] = NULL;
}
else if (cd->account_type == ACCOUNT_TYPE_STANDARD) {
- argv[4] = "--";
- argv[5] = cd->user_name;
argv[6] = NULL;
}
else {
--- src/user-classify.c.orig 2014-03-15 15:09:59.000000000 +0100
+++ src/user-classify.c 2014-03-15 15:11:06.000000000 +0100
@@ -44,6 +44,7 @@
"nobody4",
"noaccess",
"postgres",
+ "pgsql",
"pvm",
"rpm",
"nfsnobody",
@@ -53,6 +54,7 @@
"games",
"man",
"at",
+ "saned",
"gdm",
"gnome-initial-setup"
};
--- src/user.c.orig 2016-09-06 19:48:50 UTC
+++ src/user.c
@@ -145,9 +145,14 @@ account_type_from_pwent (struct passwd *pwent)
}
void
+#ifdef HAVE_SHADOW_H
user_update_from_pwent (User *user,
struct passwd *pwent,
struct spwd *spent)
+#else
+user_update_from_pwent (User *user,
+ struct passwd *pwent)
+#endif
{
gchar *real_name;
gboolean changed;
@@ -247,8 +252,10 @@ user_update_from_pwent (User *user,
}
passwd = NULL;
+#ifdef HAVE_SHADOW_H
if (spent)
passwd = spent->sp_pwdp;
+#endif
if (passwd && passwd[0] == '!') {
locked = TRUE;
@@ -270,11 +277,13 @@ user_update_from_pwent (User *user,
mode = PASSWORD_MODE_NONE;
}
+#ifdef HAVE_SHADOW_H
if (spent) {
if (spent->sp_lstchg == 0) {
mode = PASSWORD_MODE_SET_AT_LOGIN;
}
}
+#endif
if (user->password_mode != mode) {
user->password_mode = mode;
@@ -858,11 +867,11 @@ user_change_real_name_authorized_cb (Daemon
"change real name of user '%s' (%d) to '%s'",
user->user_name, user->uid, name);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-c";
- argv[2] = name;
- argv[3] = "--";
- argv[4] = user->user_name;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "usermod";
+ argv[2] = user->user_name;
+ argv[3] = "-c";
+ argv[4] = name;
argv[5] = NULL;
error = NULL;
@@ -932,11 +941,11 @@ user_change_user_name_authorized_cb (Daemon
"change name of user '%s' (%d) to '%s'",
old_name, user->uid, name);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-l";
- argv[2] = name;
- argv[3] = "--";
- argv[4] = user->user_name;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "usermode";
+ argv[2] = user->user_name;
+ argv[3] = "-n";
+ argv[4] = name;
argv[5] = NULL;
error = NULL;
@@ -1207,20 +1216,19 @@ user_change_home_dir_authorized_cb (Daemon
{
gchar *home_dir = data;
GError *error;
- const gchar *argv[7];
+ const gchar *argv[6];
if (g_strcmp0 (user->home_dir, home_dir) != 0) {
sys_log (context,
"change home directory of user '%s' (%d) to '%s'",
user->user_name, user->uid, home_dir);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-m";
- argv[2] = "-d";
- argv[3] = home_dir;
- argv[4] = "--";
- argv[5] = user->user_name;
- argv[6] = NULL;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "-d";
+ argv[2] = home_dir;
+ argv[3] = "-n";
+ argv[4] = user->user_name;
+ argv[5] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
@@ -1276,11 +1284,11 @@ user_change_shell_authorized_cb (Daemon
"change shell of user '%s' (%d) to '%s'",
user->user_name, user->uid, shell);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-s";
- argv[2] = shell;
- argv[3] = "--";
- argv[4] = user->user_name;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "usermod";
+ argv[2] = user->user_name;
+ argv[3] = "-s";
+ argv[4] = shell;
argv[5] = NULL;
error = NULL;
@@ -1530,17 +1538,16 @@ user_change_locked_authorized_cb (Daemon
{
gboolean locked = GPOINTER_TO_INT (data);
GError *error;
- const gchar *argv[5];
+ const gchar *argv[4];
if (user->locked != locked) {
sys_log (context,
"%s account of user '%s' (%d)",
locked ? "locking" : "unlocking", user->user_name, user->uid);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = locked ? "-L" : "-U";
- argv[2] = "--";
- argv[3] = user->user_name;
- argv[4] = NULL;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = locked ? "lock" : "unlock";
+ argv[2] = user->user_name;
+ argv[3] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
@@ -1649,11 +1656,11 @@ user_change_account_type_authorized_cb (Daemon
g_free (groups);
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-G";
- argv[2] = str->str;
- argv[3] = "--";
- argv[4] = user->user_name;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "usermod";
+ argv[2] = user->user_name;
+ argv[3] = "-G";
+ argv[4] = str->str;
argv[5] = NULL;
g_string_free (str, FALSE);
@@ -1720,10 +1727,8 @@ user_change_password_mode_authorized_cb (Daemon
mode == PASSWORD_MODE_NONE) {
argv[0] = "/usr/bin/passwd";
- argv[1] = "-d";
- argv[2] = "--";
- argv[3] = user->user_name;
- argv[4] = NULL;
+ argv[1] = user->user_name;
+ argv[2] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
@@ -1733,12 +1738,11 @@ user_change_password_mode_authorized_cb (Daemon
}
if (mode == PASSWORD_MODE_SET_AT_LOGIN) {
- argv[0] = "/usr/bin/chage";
- argv[1] = "-d";
+ argv[0] = "/usr/bin/chpass";
+ argv[1] = "-e";
argv[2] = "0";
- argv[3] = "--";
- argv[4] = user->user_name;
- argv[5] = NULL;
+ argv[3] = user->user_name;
+ argv[4] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
@@ -1762,11 +1766,10 @@ user_change_password_mode_authorized_cb (Daemon
}
}
else if (user->locked) {
- argv[0] = "/usr/sbin/usermod";
- argv[1] = "-U";
- argv[2] = "--";
- argv[3] = user->user_name;
- argv[4] = NULL;
+ argv[0] = "/usr/sbin/pw";
+ argv[1] = "unlock";
+ argv[2] = user->user_name;
+ argv[3] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
@@ -1829,7 +1832,7 @@ user_change_password_authorized_cb (Daemon
{
gchar **strings = data;
GError *error;
- const gchar *argv[6];
+ const gchar *argv[5];
sys_log (context,
"set password and hint of user '%s' (%d)",
@@ -1837,12 +1840,11 @@ user_change_password_authorized_cb (Daemon
g_object_freeze_notify (G_OBJECT (user));
- argv[0] = "/usr/sbin/usermod";
+ argv[0] = "/usr/bin/chpass";
argv[1] = "-p";
argv[2] = strings[0];
- argv[3] = "--";
- argv[4] = user->user_name;
- argv[5] = NULL;
+ argv[3] = user->user_name;
+ argv[4] = NULL;
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
--- src/user.h.orig 2016-09-06 17:31:50 UTC
+++ src/user.h
@@ -22,7 +22,9 @@
#include <sys/types.h>
#include <pwd.h>
+#ifdef HAVE_SHADOW_H
#include <shadow.h>
+#endif
#include <glib.h>
#include <gio/gio.h>
@@ -54,9 +56,14 @@ GType user_get_type (void) G_G
User * user_new (Daemon *daemon,
uid_t uid);
+#ifdef HAVE_SHADOW_H
void user_update_from_pwent (User *user,
struct passwd *pwent,
struct spwd *spent);
+#else
+void user_update_from_pwent (User *user,
+ struct passwd *pwent);
+#endif
void user_update_from_keyfile (User *user,
GKeyFile *keyfile);
void user_update_local_account_property (User *user,
--- src/wtmp-helper.h.orig 2016-09-06 19:48:50 UTC
+++ src/wtmp-helper.h
@@ -23,7 +23,6 @@
#include <glib.h>
#include <pwd.h>
-#include <shadow.h>
const gchar * wtmp_helper_get_path_for_monitor (void);
void wtmp_helper_update_login_frequencies (GHashTable *users);
The AccountsService project provides
o A set of D-Bus interfaces for querying and manipulating
user account information.
o An implementation of these interfaces based on the usermod(8),
useradd(8) and userdel(8) commands.