pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

accountsservice: push forward a little bit, from openbsd ports



Module Name:	pkgsrc-wip
Committed By:	Maya Rashish <maya%NetBSD.org@localhost>
Pushed By:	coypu
Date:		Fri May 29 23:10:27 2020 +0300
Changeset:	4677586fb5a1c88425a6e6a03578cca7d3aa0c2f

Modified Files:
	accountsservice/distinfo
	accountsservice/patches/patch-meson.build
Added Files:
	accountsservice/patches/patch-src_daemon.c
	accountsservice/patches/patch-src_user.c
	accountsservice/patches/patch-src_user.h
	accountsservice/patches/patch-src_wtmp-helper.h

Log Message:
accountsservice: push forward a little bit, from openbsd ports

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4677586fb5a1c88425a6e6a03578cca7d3aa0c2f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 accountsservice/distinfo                        |   7 +-
 accountsservice/patches/patch-meson.build       |  12 ++-
 accountsservice/patches/patch-src_daemon.c      | 108 ++++++++++++++++++++++++
 accountsservice/patches/patch-src_user.c        |  37 ++++++++
 accountsservice/patches/patch-src_user.h        |  14 +++
 accountsservice/patches/patch-src_wtmp-helper.h |  14 +++
 6 files changed, 188 insertions(+), 4 deletions(-)

diffs:
diff --git a/accountsservice/distinfo b/accountsservice/distinfo
index 1f0acddd45..115d0291fb 100644
--- a/accountsservice/distinfo
+++ b/accountsservice/distinfo
@@ -4,5 +4,8 @@ SHA1 (accountsservice-0.6.55.tar.xz) = bab4f37144196d8ba06195bc72b4a9937c62b9fd
 RMD160 (accountsservice-0.6.55.tar.xz) = 80144b2c703645e15cb59e8aa8f2966b70054484
 SHA512 (accountsservice-0.6.55.tar.xz) = c12e6a8e80f9b087f97238da4734d2d3a14a7c5cbd870a32a04b00116f176c818c39fb886f6dc72c3e93c136b0c2074ddf8f77e20431fa3bd54f138bea9d262d
 Size (accountsservice-0.6.55.tar.xz) = 97972 bytes
-SHA1 (patch-meson.build) = dc85949c195f43aba8697c09a8e367bda5f12e32
-SHA1 (patch-src_wtmp-helper.c) = eb32d598784f31e9baac44bd63ab248f5873c9c3
+SHA1 (patch-meson.build) = 1cf810fe17ae59caf4cc6c84826133521d5dcf92
+SHA1 (patch-src_daemon.c) = 5e1eff5d6a17e1b86ba1461508f90047157ca74d
+SHA1 (patch-src_user.c) = a4c2ed335f3b7f58326911482dae25339dcb3d78
+SHA1 (patch-src_user.h) = eacd388f4728f7bf2e34b97d622d154ffd75a782
+SHA1 (patch-src_wtmp-helper.h) = 848e73291fa8fe10d758343eac798bbeed212e2d
diff --git a/accountsservice/patches/patch-meson.build b/accountsservice/patches/patch-meson.build
index 442316a46a..f70d0d9ea5 100644
--- a/accountsservice/patches/patch-meson.build
+++ b/accountsservice/patches/patch-meson.build
@@ -5,7 +5,15 @@ $NetBSD$
 
 --- meson.build.orig	2019-04-23 15:16:09.000000000 +0000
 +++ meson.build
-@@ -79,6 +79,8 @@ endforeach
+@@ -60,6 +60,7 @@ check_headers = [
+   'paths.h',
+   'shadow.h',
+   'utmpx.h',
++  'grp.h',
+ ]
+ 
+ foreach header: check_headers
+@@ -79,6 +80,8 @@ endforeach
  
  if cc.has_header_symbol('utmpx.h', 'WTMPX_FILENAME', prefix: '#define _GNU_SOURCE')
    config_h.set('PATH_WTMP', 'WTMPX_FILENAME')
@@ -14,7 +22,7 @@ $NetBSD$
  elif cc.has_header_symbol('paths.h', '_PATH_WTMPX')
    config_h.set('PATH_WTMP', '_PATH_WTMPX')
  else
-@@ -138,8 +140,9 @@ install_systemd_unit_dir = (systemd_syst
+@@ -138,8 +141,9 @@ install_systemd_unit_dir = (systemd_syst
  
  if install_systemd_unit_dir and systemd_system_unit_dir == ''
    systemd_dep = dependency('systemd', required: false)
diff --git a/accountsservice/patches/patch-src_daemon.c b/accountsservice/patches/patch-src_daemon.c
new file mode 100644
index 0000000000..55f8a61b45
--- /dev/null
+++ b/accountsservice/patches/patch-src_daemon.c
@@ -0,0 +1,108 @@
+$NetBSD$
+
+--- src/daemon.c.orig	2019-04-23 15:16:09.000000000 +0000
++++ src/daemon.c
+@@ -36,6 +36,10 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ 
++#ifdef HAVE_GRP_H
++#include <grp.h> /* getgrnam */
++#endif
++
+ #include <glib.h>
+ #include <glib/gi18n.h>
+ #include <glib-object.h>
+@@ -49,7 +53,11 @@
+ #include "util.h"
+ 
+ #define PATH_PASSWD "/etc/passwd"
++#if defined (HAVE_SHADOW_H)
+ #define PATH_SHADOW "/etc/shadow"
++#elif defined (_PATH_MASTERPASSWD)
++#define PATH_SHADOW _PATH_MASTERPASSWD
++#endif
+ #define PATH_GROUP "/etc/group"
+ 
+ enum {
+@@ -1096,7 +1104,7 @@ daemon_create_user_authorized_cb (Daemon
+         CreateUserData *cd = data;
+         User *user;
+         g_autoptr(GError) error = NULL;
+-        const gchar *argv[9];
++        const gchar *argv[11];
+         g_autofree gchar *admin_groups = NULL;
+ 
+         if (getpwnam (cd->user_name) != NULL) {
+@@ -1119,9 +1127,17 @@ daemon_create_user_authorized_cb (Daemon
+ 
+                 argv[4] = "-G";
+                 argv[5] = admin_groups;
++#if defined(__OpenBSD__) || defined(__NetBSD__)
++		argv[6] = "-L";
++		argv[7] = "staff";
++		argv[8] = "--";
++		argv[9] = cd->user_name;
++		argv[10] = NULL;
++#else
+                 argv[6] = "--";
+                 argv[7] = cd->user_name;
+                 argv[8] = NULL;
++#endif
+         }
+         else if (cd->account_type == ACCOUNT_TYPE_STANDARD) {
+                 argv[4] = "--";
+@@ -1302,6 +1318,34 @@ daemon_delete_user_authorized_cb (Daemon
+                 return;
+         }
+ 
++/*
++ * Under OpenBSD there is no /etc/login.defs (for USERGROUPS_ENAB), so
++ * we need to explicitely remove the user's group if it contains no more
++ * members and matches the username.
++ */
++#ifdef __OpenBSD__
++        struct group *grp;
++        GError *grperror;
++        const gchar *grpargv[3];
++
++        grp = getgrnam (pwent->pw_name);
++
++        if ((grp != NULL) && (*grp->gr_name == *pwent->pw_name) && (*grp->gr_mem == NULL)) {
++                sys_log (context, "delete group '%d'", pwent->pw_gid);
++
++                grpargv[0] = "/usr/sbin/groupdel";
++                grpargv[1] = pwent->pw_name;
++                grpargv[2] = NULL;
++
++                grperror = NULL;
++                if (!spawn_with_login_uid (context, grpargv, &grperror)) {
++                    throw_error (context, ERROR_FAILED, "running '%s' failed: %s", grpargv[0], grperror->message);
++                    g_error_free (grperror);
++                    return;
++                }
++        }
++#endif
++
+         sys_log (context, "delete user '%s' (%d)", pwent->pw_name, ud->uid);
+ 
+         user = daemon_local_find_user_by_id (daemon, ud->uid);
+@@ -1320,11 +1364,18 @@ daemon_delete_user_authorized_cb (Daemon
+ 
+         argv[0] = "/usr/sbin/userdel";
+         if (ud->remove_files) {
++#ifdef __OpenBSD__
++                argv[1] = "-r";
++                argv[2] = "--";
++                argv[3] = pwent->pw_name;
++                argv[4] = NULL;
++#else
+                 argv[1] = "-f";
+                 argv[2] = "-r";
+                 argv[3] = "--";
+                 argv[4] = pwent->pw_name;
+                 argv[5] = NULL;
++#endif
+         }
+         else {
+                 argv[1] = "-f";
diff --git a/accountsservice/patches/patch-src_user.c b/accountsservice/patches/patch-src_user.c
new file mode 100644
index 0000000000..613384056a
--- /dev/null
+++ b/accountsservice/patches/patch-src_user.c
@@ -0,0 +1,37 @@
+$NetBSD$
+
+--- src/user.c.orig	2019-04-23 15:16:09.000000000 +0000
++++ src/user.c
+@@ -202,7 +202,20 @@ user_update_from_pwent (User          *u
+         if (spent)
+                 passwd = spent->sp_pwdp;
+ 
++#ifdef __OpenBSD__
++        pw = getpwnam_shadow (pwent->pw_name);
++        if (pw)
++                passwd = pw->pw_passwd;
++        if (g_strcmp0(passwd, "skey") == 0)
++                passwd = NULL;
++#endif
++
++
++#ifdef __OpenBSD__
++        if (passwd && passwd[0] == '*') {
++#else
+         if (passwd && passwd[0] == '!') {
++#endif
+                 locked = TRUE;
+         }
+         else {
+@@ -1602,7 +1615,11 @@ user_change_locked_authorized_cb (Daemon
+                          accounts_user_get_user_name (ACCOUNTS_USER (user)),
+                          accounts_user_get_uid (ACCOUNTS_USER (user)));
+                 argv[0] = "/usr/sbin/usermod";
++#ifdef __OpenBSD__
++                argv[1] = locked ? "-Z" : "-U";
++#else
+                 argv[1] = locked ? "-L" : "-U";
++#endif
+                 argv[2] = "--";
+                 argv[3] = accounts_user_get_user_name (ACCOUNTS_USER (user));
+                 argv[4] = NULL;
diff --git a/accountsservice/patches/patch-src_user.h b/accountsservice/patches/patch-src_user.h
new file mode 100644
index 0000000000..4a083ffe69
--- /dev/null
+++ b/accountsservice/patches/patch-src_user.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- src/user.h.orig	2019-04-23 15:16:09.000000000 +0000
++++ 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>
diff --git a/accountsservice/patches/patch-src_wtmp-helper.h b/accountsservice/patches/patch-src_wtmp-helper.h
new file mode 100644
index 0000000000..6aabda6a46
--- /dev/null
+++ b/accountsservice/patches/patch-src_wtmp-helper.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- src/wtmp-helper.h.orig	2019-04-23 15:16:09.000000000 +0000
++++ src/wtmp-helper.h
+@@ -23,7 +23,9 @@
+ 
+ #include <glib.h>
+ #include <pwd.h>
++#ifdef HAVE_SHADOW_H
+ #include <shadow.h>
++#endif
+ 
+ const gchar *           wtmp_helper_get_path_for_monitor                (void);
+ void                    wtmp_helper_update_login_frequencies            (GHashTable *users);


Home | Main Index | Thread Index | Old Index