Modify the privilege enum to URI style
authorhb.min <hb.min@samsung.com>
Mon, 26 Nov 2012 15:55:57 +0000 (00:55 +0900)
committerhb.min <hb.min@samsung.com>
Mon, 26 Nov 2012 15:55:57 +0000 (00:55 +0900)
Change-Id: Ic9685fac9d849ec5d1065004e08e4d8c68827f25

src/XmlHandler/PrivilegeHandler.cpp

index 75a4872..e282dc4 100755 (executable)
@@ -148,11 +148,33 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList)
        while (pEnum->MoveNext() == E_SUCCESS)
        {
                validStringFlag = false;
+               String privilegeURI = L"http://tizen.org/privilege/";
 
                String* pTempString = (String*) pEnum->GetCurrent();
+
+               if ((pTempString->GetLength()) < (privilegeURI.GetLength()))
+               {
+                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
+                       resultFlag = false;
+                       continue;
+               }
+
+               String uriString;
+               pTempString->SubString(0, privilegeURI.GetLength(), uriString);
+
+               if (!(uriString.Equals(privilegeURI, true)))
+               {
+                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
+                       resultFlag = false;
+                       continue;
+               }
+
+               String privilegeString;
+               pTempString->SubString(privilegeURI.GetLength(), pTempString->GetLength()-privilegeURI.GetLength(), privilegeString);
+
                for (index = 0; index < _MAX_PRIVILEGE_ENUM; index++)
                {
-                       if (wcscmp(privilegeListTable[index].privilegeString, pTempString->GetPointer()) == 0)
+                       if (wcscmp(privilegeListTable[index].privilegeString, privilegeString.GetPointer()) == 0)
                        {
                                validStringFlag = true;
                                privilegeEnum = static_cast< int >(privilegeListTable[index].privilege);