Fixed copying of extended attributes from skel folder upstream/1.0.7
authorImran Zaman <imran.zaman@intel.com>
Mon, 9 Feb 2015 15:46:03 +0000 (17:46 +0200)
committerImran Zaman <imran.zaman@intel.com>
Mon, 9 Feb 2015 15:46:03 +0000 (17:46 +0200)
Change-Id: I0fe8012baab1ce593820043323ec4042dc32dc28
Signed-off-by: Imran Zaman <imran.zaman@intel.com>
13 files changed:
configure
configure.ac
data/tizen/etc/gumd/gumd-tizen-common.conf
data/tizen/etc/gumd/gumd-tizen-ivi.conf
dists/debian/changelog
dists/rpm/gum-suse.spec
dists/rpm/tizen/packaging/gumd.changes
dists/rpm/tizen/packaging/gumd.spec
docs/html/gumd-utils.html
docs/html/index.html
docs/utils.xml
src/common/gum-file.c
src/utils/gumd-utils.c

index 47502a1..9e2dd74 100755 (executable)
--- 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\\"
 
index fdf99fe..49f417a 100644 (file)
@@ -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])
index b65bce5..53cda9d 100644 (file)
@@ -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.
index d48afd2..cc0a5ad 100644 (file)
@@ -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.
index 47acd31..95e3653 100644 (file)
@@ -1,3 +1,9 @@
+gumd (1.0.7-0) unstable; urgency=low
+
+  * Fixed copying of extended attributes from skel folder
+
+ -- Imran Zaman <imran.zaman@intel.com>  Mon, 09 Feb  2015 18:00:00 +0300
+
 gumd (1.0.6-0) unstable; urgency=low
 
   * Fixed gum-utils documentation
index c76e5a5..247172d 100644 (file)
@@ -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 <imran.zaman@intel.com>
+- Fixed copying of extended attributes from skel folder
+
 * Thu Feb 05 2015 Imran Zaman <imran.zaman@intel.com>
 - Fixed gum-utils documentation
 
index f6801a6..660598d 100644 (file)
@@ -1,3 +1,6 @@
+* Mon Feb 09 2015 Imran Zaman <imran.zaman@intel.com>
+- Fixed copying of extended attributes from skel folder
+
 * Thu Feb 05 2015 Imran Zaman <imran.zaman@intel.com>
 - Fixed gum-utils documentation
 
index 6371349..6697a2b 100644 (file)
@@ -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
 
index 9b18fb0..35b43a9 100644 (file)
                     mandatory-args are:<br>
                         --groupname=&lt;groupname&gt;<br>
                         --grouptype=&lt;grouptype&gt;<br>
-                        possible grouptypes are: system(1), user(2).<br>
+                        possible grouptypes are: system or user.<br>
                     optional-args are:<br>
                         --gsecret=&lt;secret&gt;<br>
             </code><br>
index 76735e2..c16dae4 100644 (file)
@@ -15,7 +15,7 @@
 <div>
 <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">gumd API Reference Manual</p></th></tr></table></div>
 <div><p class="releaseinfo">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
 .
         </p></div>
 </div>
index 084f6d3..9bb1f41 100644 (file)
                     mandatory-args are:
                         --groupname=&lt;groupname&gt;
                         --grouptype=&lt;grouptype&gt;
-                        possible grouptypes are: system(1), user(2).
+                        possible grouptypes are: system or user.
                     optional-args are:
                         --gsecret=&lt;secret&gt;
             </computeroutput>
index a56126a..d6f424a 100644 (file)
@@ -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;
index 576af1b..5ab3629 100644 (file)
@@ -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);