User home directory fixups. Needed for SSH

User home directory fixups, needed for SSH to work
properly. With this patch, home directory is created
for all users created and deleted, when users are removed.

Test:
Performed user creation, deletion test case and made sure
it is properly reflected in user manager and in ipmi.

Change-Id: If7d79c67784191e0cccb3f6c22f4e191fd0bbc84
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/user_mgr.cpp b/user_mgr.cpp
index ebed493..f407133 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -274,7 +274,7 @@
     try
     {
         executeCmd("/usr/sbin/useradd", userName.c_str(), "-G", groups.c_str(),
-                   "-M", "-N", "-s",
+                   "-m", "-N", "-s",
                    (sshRequested ? "/bin/sh" : "/bin/nologin"), "-e",
                    (enabled ? "" : "1970-01-02"));
     }
@@ -303,7 +303,7 @@
     throwForUserDoesNotExist(userName);
     try
     {
-        executeCmd("/usr/sbin/userdel", userName.c_str());
+        executeCmd("/usr/sbin/userdel", userName.c_str(), "-r");
     }
     catch (const InternalFailure &e)
     {
@@ -329,8 +329,9 @@
                                 usersList[userName].get()->userGroups());
     try
     {
+        std::string newHomeDir = "/home/" + newUserName;
         executeCmd("/usr/sbin/usermod", "-l", newUserName.c_str(),
-                   userName.c_str());
+                   userName.c_str(), "-d", newHomeDir.c_str(), "-m");
     }
     catch (const InternalFailure &e)
     {