--- a/rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrscript.cpp Fri Jul 03 15:51:30 2009 +0100
+++ b/rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrscript.cpp Thu Sep 10 12:58:32 2009 +0300
@@ -24,6 +24,7 @@
#include <s32mem.H>
const TReal DEFAULT_VERSION(1.0);
+const TReal VERSION_TWO(2.0);
// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
@@ -33,6 +34,8 @@
delete iPermissionSet;
if(iHashMark)
delete iHashMark;
+ iAllowedProviders.Close();
+ iDeniedProviders.Close();
}
// ---------------------------------------------------------------------------
@@ -84,7 +87,13 @@
iPolicyID = aRhs.iPolicyID;
iPermGrant = aRhs.iPermGrant;
iPermDenied = aRhs.iPermDenied;
-
+ iAllowedProviders.Reset();
+ for(TInt i(0); i < aRhs.iAllowedProviders.Count(); i++)
+ iAllowedProviders.Append(aRhs.iAllowedProviders[i]);
+ iDeniedProviders.Reset();
+ for(TInt i(0); i < aRhs.iDeniedProviders.Count(); i++)
+ iDeniedProviders.Append(aRhs.iDeniedProviders[i]);
+
if(iHashMark)
{
delete iHashMark;
@@ -168,12 +177,34 @@
}
// ---------------------------------------------------------------------------
+// Gets permanently granted permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::PermGranted(RProviderArray& aAllowedProviders)
+ {
+ aAllowedProviders.Reset();
+ for(TInt i(0); i < iAllowedProviders.Count(); i++)
+ aAllowedProviders.Append(iAllowedProviders[i]);
+ }
+
+// ---------------------------------------------------------------------------
+// Gets permanently denied permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::PermDenied(RProviderArray& aDeniedProviders)
+ {
+ aDeniedProviders.Reset();
+ for(TInt i(0); i < iDeniedProviders.Count(); i++)
+ aDeniedProviders.Append(iDeniedProviders[i]);
+ }
+
+// ---------------------------------------------------------------------------
// ExternalizeLs script data to stream
// ---------------------------------------------------------------------------
//
EXPORT_C void CScript::ExternalizeL(RWriteStream& aSink) const
{
- aSink.WriteReal32L(DEFAULT_VERSION);
+ aSink.WriteReal32L(VERSION_TWO);
iPermissionSet->ExternalizeL (aSink);
aSink.WriteInt32L (iScriptID);
aSink.WriteInt32L (iPolicyID);
@@ -186,6 +217,14 @@
}
else
aSink.WriteInt32L(0);
+
+ //Present only in version 2 and forward.
+ aSink.WriteInt32L(iAllowedProviders.Count());
+ for(TInt i(0); i < iAllowedProviders.Count(); i++)
+ aSink.WriteInt32L(iAllowedProviders[i].iUid);
+ aSink.WriteInt32L(iDeniedProviders.Count());
+ for(TInt i(0); i < iDeniedProviders.Count(); i++)
+ aSink.WriteInt32L(iDeniedProviders[i].iUid);
}
// ---------------------------------------------------------------------------
@@ -219,6 +258,25 @@
TPtr ptr(iHashMark->Des());
aSource.ReadL(ptr,hashMarkLen);
}
+ if(version >= VERSION_TWO)
+ {
+ TInt allowCnt = aSource.ReadInt32L();
+ iAllowedProviders.Reset();
+ for(TInt i(0); i < allowCnt; i++)
+ {
+ TInt uid = aSource.ReadInt32L();
+ TUid allowPid = TUid::Uid(uid);
+ iAllowedProviders.Append(allowPid);
+ }
+ TInt denyCnt = aSource.ReadInt32L();
+ iDeniedProviders.Reset();
+ for(TInt i(0); i < denyCnt; i++)
+ {
+ TInt uid = aSource.ReadInt32L();
+ TUid denyPid = TUid::Uid(uid);
+ iDeniedProviders.Append(denyPid);
+ }
+ }
}
// ---------------------------------------------------------------------------
@@ -238,3 +296,25 @@
{
iPermDenied = aPermDenied;
}
+
+// ---------------------------------------------------------------------------
+// Sets permanently granted permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::SetPermGranted(RProviderArray aPermGrantProvider)
+ {
+ iAllowedProviders.Reset();
+ for(TInt i(0); i < aPermGrantProvider.Count(); i++)
+ iAllowedProviders.Append(aPermGrantProvider[i]);
+ }
+
+// ---------------------------------------------------------------------------
+// Sets permanently denied permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::SetPermDenied(RProviderArray aPermDeniedProvider)
+ {
+ iDeniedProviders.Reset();
+ for(TInt i(0); i < aPermDeniedProvider.Count(); i++)
+ iDeniedProviders.Append(aPermDeniedProvider[i]);
+ }