+gumd (0.0.4-5) unstable; urgency=low
+
+ * Added primary group name for new user in the configuration file
+
+ -- Imran Zaman <imran.zaman@intel.com> Mon, 08 Sep 2014 18:00:03 +0300
+
gumd (0.0.4-4) unstable; urgency=low
* Fixed bug TC-1580 which fixes user's folder and file access permissions
- -- Imran Zaman <imran.zaman@intel.com> Tue, 26 Aug 2014 18:00:03 +0300
+ -- Imran Zaman <imran.zaman@intel.com> Fri, 05 Sep 2014 18:00:03 +0300
gumd (0.0.4-3) unstable; urgency=low
Name: gumd
Summary: User management daemon and client library
Version: 0.0.4
-Release: 3
+Release: 5
Group: System/Daemons
License: LGPL-2.1+
Source: %{name}-%{version}.tar.gz
%changelog
+* Mon Sep 08 2014 Imran Zaman <imran.zaman@intel.com>
+- Added primary group name for new user in the configuration file
+
* Fri Sep 05 2014 Imran Zaman <imran.zaman@intel.com>
- Fixed bug TC-1580 which fixes user's folder and file access permissions
#
[General]
+# Primary group name for the new user. If the primary group does not
+# exist, it will be created otherwise user gid will be set accordingly.
+# Default primary group name is same as name of the user.
+USR_PRIMARY_GRPNAME=users
+
# Comma separate listed of groups, which every user (other than system user)
# will be added to at the time of user account creation. Default value is:
# ''
+* Mon Sep 08 2014 Imran Zaman <imran.zaman@intel.com>
+- Added primary group name for new user in the configuration file
+
* Fri Sep 05 2014 Imran Zaman <imran.zaman@intel.com>
- Fixed bug TC-1580 which fixes user's folder and file access permissions
Name: gumd
Summary: User management daemon and client library
Version: 0.0.4
-Release: 4
+Release: 5
Group: Security/Accounts
License: LGPL-2.1+
Source: %{name}-%{version}.tar.gz
"/DEFAULT_USR_GROUPS"
/**
+ * GUM_CONFIG_GENERAL_USR_PRIMARY_GRPNAME:
+ *
+ * Primary group name for the new user. If the primary group does not
+ * exist, it will be created otherwise user gid will be set accordingly.
+ * Default primary group name is same as name of the user.
+ */
+#define GUM_CONFIG_GENERAL_USR_PRIMARY_GRPNAME GUM_CONFIG_GENERAL \
+ "/USR_PRIMARY_GRPNAME"
+
+/**
* GUM_CONFIG_GENERAL_DEF_ADMIN_GROUPS:
*
* Comma separate listed of groups, which admin user will be added to at the
}
if (!self->priv->config_file_path) {
- gchar *filename = g_build_filename ("%s/gumd/%s", GUM_SYSCONF_DIR,
- "gumd.conf", NULL);
+ gchar *filename = g_strdup_printf ("%s/gumd", GUM_SYSCONF_DIR);
self->priv->config_file_path = _check_config_file (filename);
g_free (filename);
}
# ifndef GUM_SYSCONF_DIR
# error "System configuration directory not defined!"
# endif
- gchar *filename = g_build_filename ("%s/gumd/%s", GUM_SYSCONF_DIR,
- "gumd.conf", NULL);
+ gchar *filename = g_strdup_printf ("%s/gumd", GUM_SYSCONF_DIR);
self->priv->config_file_path = _check_config_file (filename);
g_free (filename);
# endif /* ENABLE_DEBUG */
if (g_strcmp0 (self->priv->gshadow->sg_namp,
entry->sg_namp) == 0) {
GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_ALREADY_EXISTS,
- "File write failure", error, FALSE);
+ "Group already exists", error, FALSE);
}
break;
case GUM_OPTYPE_DELETE:
GumdDaemonUser *self,
GError **error)
{
- gboolean added = FALSE;
+ gboolean group_exists = FALSE;
GumdDaemonGroup *group = NULL;
gid_t gid = GUM_GROUP_INVALID_GID;
+ const gchar *primary_gname = NULL;
+ struct group *grp = NULL;
group = gumd_daemon_group_new (self->priv->config);
if (!group) {
GumGroupType grp_type = self->priv->user_type == GUM_USERTYPE_SYSTEM ?
GUM_GROUPTYPE_SYSTEM : GUM_GROUPTYPE_USER;
- g_object_set (G_OBJECT(group), "groupname", self->priv->pw->pw_name,
- "grouptype", grp_type, NULL);
- if (!(added = gumd_daemon_group_add (group, (gid_t)self->priv->pw->pw_uid,
- &gid, error))) {
- goto _finished;
+
+ primary_gname = gum_config_get_string (self->priv->config,
+ GUM_CONFIG_GENERAL_USR_PRIMARY_GRPNAME);
+ if (primary_gname) {
+ grp = gum_file_getgrnam (primary_gname,
+ gum_config_get_string (self->priv->config,
+ GUM_CONFIG_GENERAL_GROUP_FILE));
+ }
+
+ if (!grp) {
+ g_object_set (G_OBJECT(group), "groupname",
+ primary_gname ? primary_gname : self->priv->pw->pw_name,
+ "grouptype", grp_type, NULL);
+ if (!(group_exists = gumd_daemon_group_add (group,
+ (gid_t)self->priv->pw->pw_uid, &gid, error))) {
+ goto _finished;
+ }
+ } else {
+ gid = grp->gr_gid;
+ group_exists = TRUE;
}
+
_set_gid_property (self, gid);
_finished:
g_object_unref (group);
- return added;
+ return group_exists;
}
gboolean
#
[General]
+# Primary group name for the new user. If the primary group does not
+# exist, it will be created otherwise user gid will be set accordingly.
+# Default primary group name is same as name of the user.
+#USR_PRIMARY_GRPNAME=users
+
# Comma separate listed of groups, which every user (other than system user)
# will be added to at the time of user account creation. Default value is:
# ''
# ''
DEFAULT_USR_GROUPS=
+# Primary group name for the new user. If the primary group does not
+# exist, it will be created otherwise user gid will be set accordingly.
+# Default primary group name is same as name of the user.
+#USR_PRIMARY_GRPNAME=users
+
# Comma separate listed of groups, which admin user will be added to at the
# time of user account creation. Default value is: ''
#DEFAULT_ADMIN_GROUPS=