summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2013-11-11 14:23:31 +0100
committerTomas Bzatek <tbzatek@redhat.com>2013-11-11 17:18:39 +0100
commit3520d42bd9d5708bb9bad295efff23d1177cc32a (patch)
tree9db2bbb18c4f0a38b3dc0d98aa1a873a1dd7b9af
parenteff6cb40a89756bb8f62200a99b830639e9b17fc (diff)
downloadopenlmi-providers-3520d42bd9d5708bb9bad295efff23d1177cc32a.tar.gz
openlmi-providers-3520d42bd9d5708bb9bad295efff23d1177cc32a.tar.xz
openlmi-providers-3520d42bd9d5708bb9bad295efff23d1177cc32a.zip
account: Ignore homedir deletion failures when deleting an user
It was impossible to remove user when its home directory was unable to delete, e.g. either pointing to a bad location or inaccessible as in not being mounted, etc. Even the "force" argument didn't help. For this reason, any failure on homedir deletion is now ignored and a warning is noted in the log. The particular error return code is unused now but kept in the MOF file for compatibility, adding a note.
-rw-r--r--mof/60_LMI_Account.mof8
-rw-r--r--src/account/LMI_AccountProvider.c13
2 files changed, 12 insertions, 9 deletions
diff --git a/mof/60_LMI_Account.mof b/mof/60_LMI_Account.mof
index 4e2081f..ddd8af4 100644
--- a/mof/60_LMI_Account.mof
+++ b/mof/60_LMI_Account.mof
@@ -18,7 +18,7 @@
* Authors: Roman Rakus <rrakus@redhat.com>
*/
-[ Version("0.3.0"),
+[ Version("0.4.2"),
Description("Class representing Linux Account"),
Provider("cmpi:cmpiLMI_Account")
]
@@ -49,13 +49,15 @@ class LMI_Account: CIM_Account
"Delete the user. Along with the user, the home directory and user's "
"primary group are deleted. If the user is not owner of the home "
"directory it is not deleted. However this directory can be deleted "
- "if force parameter is set to True." ),
+ "if force parameter is set to True. If the home directory couldn't be "
+ "deleted, no error is returned to be able to remove the user even when "
+ "its home directory is inaccessible (e.g. unreachable NFS mount)." ),
ValueMap { "0", "1", "..", "4096", "4097", "4098", "4099" },
Values { "Operation completed successfully",
"Failed",
"DMTF Reserved",
"Non existing user",
- "Unable to delete Home Direcotry",
+ "Unable to delete Home Direcotry (currently unused)",
"Unable to remove user, home directory removed",
"Unable to remove group, user and home directory removed" }]
uint32 DeleteUser(
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c
index c022953..da7f970 100644
--- a/src/account/LMI_AccountProvider.c
+++ b/src/account/LMI_AccountProvider.c
@@ -55,7 +55,10 @@
// Return values of functions
// Delete user
#define USER_NOT_EXIST 4096
-#define CANNOT_DELETE_HOME 4097
+#if 0
+ /* Unused */
+ #define CANNOT_DELETE_HOME 4097
+#endif
#define CANNOT_DELETE_USER 4098
#define CANNOT_DELETE_GROUP 4099
// Change password
@@ -596,11 +599,9 @@ static CMPIrc delete_user(
if (!ret) {
const char *const home = lu_ent_get_first_string(lue, LU_HOMEDIRECTORY);
/* If null is returned then asprintf handle it. */
- asprintf(&errormsg,
- "User's homedir %s could not be deleted: %s\n", home,
- lu_strerror(error));
- rc = CANNOT_DELETE_HOME;
- goto clean;
+ warn("User's homedir %s could not be deleted: %s\n", home, lu_strerror(error));
+ /* Silently succeed, remove the user despite keeping homedir aside */
+ lu_error_free(&error);
}
}