Add default groups for the user of zone 44/66144/2
authorSungbae Yoo <sungbae.yoo@samsung.com>
Fri, 15 Apr 2016 07:52:21 +0000 (16:52 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 18 Apr 2016 08:15:42 +0000 (17:15 +0900)
Change-Id: I2a295957cf9133cd408aa467af7c71b87eb61184
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
server/zone.cpp

index 796a438..6c9ff10 100644 (file)
@@ -30,6 +30,7 @@
 #include "process.h"
 #include "filesystem.h"
 #include "auth/user.h"
+#include "auth/group.h"
 #include "xml/parser.h"
 #include "xml/document.h"
 #include "audit/logger.h"
@@ -53,6 +54,8 @@
 
 namespace DevicePolicyManager {
 
+static const char *defaultGroups[] = {"audio", "video", "display", "log", NULL};
+
 static int setZoneState(uid_t id, int state)
 {
     GDBusConnection* connection;
@@ -234,8 +237,13 @@ int Zone::createZone(const std::string& name, const std::string& setupWizAppid)
             ret = ::symlink("/dev/null",
                       (systemdUserUnit.getPath() + "/starter.service").c_str());
 
-           if (ret != 0)
-               throw runtime::Exception("Failed to mask starter.service");
+            if (ret != 0)
+                throw runtime::Exception("Failed to mask starter.service");
+
+            for (int i = 0; defaultGroups[i]; i++) {
+                runtime::Group grp(defaultGroups[i]);
+                grp.addMember(name);
+            }
 
             //initialize package db
             execute("/usr/bin/pkg_initdb",