From 9a21675a599ca9ade656c1cb6bd7ca86982eb831 Mon Sep 17 00:00:00 2001 From: Imran Zaman Date: Mon, 9 Feb 2015 17:46:03 +0200 Subject: [PATCH] Fixed copying of extended attributes from skel folder Change-Id: I0fe8012baab1ce593820043323ec4042dc32dc28 Signed-off-by: Imran Zaman --- configure | 20 ++++++++-------- configure.ac | 2 +- data/tizen/etc/gumd/gumd-tizen-common.conf | 2 +- data/tizen/etc/gumd/gumd-tizen-ivi.conf | 2 +- dists/debian/changelog | 6 +++++ dists/rpm/gum-suse.spec | 5 +++- dists/rpm/tizen/packaging/gumd.changes | 3 +++ dists/rpm/tizen/packaging/gumd.spec | 3 +-- docs/html/gumd-utils.html | 2 +- docs/html/index.html | 2 +- docs/utils.xml | 2 +- src/common/gum-file.c | 38 +++++++++++++++++------------- src/utils/gumd-utils.c | 6 ++--- 13 files changed, 55 insertions(+), 38 deletions(-) diff --git a/configure b/configure index 47502a1..9e2dd74 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gumd 1.0.6. +# Generated by GNU Autoconf 2.69 for gumd 1.0.7. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gumd' PACKAGE_TARNAME='gumd' -PACKAGE_VERSION='1.0.6' -PACKAGE_STRING='gumd 1.0.6' +PACKAGE_VERSION='1.0.7' +PACKAGE_STRING='gumd 1.0.7' PACKAGE_BUGREPORT='' PACKAGE_URL='https://github.com/01org/gumd' @@ -1405,7 +1405,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gumd 1.0.6 to adapt to many kinds of systems. +\`configure' configures gumd 1.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1475,7 +1475,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gumd 1.0.6:";; + short | recursive ) echo "Configuration of gumd 1.0.7:";; esac cat <<\_ACEOF @@ -1634,7 +1634,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gumd configure 1.0.6 +gumd configure 1.0.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1999,7 +1999,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gumd $as_me 1.0.6, which was +It was created by gumd $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2867,7 +2867,7 @@ fi # Define the identity of the package. PACKAGE='gumd' - VERSION='1.0.6' + VERSION='1.0.7' cat >>confdefs.h <<_ACEOF @@ -13932,7 +13932,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gumd $as_me 1.0.6, which was +This file was extended by gumd $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13999,7 +13999,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gumd config.status 1.0.6 +gumd config.status 1.0.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index fdf99fe..49f417a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.60]) -AC_INIT([gumd], [1.0.6],[],[],[https://github.com/01org/gumd]) +AC_INIT([gumd], [1.0.7],[],[],[https://github.com/01org/gumd]) AC_CONFIG_SRCDIR([src/daemon/main.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/data/tizen/etc/gumd/gumd-tizen-common.conf b/data/tizen/etc/gumd/gumd-tizen-common.conf index b65bce5..53cda9d 100644 --- a/data/tizen/etc/gumd/gumd-tizen-common.conf +++ b/data/tizen/etc/gumd/gumd-tizen-common.conf @@ -116,7 +116,7 @@ DEFAULT_USR_GROUPS=audio,video,display SMACK64_NEW_FILES=_ # Value used to set the smack label for User files and folders. -SMACK64_USER_FILES=User +SMACK64_USER_FILES=User::Home # # D-Bus related settings. diff --git a/data/tizen/etc/gumd/gumd-tizen-ivi.conf b/data/tizen/etc/gumd/gumd-tizen-ivi.conf index d48afd2..cc0a5ad 100644 --- a/data/tizen/etc/gumd/gumd-tizen-ivi.conf +++ b/data/tizen/etc/gumd/gumd-tizen-ivi.conf @@ -116,7 +116,7 @@ DEFAULT_USR_GROUPS=weston-launch,audio,video SMACK64_NEW_FILES=_ # Value used to set the smack label for User files and folders. -SMACK64_USER_FILES=User +SMACK64_USER_FILES=User::Home # # D-Bus related settings. diff --git a/dists/debian/changelog b/dists/debian/changelog index 47acd31..95e3653 100644 --- a/dists/debian/changelog +++ b/dists/debian/changelog @@ -1,3 +1,9 @@ +gumd (1.0.7-0) unstable; urgency=low + + * Fixed copying of extended attributes from skel folder + + -- Imran Zaman Mon, 09 Feb 2015 18:00:00 +0300 + gumd (1.0.6-0) unstable; urgency=low * Fixed gum-utils documentation diff --git a/dists/rpm/gum-suse.spec b/dists/rpm/gum-suse.spec index c76e5a5..247172d 100644 --- a/dists/rpm/gum-suse.spec +++ b/dists/rpm/gum-suse.spec @@ -7,7 +7,7 @@ Name: gumd Summary: User management daemon and client library -Version: 1.0.6 +Version: 1.0.7 Release: 0 Group: System/Daemons License: LGPL-2.1+ @@ -150,6 +150,9 @@ mkdir -p %{_sysconfdir}/%{name}/groupdel.d %changelog +* Mon Feb 09 2015 Imran Zaman +- Fixed copying of extended attributes from skel folder + * Thu Feb 05 2015 Imran Zaman - Fixed gum-utils documentation diff --git a/dists/rpm/tizen/packaging/gumd.changes b/dists/rpm/tizen/packaging/gumd.changes index f6801a6..660598d 100644 --- a/dists/rpm/tizen/packaging/gumd.changes +++ b/dists/rpm/tizen/packaging/gumd.changes @@ -1,3 +1,6 @@ +* Mon Feb 09 2015 Imran Zaman +- Fixed copying of extended attributes from skel folder + * Thu Feb 05 2015 Imran Zaman - Fixed gum-utils documentation diff --git a/dists/rpm/tizen/packaging/gumd.spec b/dists/rpm/tizen/packaging/gumd.spec index 6371349..6697a2b 100644 --- a/dists/rpm/tizen/packaging/gumd.spec +++ b/dists/rpm/tizen/packaging/gumd.spec @@ -6,7 +6,7 @@ Name: gumd Summary: User management daemon and client library -Version: 1.0.6 +Version: 1.0.7 Release: 0 Group: Security/Accounts License: LGPL-2.1+ @@ -31,7 +31,6 @@ BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(gmodule-2.0) Requires: tizen-platform-config - %description %{summary} files diff --git a/docs/html/gumd-utils.html b/docs/html/gumd-utils.html index 9b18fb0..35b43a9 100644 --- a/docs/html/gumd-utils.html +++ b/docs/html/gumd-utils.html @@ -153,7 +153,7 @@                     mandatory-args are:
                        --groupname=<groupname>
                        --grouptype=<grouptype>
-                        possible grouptypes are: system(1), user(2).
+                        possible grouptypes are: system or user.
                    optional-args are:
                        --gsecret=<secret>
            
diff --git a/docs/html/index.html b/docs/html/index.html index 76735e2..c16dae4 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -15,7 +15,7 @@

This document discusses the details of user management - daemon (gumd) and client library (libgum) with version 1.0.6 + daemon (gumd) and client library (libgum) with version 1.0.7 .

diff --git a/docs/utils.xml b/docs/utils.xml index 084f6d3..9bb1f41 100644 --- a/docs/utils.xml +++ b/docs/utils.xml @@ -134,7 +134,7 @@ mandatory-args are: --groupname=<groupname> --grouptype=<grouptype> - possible grouptypes are: system(1), user(2). + possible grouptypes are: system or user. optional-args are: --gsecret=<secret> diff --git a/src/common/gum-file.c b/src/common/gum-file.c index a56126a..d6f424a 100644 --- a/src/common/gum-file.c +++ b/src/common/gum-file.c @@ -129,7 +129,7 @@ _set_smack64_attr ( */ if (smack_label && len > 0 && - setxattr (path, XATTR_NAME_SMACK, smack_label, len, 0) != 0) { + lsetxattr (path, XATTR_NAME_SMACK, smack_label, len, 0) != 0) { g_object_unref (config); return FALSE; } @@ -182,10 +182,8 @@ _copy_file_attributes ( names[attrs_size] = '\0'; ssize_t size = 0; - while (name != end_names) { - if (name) - name = strchr (name,'\0')+1; - if (name && name[0] != '\0') { + while (name && name != end_names) { + if (name[0] != '\0') { size = lgetxattr (from_path, name, NULL, 0); if(size > 0 && (value = g_realloc (value, size)) && @@ -197,6 +195,7 @@ _copy_file_attributes ( } } } + name = strchr (name,'\0') + 1; } g_free (value); } @@ -253,16 +252,16 @@ gum_file_open_db_files ( goto _fail; } - if (!_copy_file_attributes (source_file_path, dup_file_path)) { + if (!_set_smack64_attr (dup_file_path, + GUM_CONFIG_GENERAL_SMACK64_NEW_FILES)) { GUM_SET_ERROR (GUM_ERROR_FILE_ATTRIBUTE, - "Unable to get/set file attributes", error, retval, FALSE); + "Unable to set smack file attributes", error, retval, FALSE); goto _fail; } - if (!_set_smack64_attr (dup_file_path, - GUM_CONFIG_GENERAL_SMACK64_NEW_FILES)) { + if (!_copy_file_attributes (source_file_path, dup_file_path)) { GUM_SET_ERROR (GUM_ERROR_FILE_ATTRIBUTE, - "Unable to set smack file attributes", error, retval, FALSE); + "Unable to get/set file attributes", error, retval, FALSE); goto _fail; } @@ -755,6 +754,7 @@ _copy_dir_recursively ( stop = !_set_smack64_attr (dest_filepath, GUM_CONFIG_GENERAL_SMACK64_USER_FILES); } + if (!stop) stop = !_copy_file_attributes (src_filepath, dest_filepath); if (!stop) stop = (chown (dest_filepath, uid, gid) < 0); _free_data: @@ -804,7 +804,11 @@ gum_file_create_home_dir ( } if (g_access (home_dir, F_OK) != 0) { - GumConfig *config = NULL; + GumConfig *config = gum_config_new (NULL); + const gchar *skel_dir = NULL; + + skel_dir = gum_config_get_string (config, GUM_CONFIG_GENERAL_SKEL_DIR); + g_object_unref (config); if (!g_file_test (home_dir, G_FILE_TEST_EXISTS)) { g_mkdir_with_parents (home_dir, mode); @@ -821,6 +825,11 @@ gum_file_create_home_dir ( "Unable to set smack64 home dir attr", error, FALSE); } + if (!_copy_file_attributes (skel_dir, home_dir)) { + GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_ATTRIBUTE, + "Unable to get/set dir attributes", error, FALSE); + } + /* when run in test mode, user may not exist */ #ifdef ENABLE_TESTS uid = getuid (); @@ -831,11 +840,8 @@ gum_file_create_home_dir ( "Home directory chown failure", error, FALSE); } - config = gum_config_new (NULL); - retval = _copy_dir_recursively (gum_config_get_string (config, - GUM_CONFIG_GENERAL_SKEL_DIR), home_dir, uid, gid, umask, error); - g_object_unref (config); - + retval = _copy_dir_recursively (skel_dir, home_dir, uid, gid, umask, + error); } return retval; diff --git a/src/utils/gumd-utils.c b/src/utils/gumd-utils.c index 576af1b..5ab3629 100644 --- a/src/utils/gumd-utils.c +++ b/src/utils/gumd-utils.c @@ -645,7 +645,7 @@ main (int argc, char *argv[]) { "sysroot", 'q', 0, G_OPTION_ARG_STRING, &sysroot, "sysroot path " "[Offline mode ONLY]", "sysroot"}, { "user-list", 'r', 0, G_OPTION_ARG_NONE, &is_user_list_op, - "if user_types argument is specified, then the calls will " + "if usertypes argument is specified, then the calls will " "return the specified users only otherwise all the users will " "be returned", NULL}, { NULL } @@ -693,7 +693,7 @@ main (int argc, char *argv[]) { { "groupname", 0, 0, G_OPTION_ARG_STRING, &group->group_name, "group name", "name"}, - { "group_type", 0, 0, G_OPTION_ARG_STRING, &group->group_type, + { "grouptype", 0, 0, G_OPTION_ARG_STRING, &group->group_type, "valid group type can be system or user", "type"}, { "gid", 0, 0, G_OPTION_ARG_INT, &group->gid, "group id", "gid"}, { "gsecret", 0, 0, G_OPTION_ARG_STRING, &group->group_secret, @@ -709,7 +709,7 @@ main (int argc, char *argv[]) context = g_option_context_new ("\n" " To add user in non-offline mode, gum-utils -a --username=user1 " - " --user_type=normal\n" + " --usertype=normal\n" " To delete user in offline mode, gum-utils -o -d --uid=2001\n" " NOTE: Only one command can be run at one time."); g_option_context_add_main_entries (context, main_entries, NULL); -- 2.7.4