summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoman Rakus <rrakus@redhat.com>2013-09-02 14:41:57 +0200
committerRoman Rakus <rrakus@redhat.com>2013-09-02 15:31:59 +0200
commite658e0d706edd66e544d4de63b5ee979e817a8a8 (patch)
tree3dbd82a199d463c3b51c412e1ac1ba096f19daab /src
parentabfc7cb142082feebf80ee215c72d73404a597fa (diff)
downloadopenlmi-providers-e658e0d706edd66e544d4de63b5ee979e817a8a8.tar.gz
openlmi-providers-e658e0d706edd66e544d4de63b5ee979e817a8a8.tar.xz
openlmi-providers-e658e0d706edd66e544d4de63b5ee979e817a8a8.zip
Account: Use constants for method return values
Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/account/LMI_AccountProvider.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c
index 5abad72..f1a2546 100644
--- a/src/account/LMI_AccountProvider.c
+++ b/src/account/LMI_AccountProvider.c
@@ -44,6 +44,13 @@
#include "macros.h"
#include "globals.h"
+// Return values of functions
+// Delete user
+#define USER_NOT_EXIST 4096
+#define CANNOT_DELETE_HOME 4097
+#define CANNOT_DELETE_USER 4098
+#define CANNOT_DELETE_GROUP 4099
+
static const CMPIBroker* _cb = NULL;
static void LMI_AccountInitialize()
@@ -481,7 +488,7 @@ static CMPIrc delete_user(
if (!lu_user_lookup_name(luc, username, lue, &error)) {
asprintf(&errormsg, "Non existing user: %s\n", username);
- rc = 4096;
+ rc = USER_NOT_EXIST;
goto clean;
}
@@ -493,7 +500,7 @@ static CMPIrc delete_user(
if (stat(home, &buf)) {
asprintf(&errormsg, "User's homedir %s could not be deleted: %s\n",
home, strerror(errno));
- rc = 4097;
+ rc = CANNOT_DELETE_HOME;
goto clean;
}
/* Remove home dir if the user is owner or force is set */
@@ -502,7 +509,7 @@ static CMPIrc delete_user(
asprintf(&errormsg,
"User's homedir %s could not be deleted: %s\n", home,
lu_strerror(error));
- rc = 4097;
+ rc = CANNOT_DELETE_HOME;
goto clean;
}
}
@@ -511,7 +518,7 @@ static CMPIrc delete_user(
if (!lu_user_delete(luc, lue, &error)) {
asprintf(&errormsg, "User %s could not be deleted: %s\n",
username, lu_strerror(error));
- rc = 4098;
+ rc = CANNOT_DELETE_USER;
goto clean;
}
@@ -521,14 +528,14 @@ static CMPIrc delete_user(
if (gid == LU_VALUE_INVALID_ID) {
asprintf(&errormsg, "%s did not have a gid number.\n", username);
- rc = 4099;
+ rc = CANNOT_DELETE_GROUP;
goto clean;
}
if (lu_group_lookup_id(luc, gid, lueg, &error) == FALSE) {
asprintf(&errormsg, "No group with GID %jd exists, not removing.\n",
(intmax_t)gid);
- rc = 4099;
+ rc = CANNOT_DELETE_GROUP;
goto clean;
}
const char *tmp = lu_ent_get_first_string(lueg, LU_GROUPNAME);
@@ -536,14 +543,14 @@ static CMPIrc delete_user(
asprintf(&errormsg,
"Group with GID %jd did not have a group name.\n",
(intmax_t)gid);
- rc = 4099;
+ rc = CANNOT_DELETE_GROUP;
goto clean;
}
if (strcmp(tmp, username) == 0) {
if (lu_group_delete(luc, lueg, &error) == FALSE) {
asprintf(&errormsg, "Group %s could not be deleted: %s.\n",
tmp, lu_strerror(error));
- rc = 4099;
+ rc = CANNOT_DELETE_GROUP;
goto clean;
}
}