Import Debian changes 0.6.55-ok1

accountsservice (0.6.55-ok1) yangtze; urgency=medium

  * Sync kylin-desktop
This commit is contained in:
Luo Yaoming 2022-08-14 17:21:38 +08:00 committed by luoyaoming
parent d419ce00dd
commit b81db2d1a1
35 changed files with 4270 additions and 0 deletions

9
debian/accountsservice.install vendored Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/dh-exec
etc
lib [linux-any]
usr/lib/accountsservice
usr/share/dbus-1
usr/share/language-tools
usr/share/locale
usr/share/polkit-1
var

23
debian/accountsservice.postinst vendored Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
get_pid() {
[ -n "$1" ] || return 0
[ -S /var/run/dbus/system_bus_socket ] || return 0
dbus-send --system --dest=org.freedesktop.DBus --print-reply \
/org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
string:$1 2>/dev/null | awk '/uint32/ {print $2}'
}
if [ "$1" = "configure" -a ! -d /run/systemd/system ]; then
# stop accounts-daemon
pid=$(get_pid org.freedesktop.Accounts)
kill $pid 2>/dev/null || true
# restart daemon if it was running before
[ -z "$pid" ] || /usr/lib/accountsservice/accounts-daemon & >/dev/null || true # will trigger through D-Bus activation
fi
#DEBHELPER#

18
debian/accountsservice.prerm vendored Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
set -e
get_pid() {
[ -n "$1" ] || return 0
[ -S /var/run/dbus/system_bus_socket ] || return 0
dbus-send --system --dest=org.freedesktop.DBus --print-reply \
/org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
string:$1 2>/dev/null | awk '/uint32/ {print $2}'
}
if [ "$1" = "remove" -a ! -d /run/systemd/system ]; then
kill $(get_pid org.freedesktop.Accounts) 2>/dev/null || true
fi
#DEBHELPER#

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
accountsservice (0.6.55-ok1) yangtze; urgency=medium
* Sync kylin-desktop
-- Luo Yaoming <luoyaoming@kylinos.cn> Sun, 14 Aug 2022 17:21:38 +0800

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
10

102
debian/control vendored Normal file
View File

@ -0,0 +1,102 @@
Source: accountsservice
Section: admin
Priority: optional
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
XSBC-Original-Maintainer: Debian freedesktop.org maintainers <pkg-freedesktop-maintainers@lists.alioth.debian.org>
Uploaders: Emilio Pozuelo Monfort <pochu@debian.org>
Build-Depends: debhelper (>= 10),
dh-exec (>= 0.13),
dh-translations,
gettext,
gir1.2-freedesktop,
gir1.2-glib-2.0 (>= 1.34),
gobject-introspection (>= 0.9.12-4~),
gtk-doc-tools,
libdbus-1-dev,
libgirepository1.0-dev (>= 0.9.12),
libglib2.0-dev (>= 2.44),
libpolkit-gobject-1-dev,
libsystemd-dev (>= 209) [linux-any],
meson (>= 0.46.0),
policykit-1,
xmlto
Standards-Version: 4.1.0
Homepage: https://www.freedesktop.org/wiki/Software/AccountsService/
Vcs-Git: https://anonscm.debian.org/git/collab-maint/accountsservice.git
Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/accountsservice.git
Package: accountsservice
Architecture: any
Depends: dbus,
libaccountsservice0 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Suggests: gnome-control-center
Description: query and manipulate user account information
The AccountService project provides a set of D-Bus
interfaces for querying and manipulating user account
information and an implementation of these interfaces,
based on the useradd, usermod and userdel commands.
Package: libaccountsservice0
Section: libs
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends}, ${shlibs:Depends}
Breaks: accountsservice (<< 0.6.5)
Description: query and manipulate user account information - shared libraries
The AccountService project provides a set of D-Bus
interfaces for querying and manipulating user account
information and an implementation of these interfaces,
based on the useradd, usermod and userdel commands.
.
This package provides the shared libraries of the
AccountService library.
Package: libaccountsservice-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: gir1.2-accountsservice-1.0 (= ${binary:Version}),
libaccountsservice0 (= ${binary:Version}),
libglib2.0-dev (>= 2.25.11),
libpolkit-gobject-1-dev,
${misc:Depends}
Description: query and manipulate user account information - header files
The AccountService project provides a set of D-Bus
interfaces for querying and manipulating user account
information and an implementation of these interfaces,
based on the useradd, usermod and userdel commands.
.
This package provides the development files for the
AccountService library.
Package: gir1.2-accountsservice-1.0
Section: introspection
Architecture: any
Multi-Arch: foreign
Depends: ${gir:Depends}, ${misc:Depends}, ${shlibs:Depends}
Replaces: gir1.2-accountservice-1.0 (<< 0.6.12-4)
Breaks: gir1.2-accountservice-1.0 (<< 0.6.12-4)
Description: GObject introspection data for AccountService
The AccountService project provides a set of D-Bus
interfaces for querying and manipulating user account
information and an implementation of these interfaces,
based on the useradd, usermod and userdel commands.
.
This package provides the introspection data for the
AccountService library.
Package: libaccountsservice-doc
Section: doc
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}
Description: query and manipulate user account information - documentation
The AccountService project provides a set of D-Bus
interfaces for querying and manipulating user account
information and an implementation of these interfaces,
based on the useradd, usermod and userdel commands.
.
This package provides the developers reference for the
AccountService library.

58
debian/copyright vendored Normal file
View File

@ -0,0 +1,58 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: AccountsService
Upstream-Contact: Matthias Clasen <mclasen@redhat.com>
Source: http://cgit.freedesktop.org/accountsservice/
Files: *
Copyright:
2009-2010 Red Hat, Inc
2013 Canonical Limited
License: GPL-3+
Files: src/user.c
src/libaccountsservice/act-user.*
src/libaccountsservice/act-user.manager.*
doc/dbus/spec-to-docbook.xsl
Copyright:
2009-2010 Red Hat, Inc
2007-2008 William Jon McCann <mccann@jhu.edu>
2004-2005 James M. Cape <jcape@ignore-your.tv>
License: GPL-2+
Files: debian/*
Copyright: 2011-2014 Alessio Treglia <alessio@debian.org>
License: GPL-3+
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems the full text of the GNU General Public
License can be found in the `/usr/share/common-licenses/GPL-3' file.
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems the full text of the GNU General Public
License can be found in the `/usr/share/common-licenses/GPL-2' file.

2
debian/docs vendored Normal file
View File

@ -0,0 +1,2 @@
README.md
TODO

3
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
pristine-tar = True
compression = xz

View File

@ -0,0 +1 @@
usr/lib/*/girepository-1.0 usr/lib/

4
debian/libaccountsservice-dev.install vendored Normal file
View File

@ -0,0 +1,4 @@
usr/include
usr/lib/*/*.so
usr/lib/*/pkgconfig
usr/share/gir-1.0

1
debian/libaccountsservice-doc.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/gtk-doc/html/ usr/share/doc/libaccountsservice-doc/

1
debian/libaccountsservice-doc.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/libaccountsservice-doc/html usr/share/gtk-doc/html/libaccountsservice

1
debian/libaccountsservice0.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/*/*.so.*

552
debian/libaccountsservice0.symbols vendored Normal file
View File

@ -0,0 +1,552 @@
libaccountsservice.so.0 libaccountsservice0 #MINVER#
accounts_accounts_call_cache_user@Base 0.6.24
accounts_accounts_call_cache_user_finish@Base 0.6.24
accounts_accounts_call_cache_user_sync@Base 0.6.24
accounts_accounts_call_create_user@Base 0.6.18
accounts_accounts_call_create_user_finish@Base 0.6.18
accounts_accounts_call_create_user_sync@Base 0.6.18
accounts_accounts_call_delete_user@Base 0.6.18
accounts_accounts_call_delete_user_finish@Base 0.6.18
accounts_accounts_call_delete_user_sync@Base 0.6.18
accounts_accounts_call_find_user_by_id@Base 0.6.18
accounts_accounts_call_find_user_by_id_finish@Base 0.6.18
accounts_accounts_call_find_user_by_id_sync@Base 0.6.18
accounts_accounts_call_find_user_by_name@Base 0.6.18
accounts_accounts_call_find_user_by_name_finish@Base 0.6.18
accounts_accounts_call_find_user_by_name_sync@Base 0.6.18
accounts_accounts_call_list_cached_users@Base 0.6.18
accounts_accounts_call_list_cached_users_finish@Base 0.6.18
accounts_accounts_call_list_cached_users_sync@Base 0.6.18
accounts_accounts_call_uncache_user@Base 0.6.24
accounts_accounts_call_uncache_user_finish@Base 0.6.24
accounts_accounts_call_uncache_user_sync@Base 0.6.24
accounts_accounts_complete_cache_user@Base 0.6.24
accounts_accounts_complete_create_user@Base 0.6.18
accounts_accounts_complete_delete_user@Base 0.6.18
accounts_accounts_complete_find_user_by_id@Base 0.6.18
accounts_accounts_complete_find_user_by_name@Base 0.6.18
accounts_accounts_complete_list_cached_users@Base 0.6.18
accounts_accounts_complete_uncache_user@Base 0.6.24
accounts_accounts_dup_automatic_login_users@Base 0.6.50
accounts_accounts_dup_daemon_version@Base 0.6.18
accounts_accounts_emit_user_added@Base 0.6.18
accounts_accounts_emit_user_deleted@Base 0.6.18
accounts_accounts_get_automatic_login_users@Base 0.6.50
accounts_accounts_get_daemon_version@Base 0.6.18
accounts_accounts_get_has_multiple_users@Base 0.6.50
accounts_accounts_get_has_no_users@Base 0.6.50
accounts_accounts_get_type@Base 0.6.18
accounts_accounts_interface_info@Base 0.6.18
accounts_accounts_override_properties@Base 0.6.18
accounts_accounts_proxy_get_type@Base 0.6.18
accounts_accounts_proxy_new@Base 0.6.18
accounts_accounts_proxy_new_finish@Base 0.6.18
accounts_accounts_proxy_new_for_bus@Base 0.6.18
accounts_accounts_proxy_new_for_bus_finish@Base 0.6.18
accounts_accounts_proxy_new_for_bus_sync@Base 0.6.18
accounts_accounts_proxy_new_sync@Base 0.6.18
accounts_accounts_set_automatic_login_users@Base 0.6.50
accounts_accounts_set_daemon_version@Base 0.6.18
accounts_accounts_set_has_multiple_users@Base 0.6.50
accounts_accounts_set_has_no_users@Base 0.6.50
accounts_accounts_skeleton_get_type@Base 0.6.18
accounts_accounts_skeleton_new@Base 0.6.18
accounts_user_call_get_password_expiration_policy@Base 0.6.45
accounts_user_call_get_password_expiration_policy_finish@Base 0.6.45
accounts_user_call_get_password_expiration_policy_sync@Base 0.6.45
accounts_user_call_set_account_type@Base 0.6.18
accounts_user_call_set_account_type_finish@Base 0.6.18
accounts_user_call_set_account_type_sync@Base 0.6.18
accounts_user_call_set_automatic_login@Base 0.6.18
accounts_user_call_set_automatic_login_finish@Base 0.6.18
accounts_user_call_set_automatic_login_sync@Base 0.6.18
accounts_user_call_set_background_file@Base 0.6.29
accounts_user_call_set_background_file_finish@Base 0.6.29
accounts_user_call_set_background_file_sync@Base 0.6.29
accounts_user_call_set_email@Base 0.6.18
accounts_user_call_set_email_finish@Base 0.6.18
accounts_user_call_set_email_sync@Base 0.6.18
accounts_user_call_set_formats_locale@Base 0.6.29
accounts_user_call_set_formats_locale_finish@Base 0.6.29
accounts_user_call_set_formats_locale_sync@Base 0.6.29
accounts_user_call_set_home_directory@Base 0.6.18
accounts_user_call_set_home_directory_finish@Base 0.6.18
accounts_user_call_set_home_directory_sync@Base 0.6.18
accounts_user_call_set_icon_file@Base 0.6.18
accounts_user_call_set_icon_file_finish@Base 0.6.18
accounts_user_call_set_icon_file_sync@Base 0.6.18
accounts_user_call_set_input_sources@Base 0.6.40
accounts_user_call_set_input_sources_finish@Base 0.6.40
accounts_user_call_set_input_sources_sync@Base 0.6.40
accounts_user_call_set_language@Base 0.6.18
accounts_user_call_set_language_finish@Base 0.6.18
accounts_user_call_set_language_sync@Base 0.6.18
accounts_user_call_set_location@Base 0.6.18
accounts_user_call_set_location_finish@Base 0.6.18
accounts_user_call_set_location_sync@Base 0.6.18
accounts_user_call_set_locked@Base 0.6.18
accounts_user_call_set_locked_finish@Base 0.6.18
accounts_user_call_set_locked_sync@Base 0.6.18
accounts_user_call_set_password@Base 0.6.18
accounts_user_call_set_password_finish@Base 0.6.18
accounts_user_call_set_password_hint@Base 0.6.43
accounts_user_call_set_password_hint_finish@Base 0.6.43
accounts_user_call_set_password_hint_sync@Base 0.6.43
accounts_user_call_set_password_mode@Base 0.6.18
accounts_user_call_set_password_mode_finish@Base 0.6.18
accounts_user_call_set_password_mode_sync@Base 0.6.18
accounts_user_call_set_password_sync@Base 0.6.18
accounts_user_call_set_real_name@Base 0.6.18
accounts_user_call_set_real_name_finish@Base 0.6.18
accounts_user_call_set_real_name_sync@Base 0.6.18
accounts_user_call_set_session@Base 0.6.55
accounts_user_call_set_session_finish@Base 0.6.55
accounts_user_call_set_session_sync@Base 0.6.55
accounts_user_call_set_session_type@Base 0.6.55
accounts_user_call_set_session_type_finish@Base 0.6.55
accounts_user_call_set_session_type_sync@Base 0.6.55
accounts_user_call_set_shell@Base 0.6.18
accounts_user_call_set_shell_finish@Base 0.6.18
accounts_user_call_set_shell_sync@Base 0.6.18
accounts_user_call_set_user_name@Base 0.6.18
accounts_user_call_set_user_name_finish@Base 0.6.18
accounts_user_call_set_user_name_sync@Base 0.6.18
accounts_user_call_set_xhas_messages@Base 0.6.29
accounts_user_call_set_xhas_messages_finish@Base 0.6.29
accounts_user_call_set_xhas_messages_sync@Base 0.6.29
accounts_user_call_set_xkeyboard_layouts@Base 0.6.29
accounts_user_call_set_xkeyboard_layouts_finish@Base 0.6.29
accounts_user_call_set_xkeyboard_layouts_sync@Base 0.6.29
accounts_user_call_set_xsession@Base 0.6.18
accounts_user_call_set_xsession_finish@Base 0.6.18
accounts_user_call_set_xsession_sync@Base 0.6.18
accounts_user_complete_get_password_expiration_policy@Base 0.6.45
accounts_user_complete_set_account_type@Base 0.6.18
accounts_user_complete_set_automatic_login@Base 0.6.18
accounts_user_complete_set_background_file@Base 0.6.29
accounts_user_complete_set_email@Base 0.6.18
accounts_user_complete_set_formats_locale@Base 0.6.29
accounts_user_complete_set_home_directory@Base 0.6.18
accounts_user_complete_set_icon_file@Base 0.6.18
accounts_user_complete_set_input_sources@Base 0.6.40
accounts_user_complete_set_language@Base 0.6.18
accounts_user_complete_set_location@Base 0.6.18
accounts_user_complete_set_locked@Base 0.6.18
accounts_user_complete_set_password@Base 0.6.18
accounts_user_complete_set_password_hint@Base 0.6.43
accounts_user_complete_set_password_mode@Base 0.6.18
accounts_user_complete_set_real_name@Base 0.6.18
accounts_user_complete_set_session@Base 0.6.55
accounts_user_complete_set_session_type@Base 0.6.55
accounts_user_complete_set_shell@Base 0.6.18
accounts_user_complete_set_user_name@Base 0.6.18
accounts_user_complete_set_xhas_messages@Base 0.6.29
accounts_user_complete_set_xkeyboard_layouts@Base 0.6.29
accounts_user_complete_set_xsession@Base 0.6.18
accounts_user_dup_background_file@Base 0.6.29
accounts_user_dup_email@Base 0.6.18
accounts_user_dup_formats_locale@Base 0.6.29
accounts_user_dup_home_directory@Base 0.6.18
accounts_user_dup_icon_file@Base 0.6.18
accounts_user_dup_input_sources@Base 0.6.40
accounts_user_dup_language@Base 0.6.18
accounts_user_dup_location@Base 0.6.18
accounts_user_dup_login_history@Base 0.6.29
accounts_user_dup_password_hint@Base 0.6.18
accounts_user_dup_real_name@Base 0.6.18
accounts_user_dup_session@Base 0.6.55
accounts_user_dup_session_type@Base 0.6.55
accounts_user_dup_shell@Base 0.6.18
accounts_user_dup_user_name@Base 0.6.18
accounts_user_dup_xkeyboard_layouts@Base 0.6.29
accounts_user_dup_xsession@Base 0.6.18
accounts_user_emit_changed@Base 0.6.18
accounts_user_get_account_type@Base 0.6.18
accounts_user_get_automatic_login@Base 0.6.18
accounts_user_get_background_file@Base 0.6.29
accounts_user_get_email@Base 0.6.18
accounts_user_get_formats_locale@Base 0.6.29
accounts_user_get_home_directory@Base 0.6.18
accounts_user_get_icon_file@Base 0.6.18
accounts_user_get_input_sources@Base 0.6.40
accounts_user_get_language@Base 0.6.18
accounts_user_get_local_account@Base 0.6.24
accounts_user_get_location@Base 0.6.18
accounts_user_get_locked@Base 0.6.18
accounts_user_get_login_frequency@Base 0.6.18
accounts_user_get_login_history@Base 0.6.29
accounts_user_get_login_time@Base 0.6.29
accounts_user_get_password_hint@Base 0.6.18
accounts_user_get_password_mode@Base 0.6.18
accounts_user_get_real_name@Base 0.6.18
accounts_user_get_saved@Base 0.6.55
accounts_user_get_session@Base 0.6.55
accounts_user_get_session_type@Base 0.6.55
accounts_user_get_shell@Base 0.6.18
accounts_user_get_system_account@Base 0.6.18
accounts_user_get_type@Base 0.6.18
accounts_user_get_uid@Base 0.6.18
accounts_user_get_user_name@Base 0.6.18
accounts_user_get_xhas_messages@Base 0.6.29
accounts_user_get_xkeyboard_layouts@Base 0.6.29
accounts_user_get_xsession@Base 0.6.18
accounts_user_interface_info@Base 0.6.18
accounts_user_override_properties@Base 0.6.18
accounts_user_proxy_get_type@Base 0.6.18
accounts_user_proxy_new@Base 0.6.18
accounts_user_proxy_new_finish@Base 0.6.18
accounts_user_proxy_new_for_bus@Base 0.6.18
accounts_user_proxy_new_for_bus_finish@Base 0.6.18
accounts_user_proxy_new_for_bus_sync@Base 0.6.18
accounts_user_proxy_new_sync@Base 0.6.18
accounts_user_set_account_type@Base 0.6.18
accounts_user_set_automatic_login@Base 0.6.18
accounts_user_set_background_file@Base 0.6.29
accounts_user_set_email@Base 0.6.18
accounts_user_set_formats_locale@Base 0.6.29
accounts_user_set_home_directory@Base 0.6.18
accounts_user_set_icon_file@Base 0.6.18
accounts_user_set_input_sources@Base 0.6.40
accounts_user_set_language@Base 0.6.18
accounts_user_set_local_account@Base 0.6.24
accounts_user_set_location@Base 0.6.18
accounts_user_set_locked@Base 0.6.18
accounts_user_set_login_frequency@Base 0.6.18
accounts_user_set_login_history@Base 0.6.29
accounts_user_set_login_time@Base 0.6.29
accounts_user_set_password_hint@Base 0.6.18
accounts_user_set_password_mode@Base 0.6.18
accounts_user_set_real_name@Base 0.6.18
accounts_user_set_saved@Base 0.6.55
accounts_user_set_session@Base 0.6.55
accounts_user_set_session_type@Base 0.6.55
accounts_user_set_shell@Base 0.6.18
accounts_user_set_system_account@Base 0.6.18
accounts_user_set_uid@Base 0.6.18
accounts_user_set_user_name@Base 0.6.18
accounts_user_set_xhas_messages@Base 0.6.29
accounts_user_set_xkeyboard_layouts@Base 0.6.29
accounts_user_set_xsession@Base 0.6.18
accounts_user_skeleton_get_type@Base 0.6.18
accounts_user_skeleton_new@Base 0.6.18
act_user_account_type_get_type@Base 0.6.8
act_user_collate@Base 0.6.8
act_user_get_account_type@Base 0.6.8
act_user_get_automatic_login@Base 0.6.8
act_user_get_background_file@Base 0.6.29
act_user_get_email@Base 0.6.8
act_user_get_formats_locale@Base 0.6.29
act_user_get_home_dir@Base 0.6.8
act_user_get_icon_file@Base 0.6.8
act_user_get_input_sources@Base 0.6.40
act_user_get_language@Base 0.6.8
act_user_get_location@Base 0.6.8
act_user_get_locked@Base 0.6.8
act_user_get_login_frequency@Base 0.6.8
act_user_get_login_history@Base 0.6.29
act_user_get_login_time@Base 0.6.29
act_user_get_num_sessions@Base 0.6.8
act_user_get_num_sessions_anywhere@Base 0.6.34
act_user_get_object_path@Base 0.6.8
act_user_get_password_expiration_policy@Base 0.6.45
act_user_get_password_hint@Base 0.6.8
act_user_get_password_mode@Base 0.6.8
act_user_get_primary_session_id@Base 0.6.8
act_user_get_real_name@Base 0.6.8
act_user_get_saved@Base 0.6.55
act_user_get_session@Base 0.6.55
act_user_get_session_type@Base 0.6.55
act_user_get_shell@Base 0.6.8
act_user_get_type@Base 0.6.8
act_user_get_uid@Base 0.6.8
act_user_get_user_name@Base 0.6.8
act_user_get_x_has_messages@Base 0.6.29
act_user_get_x_keyboard_layouts@Base 0.6.29
act_user_get_x_session@Base 0.6.8
act_user_is_loaded@Base 0.6.8
act_user_is_local_account@Base 0.6.24
act_user_is_logged_in@Base 0.6.8
act_user_is_logged_in_anywhere@Base 0.6.34
act_user_is_nonexistent@Base 0.6.37
act_user_is_system_account@Base 0.6.9
act_user_manager_activate_user_session@Base 0.6.8
act_user_manager_cache_user@Base 0.6.24
act_user_manager_cache_user_async@Base 0.6.29
act_user_manager_cache_user_finish@Base 0.6.29
act_user_manager_can_switch@Base 0.6.8
act_user_manager_create_user@Base 0.6.12
act_user_manager_create_user_async@Base 0.6.29
act_user_manager_create_user_finish@Base 0.6.29
act_user_manager_delete_user@Base 0.6.13
act_user_manager_delete_user_async@Base 0.6.29
act_user_manager_delete_user_finish@Base 0.6.29
act_user_manager_error_get_type@Base 0.6.18
act_user_manager_error_quark@Base 0.6.8
act_user_manager_get_default@Base 0.6.8
act_user_manager_get_type@Base 0.6.8
act_user_manager_get_user@Base 0.6.8
act_user_manager_get_user_by_id@Base 0.6.30
act_user_manager_goto_login_session@Base 0.6.8
act_user_manager_list_users@Base 0.6.8
act_user_manager_no_service@Base 0.6.30
act_user_manager_uncache_user@Base 0.6.24
act_user_manager_uncache_user_async@Base 0.6.40
act_user_manager_uncache_user_finish@Base 0.6.40
act_user_password_mode_get_type@Base 0.6.8
act_user_set_account_type@Base 0.6.8
act_user_set_automatic_login@Base 0.6.8
act_user_set_background_file@Base 0.6.29
act_user_set_email@Base 0.6.8
act_user_set_formats_locale@Base 0.6.29
act_user_set_icon_file@Base 0.6.8
act_user_set_input_sources@Base 0.6.40
act_user_set_language@Base 0.6.8
act_user_set_location@Base 0.6.8
act_user_set_locked@Base 0.6.8
act_user_set_password@Base 0.6.8
act_user_set_password_hint@Base 0.6.43
act_user_set_password_mode@Base 0.6.8
act_user_set_real_name@Base 0.6.8
act_user_set_session@Base 0.6.55
act_user_set_session_type@Base 0.6.55
act_user_set_user_name@Base 0.6.8
act_user_set_x_has_messages@Base 0.6.29
act_user_set_x_keyboard_layouts@Base 0.6.29
act_user_set_x_session@Base 0.6.8
console_kit_manager_call_can_restart@Base 0.6.18
console_kit_manager_call_can_restart_finish@Base 0.6.18
console_kit_manager_call_can_restart_sync@Base 0.6.18
console_kit_manager_call_can_stop@Base 0.6.18
console_kit_manager_call_can_stop_finish@Base 0.6.18
console_kit_manager_call_can_stop_sync@Base 0.6.18
console_kit_manager_call_close_session@Base 0.6.18
console_kit_manager_call_close_session_finish@Base 0.6.18
console_kit_manager_call_close_session_sync@Base 0.6.18
console_kit_manager_call_get_current_session@Base 0.6.18
console_kit_manager_call_get_current_session_finish@Base 0.6.18
console_kit_manager_call_get_current_session_sync@Base 0.6.18
console_kit_manager_call_get_seats@Base 0.6.18
console_kit_manager_call_get_seats_finish@Base 0.6.18
console_kit_manager_call_get_seats_sync@Base 0.6.18
console_kit_manager_call_get_session_for_cookie@Base 0.6.18
console_kit_manager_call_get_session_for_cookie_finish@Base 0.6.18
console_kit_manager_call_get_session_for_cookie_sync@Base 0.6.18
console_kit_manager_call_get_session_for_unix_process@Base 0.6.18
console_kit_manager_call_get_session_for_unix_process_finish@Base 0.6.18
console_kit_manager_call_get_session_for_unix_process_sync@Base 0.6.18
console_kit_manager_call_get_sessions@Base 0.6.18
console_kit_manager_call_get_sessions_finish@Base 0.6.18
console_kit_manager_call_get_sessions_for_unix_user@Base 0.6.18
console_kit_manager_call_get_sessions_for_unix_user_finish@Base 0.6.18
console_kit_manager_call_get_sessions_for_unix_user_sync@Base 0.6.18
console_kit_manager_call_get_sessions_for_user@Base 0.6.18
console_kit_manager_call_get_sessions_for_user_finish@Base 0.6.18
console_kit_manager_call_get_sessions_for_user_sync@Base 0.6.18
console_kit_manager_call_get_sessions_sync@Base 0.6.18
console_kit_manager_call_get_system_idle_hint@Base 0.6.18
console_kit_manager_call_get_system_idle_hint_finish@Base 0.6.18
console_kit_manager_call_get_system_idle_hint_sync@Base 0.6.18
console_kit_manager_call_get_system_idle_since_hint@Base 0.6.18
console_kit_manager_call_get_system_idle_since_hint_finish@Base 0.6.18
console_kit_manager_call_get_system_idle_since_hint_sync@Base 0.6.18
console_kit_manager_call_open_session@Base 0.6.18
console_kit_manager_call_open_session_finish@Base 0.6.18
console_kit_manager_call_open_session_sync@Base 0.6.18
console_kit_manager_call_open_session_with_parameters@Base 0.6.18
console_kit_manager_call_open_session_with_parameters_finish@Base 0.6.18
console_kit_manager_call_open_session_with_parameters_sync@Base 0.6.18
console_kit_manager_call_restart@Base 0.6.18
console_kit_manager_call_restart_finish@Base 0.6.18
console_kit_manager_call_restart_sync@Base 0.6.18
console_kit_manager_call_stop@Base 0.6.18
console_kit_manager_call_stop_finish@Base 0.6.18
console_kit_manager_call_stop_sync@Base 0.6.18
console_kit_manager_complete_can_restart@Base 0.6.18
console_kit_manager_complete_can_stop@Base 0.6.18
console_kit_manager_complete_close_session@Base 0.6.18
console_kit_manager_complete_get_current_session@Base 0.6.18
console_kit_manager_complete_get_seats@Base 0.6.18
console_kit_manager_complete_get_session_for_cookie@Base 0.6.18
console_kit_manager_complete_get_session_for_unix_process@Base 0.6.18
console_kit_manager_complete_get_sessions@Base 0.6.18
console_kit_manager_complete_get_sessions_for_unix_user@Base 0.6.18
console_kit_manager_complete_get_sessions_for_user@Base 0.6.18
console_kit_manager_complete_get_system_idle_hint@Base 0.6.18
console_kit_manager_complete_get_system_idle_since_hint@Base 0.6.18
console_kit_manager_complete_open_session@Base 0.6.18
console_kit_manager_complete_open_session_with_parameters@Base 0.6.18
console_kit_manager_complete_restart@Base 0.6.18
console_kit_manager_complete_stop@Base 0.6.18
console_kit_manager_emit_seat_added@Base 0.6.18
console_kit_manager_emit_seat_removed@Base 0.6.18
console_kit_manager_emit_system_idle_hint_changed@Base 0.6.18
console_kit_manager_get_type@Base 0.6.18
console_kit_manager_interface_info@Base 0.6.18
console_kit_manager_override_properties@Base 0.6.18
console_kit_manager_proxy_get_type@Base 0.6.18
console_kit_manager_proxy_new@Base 0.6.18
console_kit_manager_proxy_new_finish@Base 0.6.18
console_kit_manager_proxy_new_for_bus@Base 0.6.18
console_kit_manager_proxy_new_for_bus_finish@Base 0.6.18
console_kit_manager_proxy_new_for_bus_sync@Base 0.6.18
console_kit_manager_proxy_new_sync@Base 0.6.18
console_kit_manager_skeleton_get_type@Base 0.6.18
console_kit_manager_skeleton_new@Base 0.6.18
console_kit_seat_call_activate_session@Base 0.6.18
console_kit_seat_call_activate_session_finish@Base 0.6.18
console_kit_seat_call_activate_session_sync@Base 0.6.18
console_kit_seat_call_can_activate_sessions@Base 0.6.18
console_kit_seat_call_can_activate_sessions_finish@Base 0.6.18
console_kit_seat_call_can_activate_sessions_sync@Base 0.6.18
console_kit_seat_call_get_active_session@Base 0.6.18
console_kit_seat_call_get_active_session_finish@Base 0.6.18
console_kit_seat_call_get_active_session_sync@Base 0.6.18
console_kit_seat_call_get_devices@Base 0.6.18
console_kit_seat_call_get_devices_finish@Base 0.6.18
console_kit_seat_call_get_devices_sync@Base 0.6.18
console_kit_seat_call_get_id@Base 0.6.18
console_kit_seat_call_get_id_finish@Base 0.6.18
console_kit_seat_call_get_id_sync@Base 0.6.18
console_kit_seat_call_get_sessions@Base 0.6.18
console_kit_seat_call_get_sessions_finish@Base 0.6.18
console_kit_seat_call_get_sessions_sync@Base 0.6.18
console_kit_seat_complete_activate_session@Base 0.6.18
console_kit_seat_complete_can_activate_sessions@Base 0.6.18
console_kit_seat_complete_get_active_session@Base 0.6.18
console_kit_seat_complete_get_devices@Base 0.6.18
console_kit_seat_complete_get_id@Base 0.6.18
console_kit_seat_complete_get_sessions@Base 0.6.18
console_kit_seat_emit_active_session_changed@Base 0.6.18
console_kit_seat_emit_device_added@Base 0.6.18
console_kit_seat_emit_device_removed@Base 0.6.18
console_kit_seat_emit_session_added@Base 0.6.18
console_kit_seat_emit_session_removed@Base 0.6.18
console_kit_seat_get_type@Base 0.6.18
console_kit_seat_interface_info@Base 0.6.18
console_kit_seat_override_properties@Base 0.6.18
console_kit_seat_proxy_get_type@Base 0.6.18
console_kit_seat_proxy_new@Base 0.6.18
console_kit_seat_proxy_new_finish@Base 0.6.18
console_kit_seat_proxy_new_for_bus@Base 0.6.18
console_kit_seat_proxy_new_for_bus_finish@Base 0.6.18
console_kit_seat_proxy_new_for_bus_sync@Base 0.6.18
console_kit_seat_proxy_new_sync@Base 0.6.18
console_kit_seat_skeleton_get_type@Base 0.6.18
console_kit_seat_skeleton_new@Base 0.6.18
console_kit_session_call_activate@Base 0.6.18
console_kit_session_call_activate_finish@Base 0.6.18
console_kit_session_call_activate_sync@Base 0.6.18
console_kit_session_call_get_creation_time@Base 0.6.18
console_kit_session_call_get_creation_time_finish@Base 0.6.18
console_kit_session_call_get_creation_time_sync@Base 0.6.18
console_kit_session_call_get_display_device@Base 0.6.18
console_kit_session_call_get_display_device_finish@Base 0.6.18
console_kit_session_call_get_display_device_sync@Base 0.6.18
console_kit_session_call_get_id@Base 0.6.18
console_kit_session_call_get_id_finish@Base 0.6.18
console_kit_session_call_get_id_sync@Base 0.6.18
console_kit_session_call_get_idle_hint@Base 0.6.18
console_kit_session_call_get_idle_hint_finish@Base 0.6.18
console_kit_session_call_get_idle_hint_sync@Base 0.6.18
console_kit_session_call_get_idle_since_hint@Base 0.6.18
console_kit_session_call_get_idle_since_hint_finish@Base 0.6.18
console_kit_session_call_get_idle_since_hint_sync@Base 0.6.18
console_kit_session_call_get_login_session_id@Base 0.6.18
console_kit_session_call_get_login_session_id_finish@Base 0.6.18
console_kit_session_call_get_login_session_id_sync@Base 0.6.18
console_kit_session_call_get_remote_host_name@Base 0.6.18
console_kit_session_call_get_remote_host_name_finish@Base 0.6.18
console_kit_session_call_get_remote_host_name_sync@Base 0.6.18
console_kit_session_call_get_seat_id@Base 0.6.18
console_kit_session_call_get_seat_id_finish@Base 0.6.18
console_kit_session_call_get_seat_id_sync@Base 0.6.18
console_kit_session_call_get_session_type@Base 0.6.18
console_kit_session_call_get_session_type_finish@Base 0.6.18
console_kit_session_call_get_session_type_sync@Base 0.6.18
console_kit_session_call_get_unix_user@Base 0.6.18
console_kit_session_call_get_unix_user_finish@Base 0.6.18
console_kit_session_call_get_unix_user_sync@Base 0.6.18
console_kit_session_call_get_user@Base 0.6.18
console_kit_session_call_get_user_finish@Base 0.6.18
console_kit_session_call_get_user_sync@Base 0.6.18
console_kit_session_call_get_x11_display@Base 0.6.18
console_kit_session_call_get_x11_display_device@Base 0.6.18
console_kit_session_call_get_x11_display_device_finish@Base 0.6.18
console_kit_session_call_get_x11_display_device_sync@Base 0.6.18
console_kit_session_call_get_x11_display_finish@Base 0.6.18
console_kit_session_call_get_x11_display_sync@Base 0.6.18
console_kit_session_call_is_active@Base 0.6.18
console_kit_session_call_is_active_finish@Base 0.6.18
console_kit_session_call_is_active_sync@Base 0.6.18
console_kit_session_call_is_local@Base 0.6.18
console_kit_session_call_is_local_finish@Base 0.6.18
console_kit_session_call_is_local_sync@Base 0.6.18
console_kit_session_call_lock@Base 0.6.18
console_kit_session_call_lock_finish@Base 0.6.18
console_kit_session_call_lock_sync@Base 0.6.18
console_kit_session_call_set_idle_hint@Base 0.6.18
console_kit_session_call_set_idle_hint_finish@Base 0.6.18
console_kit_session_call_set_idle_hint_sync@Base 0.6.18
console_kit_session_call_unlock@Base 0.6.18
console_kit_session_call_unlock_finish@Base 0.6.18
console_kit_session_call_unlock_sync@Base 0.6.18
console_kit_session_complete_activate@Base 0.6.18
console_kit_session_complete_get_creation_time@Base 0.6.18
console_kit_session_complete_get_display_device@Base 0.6.18
console_kit_session_complete_get_id@Base 0.6.18
console_kit_session_complete_get_idle_hint@Base 0.6.18
console_kit_session_complete_get_idle_since_hint@Base 0.6.18
console_kit_session_complete_get_login_session_id@Base 0.6.18
console_kit_session_complete_get_remote_host_name@Base 0.6.18
console_kit_session_complete_get_seat_id@Base 0.6.18
console_kit_session_complete_get_session_type@Base 0.6.18
console_kit_session_complete_get_unix_user@Base 0.6.18
console_kit_session_complete_get_user@Base 0.6.18
console_kit_session_complete_get_x11_display@Base 0.6.18
console_kit_session_complete_get_x11_display_device@Base 0.6.18
console_kit_session_complete_is_active@Base 0.6.18
console_kit_session_complete_is_local@Base 0.6.18
console_kit_session_complete_lock@Base 0.6.18
console_kit_session_complete_set_idle_hint@Base 0.6.18
console_kit_session_complete_unlock@Base 0.6.18
console_kit_session_dup_display_device@Base 0.6.18
console_kit_session_dup_remote_host_name@Base 0.6.18
console_kit_session_dup_session_type@Base 0.6.18
console_kit_session_dup_x11_display@Base 0.6.18
console_kit_session_dup_x11_display_device@Base 0.6.18
console_kit_session_emit_active_changed@Base 0.6.18
console_kit_session_emit_idle_hint_changed@Base 0.6.18
console_kit_session_emit_lock@Base 0.6.18
console_kit_session_emit_unlock@Base 0.6.18
console_kit_session_get_active@Base 0.6.18
console_kit_session_get_display_device@Base 0.6.18
console_kit_session_get_idle_hint@Base 0.6.18
console_kit_session_get_is_local@Base 0.6.18
console_kit_session_get_remote_host_name@Base 0.6.18
console_kit_session_get_session_type@Base 0.6.18
console_kit_session_get_type@Base 0.6.18
console_kit_session_get_unix_user@Base 0.6.18
console_kit_session_get_user@Base 0.6.18
console_kit_session_get_x11_display@Base 0.6.18
console_kit_session_get_x11_display_device@Base 0.6.18
console_kit_session_interface_info@Base 0.6.18
console_kit_session_override_properties@Base 0.6.18
console_kit_session_proxy_get_type@Base 0.6.18
console_kit_session_proxy_new@Base 0.6.18
console_kit_session_proxy_new_finish@Base 0.6.18
console_kit_session_proxy_new_for_bus@Base 0.6.18
console_kit_session_proxy_new_for_bus_finish@Base 0.6.18
console_kit_session_proxy_new_for_bus_sync@Base 0.6.18
console_kit_session_proxy_new_sync@Base 0.6.18
console_kit_session_set_active@Base 0.6.18
console_kit_session_set_display_device@Base 0.6.18
console_kit_session_set_idle_hint@Base 0.6.18
console_kit_session_set_is_local@Base 0.6.18
console_kit_session_set_remote_host_name@Base 0.6.18
console_kit_session_set_session_type@Base 0.6.18
console_kit_session_set_unix_user@Base 0.6.18
console_kit_session_set_user@Base 0.6.18
console_kit_session_set_x11_display@Base 0.6.18
console_kit_session_set_x11_display_device@Base 0.6.18
console_kit_session_skeleton_get_type@Base 0.6.18
console_kit_session_skeleton_new@Base 0.6.18

View File

@ -0,0 +1,278 @@
From 8fe53c3b9b65ddb720336ff6ff85ffd8a63819ca Mon Sep 17 00:00:00 2001
From: Gunnar Hjalmarsson <ubuntu@gunnar.cc>
Date: Thu, 21 Dec 2017 15:03:24 +1300
Subject: [PATCH 01/12] Addition of FormatsLocale property and SetFormatsLocale
method
---
data/org.freedesktop.Accounts.User.xml | 45 ++++++++++++++++++++
src/libaccountsservice/act-user.c | 55 ++++++++++++++++++++++++
src/libaccountsservice/act-user.h | 3 ++
src/user.c | 59 ++++++++++++++++++++++++++
4 files changed, 162 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index 3b839a3..d4adc3f 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -150,6 +150,41 @@
</doc:doc>
</method>
+ <method name="SetFormatsLocale">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="formats_locale" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>
+ The new regional formats, as a locale specification like "de_DE.UTF-8".
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the users regional formats.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his own language</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the language of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
<method name="SetXSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_x_session"/>
@@ -771,6 +806,16 @@
</doc:doc>
</property>
+ <property name="FormatsLocale" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The users regional formats, as a locale specification like "de_DE.UTF-8".
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="XSession" type="s" access="read">
<doc:doc>
<doc:description>
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
index e66acb1..2861518 100644
--- a/src/libaccountsservice/act-user.c
+++ b/src/libaccountsservice/act-user.c
@@ -95,6 +95,7 @@ enum {
PROP_LOGIN_HISTORY,
PROP_ICON_FILE,
PROP_LANGUAGE,
+ PROP_FORMATS_LOCALE,
PROP_X_SESSION,
PROP_IS_LOADED
};
@@ -386,6 +387,13 @@ act_user_class_init (ActUserClass *class)
"User's locale.",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_FORMATS_LOCALE,
+ g_param_spec_string ("formats_locale",
+ "Regional Formats",
+ "User's regional formats.",
+ NULL,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_X_SESSION,
g_param_spec_string ("x-session",
@@ -1026,6 +1034,25 @@ act_user_get_language (ActUser *user)
return accounts_user_get_language (user->accounts_proxy);
}
+/**
+ * act_user_get_formats_locale:
+ * @user: a #ActUser
+ *
+ * Returns the path to the configured formats locale of @user.
+ *
+ * Returns: (transfer none): a path to an icon
+ */
+const char *
+act_user_get_formats_locale (ActUser *user)
+{
+ g_return_val_if_fail (ACT_IS_USER (user), NULL);
+
+ if (user->accounts_proxy == NULL)
+ return NULL;
+
+ return accounts_user_get_formats_locale (user->accounts_proxy);
+}
+
/**
* act_user_get_x_session:
* @user: a #ActUser
@@ -1310,6 +1337,34 @@ act_user_get_password_expiration_policy (ActUser *user,
}
}
+/**
+ * act_user_set_formats_locale:
+ * @user: the user object to alter.
+ * @formats_locale: a locale (e.g. en_US.utf8)
+ *
+ * Assigns a new formats locale for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_formats_locale (ActUser *user,
+ const char *formats_locale)
+{
+ g_autoptr(GError) error = NULL;
+
+ g_return_if_fail (ACT_IS_USER (user));
+ g_return_if_fail (formats_locale != NULL);
+ g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+
+ if (!accounts_user_call_set_formats_locale_sync (user->accounts_proxy,
+ formats_locale,
+ NULL,
+ &error)) {
+ g_warning ("SetFormatsLocale call failed: %s", error->message);
+ return;
+ }
+}
+
/**
* act_user_set_email:
* @user: the user object to alter.
diff --git a/src/libaccountsservice/act-user.h b/src/libaccountsservice/act-user.h
index 34d7fe3..323e3a5 100644
--- a/src/libaccountsservice/act-user.h
+++ b/src/libaccountsservice/act-user.h
@@ -78,6 +78,7 @@ gboolean act_user_is_local_account (ActUser *user);
gboolean act_user_is_nonexistent (ActUser *user);
const char *act_user_get_icon_file (ActUser *user);
const char *act_user_get_language (ActUser *user);
+const char *act_user_get_formats_locale (ActUser *user);
const char *act_user_get_x_session (ActUser *user);
const char *act_user_get_session (ActUser *user);
const char *act_user_get_session_type (ActUser *user);
@@ -99,6 +100,8 @@ void act_user_set_email (ActUser *user,
const char *email);
void act_user_set_language (ActUser *user,
const char *language);
+void act_user_set_formats_locale (ActUser *user,
+ const char *formats_locale);
void act_user_set_x_session (ActUser *user,
const char *x_session);
void act_user_set_session (ActUser *user,
diff --git a/src/user.c b/src/user.c
index 9f57af5..beb36a3 100644
--- a/src/user.c
+++ b/src/user.c
@@ -256,6 +256,12 @@ user_update_from_keyfile (User *user,
g_clear_pointer (&s, g_free);
}
+ s = g_key_file_get_string (keyfile, "User", "FormatsLocale", NULL);
+ if (s != NULL) {
+ accounts_user_set_formats_locale (ACCOUNTS_USER (user), s);
+ g_clear_pointer (&s, g_free);
+ }
+
s = g_key_file_get_string (keyfile, "User", "XSession", NULL);
if (s != NULL) {
accounts_user_set_xsession (ACCOUNTS_USER (user), s);
@@ -348,6 +354,9 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_session_type (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "SessionType", accounts_user_get_session_type (ACCOUNTS_USER (user)));
+ if (accounts_user_get_formats_locale (ACCOUNTS_USER (user)))
+ g_key_file_set_string (keyfile, "User", "FormatsLocale", accounts_user_get_formats_locale (ACCOUNTS_USER (user)));
+
if (accounts_user_get_xsession (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "XSession", accounts_user_get_xsession (ACCOUNTS_USER (user)));
@@ -1152,6 +1161,55 @@ user_set_session_type (AccountsUser *auser,
return TRUE;
}
+static void
+user_change_formats_locale_authorized_cb (Daemon *daemon,
+ User *user,
+ GDBusMethodInvocation *context,
+ gpointer user_data)
+
+{
+ const gchar *formats_locale = user_data;
+
+ if (g_strcmp0 (accounts_user_get_formats_locale (ACCOUNTS_USER (user)), formats_locale) != 0) {
+ accounts_user_set_formats_locale (ACCOUNTS_USER (user), formats_locale);
+
+ save_extra_data (user);
+ }
+
+ accounts_user_complete_set_formats_locale (ACCOUNTS_USER (user), context);
+}
+
+static gboolean
+user_set_formats_locale (AccountsUser *auser,
+ GDBusMethodInvocation *context,
+ const gchar *formats_locale)
+{
+ User *user = (User*)auser;
+ int uid;
+ const gchar *action_id;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "identifying caller failed");
+ return FALSE;
+ }
+
+ if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
+ action_id = "org.freedesktop.accounts.change-own-user-data";
+ else
+ action_id = "org.freedesktop.accounts.user-administration";
+
+ daemon_local_check_auth (user->daemon,
+ user,
+ action_id,
+ TRUE,
+ user_change_formats_locale_authorized_cb,
+ context,
+ g_strdup (formats_locale),
+ (GDestroyNotify) g_free);
+
+ return TRUE;
+}
+
static void
user_change_x_session_authorized_cb (Daemon *daemon,
User *user,
@@ -2110,6 +2168,7 @@ user_accounts_user_iface_init (AccountsUserIface *iface)
iface->handle_set_account_type = user_set_account_type;
iface->handle_set_automatic_login = user_set_automatic_login;
iface->handle_set_email = user_set_email;
+ iface->handle_set_formats_locale = user_set_formats_locale;
iface->handle_set_home_directory = user_set_home_directory;
iface->handle_set_icon_file = user_set_icon_file;
iface->handle_set_language = user_set_language;
--
2.20.1

View File

@ -0,0 +1,127 @@
From 61198bff068d1fa575967b29a28078240e9815e0 Mon Sep 17 00:00:00 2001
From: Frederic Peters <fpeters@debian.org>
Date: Thu, 21 Dec 2017 15:03:57 +1300
Subject: [PATCH 02/12] Create and manage groups like on a debian system.
---
src/daemon.c | 28 ++++++----------------------
src/util.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/util.h | 9 +++++++++
3 files changed, 55 insertions(+), 22 deletions(-)
diff --git a/src/daemon.c b/src/daemon.c
index d7c4437..5f2931e 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1110,34 +1110,18 @@ daemon_create_user_authorized_cb (Daemon *daemon,
argv[1] = "-m";
argv[2] = "-c";
argv[3] = cd->real_name;
- if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR) {
- if (EXTRA_ADMIN_GROUPS != NULL && EXTRA_ADMIN_GROUPS[0] != '\0')
- admin_groups = g_strconcat (ADMIN_GROUP, ",",
- EXTRA_ADMIN_GROUPS, NULL);
- else
- admin_groups = g_strdup (ADMIN_GROUP);
-
- argv[4] = "-G";
- argv[5] = admin_groups;
- argv[6] = "--";
- argv[7] = cd->user_name;
- argv[8] = NULL;
- }
- else if (cd->account_type == ACCOUNT_TYPE_STANDARD) {
- argv[4] = "--";
- argv[5] = cd->user_name;
- argv[6] = NULL;
- }
- else {
- throw_error (context, ERROR_FAILED, "Don't know how to add user of type %d", cd->account_type);
- return;
- }
+ argv[4] = cd->user_name;
+ argv[5] = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
}
+ if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR) {
+ add_user_to_group (context, cd->user_name, "sudo");
+ }
+
user = daemon_local_find_user_by_name (daemon, cd->user_name);
user_update_local_account_property (user, TRUE);
user_update_system_account_property (user, FALSE);
diff --git a/src/util.c b/src/util.c
index 0372b4b..684a58d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -289,3 +289,43 @@ get_caller_uid (GDBusMethodInvocation *context,
return TRUE;
}
+
+void
+add_user_to_group (GDBusMethodInvocation *context,
+ const char *user_name,
+ const char *group_name)
+{
+ g_autoptr(GError) error = NULL;
+ const gchar *argv[4];
+
+ argv[0] = "/usr/sbin/adduser";
+ argv[1] = user_name;
+ argv[2] = group_name;
+ argv[3] = NULL;
+
+ error = NULL;
+ if (!spawn_with_login_uid (context, argv, &error)) {
+ g_warning ("failed to add user %s to group %s", user_name, group_name);
+ return;
+ }
+}
+
+void
+remove_user_from_group (GDBusMethodInvocation *context,
+ const char *user_name,
+ const char *group_name)
+{
+ g_autoptr(GError) error = NULL;
+ const gchar *argv[4];
+
+ argv[0] = "/usr/sbin/deluser";
+ argv[1] = user_name;
+ argv[2] = group_name;
+ argv[3] = NULL;
+
+ error = NULL;
+ if (!spawn_with_login_uid (context, argv, &error)) {
+ g_warning ("failed to remove user %s from group %s", user_name, group_name);
+ return;
+ }
+}
diff --git a/src/util.h b/src/util.h
index 41ba545..c243c29 100644
--- a/src/util.h
+++ b/src/util.h
@@ -40,6 +40,15 @@ gint get_user_groups (const gchar *username,
gid_t group,
gid_t **groups);
+void add_user_to_group (GDBusMethodInvocation *context,
+ const char *user_name,
+ const char *group_name);
+
+void remove_user_from_group (GDBusMethodInvocation *context,
+ const char *user_name,
+ const char *group_name);
+
+
G_END_DECLS
#endif /* __UTIL_H__ */
--
2.20.1

View File

@ -0,0 +1,37 @@
From 7e8f45e66233e502aa9ae5a3f5200884b1b9b235 Mon Sep 17 00:00:00 2001
From: Alessio Treglia <alessio@debian.org>
Date: Thu, 21 Dec 2017 15:05:01 +1300
Subject: [PATCH 03/12] Replace useradd with adduser to comply with Debian
Policy.
---
src/daemon.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/daemon.c b/src/daemon.c
index 5f2931e..140210c 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1106,12 +1106,13 @@ daemon_create_user_authorized_cb (Daemon *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[4] = cd->user_name;
- argv[5] = NULL;
+ argv[0] = "/usr/sbin/adduser";
+ argv[1] = "--quiet";
+ argv[2] = "--disabled-login";
+ argv[3] = "--gecos";
+ argv[4] = cd->real_name;
+ argv[5] = cd->user_name;
+ argv[6] = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
--
2.20.1

View File

@ -0,0 +1,174 @@
From eff9885a917909aeb677805052be665ec2b8d4af Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@canonical.com>
Date: Thu, 21 Dec 2017 15:08:44 +1300
Subject: [PATCH 04/12] Support setting/reading LightDM autologin setings
---
src/daemon.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 117 insertions(+), 10 deletions(-)
diff --git a/src/daemon.c b/src/daemon.c
index 140210c..0415f41 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1459,11 +1459,11 @@ daemon_local_check_auth (Daemon *daemon,
g_object_unref (subject);
}
-gboolean
-load_autologin (Daemon *daemon,
- gchar **name,
- gboolean *enabled,
- GError **error)
+static gboolean
+load_autologin_gdm (Daemon *daemon,
+ gchar **name,
+ gboolean *enabled,
+ GError **error)
{
g_autoptr(GKeyFile) keyfile = NULL;
GError *local_error = NULL;
@@ -1499,21 +1499,81 @@ load_autologin (Daemon *daemon,
}
static gboolean
-save_autologin (Daemon *daemon,
- const gchar *name,
- gboolean enabled,
+load_autologin_lightdm (Daemon *daemon,
+ gchar **name,
+ gboolean *enabled,
+ GError **error)
+{
+ g_autoptr(GKeyFile) keyfile = NULL;
+ const gchar *filename;
+
+ filename = "/etc/lightdm/lightdm.conf";
+
+ keyfile = g_key_file_new ();
+ if (!g_key_file_load_from_file (keyfile,
+ filename,
+ G_KEY_FILE_KEEP_COMMENTS,
+ error)) {
+ return FALSE;
+ }
+
+ *name = g_key_file_get_string (keyfile, "SeatDefaults", "autologin-user", error);
+ *enabled = (*error == NULL && (*name) && (*name)[0] != 0);
+
+ return (*error == NULL);
+}
+
+gboolean
+load_autologin (Daemon *daemon,
+ gchar **name,
+ gboolean *enabled,
GError **error)
+{
+ g_autoptr(GDBusProxy) proxy = NULL;
+
+ /* First, determine whether we should load GDM or LightDM values by
+ checking if GDM is running. */
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES|
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS|
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ NULL,
+ "org.gnome.DisplayManager",
+ "/org/gnome/DisplayManager/Manager",
+ "org.gnome.DisplayManager.Manager",
+ NULL, /* GCancellable */
+ NULL); /* GError */
+
+ if (proxy != NULL)
+ return load_autologin_gdm (daemon, name, enabled, error);
+ else
+ return load_autologin_lightdm (daemon, name, enabled, error);
+}
+
+static gboolean
+save_autologin_gdm (Daemon *daemon,
+ const gchar *name,
+ gboolean enabled,
+ GError **error)
{
g_autoptr(GKeyFile) keyfile = NULL;
g_autofree gchar *data = NULL;
gboolean result;
+ g_autoptr(GError) local_error = NULL;
+
+ if (!g_file_test ("/etc/gdm3", G_FILE_TEST_EXISTS))
+ return TRUE; /* not an error, just not installed */
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile,
PATH_GDM_CUSTOM,
G_KEY_FILE_KEEP_COMMENTS,
- error)) {
- return FALSE;
+ &local_error)) {
+ /* It's OK for custom.conf to not exist, we will make it */
+ if (!g_error_matches (local_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
+ g_propagate_error (error, g_steal_pointer (&local_error));
+ return FALSE;
+ }
}
g_key_file_set_string (keyfile, "daemon", "AutomaticLoginEnable", enabled ? "True" : "False");
@@ -1525,6 +1585,53 @@ save_autologin (Daemon *daemon,
return result;
}
+static gboolean
+save_autologin_lightdm (Daemon *daemon,
+ const gchar *name,
+ gboolean enabled,
+ GError **error)
+{
+ g_autoptr(GKeyFile) keyfile = NULL;
+ const gchar *filename;
+ g_autofree gchar *data = NULL;
+ g_autoptr(GError) local_error = NULL;
+
+ if (!g_file_test ("/etc/lightdm", G_FILE_TEST_EXISTS))
+ return TRUE; /* not an error, just not installed */
+
+ filename = "/etc/lightdm/lightdm.conf";
+
+ keyfile = g_key_file_new ();
+ if (!g_key_file_load_from_file (keyfile,
+ filename,
+ G_KEY_FILE_KEEP_COMMENTS,
+ &local_error)) {
+ /* It's OK for custom.conf to not exist, we will make it */
+ if (!g_error_matches (local_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
+ g_propagate_error (error, g_steal_pointer (&local_error));
+ return FALSE;
+ }
+ }
+
+ g_key_file_set_string (keyfile, "SeatDefaults", "autologin-user", enabled ? name : "");
+
+ data = g_key_file_to_data (keyfile, NULL, NULL);
+ return g_file_set_contents (filename, data, -1, error);
+}
+
+static gboolean
+save_autologin (Daemon *daemon,
+ const gchar *name,
+ gboolean enabled,
+ GError **error)
+{
+ if (!save_autologin_gdm (daemon, name, enabled, error))
+ return FALSE;
+ if (!save_autologin_lightdm (daemon, name, enabled, error))
+ return FALSE;
+ return TRUE;
+}
+
gboolean
daemon_local_set_automatic_login (Daemon *daemon,
User *user,
--
2.20.1

543
debian/patches/0009-language-tools.patch vendored Normal file
View File

@ -0,0 +1,543 @@
From c2caf5bcb59e10230e17cc15e7e6260beffdef71 Mon Sep 17 00:00:00 2001
From: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
Date: Thu, 21 Dec 2017 15:09:24 +1300
Subject: [PATCH 05/12] Help files for dealing with language/locale settings.
Updated: 2020-11-02
---
data/langtools/Makefile.am | 17 ++++++
data/langtools/language-options | 84 ++++++++++++++++++++++++++++++
data/langtools/language-validate | 82 +++++++++++++++++++++++++++++
data/langtools/language2locale | 70 +++++++++++++++++++++++++
data/langtools/locale2papersize | 18 +++++++
data/langtools/main-countries | 28 ++++++++++
data/langtools/meson.build | 25 +++++++++
data/langtools/save-to-pam-env | 40 ++++++++++++++
data/langtools/set-language-helper | 27 ++++++++++
data/langtools/update-langlist | 48 +++++++++++++++++
data/meson.build | 2 +
11 files changed, 441 insertions(+)
create mode 100644 data/langtools/Makefile.am
create mode 100755 data/langtools/language-options
create mode 100755 data/langtools/language-validate
create mode 100755 data/langtools/language2locale
create mode 100755 data/langtools/locale2papersize
create mode 100644 data/langtools/main-countries
create mode 100644 data/langtools/meson.build
create mode 100755 data/langtools/save-to-pam-env
create mode 100755 data/langtools/set-language-helper
create mode 100755 data/langtools/update-langlist
diff --git a/data/langtools/Makefile.am b/data/langtools/Makefile.am
new file mode 100644
index 0000000..ca345e0
--- /dev/null
+++ b/data/langtools/Makefile.am
@@ -0,0 +1,17 @@
+langtoolsdir = ${datadir}/language-tools
+
+install-data-hook:
+ if test '!' -d $(DESTDIR)$(langtoolsdir); then \
+ $(mkinstalldirs) $(DESTDIR)$(langtoolsdir); \
+ chmod 755 $(DESTDIR)$(langtoolsdir); \
+ fi
+
+ $(INSTALL_SCRIPT) language-options $(DESTDIR)$(langtoolsdir)/language-options
+ $(INSTALL_SCRIPT) language-validate $(DESTDIR)$(langtoolsdir)/language-validate
+ $(INSTALL_SCRIPT) language2locale $(DESTDIR)$(langtoolsdir)/language2locale
+ $(INSTALL_SCRIPT) locale2papersize $(DESTDIR)$(langtoolsdir)/locale2papersize
+ $(INSTALL_DATA) main-countries $(DESTDIR)$(langtoolsdir)/main-countries
+ $(INSTALL_SCRIPT) save-to-pam-env $(DESTDIR)$(langtoolsdir)/save-to-pam-env
+ $(INSTALL_SCRIPT) set-language-helper $(DESTDIR)$(langtoolsdir)/set-language-helper
+ $(INSTALL_SCRIPT) update-langlist $(DESTDIR)$(langtoolsdir)/update-langlist
+
diff --git a/data/langtools/language-options b/data/langtools/language-options
new file mode 100755
index 0000000..b1cc1f3
--- /dev/null
+++ b/data/langtools/language-options
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $langtoolsdir = '/usr/share/language-tools';
+
+# get the locales available on the system
+my @avail_locales = map { chomp; s/\.utf8//; $_ } qx( locale -a | grep -F .utf8 );
+
+# add items without country code to facilitate lookups
+my %extended_localelist;
+for my $loc (@avail_locales) {
+ ( my $lang = $loc ) =~ s/_[A-Z]+//;
+ @extended_localelist{$loc, $lang} = (1, 1);
+}
+
+# get the directory names in /usr/share/locale-langpack plus possible other
+# translation directory names in /usr/share/locale and /usr/local/share/locale
+my %translation_dirs;
+if ( opendir my ($dh), '/usr/share/locale-langpack' ) {
+ $translation_dirs{$_} = 1 for readdir $dh;
+}
+my %langpack_langcodes = map { s/[^a-z].+//; $_, 1 }
+ grep !/^\./, keys %translation_dirs;
+for my $t_dir ('/usr/share/locale', '/usr/local/share/locale') {
+ if ( opendir my ($dh), $t_dir ) {
+ for ( readdir $dh ) {
+ for my $lang ( keys %langpack_langcodes ) {
+ if ( /^$lang[_@]/ ) {
+ $translation_dirs{$_} = 1;
+ last;
+ }
+ }
+ }
+ }
+}
+
+# Assume that 'en' is present even if the English language pack isn't installed
+if ( ! $translation_dirs{'en'} and "@avail_locales" =~ /\ben_US\b/ ) {
+ $translation_dirs{'en'} = 1;
+}
+
+# get the intersection of available translation_dirs and the extended locale list
+my %intersection;
+for ( keys %extended_localelist ) {
+ $intersection{$_} = 1 if $translation_dirs{$_};
+}
+
+# adjustments
+if ( open my $fh, '<', "$langtoolsdir/main-countries" ) {
+ # If country code items in a language exist:
+ # - Remove the item without country code, since gettext won't find a
+ # translation under e.g. 'de_DE' if the first item in LANGUAGE is 'de'
+ # (see https://launchpad.net/bugs/700213). 'en' is kept, though, since
+ # it's always the last item in LANGUAGE per design.
+ # - Make sure that the main dialect of the language is represented among
+ # the country code items (see https://launchpad.net/bugs/710148).
+ my %main;
+ while ( <$fh> ) {
+ next if /^\s*(?:#|$)/;
+ my ($k, $v) = split;
+ $main{$k} = $v;
+ }
+ my %count;
+ for ( keys %intersection ) {
+ next if /^en[^a-z]/;
+ ( my $not_country = $_ ) =~ s/_[A-Z]+//;
+ $count{$not_country} ++;
+ }
+ for my $langcode ( keys %count ) {
+ if ( $count{$langcode} > 1 ) {
+ delete $intersection{$langcode};
+ $intersection{ $main{$langcode} } = 1 if $main{$langcode};
+ }
+ }
+} else {
+ # not access to the language-to-main-dialect map
+ # => stick with a minimum of list manipulation
+ delete $intersection{'zh'};
+}
+
+# print the resulting list of language options
+print join("\n", sort keys %intersection) || 'en';
+
diff --git a/data/langtools/language-validate b/data/langtools/language-validate
new file mode 100755
index 0000000..b87c132
--- /dev/null
+++ b/data/langtools/language-validate
@@ -0,0 +1,82 @@
+#!/bin/sh -pe
+
+lang=$1
+validated_language=
+
+test -n "$lang" || exit 1
+
+langtoolsdir=/usr/share/language-tools
+
+#
+# discard possible fallback languages
+#
+lang=${lang%%:*}
+
+#
+# remove possible encoding part
+#
+if [ $lang != ${lang%.utf8*} ]; then
+ lang=${lang%.*}${lang#*.utf8}
+elif [ $lang != ${lang%.UTF-8*} ]; then
+ lang=${lang%.*}${lang#*.UTF-8}
+fi
+
+#
+# make sure that the output is a valid language option
+#
+options=$( $langtoolsdir/language-options )
+
+# exact match
+for opt in $options; do
+ if [ $opt = $lang ]; then
+ validated_language=$lang
+ break
+ fi
+done
+
+if [ -z "$validated_language" ]; then
+ langcode=${lang%%[_@]*}
+
+ # try the "main" country code if any
+ main_country=
+ is_variant=false
+ while read line; do
+ if [ "${line%%[[:space:]]*}" = $langcode ]; then
+ main_country=${line##*[[:space:]]}
+ if [ $lang != ${lang#*@} ]; then
+ main_country=$main_country@${lang#*@}
+ is_variant=true
+ fi
+ break
+ fi
+ done < $langtoolsdir/main-countries
+ if [ -n "$main_country" ]; then
+ for opt in $options; do
+ if [ $main_country = $opt ]; then
+ validated_language=$main_country
+ break
+ fi
+ done
+ fi
+
+ # try out fitting language option without paying regard to
+ # country code
+ if [ -z "$validated_language" ]; then
+ for opt in $options; do
+ if [ "${opt%%[_@]*}" = $langcode -a $langcode != 'zh' ]; then
+ if $is_variant && [ $opt = ${opt#*@} ]; then
+ continue
+ fi
+ validated_language=$opt
+ break
+ fi
+ done
+ fi
+fi
+
+if [ -z "$validated_language" ]; then
+ validated_language='en'
+fi
+
+echo $validated_language
+
diff --git a/data/langtools/language2locale b/data/langtools/language2locale
new file mode 100755
index 0000000..874b357
--- /dev/null
+++ b/data/langtools/language2locale
@@ -0,0 +1,70 @@
+#!/bin/sh -pe
+#
+# - takes the first choice language in the LANGUAGE priority list as argument
+# - outputs locale name corresponding to that language
+
+lang=$1
+locale_name=
+
+test -n "$lang" || exit 1
+
+# remove codeset if any
+if [ "$lang" != "${lang%.*}" ]; then
+ lang=$( echo $lang | sed -r 's/([^.]+)[^@]+(.*)/\1\2/' )
+fi
+
+langtoolsdir=/usr/share/language-tools
+
+langcode=${lang%%[_@]*}
+locales=
+for loc in $( locale -a | grep -F .utf8 ); do
+ # skip locales for other languages
+ if [ $langcode = ${loc%%[._@]*} ]; then
+ loc=${loc%.*}${loc#*.utf8}
+ locales="$locales $loc"
+ fi
+done
+
+# exact match
+for loc in $locales; do
+ if [ $lang = $loc ]; then
+ locale_name=$( echo $loc | sed -r 's/([^@]+)/\1.UTF-8/' )
+ break
+ fi
+done
+
+if [ -z "$locale_name" -a $lang = ${lang%_[A-Z]*} ]; then
+
+ # try the "main" country code if any
+ main_country=
+ while read line; do
+ if [ "${line%%[[:space:]]*}" = $langcode ]; then
+ main_country=${line##*[[:space:]]}
+ if [ $lang != ${lang#*@} ]; then
+ main_country=$main_country@${lang#*@}
+ fi
+ break
+ fi
+ done < $langtoolsdir/main-countries
+ if [ -n "$main_country" ]; then
+ for loc in $locales; do
+ if [ $main_country = $loc ]; then
+ locale_name=$( echo $loc | sed -r 's/([^@]+)/\1.UTF-8/' )
+ break
+ fi
+ done
+ fi
+
+ # try out fitting locale with any country code
+ if [ -z "$locale_name" -a $langcode != 'zh' ]; then
+ for loc in $locales; do
+ if [ "${loc%%[_@]*}" = $langcode ]; then
+ locale_name=$( echo $loc | sed -r 's/([^@]+)/\1.UTF-8/' )
+ break
+ fi
+ done
+ fi
+fi
+
+echo $locale_name
+
diff --git a/data/langtools/locale2papersize b/data/langtools/locale2papersize
new file mode 100755
index 0000000..3fcc13b
--- /dev/null
+++ b/data/langtools/locale2papersize
@@ -0,0 +1,18 @@
+#!/bin/sh -pe
+#
+# locale2papersize outputs the paper size "a4" or "letter" based on
+# the height and width in the locale that is passed as an argument.
+
+export LC_PAPER=$1
+
+height=$( locale height )
+width=$( locale width )
+
+if [ "$height" = 279 -a "$width" = 216 ]; then
+ size=letter
+else
+ size=a4
+fi
+
+echo $size
+
diff --git a/data/langtools/main-countries b/data/langtools/main-countries
new file mode 100644
index 0000000..c6bbd32
--- /dev/null
+++ b/data/langtools/main-countries
@@ -0,0 +1,28 @@
+# If multiple country codes are present among the available locales for
+# a language, we may want to map the language code to the language's
+# main or origin country. The list below aims to serve that purpose.
+#
+aa aa_ET
+ar ar_EG
+bn bn_BD
+ca ca_ES
+de de_DE
+el el_GR
+en en_US
+es es_ES
+eu eu_ES
+fr fr_FR
+fy fy_NL
+it it_IT
+li li_NL
+nl nl_NL
+om om_ET
+pa pa_PK
+pt pt_PT
+ru ru_RU
+so so_SO
+sr sr_RS
+sv sv_SE
+ti ti_ER
+tr tr_TR
+
diff --git a/data/langtools/meson.build b/data/langtools/meson.build
new file mode 100644
index 0000000..ed024a7
--- /dev/null
+++ b/data/langtools/meson.build
@@ -0,0 +1,25 @@
+langtools_dir = join_paths(get_option('datadir'), 'language-tools')
+
+scripts = files(
+ 'language-options',
+ 'language-validate',
+ 'language2locale',
+ 'locale2papersize',
+ 'save-to-pam-env',
+ 'set-language-helper',
+ 'update-langlist'
+)
+
+install_data(
+ scripts,
+ install_dir: langtools_dir,
+)
+
+data = files(
+ 'main-countries'
+)
+
+install_data(
+ data,
+ install_dir: langtools_dir,
+)
diff --git a/data/langtools/save-to-pam-env b/data/langtools/save-to-pam-env
new file mode 100755
index 0000000..2492957
--- /dev/null
+++ b/data/langtools/save-to-pam-env
@@ -0,0 +1,40 @@
+#!/bin/sh -pe
+#
+# updates the ~/.pam_environment config file
+
+homedir=$1
+locale_name=$2
+language_list=$3
+
+[ -n "$homedir" -a -n "$locale_name" ] || exit 1
+
+langtoolsdir=/usr/share/language-tools
+
+# create ~/.pam_environment if it doesn't exist
+touch "$homedir/.pam_environment" || exit 1
+
+save_to_pam_env() {
+ var=$1; value=$2
+ if [ "$( grep -E "^$var(\s+DEFAULT|=)" .pam_environment )" ]; then
+ sed -r -i "s/^$var(\s+DEFAULT|=).*/$var\tDEFAULT=$value/" .pam_environment
+ else
+ echo "$var\tDEFAULT=$value" >> .pam_environment
+ fi
+}
+
+cd "$homedir"
+if [ -n "$language_list" ]; then
+ save_to_pam_env 'LANGUAGE' $language_list
+ save_to_pam_env 'LANG' $locale_name
+else
+ for var in 'LC_NUMERIC' 'LC_TIME' 'LC_MONETARY' 'LC_PAPER' 'LC_NAME' \
+ 'LC_ADDRESS' 'LC_TELEPHONE' 'LC_MEASUREMENT' 'LC_IDENTIFICATION'; do
+ save_to_pam_env $var $locale_name
+ done
+ papersize=$( $langtoolsdir/locale2papersize $locale_name )
+ save_to_pam_env 'PAPERSIZE' $papersize
+ echo $locale_name
+fi
+
+exit 0
+
diff --git a/data/langtools/set-language-helper b/data/langtools/set-language-helper
new file mode 100755
index 0000000..efbb394
--- /dev/null
+++ b/data/langtools/set-language-helper
@@ -0,0 +1,27 @@
+#!/bin/sh -pe
+
+homedir=$1
+language=$2
+validated_language=
+
+[ -n "$language" -a -n "$homedir" ] || exit 1
+
+langtoolsdir=/usr/share/language-tools
+
+validated_language=$( $langtoolsdir/language-validate $language )
+
+if ! dpkg -l language-selector-gnome > /dev/null 2>&1; then
+ renewed_langlist=$validated_language
+elif [ $language = "${language%:*}" ]; then
+ renewed_langlist=$( $langtoolsdir/update-langlist $validated_language "$homedir" )
+else
+ # $language contains a priority list
+ renewed_langlist=$validated_language:${language#*:}
+fi
+
+locale_name=$( $langtoolsdir/language2locale $validated_language )
+
+( $langtoolsdir/save-to-pam-env "$homedir" $locale_name $renewed_langlist ) || exit 1
+
+echo $validated_language
+
diff --git a/data/langtools/update-langlist b/data/langtools/update-langlist
new file mode 100755
index 0000000..317a60b
--- /dev/null
+++ b/data/langtools/update-langlist
@@ -0,0 +1,48 @@
+#!/bin/sh -pe
+#
+# update-langlist maintains the LANGUAGE priority list. It does so in
+# a simplified manner, unlike the UI in language-selector-gnome for
+# setting the user language which provides full control.
+
+first_language=$1
+homedir=$2
+renewed_langlist=
+
+[ -n "$first_language" -a -n "$homedir" ] || exit 1
+
+get_old_langlist() {
+ if [ -r "$homedir/.pam_environment" ]; then
+ while read line; do
+ if [ "$( echo "${line%=*}" | sed -r 's/\s+DEFAULT$//' )" = 'LANGUAGE' ]; then
+ old_langlist=${line#*=}
+ break
+ fi
+ done < $homedir/.pam_environment
+ fi
+}
+
+old_langlist=
+english=true
+if [ ${first_language%%[_@]*} != 'en' ]; then
+ get_old_langlist
+ english=false
+fi
+
+if [ -n "$old_langlist" ] && ! $english; then
+ if expr $old_langlist : ".*:$first_language:" > /dev/null ; then
+ renewed_langlist=$( echo $old_langlist | sed -r "s/(.+:)($first_language:)/\2\1/" )
+ elif [ ${old_langlist%%:*} = $first_language ]; then
+ # no change
+ renewed_langlist=$old_langlist
+ else
+ renewed_langlist=$first_language:$old_langlist
+ fi
+else
+ # build fresh list with 'en' as the last element
+ # no other languages needed if English was selected
+ renewed_langlist=$first_language
+ [ $first_language != 'en' ] && renewed_langlist=$renewed_langlist:en
+fi
+
+echo $renewed_langlist
+
diff --git a/data/meson.build b/data/meson.build
index 79f7651..e0a21b7 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -52,3 +52,5 @@ if install_systemd_unit_dir
install_dir: systemd_system_unit_dir,
)
endif
+
+subdir('langtools')
--
2.20.1

488
debian/patches/0010-set-language.patch vendored Normal file
View File

@ -0,0 +1,488 @@
From a2646ae602a1eb01d260ee88f2ced0c6a51226ba Mon Sep 17 00:00:00 2001
From: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
Date: Fri, 09 Oct 2020 13:29:00 +0200
Subject: [PATCH 06/12] Save user language and regional formats settings to
~/.pam_environment.
Updated: 2021-11-09
---
src/user.c | 389 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 384 insertions(+), 5 deletions(-)
--- a/src/user.c
+++ b/src/user.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
#include <grp.h>
@@ -336,6 +337,8 @@ user_update_system_account_property (Use
accounts_user_set_system_account (ACCOUNTS_USER (user), system);
}
+static gboolean is_in_pam_environment (User *user, const gchar *property);
+
static void
user_save_to_keyfile (User *user,
GKeyFile *keyfile)
@@ -345,7 +348,7 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_email (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Email", accounts_user_get_email (ACCOUNTS_USER (user)));
- if (accounts_user_get_language (ACCOUNTS_USER (user)))
+ if (accounts_user_get_language (ACCOUNTS_USER (user)) && is_in_pam_environment (user, "Language"))
g_key_file_set_string (keyfile, "User", "Language", accounts_user_get_language (ACCOUNTS_USER (user)));
if (accounts_user_get_session (ACCOUNTS_USER (user)))
@@ -354,7 +357,7 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_session_type (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "SessionType", accounts_user_get_session_type (ACCOUNTS_USER (user)));
- if (accounts_user_get_formats_locale (ACCOUNTS_USER (user)))
+ if (accounts_user_get_formats_locale (ACCOUNTS_USER (user)) && is_in_pam_environment (user, "FormatsLocale"))
g_key_file_set_string (keyfile, "User", "FormatsLocale", accounts_user_get_formats_locale (ACCOUNTS_USER (user)));
if (accounts_user_get_xsession (ACCOUNTS_USER (user)))
@@ -750,6 +753,8 @@ user_changed (User *user)
accounts_user_emit_changed (ACCOUNTS_USER (user));
}
+static gchar *user_get_fallback_value (User *user, const gchar *property);
+
User *
user_new (Daemon *daemon,
uid_t uid)
@@ -760,6 +765,9 @@ user_new (Daemon *daemon,
user->daemon = daemon;
accounts_user_set_uid (ACCOUNTS_USER (user), uid);
+ accounts_user_set_language (ACCOUNTS_USER (user), user_get_fallback_value (user, "Language"));
+ accounts_user_set_formats_locale (ACCOUNTS_USER (user), user_get_fallback_value (user, "FormatsLocale"));
+
return user;
}
@@ -1012,6 +1020,357 @@ user_set_email (AccountsUser *a
return TRUE;
}
+static gboolean
+user_drop_privileges_to_user (User *user)
+{
+ if (setresgid (-1, user->gid, -1) != 0) {
+ g_warning ("setresgid() failed");
+ return FALSE;
+ }
+ if (setresuid (-1, accounts_user_get_uid (ACCOUNTS_USER (user)), -1) != 0) {
+ g_warning ("setresuid() failed");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+user_regain_privileges ()
+{
+ if (setresuid (0, 0, -1) != 0)
+ g_warning ("setresuid() failed");
+ if (setresgid (0, 0, -1) != 0)
+ g_warning ("setresgid() failed");
+}
+
+static gchar *
+user_locale_utf8_fix (const gchar *locale)
+{
+ if (locale == NULL || !g_strrstr (locale, ".utf8"))
+ return g_strdup (locale);
+
+ gchar **tokens = g_strsplit_set (locale, ".8", 3);
+ gchar *fixed_locale = g_strconcat (tokens[0], ".UTF-8", tokens[2], NULL);
+ g_strfreev (tokens);
+
+ return fixed_locale;
+}
+
+static gchar *
+user_language_validate (User *user,
+ const gchar *lang)
+{
+ gboolean ret;
+ const gchar *program = "/usr/share/language-tools/language-validate";
+ gchar *command = g_strconcat (program, " ", lang, NULL);
+ gchar *validated_language;
+ GError *error = NULL;
+
+ if (!user_drop_privileges_to_user (user))
+ return NULL;
+ ret = g_spawn_command_line_sync (command, &validated_language, NULL, NULL, &error);
+ user_regain_privileges ();
+
+ g_free (command);
+ if (!ret) {
+ g_warning ("Couldn't get validated language: %s", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+ return g_strchomp (validated_language);
+}
+
+static gchar *
+user_locale_validate (User *user,
+ const gchar *locale,
+ GDBusMethodInvocation *context)
+{
+ gchar *validated_locale = NULL;
+ gchar *tmp_locale = NULL;
+ gchar *tmp_locale_utf8 = NULL;
+ gboolean ret = FALSE;
+ gchar *output = NULL;
+ GError *error = NULL;
+ gboolean found = FALSE;
+
+ if (locale == NULL || strlen (locale) < 2)
+ goto out;
+ tmp_locale = g_strdup (locale);
+ g_strchomp (tmp_locale);
+
+ /* When a new language has been installed, we want to be able to instantly
+ set a locale for that language to denote the regional formats. For that
+ reason we make use of 'locale -a' instead of calling setlocale(). */
+
+ if (!user_drop_privileges_to_user (user))
+ goto out;
+ ret = g_spawn_command_line_sync ("locale -a", &output, NULL, NULL, &error);
+ user_regain_privileges ();
+ if (!ret) {
+ throw_error (context, ERROR_FAILED, "Failed to run 'locale -a': %s", error->message);
+ g_clear_error (&error);
+ goto out;
+ }
+
+ /* Replace 'UTF-8' with 'utf8' since 'locale -a' outputs the latter. */
+ tmp_locale_utf8 = g_strdup (tmp_locale);
+ if (g_strrstr (tmp_locale_utf8, ".UTF-8")) {
+ gchar **tokens = g_strsplit_set (tmp_locale_utf8, ".8", 3);
+ g_free (tmp_locale_utf8);
+ tmp_locale_utf8 = g_strconcat (tokens[0], ".utf8", tokens[2], NULL);
+ g_strfreev (tokens);
+ }
+
+ gchar **tokens;
+ int i;
+ g_strchomp (output);
+ tokens = g_strsplit (output, "\n", -1);
+ for (i = 0; tokens[i]; i++) {
+ if (g_strcmp0 (tokens[i], "C") == 0 ||
+ g_strcmp0 (tokens[i], "C.UTF-8") == 0 ||
+ g_strcmp0 (tokens[i], "POSIX") == 0)
+ continue;
+
+ if (g_strcmp0 (tokens[i], tmp_locale_utf8) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+ g_strfreev (tokens);
+
+ if (!found && g_strcmp0 (tmp_locale, "C.UTF-8") != 0) {
+ throw_error (context, ERROR_FAILED, "'%s' is not a valid locale name", tmp_locale);
+ goto out;
+ }
+ validated_locale = user_locale_utf8_fix (tmp_locale);
+
+out:
+ g_free (tmp_locale);
+ g_free (tmp_locale_utf8);
+ g_free (output);
+
+ return validated_locale;
+}
+
+static gchar *
+strip_quotes (const gchar *str)
+{
+ if ((g_str_has_prefix (str, "\"") && g_str_has_suffix (str, "\""))
+ || (g_str_has_prefix (str, "'") && g_str_has_suffix (str, "'")))
+ return g_strndup (str + 1, strlen (str) - 2);
+ else
+ return g_strdup (str);
+}
+
+static gchar *
+user_get_fallback_value (User *user,
+ const gchar *property)
+{
+ static gchar *system_language;
+ static gchar *system_formats_locale;
+
+ if (g_strcmp0 (property, "Language") == 0 && system_language)
+ return system_language;
+ if (g_strcmp0 (property, "FormatsLocale") == 0 && system_formats_locale)
+ return system_formats_locale;
+
+ gchar *fallback_value = NULL;
+ gchar *language = NULL;
+ gchar *lang = NULL;
+ gchar *lctime = NULL;
+
+ FILE *fp;
+ if ((fp = fopen ("/etc/default/locale", "r"))) {
+ gchar line[50];
+ while ((fgets (line, 50, fp)) != NULL) {
+ g_strchomp (line);
+ if (g_str_has_prefix (line, "LANGUAGE="))
+ language = strip_quotes (line + strlen ("LANGUAGE="));
+ else if (g_str_has_prefix (line, "LANG="))
+ lang = strip_quotes (line + strlen ("LANG="));
+ else if (g_str_has_prefix (line, "LC_TIME="))
+ lctime = strip_quotes (line + strlen ("LC_TIME="));
+ }
+ fclose (fp);
+ }
+
+ if (g_strcmp0 (property, "Language") == 0) {
+ gchar *tmp = NULL;
+ if (language)
+ tmp = language;
+ else if (lang)
+ tmp = lang;
+ system_language = user_language_validate (user, tmp);
+ fallback_value = system_language;
+ }
+
+ if (g_strcmp0 (property, "FormatsLocale") == 0) {
+ gchar *tmp = NULL;
+ if (lctime)
+ tmp = lctime;
+ else if (lang)
+ tmp = lang;
+ system_formats_locale = user_locale_utf8_fix (tmp);
+ fallback_value = system_formats_locale;
+ }
+
+ g_free (language);
+ g_free (lang);
+ g_free (lctime);
+
+ return fallback_value;
+}
+
+static gchar *
+user_update_environment (User *user,
+ gchar *data,
+ const gchar *script,
+ GDBusMethodInvocation *context)
+
+/* This function updates ~/.pam_environment by means of the help files in /usr/share/language-tools. */
+{
+ gchar *program;
+ gchar *validated_data = NULL;
+ gint i;
+ const gchar *allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890._+-:/ @";
+ gboolean ret;
+ GError *error = NULL;
+
+ if (data == NULL)
+ return NULL;
+
+ program = g_build_path ("/", "/usr/share/language-tools", script, NULL);
+ const gchar *command[] = { program, accounts_user_get_home_directory (ACCOUNTS_USER (user)), data, NULL };
+
+ /* test for odd characters in arguments */
+ for (i = 1; i <= 2; i++) {
+ if (strlen (command[i]) != strspn (command[i], allowed_chars)) {
+ throw_error (context, ERROR_FAILED, "non-permitted character(s) in argument");
+ goto out;
+ }
+ }
+
+ /* set applicable environment variables in ~/.pam_environment */
+ if (!user_drop_privileges_to_user (user))
+ goto out;
+ ret = g_spawn_sync ( NULL,
+ (gchar **)command,
+ NULL,
+ G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL,
+ NULL,
+ &validated_data,
+ NULL,
+ NULL,
+ &error );
+ user_regain_privileges ();
+ if (!ret) {
+ throw_error (context, ERROR_FAILED, "running '%s' failed: %s", program, error->message);
+ g_error_free (error);
+ validated_data = NULL;
+ goto out;
+ }
+ if (validated_data == NULL || strlen (validated_data) <= 1) {
+ throw_error (context, ERROR_FAILED, "running '%s' failed: no output", program);
+ validated_data = NULL;
+ goto out;
+ }
+
+out:
+ g_free (program);
+ if (validated_data == NULL)
+ return NULL;
+
+ return g_strchomp (validated_data);
+}
+
+static gboolean
+user_HOME_available (User *user)
+{
+ /* run these tests as user to prevent incorrect
+ failures when HOME is on NFS */
+ user_drop_privileges_to_user (user);
+
+ GDir* homedir = g_dir_open (accounts_user_get_home_directory (ACCOUNTS_USER (user)), 0, NULL);
+
+ if (homedir == NULL) { // HOME not found
+ user_regain_privileges ();
+ return FALSE;
+ } else {
+ do {
+ const gchar *entry = g_dir_read_name (homedir);
+ gchar *path_to_entry = g_build_path ("/", accounts_user_get_home_directory (ACCOUNTS_USER (user)), entry, NULL);
+ if (g_file_test (path_to_entry, G_FILE_TEST_IS_SYMLINK)) {
+ g_free (path_to_entry);
+ continue;
+ }
+ if (g_strcmp0 (entry, NULL) == 0) { // HOME contains only symlinks
+ g_free (path_to_entry);
+ g_dir_close (homedir);
+ user_regain_privileges ();
+ return FALSE;
+ } else
+ g_free (path_to_entry);
+ break;
+ } while (TRUE);
+ }
+
+ g_dir_close (homedir);
+ user_regain_privileges ();
+
+ return TRUE;
+}
+
+static gboolean
+is_in_pam_environment (User *user,
+ const gchar *property)
+{
+ gboolean ret = FALSE;
+ const gchar *prefix;
+ FILE *fp;
+ g_autofree gchar *pam_env = NULL;
+ int lineno = 0;
+ int fd;
+
+ if (g_strcmp0 (property, "Language") == 0)
+ prefix = "LANG";
+ else if (g_strcmp0 (property, "FormatsLocale") == 0)
+ prefix = "LC_TIME";
+ else
+ return FALSE;
+
+ pam_env = g_build_path ("/", accounts_user_get_home_directory (ACCOUNTS_USER (user)), ".pam_environment", NULL);
+
+ if (!user_drop_privileges_to_user (user))
+ return FALSE;
+
+ fd = open (pam_env, O_RDONLY | O_NOFOLLOW);
+ if (fd < 0) {
+ user_regain_privileges ();
+ return FALSE;
+ }
+
+ if ((fp = fdopen (fd, "r"))) {
+ gchar line[50];
+ while ((fgets (line, 50, fp)) != NULL) {
+ if (g_str_has_prefix (line, prefix)) {
+ ret = TRUE;
+ break;
+ }
+ /* Give up on large files */
+ if (lineno > 50) {
+ ret = FALSE;
+ break;
+ }
+ lineno++;
+ }
+ fclose (fp);
+ }
+ user_regain_privileges ();
+
+ return ret;
+}
+
static void
user_change_language_authorized_cb (Daemon *daemon,
User *user,
@@ -1019,14 +1378,44 @@ user_change_language_authorized_cb (Daem
gpointer data)
{
- gchar *language = data;
+ const gchar *language = data;
+
+ if (!user_HOME_available (user)) {
+
+ /* SetLanguage was probably called from a login greeter,
+ and HOME not mounted and/or not decrypted.
+ Hence don't save anything, or else accountsservice
+ and ~/.pam_environment would become out of sync. */
+ throw_error (context, ERROR_FAILED, "not access to HOME yet so language not saved");
+ goto out;
+ }
if (g_strcmp0 (accounts_user_get_language (ACCOUNTS_USER (user)), language) != 0) {
- accounts_user_set_language (ACCOUNTS_USER (user), language);
+ g_autofree gchar *lang = user_update_environment (user,
+ (gchar *) language,
+ "set-language-helper",
+ context);
+ if (lang != NULL)
+ accounts_user_set_language (ACCOUNTS_USER (user), lang);
+
+ if (!is_in_pam_environment (user, "FormatsLocale")) {
+
+ /* set the user formats (certain LC_* variables) explicitly
+ in order to prevent surprises when LANG is changed */
+ gchar *fallback_locale = user_get_fallback_value (user, "FormatsLocale");
+ g_autofree gchar *validated_locale = user_locale_validate (user, fallback_locale, context);
+ g_autofree gchar *formats_locale = user_update_environment (user,
+ validated_locale,
+ "save-to-pam-env",
+ context);
+ if (formats_locale != NULL)
+ accounts_user_set_formats_locale (ACCOUNTS_USER (user), formats_locale);
+ }
save_extra_data (user);
}
+out:
accounts_user_complete_set_language (ACCOUNTS_USER (user), context);
}
@@ -1171,7 +1560,13 @@ user_change_formats_locale_authorized_cb
const gchar *formats_locale = user_data;
if (g_strcmp0 (accounts_user_get_formats_locale (ACCOUNTS_USER (user)), formats_locale) != 0) {
- accounts_user_set_formats_locale (ACCOUNTS_USER (user), formats_locale);
+ g_autofree gchar *validated_locale = user_locale_validate (user, formats_locale, context);
+ g_autofree gchar *locale = user_update_environment (user,
+ validated_locale,
+ "save-to-pam-env",
+ context);
+ if (locale != NULL)
+ accounts_user_set_formats_locale (ACCOUNTS_USER (user), locale);
save_extra_data (user);
}

View File

@ -0,0 +1,300 @@
From ace0d7e184ff7011a26eb9287f81ef2d884f09e3 Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@ubuntu.com>
Date: Thu, 21 Dec 2017 15:11:01 +1300
Subject: [PATCH 07/12] Add support for a BackgroundFile property, similar to
IconFile
---
data/org.freedesktop.Accounts.User.xml | 45 ++++++++++++++
src/libaccountsservice/act-user.c | 55 +++++++++++++++++
src/libaccountsservice/act-user.h | 3 +
src/user.c | 81 ++++++++++++++++++++++++++
4 files changed, 184 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index d4adc3f..143794c 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -414,6 +414,41 @@
</doc:doc>
</method>
+ <method name="SetBackgroundFile">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="filename" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>
+ The absolute filename of a png file to use as the users background.
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the users background.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his own background</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the background of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
<method name="SetIconFile">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="filename" direction="in" type="s">
@@ -874,6 +909,16 @@
</doc:doc>
</property>
+ <property name="BackgroundFile" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The filename of a png file containing the users background.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="IconFile" type="s" access="read">
<doc:doc>
<doc:description>
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
index 2861518..554d371 100644
--- a/src/libaccountsservice/act-user.c
+++ b/src/libaccountsservice/act-user.c
@@ -93,6 +93,7 @@ enum {
PROP_LOGIN_FREQUENCY,
PROP_LOGIN_TIME,
PROP_LOGIN_HISTORY,
+ PROP_BACKGROUND_FILE,
PROP_ICON_FILE,
PROP_LANGUAGE,
PROP_FORMATS_LOCALE,
@@ -373,6 +374,13 @@ act_user_class_init (ActUserClass *class)
G_VARIANT_TYPE ("a(xxa{sv})"),
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_BACKGROUND_FILE,
+ g_param_spec_string ("background-file",
+ "Background File",
+ "The path to a background for this user.",
+ NULL,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_ICON_FILE,
g_param_spec_string ("icon-file",
@@ -996,6 +1004,25 @@ act_user_is_nonexistent (ActUser *user)
return user->nonexistent;
}
+/**
+ * act_user_get_background_file:
+ * @user: a #ActUser
+ *
+ * Returns the path to the account background belonging to @user.
+ *
+ * Returns: (transfer none): a path to a background
+ */
+const char *
+act_user_get_background_file (ActUser *user)
+{
+ g_return_val_if_fail (ACT_IS_USER (user), NULL);
+
+ if (user->accounts_proxy == NULL)
+ return NULL;
+
+ return accounts_user_get_background_file (user->accounts_proxy);
+}
+
/**
* act_user_get_icon_file:
* @user: a #ActUser
@@ -1421,6 +1448,34 @@ act_user_set_language (ActUser *user,
}
}
+/**
+ * act_user_set_background_file:
+ * @user: the user object to alter.
+ * @background_file: path to an background
+ *
+ * Assigns a new background for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_background_file (ActUser *user,
+ const char *background_file)
+{
+ g_autoptr(GError) error = NULL;
+
+ g_return_if_fail (ACT_IS_USER (user));
+ g_return_if_fail (background_file != NULL);
+ g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+
+ if (!accounts_user_call_set_background_file_sync (user->accounts_proxy,
+ background_file,
+ NULL,
+ &error)) {
+ g_warning ("SetBackgroundFile call failed: %s", error->message);
+ return;
+ }
+}
+
/**
* act_user_set_x_session:
* @user: the user object to alter.
diff --git a/src/libaccountsservice/act-user.h b/src/libaccountsservice/act-user.h
index 323e3a5..40cf7aa 100644
--- a/src/libaccountsservice/act-user.h
+++ b/src/libaccountsservice/act-user.h
@@ -76,6 +76,7 @@ gboolean act_user_get_automatic_login (ActUser *user);
gboolean act_user_is_system_account (ActUser *user);
gboolean act_user_is_local_account (ActUser *user);
gboolean act_user_is_nonexistent (ActUser *user);
+const char *act_user_get_background_file (ActUser *user);
const char *act_user_get_icon_file (ActUser *user);
const char *act_user_get_language (ActUser *user);
const char *act_user_get_formats_locale (ActUser *user);
@@ -102,6 +103,8 @@ void act_user_set_language (ActUser *user,
const char *language);
void act_user_set_formats_locale (ActUser *user,
const char *formats_locale);
+void act_user_set_background_file (ActUser *user,
+ const char *background_file);
void act_user_set_x_session (ActUser *user,
const char *x_session);
void act_user_set_session (ActUser *user,
diff --git a/src/user.c b/src/user.c
index 0daeac9..789d7d8 100644
--- a/src/user.c
+++ b/src/user.c
@@ -301,6 +301,12 @@ user_update_from_keyfile (User *user,
g_clear_pointer (&s, g_free);
}
+ s = g_key_file_get_string (keyfile, "User", "Background", NULL);
+ if (s != NULL) {
+ accounts_user_set_background_file (ACCOUNTS_USER (user), s);
+ g_clear_pointer (&s, g_free);
+ }
+
s = g_key_file_get_string (keyfile, "User", "Icon", NULL);
if (s != NULL) {
accounts_user_set_icon_file (ACCOUNTS_USER (user), s);
@@ -366,6 +372,9 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_password_hint (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "PasswordHint", accounts_user_get_password_hint (ACCOUNTS_USER (user)));
+ if (accounts_user_get_background_file (ACCOUNTS_USER (user)))
+ g_key_file_set_string (keyfile, "User", "Background", accounts_user_get_background_file (ACCOUNTS_USER (user)));
+
if (accounts_user_get_icon_file (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Icon", accounts_user_get_icon_file (ACCOUNTS_USER (user)));
@@ -1854,6 +1863,77 @@ become_user (gpointer data)
}
}
+static void
+user_change_background_file_authorized_cb (Daemon *daemon,
+ User *user,
+ GDBusMethodInvocation *context,
+ gpointer data)
+{
+ g_autofree gchar *filename = NULL;
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GFileInfo) info = NULL;
+ GFileType type;
+
+ filename = g_strdup (data);
+
+ if (filename == NULL ||
+ *filename == '\0') {
+ g_free (filename);
+ filename = NULL;
+
+ goto background_saved;
+ }
+
+ file = g_file_new_for_path (filename);
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ 0, NULL, NULL);
+ type = g_file_info_get_file_type (info);
+
+ if (type != G_FILE_TYPE_REGULAR) {
+ g_debug ("not a regular file\n");
+ throw_error (context, ERROR_FAILED, "file '%s' is not a regular file", filename);
+ return;
+ }
+
+background_saved:
+ accounts_user_set_background_file (ACCOUNTS_USER (user), filename);
+
+ save_extra_data (user);
+
+ accounts_user_complete_set_background_file (ACCOUNTS_USER (user), context);
+}
+
+static gboolean
+user_set_background_file (AccountsUser *auser,
+ GDBusMethodInvocation *context,
+ const gchar *filename)
+{
+ User *user = (User*)auser;
+ int uid;
+ const gchar *action_id;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "identifying caller failed");
+ return FALSE;
+ }
+
+ if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
+ action_id = "org.freedesktop.accounts.change-own-user-data";
+ else
+ action_id = "org.freedesktop.accounts.user-administration";
+
+ daemon_local_check_auth (user->daemon,
+ user,
+ action_id,
+ TRUE,
+ user_change_background_file_authorized_cb,
+ context,
+ g_strdup (filename),
+ (GDestroyNotify)g_free);
+
+ return TRUE;
+}
+
static void
user_change_icon_file_authorized_cb (Daemon *daemon,
User *user,
@@ -2536,6 +2616,7 @@ user_accounts_user_iface_init (AccountsUserIface *iface)
{
iface->handle_set_account_type = user_set_account_type;
iface->handle_set_automatic_login = user_set_automatic_login;
+ iface->handle_set_background_file = user_set_background_file;
iface->handle_set_email = user_set_email;
iface->handle_set_formats_locale = user_set_formats_locale;
iface->handle_set_home_directory = user_set_home_directory;
--
2.20.1

View File

@ -0,0 +1,281 @@
From 5b94fee636146034fb2fbf314853bdb3380518fb Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@ubuntu.com>
Date: Thu, 21 Dec 2017 15:11:19 +1300
Subject: [PATCH 08/12] Add XKeyboardLayouts property to report a user's
keyboard layouts, largely for LightDM's benefit.
---
data/org.freedesktop.Accounts.User.xml | 45 +++++++++++++++++++++
src/libaccountsservice/act-user.c | 55 ++++++++++++++++++++++++++
src/libaccountsservice/act-user.h | 3 ++
src/user.c | 55 ++++++++++++++++++++++++++
4 files changed, 158 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index 143794c..e4604b1 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -414,6 +414,41 @@
</doc:doc>
</method>
+ <method name="SetXKeyboardLayouts">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="layouts" direction="in" type="as">
+ <doc:doc>
+ <doc:summary>
+ The name of the keyboard layouts to use as the user's keyboard layout. The first is the default.
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the user's keyboard layouts.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his or her own keyboard layouts</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the keyboard layouts of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
<method name="SetBackgroundFile">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="filename" direction="in" type="s">
@@ -909,6 +944,16 @@
</doc:doc>
</property>
+ <property name="XKeyboardLayouts" type="as" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The names of the user's keyboard layouts.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="BackgroundFile" type="s" access="read">
<doc:doc>
<doc:description>
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
index 554d371..982d64f 100644
--- a/src/libaccountsservice/act-user.c
+++ b/src/libaccountsservice/act-user.c
@@ -93,6 +93,7 @@ enum {
PROP_LOGIN_FREQUENCY,
PROP_LOGIN_TIME,
PROP_LOGIN_HISTORY,
+ PROP_X_KEYBOARD_LAYOUTS,
PROP_BACKGROUND_FILE,
PROP_ICON_FILE,
PROP_LANGUAGE,
@@ -374,6 +375,13 @@ act_user_class_init (ActUserClass *class)
G_VARIANT_TYPE ("a(xxa{sv})"),
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_X_KEYBOARD_LAYOUTS,
+ g_param_spec_boxed ("xkeyboard-layouts",
+ "Keyboard layouts",
+ "The name of keyboard layouts for this user.",
+ G_TYPE_STRV,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_FILE,
g_param_spec_string ("background-file",
@@ -1004,6 +1012,25 @@ act_user_is_nonexistent (ActUser *user)
return user->nonexistent;
}
+/**
+ * act_user_get_x_keyboard_layouts:
+ * @user: a #ActUser
+ *
+ * Returns the name of the account keyboard layouts belonging to @user.
+ *
+ * Returns: (transfer none): names of keyboard layouts
+ */
+const char * const *
+act_user_get_x_keyboard_layouts (ActUser *user)
+{
+ g_return_val_if_fail (ACT_IS_USER (user), NULL);
+
+ if (user->accounts_proxy == NULL)
+ return NULL;
+
+ return accounts_user_get_xkeyboard_layouts (user->accounts_proxy);
+}
+
/**
* act_user_get_background_file:
* @user: a #ActUser
@@ -1364,6 +1391,34 @@ act_user_get_password_expiration_policy (ActUser *user,
}
}
+/**
+ * act_user_set_x_keyboard_layouts:
+ * @user: the user object to alter.
+ * @keyboard_layouts: names of keyboard layouts
+ *
+ * Assigns a new set of keyboard layouts for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_x_keyboard_layouts (ActUser *user,
+ const char * const *keyboard_layouts)
+{
+ g_autoptr(GError) error = NULL;
+
+ g_return_if_fail (ACT_IS_USER (user));
+ g_return_if_fail (keyboard_layouts != NULL);
+ g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+
+ if (!accounts_user_call_set_xkeyboard_layouts_sync (user->accounts_proxy,
+ keyboard_layouts,
+ NULL,
+ &error)) {
+ g_warning ("SetXKeyboardLayouts call failed: %s", error->message);
+ return;
+ }
+}
+
/**
* act_user_set_formats_locale:
* @user: the user object to alter.
diff --git a/src/libaccountsservice/act-user.h b/src/libaccountsservice/act-user.h
index 40cf7aa..52c98b4 100644
--- a/src/libaccountsservice/act-user.h
+++ b/src/libaccountsservice/act-user.h
@@ -75,6 +75,7 @@ gboolean act_user_get_locked (ActUser *user);
gboolean act_user_get_automatic_login (ActUser *user);
gboolean act_user_is_system_account (ActUser *user);
gboolean act_user_is_local_account (ActUser *user);
+const char * const *act_user_get_x_keyboard_layouts (ActUser *user);
gboolean act_user_is_nonexistent (ActUser *user);
const char *act_user_get_background_file (ActUser *user);
const char *act_user_get_icon_file (ActUser *user);
@@ -101,6 +102,8 @@ void act_user_set_email (ActUser *user,
const char *email);
void act_user_set_language (ActUser *user,
const char *language);
+void act_user_set_x_keyboard_layouts (ActUser *user,
+ const char * const *keyboard_layouts);
void act_user_set_formats_locale (ActUser *user,
const char *formats_locale);
void act_user_set_background_file (ActUser *user,
diff --git a/src/user.c b/src/user.c
index 789d7d8..06b3891 100644
--- a/src/user.c
+++ b/src/user.c
@@ -247,6 +247,7 @@ user_update_from_keyfile (User *user,
GKeyFile *keyfile)
{
gchar *s;
+ gchar **layouts;
g_object_freeze_notify (G_OBJECT (user));
@@ -301,6 +302,12 @@ user_update_from_keyfile (User *user,
g_clear_pointer (&s, g_free);
}
+ layouts = g_key_file_get_string_list (keyfile, "User", "XKeyboardLayouts", NULL, NULL);
+ if (layouts != NULL) {
+ accounts_user_set_xkeyboard_layouts (ACCOUNTS_USER (user), (const gchar * const *) layouts);
+ g_strfreev (layouts);
+ }
+
s = g_key_file_get_string (keyfile, "User", "Background", NULL);
if (s != NULL) {
accounts_user_set_background_file (ACCOUNTS_USER (user), s);
@@ -372,6 +379,9 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_password_hint (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "PasswordHint", accounts_user_get_password_hint (ACCOUNTS_USER (user)));
+ if (accounts_user_get_xkeyboard_layouts (ACCOUNTS_USER (user)))
+ g_key_file_set_string_list (keyfile, "User", "XKeyboardLayouts", (const gchar * const *) accounts_user_get_xkeyboard_layouts (ACCOUNTS_USER (user)), g_strv_length ((gchar **) accounts_user_get_xkeyboard_layouts (ACCOUNTS_USER (user))));
+
if (accounts_user_get_background_file (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Background", accounts_user_get_background_file (ACCOUNTS_USER (user)));
@@ -1863,6 +1873,50 @@ become_user (gpointer data)
}
}
+static void
+user_change_x_keyboard_layouts_authorized_cb (Daemon *daemon,
+ User *user,
+ GDBusMethodInvocation *context,
+ gpointer data)
+{
+ accounts_user_set_xkeyboard_layouts (ACCOUNTS_USER (user), data);
+
+ save_extra_data (user);
+
+ accounts_user_complete_set_xkeyboard_layouts (ACCOUNTS_USER (user), context);
+}
+
+static gboolean
+user_set_xkeyboard_layouts (AccountsUser *auser,
+ GDBusMethodInvocation *context,
+ const gchar * const *layouts)
+{
+ User *user = (User*)auser;
+ int uid;
+ const gchar *action_id;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "identifying caller failed");
+ return FALSE;
+ }
+
+ if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
+ action_id = "org.freedesktop.accounts.change-own-user-data";
+ else
+ action_id = "org.freedesktop.accounts.user-administration";
+
+ daemon_local_check_auth (user->daemon,
+ user,
+ action_id,
+ TRUE,
+ user_change_x_keyboard_layouts_authorized_cb,
+ context,
+ g_strdupv ((gchar **)layouts),
+ (GDestroyNotify)g_strfreev);
+
+ return TRUE;
+}
+
static void
user_change_background_file_authorized_cb (Daemon *daemon,
User *user,
@@ -2630,6 +2684,7 @@ user_accounts_user_iface_init (AccountsUserIface *iface)
iface->handle_set_real_name = user_set_real_name;
iface->handle_set_shell = user_set_shell;
iface->handle_set_user_name = user_set_user_name;
+ iface->handle_set_xkeyboard_layouts = user_set_xkeyboard_layouts;
iface->handle_set_xsession = user_set_x_session;
iface->handle_set_session = user_set_session;
iface->handle_set_session_type = user_set_session_type;
--
2.20.1

View File

@ -0,0 +1,255 @@
From d8a0af56bae46720e053a6ce25b2d5273d7233d3 Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@ubuntu.com>
Date: Thu, 21 Dec 2017 15:11:37 +1300
Subject: [PATCH 09/12] Add XHasMessages property to report if a user had
unread messages, largely for LightDM's benefit.
---
data/org.freedesktop.Accounts.User.xml | 45 +++++++++++++++++++++
src/libaccountsservice/act-user.c | 55 ++++++++++++++++++++++++++
src/libaccountsservice/act-user.h | 3 ++
src/user.c | 43 ++++++++++++++++++++
4 files changed, 146 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index e4604b1..96d30a7 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -414,6 +414,41 @@
</doc:doc>
</method>
+ <method name="SetXHasMessages">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="has_messages" direction="in" type="b">
+ <doc:doc>
+ <doc:summary>
+ Whether the user has messages waiting for them.
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets whether the user has messages waiting for them.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his or her own status</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the status of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
<method name="SetXKeyboardLayouts">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="layouts" direction="in" type="as">
@@ -944,6 +979,16 @@
</doc:doc>
</property>
+ <property name="XHasMessages" type="b" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Whether the user has messages waiting for them.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="XKeyboardLayouts" type="as" access="read">
<doc:doc>
<doc:description>
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
index 982d64f..fdc8b2d 100644
--- a/src/libaccountsservice/act-user.c
+++ b/src/libaccountsservice/act-user.c
@@ -93,6 +93,7 @@ enum {
PROP_LOGIN_FREQUENCY,
PROP_LOGIN_TIME,
PROP_LOGIN_HISTORY,
+ PROP_X_HAS_MESSAGES,
PROP_X_KEYBOARD_LAYOUTS,
PROP_BACKGROUND_FILE,
PROP_ICON_FILE,
@@ -117,6 +118,7 @@ struct _ActUser {
GList *our_sessions;
GList *other_sessions;
+ guint x_has_messages : 1;
guint is_loaded : 1;
guint nonexistent : 1;
};
@@ -375,6 +377,13 @@ act_user_class_init (ActUserClass *class)
G_VARIANT_TYPE ("a(xxa{sv})"),
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_X_HAS_MESSAGES,
+ g_param_spec_boolean ("xhas-messages",
+ "Has Messages",
+ "Whether the user has messages waiting.",
+ FALSE,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_X_KEYBOARD_LAYOUTS,
g_param_spec_boxed ("xkeyboard-layouts",
@@ -1012,6 +1021,25 @@ act_user_is_nonexistent (ActUser *user)
return user->nonexistent;
}
+/**
+ * act_user_get_x_has_messages:
+ * @user: a #ActUser
+ *
+ * Returns whether @user has messages waiting for them.
+ *
+ * Returns: whether messages exist
+ */
+gboolean
+act_user_get_x_has_messages (ActUser *user)
+{
+ g_return_val_if_fail (ACT_IS_USER (user), FALSE);
+
+ if (user->accounts_proxy == NULL)
+ return FALSE;
+
+ return accounts_user_get_xhas_messages (user->accounts_proxy);
+}
+
/**
* act_user_get_x_keyboard_layouts:
* @user: a #ActUser
@@ -1391,6 +1419,33 @@ act_user_get_password_expiration_policy (ActUser *user,
}
}
+/**
+ * act_user_set_x_has_messages:
+ * @user: the user object to alter.
+ * @has_messages: whether the user has messages waiting
+ *
+ * Sets a new has-messages status for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_x_has_messages (ActUser *user,
+ gboolean has_messages)
+{
+ g_autoptr(GError) error = NULL;
+
+ g_return_if_fail (ACT_IS_USER (user));
+ g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+
+ if (!accounts_user_call_set_xhas_messages_sync (user->accounts_proxy,
+ has_messages,
+ NULL,
+ &error)) {
+ g_warning ("SetXHasMessages call failed: %s", error->message);
+ return;
+ }
+}
+
/**
* act_user_set_x_keyboard_layouts:
* @user: the user object to alter.
diff --git a/src/libaccountsservice/act-user.h b/src/libaccountsservice/act-user.h
index 52c98b4..d460ef9 100644
--- a/src/libaccountsservice/act-user.h
+++ b/src/libaccountsservice/act-user.h
@@ -77,6 +77,7 @@ gboolean act_user_is_system_account (ActUser *user);
gboolean act_user_is_local_account (ActUser *user);
const char * const *act_user_get_x_keyboard_layouts (ActUser *user);
gboolean act_user_is_nonexistent (ActUser *user);
+gboolean act_user_get_x_has_messages (ActUser *user);
const char *act_user_get_background_file (ActUser *user);
const char *act_user_get_icon_file (ActUser *user);
const char *act_user_get_language (ActUser *user);
@@ -102,6 +103,8 @@ void act_user_set_email (ActUser *user,
const char *email);
void act_user_set_language (ActUser *user,
const char *language);
+void act_user_set_x_has_messages (ActUser *user,
+ gboolean has_messages);
void act_user_set_x_keyboard_layouts (ActUser *user,
const char * const *keyboard_layouts);
void act_user_set_formats_locale (ActUser *user,
diff --git a/src/user.c b/src/user.c
index 06b3891..8bb1530 100644
--- a/src/user.c
+++ b/src/user.c
@@ -1873,6 +1873,48 @@ become_user (gpointer data)
}
}
+static void
+user_change_x_has_messages_authorized_cb (Daemon *daemon,
+ User *user,
+ GDBusMethodInvocation *context,
+ gpointer data)
+{
+ accounts_user_set_xhas_messages (ACCOUNTS_USER (user), GPOINTER_TO_INT (data));
+
+ accounts_user_complete_set_xhas_messages (ACCOUNTS_USER (user), context);
+}
+
+static gboolean
+user_set_xhas_messages (AccountsUser *auser,
+ GDBusMethodInvocation *context,
+ gboolean has_messages)
+{
+ User *user = (User*)auser;
+ int uid;
+ const gchar *action_id;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "identifying caller failed");
+ return FALSE;
+ }
+
+ if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
+ action_id = "org.freedesktop.accounts.change-own-user-data";
+ else
+ action_id = "org.freedesktop.accounts.user-administration";
+
+ daemon_local_check_auth (user->daemon,
+ user,
+ action_id,
+ TRUE,
+ user_change_x_has_messages_authorized_cb,
+ context,
+ GINT_TO_POINTER (has_messages),
+ NULL);
+
+ return TRUE;
+}
+
static void
user_change_x_keyboard_layouts_authorized_cb (Daemon *daemon,
User *user,
@@ -2684,6 +2726,7 @@ user_accounts_user_iface_init (AccountsUserIface *iface)
iface->handle_set_real_name = user_set_real_name;
iface->handle_set_shell = user_set_shell;
iface->handle_set_user_name = user_set_user_name;
+ iface->handle_set_xhas_messages = user_set_xhas_messages;
iface->handle_set_xkeyboard_layouts = user_set_xkeyboard_layouts;
iface->handle_set_xsession = user_set_x_session;
iface->handle_set_session = user_set_session;
--
2.20.1

View File

@ -0,0 +1,404 @@
From 273e6f0892ed7bc1cc31f74fc08423edc95a4ef4 Mon Sep 17 00:00:00 2001
From: William Hua <william@attente.ca>
Date: Fri, 26 Jul 2013 10:10:11 -0400
Subject: [PATCH 10/12] Store input sources in user objects.
---
data/org.freedesktop.Accounts.User.xml | 45 +++++++
src/libaccountsservice/act-user.c | 56 ++++++++
src/libaccountsservice/act-user.h | 3 +
src/user.c | 171 +++++++++++++++++++++++++
4 files changed, 275 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index 96d30a7..c62b4bb 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -185,6 +185,41 @@
</doc:doc>
</method>
+ <method name="SetInputSources">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="sources" direction="in" type="aa{ss}">
+ <doc:doc>
+ <doc:summary>
+ A list of input sources.
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the user's input sources.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his own input sources</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the input sources of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
<method name="SetXSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_x_session"/>
@@ -921,6 +956,16 @@
</doc:doc>
</property>
+ <property name="InputSources" type="aa{ss}" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The user's input sources.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="XSession" type="s" access="read">
<doc:doc>
<doc:description>
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
index fdc8b2d..8e012de 100644
--- a/src/libaccountsservice/act-user.c
+++ b/src/libaccountsservice/act-user.c
@@ -99,6 +99,7 @@ enum {
PROP_ICON_FILE,
PROP_LANGUAGE,
PROP_FORMATS_LOCALE,
+ PROP_INPUT_SOURCES,
PROP_X_SESSION,
PROP_IS_LOADED
};
@@ -419,6 +420,14 @@ act_user_class_init (ActUserClass *class)
"User's regional formats.",
NULL,
G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class,
+ PROP_INPUT_SOURCES,
+ g_param_spec_variant ("input-sources",
+ "Input sources",
+ "User's input sources.",
+ G_VARIANT_TYPE ("aa{ss}"),
+ NULL,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_X_SESSION,
g_param_spec_string ("x-session",
@@ -1135,6 +1144,25 @@ act_user_get_formats_locale (ActUser *user)
return accounts_user_get_formats_locale (user->accounts_proxy);
}
+/**
+ * act_user_get_input_sources:
+ * @user: a #ActUser
+ *
+ * Returns the input sources of @user.
+ *
+ * Returns: (transfer none): a list of input sources
+ */
+GVariant *
+act_user_get_input_sources (ActUser *user)
+{
+ g_return_val_if_fail (ACT_IS_USER (user), NULL);
+
+ if (user->accounts_proxy == NULL)
+ return NULL;
+
+ return accounts_user_get_input_sources (user->accounts_proxy);
+}
+
/**
* act_user_get_x_session:
* @user: a #ActUser
@@ -1530,6 +1558,34 @@ act_user_set_email (ActUser *user,
}
}
+/**
+ * act_user_set_input_sources:
+ * @user: the user object to alter.
+ * @sources: a list of input sources
+ *
+ * Assigns new input sources for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_input_sources (ActUser *user,
+ GVariant *sources)
+{
+ g_autoptr(GError) error = NULL;
+
+ g_return_if_fail (ACT_IS_USER (user));
+ g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+ g_return_if_fail (g_variant_is_of_type (sources, G_VARIANT_TYPE ("aa{ss}")));
+
+ if (!accounts_user_call_set_input_sources_sync (user->accounts_proxy,
+ sources,
+ NULL,
+ &error)) {
+ g_warning ("SetInputSources call failed: %s", error->message);
+ return;
+ }
+}
+
/**
* act_user_set_language:
* @user: the user object to alter.
diff --git a/src/libaccountsservice/act-user.h b/src/libaccountsservice/act-user.h
index d460ef9..bff16cb 100644
--- a/src/libaccountsservice/act-user.h
+++ b/src/libaccountsservice/act-user.h
@@ -82,6 +82,7 @@ const char *act_user_get_background_file (ActUser *user);
const char *act_user_get_icon_file (ActUser *user);
const char *act_user_get_language (ActUser *user);
const char *act_user_get_formats_locale (ActUser *user);
+GVariant *act_user_get_input_sources (ActUser *user);
const char *act_user_get_x_session (ActUser *user);
const char *act_user_get_session (ActUser *user);
const char *act_user_get_session_type (ActUser *user);
@@ -101,6 +102,8 @@ void act_user_get_password_expiration_policy (ActUser *user,
void act_user_set_email (ActUser *user,
const char *email);
+void act_user_set_input_sources (ActUser *user,
+ GVariant *sources);
void act_user_set_language (ActUser *user,
const char *language);
void act_user_set_x_has_messages (ActUser *user,
diff --git a/src/user.c b/src/user.c
index fce1ac4..28b4d21 100644
--- a/src/user.c
+++ b/src/user.c
@@ -242,6 +242,75 @@ user_update_from_pwent (User *user,
g_object_thaw_notify (G_OBJECT (user));
}
+static gint
+intcmp (gconstpointer a,
+ gconstpointer b,
+ gpointer user_data)
+{
+ return GPOINTER_TO_INT (a) - GPOINTER_TO_INT (b);
+}
+
+static GVariant *
+key_file_get_input_sources (GKeyFile *key_file)
+{
+ GVariantBuilder builder;
+ GSequence *indices;
+ GSequenceIter *indices_iter;
+ gchar **groups;
+ gchar **groups_iter;
+
+ indices = g_sequence_new (NULL);
+ groups = g_key_file_get_groups (key_file, NULL);
+
+ for (groups_iter = groups; *groups_iter; groups_iter++) {
+ if (g_str_has_prefix (*groups_iter, "InputSource") && (*groups_iter)[11]) {
+ gchar *end;
+ guint64 index;
+
+ index = g_ascii_strtoull (*groups_iter + 11, &end, 0);
+
+ if (!*end)
+ g_sequence_insert_sorted (indices, GINT_TO_POINTER (index), intcmp, NULL);
+ }
+ }
+
+ g_strfreev (groups);
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{ss}"));
+
+ indices_iter = g_sequence_get_begin_iter (indices);
+
+ while (!g_sequence_iter_is_end (indices_iter)) {
+ guint index;
+ gchar *group;
+ gchar **keys;
+ gchar **keys_iter;
+
+ g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
+
+ index = GPOINTER_TO_UINT (g_sequence_get (indices_iter));
+ group = g_strdup_printf ("InputSource%u", index);
+ keys = g_key_file_get_keys (key_file, group, NULL, NULL);
+
+ for (keys_iter = keys; *keys_iter; keys_iter++) {
+ gchar *value = g_key_file_get_string (key_file, group, *keys_iter, NULL);
+ g_variant_builder_add (&builder, "{ss}", *keys_iter, value);
+ g_free (value);
+ }
+
+ g_strfreev (keys);
+ g_free (group);
+
+ g_variant_builder_close (&builder);
+
+ indices_iter = g_sequence_iter_next (indices_iter);
+ }
+
+ g_sequence_free (indices);
+
+ return g_variant_ref_sink (g_variant_builder_end (&builder));
+}
+
void
user_update_from_keyfile (User *user,
GKeyFile *keyfile)
@@ -263,6 +332,8 @@ user_update_from_keyfile (User *user,
g_clear_pointer (&s, g_free);
}
+ accounts_user_set_input_sources (ACCOUNTS_USER (user), key_file_get_input_sources (keyfile));
+
s = g_key_file_get_string (keyfile, "User", "XSession", NULL);
if (s != NULL) {
accounts_user_set_xsession (ACCOUNTS_USER (user), s);
@@ -349,6 +420,51 @@ user_update_system_account_property (User *user,
accounts_user_set_system_account (ACCOUNTS_USER (user), system);
}
+static void
+key_file_set_input_sources (GKeyFile *key_file,
+ GVariant *input_sources)
+{
+ gchar **groups;
+ gchar **groups_iter;
+ GVariantIter sources;
+ GVariantIter *source;
+ guint i;
+
+ /* Remove all groups matching regex "InputSource\d+". */
+
+ groups = g_key_file_get_groups (key_file, NULL);
+
+ for (groups_iter = groups; *groups_iter; groups_iter++) {
+ if (g_str_has_prefix (*groups_iter, "InputSource")) {
+ for (i = 11; g_ascii_isdigit ((*groups_iter)[i]); i++);
+
+ if (i > 11 && !(*groups_iter)[i])
+ g_key_file_remove_group (key_file, *groups_iter, NULL);
+ }
+ }
+
+ g_strfreev (groups);
+
+ /* Write all input sources to key file. */
+
+ g_variant_iter_init (&sources, input_sources);
+
+ for (i = 0; g_variant_iter_next (&sources, "a{ss}", &source); i++) {
+ gchar *group;
+ const gchar *key;
+ const gchar *value;
+
+ group = g_strdup_printf ("InputSource%u", i);
+
+ while (g_variant_iter_next (source, "{&s&s}", &key, &value))
+ g_key_file_set_string (key_file, group, key, value);
+
+ g_free (group);
+
+ g_variant_iter_free (source);
+ }
+}
+
static gboolean is_in_pam_environment (User *user, const gchar *property);
static void
@@ -372,6 +488,9 @@ user_save_to_keyfile (User *user,
if (accounts_user_get_formats_locale (ACCOUNTS_USER (user)) && is_in_pam_environment (user, "FormatsLocale"))
g_key_file_set_string (keyfile, "User", "FormatsLocale", accounts_user_get_formats_locale (ACCOUNTS_USER (user)));
+ if (accounts_user_get_input_sources (ACCOUNTS_USER (user)))
+ key_file_set_input_sources (keyfile, accounts_user_get_input_sources (ACCOUNTS_USER (user)));
+
if (accounts_user_get_xsession (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "XSession", accounts_user_get_xsession (ACCOUNTS_USER (user)));
@@ -1608,6 +1727,57 @@ user_set_formats_locale (AccountsUser *auser,
return TRUE;
}
+static void
+user_change_input_sources_authorized_cb (Daemon *daemon,
+ User *user,
+ GDBusMethodInvocation *context,
+ gpointer data)
+
+{
+ GVariant *sources = data;
+
+ if (sources != accounts_user_get_input_sources (ACCOUNTS_USER (user)) &&
+ (!sources || !accounts_user_get_input_sources (ACCOUNTS_USER (user)) ||
+ !g_variant_equal (sources, accounts_user_get_input_sources (ACCOUNTS_USER (user))))) {
+ accounts_user_set_input_sources (ACCOUNTS_USER (user), sources);
+
+ save_extra_data (user);
+ }
+
+ accounts_user_complete_set_input_sources (ACCOUNTS_USER (user), context);
+}
+
+static gboolean
+user_set_input_sources (AccountsUser *auser,
+ GDBusMethodInvocation *context,
+ GVariant *sources)
+{
+ User *user = (User*)auser;
+ int uid;
+ const gchar *action_id;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "identifying caller failed");
+ return FALSE;
+ }
+
+ if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
+ action_id = "org.freedesktop.accounts.change-own-user-data";
+ else
+ action_id = "org.freedesktop.accounts.user-administration";
+
+ daemon_local_check_auth (user->daemon,
+ user,
+ action_id,
+ TRUE,
+ user_change_input_sources_authorized_cb,
+ context,
+ sources ? g_variant_ref (sources) : NULL,
+ sources ? (GDestroyNotify) g_variant_unref : NULL);
+
+ return TRUE;
+}
+
static void
user_change_x_session_authorized_cb (Daemon *daemon,
User *user,
@@ -2728,6 +2898,7 @@ user_accounts_user_iface_init (AccountsUserIface *iface)
iface->handle_set_home_directory = user_set_home_directory;
iface->handle_set_icon_file = user_set_icon_file;
iface->handle_set_language = user_set_language;
+ iface->handle_set_input_sources = user_set_input_sources;
iface->handle_set_location = user_set_location;
iface->handle_set_locked = user_set_locked;
iface->handle_set_password = user_set_password;
--
2.20.1

View File

@ -0,0 +1,54 @@
From 16267efeb840ceaa7067e8d608146ea6c9d4184b Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@ubuntu.com>
Date: Thu, 21 Dec 2017 15:15:05 +1300
Subject: [PATCH 12/12] In addition to watching /etc/{passwd,shadow,group},
also watch those same files in /var/lib/extrausers/, if they exist.
---
src/daemon.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/daemon.c b/src/daemon.c
index 0415f41..ade29d9 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -51,6 +51,9 @@
#define PATH_PASSWD "/etc/passwd"
#define PATH_SHADOW "/etc/shadow"
#define PATH_GROUP "/etc/group"
+#define PATH_EXTRAUSERS_PASSWD "/var/lib/extrausers/passwd"
+#define PATH_EXTRAUSERS_SHADOW "/var/lib/extrausers/shadow"
+#define PATH_EXTRAUSERS_GROUP "/var/lib/extrausers/group"
enum {
PROP_0,
@@ -69,6 +72,9 @@ typedef struct {
GFileMonitor *passwd_monitor;
GFileMonitor *shadow_monitor;
GFileMonitor *group_monitor;
+ GFileMonitor *extrausers_passwd_monitor;
+ GFileMonitor *extrausers_shadow_monitor;
+ GFileMonitor *extrausers_group_monitor;
GFileMonitor *gdm_monitor;
GFileMonitor *wtmp_monitor;
@@ -743,6 +749,16 @@ daemon_init (Daemon *daemon)
PATH_GROUP,
on_users_monitor_changed);
+ priv->extrausers_passwd_monitor = setup_monitor (daemon,
+ PATH_EXTRAUSERS_PASSWD,
+ on_users_monitor_changed);
+ priv->extrausers_shadow_monitor = setup_monitor (daemon,
+ PATH_EXTRAUSERS_SHADOW,
+ on_users_monitor_changed);
+ priv->extrausers_group_monitor = setup_monitor (daemon,
+ PATH_EXTRAUSERS_GROUP,
+ on_users_monitor_changed);
+
priv->wtmp_monitor = setup_monitor (daemon,
wtmp_helper_get_path_for_monitor (),
on_users_monitor_changed);
--
2.20.1

View File

@ -0,0 +1,46 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
accountsservice (0.6.55-0kylin11k3) v101; urgency=medium
.
* 新建管理员用户时管理员用户所属组和ubiquality保持一致
-debian/patches/0022-groups-stay-same-with-ubiquity-when-create-admuser.patch
Author: hebing <hebing@kylinos.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2020-12-21
--- accountsservice-0.6.55.orig/src/daemon.c
+++ accountsservice-0.6.55/src/daemon.c
@@ -1141,6 +1141,17 @@ daemon_create_user_authorized_cb (Daemon
if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR) {
add_user_to_group (context, cd->user_name, "sudo");
+
+ add_user_to_group(context, cd->user_name, "adm");
+ add_user_to_group(context, cd->user_name, "lpadmin");
+ add_user_to_group(context, cd->user_name, "sambashare");
+ add_user_to_group(context, cd->user_name, "cdrom");
+ add_user_to_group(context, cd->user_name, "dip");
+ add_user_to_group(context, cd->user_name, "plugdev");
+
+ add_user_to_group(context, cd->user_name, "lxd");
+ add_user_to_group(context, cd->user_name, "libvirt");
+ add_user_to_group(context, cd->user_name, "debian-tor");
}
user = daemon_local_find_user_by_name (daemon, cd->user_name);

View File

@ -0,0 +1,55 @@
From: Iain Lane <iainl@gnome.org>
Date: Tue, 28 Apr 2020 16:47:00 +0100
Subject: act-user-manager: Watch for the daemon going away and coming back
And set is-loaded accordingly. This causes properties to be invalidated
on the client side and then get re-fetched when the daemon comes back.
Applied-Upstream: 0.6.56
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948228
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1843982
Bug-Upstream: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/55
Origin: https://gitlab.freedesktop.org/accountsservice/accountsservice/-/commit/323707648fdefd11502faf44c2aa41d9b9500078
---
src/libaccountsservice/act-user-manager.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index 1b5298d..6be9165 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -2928,6 +2928,23 @@ act_user_manager_queue_load (ActUserManager *manager)
}
}
+static void
+on_name_owner_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ ActUserManager *manager = ACT_USER_MANAGER (user_data);
+ GDBusProxy *accounts_proxy = G_DBUS_PROXY (object);
+ g_autofree gchar *owner = NULL;
+
+ g_return_if_fail (ACT_IS_USER_MANAGER (manager));
+ g_return_if_fail (accounts_proxy != NULL);
+
+ owner = g_dbus_proxy_get_name_owner (accounts_proxy);
+
+ set_is_loaded (manager, owner != NULL);
+}
+
static gboolean
ensure_accounts_proxy (ActUserManager *manager)
{
@@ -2965,6 +2982,10 @@ ensure_accounts_proxy (ActUserManager *manager)
"user-deleted",
G_CALLBACK (on_user_removed_in_accounts_service),
manager);
+ g_signal_connect (priv->accounts_proxy,
+ "notify::g-name-owner",
+ G_CALLBACK (on_name_owner_changed),
+ manager);
return TRUE;
}

View File

@ -0,0 +1,36 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
accountsservice (0.6.55-0kylin11k1) v101; urgency=medium
.
* bug#22233 账户管理页面新增用户时弹出的授权页面,详细信息里发行商内容显示空白
Author: liuyuanpeng <liuyuanpeng@kylinos.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- accountsservice-0.6.55.orig/data/org.freedesktop.accounts.policy.in
+++ accountsservice-0.6.55/data/org.freedesktop.accounts.policy.in
@@ -3,7 +3,7 @@
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
- <vendor/>
+ <vendor>accountsservice</vendor>
<vendor_url/>
<icon_name>stock_person</icon_name>

View File

@ -0,0 +1,192 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
accountsservice (0.6.55-0kylin11k2) v101; urgency=medium
.
* 设置用户目录下背景图片时,复制一张图片到/var/lib/AccountsService/background/路径下
* 避免登录界面没有权限读取背景图片
Author: liuyuanpeng <liuyuanpeng@kylinos.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- accountsservice-0.6.55.orig/src/daemon.c
+++ accountsservice-0.6.55/src/daemon.c
@@ -162,12 +162,16 @@ remove_cache_files (const gchar *user_na
{
g_autofree gchar *user_filename = NULL;
g_autofree gchar *icon_filename = NULL;
+ g_autofree gchar *background_filename = NULL;
user_filename = g_build_filename (USERDIR, user_name, NULL);
g_remove (user_filename);
icon_filename = g_build_filename (ICONDIR, user_name, NULL);
g_remove (icon_filename);
+
+ background_filename = g_build_filename (BACKGROUNDDIR, user_name, NULL);
+ g_remove (background_filename);
}
static struct passwd *
--- accountsservice-0.6.55.orig/src/main.c
+++ accountsservice-0.6.55/src/main.c
@@ -113,6 +113,7 @@ on_bus_acquired (GDBusConnection *conne
if (!ensure_directory (ICONDIR, 0775, &error) ||
!ensure_directory (USERDIR, 0700, &error) ||
+ !ensure_directory (BACKGROUNDDIR,0775,&error) ||
!ensure_file_permissions (USERDIR, 0600, &error)) {
g_printerr ("%s\n", error->message);
g_main_loop_quit (loop);
--- accountsservice-0.6.55.orig/src/meson.build
+++ accountsservice-0.6.55/src/meson.build
@@ -28,6 +28,7 @@ cflags = [
'-DDATADIR="@0@"'.format(act_datadir),
'-DICONDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'icons')),
'-DUSERDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'users')),
+ '-DBACKGROUNDDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'backgrounds')),
]
libaccounts_generated = static_library(
--- accountsservice-0.6.55.orig/src/user.c
+++ accountsservice-0.6.55/src/user.c
@@ -2148,31 +2148,117 @@ user_change_background_file_authorized_c
g_autofree gchar *filename = NULL;
g_autoptr(GFile) file = NULL;
g_autoptr(GFileInfo) info = NULL;
+ guint32 mode;
GFileType type;
+ guint64 size;
filename = g_strdup (data);
if (filename == NULL ||
*filename == '\0') {
- g_free (filename);
- filename = NULL;
-
+ g_autofree gchar *dest_path = NULL;
+ g_autoptr(GFile) dest = NULL;
+ g_autoptr(GError) error = NULL;
+
+ g_clear_pointer (&filename, g_free);
+
+ dest_path = g_build_filename (BACKGROUNDDIR, accounts_user_get_user_name (ACCOUNTS_USER (user)), NULL);
+ dest = g_file_new_for_path (dest_path);
+
+ if (!g_file_delete (dest, NULL, &error) &&
+ !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
+ throw_error (context, ERROR_FAILED, "failed to remove user background, %s", error->message);
+ return;
+ }
goto background_saved;
- }
- file = g_file_new_for_path (filename);
- info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ }
+
+ file = g_file_new_for_path (filename);
+ g_clear_pointer (&filename, g_free);
+
+ /* Canonicalize path so we can call g_str_has_prefix on it
+ * below without concern for ../ path components moving outside
+ * the prefix
+ */
+ filename = g_file_get_path (file);
+
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_UNIX_MODE ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
0, NULL, NULL);
+ mode = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE);
type = g_file_info_get_file_type (info);
+ size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
if (type != G_FILE_TYPE_REGULAR) {
- g_debug ("not a regular file\n");
+ g_debug ("not a regular file");
throw_error (context, ERROR_FAILED, "file '%s' is not a regular file", filename);
return;
}
+ if (size > 104857600) {
+ g_debug ("file too large");
+ /* 1MB ought to be enough for everybody */
+ throw_error (context, ERROR_FAILED, "file '%s' is too large to be used as an background", filename);
+ return;
+ }
+
+ if ((mode & S_IROTH) == 0 ||
+ (!g_str_has_prefix (filename, DATADIR) &&
+ !g_str_has_prefix (filename, BACKGROUNDDIR))) {
+ g_autofree gchar *dest_path = NULL;
+ g_autoptr(GFile) dest = NULL;
+ const gchar *argv[3];
+ gint std_out;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GInputStream) input = NULL;
+ g_autoptr(GOutputStream) output = NULL;
+ gint uid;
+ gssize bytes;
+ struct passwd *pw;
+
+ if (!get_caller_uid (context, &uid)) {
+ throw_error (context, ERROR_FAILED, "failed to copy file, could not determine caller UID");
+ return;
+ }
+
+ dest_path = g_build_filename (BACKGROUNDDIR, accounts_user_get_user_name (ACCOUNTS_USER (user)), NULL);
+ dest = g_file_new_for_path (dest_path);
+
+ output = G_OUTPUT_STREAM (g_file_replace (dest, NULL, FALSE, 0, NULL, &error));
+ if (!output) {
+ throw_error (context, ERROR_FAILED, "creating file '%s' failed: %s", dest_path, error->message);
+ return;
+ }
+
+ argv[0] = "/bin/cat";
+ argv[1] = filename;
+ argv[2] = NULL;
+
+ pw = getpwuid (uid);
+
+ if (!g_spawn_async_with_pipes (NULL, (gchar**)argv, NULL, 0, become_user, pw, NULL, NULL, &std_out, NULL, &error)) {
+ throw_error (context, ERROR_FAILED, "reading file '%s' failed: %s", filename, error->message);
+ return;
+ }
+
+ input = g_unix_input_stream_new (std_out, FALSE);
+
+ bytes = g_output_stream_splice (output, input, G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error);
+ if (bytes < 0 || (gsize)bytes != size) {
+ throw_error (context, ERROR_FAILED, "copying file '%s' to '%s' failed: %s", filename, dest_path, error ? error->message : "unknown reason");
+ g_file_delete (dest, NULL, NULL);
+ return;
+ }
+
+ g_free (filename);
+ filename = g_steal_pointer (&dest_path);
+ }
+
background_saved:
accounts_user_set_background_file (ACCOUNTS_USER (user), filename);
+ g_clear_pointer (&filename, g_free);
save_extra_data (user);

View File

@ -0,0 +1,94 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
accountsservice (0.6.55-0kylin11k4) v101; urgency=medium
.
* BUG 号: 74231
* 需求号: 无
* 其他改动说明: 开机初始化如果找不到/etc/gdm3/custom.conf配置文件则
去检查/etc/lightdm/lightdm.conf文件。
Author: shilongzhen <shilongzhen@kylinos.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2021-08-30
--- accountsservice-0.6.55.orig/src/daemon.c
+++ accountsservice-0.6.55/src/daemon.c
@@ -1535,6 +1535,7 @@ load_autologin_lightdm (Daemon *dae
gboolean *enabled,
GError **error)
{
+ GError *local_error = NULL;
g_autoptr(GKeyFile) keyfile = NULL;
const gchar *filename;
@@ -1548,10 +1549,15 @@ load_autologin_lightdm (Daemon *dae
return FALSE;
}
- *name = g_key_file_get_string (keyfile, "SeatDefaults", "autologin-user", error);
- *enabled = (*error == NULL && (*name) && (*name)[0] != 0);
+ *name = g_key_file_get_string (keyfile, "SeatDefaults", "autologin-user", &local_error);
+ if (local_error) {
+ g_propagate_error (error, local_error);
+ *enabled = (&local_error== NULL && (*name) && (*name)[0] != 0);
+ return FALSE;
+ }
+ *enabled = ((*name) && (*name)[0] != 0);
- return (*error == NULL);
+ return TRUE;
}
gboolean
@@ -1560,6 +1566,8 @@ load_autologin (Daemon *daemon,
gboolean *enabled,
GError **error)
{
+ int ret = FALSE;
+
g_autoptr(GDBusProxy) proxy = NULL;
/* First, determine whether we should load GDM or LightDM values by
@@ -1575,10 +1583,23 @@ load_autologin (Daemon *daemon,
NULL, /* GCancellable */
NULL); /* GError */
- if (proxy != NULL)
- return load_autologin_gdm (daemon, name, enabled, error);
- else
- return load_autologin_lightdm (daemon, name, enabled, error);
+ if (proxy != NULL) {
+ ret = load_autologin_gdm (daemon, name, enabled, error);
+ if (ret == FALSE) {
+ g_warning ("%s fail to load %s file\n", __func__, PATH_GDM_CUSTOM);
+ }
+ }
+ /*
+ * if /etc/gdm3/custom.conf not find we need check /etc/lightdm/lightdm.conf;
+ */
+ if (ret == FALSE) {
+ ret = load_autologin_lightdm (daemon, name, enabled, error);
+ if (ret == FALSE) {
+ g_warning ("%s fail to load /etc/lightdm/lightdm.conf file\n", __func__);
+ }
+ }
+
+ return ret;
}
static gboolean

View File

@ -0,0 +1,88 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
accountsservice (0.6.55-0kylin11k5) v101; urgency=medium
.
* BUG 号: 75162 78297
* 需求号: 无
* 其他改动说明: 用户修改语言后也修改root的语言环境变量。
Author: shilongzhen <shilongzhen@kylinos.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2021-09-23
--- accountsservice-0.6.55.orig/src/user.c
+++ accountsservice-0.6.55/src/user.c
@@ -1541,7 +1541,49 @@ out:
accounts_user_complete_set_language (ACCOUNTS_USER (user), context);
}
+static gboolean set_locale_language(const gchar *language)
+{
+ g_autoptr(GDBusConnection) connection = NULL;
+ g_autoptr(GVariant) reply = NULL;
+ g_autoptr(GError) error = NULL;
+ gboolean arg_enabled = FALSE;
+
+ g_debug("user setting language:%s", language);
+
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (connection == NULL) {
+ g_warning ("Unable to get bus: %s", error->message);
+ return FALSE;
+ }
+
+ GVariantBuilder *builder;
+ gchar lang_str[32] = {0};
+ gchar language_str[32] = {0};
+ sprintf(lang_str, "LANG=%s.UTF-8", language);
+ sprintf(language_str, "LANGUAGE=%s", language);
+ builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+ g_variant_builder_add (builder, "s", lang_str);
+ g_variant_builder_add (builder, "s", language_str);
+
+ reply = g_dbus_connection_call_sync (connection,
+ "org.freedesktop.locale1",
+ "/org/freedesktop/locale1",
+ "org.freedesktop.locale1",
+ "SetLocale",
+ g_variant_new ("(asb)", builder, arg_enabled),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ if (reply == NULL) {
+ g_warning ("Unable to set locale: %s", error->message);
+ return FALSE;
+ }
+ g_variant_builder_unref (builder);
+ return TRUE;
+}
static gboolean
user_set_language (AccountsUser *auser,
@@ -1571,6 +1613,8 @@ user_set_language (AccountsUser
g_strdup (language),
(GDestroyNotify)g_free);
+ set_locale_language(language);
+
return TRUE;
}

33
debian/rules vendored Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/make -f
# -*- makefile -*-
export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
export CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
export CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
export LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS+=-Wl,--as-needed
%:
dh $@ --buildsystem=meson --with=gir,translations
override_dh_makeshlibs:
dh_makeshlibs -V -- -c4
override_dh_auto_configure:
dh_auto_configure -- \
--libexecdir=/usr/lib/accountsservice \
-Dgtk_doc=true \
-Dsystemd=true \
-Dsystemdsystemunitdir=/lib/systemd/system \
-Dgdmconffile=/etc/gdm3/custom.conf
# Disabled to avoid FTBFS
override_dh_auto_test:
override_dh_installchangelogs:
dh_installchangelogs NEWS
override_dh_strip:
dh_strip -plibaccountsservice0 --dbgsym-migration='libaccountsservice-dbg (<< 0.6.40-4~)'
dh_strip --remaining-packages

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

3
debian/watch vendored Normal file
View File

@ -0,0 +1,3 @@
version=3
http://www.freedesktop.org/software/accountsservice/ \
accountsservice-([\d\.]+)\.tar\.xz