/*
* This file is part of gum
*
- * Copyright (C) 2012-2013 Intel Corporation.
+ * Copyright (C) 2013 Intel Corporation.
*
- * Contact: Alexander Kanavin <alex.kanavin@gmail.com>
+ * Contact: Imran Zaman <imran.zaman@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#define GUM_TYPE_DICTIONARY (G_TYPE_HASH_TABLE)
#define GUM_DICTIONARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUM_TYPE_DICTIONARY, \
- GumDictionary))
+ GUM_TYPE_DICTIONARY, \
+ GumDictionary))
#define GUM_IS_DICTIONARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
- GUM_TYPE_DICTIONARY))
+ GUM_TYPE_DICTIONARY))
typedef GHashTable GumDictionary;
gum_dictionary_new (void);
void
-gum_dictionary_ref (GumDictionary *dict);
+gum_dictionary_ref (
+ GumDictionary *dict);
void
-gum_dictionary_unref (GumDictionary *dict);
+gum_dictionary_unref (
+ GumDictionary *dict);
GumDictionary *
-gum_dictionary_copy (GumDictionary *other);
+gum_dictionary_copy (
+ GumDictionary *other);
GumDictionary *
-gum_dictionary_new_from_variant (GVariant *variant);
+gum_dictionary_new_from_variant (
+ GVariant *variant);
GVariant *
-gum_dictionary_to_variant (GumDictionary *self);
+gum_dictionary_to_variant (
+ GumDictionary *dict);
GVariant *
-gum_dictionary_get (GumDictionary *dict, const gchar *key);
+gum_dictionary_get (
+ GumDictionary *dict,
+ const gchar *key);
gboolean
-gum_dictionary_set (GumDictionary *dict,
- const gchar *key, GVariant *value);
+gum_dictionary_set (
+ GumDictionary *dict,
+ const gchar *key,
+ GVariant *value);
gboolean
-gum_dictionary_get_boolean (GumDictionary *dict, const gchar *key,
- gboolean *value);
+gum_dictionary_get_boolean (
+ GumDictionary *dict,
+ const gchar *key,
+ gboolean *value);
gboolean
-gum_dictionary_set_boolean (GumDictionary *dict, const gchar *key,
- gboolean value);
+gum_dictionary_set_boolean (
+ GumDictionary *dict,
+ const gchar *key,
+ gboolean value);
gboolean
-gum_dictionary_get_int32 (GumDictionary *dict, const gchar *key,
- gint *value);
+gum_dictionary_get_int32 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint *value);
gboolean
-gum_dictionary_set_int32 (GumDictionary *dict, const gchar *key,
- gint value);
+gum_dictionary_set_int32 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint value);
gboolean
-gum_dictionary_get_uint32 (GumDictionary *dict, const gchar *key,
- guint *value);
+gum_dictionary_get_uint32 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint *value);
gboolean
-gum_dictionary_set_uint32 (GumDictionary *dict, const gchar *key,
- guint32 value);
+gum_dictionary_set_uint32 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint32 value);
gboolean
-gum_dictionary_get_int64 (GumDictionary *dict, const gchar *key,
- gint64 *value);
+gum_dictionary_get_int64 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint64 *value);
gboolean
-gum_dictionary_set_int64 (GumDictionary *dict, const gchar *key,
- gint64 value);
+gum_dictionary_set_int64 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint64 value);
gboolean
-gum_dictionary_get_uint64 (GumDictionary *dict, const gchar *key,
- guint64 *value);
+gum_dictionary_get_uint64 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint64 *value);
gboolean
-gum_dictionary_set_uint64 (GumDictionary *dict, const gchar *key,
- guint64 value);
+gum_dictionary_set_uint64 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint64 value);
const gchar *
-gum_dictionary_get_string (GumDictionary *dict, const gchar *key);
+gum_dictionary_get_string (
+ GumDictionary *dict,
+ const gchar *key);
gboolean
-gum_dictionary_set_string (GumDictionary *dict, const gchar *key,
- const gchar *value);
+gum_dictionary_set_string (
+ GumDictionary *dict,
+ const gchar *key,
+ const gchar *value);
gboolean
-gum_dictionary_remove (GumDictionary *dict, const gchar *key);
+gum_dictionary_remove (
+ GumDictionary *dict,
+ const gchar *key);
G_END_DECLS
G_BEGIN_DECLS
-#define GUM_ERROR_DOMAIN "gum"
-
-/**
- * GUM_ERROR:
- *
- */
#define GUM_ERROR (gum_error_quark())
typedef enum {
GUM_ERROR_NONE,
- /**< Catch-all for errors not distinguished by another code. */
GUM_ERROR_UNKNOWN = 1,
- /**< Signon Daemon internal error. */
- GUM_ERROR_INTERNAL_SERVER = 2,
- /**< Communication with Signon Daemon error. */
- GUM_ERROR_INTERNAL_COMMUNICATION = 3,
- /**< The operation cannot be performed due to insufficient client
- * permissions. */
- GUM_ERROR_PERMISSION_DENIED = 4,
+ GUM_ERROR_INTERNAL_SERVER,
+ GUM_ERROR_PERMISSION_DENIED,
GUM_ERROR_USER_ALREADY_EXISTS = 32,
GUM_ERROR_USER_GROUP_ADD_FAILURE,
GUM_ERROR_INVALID_INPUT = 160,
- /* Placeholder to rearrange enumeration - User space specific */
GUM_ERROR_USER_ERR = 400
-
-} GumError;
-
-#define gum_gerr(error, handler) \
- G_STMT_START { \
- GString* msg = gum_prepend_domain_to_error_msg(error); \
- handler(msg->str); \
- g_string_free(msg, TRUE); \
- } G_STMT_END\
-
-#define gum_error_gerr(err) gum_gerr(err, g_error)
-
-#define gum_critical_gerr(err) gum_gerr(err, g_critical)
-
-#define gum_warning_gerr(err) gum_gerr(err, g_warning)
-
-#define gum_message_gerr(err) gum_gerr(err, g_message)
-
-#define gum_debug_gerr(err) gum_gerr(err, g_debug)
-
-GQuark
-gum_error_quark (void);
-
-GString*
-gum_concat_domain_and_error (
- const gchar *str1,
- const gchar *str2);
-
-GString*
-gum_prepend_domain_to_error_msg (
- const GError *err);
-
-GError *
-gum_error_new_from_variant (
- GVariant *var);
-GVariant *
-gum_error_to_variant (
- GError *error);
+} GumError;
-#define gum_get_gerror_for_id(err, message, args...) \
- g_error_new (gum_error_quark(), err, message, ##args);
+#define GUM_GET_ERROR_FOR_ID(code, message, args...) \
+ g_error_new (GUM_ERROR, code, message, ##args);
-#define SET_ERROR(code, err_str, err, retvar, retval) \
+#define GUM_SET_ERROR(code, err_str, err, retvar, retval) \
{ \
if (err) { \
- *err = gum_get_gerror_for_id (code, err_str); \
+ *err = GUM_GET_ERROR_FOR_ID (code, err_str); \
DBG ("Error %d:%s", code, err_str); \
} \
retvar = retval; \
}
-#define RETURN_WITH_ERROR(code, err_str, err, retval) \
+#define GUM_RETURN_WITH_ERROR(code, err_str, err, retval) \
{ \
if (err) { \
- *err = gum_get_gerror_for_id (code, err_str); \
+ *err = GUM_GET_ERROR_FOR_ID (code, err_str); \
DBG ("Error %d:%s", code, err_str); \
} \
return retval; \
}
+GQuark
+gum_error_quark (void);
+
+GError *
+gum_error_new_from_variant (
+ GVariant *var);
+
+GVariant *
+gum_error_to_variant (
+ GError *error);
+
G_END_DECLS
#endif /* __GUM_ERROR_H__ */
G_BEGIN_DECLS
+/**
+ * SECTION:gum-group-types
+ * @short_description: group types definition
+ * @title: Group types
+ *
+ * This file provides various types of group that can be created by the user
+ * management framework.
+ *
+ */
+
+/**
+ * GumGroupType:
+ * @GUM_GROUPTYPE_NONE: group type not defined/set.
+ * @GUM_GROUPTYPE_SYSTEM: system group.
+ * @GUM_GROUPTYPE_USER: normal group.
+ *
+ * This enumeration lists group types.
+ */
+
typedef enum {
GUM_GROUPTYPE_NONE = 0,
#include <stdio.h>
#include <stdlib.h>
+/**
+ * SECTION:gum-log
+ * @short_description: logging facilities
+ * @title: Logging
+ * @include: gum/common/gum-log.h
+ *
+ * <filename>gum/common/gum-log.h</filename> file contains logging macros
+ *
+ * For example:
+ * |[ INFO("Object initialized"); ]|
+ */
+
+/**
+ * TRACEBACK:
+ *
+ * This macro prints the current function call stack to stderr.
+ */
#define TRACEBACK() \
{ \
void *array[256];\
}\
}
+/**
+ * INFO:
+ * @frmt: format string for the message
+ * @...: arguments for the format string
+ *
+ * Use this macro to log informational messages. Gum will take care of
+ * correctly saving them.
+ */
#define INFO(frmt, args...) g_message("%f %s:%d %s " frmt , \
g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
__PRETTY_FUNCTION__, ##args)
+
+/**
+ * ERR:
+ * @frmt: format string for the message
+ * @...: arguments for the format string
+ *
+ * Use this macro to log error messages. Gum will take care of
+ * correctly saving them.
+ */
#define ERR(frmt, args...) g_critical("%f %s:%d %s " frmt , \
g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
__PRETTY_FUNCTION__, ##args)
+
+/**
+ * WARN:
+ * @frmt: format string for the message
+ * @...: arguments for the format string
+ *
+ * Use this macro to log warning messages. Gum will take care of
+ * correctly saving them.
+ */
#define WARN(frmt, args...) g_warning("%f %s:%d %s " frmt , \
g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
__PRETTY_FUNCTION__, ##args)
+
+/**
+ * DBG:
+ * @frmt: format string for the message
+ * @...: arguments for the format string
+ *
+ * Use this macro to log debug messages. Gum will take care of
+ * correctly saving them.
+ */
#define DBG(frmt, args...) g_debug("%f %s:%d %s " frmt , \
g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
__PRETTY_FUNCTION__, ##args)
G_BEGIN_DECLS
+/**
+ * SECTION:gum-user-types
+ * @short_description: user types definition
+ * @title: User types
+ *
+ * This file provides various types of users that can be created by the user
+ * management framework.
+ *
+ */
+
+/**
+ * GumUserType:
+ * @GUM_USERTYPE_NONE: user type not defined/set
+ * @GUM_USERTYPE_SYSTEM: system user. No home directory will be created for
+ * system user. System user is not able to use login/logout functionality as
+ * its primary usage is limited to system daemons.
+ * @GUM_USERTYPE_ADMIN: admin user is similar to normal user with the addition
+ * of super user privileges.
+ * @GUM_USERTYPE_GUEST: guest user does not need secret/password to login.
+ * Guest user home directory is created with login and cleaned up/destroyed
+ * when user logs out.
+ * @GUM_USERTYPE_NORMAL: normal user with home directory created based on prefix
+ * #GUM_CONFIG_GENERAL_HOME_DIR_PREF. Contents of #GUM_CONFIG_GENERAL_SKEL_DIR
+ * are copied to the home directory.
+ *
+ * This enumeration lists users types.
+ */
+
typedef enum {
GUM_USERTYPE_NONE = 0,
/*
* This file is part of gum
*
- * Copyright (C) 2012-2013 Intel Corporation.
+ * Copyright (C) 2013 Intel Corporation.
*
- * Contact: Alexander Kanavin <alex.kanavin@gmail.com>
+ * Contact: Imran Zaman <imran.zaman@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "common/gum-log.h"
/**
+ * SECTION:gum-dictionary
+ * @short_description: a dictionary container holding string keys and variant
+ * values
+ * @title: GumDictionary
+ * @include: gum/common/gum-dictionary.h
+ *
+ * A #GumDictionary is a dictionary data structure that maps string keys to
+ * #GVariant values. It's used in multiple places in gum and its public API
+ * to pass key-value data sets.
+ *
+ * |[
+ * GumDictionary* dict = gum_dictionary_new();
+ * gum_dictionary_set_string(dict, "name", "John Smith");
+ * gum_dictionary_set_uint32(dict, "age", 32);
+ *
+ * guint32 age;
+ * gboolean success = gum_dictionary_get_uint32(dict, "age", &age);
+ * const gchar* name = gum_dictionary_get_string(dict, "name");
+ * gum_dictionary_unref(dict);
+ * ]|
+ */
+
+/**
+ * GumDictionary:
+ *
+ * #GumDictionary is a typedef for #GHashTable, which
+ * means the developers may also use methods associated with that structure.
+ */
+
+/**
* gum_dictionary_new_from_variant:
- * @variant: instance of #GVariant
+ * @variant: (transfer none): instance of #GVariant
*
- * Converts the variant to GumDictionary.
+ * Converts the #GVariant to #GumDictionary. This is useful for example if
+ * the dictionary needs to be deserialized, or if it's contained in another
+ * #GumDictionary and has been retrieved using gum_dictionary_get().
*
- * Returns: (transfer full) object if successful, NULL otherwise.
+ * Returns: (transfer full): #GumDictionary if successful, NULL otherwise.
*/
GumDictionary *
-gum_dictionary_new_from_variant (GVariant *variant)
+gum_dictionary_new_from_variant (
+ GVariant *variant)
{
GumDictionary *dict = NULL;
GVariantIter iter;
/**
* gum_dictionary_to_variant:
- * @dict: instance of #GumDictionary
+ * @dict: (transfer none): instance of #GumDictionary
*
- * Converts the GumDictionary to variant.
+ * Converts the #GumDictionary to a #GVariant. The result can be serialized
+ * or put into another #GumDictionary using gum_dictionary_set().
*
- * Returns: (transfer full) #GVariant object if successful, NULL otherwise.
+ * Returns: (transfer full): #GVariant object if successful, NULL otherwise.
*/
GVariant *
-gum_dictionary_to_variant (GumDictionary *dict)
+gum_dictionary_to_variant (
+ GumDictionary *dict)
{
GVariantBuilder builder;
GHashTableIter iter;
/**
* gum_dictionary_new:
*
- * Creates new instance of GumDictionary.
+ * Creates a new instance of #GumDictionary.
*
- * Returns: (transfer full) #GumDictionary object if successful,
+ * Returns: (transfer full): #GumDictionary object if successful,
* NULL otherwise.
*/
GumDictionary *
/**
* gum_dictionary_ref:
- * @dict: instance of #GumDictionary
+ * @dict: (transfer none): instance of #GumDictionary
+ *
+ * Increments the reference count of the dictionary structure.
*
- * Increment reference count of the dictionary structure.
*/
void
-gum_dictionary_ref (GumDictionary *dict)
+gum_dictionary_ref (
+ GumDictionary *dict)
{
g_return_if_fail (dict != NULL);
/**
* gum_dictionary_unref:
- * @dict: instance of #GumDictionary
+ * @dict: (transfer none): instance of #GumDictionary
*
- * Decrement reference count of the dictionary structure.
+ * Decrements the reference count of the dictionary structure. If the reference
+ * count reaches zero, the structure is deallocated and shouldn't be used.
*
*/
void
-gum_dictionary_unref (GumDictionary *dict)
+gum_dictionary_unref (
+ GumDictionary *dict)
{
if (!dict)
return;
/**
* gum_dictionary_get:
- * @dict: instance of #GumDictionary
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): the key to look up in the dictionary
*
- * Retrieves a value from the dictionary.
+ * Retrieves a #GVariant value from the dictionary. This can be used to retrieve
+ * a value of an arbitrary type, and then convert it manually to a specific type
+ * using #GVariant methods. For most commonly used types, also getters that
+ * return the specific type directly are provided (gum_dictionary_get_string()
+ * and similar).
*
- * Returns: (transfer none) the value; NULL is returned in case of failure.
+ * Returns: (transfer none): the value; NULL is returned in case of failure (for
+ * example if the entry corresponding to the supplied key doesn't exist).
*/
GVariant *
-gum_dictionary_get (GumDictionary *dict, const gchar *key)
+gum_dictionary_get (
+ GumDictionary *dict,
+ const gchar *key)
{
g_return_val_if_fail (dict != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
/**
* gum_dictionary_set:
- * @dict: instance of #GumDictionary
- *
- * @key: key to be set
- * @value: value to be set
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to be set
+ * @value: (transfer full): value to be set
*
- * Adds or replaces key-value pair in the dictionary.
+ * Adds or replaces key-value pair in the dictionary. This allows to set a value
+ * of an arbitrary type: it first needs to be converted to a #GVariant. For most
+ * commonly used types also type-specific setters are provided.
*
* Returns: TRUE if successful, FALSE otherwise.
*/
gboolean
-gum_dictionary_set (GumDictionary *dict,
- const gchar *key, GVariant *value)
+gum_dictionary_set (
+ GumDictionary *dict,
+ const gchar *key,
+ GVariant *value)
{
g_return_val_if_fail (dict != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
/**
* gum_dictionary_get_boolean:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ * @value: (transfer none): points to the location where the value should be set
*
- * Overload, see #gum_dictionary_get for details.
+ * Retrieves a gboolean value.
+ *
+ * Returns: TRUE if the value was retrieved successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_get_boolean (GumDictionary *dict, const gchar *key,
- gboolean *value)
+gum_dictionary_get_boolean (
+ GumDictionary *dict,
+ const gchar *key,
+ gboolean *value)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_boolean:
+ * gum_dictionary_set_boolean:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: value to set
+ *
+ * Sets or replaces a gboolean value in the dictionary.
*
- * Overload, see #gum_dictionary_set for details.
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_boolean (GumDictionary *dict, const gchar *key,
- gboolean value)
+gum_dictionary_set_boolean (
+ GumDictionary *dict,
+ const gchar *key,
+ gboolean value)
{
return gum_dictionary_set (dict, key, g_variant_new_boolean (value));
}
/**
* gum_dictionary_get_int32:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ * @value: (transfer none): points to the location where the value should be set
+ *
+ * Retrieves a int32 value.
*
- * Overload, see #gum_dictionary_get for details.
+ * Returns: TRUE if the value was retrieved successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_get_int32 (GumDictionary *dict, const gchar *key,
- gint32 *value)
+gum_dictionary_get_int32 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint32 *value)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_int32:
+ * gum_dictionary_set_int32:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: value to set
*
- * Overload, see #gum_dictionary_set for details.
+ * Sets or replaces a int32 value in the dictionary.
+ *
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_int32 (GumDictionary *dict, const gchar *key,
- gint32 value)
+gum_dictionary_set_int32 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint32 value)
{
return gum_dictionary_set (dict, key, g_variant_new_int32 (value));
}
/**
- * gum_dictionary_get_guint32:
+ * gum_dictionary_get_uint32:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ * @value: (transfer none): points to the location where the value should be set
+ *
+ * Retrieves a uint32 value.
*
- * Overload, see #gum_dictionary_get for details.
+ * Returns: TRUE if the value was retrieved successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_get_uint32 (GumDictionary *dict, const gchar *key,
- guint32 *value)
+gum_dictionary_get_uint32 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint32 *value)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_guint32:
+ * gum_dictionary_set_uint32:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: value to set
+ *
+ * Sets or replaces a uint32 value in the dictionary.
*
- * Overload, see #gum_dictionary_set for details.
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_uint32 (GumDictionary *dict, const gchar *key,
- guint32 value)
+gum_dictionary_set_uint32 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint32 value)
{
return gum_dictionary_set (dict, key, g_variant_new_uint32 (value));
}
/**
* gum_dictionary_get_int64:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ * @value: (transfer none): points to the location where the value should be set
*
- * Overload, see #gum_dictionary_get for details.
+ * Retrieves a int64 value.
+ *
+ * Returns: TRUE if the value was retrieved successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_get_int64 (GumDictionary *dict, const gchar *key,
- gint64 *value)
+gum_dictionary_get_int64 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint64 *value)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_int32:
+ * gum_dictionary_set_int64:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: value to set
+ *
+ * Sets or replaces a int64 value in the dictionary.
*
- * Overload, see #gum_dictionary_set for details.
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_int64 (GumDictionary *dict, const gchar *key,
- gint64 value)
+gum_dictionary_set_int64 (
+ GumDictionary *dict,
+ const gchar *key,
+ gint64 value)
{
return gum_dictionary_set (dict, key, g_variant_new_int64 (value));
}
/**
- * gum_dictionary_get_guint32:
+ * gum_dictionary_get_uint64:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ * @value: (transfer none): points to the location where the value should be set
+ *
+ * Retrieves a uint64 value.
*
- * Overload, see #gum_dictionary_get for details.
+ * Returns: TRUE if the value was retrieved successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_get_uint64 (GumDictionary *dict, const gchar *key,
- guint64 *value)
+gum_dictionary_get_uint64 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint64 *value)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_guint32:
+ * gum_dictionary_set_uint64:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: value to set
*
- * Overload, see #gum_dictionary_set for details.
+ * Sets or replaces a uint64 value in the dictionary.
+ *
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_uint64 (GumDictionary *dict, const gchar *key,
- guint64 value)
+gum_dictionary_set_uint64 (
+ GumDictionary *dict,
+ const gchar *key,
+ guint64 value)
{
return gum_dictionary_set (dict, key, g_variant_new_uint64 (value));
}
-
/**
* gum_dictionary_get_string:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to look up
+ *
+ * Retrieves a string value.
*
- * Overload, see #gum_dictionary_get for details.
+ * Returns: (transfer none): the value if it was retrieved successfully, NULL
+ * otherwise.
*/
const gchar *
-gum_dictionary_get_string (GumDictionary *dict, const gchar *key)
+gum_dictionary_get_string (
+ GumDictionary *dict,
+ const gchar *key)
{
GVariant *variant = gum_dictionary_get (dict, key);
}
/**
- * gsignon_dictionary_set_string:
+ * gum_dictionary_set_string:
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key to set
+ * @value: (transfer none): value to set
*
- * Overload, see #gum_dictionary_set for details.
+ * Sets or replaces a string value in the dictionary.
+ *
+ * Returns: TRUE if the value was set or replaced successfully, FALSE otherwise.
*/
gboolean
-gum_dictionary_set_string (GumDictionary *dict, const gchar *key,
- const gchar *value)
+gum_dictionary_set_string (
+ GumDictionary *dict,
+ const gchar *key,
+ const gchar *value)
{
return gum_dictionary_set (dict, key, g_variant_new_string (value));
}
/**
* gum_dictionary_remove:
- * @dict: instance of #GumDictionary
- *
- * @key: key which needs to be removed from the dictionary
- * @value: value to be set
+ * @dict: (transfer none): instance of #GumDictionary
+ * @key: (transfer none): key which needs to be removed from the dictionary
*
* Removes key-value pair in the dictionary as per key.
*
* Returns: TRUE if successful, FALSE otherwise.
*/
gboolean
-gum_dictionary_remove (GumDictionary *dict, const gchar *key)
+gum_dictionary_remove (
+ GumDictionary *dict,
+ const gchar *key)
{
g_return_val_if_fail (dict != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
/**
* gum_dictionary_copy:
- * @other: instance of #GumDictionary
+ * @other: (transfer none): instance of #GumDictionary
*
* Creates a copy of the dictionary.
*
- * Returns: (transfer full) #GumDictionary object if successful,
+ * Returns: (transfer full): #GumDictionary object if the copy was successful,
* NULL otherwise.
*/
GumDictionary *
-gum_dictionary_copy (GumDictionary *other)
+gum_dictionary_copy (
+ GumDictionary *other)
{
GumDictionary *dict = NULL;
GHashTableIter iter;
{
gum_dictionary_set (dict, key, value);
}
-
return dict;
}
#include "common/gum-error.h"
+/**
+ * SECTION:gum-error
+ * @short_description: error definitions and utilities
+ * @title: Errors
+ * @include: gum/common/gum-error.h
+ *
+ * This file provides Gum error definitions and utilities.
+ * When creating an error, use #GUM_ERROR for the error domain and errors
+ * from #GumError for the error code.
+ *
+ * |[
+ * GError* err = g_error_new(GUM_ERROR, GUM_ERROR_USER_ALREADY_EXISTS,
+ * "User already exists");
+ * ]|
+ */
+
+/**
+ * GUM_ERROR:
+ *
+ * This macro should be used when creating a #GError (for example with
+ * g_error_new()).
+ */
+
+/**
+ * GumError:
+ * @GUM_ERROR_NONE: No error
+ * @GUM_ERROR_UNKNOWN: Catch-all for errors not distinguished by another error
+ * code
+ * @GUM_ERROR_INTERNAL_SERVER: Server internal error
+ * @GUM_ERROR_PERMISSION_DENIED: The operation cannot be performed due to
+ * insufficient client permissions
+ * @GUM_ERROR_USER_ALREADY_EXISTS: User already exists
+ * @GUM_ERROR_USER_GROUP_ADD_FAILURE: Adding/creating groups for the user
+ * failure
+ * @GUM_ERROR_USER_UID_NOT_AVAILABLE: UID not available in the defined range
+ * @GUM_ERROR_USER_INVALID_USER_TYPE: Usertype is not set
+ * @GUM_ERROR_USER_SECRET_ENCRYPT_FAILURE: Encryption of secret failure
+ * @GUM_ERROR_USER_NOT_FOUND: User not found
+ * @GUM_ERROR_USER_INVALID_DATA: Invalid data provided in the request
+ * @GUM_ERROR_USER_GROUP_DELETE_FAILURE: Deleting group for the user failure
+ * @GUM_ERROR_USER_SELF_DESTRUCTION: Self-destruction is not allowed
+ * @GUM_ERROR_USER_SESSION_TERM_FAILURE: Session termination of a user failure
+ * @GUM_ERROR_USER_NO_CHANGES: No changes specified in the user update request
+ * @GUM_ERROR_USER_LOCK_FAILURE: Unable to lock the user account before doing
+ * any changes
+ * @GUM_ERROR_GROUP_ALREADY_EXISTS: Group already exists
+ * @GUM_ERROR_GROUP_GID_NOT_AVAILABLE: GID mot available in the defined range
+ * @GUM_ERROR_GROUP_INVALID_GROUP_TYPE: Group type not set
+ * @GUM_ERROR_GROUP_SECRET_ENCRYPT_FAILURE: Encryption of group secret failure
+ * @GUM_ERROR_GROUP_NOT_FOUND: Group not found
+ * @GUM_ERROR_GROUP_USER_ALREADY_A_MEMBER: User is already a member of the group
+ * @GUM_ERROR_GROUP_INVALID_DATA: Invalid data is specified in the request
+ * @GUM_ERROR_GROUP_SELF_DESTRUCTION: Self-destruction is not allowed
+ * @GUM_ERROR_GROUP_HAS_USER: Group has (other) user(s)
+ * @GUM_ERROR_GROUP_NO_CHANGES: No changes specified in the group update request
+ * @GUM_ERROR_DB_ALREADY_LOCKED: Database is already locked
+ * @GUM_ERROR_FILE_OPEN: File open error
+ * @GUM_ERROR_FILE_ATTRIBUTE: File attribute error
+ * @GUM_ERROR_FILE_MOVE: File move error
+ * @GUM_ERROR_FILE_WRITE: File write error
+ * @GUM_ERROR_HOME_DIR_CREATE_FAILURE: Directory create failure
+ * @GUM_ERROR_HOME_DIR_DELETE_FAILURE: Directory delete failure
+ * @GUM_ERROR_HOME_DIR_COPY_FAILURE: Directory copy failure
+ * @GUM_ERROR_INVALID_NAME: Invalid name specified
+ * @GUM_ERROR_INVALID_NICKNAME: Invalid nickname specified
+ * @GUM_ERROR_INVALID_SECRET: Invalid secret specified
+ * @GUM_ERROR_INVALID_STR: Invalid string specified
+ * @GUM_ERROR_INVALID_STR_LEN: Invalid string length
+ * @GUM_ERROR_INVALID_INPUT: Invalid input specified
+ * @GUM_ERROR_USER_ERR: Placeholder to rearrange enumeration - User space
+ * specific
+ *
+ * This enum provides a list of errors
+ */
+
+/**
+ * GUM_ERROR_DOMAIN:
+ *
+ * This macro defines the error domain for gum.
+ */
+#define GUM_ERROR_DOMAIN "gum"
+
+/**
+ * GUM_GET_ERROR_FOR_ID:
+ * @code: A #GumError specifying the error
+ * @message: Format string for the error message
+ * @...: parameters for the error string
+ *
+ * A helper macro that creates a #GError with the proper gum domain
+ */
+
+/**
+ * GUM_SET_ERROR:
+ * @code: the error code as listed in #GumError
+ * @err_str: the error message to be set for the #GError
+ * @err: a #GError
+ * @retvar: return variable to hold the return value
+ * @retval: return value to be set to the return variable
+ *
+ * A helper macro that creates a #GError with the proper gum domain, output
+ * the error message to logs, and sets the specified retval to retvar.
+ */
+
+/**
+ * GUM_RETURN_WITH_ERROR:
+ * @code: the error code as listed in #GumError
+ * @err_str: the error message to be set for the #GError
+ * @err: a #GError
+ * @retval: value to be used on return
+ *
+ * A helper macro that creates a #GError with the proper gum domain, output
+ * the error message to logs, and returns with specified retval.
+ */
+
#define _ERROR_PREFIX "org.tizen.SecurityAccounts.gUserManagement.Error"
GDBusErrorEntry _gum_errors[] =
{
{GUM_ERROR_UNKNOWN, _ERROR_PREFIX".Unknown"},
{GUM_ERROR_INTERNAL_SERVER, _ERROR_PREFIX".InternalServerError"},
- {GUM_ERROR_INTERNAL_COMMUNICATION,
- _ERROR_PREFIX".InternalCommunicationError"},
{GUM_ERROR_PERMISSION_DENIED, _ERROR_PREFIX".PermissionDenied"},
{GUM_ERROR_USER_ALREADY_EXISTS, _ERROR_PREFIX".UserAlreadyExists"},
{GUM_ERROR_USER_SELF_DESTRUCTION, _ERROR_PREFIX".UserSelfDestruction"},
{GUM_ERROR_USER_SESSION_TERM_FAILURE,
_ERROR_PREFIX".UserSessionTermFailure"},
-
{GUM_ERROR_USER_NO_CHANGES, _ERROR_PREFIX".UserNoChanges"},
{GUM_ERROR_USER_LOCK_FAILURE, _ERROR_PREFIX".UserLockFailure"},
{GUM_ERROR_INVALID_INPUT, _ERROR_PREFIX".InvalidInput"},
} ;
+ /**
+ * gum_error_quark:
+ *
+ * Creates and returns a domain for Gum errors.
+ *
+ * Returns: #GQuark for Gum errors
+ */
GQuark
gum_error_quark (void)
{
return (GQuark) quark_volatile;
}
-GString*
-gum_concat_domain_and_error (
- const gchar *str1,
- const gchar *str2)
-{
- GString *str = NULL;
- g_return_val_if_fail (str1 != NULL && str2 != NULL, NULL);
- str = g_string_sized_new (strlen(str1)+strlen(str2)-1);
- g_string_printf (str,"[%s].%s\n",str1,str2);
- return str;
-}
-
-GString*
-gum_prepend_domain_to_error_msg (const GError *err)
-{
- GString *msg = NULL;
- const gchar *domain = NULL;
- g_return_val_if_fail (err != NULL, NULL);
- if (err->message != NULL) {
- domain = g_quark_to_string(err->domain);
- msg = gum_concat_domain_and_error(domain, err->message);
- }
- return msg;
-}
-
/**
* gum_error_new_from_variant:
- * @var: instance of #GVariant
+ * @var: (transfer none): instance of #GVariant
*
* Converts the GVariant to GError.
*
- * Returns: (transfer full) #GError object if successful, NULL otherwise.
+ * Returns: (transfer full): #GError object if successful, NULL otherwise.
*/
GError *
gum_error_new_from_variant (
/**
* gum_error_to_variant:
- * @error: instance of #GError
+ * @error: (transfer none): instance of #GError
*
* Converts the GError to GVariant.
*
{
if (!origfn || !origf || !(*origf = _open_file (origfn, "r"))) {
DBG("origfn %s --- orig %p", origfn ? origfn : "NULL", origf);
- RETURN_WITH_ERROR (GUM_ERROR_FILE_OPEN, "Unable to open orig file",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_OPEN, "Unable to open orig file",
error, FALSE);
}
if (!newfn || !newf || !(*newf = _open_file (newfn, "w+"))) {
if (*origf) fclose (*origf);
- RETURN_WITH_ERROR (GUM_ERROR_FILE_OPEN, "Unable to open new file",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_OPEN, "Unable to open new file",
error, FALSE);
}
if (*origf) fclose (*origf);
if (*newf) fclose (*newf);
g_unlink (newfn);
- RETURN_WITH_ERROR (GUM_ERROR_FILE_ATTRIBUTE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_ATTRIBUTE,
"Unable to get/set file attributes", error, FALSE);
}
fflush (newf) != 0 ||
fsync (fileno (newf)) != 0 ||
fclose (newf) != 0) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error, retval,
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error, retval,
FALSE);
goto _close_new;
}
/* Move original file to old file and new file as updated file */
old_file = g_strdup_printf ("%s.old", origfn);
if (!old_file) {
- SET_ERROR (GUM_ERROR_FILE_MOVE, "Unable to create old file", error,
+ GUM_SET_ERROR (GUM_ERROR_FILE_MOVE, "Unable to create old file", error,
retval, FALSE);
goto _close_new;
}
g_unlink (old_file);
if (link (origfn, old_file) != 0 ||
g_rename (newfn, origfn) != 0) {
- SET_ERROR (GUM_ERROR_FILE_MOVE, "Unable to move file", error, retval,
+ GUM_SET_ERROR (GUM_ERROR_FILE_MOVE, "Unable to move file", error, retval,
FALSE);
}
/* Update, sync and close file */
if (!update_func) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write function not specified",
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write function not specified",
error, retval, FALSE);
goto _close;
}
struct stat stat_entry;
if (!src || !dest) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
"Invalid directory path(s)", error, FALSE);
}
DBG ("copy directory %s -> %s", src, dest);
src_dir = g_dir_open (src, 0, NULL);
if (!src_dir) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
"Invalid source directory path", error, FALSE);
}
GUM_OBJECT_UNREF (src_file);
GUM_OBJECT_UNREF (dest_file);
if (stop) {
- SET_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
+ GUM_SET_ERROR (GUM_ERROR_HOME_DIR_COPY_FAILURE,
"Home directory copy failure", error, retval, FALSE);
break;
}
GUM_CONFIG_GENERAL_UMASK, GUM_UMASK);
if (!usr_home_dir) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
"Invalid home directory path", error, FALSE);
}
}
if (!g_file_test (usr_home_dir, G_FILE_TEST_IS_DIR)) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
"Home directory creation failure", error, FALSE);
}
/* when run in test mode, user may not exist */
#ifndef ENABLE_TESTS
if (chown (usr_home_dir, uid, gid) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_CREATE_FAILURE,
"Home directory chown failure", error, FALSE);
}
#endif
struct stat sent;
if (!dir || !(gdir = g_dir_open(dir, 0, NULL))) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
"Invalid home directory path", error, FALSE);
}
}
if (retval != 0) {
g_dir_close (gdir);
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
"Unable to delete files in the directory", error, FALSE);
}
}
g_dir_close (gdir);
if (g_remove (dir) != 0) {
- RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_HOME_DIR_DELETE_FAILURE,
"Unable to delete home directory", error, FALSE);
}
int rval;
regex_t re;
if (!name) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"Invalid name. len must be > 0 and less than UT_NAMESIZE",
error, FALSE);
}
len = strlen (name);
if (len == 0 || len > UT_NAMESIZE) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"Invalid name len. len must be > 0 and less than UT_NAMESIZE",
error, FALSE);
}
memset (&re, 0, sizeof (regex_t));
if (regcomp (&re, (const char*)GUM_NAME_PATTERN, 0) != 0) {
- RETURN_WITH_ERROR (GUM_ERROR_INTERNAL_SERVER, "Internal server error",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INTERNAL_SERVER, "Internal server error",
error, FALSE);
}
rval = regexec (&re, name, 0, NULL, 0);
regfree (&re);
if (rval != 0) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"Name failed pattern match for "
GUM_NAME_PATTERN, error, FALSE);
}
GChecksum *hid = NULL;
gsize len = 0;
if (!str || (len = strlen (str)) == 0) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"Unable to generate name for 0 len str", error, NULL);
}
int rval;
regex_t re;
if (!str) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR, "Invalid input str.", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR, "Invalid input str.", error,
FALSE);
}
memset (&re, 0, sizeof (regex_t));
if (regcomp (&re, (const char*)GUM_DB_ENTRY_PATTERN, REG_EXTENDED) != 0) {
- RETURN_WITH_ERROR (GUM_ERROR_INTERNAL_SERVER, "Internal server error",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INTERNAL_SERVER, "Internal server error",
error, FALSE);
}
rval = regexec (&re, str, 0, NULL, 0);
regfree (&re);
if (rval != 0) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR,
"No control characters or ':' or ',' is allowed."
"String failed pattern match for "GUM_DB_ENTRY_PATTERN, error,
FALSE);
};
if (!str) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR, "Invalid input str.",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR, "Invalid input str.",
error, FALSE);
}
if (strlen (str) > 0 && strpbrk (str, invalid) != NULL) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_STR,
"No control characters or ':' or ',' is allowed", error, FALSE);
}
return TRUE;
};
if (!str) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_SECRET, "Invalid input str.",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_SECRET, "Invalid input str.",
error, FALSE);
}
if (strpbrk (str, invalid) != NULL) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_SECRET,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_SECRET,
"No control characters or ':' is allowed", error, FALSE);
}
return TRUE;
invocation, gumd_dbus_group_adapter_get_object_path (dbus_group));
} else {
if (!error) {
- error = gum_get_gerror_for_id (GUM_ERROR_GROUP_NOT_FOUND,
+ error = GUM_GET_ERROR_FOR_ID (GUM_ERROR_GROUP_NOT_FOUND,
"Group Not Found");
}
g_dbus_method_invocation_return_gerror (invocation, error);
gumd_dbus_group_adapter_get_object_path (dbus_group));
} else {
if (!error) {
- error = gum_get_gerror_for_id (GUM_ERROR_GROUP_NOT_FOUND,
+ error = GUM_GET_ERROR_FOR_ID (GUM_ERROR_GROUP_NOT_FOUND,
"Group Not Found");
}
g_dbus_method_invocation_return_gerror (invocation, error);
invocation, gumd_dbus_user_adapter_get_object_path (dbus_user));
} else {
if (!error) {
- error = gum_get_gerror_for_id (GUM_ERROR_USER_NOT_FOUND,
+ error = GUM_GET_ERROR_FOR_ID (GUM_ERROR_USER_NOT_FOUND,
"User Not Found");
}
g_dbus_method_invocation_return_gerror (invocation, error);
gumd_dbus_user_adapter_get_object_path (dbus_user));
} else {
if (!error) {
- error = gum_get_gerror_for_id (GUM_ERROR_USER_NOT_FOUND,
+ error = GUM_GET_ERROR_FOR_ID (GUM_ERROR_USER_NOT_FOUND,
"User Not Found");
}
g_dbus_method_invocation_return_gerror (invocation, error);
if (gum_file_getgrnam (self->priv->group->gr_name, self->priv->config)
!= NULL) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_ALREADY_EXISTS,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_ALREADY_EXISTS,
"Group already exists", error, FALSE);
}
if (!_find_free_gid (self, preferred_gid, &gid)){
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_GID_NOT_AVAILABLE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_GID_NOT_AVAILABLE,
"GID not available", error, FALSE);
}
_set_gid_property (self, gid);
case GUM_OPTYPE_ADD:
if (self->priv->group->gr_gid < entry->gr_gid) {
if (putgrent (self->priv->group, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
if (self->priv->group->gr_gid == entry->gr_gid &&
g_strcmp0 (old_name, entry->gr_name) == 0) {
if (putgrent (self->priv->group, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
}
}
if (putgrent (entry, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
}
/* Write entry to file in case it is first entry in the file */
if (!done && op == GUM_OPTYPE_ADD) {
if (putgrent (self->priv->group, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
done = TRUE;
}
if (!done) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error,
FALSE);
}
case GUM_OPTYPE_ADD:
if (g_strcmp0 (self->priv->gshadow->sg_namp,
entry->sg_namp) == 0) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_ALREADY_EXISTS,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_ALREADY_EXISTS,
"File write failure", error, FALSE);
}
break;
self->priv->gshadow->sg_namp;
if (g_strcmp0 (old_name, entry->sg_namp) == 0) {
if (putsgent (self->priv->gshadow, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
}
}
if (putsgent (entry, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
}
/* Write entry to file in case it is first entry in the file */
if (!done && op == GUM_OPTYPE_ADD) {
if (putsgent (self->priv->gshadow, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
done = TRUE;
}
if (!done) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure", error,
FALSE);
}
self->priv->gshadow->sg_passwd = gum_crypt_encrypt_secret (
self->priv->group->gr_passwd, GUM_CRYPT_SHA512);
if (!self->priv->gshadow->sg_passwd) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_SECRET_ENCRYPT_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_SECRET_ENCRYPT_FAILURE,
"Secret encryption failed.", error, FALSE);
}
break;
case GUM_GROUPTYPE_NONE:
default:
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_INVALID_GROUP_TYPE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_INVALID_GROUP_TYPE,
"Invalid group type", error, FALSE);
break;
}
if (!grp ||
(s_gid != G_MAXUINT && s_gid != grp->gr_gid) ||
(s_name && g_strcmp0 (s_name, grp->gr_name) != 0)) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group not found",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group not found",
error, FALSE);
}
}
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
const gchar *shadow_file = NULL;
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if (self->priv->group->gr_gid == GUM_GROUP_INVALID_GID) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group gid invalid",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group gid invalid",
error, FALSE);
}
if (self->priv->group->gr_gid == getegid ()) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_SELF_DESTRUCTION,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_SELF_DESTRUCTION,
"Self-destruction not possible", error, FALSE);
}
if (gum_file_find_user_by_gid (self->priv->group->gr_gid,
self->priv->config) != NULL) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_HAS_USER,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_HAS_USER,
"Group is a primary group of an existing user", error, FALSE);
}
/* Only secret can be updated */
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if (self->priv->group->gr_gid == GUM_GROUP_INVALID_GID) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group gid invalid",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group gid invalid",
error, FALSE);
}
(gshadow && gum_crypt_cmp_secret (self->priv->group->gr_passwd,
gshadow->sg_passwd) == 0)) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NO_CHANGES,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NO_CHANGES,
"No changes registered", error, FALSE);
}
DBG ("");
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if ((pent = gum_file_getpwuid (uid, self->priv->config)) == NULL) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
FALSE);
}
if (gum_string_utils_search_stringv (grp->gr_mem, pent->pw_name)) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_USER_ALREADY_A_MEMBER,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_USER_ALREADY_A_MEMBER,
"User already a member of the group", error, FALSE);
}
DBG ("");
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if ((pent = gum_file_getpwuid (uid, self->priv->config)) == NULL) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
FALSE);
}
if (!gum_string_utils_search_stringv (grp->gr_mem, pent->pw_name)) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND,
"User not a member of the group", error, FALSE);
}
const gchar *origfn = NULL;
if (!config || !user_name) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_INVALID_DATA,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_INVALID_DATA,
"Invalid input data", error, FALSE);
}
}
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
status = putgrent (gdest, newf);
_free_daemon_group_entry (gdest);
if (status < 0) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, retval, FALSE);
break;
}
} else if (putgrent (gent, newf) < 0) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, retval, FALSE);
break;
}
status = putsgent (gsdest, newf);
_free_gshadow_entry (gsdest);
if (status < 0) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, retval, FALSE);
break;
}
} else if (putsgent (gsent, newf) < 0) {
- SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_SET_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, retval, FALSE);
break;
}
* */
gchar *tname = NULL;
if (!self->priv->pw->pw_name && !self->priv->nick_name) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"User name not specified", error, FALSE);
}
g_free (tname);
return TRUE;
} else if (self->priv->user_type == GUM_USERTYPE_SYSTEM) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_NAME,
"System user name must exist with pattern "
GUM_NAME_PATTERN, error, FALSE);
}
if (gum_file_getpwnam (self->priv->pw->pw_name, self->priv->config)
!= NULL) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_ALREADY_EXISTS,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_ALREADY_EXISTS,
"User already exists", error, FALSE);
}
if (!_find_free_uid (self, &uid)){
- RETURN_WITH_ERROR (GUM_ERROR_USER_UID_NOT_AVAILABLE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_UID_NOT_AVAILABLE,
"UID not available", error, FALSE);
}
_set_uid_property (self, uid);
break;
case GUM_USERTYPE_NONE:
default:
- RETURN_WITH_ERROR (GUM_ERROR_USER_INVALID_USER_TYPE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_INVALID_USER_TYPE,
"Invalid user type", error, FALSE);
break;
}
self->priv->shadow->sp_pwdp = gum_crypt_encrypt_secret (
self->priv->pw->pw_passwd, GUM_CRYPT_SHA512);
if (!self->priv->shadow->sp_pwdp) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_SECRET_ENCRYPT_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_SECRET_ENCRYPT_FAILURE,
"Secret encryption failed.", error, FALSE);
}
case GUM_OPTYPE_ADD:
if (self->priv->pw->pw_uid < entry->pw_uid) {
if (putpwent (self->priv->pw, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
self->priv->pw->pw_gid == entry->pw_gid &&
g_strcmp0 (old_name, entry->pw_name) == 0) {
if (putpwent (self->priv->pw, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
}
}
if (putpwent (entry, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
}
/* Write entry to file in case it is first entry in the file */
if (!done && op == GUM_OPTYPE_ADD) {
if (putpwent (self->priv->pw, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Add entry failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Add entry failure",
error, FALSE);
}
done = TRUE;
}
if (!done) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
error, FALSE);
}
struct spwd *entry = NULL;
if (!user_data) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
ret = putspent (spent, newf);
_free_shadow_entry (spent);
if (ret < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
}
}
if (putspent (entry, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
}
if (!done) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
error, FALSE);
}
case GUM_OPTYPE_ADD:
if (g_strcmp0 (self->priv->shadow->sp_namp,
entry->sp_namp) == 0) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_ALREADY_EXISTS,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_ALREADY_EXISTS,
"File write failure", error, FALSE);
}
break;
self->priv->shadow->sp_namp;
if (g_strcmp0 (old_name, entry->sp_namp) == 0) {
if (putspent (self->priv->shadow, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"File write failure", error, FALSE);
}
done = TRUE;
}
}
if (putspent (entry, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "File write failure",
error, FALSE);
}
}
/* Write entry to file in case it is first entry in the file */
if (!done && op == GUM_OPTYPE_ADD) {
if (putspent (self->priv->shadow, newf) < 0) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Add entry failure",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Add entry failure",
error, FALSE);
}
done = TRUE;
}
if (!done) {
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Operation did not complete",
error, FALSE);
}
group = gumd_daemon_group_new (self->priv->config);
if (!group) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
"Group add failure", error, FALSE);
}
"grouptype", grp_type, NULL);
if (!(added = gumd_daemon_group_add (group, (gid_t)self->priv->pw->pw_uid,
&gid, error))) {
- SET_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
+ GUM_SET_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
"Group add failure", error, added, FALSE);
goto _finished;
}
g_object_unref (agroup);
if (!added) break;
} else {
- RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_ADD_FAILURE,
"Unable to add default groups", error, FALSE);
}
ind++;
group = gumd_daemon_group_new (self->priv->config);
if (!group) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_DELETE_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_GROUP_DELETE_FAILURE,
"Group delete failure - unable to create group obj",
error, FALSE);
}
g_object_set (G_OBJECT(group), "groupname", self->priv->pw->pw_name,
"gid", self->priv->pw->pw_gid, NULL);
if (!(deleted = gumd_daemon_group_delete (group, error))) {
- SET_ERROR (GUM_ERROR_USER_GROUP_DELETE_FAILURE,
+ GUM_SET_ERROR (GUM_ERROR_USER_GROUP_DELETE_FAILURE,
"Group delete failure", error, deleted, FALSE);
goto _finished;
}
if (!pwd ||
(s_uid != GUM_USER_INVALID_UID && s_uid != pwd->pw_uid) ||
(s_name && g_strcmp0 (s_name, pwd->pw_name) != 0)) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found",
error, FALSE);
}
}
spent = gum_file_getspnam (pent->pw_name, self->priv->config);
if (!spent) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found",
error, FALSE);
}
}
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
gboolean lock = TRUE;
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if (self->priv->pw->pw_uid == GUM_USER_INVALID_UID) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User uid invalid", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User uid invalid", error,
FALSE);
}
if (!_copy_passwd_data (self, error)) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
FALSE);
}
/* deny if user is self-destructing */
if (self->priv->pw->pw_uid == geteuid ()) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_SELF_DESTRUCTION,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_SELF_DESTRUCTION,
"Self-destruction not possible", error, FALSE);
}
gum_config_get_string (self->priv->config,
GUM_CONFIG_GENERAL_SHADOW_FILE), &lock, error)) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_LOCK_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_LOCK_FAILURE,
"unable to lock user to login", error, FALSE);
}
gum_config_get_string (self->priv->config,
GUM_CONFIG_GENERAL_SHADOW_FILE), &lock, NULL);
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_SESSION_TERM_FAILURE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_SESSION_TERM_FAILURE,
"unable to terminate user active sessions", error, FALSE);
}
/* Only secret, realname, office, officephone, homephone and
* shell can be updated */
if (!gum_lock_pwdf_lock ()) {
- RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_DB_ALREADY_LOCKED,
"Database already locked", error, FALSE);
}
if (self->priv->pw->pw_uid == GUM_USER_INVALID_UID) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User uid invalid", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User uid invalid", error,
FALSE);
}
if ((shadow = gum_file_getspnam (pw->pw_name,
self->priv->config)) == NULL) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND,
"User not found in Shadow", error, FALSE);
}
if (change == 0) {
gum_lock_pwdf_unlock ();
- RETURN_WITH_ERROR (GUM_ERROR_USER_NO_CHANGES,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NO_CHANGES,
"No changes registered", error, FALSE);
}
{
GumdDaemonUser *user = NULL;
if (!self || !GUMD_IS_DAEMON (self)) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon object is not valid", error, NULL);
}
user = gumd_daemon_user_new_by_uid (uid, self->priv->config);
if (!user) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
NULL);
}
{
uid_t uid = GUM_USER_INVALID_UID;
if (!self || !GUMD_IS_DAEMON (self)) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon object is not valid", error, NULL);
}
uid = gumd_daemon_user_get_uid_by_name (username, self->priv->config);
if (uid == GUM_USER_INVALID_UID) {
- RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_USER_NOT_FOUND, "User not found", error,
NULL);
}
uid_t uid = GUM_USER_INVALID_UID;
if (!self || !GUMD_IS_DAEMON (self) || !user) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/usr object not valid", error, FALSE);
}
uid_t uid = GUM_USER_INVALID_UID;
if (!self || !GUMD_IS_DAEMON (self) || !user) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/user object not valid", error, FALSE);
}
uid_t uid = GUM_USER_INVALID_UID;
if (!self || !GUMD_IS_DAEMON (self) || !user) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/user object not valid", error, FALSE);
}
{
GumdDaemonGroup *group = NULL;
if (!self || !GUMD_IS_DAEMON (self)) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon object is not valid", error, NULL);
}
group = gumd_daemon_group_new_by_gid (gid, self->priv->config);
if (!group) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "Group not found", error,
FALSE);
}
{
gid_t gid = GUM_GROUP_INVALID_GID;
if (!self || !GUMD_IS_DAEMON (self)) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon object is not valid", error, NULL);
}
gid = gumd_daemon_group_get_gid_by_name (groupname, self->priv->config);
if (gid == GUM_GROUP_INVALID_GID) {
- RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "User not found", error,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_GROUP_NOT_FOUND, "User not found", error,
NULL);
}
gid_t gid = GUM_GROUP_INVALID_GID;
if (!self || !GUMD_IS_DAEMON (self) || !group) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/usr object not valid", error, FALSE);
}
gid_t gid = GUM_GROUP_INVALID_GID;
if (!self || !GUMD_IS_DAEMON (self) || !group) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/group object not valid", error, FALSE);
}
gid_t gid = GUM_GROUP_INVALID_GID;
if (!self || !GUMD_IS_DAEMON (self) || !group) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/group object not valid", error, FALSE);
}
GError **error)
{
if (!self || !GUMD_IS_DAEMON (self) || !group) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/group object not valid", error, FALSE);
}
GError **error)
{
if (!self || !GUMD_IS_DAEMON (self) || !group) {
- RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_INVALID_INPUT,
"Daemon/group object not valid", error, FALSE);
}
/**
* GumGroupClass:
+ * @parent_class: parent class object
*
* Opaque structure for the class.
*/
* GumGroup:grouptype:
*
* This property holds a group type that the object corresponds to. Valid
- * values of group types are; 1 (system), 2 (user).
+ * values of group types are: 1 (system), 2 (user).
* #GumGroup:grouptype must be specified when adding a new group.
*/
properties[PROP_GROUPTYPE] = g_param_spec_uint ("grouptype",
/**
* GumUserClass:
+ * @parent_class: parent class object
*
* Opaque structure for the class.
*/
* GumUser:usertype:
*
* This property holds a user type that the object corresponds to. Valid
- * values of user types are; 1 (system), 2 (admin), 3 (guest), 4 (normal).
+ * values of user types are: 1 (system), 2 (admin), 3 (guest), 4 (normal).
* #GumUser:usertype must be specified when adding a new user.
*/
properties[PROP_USERTYPE] = g_param_spec_uint ("usertype",
n_read += n;
} while (n_read < BLOCKSIZE && n != 0);
if (n == 0 && ferror (origf))
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Unable to write file",
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE, "Unable to write file",
error, FALSE);
p = buffer;
while (n_read > 0) {
n_written = fwrite (p, 1, n_read, newf);
if (n_written == -1)
- RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
+ GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_WRITE,
"Unable to write file", error, FALSE);
p += n_written;