Binary file build/loc/resources.jar has changed
--- a/build/makefile.javaversion Thu Aug 05 16:07:57 2010 +0300
+++ b/build/makefile.javaversion Mon Aug 23 14:24:31 2010 +0300
@@ -1,2 +1,2 @@
# Set Java version (must be dot separated, without spaces)
-JAVA_VERSION = 2.2.9
+JAVA_VERSION = 2.2.11
--- a/build/symbian_uids.pri Thu Aug 05 16:07:57 2010 +0300
+++ b/build/symbian_uids.pri Mon Aug 23 14:24:31 2010 +0300
@@ -123,6 +123,7 @@
contains(TARGET, javacaptain_ext_autostarter): TARGET.UID3 = 0x2002EA7E
contains(TARGET, javacontrolpanel): TARGET.UID3 = 0x2002FF62
contains(TARGET, eswtqtwebkit): TARGET.UID3 = 0x2002FFA9
+contains(TARGET, javaopengles): TARGET.UID3 = 0x20031DD1
isEmpty(TARGET.UID3): error($${TEMPLATE} $${TARGET} : UID3 not defined. Please allocate UID3 and configure it either on $${TARGET}.pro file or in command symbian_uids.pri)
--- a/inc/build_defines.hrh Thu Aug 05 16:07:57 2010 +0300
+++ b/inc/build_defines.hrh Mon Aug 23 14:24:31 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-#define RD_JAVA_VERSION 2,2,9
+#define RD_JAVA_VERSION 2,2,11
#define RD_JAVA_SYMBIAN_TARGET
#define RD_JAVA_S60_RELEASE_10_1
#define RD_JAVA_S60_RELEASE_10_1_ONWARDS
--- a/inc/java.txt Thu Aug 05 16:07:57 2010 +0300
+++ b/inc/java.txt Mon Aug 23 14:24:31 2010 +0300
@@ -1,1 +1,1 @@
-2.2.9
+2.2.11
--- a/javacommons/comms/ipclib/clientserver/src.s60/creceiver.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/comms/ipclib/clientserver/src.s60/creceiver.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -33,8 +33,20 @@
CReceiver::CReceiver(IpcClient& aParent, IpcListener& aListener, RComms& aSession)
: CActive(EPriorityStandard), mParent(aParent), mListener(aListener), mSession(aSession)
{
+}
+
+CReceiver* CReceiver::NewLC(IpcClient& aParent, IpcListener& aListener, RComms& aSession)
+{
+ CReceiver* self = new(ELeave) CReceiver(aParent, aListener, aSession);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+void CReceiver::ConstructL()
+{
CActiveScheduler::Add(this);
- mBuffer.Create(DEFAULT_BUFFER_SIZE);
+ mBuffer.CreateL(DEFAULT_BUFFER_SIZE);
}
CReceiver::~CReceiver()
--- a/javacommons/comms/ipclib/clientserver/src.s60/creceiver.h Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/comms/ipclib/clientserver/src.s60/creceiver.h Mon Aug 23 14:24:31 2010 +0300
@@ -31,12 +31,16 @@
NONSHARABLE_CLASS(CReceiver): public CActive
{
+ CReceiver(IpcClient& aParent, IpcListener& aListener, RComms& aSession);
public:
- CReceiver(IpcClient& aParent, IpcListener& aListener, RComms& aSession);
+ static CReceiver* NewLC(IpcClient& aParent, IpcListener& aListener, RComms& aSession);
+
~CReceiver();
void Receive();
private:
+ void ConstructL();
+
virtual void RunL();
virtual void DoCancel();
virtual TInt RunError(TInt aError);
--- a/javacommons/comms/ipclib/clientserver/src.s60/ipcclient.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/comms/ipclib/clientserver/src.s60/ipcclient.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -176,8 +176,7 @@
User::LeaveIfError(mComms.Connect(serverName->Des()));
LOG1(EJavaComms, EInfo, "IpcClient connected to %s", address.str().c_str());
- mReceiver = new(ELeave) CReceiver(*this, *mListener, mComms);
- CleanupStack::PushL(mReceiver);
+ mReceiver = CReceiver::NewLC(*this, *mListener, mComms);
mReceiver->Receive();
CActiveScheduler::Add(this);
--- a/javacommons/fileutils/src.s60/filesystemutils.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/fileutils/src.s60/filesystemutils.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -25,6 +25,7 @@
#include "s60filesystemutilities.h"
#include "javasymbianoslayer.h"
+#define BUF_LEN 255
using namespace std;
using namespace java::util;
using namespace java::fileutils;
@@ -94,8 +95,9 @@
OS_EXPORT std::wstring FileUtilities::listRoots()
{
JELOG2(EJavaFile);
- TDesC16 aDes(S60FileSystemUtilities::GetSupportedDrives());
- std::wstring retString((wchar_t*)aDes.Ptr());
+ TBuf<BUF_LEN> buf;
+ buf.Copy(S60FileSystemUtilities::GetSupportedDrives());
+ std::wstring retString((wchar_t*)buf.Ptr());
return retString;
}
--- a/javacommons/fileutils/src/fileutilities.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/fileutils/src/fileutilities.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -323,7 +323,8 @@
char *dirName = JavaCommonUtils::wstringToUtf8(path);
if (ableToOpen)
{
- if (!opendir(dirName))
+ DIR* wDirHandle = opendir(dirName);
+ if (!wDirHandle)
{
ableToOpen = false;
if (mkdir(dirName,0666)<0)
@@ -334,6 +335,7 @@
return -1;
}
}
+ closedir(wDirHandle);
}
else
{
--- a/javacommons/gcfprotocols/http/build/javahttp.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/http/build/javahttp.pro Mon Aug 23 14:24:31 2010 +0300
@@ -18,6 +18,7 @@
TARGET=javahttp
TEMPLATE=lib
CONFIG += omj java stl
+CONFIG -= qt
symbian {
--- a/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -244,35 +244,36 @@
} // end of else
LOG1(ESOCKET,EInfo,"apnerr = %d",*apnerr);
+ LOG(ESOCKET,EInfo,"now no re prompting");
// This is special case when that IAP/SNAP is not found
// Override the http stack's feaute of using device default
- if (*apnerr < 0)
- {
- LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session");
- int ret = iSocketServ.Connect();
- ret = iConnection.Open(iSocketServ);
-#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
- TConnPrefList prefList;
- TExtendedConnPref prefs;
- prefs.SetConnSelectionDialog(ETrue);
- prefList.AppendL(&prefs);
- ret = iConnection.Start(prefList);
- LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce - error case ");
-#else
- TCommDbConnPref pref;
- pref.SetDialogPreference(ECommDbDialogPrefPrompt);
- ret = iConnection.Start(pref);
- LOG(ESOCKET,EInfo,"+HttpSessionClient:: using commdb con pref - error case ");
-#endif
-
- RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
- connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
- HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
- TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
- connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
- HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
- }
+// if (*apnerr < 0)
+// {
+// LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session");
+// int ret = iSocketServ.Connect();
+// ret = iConnection.Open(iSocketServ);
+//#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+// TConnPrefList prefList;
+// TExtendedConnPref prefs;
+// prefs.SetConnSelectionDialog(ETrue);
+// prefList.AppendL(&prefs);
+// ret = iConnection.Start(prefList);
+// LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce - error case ");
+//#else
+// TCommDbConnPref pref;
+// pref.SetDialogPreference(ECommDbDialogPrefPrompt);
+// ret = iConnection.Start(pref);
+// LOG(ESOCKET,EInfo,"+HttpSessionClient:: using commdb con pref - error case ");
+//#endif
+//
+// RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
+// connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
+// HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
+// TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
+// connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
+// HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
+// }
//Add proxy support
TRAP_IGNORE(LoadProxyLibraryL(aAPNId));
--- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -20,7 +20,7 @@
#include <centralrepository.h>
#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <cuseragent.h>
+#include <CUserAgent.h>
#else
#include <cuseragent.h>
#endif
--- a/javacommons/gcfprotocols/socket/socket/javasrc.s60/com/nokia/mj/impl/gcf/protocol/socket/Protocol.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/javasrc.s60/com/nokia/mj/impl/gcf/protocol/socket/Protocol.java Mon Aug 23 14:24:31 2010 +0300
@@ -151,7 +151,7 @@
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
"socket - protocol class : server connection");
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- SocketPermissionImpl per = new SocketPermissionImpl("socket://");
+ SocketPermissionImpl per = new SocketPermissionImpl(SocketPermissionImpl.SERVER_TARGET);
appUtils.checkPermission(per);
/* security related stuff */
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
@@ -168,7 +168,7 @@
throw new IllegalArgumentException("Invalid URL: " + fullurl);
}
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- SocketPermissionImpl per = new SocketPermissionImpl("socket://*");
+ SocketPermissionImpl per = new SocketPermissionImpl(SocketPermissionImpl.CLIENT_TARGET);
appUtils.checkPermission(per);
/* security related stuff */
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
--- a/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/gcf/protocol/socket/PushValidatorImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/gcf/protocol/socket/PushValidatorImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -127,7 +127,7 @@
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
"socket - push validator : before security check");
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- SocketPermissionImpl per = new SocketPermissionImpl("socket://");
+ SocketPermissionImpl per = new SocketPermissionImpl(SocketPermissionImpl.SERVER_TARGET);
appUtils.checkPermission(per);
/* security check */
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
--- a/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/gcf/protocol/socket/SocketPermissionImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/gcf/protocol/socket/SocketPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -25,6 +25,13 @@
public class SocketPermissionImpl extends PermissionBase
{
+ /**
+ * Constants for identifying the target/uri of connection: client or server
+ */
+ static String CLIENT_TARGET = "socket://*";
+ static String SERVER_TARGET = "socket://";
+
+ private String iTarget;
/**
* Returns the question (as localized text) associated with the security
@@ -36,6 +43,7 @@
public SocketPermissionImpl(String uri)
{
super(uri);
+ iTarget = uri;
}
public String getSecurityPromptQuestion(int aInteractionMode)
@@ -55,14 +63,23 @@
public String toString()
{
- return "javax.microedition.io.SocketProtocolPermission";
+ if (SERVER_TARGET.equals(iTarget))
+ {
+ return "javax.microedition.io.Connector.serversocket";
+ }
+ return "javax.microedition.io.Connector.socket";
}
public boolean implies(Permission p)
{
if (p instanceof SocketPermissionImpl)
{
- return true;
+ SocketPermissionImpl o = (SocketPermissionImpl)p;
+ if ((iTarget != null && iTarget.equals(o.getTarget()))
+ || (iTarget == null && o.getTarget() == null))
+ {
+ return true;
+ }
}
return false;
}
@@ -87,4 +104,8 @@
return null;
}
+ String getTarget()
+ {
+ return iTarget;
+ }
}
\ No newline at end of file
--- a/javacommons/javastorage/javasrc/com/nokia/mj/impl/storage/StorageSessionImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/javastorage/javasrc/com/nokia/mj/impl/storage/StorageSessionImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -297,7 +297,7 @@
*/
private void ensureNonEmpty(Uid aUid) throws StorageException
{
- if (aUid == null || aUid.equals(""))
+ if (aUid == null || aUid.toString().equals(""))
{
Logger.ELOG(Logger.EJavaStorage, "Invalid argument");
throw new StorageException("Invalid argument");
--- a/javacommons/javastorage/tsrc/java_api/javasrc/com/nokia/mj/impl/storage/TestStorageAttribute.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/javastorage/tsrc/java_api/javasrc/com/nokia/mj/impl/storage/TestStorageAttribute.java Mon Aug 23 14:24:31 2010 +0300
@@ -136,10 +136,10 @@
* 2. Test with Name and Value.
* 3. Test Name null throws StorageException
* 4. Test Name "" throws StorageException
- * 5. Test value null. Type is not set SE thrown.
+ * 5. Test value null. It is allowed value.
* 6. Test value "".
* 7. Test one len name and value.
- * 8. Test value null, type STRING throws StorageException.
+ * 8. Test value null, type STRING is allowed.
*/
public void testNameValueConstructor()
{
@@ -195,11 +195,10 @@
String name = "AttrName";
String value = null;
sa = new StorageAttribute(name, value);
- assertTrue("No exp when value Null", false);
}
catch (StorageException se)
{
- // PASSED
+ assertTrue("SE thrown when null value: " + se.toString(), false);
}
catch (Throwable t)
{
@@ -246,11 +245,10 @@
String name = "A";
String value = null;
sa = new StorageAttribute(name, value);
- assertTrue("No exp thrown when null value, string type", false);
}
catch (StorageException se)
{
- // PASSED
+ assertTrue("SE thrown when null value: " + se.toString(), false);
}
catch (Throwable t)
{
--- a/javacommons/security/data/att_untrusted.txt Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/data/att_untrusted.txt Mon Aug 23 14:24:31 2010 +0300
@@ -2,5 +2,4 @@
grant user "Net Access" oneshot,no {
permission javax.microedition.io.HttpProtocolPermission "http://*";
permission javax.microedition.io.HttpsProtocolPermission "https://*";
- permission javax.microedition.io.Connector.rtsp "*";
}
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java Mon Aug 23 14:24:31 2010 +0300
@@ -58,6 +58,9 @@
* different aplications being installed
*/
private Hashtable iBlanketPermissionsDetails = new Hashtable();
+
+ private static final int NOT_FOUND = -2;
+ private static final int REMOVED = -1;
/**
* Creates an instance of the PermissionGranter
@@ -171,23 +174,22 @@
* SecurityAttributes.addManifestAttributes())
*/
public void grantJarPermissions(
- StorageSession storageSession,
Uid msUID,
Uid oldMSUID,
- PermissionAttribute[] requestedPermissions)
+ PermissionAttribute[] requestedPermissions,
+ AuthenticationCredentials[] authCredentials)
{
- if (storageSession == null
- || msUID == null)
+ if (msUID == null)
{
return;
}
- // take the domain from storage
- SecurityStorage storage = new SecurityStorage(storageSession);
- String protectionDomainName = storage.readProtectionDomain(msUID);
// filter the already granted permissions
+ String protectionDomainName = authCredentials[0].getProtectionDomainName();
Object o = iGrantedPermissions.remove(
- msUID.getStringValue() + protectionDomainName);
+ msUID.getStringValue()
+ + protectionDomainName);
+
Vector preGrantedPermissions = null;
if (o != null)
{
@@ -215,10 +217,15 @@
}
}
}
- storage.writeGrantedPermissions(
- msUID,
- oldMSUID,
- resolvedPermissions);
+ // in case of update preserve the settings of the "old" suite
+ if (oldMSUID != null)
+ {
+ updateGrantedPermissions(
+ msUID,
+ oldMSUID,
+ resolvedPermissions);
+ }
+
// update the cache with the full set of permissions
iGrantedPermissions.put(msUID.getStringValue() + protectionDomainName,
resolvedPermissions);
@@ -240,7 +247,6 @@
* the MIDlet suite.
*/
public void grantJarPermissions(
- StorageSession storageSession,
Uid uid,
Uid oldUid,
ProtectionDomain protectionDomain)
@@ -265,15 +271,17 @@
protectionDomain.getName(),
securityAttributes.getPermissionAttributes(),
true /* add the assigned permissions */);
-
- // store the permissions
- SecurityStorage storage = new SecurityStorage(storageSession);
- storage.writeGrantedPermissions(
- uid,
- oldUid,
- resolvedPermissions);
+ // in case of update preserve the settings
+ if (oldUid != null)
+ {
+ updateGrantedPermissions(
+ uid,
+ oldUid,
+ resolvedPermissions);
+ }
+
// update the cache with the full set of permissions
- iGrantedPermissions.put(uid.getStringValue() + protectionDomain,
+ iGrantedPermissions.put(uid.getStringValue() + protectionDomain.getName(),
resolvedPermissions);
Logger.logGrantedPermissions(resolvedPermissions);
}
@@ -315,7 +323,7 @@
String key = (String)e.nextElement();
if (key.startsWith(msUidKey))
{
- grantedPermissions = (Vector)iGrantedPermissions.remove(key);
+ grantedPermissions = (Vector)iGrantedPermissions.get(key);
if (key.endsWith("UnidentifiedThirdParty"))
{
// if the suite is not signed, there is no blanket
@@ -360,7 +368,7 @@
((PolicyBasedPermission)grantedPermissions.elementAt(i));
UserSecuritySettings settings =
permission.getUserSecuritySettings();
- if (permission.getType() != PolicyBasedPermission.USER_TYPE
+ if (permission.getType() != PolicyBasedPermission.USER_TYPE
|| settings == null)
{
// not a user permission -> move on to the next permission
@@ -458,24 +466,24 @@
if (permissions_from_sensitive_combination_list_1
&& permissions_from_sensitive_combination_list_2)
{
- /*String blanketPermissionsDetails = (
+ /*String blanketPermissionsDetails = (
((call_control == true && multimedia == true)
- || (call_control == true && read_user_data == true)
+ || (call_control == true && read_user_data == true)
|| (net_access == true && multimedia == true)
|| (net_access == true && read_user_data == true)
|| (messaging == true && multimedia == true)
- || (messaging == true && read_user_data == true)) ?
- "settings_inst_query_perm_net" :
+ || (messaging == true && read_user_data == true)) ?
+ "settings_inst_query_perm_net" :
"settings_inst_query_perm_sec");*/
- Id blanketPermissionsDetails = (
+ Id blanketPermissionsDetails = (
((call_control == true && multimedia == true)
- || (call_control == true && read_user_data == true)
+ || (call_control == true && read_user_data == true)
|| (net_access == true && multimedia == true)
|| (net_access == true && read_user_data == true)
|| (messaging == true && multimedia == true)
- || (messaging == true && read_user_data == true)) ?
- new Id("settings_inst_query_perm_net", "N/A") :
+ || (messaging == true && read_user_data == true)) ?
+ new Id("settings_inst_query_perm_net", "N/A") :
new Id("settings_inst_query_perm_sec", "N/A"));
iBlanketPermissionsDetails.put(msUidKey,
@@ -532,6 +540,8 @@
storage.writeUserSecuritySettings(msUID,
UserSecuritySettings.BLANKET_INTERACTION_MODE,
true /* blanket prompt shown */);
+ // cleanup the cache as well
+ cleanup(msUID);
}
/**
@@ -544,7 +554,7 @@
iGrantedPermissions.clear();
iBlanketPermissionsDetails.clear();
}
-
+
/**
* Removes all the security data related to a certain MIDlet suite
*
@@ -559,6 +569,25 @@
SecurityStorage storage = new SecurityStorage(storageSession);
storage.removeGrantedPermissions(msUID);
// clear the cache
+ cleanup(msUID);
+ }
+
+ /**
+ * Writes to storage all the security data related to a certain MIDlet suite
+ *
+ * @param sessionID the JavaStorage session to be used when
+ * writing the security data into storage
+ * @param msUID the UID if the MIDlet suite whose security data is
+ * being written
+ */
+ public void addSecurityData(StorageSession storageSession, Uid msUID, Uid oldMsUID)
+ {
+ Logger.log("Write granted permissions to storage");
+ if (storageSession == null || msUID == null)
+ {
+ return;
+ }
+ SecurityStorage storage = new SecurityStorage(storageSession);
String msUidKey = msUID.getStringValue();
for (Enumeration e = iGrantedPermissions.keys() ;
e.hasMoreElements() ;)
@@ -566,11 +595,13 @@
String key = (String)e.nextElement();
if (key.startsWith(msUidKey))
{
- iGrantedPermissions.remove(key);
- break;
+ storage.writeGrantedPermissions(
+ msUID,
+ oldMsUID,
+ (Vector)iGrantedPermissions.remove(key));
+ return;
}
}
- iBlanketPermissionsDetails.remove(msUidKey);
}
private Vector resolvePermissions(Uid msUID,
@@ -599,8 +630,8 @@
for (int i=0; i<policyPermissions.length; i++)
{
if (policyPermissions[i].getType()
- == PolicyBasedPermission.ASSIGNED_TYPE
- || policyPermissions[i].getType()
+ == PolicyBasedPermission.ASSIGNED_TYPE
+ || policyPermissions[i].getType()
== PolicyBasedPermission.USER_ASSIGNED_TYPE)
{
PolicyBasedPermissionImpl p1 = new PolicyBasedPermissionImpl(
@@ -641,4 +672,130 @@
return resolvePermissions(msUID, protectionDomainName,
requestedPermissions, true /* add assigned permissions */);
}
+
+ private void cleanup(Uid msUID)
+ {
+ // clear the cache
+ String msUidKey = msUID.getStringValue();
+ for (Enumeration e = iGrantedPermissions.keys() ;
+ e.hasMoreElements() ;)
+ {
+ String key = (String)e.nextElement();
+ if (key.startsWith(msUidKey))
+ {
+ iGrantedPermissions.remove(key);
+ break;
+ }
+ }
+ iBlanketPermissionsDetails.remove(msUidKey);
+ }
+
+ private void updateGrantedPermissions(Uid newAppUID, Uid oldAppUID, Vector grantedPermissions)
+ {
+ // the vector containing the newGrantedPermissions
+ Vector newGrantedPermissions = new Vector();
+
+ // get the old permissions & settings
+ SecurityStorage storage = new SecurityStorage();
+ Vector oldPermissions = storage.readGrantedPermissions(oldAppUID);
+ storage.close();
+
+ // filter out the the brand new permissions
+ // (permissions which are not found among the old permissions)
+ if (oldPermissions != null)
+ {
+ int index=0;
+ while (index < grantedPermissions.size())
+ {
+ // instead of calling Vector.removeElement(p) we will do the
+ // remove manually, since the search is to be based on
+ // the permission without the settings
+ PolicyBasedPermission p = (PolicyBasedPermission)
+ grantedPermissions.elementAt(index);
+ int status = removeElement(oldPermissions, p);
+ switch (status)
+ {
+ case REMOVED:
+ case NOT_FOUND:
+ index++;
+ break;
+ default:
+ // different settings
+ UserSecuritySettings oldSettings
+ = ((PolicyBasedPermission)oldPermissions
+ .elementAt(status)).getUserSecuritySettings();
+ UserSecuritySettings newSettings
+ = p.getUserSecuritySettings();
+ if (oldSettings != null
+ && newSettings != null)
+ {
+ boolean activeSettings = false;
+ if (oldSettings.isActive()
+ || newSettings.isActive())
+ {
+ activeSettings = true;
+ }
+ newGrantedPermissions.addElement(
+ new PolicyBasedPermissionImpl(
+ p.getName(),
+ p.getTarget(),
+ p.getActionList(),
+ p.getType(),
+ new UserSecuritySettingsImpl(
+ newSettings.getName(),
+ oldSettings.getCurrentInteractionMode(),
+ newSettings.getAllowedInteractionModes(),
+ oldSettings.getBlanketPrompt(),
+ activeSettings)));
+ }
+ else
+ {
+ newGrantedPermissions.addElement(p);
+ }
+ grantedPermissions.removeElementAt(index);
+ break;
+ }
+ }
+ }
+ // write what's left from the granted permissions
+ for (int i=0; i<newGrantedPermissions.size(); i++)
+ {
+ grantedPermissions.addElement(newGrantedPermissions.elementAt(i));
+ }
+ }
+
+ private int removeElement(Vector elements, PolicyBasedPermission element)
+ {
+ PolicyBasedPermissionImpl p1 = new PolicyBasedPermissionImpl(
+ element.getName(),
+ element.getTarget(),
+ element.getActionList(),
+ null);
+ for (int i=0; i<elements.size(); i++)
+ {
+ PolicyBasedPermission tmp = (PolicyBasedPermission)elements
+ .elementAt(i);
+ PolicyBasedPermissionImpl p2 = new PolicyBasedPermissionImpl(
+ tmp.getName(),
+ tmp.getTarget(),
+ tmp.getActionList(),
+ null);
+ if (p1.equals(p2))
+ {
+ UserSecuritySettings s1 = element.getUserSecuritySettings();
+ UserSecuritySettings s2 = tmp.getUserSecuritySettings();
+ if ((s1 == null && s2 == null)
+ || (s1 != null
+ && s2 != null
+ && s1.equals(s2)))
+ {
+ // identical permissions
+ elements.removeElementAt(i);
+ return REMOVED;
+ }
+ return i;
+ }
+ }
+ return NOT_FOUND;
+ }
}
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModule.java Mon Aug 23 14:24:31 2010 +0300
@@ -266,14 +266,14 @@
* (if applicable)
* @param appJARPath the path to the JAR being authenticated
*/
- public void authenticateJar(
- StorageSession storageSession,
+ public AuthenticationCredentials[] authenticateJar(
Uid msUID,
Uid oldMSUID,
String appJARPath,
boolean drmContent)
{
AuthenticationStorageData data = null;
+ Credentials selectedCredentials = null;
try
{
Vector allAuthCredentials = (Vector)iAuthCredentials.get(msUID);
@@ -307,15 +307,15 @@
null /*validatedChainIndexes*/,
null /* jarPath*/,
iSecurityWarningsMode);
+ selectedCredentials = new Credentials(
+ data.getProtectionDomain(),
+ data.getProtectionDomainCategory(),
+ jarHash,
+ null /* root hash */,
+ -1 /* validated chain index*/,
+ null /* signing cert */);
verifyUpdate(
- new Credentials[] {new Credentials(
- data.getProtectionDomain(),
- data.getProtectionDomainCategory(),
- jarHash,
- null /* root hash */,
- -1 /* validated chain index*/,
- null /* signing cert */)
- },
+ new Credentials[] {selectedCredentials},
oldMSUID);
}
else
@@ -328,7 +328,7 @@
String jarHashValue = null;
String rootHashValue = null;
Vector validatedChainIndexes = new Vector();
- Credentials selectedCredentials = selectCredentials(jarHash, allAuthCredentials, validatedChainIndexes);
+ selectedCredentials = selectCredentials(jarHash, allAuthCredentials, validatedChainIndexes);
if (selectedCredentials == null
|| selectedCredentials.getProtectionDomainName() == null)
{
@@ -378,8 +378,6 @@
validatedChainIndexes,
iSecurityWarningsMode);
}
-
- writeAuthenticationStorageData(storageSession, msUID, data, (oldMSUID != null && oldMSUID.equals(msUID)));
}
finally
{
@@ -389,17 +387,18 @@
iSelectedAuthCredentials.put(msUID, data);
}
}
+ return new AuthenticationCredentials[] {selectedCredentials};
}
/**
*/
- public void authenticateJar(
- StorageSession storageSession,
+ public AuthenticationCredentials[] authenticateJar(
Uid uid,
Uid oldUid,
ProtectionDomain protectionDomain,
String appJARPath)
{
+ Credentials selectedCredentials = null;
if (protectionDomain == null
|| (!protectionDomain.equals(ProtectionDomain.getManufacturerDomain())
&& !protectionDomain.equals(ProtectionDomain.getOperatorDomain())
@@ -438,18 +437,20 @@
null /*validatedChainIndexes*/,
null /* jarPath*/,
iSecurityWarningsMode);
+ selectedCredentials = new Credentials(
+ data.getProtectionDomain(),
+ data.getProtectionDomainCategory(),
+ jarHash,
+ null /* root hash */,
+ -1 /* validated chain index*/,
+ null /* signing cert */);
verifyUpdate(
- new Credentials[] {new Credentials(
- data.getProtectionDomain(),
- data.getProtectionDomainCategory(),
- jarHash,
- null /* root hash */,
- -1 /* validated chain index*/,
- null /* signing cert */)
- },
+ new Credentials[] {selectedCredentials},
oldUid);
- writeAuthenticationStorageData(storageSession, uid, data, (oldUid != null && oldUid.equals(uid)));
+ iSelectedAuthCredentials.put(uid, data);
+
+ return new AuthenticationCredentials[] {selectedCredentials};
}
/**
@@ -581,6 +582,24 @@
}
/**
+ * Writes to storage all the security data related to a certain MIDlet suite
+ *
+ * @param sessionID the JavaStorage session to be used when
+ * writing the security data into storage
+ * @param msUID the UID if the MIDlet suite whose security data is
+ * being written
+ */
+ public void addSecurityData(StorageSession storageSession, Uid msUID, Uid oldMsUID)
+ {
+ Logger.log("Write authentication data to storage");
+ AuthenticationStorageData authStorageData =
+ (AuthenticationStorageData)iSelectedAuthCredentials.remove(
+ msUID);
+ writeAuthenticationStorageData(storageSession, msUID, authStorageData,
+ (oldMsUID != null && oldMsUID.equals(msUID)));
+ }
+
+ /**
* Returns the details of the certificates used for authenticating a
* MIDlet suite. This method is used at installation time.
*
@@ -661,31 +680,20 @@
* @param aMediaId the identifier of the media where the MIDlet
* suite is installed
*/
- public void setMediaId(StorageSession aStorageSession, Uid aMsUid, int aMediaId)
+ public void setMediaId(Uid aMsUid, int aMediaId)
{
// store the jar hash only if the suite was installed on a non-protected media
if (isDriveProtected(aMediaId))
{
- SecurityStorage storage = new SecurityStorage(aStorageSession);
- try
+ AuthenticationStorageData authStorageData =
+ (AuthenticationStorageData)iSelectedAuthCredentials.get(
+ aMsUid);
+ if (authStorageData != null)
{
- AuthenticationStorageData authStorageData =
- (AuthenticationStorageData)iSelectedAuthCredentials.get(
- aMsUid);
- if (authStorageData != null)
- {
- Logger.log("Suite installed on protected media -> the runtime tamper detection is disabled");
- authStorageData.setJarHashValue(null);
- storage.writeAuthenticationStorageData(aMsUid,
- authStorageData,
- true /* this is an update */);
- }
+ Logger.log("Suite installed on protected media -> the runtime tamper detection is disabled");
+ authStorageData.setJarHashValue(null);
+ iSelectedAuthCredentials.put(aMsUid, authStorageData);
}
- finally
- {
- iSelectedAuthCredentials.remove(aMsUid);
- }
-
}
}
@@ -833,13 +841,13 @@
&& authStorageData.getJarHashValue().length() > 0)
{
Logger.log(" Doing tamper detection");
- String computedJarHash = null;
+ String computedJarHash = null;
try
{
computedJarHash = _computeHash(authStorageData.getJarPath());
- }catch(AuthenticationException e)
+ }catch(AuthenticationException e)
{
- if (e.getErrorCode()
+ if (e.getErrorCode()
== AuthenticationException.JAR_NOT_FOUND)
{
Logger.logWarning(" Jar not found while trying to compute hash");
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionResolver.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionResolver.java Mon Aug 23 14:24:31 2010 +0300
@@ -203,7 +203,7 @@
// add new settings
newPermissionInstancesAndSettings.addElement(
new PermisionInstanceAndSettings(
- p.getPermissionInstance(),
+ p.getPermissionInstance(),
p.getType(),
newSettings));
}
@@ -678,11 +678,15 @@
// permission and the policy permission
String target = legacyPermission.getTarget();
if (target != null
- && target.indexOf("*") == -1
- && !target.equals(policyPermissions[i].getTarget()))
+ && !("*".equals(policyPermissions[i].getTarget()))
+ && !target.equals(policyPermissions[i].getTarget()))
{
continue;
}
+ if (target == null)
+ {
+ target = policyPermissions[i].getTarget();
+ }
// choose the action
String actionList = legacyPermission.getActionList();
if (actionList == null)
@@ -690,7 +694,7 @@
resolvedPermissions.addElement(
new PolicyBasedPermissionImpl(
policyPermissions[i].getName(),
- policyPermissions[i].getTarget(),
+ target,
policyPermissions[i].getActionList(),
policyPermissions[i].getUserSecuritySettings()));
}
@@ -702,7 +706,7 @@
resolvedPermissions.addElement(
new PolicyBasedPermissionImpl(
policyPermissions[i].getName(),
- policyPermissions[i].getTarget(),
+ target,
actionList,
policyPermissions[i].getUserSecuritySettings()));
}
@@ -735,7 +739,7 @@
{
return settings;
}
-
+
public int getType()
{
return type;
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/PermissionMappingTable.java Mon Aug 23 14:24:31 2010 +0300
@@ -58,7 +58,7 @@
"com.nokia.mj.impl.gcf.protocol.datagram.DatagramPermissionImpl", "datagram://"));
PERMISSION_MAPPING_TABLE.put(
"javax.microedition.io.Connector.comm", new MIDPPermission(
- "com.nokia.mj.impl.gcf.protocol.comm.CommPermissionImpl", "comm://*"));
+ "com.nokia.mj.impl.gcf.protocol.comm.CommPermissionImpl", "comm:*"));
PERMISSION_MAPPING_TABLE.put(
"javax.microedition.io.PushRegistry", new MIDPPermission(
"com.nokia.mj.impl.gcf.PushRegistryPermissionImpl", "*"));
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java Mon Aug 23 14:24:31 2010 +0300
@@ -102,9 +102,6 @@
public static final int AUTHENTICATION_JAR_HASH_QUERY = 8;
public static final int AUTHENTICATION_VALID_CERTS_QUERY = 16;
- private static final int NOT_FOUND = -2;
- private static final int REMOVED = -1;
-
/**
* Constructor
*/
@@ -435,10 +432,11 @@
{
if (oldAppUID != null)
{
- updateGrantedPermissions(
- appUID,
- oldAppUID,
- grantedPermissions);
+ // remove granted permissions
+ removeGrantedPermissions(appUID);
+
+ // write granted permissions
+ writeGrantedPermissions(appUID, null, grantedPermissions);
return;
}
// put all the function group names into a vector and use it
@@ -1246,146 +1244,6 @@
{/* move on with defaults */}
}
-
- private void updateGrantedPermissions(Uid newAppUID, Uid oldAppUID, Vector grantedPermissions)
- {
- // the vector containing the newGrantedPermissions
- Vector newGrantedPermissions = new Vector();
-
- // get the old permissions & settings
- Vector oldPermissions = readGrantedPermissions(oldAppUID);
-
- // filter out the the brand new permissions
- // (permissions which are not found among the old permissions)
- if (oldPermissions != null)
- {
- int index=0;
- while (index < grantedPermissions.size())
- {
- // instead of calling Vector.removeElement(p) we will do the
- // remove manually, since the search is to be based on
- // the permission without the settings
- PolicyBasedPermission p = (PolicyBasedPermission)
- grantedPermissions.elementAt(index);
- int status = removeElement(oldPermissions, p);
- switch (status)
- {
- case NOT_FOUND:
- index++;
- break;
- case REMOVED:
- grantedPermissions.removeElementAt(index);
- break;
- default:
- // different settings
- UserSecuritySettings oldSettings
- = ((PolicyBasedPermission)oldPermissions
- .elementAt(status)).getUserSecuritySettings();
- UserSecuritySettings newSettings
- = p.getUserSecuritySettings();
- if (oldSettings != null
- && newSettings != null)
- {
- boolean activeSettings = false;
- if (oldSettings.isActive()
- || newSettings.isActive())
- {
- activeSettings = true;
- }
- newGrantedPermissions.addElement(
- new PolicyBasedPermissionImpl(
- p.getName(),
- p.getTarget(),
- p.getActionList(),
- p.getType(),
- new UserSecuritySettingsImpl(
- newSettings.getName(),
- oldSettings.getCurrentInteractionMode(),
- newSettings.getAllowedInteractionModes(),
- oldSettings.getBlanketPrompt(),
- activeSettings)));
- }
- else
- {
- newGrantedPermissions.addElement(p);
- }
- grantedPermissions.removeElementAt(index);
- break;
- }
- }
- }
- // write what's left from the granted permissions
- writeGrantedPermissions(newAppUID, null, grantedPermissions, true /* preserveSettings */);
- for (int i=0; i<newGrantedPermissions.size(); i++)
- {
- grantedPermissions.addElement(newGrantedPermissions.elementAt(i));
- }
-
- // remove what's left from the old permissions
- if (oldPermissions != null)
- {
- for (int i=0; i<oldPermissions.size(); i++)
- {
- PolicyBasedPermission p = (PolicyBasedPermission)
- oldPermissions.elementAt(i);
- StorageEntry removePermissionQuery = new StorageEntry();
- removePermissionQuery.addAttribute(new StorageAttribute(
- StorageAttribute.ID,
- oldAppUID.getStringValue()));
- removePermissionQuery.addAttribute(new StorageAttribute(
- StorageNames.CLASS,
- p.getName()));
- if (p.getTarget() != null
- && p.getTarget().length() > 0)
- {
- removePermissionQuery.addAttribute(new StorageAttribute(
- StorageNames.NAME,
- p.getTarget()));
- }
- if (p.getActionList() != null
- && p.getActionList().length() > 0)
- {
- removePermissionQuery.addAttribute(new StorageAttribute(
- StorageNames.ACTION,
- p.getActionList()));
- }
- doStorageRemove(StorageNames.MIDP_PERMISSIONS_TABLE,
- removePermissionQuery);
- // remove the setting also if not used by some other permission
- UserSecuritySettings settings =
- p.getUserSecuritySettings();
- if (settings != null)
- {
- StorageEntry permissionsQuery = new StorageEntry();
- permissionsQuery.addAttribute(new StorageAttribute(
- StorageAttribute.ID,
- newAppUID.getStringValue()));
- permissionsQuery.addAttribute(new StorageAttribute(
- StorageNames.FUNCTION_GROUP,
- settings.getName()));
- StorageEntry[] permissions = doStorageSearch(
- StorageNames.MIDP_PERMISSIONS_TABLE, permissionsQuery);
- if (permissions == null || (permissions != null
- && permissions.length == 0))
- {
- // remove the orphaned settings from settings table
- StorageEntry removeSettingsQuery = new StorageEntry();
- removeSettingsQuery.addAttribute(new StorageAttribute(
- StorageAttribute.ID,
- newAppUID.getStringValue()));
- removeSettingsQuery.addAttribute(new StorageAttribute(
- StorageNames.FUNCTION_GROUP,
- settings.getName()));
- doStorageRemove(StorageNames.MIDP_FUNC_GRP_SETTINGS_TABLE,
- removeSettingsQuery);
- }
- }
- }
- }
- // write the new permissions
- writeGrantedPermissions(newAppUID, null, newGrantedPermissions, true /* preserveSettings */);
- }
-
private AuthenticationStorageData readAuthenticationStorageData(
Uid appUID, String aAppName, String aAppVersion,
String aAppVendor, int readFilter)
@@ -1838,41 +1696,6 @@
}
return attrValue;
}
-
- private int removeElement(Vector elements, PolicyBasedPermission element)
- {
- PolicyBasedPermissionImpl p1 = new PolicyBasedPermissionImpl(
- element.getName(),
- element.getTarget(),
- element.getActionList(),
- null);
- for (int i=0; i<elements.size(); i++)
- {
- PolicyBasedPermission tmp = (PolicyBasedPermission)elements
- .elementAt(i);
- PolicyBasedPermissionImpl p2 = new PolicyBasedPermissionImpl(
- tmp.getName(),
- tmp.getTarget(),
- tmp.getActionList(),
- null);
- if (p1.equals(p2))
- {
- UserSecuritySettings s1 = element.getUserSecuritySettings();
- UserSecuritySettings s2 = tmp.getUserSecuritySettings();
- if ((s1 == null && s2 == null)
- || (s1 != null
- && s2 != null
- && s1.equals(s2)))
- {
- // identical permissions
- elements.removeElementAt(i);
- return REMOVED;
- }
- return i;
- }
- }
- return NOT_FOUND;
- }
private String encodeFunctionGroup(int type, String name)
{
--- a/javacommons/security/javaunicertstoreplugin/build/bld.inf Thu Aug 05 16:07:57 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-PRJ_PLATFORMS
-default
-
-PRJ_MMPFILES
-javaunicertstoreplugin.mmp
-
-#ifdef RD_JAVA_UI_QT
-#include "exports.inf"
-#endif
--- a/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.mmp Thu Aug 05 16:07:57 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <bldvariant.hrh>
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-#include <../../../../inc/project_defines.hrh>
-#include <../../../../inc/java_stdcpp_support_for_dll.hrh>
-
-target javaunicertstoreplugin.dll
-
-targettype PLUGIN
-
-uid 0x10009D8D 0x200213A3
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-// Use bytepair compression to enable code paging
-PAGED
-
-userinclude ../../../../inc
-
-sourcepath ../src.s60
-
-source javacertstoreimpl.cpp
-source javacertstoretoken.cpp
-source javacertstoretokentype.cpp
-source main.cpp
-
-start resource 200213A3.rss
-target javaunicertstoreplugin.rsc
-end
-
-START RESOURCE ../data/javausermessages.rss
-HEADER
-TARGETPATH /resource/java
-LANGUAGE_IDS
-END
-
-library ctframework.lib
-library efsrv.lib
-library estor.lib
-library x509.lib
-library javacomms.lib
-LIBRARY CommonEngine.lib
-LIBRARY aknnotify.lib
-
-#if defined(WINSCW)
-deffile ./bwins/javaunicertstoreplugin.def
-#else
-deffile ./eabi/javaunicertstoreplugin.def
-#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/javaunicertstoreplugin/build/javaunicertstoreplugin.pro Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../../../../inc/build_defines.pri)
+
+TEMPLATE=lib
+TARGET=javaunicertstoreplugin
+CONFIG += omj stl
+CONFIG -= qt
+
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+ CONFIG += qt hb
+ SOURCES += ../src.s60/confirmquery.cpp
+ HEADERS += ../src.s60/confirmquery.h
+}
+symbian {
+ TARGET.UID2 = 0x10009D8D
+ TARGET.UID3 = 0x200213A3
+ TARGET.TARGETTYPE=PLUGIN
+ TARGET.CAPABILITY = CAP_ECOM_PLUGIN
+ MMP_RULES += "START RESOURCE 200213A3.rss"
+ MMP_RULES += "TARGETPATH /resource/plugins"
+ MMP_RULES += "TARGET javaunicertstoreplugin.rsc"
+ MMP_RULES += "END"
+ MMP_RULES += "START RESOURCE ../data/javausermessages.rss"
+ MMP_RULES += "HEADER"
+ MMP_RULES += "TARGETPATH /resource/java"
+ MMP_RULES += "LANGUAGE_IDS"
+ MMP_RULES += "END"
+ DEPENDPATH += ../src.s60
+ INCLUDEPATH += ../src.s60 ../../../../inc
+ SOURCES += ../src.s60/javacertstoreimpl.cpp \
+ ../src.s60/javacertstoretoken.cpp \
+ ../src.s60/javacertstoretokentype.cpp \
+ ../src.s60/main.cpp
+ LIBS += -lctframework \
+ -lefsrv \
+ -lestor \
+ -lx509 \
+ -ljavacomms \
+ -lCommonEngine
+ !contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+ LIBS += -laknnotify
+ }
+}
+
+include(../../../../build/omj.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/confirmquery.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "confirmquery.h"
+#include <hbmessagebox.h>
+#include <hblabel.h>
+
+using namespace java::security;
+
+ConfirmQuery::ConfirmQuery()
+ : mAsyncToSyncCallEventLoop(0), mQueryAccepted(false)
+{
+ mAsyncToSyncCallEventLoop = new QEventLoop();
+}
+
+bool ConfirmQuery::accept(const QString& aQuery)
+{
+ HbMessageBox confirmQuery(HbMessageBox::MessageTypeQuestion);
+ confirmQuery.setDismissPolicy(HbDialog::NoDismiss);
+ confirmQuery.setTimeout(HbDialog::NoTimeout);
+ confirmQuery.setIconVisible(false);
+ confirmQuery.setText(aQuery);
+ confirmQuery.setAttribute(Qt::WA_DeleteOnClose);
+ confirmQuery.setStandardButtons(HbMessageBox::Yes | HbMessageBox::No);
+ confirmQuery.open(this,SLOT(queryDismissed(int)));
+ mAsyncToSyncCallEventLoop->exec();
+ return mQueryAccepted;
+}
+
+void ConfirmQuery::queryDismissed(int dismissAction)
+{
+ if (dismissAction == HbMessageBox::Yes) {
+ mQueryAccepted = true;
+ }
+ mAsyncToSyncCallEventLoop->exit();
+}
+
+ConfirmQuery::~ConfirmQuery()
+{
+ delete mAsyncToSyncCallEventLoop;
+}
+
+#include "moc_confirmquery.cpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/confirmquery.h Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef CONFIRMQUERY_H
+#define CONFIRMQUERY_H
+
+#include <QEventLoop>
+
+namespace java
+{
+namespace security
+{
+
+class ConfirmQuery: public QObject
+{
+ Q_OBJECT
+
+public:
+ ConfirmQuery();
+ bool accept(const QString& aQuery);
+ virtual ~ConfirmQuery();
+
+private slots:
+ void queryDismissed(int dismissAction);
+
+private:
+ // own event loop used for "translating" asynchronous calls into
+ // synchronous calls
+ QEventLoop* mAsyncToSyncCallEventLoop;
+ // boolean for carying the user's input in between two async calls
+ bool mQueryAccepted;
+};
+
+} // end namespace security
+} // end namespace java
+
+#endif //CONFIRMQUERY_H
--- a/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -20,8 +20,6 @@
#include <javausermessages.rsg>
-#include <avkon.rsg>
-#include <AknGlobalConfirmationQuery.h>
#include <stringresourcereader.h>
#include <StringLoader.h>
#include <data_caging_path_literals.hrh>
@@ -43,6 +41,12 @@
#include "s60commonutils.h"
#include "securitycommsmessagedefs.h"
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include "confirmquery.h"
+#else
+#include <avkon.rsg>
+#include <AknGlobalConfirmationQuery.h>
+#endif
//_LIT(KMIDP2TrustRoot, "J2ME MIDP2 Trust Root");
@@ -60,8 +64,11 @@
*
*/
CJavaCertStoreImpl::CJavaCertStoreImpl(CJavaCertStoreToken& aToken)
- : CActive(EPriorityNormal),mToken(aToken),mClientStatus(NULL),mState(EInitial),mQuery(0),mTempCertData(0)
+ : CActive(EPriorityNormal),mToken(aToken),mClientStatus(NULL),mState(EInitial),mTempCertData(0)
{
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ mQuery.reset(0);
+#endif
}
/**
@@ -877,7 +884,9 @@
SetActive();
return;
}
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
delete mQuery.release();
+#endif
mState = EInitial;
TRequestStatus* pRequestStatus = &aRequestStatus;
User::RequestComplete(pRequestStatus,KErrCancel);
@@ -894,8 +903,24 @@
std::auto_ptr<CStringResourceReader> reader(CStringResourceReader::NewL(resourceFileName));
std::auto_ptr<HBufC> queryPrompt(reader->ReadResourceString(resourceId).AllocL());
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
mQuery.reset(CAknGlobalConfirmationQuery::NewL());
mQuery->ShowConfirmationQueryL(iStatus,queryPrompt->Des(),R_AVKON_SOFTKEYS_OK_CANCEL);
+#else
+ int completeStatus = KErrCancel;
+ ConfirmQuery* query = new ConfirmQuery();
+ QString queryText = QString::fromStdWString(
+ std::wstring((wchar_t*) queryPrompt->Ptr(),
+ queryPrompt->Length()));
+ if (query->accept(queryText))
+ {
+ completeStatus = KErrNone;
+ }
+ delete query; query = NULL;
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status, completeStatus);
+#endif
+
}
/**
@@ -905,9 +930,15 @@
{
mState = EInitial;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
delete mQuery.release();
+#endif
mState = EInitial;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
if (EAknSoftkeyOk != aStatus)
+#else
+ if (KErrNone != aStatus)
+#endif
{
User::RequestComplete(mClientStatus,KErrCancel);
return;
@@ -922,9 +953,15 @@
{
mState = EInitial;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
delete mQuery.release();
+#endif
mState = EInitial;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
if (EAknSoftkeyOk != aStatus)
+#else
+ if (KErrNone != aStatus)
+#endif
{
User::RequestComplete(mClientStatus,KErrCancel);
return;
--- a/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.h Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.h Mon Aug 23 14:24:31 2010 +0300
@@ -24,7 +24,9 @@
#include "commsclientendpoint.h"
#include "commsmessage.h"
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
class CAknGlobalConfirmationQuery;
+#endif
namespace java
{
@@ -142,7 +144,9 @@
RPointerArray<CJavaCertData> mCertsData;
TState mState;
RThread mUiThread;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
std::auto_ptr<CAknGlobalConfirmationQuery> mQuery;
+#endif
//This class does not have ownership into this object.
CJavaCertData* mTempCertData;
--- a/javacommons/security/security.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/security.pro Mon Aug 23 14:24:31 2010 +0300
@@ -15,5 +15,5 @@
#
TEMPLATE = subdirs
SUBDIRS += build/javasecurity.pro
-BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javaunicertstoreplugin/build/bld.inf\""
+SUBDIRS += javaunicertstoreplugin/build/javaunicertstoreplugin.pro
BLD_INF_RULES.prj_extensions += "prj_extensions"
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -480,7 +480,23 @@
{
if (JavaCommonUtils::isFirstBoot())
{
- ret_code = KCertAndSignatureOk;
+ // from the underlaying/openssl services point of view this
+ // is a failure. In order to behave like everything is ok,
+ // compute the root hash now so there is no need later to
+ // contact the underlaying/openssl services
+ // -> treat the last certificate from the chain as the user
+ // certificate
+ X509 *user_cert = NULL;
+ if (no_certs > 0)
+ {
+ user_cert = SecurityUtils::readCert(cert_chain[no_certs-1], strlen(cert_chain[no_certs-1]), PEM);
+ }
+ if (user_cert != NULL)
+ {
+ sprintf(root_hash,"%08lX",X509_issuer_name_hash(user_cert));
+ X509_free(user_cert);
+ ret_code = KCertAndSignatureOk;
+ }
}
}
@@ -519,7 +535,10 @@
}
// compute the root hash value if requested
- sprintf(root_hash,"%08lX",X509_issuer_name_hash(x509_ctx->current_issuer));
+ if (x509_ctx->current_issuer != NULL)
+ {
+ sprintf(root_hash,"%08lX",X509_issuer_name_hash(x509_ctx->current_issuer));
+ }
// add the '\0'
root_hash[MD5_DIGEST_LEN] = '\0';
--- a/javacommons/security/src/utils/storagehandler.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/src/utils/storagehandler.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -163,7 +163,7 @@
{
aCerts.push_back(JavaCommonUtils::wstringToInt(aValue));
}
- catch (ExceptionBase eb)
+ catch (ExceptionBase& eb)
{
WLOG1WSTR(EJavaStorage,
"Invalid cert index skipped: %s", aValue);
--- a/javacommons/security/subsystem.mk Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/subsystem.mk Mon Aug 23 14:24:31 2010 +0300
@@ -17,16 +17,14 @@
include $(JAVA_SRC_ROOT)/build/Makefile.defs
COMPONENTS = \
- build
+ build \
+ javaunicertstoreplugin/build
ifdef RD_JAVA_S60_RELEASE_5_0_IAD
SUBSYSTEMS = \
legacysupport
endif
-NONQTSUBSYSTEMS = \
- javaunicertstoreplugin/build
-
SYMBIAN_ONLY = \
javaunicertstoreplugin/build
ifdef RD_JAVA_S60_RELEASE_5_0_IAD
--- a/javacommons/security/tsrc/data/ext1/ext1.odc Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/data/ext1/ext1.odc Mon Aug 23 14:24:31 2010 +0300
@@ -1,5 +1,5 @@
[properties]
-Dcom.nokia.mj.addon.protected.ext1=com.nokia.mj.impl.,com.nokia.ext1.internal.,java.security.
-Dcom.nokia.mj.addon.restricted.ext1=com.nokia.ext1.public.,com.nokia.mj.impl.
--Dcom.nokia.mj.addon.permissions.ext1=com.nokia.ext1.public.Ext1Perm,com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl;javax.microedition.io.Connector.socket,com.nokia.ext1.internal.Ext1Perm;com.nokia.ext1.public.Ext1Perm,com.nokia.ext1.internal.Ext1Perm,*;
+-Dcom.nokia.mj.addon.permissions.ext1=com.nokia.ext1.public.Ext1Perm,com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl;javax.microedition.io.Connector.socket,com.nokia.ext1.internal.Ext1Perm;com.nokia.ext1.public.Ext1Perm,com.nokia.ext1.internal.Ext1Perm;
-Dcom.nokia.mj.addon.policies.ext1=c:\resource\java\security\extensions\ext1\policies\untrusted.ser;c:\resource\java\security\extensions\ext1\policies\trustedthirdparty.ser;
\ No newline at end of file
--- a/javacommons/security/tsrc/data/ext2/ext2.odc Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/data/ext2/ext2.odc Mon Aug 23 14:24:31 2010 +0300
@@ -1,5 +1,5 @@
[properties]
-Dcom.nokia.mj.addon.protected.ext2=com.nokia.ext2.internal.,com.nokia.ext1.public
-Dcom.nokia.mj.addon.restricted.ext2=com.nokia.ext2.public.,com.nokia.ext1.internal
--Dcom.nokia.mj.addon.permissions.ext2=com.nokia.ext2.public.Ext2Perm,com.nokia.ext1.internal.Ext1Perm;com.nokia.ext1.public.Ext1Perm,com.nokia.ext2.internal.Ext2Perm;com.nokia.ext2.public.Ext2Perm,com.nokia.ext2.internal.Ext2Perm,*
+-Dcom.nokia.mj.addon.permissions.ext2=com.nokia.ext2.public.Ext2Perm,com.nokia.ext1.internal.Ext1Perm;com.nokia.ext1.public.Ext1Perm,com.nokia.ext2.internal.Ext2Perm;com.nokia.ext2.public.Ext2Perm,com.nokia.ext2.internal.Ext2Perm
-Dcom.nokia.mj.addon.policies.ext2=c:\resource\java\security\extensions\ext2\policies\trustedthirdparty.ser
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -196,9 +196,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertWithTrace(signingCerts != null
&& signingCerts.length == 1
@@ -241,9 +243,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertWithTrace(signingCerts != null
&& signingCerts.length == 1
@@ -285,9 +289,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("", "MIICWDCCAcECBEhQwA0wDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBpcmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmExHzAdBgNVBAMMFkpQX0RldmljZV9NYW51ZmFjdHVyZXIwHhcNMDgwNjEyMDYxOTU3WhcNMTgwNjEwMDYxOTU3WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1wZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfRGV2aWNlX01hbnVmYWN0dXJlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApi3ipIPj8O33/rZre1euh7Itd9d6ZVf2mvQ/tLpHEsFJe5XLOsVViMvFskhhKUzmDsRbP4J03L6827/vEDIi/1i8kJGLaoFqJYaLGFWI2Zmxlj6aJV8cfZyOjmQPWJn1IDEe1ZAWbvMSp8xibWRsCLNEGKIkxQvAr/QDK/6iS+kCAwEAATANBgkqhkiG9w0BAQQFAAOBgQCDXt6klAs6yKvdTab3D2wkdoi3Lu4YFsMgLexJOu5HhAUJ/9VYO+Q2+mjd95MRsTa5rWQ2Jjvhn57Z3z/KBOwfHbymmNtMk6Gl14H0vQRoHa31jh3mTuAy5KotDVthaDp30aOizk473NU68wY1WdP4gFk5ZhrpNea9q3st13BxIQ=="));
@@ -301,9 +307,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID2,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID2, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID2,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID2, null);
+ permissionGranter.grantJarPermissions( appUID2, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID2, null);
// 2 legacy unsigned MIDlets, install from JAD -> checkPermission succeeds
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session,appUID);
@@ -317,9 +325,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertWithTrace(signingCerts == null);
ac.checkPermission(new java.util.PropertyPermission("microedition.version", "read"));
@@ -331,9 +341,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes = new SecurityAttributes();
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertWithTrace(signingCerts == null);
ac.checkPermission(new java.util.PropertyPermission("microedition.version", "read"));
@@ -356,7 +368,8 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
storage.removeAuthenticationStorageData(appUID2);
permissionGranter.removeSecurityData(session,appUID2);
PermissionResolver.testClearCache();
@@ -388,9 +401,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
storage.removeAuthenticationStorageData(appUID2);
permissionGranter.removeSecurityData(session,appUID2);
PermissionResolver.testClearCache();
@@ -426,9 +441,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
storage.removeAuthenticationStorageData(appUID2);
permissionGranter.removeSecurityData(session,appUID2);
PermissionResolver.testClearCache();
@@ -454,9 +471,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
storage.removeAuthenticationStorageData(appUID2);
permissionGranter.removeSecurityData(session,appUID2);
PermissionResolver.testClearCache();
@@ -475,9 +494,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID2, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID2, appUID);
+ permissionGranter.grantJarPermissions( appUID2, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID2, null);
// update from manufacturer to operator succeeds for legacy suites
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session,appUID);
@@ -495,7 +516,8 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
storage.removeAuthenticationStorageData(appUID2);
permissionGranter.removeSecurityData(session,appUID2);
PermissionResolver.testClearCache();
@@ -525,9 +547,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
appPackageEntry = new StorageEntry();
appPackageEntry.addAttribute(new StorageAttribute(
StorageAttribute.ID,
@@ -556,9 +580,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID2, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID2, appUID);
+ permissionGranter.grantJarPermissions( appUID2, appUID, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID2, appUID);
// update from identified third party to identified third party but with different organization for signing certificate fails for MIDP3 MIDlets
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session,appUID);
@@ -573,7 +599,8 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
appPackageEntry = new StorageEntry();
appPackageEntry.addAttribute(new StorageAttribute(
StorageAttribute.ID,
@@ -623,9 +650,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
appPackageEntry = new StorageEntry();
appPackageEntry.addAttribute(new StorageAttribute(
StorageAttribute.ID,
@@ -654,9 +683,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID2, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID2,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID2, appUID);
+ permissionGranter.grantJarPermissions( appUID2, appUID, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID2, appUID);
// update from identified third party to identified third party succeeds (V1 requests P1 (Net), P2 (Messaging), P3 (Messaging), V2 requests P2 (Messaging), P4 (UserData), P5 (Net)) -> check that P1 is removed, P2 is retained (with old settings), P3 is removed, P4 and P5 are added with brand new settings
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session,appUID);
@@ -674,10 +705,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.wireless.messaging.sms.send,javax.wireless.messaging.mms.send"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
- permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
appPackageEntry = new StorageEntry();
appPackageEntry.addAttribute(new StorageAttribute(
StorageAttribute.ID,
@@ -706,9 +738,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.wireless.messaging.sms.send,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
grantedPermissions = storage.readGrantedPermissions(appUID);
MIDPPermission p1 = PermissionMappingTable.get("javax.wireless.messaging.sms.send");
MIDPPermission p2 = PermissionMappingTable.get("javax.microedition.io.Connector.file.read");
@@ -724,7 +758,7 @@
UserSecuritySettings.NO_INTERACTION_MODE,
UserSecuritySettings.ONESHOT_INTERACTION_MODE,
UserSecuritySettings.SESSION_INTERACTION_MODE})),
- new PolicyBasedPermissionImpl(p2.getName(), "*", p2.getActionList(),
+ new PolicyBasedPermissionImpl(p2.getName(), p2.getTarget(), p2.getActionList(),
new UserSecuritySettingsImpl("Read User Data Access",
UserSecuritySettings.SESSION_INTERACTION_MODE,
new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,
@@ -780,9 +814,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.wireless.messaging.sms.send,javax.wireless.messaging.mms.send"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
assertWithTrace(checkStringArrays(blanketPermissions,
new String[] {UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.NET_ACCESS_SETTINGS),
UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.MESSAGING_SETTINGS)
@@ -814,9 +850,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.wireless.messaging.sms.send,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
assertWithTrace(checkStringArrays(blanketPermissions,
new String[] {UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.NET_ACCESS_SETTINGS),
UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.MESSAGING_SETTINGS),
@@ -839,9 +877,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.wireless.messaging.sms.send,javax.wireless.messaging.mms.send"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
assertWithTrace(checkStringArrays(blanketPermissions,
new String[] {UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.NET_ACCESS_SETTINGS),
UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.MESSAGING_SETTINGS)
@@ -872,9 +912,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.wireless.messaging.sms.send,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
assertWithTrace(checkStringArrays(blanketPermissions,
new String[] {UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.NET_ACCESS_SETTINGS),
UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.READ_USER_DATA_ACCESS_SETTINGS)
@@ -894,9 +936,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.wireless.messaging.sms.send,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
assertWithTrace(blanketPermissions == null);
// change some settings to e.g. Session and reinstall the same suite with same permissions -> check that only the settings which are not Blanket (due to being changed) are returned
storage.writeUserSecuritySettings(appUID, "Messaging", UserSecuritySettings.SESSION_INTERACTION_MODE);
@@ -913,9 +957,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.wireless.messaging.sms.send,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
assertWithTrace(checkStringArrays(blanketPermissions,
new String[] {UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.MESSAGING_SETTINGS)}));
// upgrade tests for legacy suites
@@ -948,9 +994,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.http,javax.wireless.messaging.sms.send"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
permissionGranter.getBlanketPermissions(appUID);
assertTrue(permissionGranter.getBlanketPermissionsDetails(appUID) == null);
+ permissionGranter.addSecurityData(session, appUID, null);
// getBlanketPermissionsDetails for Multimedia Read User Data -> no details
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -971,8 +1018,9 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.media.control.RecordControl,javax.microedition.io.Connector.file.read"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
assertTrue(permissionGranter.getBlanketPermissionsDetails(appUID) == null);
// getBlanketPermissionsDetails for Multimedia, Local Connectivity -> privacy details
permissionGranter.removeSecurityData(session, appUID);
@@ -994,10 +1042,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.media.control.RecordControl,javax.microedition.io.Connector.bluetooth.client"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
String blanketDetails = permissionGranter.getBlanketPermissionsDetails(appUID);
- assertTrue("qtn_java_settings_inst_query_perm_sec".equals(blanketDetails)
+ assertTrue("qtn_java_settings_inst_query_perm_sec".equals(blanketDetails)
|| "Allowing these permissions may result in compromised privacy".equals(
blanketDetails));
// getBlanketPermissionsDetails for Messaging, Multimedia -> net details
@@ -1020,10 +1069,11 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.media.control.RecordControl,javax.wireless.messaging.sms.send"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
blanketDetails = permissionGranter.getBlanketPermissionsDetails(appUID);
- assertTrue("qtn_java_settings_inst_query_perm_net".equals(blanketDetails)
+ assertTrue("qtn_java_settings_inst_query_perm_net".equals(blanketDetails)
|| "Allowing these permissions may result in compromised privacy or increased network usage costs".equals(
blanketDetails));
}
@@ -1058,6 +1108,7 @@
private void upgradeDomain(ProtectionDomain domain1, ProtectionDomain domain2, boolean expectToFail, boolean legacySuite)
{
+ AuthenticationCredentials[] credentials;
boolean success1 = false;
boolean success2 = false;
storage.removeAuthenticationStorageData(appUID);
@@ -1081,9 +1132,11 @@
StorageNames.VALUE,
(legacySuite ? "MIDP-2.0" : "MIDP-3.0")));
session.write(StorageNames.APPLICATION_PACKAGE_ATTRIBUTES_TABLE, appPackageEntry);
- authenticationModule.authenticateJar(session, appUID, null, domain1, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar");
- permissionGranter.grantJarPermissions(session, appUID, null, domain1);
+ credentials = authenticationModule.authenticateJar(appUID, null, domain1, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar");
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions(appUID, null, domain1);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
success1 = (blanketPermissions == null && signingCerts == null);
ac.checkPermission(new java.util.PropertyPermission("microedition.version", "read"));
@@ -1093,7 +1146,8 @@
assertWithTrace(domainCategory.equals(domain1.getCategory()));
try
{
- authenticationModule.authenticateJar(session, appUID, appUID, domain2, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar");
+ credentials = authenticationModule.authenticateJar(appUID, appUID, domain2, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar");
+ authenticationModule.addSecurityData(session, appUID, appUID);
assertWithTrace(!expectToFail);
}
catch (InstallerSecurityException e)
@@ -1104,8 +1158,9 @@
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.DIFFERENT_SIGNERS, null)));
return;
}
- permissionGranter.grantJarPermissions(session, appUID,appUID, domain2);
+ permissionGranter.grantJarPermissions(appUID,appUID, domain2);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
+ permissionGranter.addSecurityData(session, appUID, appUID);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
success2 = (blanketPermissions == null && signingCerts == null);
assertWithTrace(success1 == true && success2 == true);
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModuleTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModuleTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -179,7 +179,8 @@
authenticationModule.removeSecurityData(session, appUID);
try
{
- authenticationModule.authenticateJar(session, appUID,null,"somethingWhichDoesNotExist", false);
+ authenticationModule.authenticateJar(appUID,null,"somethingWhichDoesNotExist", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(false);
}
catch (InstallerSecurityException e)
@@ -193,13 +194,15 @@
authenticationModule.removeSecurityData(session, appUID);
// 3. unsigned, install from JAR
authenticationModule.removeSecurityData(session, appUID);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(authenticationModule.getProtectionDomainCategory(session, appUID).equals(ApplicationInfo.UNIDENTIFIED_THIRD_PARTY_DOMAIN)
&& authenticationModule.getCertificatesDetails(session, appUID) == null);
authenticationModule.removeSecurityData(session, appUID);
- // 3.1. unsigned, install from JAR, no session provided to authenticateJar -> no authentication data stored to storage
+ // 3.1. unsigned, install from JAR, no session provided to addSecurityData -> no authentication data stored to storage
authenticationModule.removeSecurityData(session, appUID);
- authenticationModule.authenticateJar(null, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(null, appUID, null);
StorageEntry query = new StorageEntry();
query.addAttribute(new StorageAttribute(
StorageAttribute.ID,
@@ -231,13 +234,15 @@
credentials = authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
assertTrue(credentials != null && credentials.length == 1 && credentials[0].getProtectionDomainName().equals("UnidentifiedThirdParty")
&& authenticationModule.getCertificatesDetails(session, appUID) == null);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(authenticationModule.getProtectionDomainCategory(session, appUID).equals(ApplicationInfo.UNIDENTIFIED_THIRD_PARTY_DOMAIN));
authenticationModule.removeSecurityData(session, appUID);
// 5. upgrade of authentication storage data
authenticationModule.removeSecurityData(session, appUID);
storage.writeAuthenticationStorageData(appUID, new AuthenticationStorageData("UnidentifiedThirdParty", ApplicationInfo.UNIDENTIFIED_THIRD_PARTY_DOMAIN, "jarHash", "rootHash", new Vector()));
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
assertTrue(authenticationModule.getProtectionDomainCategory(session, appUID).equals(ApplicationInfo.UNIDENTIFIED_THIRD_PARTY_DOMAIN)
&& authenticationModule.getCertificatesDetails(session, appUID) == null);
authenticationModule.removeSecurityData(session, appUID);
@@ -272,7 +277,8 @@
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
details = (SigningCertificate[])authenticationModule.getCertificatesDetails(session, appUID);
- authenticationModule.authenticateJar(session, appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
// this empties the cache as well
authenticationModule.removeSecurityData(session, appUID);
@@ -359,7 +365,8 @@
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
try
{
- authenticationModule.authenticateJar(session, appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "modified_app.jar", false);
+ authenticationModule.authenticateJar(appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "modified_app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(INVALID_CERTIFICATE_SIGNATURE_MSG, false);
}
catch (InstallerSecurityException e)
@@ -552,7 +559,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.IDENTIFIED_THIRD_PARTY_DOMAIN));
// 17. Developer Certificates/Manufacturer - sign to operator party domain
@@ -566,7 +574,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.OPERATOR_DOMAIN));
// 18. Developer Certificates/Manufacturer - sign to manufacturer domain
@@ -580,7 +589,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.MANUFACTURER_DOMAIN));
// 19. Developer Certificates/Operator - sign to trusted third party domain
@@ -594,7 +604,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.IDENTIFIED_THIRD_PARTY_DOMAIN));
// 20. Developer Certificates/Operator - sign to operator party domain
@@ -608,7 +619,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.OPERATOR_DOMAIN));
// 21. Developer Certificates/Operator - sign to manufacturer domain -> still the operator domain is used
@@ -622,7 +634,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.OPERATOR_DOMAIN));
// 22. Developer Certificates/TrustedThirdParty - sign to manufacturer domain -> still the trusted third party domain is used
@@ -636,7 +649,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.IDENTIFIED_THIRD_PARTY_DOMAIN));
// 23. Developer Certificates/TrustedThirdParty - sign to operator domain -> still the trusted third party domain is used
@@ -650,7 +664,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.IDENTIFIED_THIRD_PARTY_DOMAIN));
// 24. Developer Certificates - no domain info -> fail
@@ -687,7 +702,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
domainCategory = authenticationModule.getProtectionDomainCategory(session, appUID);
assertTrue(domainCategory.equals(ApplicationInfo.IDENTIFIED_THIRD_PARTY_DOMAIN));
// 26. Developer Certificates - empty IMEI list -> failure
@@ -807,7 +823,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
SigningInfo info = authenticationModule.getSigningInfo("appName","appVersion","appVendor");
// app is unknown
assertTrue(info == null);
@@ -851,7 +868,8 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
- authenticationModule.authenticateJar(session, appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.authenticateJar(appUID, null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
info = authenticationModule.getSigningInfo("appName","appVersion","appVendor");
assertTrue(info.getProtectionDomain() != null
&& info.getProtectionDomain().getName() != null
@@ -958,7 +976,8 @@
authenticationModule.removeSecurityData(session, appUID);
try
{
- authenticationModule.authenticateJar(session, appUID, null, domain, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar");
+ authenticationModule.authenticateJar(appUID, null, domain, TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "app.jar");
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(!expectToFail);
}
catch (InstallerSecurityException e)
@@ -1200,7 +1219,8 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(true);
// PreInstallation: ocsp disabled, warning undefined, silent mode
ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_DISABLED, OcspSettings.OCSP_WARNING_UNDEFINED, true, "0", "0");
@@ -1218,7 +1238,8 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(true);
// PreInstallation: ocsp enabled, warning ignore, silent mode, ocsp url not set
ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_IGNORE, true, "0", "0");
@@ -1236,7 +1257,8 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
assertTrue(true);
}
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/AccessControllerTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/AccessControllerTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -47,6 +47,7 @@
public class AccessControllerTests extends TestCase implements InstallerMain
{
+ int assertTrace = 0;
// Begin j2meunit test framework setup
public void installerMain(String[] args)
{
@@ -91,6 +92,12 @@
{
}
+ private void assertWithTrace(boolean aCondition)
+ {
+ assertTrue("" + assertTrace, aCondition);
+ assertTrace++;
+ }
+
protected void testAccessControllerFactory()
{
Uid appUID1 = Uid.createUid("appUID1");
@@ -100,17 +107,17 @@
String appName = "AccessControllerTests";
// check null values
ac1 = AccessControllerFactoryImpl.getAccessController(null, null);
- assertTrue(ac1 == null);
+ assertWithTrace(ac1 == null);
AccessControllerFactoryImpl.destroyAccessController(null);
ac1 = AccessControllerFactoryImpl.getAccessController(null, "appName");
- assertTrue(ac1 == null);
+ assertWithTrace(ac1 == null);
AccessControllerFactoryImpl.destroyAccessController(null);
// check duplicates
AccessControllerFactoryImpl.destroyAccessController(appUID1);
ac1 = AccessControllerFactoryImpl.getAccessController(appUID1, appName);
ac2 = AccessControllerFactoryImpl.getAccessController(appUID1, appName);
AccessControllerFactoryImpl.destroyAccessController(appUID1);
- assertTrue(ac1 == ac2);
+ assertWithTrace(ac1 == ac2);
// check destroy
ac1 = AccessControllerFactoryImpl.getAccessController(appUID1, appName);
AccessControllerFactoryImpl.destroyAccessController(appUID1);
@@ -118,7 +125,7 @@
// call destroy two times (or calling it on a UID which does not have an instance)
AccessControllerFactoryImpl.destroyAccessController(appUID1);
AccessControllerFactoryImpl.destroyAccessController(appUID1);
- assertTrue(ac1 != ac2);
+ assertWithTrace(ac1 != ac2);
}
protected void testAccessController()
@@ -135,32 +142,32 @@
try
{
ac.checkPermission((Permission)null);
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
- assertTrue(ac.checkPermission((String)null) == 0);
+ assertWithTrace(ac.checkPermission((String)null) == 0);
// check permission which is not granted
PermissionResolver.testClearCache();
try
{
ac.checkPermission(new CommProtocolPermission("comm://"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
try
{
ac.checkPermission(new CommProtocolPermission("comm://"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
// check allowed permission which is granted
PermissionResolver.testClearCache();
@@ -176,11 +183,11 @@
try
{
ac.checkPermission(new FileProtocolPermission("file://myFile.txt", "read"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
storage.removeGrantedPermissions(appUID);
// check permission not allowed
@@ -202,11 +209,11 @@
try
{
ac.checkPermission(new SocketProtocolPermission("socket://:100"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
storage.removeGrantedPermissions(appUID);
// check user permission with NO as interaction mode -> security exception thrown
@@ -228,35 +235,35 @@
try
{
ac.checkPermission(new HttpProtocolPermissionImpl("http://"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
try
{
ac.checkPermission(new HttpProtocolPermission("http://"));
- assertTrue(false);
+ assertWithTrace(false);
}
catch (AccessControlException e)
{
- assertTrue(true);
+ assertWithTrace(true);
}
storage.removeGrantedPermissions(appUID);
// check the named permissions: unknown permission
- assertTrue(ac.checkPermission("unknownPermission") == 0);
+ assertWithTrace(ac.checkPermission("unknownPermission") == 0);
// check the named permissions: allowed permission
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
grantedPermissions.addElement(new PolicyBasedPermissionImpl(
"com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl",
- "socket://",
+ "socket://*",
null,
null));
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.socket") == 1);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.socket") == 1);
// check the named permissions: user permission with NO interaction mode
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -273,7 +280,7 @@
})));
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.http") == 0);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.http") == 0);
// check the named permissions: user permission with ONESHOT interaction mode
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -290,7 +297,7 @@
})));
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
// check the named permissions: user permission with BLANKET interaction mode (blanket prompt not shown yet)
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -307,7 +314,7 @@
})));
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
// check the named permissions: user permission with BLANKET interaction mode (blanket prompt shown already)
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -325,7 +332,7 @@
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
storage.writeUserSecuritySettingsPromptFlag(appUID, "Net Access", true);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.http") == 1);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.http") == 1);
// check the named permissions: user permission with SESSION interaction mode (session prompt not shown already)
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -343,7 +350,7 @@
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
storage.writeUserSecuritySettingsPromptFlag(appUID, "Net Access", true);
- assertTrue(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
+ assertWithTrace(ac.checkPermission("javax.microedition.io.Connector.http") == -1);
// check the named permissions: denied permission
PermissionResolver.testClearCache();
grantedPermissions = new Vector();
@@ -354,7 +361,7 @@
null));
storage.removeGrantedPermissions(appUID);
storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- assertTrue(ac.checkPermission("javax.wireless.messaging.mms.send") == 0);
+ assertWithTrace(ac.checkPermission("javax.wireless.messaging.mms.send") == 0);
// cleanup
storage.removeGrantedPermissions(appUID);
AccessControllerFactoryImpl.destroyAccessController(appUID);
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/InteractiveAccessControllerTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/InteractiveAccessControllerTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -626,8 +626,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, null);
permissionGranter.getBlanketPermissions(appUID);
ac.checkPermission(new HttpProtocolPermissionImpl("http://", "\n(choose ALLOW)"));
ac.checkPermission(new HttpProtocolPermissionImpl("http://", "\n(IF YOU SEE THIS PROMPT THE TEST FAILED)"));
@@ -659,8 +661,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, appUID, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,appUID,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, appUID);
+ permissionGranter.grantJarPermissions( appUID, appUID, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, appUID);
blanketPromptShown = storage.readUserSecuritySettingsPromptFlag(appUID, "Net Access");
ac.checkPermission(new HttpProtocolPermissionImpl("http://", "\n(IF YOU SEE THIS PROMPT THE TEST FAILED)"));
storage.removeAuthenticationStorageData(appUID);
@@ -687,8 +691,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(com.nokia.mj.impl.security.midp.common.PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http"));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertTrue(signingCerts != null
&& signingCerts.length == 1
@@ -725,8 +731,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, null);
signingCerts = authenticationModule.getCertificatesDetails(session, appUID);
assertTrue(signingCerts == null);
ac.checkPermission(new HttpProtocolPermissionImpl("http://url", "\n(choose ALLOW)"));
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -57,6 +57,7 @@
{
private static String TEST_DATA_DIR;
+ int assertTrace = 0;
static
{
@@ -78,6 +79,12 @@
}
}
+ private void assertWithTrace(boolean aCondition)
+ {
+ assertTrue("" + assertTrace, aCondition);
+ assertTrace++;
+ }
+
// general-purpose constants
private static final String MIDP_PROFILE_ATTRIBUTE_NAME = "MicroEdition-Profile";
private static final String MIDP3 = "MIDP-3.0";
@@ -218,6 +225,7 @@
IMPL_PERMISSION_MAPPING_TABLE = PermissionMappingTable.setMappingTable(TestPermissionMappingTable.getMappingTable());
SecurityPolicyModule.policiesDir = TEST_DATA_DIR;
SecurityPolicyModule.policiesFileNamePrefix = "test_";
+ String[] blanketPermissions = null;
// data structures used in tests
AuthenticationStorageData authData = null;
AuthenticationCredentials[] authCredentials = null;
@@ -225,12 +233,12 @@
MIDPPermission[] jadPermissions;
MIDPPermission[] jarPermissions;
MIDPPermission[] allPermissions;
- assertTrue(permissionGranter != null);
+ assertWithTrace(permissionGranter != null);
// test the null values
permissionGranter.removeSecurityData(session, appUID);
- permissionGranter.grantJarPermissions(null, null, null, (PermissionAttribute[])null);
+ permissionGranter.grantJarPermissions(null, null, (PermissionAttribute[])null, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions == null);
+ assertWithTrace(grantedPermissions == null);
// populate the storage
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -258,9 +266,10 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_DATAGRAM_PERMISSION + COMMA + " " + MIDP2_COMM_PERMISSION));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_SOCKET_PERMISSION + COMMA + MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Manufacturer", new String[]
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Manufacturer", new String[]
{
INTERNAL_DATAGRAM_PERMISSION, INTERNAL_COMM_PERMISSION, INTERNAL_SOCKET_PERMISSION,INTERNAL_HTTP_PERMISSION,"javax.microedition.PropertyPermission","javax.microedition.midlet.AutoStartPermission"
}),
@@ -286,9 +295,10 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_DATAGRAM_PERMISSION + COMMA + " " + MIDP2_COMM_PERMISSION));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_SOCKET_PERMISSION + COMMA + MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("IdentifiedThirdParty",
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("IdentifiedThirdParty",
new String[] {INTERNAL_DATAGRAM_PERMISSION, INTERNAL_COMM_PERMISSION, INTERNAL_SOCKET_PERMISSION,INTERNAL_HTTP_PERMISSION}),
getAssignedPermissions("IdentifiedThirdParty")));
// 1.2 One of the requested mandatory permission is not available in the domain -> fail
@@ -313,12 +323,13 @@
allAttributes.put(PermissionAttribute.OPTIONAL_ATTRIBUTE_PREFIX + "1", new Attribute("",MIDP3_DATAGRAM_PERMISSION));
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1", new Attribute("",MIDP3_RUNTIME_PERMISSION + " name"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(INVALID_PERMISSION_VALUE_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_PERMISSION_VALUE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -342,9 +353,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
allAttributes.put(PermissionAttribute.OPTIONAL_ATTRIBUTE_PREFIX + "1", new Attribute("",MIDP3_RUNTIME_PERMISSION + " name"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getAssignedPermissions("IdentifiedThirdParty"), true));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getAssignedPermissions("IdentifiedThirdParty"), true));
// 2. Legacy, signed : permissions NOT requested in JAD & permissions requested in JAR -> grant the requested permissions filled in with right
// targets/actions from the policy plus the assigned ones
storage.removeAuthenticationStorageData(appUID);
@@ -364,9 +376,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_SOCKET_PERMISSION + COMMA + MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Operator", new String[]
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Operator", new String[]
{
INTERNAL_SOCKET_PERMISSION, INTERNAL_HTTP_PERMISSION,"javax.microedition.PropertyPermission","javax.microedition.midlet.AutoStartPermission"
}),
@@ -388,9 +401,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions, getAssignedPermissions("IdentifiedThirdParty"), true));
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions, getAssignedPermissions("IdentifiedThirdParty"), true));
// same for a domain which has one assigned permissions -> only the assigned + default permissions are granted
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -408,9 +422,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Operator", new String[] {"javax.microedition.PropertyPermission","javax.microedition.midlet.AutoStartPermission"}),
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("Operator", new String[] {"javax.microedition.PropertyPermission","javax.microedition.midlet.AutoStartPermission"}),
getDefaultPermissions()));
// 4. Legacy, unsigned : permissions requested in JAD & permissions requested in JAR -> ignore requested permissions and
// grant all the permissions available in the policy for untrusted MIDlets
@@ -433,9 +448,10 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("","MyOwnOptionalPermission"));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","MyOwnMandatoryPermission"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
// 5. Legacy, unsigned : permissions requested in JAD & permissions NOT requested in JAR -> ignore requested permissions and,
// grant all the permissions available in the policy for untrusted MIDlets
storage.removeAuthenticationStorageData(appUID);
@@ -454,9 +470,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
// 6. Legacy, unsigned : permissions NOT requested in JAD & permissions requested in JAR -> ignore requested permissions and
// grant all the permissions available in the policy for untrusted MIDlets
storage.removeAuthenticationStorageData(appUID);
@@ -475,9 +492,10 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("","MyOwnOptionalPermission"));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","MyOwnMandatoryPermission"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
// 7. Legacy, unsigned : permissions NOT requested in JAD & permissions NOT requested in JAR -> grant all the permissions available in the policy for untrusted MIDlets
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -493,9 +511,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions("UnidentifiedThirdParty")));
// 8. MIDP3 unsigned, unknown mandatory permission in JAD file -> failure
permissionGranter.removeSecurityData(session, appUID);
try
@@ -508,11 +527,11 @@
authCredentials = new AuthenticationCredentials[1];
authCredentials[0] = new AuthenticationCredentials("UnidentifiedThirdParty", "UIDP");
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -527,12 +546,13 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1,MyMandatoryAction2,MyMandatoryAction3"));
securityAttributes = new SecurityAttributes();
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -554,9 +574,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions, getAssignedPermissions("UnidentifiedThirdParty"), true));
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions, getAssignedPermissions("UnidentifiedThirdParty"), true));
// 9.1. MIDP3 unsigned, P1, unknown optional P2 requested in JAD -> unknown permission is ignored, grant only P1 plus the assigned permissions
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -574,9 +595,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
new MIDPPermission[] {new MIDPPermission(INTERNAL_SOCKET_PERMISSION,"socket://")},getAssignedPermissions("UnidentifiedThirdParty")));
// 10. MIDP3 unsigned MIDlet, unknown mandatory permission in JAR file -> failure
permissionGranter.removeSecurityData(session, appUID);
@@ -587,12 +609,13 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1,MyMandatoryAction2,MyMandatoryAction3"));
securityAttributes = new SecurityAttributes();
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -610,12 +633,13 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1", new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -634,12 +658,13 @@
securityAttributes.addDescriptorAttributes(allAttributes);
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1,MyMandatoryAction2,MyMandatoryAction3"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -658,12 +683,13 @@
securityAttributes.addDescriptorAttributes(allAttributes);
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1,MyMandatoryAction2,MyMandatoryAction3"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -690,9 +716,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
new MIDPPermission[]
{
new MIDPPermission(INTERNAL_SOCKET_PERMISSION,"socket://50"),
@@ -724,11 +751,11 @@
authCredentials = new AuthenticationCredentials[1];
authCredentials[0] = new AuthenticationCredentials("UnidentifiedThirdParty", "UIDP");
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
- assertTrue(INVALID_PERMISSION_VALUE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_PERMISSION_VALUE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -764,9 +791,10 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "5",new Attribute("",MIDP3_DATAGRAM_PERMISSION + " datagram://12345"));
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "6",new Attribute("",MIDP3_COMM_PERMISSION + " comm:123"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
new MIDPPermission[]
{
new MIDPPermission(INTERNAL_SOCKET_PERMISSION,"socket://50"),
@@ -809,9 +837,10 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "5",new Attribute("",MIDP3_DATAGRAM_PERMISSION + " datagram://12345"));
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "6",new Attribute("",MIDP3_COMM_PERMISSION + " comm:123"));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
+ assertWithTrace(grantedPermissions != null && checkGrantedPermissions(grantedPermissions,
new MIDPPermission[]
{
new MIDPPermission(INTERNAL_SOCKET_PERMISSION,"socket://50"),
@@ -823,16 +852,15 @@
},
getAssignedPermissions("IdentifiedThirdParty")));
// 19. getBlanketPermissions - null appUID
- String[] blanketPermissions = null;
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
blanketPermissions = permissionGranter.getBlanketPermissions(null);
- assertTrue(blanketPermissions == null);
+ assertWithTrace(blanketPermissions == null);
// 20. getBlanketPermissions - unknown appUID
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ assertWithTrace(blanketPermissions == null);
// 21. getBlanketPermissions - unsigned suite
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -848,9 +876,10 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions == null);
// 22. getBlanketPermissions - one of the requested permissions does not allow Blanket
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -872,9 +901,10 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_DATAGRAM_PERMISSION + COMMA + " " + MIDP2_SMS_SEND_PERMISSION));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_SOCKET_PERMISSION + COMMA + MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions == null);
// 23. getBlanketPermissions - request one permissions which is already in Blanket
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -895,9 +925,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions == null);
// 24. getBlanketPermissions - request Auto Invocation and Net Access -> mutually exclusive permissions
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -918,9 +949,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_PUSH_REGISTRY_PERMISSION + COMMA + MIDP2_HTTP_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions == null);
// 25. getBlanketPermissions - manufacturer signed MIDlet
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -941,9 +973,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_HTTP_PERMISSION + COMMA + MIDP2_SMS_SEND_PERMISSION + COMMA + MIDP2_MMS_OPEN_PERMISSION + COMMA + MIDP2_COMM_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions == null);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions == null);
// 26. getBlanketPermissions - request Messaging, Net Access and Local connectivity. Since Messaging and Net Access have the current interaction mode set to Blanket, only Local connectivity is returned
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
@@ -964,9 +997,10 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("",MIDP2_HTTP_PERMISSION + COMMA + MIDP2_SMS_SEND_PERMISSION + COMMA + MIDP2_MMS_OPEN_PERMISSION + COMMA + MIDP2_COMM_PERMISSION));
securityAttributes.addManifestAttributes(allAttributes);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
+ permissionGranter.grantJarPermissions( appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
blanketPermissions = permissionGranter.getBlanketPermissions(appUID);
- assertTrue(blanketPermissions != null && blanketPermissions.length == 1 && blanketPermissions[0].equals(UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.LOCAL_CONNECTIVITY_SETTINGS)));
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(blanketPermissions != null && blanketPermissions.length == 1 && blanketPermissions[0].equals(UserSecuritySettingsImpl.getLocalizedName(UserSecuritySettings.LOCAL_CONNECTIVITY_SETTINGS)));
permissionGranter.setPermissionsToBlanket(session, appUID);
grantedPermissions = storage.readGrantedPermissions(appUID);
for (int i=0; i<grantedPermissions.size(); i++)
@@ -975,22 +1009,24 @@
((PolicyBasedPermission)grantedPermissions.elementAt(i));
UserSecuritySettings settings =
permission.getUserSecuritySettings();
- if (settings != null)
+ if (settings != null && settings.getName() == UserSecuritySettings.LOCAL_CONNECTIVITY_SETTINGS)
{
- assertTrue(settings.getCurrentInteractionMode() == UserSecuritySettings.BLANKET_INTERACTION_MODE);
+ assertWithTrace(settings.getCurrentInteractionMode() == UserSecuritySettings.BLANKET_INTERACTION_MODE);
}
}
// grantAllPermissions - null values
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
- permissionGranter.grantJarPermissions(session, null, null, (ProtectionDomain)null);
+ permissionGranter.grantJarPermissions(null, null, (ProtectionDomain)null);
+ permissionGranter.addSecurityData(session, null, null);
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
- permissionGranter.grantJarPermissions(session, appUID, null, (ProtectionDomain)null);
+ permissionGranter.grantJarPermissions(appUID, null, (ProtectionDomain)null);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
- assertTrue(grantedPermissions == null);
+ assertWithTrace(grantedPermissions == null);
// grantAllPermissions - operator domain
grantAllPermissions(ProtectionDomain.getOperatorDomain());
// grantAllPermissions - manufacturer domain
@@ -1008,11 +1044,12 @@
{
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
- permissionGranter.grantJarPermissions(session, appUID, null, domain);
+ permissionGranter.grantJarPermissions(appUID, null, domain);
+ permissionGranter.addSecurityData(session, appUID, null);
grantedPermissions = storage.readGrantedPermissions(appUID);
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
- assertTrue(checkGrantedPermissions(grantedPermissions, getPolicyPermissions(domain.getName())));
+ assertWithTrace(checkGrantedPermissions(grantedPermissions, getPolicyPermissions(domain.getName())));
}
private static MIDPPermission[] getPolicyPermissions(String policyName, String[] permissionNameFilter, String permissionTypeFilter)
@@ -1041,7 +1078,8 @@
&& findString(policyPerms[i].getName(), permissionNameFilter) != -1)
|| permissionNameFilter == null) && (permissionTypeFilter == null
|| (permissionTypeFilter.equals("assigned")
- && policyPerms[i].getUserSecuritySettings() == null)))
+ && (policyPerms[i].getType() == PolicyBasedPermission.ASSIGNED_TYPE
+ || policyPerms[i].getType() == PolicyBasedPermission.USER_ASSIGNED_TYPE))))
{
vPermissions.addElement(new MIDPPermission(policyPerms[i].getName(), policyPerms[i].getTarget(), policyPerms[i].getActionList()));
}
@@ -1087,10 +1125,12 @@
private static MIDPPermission[] getDefaultPermissions()
{
- MIDPPermission[] defaultPerms = new MIDPPermission[3];
+ MIDPPermission[] defaultPerms = new MIDPPermission[5];
defaultPerms[0] = new MIDPPermission("java.util.PropertyPermission", "microedition.*", "read");
defaultPerms[1] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.publicinfo", "read");
defaultPerms[2] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.cellid", "read");
+ defaultPerms[3] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.countrycode", "read");
+ defaultPerms[4] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.networkid", "read");
return defaultPerms;
}
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/TestPermissionMappingTable.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/TestPermissionMappingTable.java Mon Aug 23 14:24:31 2010 +0300
@@ -62,7 +62,7 @@
"com.nokia.mj.impl.security.midp.authorization.DatagramProtocolPermissionImpl", "datagram://"));
TEST_PERMISSION_MAPPING_TABLE.put(
"javax.microedition.io.Connector.comm", new MIDPPermission(
- "com.nokia.mj.impl.security.midp.authorization.CommProtocolPermissionImpl", "comm://*"));
+ "com.nokia.mj.impl.security.midp.authorization.CommProtocolPermissionImpl", "comm:*"));
TEST_PERMISSION_MAPPING_TABLE.put(
"javax.microedition.io.PushRegistry", new MIDPPermission(
"javax.microedition.io.PushRegistryPermission", "*"));
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/common/SecurityDescriptorAttributesTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/common/SecurityDescriptorAttributesTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -39,6 +39,7 @@
*/
public class SecurityDescriptorAttributesTests extends TestCase implements InstallerMain
{
+ int assertTrace = 0;
/**
* Hashtable holding all the attributes. Tests populate this hashtable
@@ -78,7 +79,7 @@
midp2PermissionTargets.put(INTERNAL_HTTPS_PERMISSION, "https://*");
midp2PermissionTargets.put(INTERNAL_SSL_PERMISSION, "ssl://*");
midp2PermissionTargets.put(INTERNAL_DATAGRAM_PERMISSION,"datagram://*");
- midp2PermissionTargets.put(INTERNAL_COMM_PERMISSION, "comm://*");
+ midp2PermissionTargets.put(INTERNAL_COMM_PERMISSION, "comm:*");
midp2PermissionTargets.put(INTERNAL_PUSH_REGISTRY_PERMISSION, "*");
}
@@ -164,7 +165,7 @@
// no attributes
allAttributes.clear();
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue((authAttributes == null) || (authAttributes.length == 0));
+ assertWithTrace((authAttributes == null) || (authAttributes.length == 0));
// empty certificate attribute
try
{
@@ -172,11 +173,11 @@
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("", ""));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(EMPTY_CERTIFICATE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(EMPTY_CERTIFICATE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -189,11 +190,11 @@
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("","?%cert"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_CERTIFICATE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_CERTIFICATE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -204,7 +205,7 @@
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("","cert"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(securityAttributes.getAuthenticationAttributes() == null);
+ assertWithTrace(securityAttributes.getAuthenticationAttributes() == null);
// missing certificate attribute
try
{
@@ -212,11 +213,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MISSING_CERTIFICATE_ATTRIBUTE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MISSING_CERTIFICATE_ATTRIBUTE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_MISSING,
@@ -230,11 +231,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","?signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_CERTIFICATE_SIGNATURE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_CERTIFICATE_SIGNATURE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -249,11 +250,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1", new Attribute("","?signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_CERTIFICATE_SIGNATURE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_CERTIFICATE_SIGNATURE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -268,11 +269,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "2", new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MISSING_CERTIFICATE_ATTRIBUTE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MISSING_CERTIFICATE_ATTRIBUTE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_MISSING,
@@ -286,11 +287,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1", new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -305,11 +306,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MIDP2_SIGNATURE_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MIDP2_SIGNATURE_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -326,11 +327,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MIDP2_SIGNATURE_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MIDP2_SIGNATURE_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -344,7 +345,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 1
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert1", "cert2"},
@@ -360,7 +361,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 1
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert1", "cert2"},
@@ -377,7 +378,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 1
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert1", "cert2"},
@@ -391,7 +392,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 1
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert1", "cert2"},
@@ -410,7 +411,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 1
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert11", "cert12"},
@@ -430,11 +431,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "2" , new Attribute("","signature2"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(CERTIFICATE_WITHOUT_SIGNATURE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_CERTIFICATE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -452,11 +453,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" , new Attribute("","signature1"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_CERTIFICATE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_CERTIFICATE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -479,7 +480,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null
+ assertWithTrace(authAttributes != null
&& authAttributes.length == 2
&& checkChainsAndSignatures(authAttributes,
new String[] {"cert11", "cert12", "cert21", "cert22", "cert23"},
@@ -498,18 +499,18 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
authAttributes = securityAttributes.getAuthenticationAttributes();
- assertTrue(authAttributes != null && authAttributes.length == 100);
+ assertWithTrace(authAttributes != null && authAttributes.length == 100);
for (int i=0; i<100; i++)
{
// make sure we have 10 certs in each chain and a corresponding signature
- assertTrue(authAttributes[i].getCertChain() != null
+ assertWithTrace(authAttributes[i].getCertChain() != null
&& authAttributes[i].getSignature() != null
&& authAttributes[i].getCertChain().length == 10
&& authAttributes[i].getSignature().equals("signature" + (i+1)));
// check each chain
for (int j=0; j<10; j++)
{
- assertTrue((authAttributes[i].getCertChain())[j]
+ assertWithTrace((authAttributes[i].getCertChain())[j]
.equals("cert" + (i+1) + "" + (j+1)));
}
}
@@ -526,11 +527,11 @@
allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","Perm1, Perm2"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(LEGACY_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(LEGACY_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -544,11 +545,11 @@
allAttributes.put(PermissionAttribute.OPTIONAL_LEGACY_ATTRIBUTE_NAME, new Attribute("","Perm1, Perm2"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(LEGACY_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(LEGACY_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -563,11 +564,11 @@
new Attribute("","PermissionClassName TargetName ActionList"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -582,11 +583,11 @@
new Attribute("","PermissionClassName TargetName ActionList"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(MIDP3_ATTRIBUTE_NOT_ALLOWED_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.INVALID_DESCRIPTOR
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -601,7 +602,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 1
&& permissionAttributes[0].isLegacyAttribute());
// MIDP2 mandatory permissions handling - invalid permission value
@@ -616,11 +617,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -640,11 +641,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -663,7 +664,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 0, 2)
&& checkNamesAndTargets(permissionAttributes,
@@ -681,7 +682,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 1
&& checkImportance(permissionAttributes, 0, 1)
&& checkNamesAndTargets(permissionAttributes,
@@ -698,11 +699,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(UNKNOWN_PERMISSION_MSG, true);
+ assertWithTrace(true);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ assertWithTrace(false);
}
// MIDP2 optional permissions handling - unknown permission value
try
@@ -716,11 +717,11 @@
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(UNKNOWN_PERMISSION_MSG, true);
+ assertWithTrace(true);
}
catch (InvalidAttributeException e)
{
- assertTrue(UNKNOWN_PERMISSION_MSG, false);
+ assertWithTrace(false);
}
// MIDP2 optional permissions handling - known permission value
allAttributes.clear();
@@ -734,7 +735,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 2, 0)
&& checkNamesAndTargets(permissionAttributes,
@@ -756,7 +757,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 1
&& checkImportance(permissionAttributes, 1, 0)
&& checkNamesAndTargets(permissionAttributes,
@@ -777,7 +778,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 4
&& checkImportance(permissionAttributes, 2, 2)
&& checkNamesAndTargets(permissionAttributes,
@@ -797,7 +798,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 1, 1)
&& checkNamesAndTargets(permissionAttributes,
@@ -811,7 +812,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 1, 1)
&& checkNamesAndTargets(permissionAttributes,
@@ -825,7 +826,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 1, 1)
&& checkNamesAndTargets(permissionAttributes,
@@ -841,7 +842,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 2
&& checkImportance(permissionAttributes, 1, 1)
&& checkNamesAndTargets(permissionAttributes,
@@ -855,11 +856,11 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1 MyMandatoryAction2"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_PERMISSION_VALUE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_PERMISSION_VALUE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -873,11 +874,11 @@
allAttributes.put(PermissionAttribute.MANDATORY_ATTRIBUTE_PREFIX + "1",new Attribute("","MyMandatoryClass MyMandatoryTarget MyMandatoryAction1 MyMandatoryAction2"));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_PERMISSION_VALUE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(INVALID_PERMISSION_VALUE_MSG + e.getOtaStatusCode() + " " + e.getShortMessage() + "," + e.getDetailedMessage(),
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_HANDLING_FAILED,
@@ -890,7 +891,7 @@
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
permissionAttributes = securityAttributes.getPermissionAttributes();
- assertTrue(permissionAttributes != null
+ assertWithTrace(permissionAttributes != null
&& permissionAttributes.length == 1
&& checkImportance(permissionAttributes, 1, 0)
&& checkNamesAndTargets(permissionAttributes,
@@ -932,7 +933,7 @@
allAttributes.put(PermissionAttribute.OPTIONAL_ATTRIBUTE_PREFIX + "1",new Attribute("",className + " MyMandatoryTarget MyMandatoryAction "));
securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
- assertTrue(INVALID_PERMISSION_VALUE_MSG, false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
@@ -1110,6 +1111,13 @@
return (checkBoolArray(certsChecked) && checkBoolArray(signaturesChecked));
}
+ private void assertWithTrace(boolean aCondition)
+ {
+ assertTrue("" + assertTrace, aCondition);
+ assertTrace++;
+ }
+
+
private int findString(String str, String[] strings)
{
for (int i=0; i<strings.length; i++)
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -48,6 +48,7 @@
public class SecurityExtensionsTests extends TestCase implements InstallerMain
{
private static String TEST_DATA_DIR;
+ int assertTrace = 0;
static
{
@@ -128,7 +129,7 @@
SecurityAttributes securityAttributes;
AuthenticationCredentials[] credentials;
// package names
- assertTrue(find(SecurityExtensionsReader.getExtProtectedPackages(), new String[] {"com.nokia.ext1.internal.", "com.nokia.ext2.internal."})
+ assertWithTrace(find(SecurityExtensionsReader.getExtProtectedPackages(), new String[] {"com.nokia.ext1.internal.", "com.nokia.ext2.internal."})
&& !find(SecurityExtensionsReader.getExtProtectedPackages(), new String[] {"com.nokia.ext1.public."})
&& !find(SecurityExtensionsReader.getExtProtectedPackages(), new String[] {"com.nokia.ext2.public."})
&& find(SecurityExtensionsReader.getExtRestrictedPackages(), new String[] {"com.nokia.ext1.public.", "com.nokia.ext2.public."})
@@ -136,10 +137,10 @@
&& !find(SecurityExtensionsReader.getExtRestrictedPackages(), new String[] {"com.nokia.ext2.internal."}));
// mappings
MIDPPermission perm = SecurityExtensionsReader.getExtPermission("com.nokia.ext1.public.Ext1Perm");
- assertTrue(perm != null && perm.getName() != null && perm.getName().equals("com.nokia.ext1.internal.Ext1Perm") && perm.getTarget() != null && perm.getTarget().equals("*")&& perm.getActionList() == null);
- assertTrue(SecurityExtensionsReader.getExtPermission("com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl") == null);
+ assertWithTrace(perm != null && perm.getName() != null && perm.getName().equals("com.nokia.ext1.internal.Ext1Perm") && perm.getTarget() == null && perm.getActionList() == null);
+ assertWithTrace(SecurityExtensionsReader.getExtPermission("com.nokia.mj.impl.gcf.protocol.socket.SocketPermissionImpl") == null);
perm = SecurityExtensionsReader.getExtPermission("com.nokia.ext2.public.Ext2Perm");
- assertTrue(perm != null && perm.getName() != null && perm.getName().equals("com.nokia.ext2.internal.Ext2Perm") && perm.getTarget() != null && perm.getTarget().equals("*")&& perm.getActionList() == null);
+ assertWithTrace(perm != null && perm.getName() != null && perm.getName().equals("com.nokia.ext2.internal.Ext2Perm") && perm.getTarget() == null && perm.getActionList() == null);
// policies (unsigned suite, check that ext1 perms are granted and the base permissions were not altered)
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session,appUID);
@@ -153,9 +154,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(checkGrantedPermissions(storage.readGrantedPermissions(appUID),
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(checkGrantedPermissions(storage.readGrantedPermissions(appUID),
new PolicyBasedPermissionImpl[]
{
new PolicyBasedPermissionImpl("com.nokia.ext1.internal.Ext1Perm", "ext1.target1", "ext1.action1", new UserSecuritySettingsImpl("Ext1", UserSecuritySettings.ONESHOT_INTERACTION_MODE, new int[] {UserSecuritySettings.ONESHOT_INTERACTION_MODE, UserSecuritySettings.SESSION_INTERACTION_MODE, UserSecuritySettings.BLANKET_INTERACTION_MODE, UserSecuritySettings.NO_INTERACTION_MODE})),
@@ -180,11 +183,11 @@
securityAttributes.addDescriptorAttributes(allAttributes);
credentials = authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
- assertTrue(false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -205,11 +208,11 @@
securityAttributes.addDescriptorAttributes(allAttributes);
credentials = authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
- assertTrue(false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -230,11 +233,11 @@
securityAttributes.addDescriptorAttributes(allAttributes);
credentials = authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
- assertTrue(false);
+ assertWithTrace(false);
}
catch (InvalidAttributeException e)
{
- assertTrue(
+ assertWithTrace(
e.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHORIZATION_FAILURE
&& e.getShortMessage().equals(errorMessage.get(InstallerErrorMessage.INST_CORRUPT_PKG, null))
&& e.getDetailedMessage().equals(detailedErrorMessage.get(InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
@@ -256,9 +259,11 @@
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
securityAttributes.addManifestAttributes(allAttributes);
- authenticationModule.authenticateJar(session, appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
- permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
- assertTrue(checkGrantedPermissions(storage.readGrantedPermissions(appUID),
+ credentials = authenticationModule.authenticateJar(appUID,null,TEST_DATA_DIR + "security_tmp" + System.getProperty("file.separator") + "HelloWorld.jar", false);
+ authenticationModule.addSecurityData(session, appUID, null);
+ permissionGranter.grantJarPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
+ permissionGranter.addSecurityData(session, appUID, null);
+ assertWithTrace(checkGrantedPermissions(storage.readGrantedPermissions(appUID),
new PolicyBasedPermissionImpl[]
{
new PolicyBasedPermissionImpl("com.nokia.ext2.internal.Ext2Perm", "ext2.target1", "ext2.action1", new UserSecuritySettingsImpl("Ext1", UserSecuritySettings.BLANKET_INTERACTION_MODE, new int[] {UserSecuritySettings.BLANKET_INTERACTION_MODE, UserSecuritySettings.NO_INTERACTION_MODE})),
@@ -269,6 +274,12 @@
}));
}
+ private void assertWithTrace(boolean aCondition)
+ {
+ assertTrue("" + assertTrace, aCondition);
+ assertTrace++;
+ }
+
private static boolean checkGrantedPermissions(Vector grantedPermissions, PolicyBasedPermissionImpl[] expectedPerms)
{
if (grantedPermissions == null)
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorageTests.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorageTests.java Mon Aug 23 14:24:31 2010 +0300
@@ -188,70 +188,6 @@
storage.removeGrantedPermissions(appUID);
readPermissions = storage.readGrantedPermissions(appUID);
assertTrue(readPermissions == null);
- // full read/write/remove cycle for update -> the old settings are retained
- storage.removeGrantedPermissions(appUID);
- grantedPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(grantedPermissions == null);
- grantedPermissions = new Vector();
- storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- storage.removeGrantedPermissions(appUID);
- assertTrue(true);
- grantedPermissions.addElement(new PolicyBasedPermissionImpl(
- "permission1",
- "target1",
- "action1",
- PolicyBasedPermission.ALLOWED_TYPE));
- grantedPermissions.addElement(new PolicyBasedPermissionImpl(
- "permission2",
- "target2",
- "action2",
- PolicyBasedPermission.ASSIGNED_TYPE));
- grantedPermissions.addElement(new PolicyBasedPermissionImpl(
- "permission3",
- "target3",
- "action3",
- new UserSecuritySettingsImpl("settingsname",
- UserSecuritySettings.ONESHOT_INTERACTION_MODE,
- new int[] { UserSecuritySettings.ONESHOT_INTERACTION_MODE,
- UserSecuritySettings.SESSION_INTERACTION_MODE,
- UserSecuritySettings.BLANKET_INTERACTION_MODE,
- UserSecuritySettings.NO_INTERACTION_MODE
- })));
- storage.writeGrantedPermissions(appUID, null, grantedPermissions);
- readPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(readPermissions != null
- && readPermissions.size() == grantedPermissions.size()
- && checkGrantedPermissions(readPermissions, grantedPermissions));
- grantedPermissions2 = new Vector();
- grantedPermissions2.addElement(new PolicyBasedPermissionImpl(
- "permission1",
- "target1",
- "action1",
- PolicyBasedPermission.ALLOWED_TYPE));
- grantedPermissions2.addElement(new PolicyBasedPermissionImpl(
- "permission2",
- "target2",
- "action2",
- PolicyBasedPermission.ASSIGNED_TYPE));
- grantedPermissions2.addElement(new PolicyBasedPermissionImpl(
- "permission3",
- "target3",
- "action3",
- new UserSecuritySettingsImpl("settingsname",
- UserSecuritySettings.SESSION_INTERACTION_MODE,
- new int[] { UserSecuritySettings.ONESHOT_INTERACTION_MODE,
- UserSecuritySettings.SESSION_INTERACTION_MODE,
- UserSecuritySettings.BLANKET_INTERACTION_MODE,
- UserSecuritySettings.NO_INTERACTION_MODE
- })));
- storage.writeGrantedPermissions(appUID, appUID, grantedPermissions2);
- readPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(readPermissions != null
- && readPermissions.size() == grantedPermissions.size()
- && checkGrantedPermissions(readPermissions, grantedPermissions));
- storage.removeGrantedPermissions(appUID);
- readPermissions = storage.readGrantedPermissions(appUID);
- assertTrue(readPermissions == null);
// full read/write/remove cycle with different valid values for permissions and user settings
storage.removeGrantedPermissions(appUID);
grantedPermissions = storage.readGrantedPermissions(appUID);
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/rt/SystemPropertyUtils.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/rt/SystemPropertyUtils.java Mon Aug 23 14:24:31 2010 +0300
@@ -98,7 +98,7 @@
try
{
- Class clazz = clazz = Class.forName(className);
+ Class clazz = Class.forName(className);
Object providerImpl = clazz.newInstance();
boolean isFrozen = false;
--- a/javacommons/utils/src.s60/properties.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/utils/src.s60/properties.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -103,7 +103,9 @@
JELOG2(EUtils);
// microedition.locale
- switch (User::Language()) {
+ ILOG1(EUtils, "User::Language: %d", User::Language());
+ // KDialectMask enables support for operator specific language variants
+ switch (User::Language() & KDialectMask) {
case ELangAfrikaans:
return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleAfrikaans);
case ELangAlbanian:
--- a/javacommons/utils/src/logger.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/utils/src/logger.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -340,14 +340,16 @@
int logFileNameLen = strlen(fileName);
TPtr8 fileNamePtr((unsigned char*)fileName, logFileNameLen, logFileNameLen);
RBuf nameBuf;
- nameBuf.Create(fileNamePtr.MaxLength());
- nameBuf.Copy(fileNamePtr);
+ int rc = nameBuf.Create(fileNamePtr.MaxLength());
+ if (rc == KErrNone)
+ {
+ nameBuf.Copy(fileNamePtr);
- TInt len = strlen(txt);
- TPtr8 ptr((unsigned char*)txt, len, len);
- RFileLogger::Write(KJavaLogDir, nameBuf, EFileLoggingModeAppendRaw, ptr);
-
- nameBuf.Close();
+ TInt len = strlen(txt);
+ TPtr8 ptr((unsigned char*)txt, len, len);
+ RFileLogger::Write(KJavaLogDir, nameBuf, EFileLoggingModeAppendRaw, ptr);
+ nameBuf.Close();
+ }
#else //J_LOG_USE_RLOGGER_ENABLED
--- a/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/datagram/UDPDatagramConnectionImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -134,7 +134,7 @@
/* security related stuff */
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- DatagramPermissionImpl per = new DatagramPermissionImpl("datagram://");
+ DatagramPermissionImpl per = new DatagramPermissionImpl(DatagramPermissionImpl.SERVER_TARGET);
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
"calling check permissions from UDPDatagramConnectionImpl");
appUtils.checkPermission(per);
@@ -171,7 +171,7 @@
{
/* security related stuff, server mode datagram connection */
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- DatagramPermissionImpl per = new DatagramPermissionImpl("datagram://");
+ DatagramPermissionImpl per = new DatagramPermissionImpl(DatagramPermissionImpl.SERVER_TARGET);
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
"calling check permissions from UDPDatagramConnectionImpl");
appUtils.checkPermission(per);
@@ -183,7 +183,7 @@
{
/* security related stuff, client mode datagram connection */
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- DatagramPermissionImpl per = new DatagramPermissionImpl("datagram://*");
+ DatagramPermissionImpl per = new DatagramPermissionImpl(DatagramPermissionImpl.CLIENT_TARGET);
Logger.LOG(Logger.ESOCKET, Logger.EInfo,
"calling check permissions from UDPDatagramConnectionImpl");
appUtils.checkPermission(per);
--- a/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/DatagramPermissionImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/DatagramPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -25,6 +25,13 @@
public class DatagramPermissionImpl extends PermissionBase
{
+ /**
+ * Constants for identifying the target/uri of connection: client or server
+ */
+ public static String CLIENT_TARGET = "datagram://*";
+ public static String SERVER_TARGET = "datagram://";
+
+ private String iTarget;
/**
* Returns the question (as localized text) associated with the security
@@ -37,6 +44,7 @@
public DatagramPermissionImpl(String uri)
{
super(uri);
+ iTarget = uri;
}
public String getSecurityPromptQuestion(int aInteractionMode)
@@ -56,14 +64,23 @@
public String toString()
{
- return "javax.microedition.io.DatagramProtocolPermission";
+ if (SERVER_TARGET.equals(iTarget))
+ {
+ return "javax.microedition.io.Connector.datagramreceiver";
+ }
+ return "javax.microedition.io.Connector.datagram";
}
public boolean implies(Permission p)
{
if (p instanceof DatagramPermissionImpl)
{
- return true;
+ DatagramPermissionImpl o = (DatagramPermissionImpl)p;
+ if ((iTarget != null && iTarget.equals(o.getTarget()))
+ || (iTarget == null && o.getTarget() == null))
+ {
+ return true;
+ }
}
return false;
}
@@ -88,4 +105,8 @@
return null;
}
+ String getTarget()
+ {
+ return iTarget;
+ }
}
\ No newline at end of file
--- a/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/PushValidatorImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/datagram/datagram/javasrc/com/nokia/mj/impl/gcf/protocol/datagram/PushValidatorImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -125,7 +125,7 @@
/* security check */
Logger.LOG(Logger.ESOCKET, Logger.EInfo,"datagram - push validator : before security check");
ApplicationUtils appUtils = ApplicationUtils.getInstance();
- DatagramPermissionImpl per = new DatagramPermissionImpl("datagram://");
+ DatagramPermissionImpl per = new DatagramPermissionImpl(DatagramPermissionImpl.SERVER_TARGET);
appUtils.checkPermission(per);
/* security check */
Logger.LOG(Logger.ESOCKET, Logger.EInfo,"datagram - push validator : after security check");
--- a/javaextensions/datagram/datagram/src.s60/apnsettings.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/datagram/datagram/src.s60/apnsettings.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -42,6 +42,7 @@
char * fret = if_indextoname(aApn,interfacename);
strcpy(ifr.ifr_name, interfacename);
ILOG1(ESOCKET, "interface name is %s",interfacename);
+ delete interfacename;
}
else
{
--- a/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -133,6 +133,7 @@
writeBuffer = new char[requiredNativeBufferLength + 1];
}
/* Copy the data to be written from java buffer to the native buffer. */
+ if (writeBuffer != NULL)
JNIArrayUtils::CopyToNative(aJni, aJavaBuffer, aOffset,
requiredNativeBufferLength, writeBuffer);
--- a/javaextensions/iapinfo/build/javaiapinfo.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/build/javaiapinfo.pro Mon Aug 23 14:24:31 2010 +0300
@@ -24,7 +24,8 @@
SOURCES += ../src.s60/javacommdb.cpp \
../src.s60/iapinfoimpl.cpp \
../src.s60/javaapncontrol.cpp \
- ../src.s60/stringbuffer.cpp
+ ../src.s60/stringbuffer.cpp \
+ ../src.s60/iapinfosession.cpp
LIBS += -leuser -lcommsdat -lcommdb -lagentdialog -lcmmanager
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/iapinfo/inc.s60/iapinfosession.h Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JavaCommDB class implementation
+ *
+*/
+
+#ifndef IAINFOSESSION_H
+#define IAINFOSESSION_H
+
+
+#include <commsdattypesv1_1.h>
+#include <commsdat.h>
+#include <metadatabase.h>
+#include "functionserver.h"
+#include <e32base.h>
+
+using namespace java::util;
+
+class IapInfoSession : public FunctionServer
+{
+ public: static IapInfoSession* NewL();
+
+ private:
+ IapInfoSession();
+ void ConstructL();
+
+ /**
+ * Pointer to the actual DB Session object.
+ * Initialized in the Open() function.
+ */
+ public:
+ CommsDat::CMDBSession* iDb;
+
+
+
+
+};
+
+#endif // IAINFOSESSION_H
\ No newline at end of file
--- a/javaextensions/iapinfo/inc.s60/javacommdb.h Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/inc.s60/javacommdb.h Mon Aug 23 14:24:31 2010 +0300
@@ -23,6 +23,7 @@
#include <commsdat.h>
#include <metadatabase.h>
#include "com_nokia_mid_iapinfo_CommsTable.h"
+#include "iapinfosession.h"
using namespace CommsDat;
@@ -41,6 +42,8 @@
public:
~ JavaCommDB();
+
+ JavaCommDB(IapInfoSession *aSess);
/**
* Opens the given table.
@@ -50,12 +53,12 @@
*/
void OpenL(const TDesC&);
+ static void Destroy(JavaCommDB* aObj);
/**
* Close the table and delete allocated member objects.
- * @since S60 v3.0
- * @return error code
+ * @since S60 v3.0
*/
- TInt Close();
+ void Close();
/**
* Get number of records in the current table.
@@ -133,6 +136,9 @@
* Initialized in the Open() function.
*/
CMDBRecordSet<CCDRecordBase>* iTable;
+
+public:
+ IapInfoSession* iSession;
};
#endif // JAVACOMMDB_H
--- a/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/CommsTable.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/CommsTable.java Mon Aug 23 14:24:31 2010 +0300
@@ -19,6 +19,7 @@
import com.nokia.mj.impl.rt.support.Finalizer;
import com.nokia.mj.impl.gcf.utils.NativeError;
+import com.nokia.mj.impl.utils.Logger;
//import com.nokia.mj.impl.vmport.VmPort;
@@ -131,13 +132,6 @@
iTableName = tableName;
- // create native peer
- iHandle = _construct();
- if (iHandle < NativeError.KErrNone)
- {
- throw new CommDBException("Native constructor failed!", ERROR_NONE,
- iHandle);
- }
// we need this so we can do some cleanup when we are garbage collected
iFinalizer = createFinalizer();
state = CREATED;
@@ -146,18 +140,20 @@
/**
* Opens the corresponding CommDB table.
*/
- public void open() throws CommDBException
+ public void open(int aNativeSessionHandle) throws CommDBException
{
- int err = _open(iHandle, iTableName);
- if (NativeError.KErrNone == err)
+ iHandle = _open(aNativeSessionHandle, iTableName);
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "iHandle ="+iHandle);
+
+ if (iHandle > 0)
{
state = OPENED;
readFieldValues();
}
else
{
- throw new CommDBException("Open failed!", ERROR_OPEN_FAILED, err);
+ throw new CommDBException("Open failed!", ERROR_OPEN_FAILED, iHandle);
}
}
@@ -185,6 +181,7 @@
{
int rec = 0;
+
rec = _findByName(iHandle, recordName);
if (rec >= 0)
{
@@ -230,6 +227,7 @@
*/
public int getRecordCount() throws CommDBException
{
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo,"+getRecordCount()");
return _getRecordCount(iHandle);
}
@@ -326,13 +324,6 @@
/* Native funcions */
/*----------------------------------------------------------------*/
/*
- * Creates native peer.
- *
- * @return handle for native peer
- */
- private static native int _construct();
-
- /*
* Destructs native peer.
*
* @param aHandle - handle for native peer
@@ -346,7 +337,7 @@
*
* @return - error code
*/
- private static native int _open(int aHandle, String tableName);
+ private static native int _open(int aSessionHandle, String tableName);
/*
* Close the actual CommDB table.
--- a/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfo.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfo.java Mon Aug 23 14:24:31 2010 +0300
@@ -34,7 +34,7 @@
* Please refer IapInfo Spec.
*/
- public static IAPInfo getIAPInfo() throws IAPInfoException
+ public synchronized static IAPInfo getIAPInfo() throws IAPInfoException
{
if (instance == null)
instance = new IAPInfoImpl();
--- a/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfoImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfoImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -35,16 +35,14 @@
class IAPInfoImpl extends IAPInfo
{
- // variable to store the network preferences
- private IAPTable iIAPTable = null;
-
+ private int iSessionHandle;
static
{
try
{
- Logger.ILOG(Logger.ESOCKET, "loading javaiapinfo");
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "loading javaiapinfo");
Jvm.loadSystemLibrary("javaiapinfo");
- Logger.ILOG(Logger.ESOCKET, "javaiapinfo loaded");
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "javaiapinfo loaded");
}
catch (Exception e)
{
@@ -57,42 +55,48 @@
*/
public IAPInfoImpl() throws IAPInfoException
{
+ iSessionHandle = _createSession();
+ if (iSessionHandle <0)
+ throw new IAPInfoException("Error: symbian os error: "+iSessionHandle);
+
+ }
+
+ /**
+ * Please refer IapInfo Spec.
+ */
+ public synchronized AccessPoint[] getAccessPoints() throws IAPInfoException
+ {
+ IAPTable iIAPTable = null;
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getAccessPoints() - this = "+Thread.currentThread().toString() +"hascode= " +Thread.currentThread().hashCode());
try
{
- this.iIAPTable = new IAPTable();
+ iIAPTable = new IAPTable();
}
catch (CommDBException e)
{
e.printStackTrace();
throw new IAPInfoException(e.getMessage());
}
- }
-
- /**
- * Please refer IapInfo Spec.
- */
- public AccessPoint[] getAccessPoints() throws IAPInfoException
- {
AccessPoint[] _ac = null;
try
{
- this.iIAPTable.open();
- int _nr_of_access_points = this.iIAPTable.getRecordCount();
+ iIAPTable.open(iSessionHandle);
+ int _nr_of_access_points = iIAPTable.getRecordCount();
_ac = new AccessPoint[_nr_of_access_points];
for (int i = 0; i < _nr_of_access_points; i++)
{
- AccessPoint _c = new AccessPoint(this.iIAPTable.iRecordId,
- this.iIAPTable.iRecordName, this.iIAPTable.iBearerType,
- this.iIAPTable.iServiceType);
+ AccessPoint _c = new AccessPoint(iIAPTable.iRecordId,
+ iIAPTable.iRecordName, iIAPTable.iBearerType,
+ iIAPTable.iServiceType);
_ac[i] = _c;
if (i != _nr_of_access_points - 1)
- this.iIAPTable.nextRecord();
+ iIAPTable.nextRecord();
}
- this.iIAPTable.close();
+ iIAPTable.close();
}
catch (CommDBException _exception)
{
- this.iIAPTable.close();
+ iIAPTable.close();
throw new IAPInfoException(_exception.getMessage());
}// end of catch
return _ac;
@@ -101,24 +105,35 @@
/**
* Please refer IapInfo Spec.
*/
- public AccessPoint getAccessPoint(int aID) throws IAPInfoException
+ public synchronized AccessPoint getAccessPoint(int aID) throws IAPInfoException
{
AccessPoint _ac = null;
+ IAPTable iIAPTable = null;
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getAccessPoint() - aID = "+aID +" this = "+Thread.currentThread().toString() +"hascode= " +Thread.currentThread().hashCode());
try
{
- this.iIAPTable.open();
- int _ret = this.iIAPTable.findById(aID);
+ iIAPTable = new IAPTable();
+ }
+ catch (CommDBException e)
+ {
+ e.printStackTrace();
+ throw new IAPInfoException(e.getMessage());
+ }
+ try
+ {
+ iIAPTable.open(iSessionHandle);
+ int _ret = iIAPTable.findById(aID);
if (_ret != IAPTable.RECORD_NOT_FOUND)
{
- _ac = new AccessPoint(this.iIAPTable.iRecordId,
- this.iIAPTable.iRecordName, this.iIAPTable.iBearerType,
- this.iIAPTable.iServiceType);
+ _ac = new AccessPoint(iIAPTable.iRecordId,
+ iIAPTable.iRecordName, iIAPTable.iBearerType,
+ iIAPTable.iServiceType);
}
- this.iIAPTable.close();
+ iIAPTable.close();
}
catch (CommDBException _exception)
{
- this.iIAPTable.close();
+ iIAPTable.close();
throw new IAPInfoException(_exception.getMessage());
}// end catch
return _ac;
@@ -127,8 +142,19 @@
/**
* Please refer IapInfo Spec.
*/
- public AccessPoint getAccessPoint(String aName) throws IAPInfoException
+ public synchronized AccessPoint getAccessPoint(String aName) throws IAPInfoException
{
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getAccessPoint() - aName = "+aName +" this = "+Thread.currentThread().toString() +"hascode= " +Thread.currentThread().hashCode());
+ IAPTable iIAPTable = null;
+ try
+ {
+ iIAPTable = new IAPTable();
+ }
+ catch (CommDBException e)
+ {
+ e.printStackTrace();
+ throw new IAPInfoException(e.getMessage());
+ }
if (aName == null)
{
throw new IAPInfoException("Parameter is NULL");
@@ -136,57 +162,71 @@
AccessPoint _ac = null;
try
{
- this.iIAPTable.open();
- int _ret = this.iIAPTable.findByName(aName);
+ iIAPTable.open(iSessionHandle);
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getAccessPoint() - aName = after iaptable.open()");
+ int _ret = iIAPTable.findByName(aName);
if (_ret != IAPTable.RECORD_NOT_FOUND)
{
- _ac = new AccessPoint(this.iIAPTable.iRecordId,
- this.iIAPTable.iRecordName, this.iIAPTable.iBearerType,
- this.iIAPTable.iServiceType);
+ _ac = new AccessPoint(iIAPTable.iRecordId,
+ iIAPTable.iRecordName, iIAPTable.iBearerType,
+ iIAPTable.iServiceType);
}
- this.iIAPTable.close();
+ iIAPTable.close();
}
catch (CommDBException _exception)
{
- this.iIAPTable.close();
+ iIAPTable.close();
throw new IAPInfoException(_exception.getMessage());
}// end catch
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "-getAccessPoint() - aName = "+aName);
return _ac;
+//return null;
}
/**
* Please refer IapInfo Spec.
*/
- public AccessPoint getLastUsedAccessPoint() throws IAPInfoException
+ public synchronized AccessPoint getLastUsedAccessPoint() throws IAPInfoException
{
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getLastUsedAccessPoint() " +" this = "+Thread.currentThread().toString() +"hascode= " +Thread.currentThread().hashCode());
+ IAPTable iIAPTable = null;
+ try
+ {
+ iIAPTable = new IAPTable();
+ }
+ catch (CommDBException e)
+ {
+ e.printStackTrace();
+ throw new IAPInfoException(e.getMessage());
+ }
APNControl _control = new APNControl();
int _lastIAP = _control.getLastIAP();
AccessPoint _ac = null;
int _nr_of_access_points = 0;
try
{
- this.iIAPTable.open();
- _nr_of_access_points = this.iIAPTable.getRecordCount();
+ iIAPTable.open(iSessionHandle);
+ _nr_of_access_points = iIAPTable.getRecordCount();
for (int i = 0; i < _nr_of_access_points; i++)
{
- if (this.iIAPTable.iRecordId == _lastIAP)
+ if (iIAPTable.iRecordId == _lastIAP)
{
- _ac = new AccessPoint(this.iIAPTable.iRecordId,
- this.iIAPTable.iRecordName,
- this.iIAPTable.iBearerType,
- this.iIAPTable.iServiceType);
+ _ac = new AccessPoint(iIAPTable.iRecordId,
+ iIAPTable.iRecordName,
+ iIAPTable.iBearerType,
+ iIAPTable.iServiceType);
break;
}// end if
if (i != _nr_of_access_points - 1)
{
- this.iIAPTable.nextRecord();
+ iIAPTable.nextRecord();
}
}// end for
- this.iIAPTable.close();
+ iIAPTable.close();
}
catch (CommDBException _exception)
{
- this.iIAPTable.close();
+ iIAPTable.close();
throw new IAPInfoException(_exception.getMessage());
}
return _ac;
@@ -294,16 +334,27 @@
/**
* Please refer IapInfo Spec.
*/
- public AccessPoint[] getConnectionPreferences() throws IAPInfoException
+ public synchronized AccessPoint[] getConnectionPreferences() throws IAPInfoException
{
ConnectionPreferencesTable _prefTable = null;
AccessPoint[] _ac = null;
+ IAPTable iIAPTable = null;
+ Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "+getConnectionPreferences() " +" this = "+Thread.currentThread().toString() +"hascode= " +Thread.currentThread().hashCode());
+ try
+ {
+ iIAPTable = new IAPTable();
+ }
+ catch (CommDBException e)
+ {
+ e.printStackTrace();
+ throw new IAPInfoException(e.getMessage());
+ }
try
{
_prefTable = new ConnectionPreferencesTable();
- _prefTable.open();
+ _prefTable.open(iSessionHandle);
int recNr = _prefTable.getRecordCount();
HelperObject[] hp = new HelperObject[recNr];
@@ -336,20 +387,20 @@
}// end while
// get the AccesssPoints from IAPTable
- this.iIAPTable.open();
+ iIAPTable.open(iSessionHandle);
Vector apv = new Vector();
for (int i = 0; i < recNr; i++)
{
- // int _ret = this.iIAPTable.findById( ids[ i ] );
- int _ret = this.iIAPTable.findById(hp[i].Id);
+ // int _ret = iIAPTable.findById( ids[ i ] );
+ int _ret = iIAPTable.findById(hp[i].Id);
if (_ret != IAPTable.RECORD_NOT_FOUND)
{
- apv.addElement(new AccessPoint(this.iIAPTable.iRecordId,
- this.iIAPTable.iRecordName,
- this.iIAPTable.iBearerType,
- this.iIAPTable.iServiceType));
+ apv.addElement(new AccessPoint(iIAPTable.iRecordId,
+ iIAPTable.iRecordName,
+ iIAPTable.iBearerType,
+ iIAPTable.iServiceType));
}// end if
}// end for
@@ -359,14 +410,14 @@
_ac[i] = (AccessPoint) apv.elementAt(i);
}
- this.iIAPTable.close();
+ iIAPTable.close();
_prefTable.close();
}
catch (CommDBException e)
{
_prefTable.close();
- this.iIAPTable.close();
+ iIAPTable.close();
throw new IAPInfoException(e.getMessage());
}
return _ac;
@@ -427,4 +478,6 @@
static native String _getDestinationNetworkByName(String aName)
throws IAPInfoException;
+ private native int _createSession();
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/iapinfo/src.s60/iapinfosession.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JavaCommDB class implementation
+ *
+*/
+#include "iapinfosession.h"
+#include "fs_methodcall.h"
+
+#include "logger.h"
+
+using namespace CommsDat;
+
+IapInfoSession::IapInfoSession(): java::util::FunctionServer("MyIapServer")
+{
+ createServerToNewThread();
+
+}
+
+IapInfoSession* IapInfoSession::NewL()
+{
+ LOG(EJavaIapInfo, EInfo, "IapInfoSession + NewL()");
+ IapInfoSession* self = new(ELeave) IapInfoSession();
+ CallMethodL(self, &IapInfoSession::ConstructL,self);
+ return self;
+
+}
+
+void IapInfoSession::ConstructL()
+{
+ iDb = CMDBSession::NewL(KCDVersion1_1);
+
+}
+
--- a/javaextensions/iapinfo/src.s60/javacommdb.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/iapinfo/src.s60/javacommdb.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -24,6 +24,9 @@
#include "logger.h"
#include "javajniutils.h"
+#include "fs_methodcall.h"
+#include "com_nokia_mid_iapinfo_IAPInfoImpl.h"
+
using namespace CommsDat;
using namespace java::util;
@@ -35,49 +38,65 @@
_LIT(KFieldNameRecordId, "RecordId");
_LIT(KFieldNameName, "Name");
+JNIEXPORT jint JNICALL Java_com_nokia_mid_iapinfo_IAPInfoImpl__1createSession
+(JNIEnv *, jobject)
+{
+ IapInfoSession *sess = NULL;
+ TRAPD(err,sess = IapInfoSession::NewL(););
+ if (err!=KErrNone)
+ {
+ return err;
+ }
+ return reinterpret_cast<int>(sess);
+
+}
+
+
JNIEXPORT void JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1destroy(JNIEnv* ,
jclass,
- jint aHandle)
+ jint /*aHandle*/)
{
- LOG1(ESOCKET, EInfo, "CJAVACOMMDB + destroy() handle: %D", aHandle);
- JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- delete commdb;
+ LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + destroy()");
+ // JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
+ // delete commdb;
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - destroy()");
}
-JNIEXPORT jint JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1construct(JNIEnv* ,
- jclass)
+
+JNIEXPORT jint JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1open(JNIEnv* aJni,
+ jclass, jint aSessionHandle,
+ jstring aTableName)
{
- LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + construct()");
- JavaCommDB *cdb = new JavaCommDB();
+ LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + open()gggggggggg");
+ IapInfoSession* session = reinterpret_cast<IapInfoSession *>(aSessionHandle);
+ JavaCommDB *cdb = new JavaCommDB(session);
+ JStringUtils table(*aJni, aTableName);
+ int err = -1;
+ TRAP(err,CallMethodL(cdb, &JavaCommDB::OpenL,table,cdb->iSession););
TInt handle = reinterpret_cast<jint>(cdb);
- LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB - construct() handle: %D", handle);
+ if (err < 0)
+ handle = err;
+ LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - open()hhhhhh");
return handle;
}
-JNIEXPORT jint JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1open(JNIEnv* aJni,
- jclass, jint aHandle,
- jstring aTableName)
-{
- LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + open()");
- JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- JStringUtils table(*aJni, aTableName);
-
- //LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB opening table: %S", table );
- TRAPD(error, commdb->OpenL(table));
- LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - open()");
- return error;
-}
JNIEXPORT void JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1close(JNIEnv* ,
jclass, jint aHandle)
{
LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB + close() handle: %D", aHandle);
JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- TRAP_IGNORE(commdb->Close());
+ CallMethod(commdb, &JavaCommDB::Close,commdb->iSession);
+ //TRAP_IGNORE(commdb->Close());
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - close()");
}
+void JavaCommDB::Destroy(JavaCommDB* aObj)
+{
+ delete aObj;
+
+}
+
JNIEXPORT jint JNICALL Java_com_nokia_mid_iapinfo_CommsTable__1getRecordCount(JNIEnv* ,
jclass,
jint aHandle)
@@ -85,7 +104,8 @@
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + getRecordCount()");
JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
TInt count = 0;
- count = commdb->GetRecordCount();
+ CallMethod(count, commdb, &JavaCommDB::GetRecordCount,commdb->iSession);
+ //count = commdb->GetRecordCount();
LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB returning value: %D", count);
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - getRecordCount()");
return count;
@@ -104,7 +124,9 @@
JStringUtils field(*aJni, aFieldName);
//LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB reading field value: %S", field );
- TRAPD(err, value = commdb->GetIntFieldValueL(field));
+
+ TRAPD(err,CallMethodL(value, commdb, &JavaCommDB::GetIntFieldValueL,field,commdb->iSession););
+ //TRAPD(err, value = commdb->GetIntFieldValueL(field));
// Put the native error code into the Java error array
jint javaError[1] =
@@ -131,7 +153,8 @@
JStringUtils field(*aJni, aFieldName);
//LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB reading field value: %S", field );
- TRAPD(err, value = commdb->GetStringFieldValueL(field));
+ TRAPD(err,CallMethodL(value, commdb, &JavaCommDB::GetStringFieldValueL,field,commdb->iSession););
+ // TRAPD(err, value = commdb->GetStringFieldValueL(field));
if (NULL != value && KErrNone == err)
{
str = S60CommonUtils::NativeToJavaString(*aJni, value->Des());
@@ -153,7 +176,9 @@
{
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + next()");
JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- TInt rec = commdb->Next();
+ TInt rec;
+ CallMethod(rec, commdb, &JavaCommDB::Next,commdb->iSession);
+ //TInt rec = commdb->Next();
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - next()");
return rec;
}
@@ -174,7 +199,8 @@
TInt recId = 0;
JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- recId = commdb->FindById(aId);
+ CallMethod(recId, commdb, &JavaCommDB::FindById,aId,commdb->iSession);
+ //recId = commdb->FindById(aId);
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - findById()");
return recId;
}
@@ -189,7 +215,10 @@
JStringUtils name(*aJni, aName);
JavaCommDB* commdb = reinterpret_cast<JavaCommDB *>(aHandle);
- TRAP(recId, recId = commdb->FindByNameL(name));
+ TRAPD(err,CallMethodL(recId, commdb, &JavaCommDB::FindByNameL,name,commdb->iSession););
+ if (err < KErrNone)
+ recId = err;
+ //TRAP(recId, recId = commdb->FindByNameL(name));
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - findByName()");
return recId;
}
@@ -199,6 +228,13 @@
* ---------------------------------------------------------------------------
*/
+JavaCommDB::JavaCommDB(IapInfoSession *aSession)
+{
+ iSession = aSession;
+
+
+}
+
// ---------------------------------------------------------------------------
// Delete allocated member objects.
// -----------------------------------------------------------------------------
@@ -211,19 +247,18 @@
// ---------------------------------------------------------------------------
// Delete allocated member objects.
-// @return error code
// -----------------------------------------------------------------------------
-TInt JavaCommDB::Close()
+void JavaCommDB::Close()
{
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB + Close()");
iCurrentRecord = 0;
- delete iTable;
+ if (iTable)
+ delete iTable;
+
iTable = NULL;
- delete iDb;
- iDb = NULL;
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - Close()");
- return KErrNone;
+
}
// ---------------------------------------------------------------------------
@@ -234,7 +269,7 @@
void JavaCommDB::OpenL(const TDesC& aTableName)
{
//LOG1(EJavaIapInfo, EInfo, "CJAVACOMMDB + OpenL(): open table: %S", aTableName);
- iDb = CMDBSession::NewL(KCDVersion1_1);
+ //iDb = CMDBSession::NewL(KCDVersion1_1);
iCurrentRecord = 0;
if (0 == aTableName.Compare(KIAPTable))
@@ -259,7 +294,8 @@
"CJAVACOMMDB OpenL(): ConnectionPreferences table opened.");
}
// Load the table
- iTable->LoadL(*iDb);
+
+ iTable->LoadL(*(iSession->iDb));
LOG(EJavaIapInfo, EInfo, "CJAVACOMMDB - OpenL()");
}
--- a/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -193,12 +193,12 @@
JELOG2(EPim);
const CDesCArray& pimCategories = aItem.ItemData().Categories();
const TInt pimCategoryCount = pimCategories.Count();
- TBool* newCategoryTable = new(ELeave) TBool[pimCategoryCount];
- CleanupArrayDeletePushL(newCategoryTable);
+ CArrayFix<TInt>* newCategoryTable = new(ELeave) CArrayFixFlat<TInt> (pimCategoryCount);
+ CleanupStack::PushL(newCategoryTable);
TInt i = 0;
for (i = 0; i < pimCategoryCount; i++)
{
- newCategoryTable[i] = ETrue;
+ newCategoryTable->InsertL(TRUE,i);
}
CContactIdArray* cardCategories = aCard.GroupsJoinedLC();
@@ -220,14 +220,14 @@
}
else
{
- // old group
- newCategoryTable[pos] = EFalse;
+ // old group
+ newCategoryTable->InsertL(FALSE,pos);
}
}
// then add new categories
for (i = 0; i < pimCategoryCount; i++)
{
- if (newCategoryTable[i])
+ if (newCategoryTable->At(i))
{
TPtrC category = pimCategories[i];
iCategoryManager.AddToGroupL(id, category);
--- a/javaextensions/satsa/build/javasatsa.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/satsa/build/javasatsa.pro Mon Aug 23 14:24:31 2010 +0300
@@ -62,10 +62,8 @@
-lcertstore \
-lcharconv \
-lcms \
- -laknnotify \
-leiksrv \
-lctframework \
- -lctsecdlgs \
-lcustomapi \
-lefsrv \
-letel \
@@ -78,6 +76,15 @@
-lcryptography \
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+ LIBS += -laknnotify \
+ -lctsecdlgs \
+ }
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2) {
+ LIBS += -laknnotify \
+ -lctsecdlgs \
+ }
+
}
include(../../../build/omj.pri)
--- a/javaextensions/satsa/pki/src.s60/cstscredentialmanager.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstscredentialmanager.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -32,10 +32,15 @@
#include <charconv.h>
#include <pkcs10.h>
#include <secdlg.h>
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
#include <PKIDlg.h>
+#endif
+
#include <securityerr.h>
+
// CONSTANTS
_LIT(KSTSSymbianKeyStoreLabel, "Software key store");
_LIT(KSTSSymbianCertificateStoreLabel, "Software certificate store");
@@ -66,7 +71,12 @@
{
delete iEncodedCert;
delete iIssuerAndSerialNumber;
-
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ if (iPKIDialog)
+ {
+ iPKIDialog->Release();
+ }
+#endif
delete iDistinguishedName;
delete iDisplayName;
delete iRequestEncoded;
@@ -529,7 +539,9 @@
//
void CSTSCredentialManager::ConstructL()
{
-
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog = PKIDialogFactory::CreateNoteL();
+ #endif
User::LeaveIfError(iFileServer.Connect());
iWait = new(ELeave) CActiveSchedulerWait;
iStore = CUnifiedCertStore::NewL(iFileServer, ETrue);
@@ -614,7 +626,10 @@
{
// not found, ok to add
iState = EAddDialog;
-
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->SaveCertificate(EX509Certificate, EUserCertificate,
+ iSubject, iStatus);
+ #endif
SetActive();
return;
}
@@ -714,8 +729,9 @@
CCTCertInfo* certInfo = (*iCertInfoArray)[ 0 ];
iState = ERemoveDialog;
iHandle = certInfo->Handle();
-
-
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->DeleteCertificate(iHandle, iStatus);
+ #endif
SetActive();
}
@@ -777,8 +793,9 @@
}
iState = ECSRDialog;
iHandle = iKeyInfo->Handle();
-
-
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->CreateCSR(*iDisplayName, iHandle, iStatus);
+ #endif
SetActive();
}
@@ -1022,5 +1039,3 @@
FunctionServer::doServerSideInit();
}
-
-
--- a/javaextensions/satsa/pki/src.s60/cstscredentialmanager.h Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstscredentialmanager.h Mon Aug 23 14:24:31 2010 +0300
@@ -31,7 +31,9 @@
// FORWARD DECLARATIONS
class CCTKeyInfo;
-
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+class MPKIDialog;
+#endif
class CUnifiedCertStore;
class CUnifiedKeyStore;
class CX500DistinguishedName;
@@ -348,7 +350,11 @@
// internal error variable
TInt iError;
-
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ // PKI Dialog, owned
+ MPKIDialog* iPKIDialog;
+#endif
// The actual store, owned
CUnifiedCertStore* iStore;
--- a/javaextensions/sensor/src.s60/cnetworkfieldintensitysensor.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/sensor/src.s60/cnetworkfieldintensitysensor.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -146,15 +146,16 @@
SensorData* data = iData[ KNISensorChannel ];
TTime currentTime;
- if (data->iTimeStamps || (iBufferingPeriod > 0))
- {
- currentTime.UniversalTime();
- if (iStartTime == KErrNotFound)
+
+ if ((data->iTimeStampsIncluded) || (iBufferingPeriod > 0))
{
- iStartTime = currentTime;
+ currentTime.UniversalTime();
+ if (iStartTime == KErrNotFound)
+ {
+ iStartTime = currentTime;
+ }
}
- }
-
+
// P&S sensors are assumed to have one channel only
TInt interpretedValue = InterpretValue(aLevel);
--- a/javaextensions/sensor/src.s60/csensorbase.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaextensions/sensor/src.s60/csensorbase.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -249,14 +249,13 @@
matched = ETrue;
CSensorConditionBase *condition = iConditions[i];
iConditions.Remove(i);
- if (iSensorListener)
- {
- iSensorListener->ConditionMet(
- condition,
- condition->GetChannelId(),
- currentValue,
- javaTime);
- }
+
+ iSensorListener->ConditionMet(
+ condition,
+ condition->GetChannelId(),
+ currentValue,
+ javaTime);
+
delete condition;
}
}
@@ -264,6 +263,7 @@
// Also send all values separately if we have java side custom conditions
if (iJavaConditionEval)
{
+ if (iSensorListener != NULL)
iSensorListener->ConditionMet(0, aChannelId, currentValue, javaTime);
}
return matched;
--- a/javamanager/javacaptain/build/javacaptain.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javacaptain/build/javacaptain.pro Mon Aug 23 14:24:31 2010 +0300
@@ -35,7 +35,7 @@
LIBS += -ljavacomms -ljavaipc -ljavafileutils -ljavastorage
symbian {
- LIBS += -lefsrv -lAknNotify
+ LIBS += -lefsrv
TARGET.EPOCHEAPSIZE = 0x2800 0x100000
TARGET.EPOCSTACKSIZE = 0x2000
TARGET.UID2 = 0x200211DC
--- a/javamanager/javacaptain/inc.s60/pmc.h Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javacaptain/inc.s60/pmc.h Mon Aug 23 14:24:31 2010 +0300
@@ -23,9 +23,6 @@
#include <map>
-#include <AknGlobalNote.h>
-
-
#include "javaoslayer.h"
#include "logger.h"
#include "scopedlocks.h"
@@ -143,13 +140,6 @@
void showErrorNote()
{
LOG(EJavaCaptain, EInfo, "Process failed to exit gracefully");
-#ifdef RD_JAVA_EXIT_ERROR_DIALOG
- //Print the dialog showing that force process kill was done.
- CAknGlobalNote* globalNote = CAknGlobalNote::NewL();
- globalNote->ShowNoteL(EAknGlobalErrorNote,
- _L("Midp process failed to exit gracefully."));
- delete globalNote;
-#endif
}
private:
--- a/javamanager/javainstaller/appinstuiplugin/src/javainstalllauncher.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/appinstuiplugin/src/javainstalllauncher.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -26,7 +26,7 @@
#include <CUIUtils.h>
#include <eikenv.h>
-#include <SisxUIData.rsg>
+#include <sisxuidata.rsg>
#include <javadomainpskeys.h>
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/GetComponentInfo.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/GetComponentInfo.java Mon Aug 23 14:24:31 2010 +0300
@@ -480,11 +480,20 @@
suiteUid, null,
iSecurityAttributes.getAuthenticationAttributes());
+ if (authenticationCredentials != null)
+ {
+ for (int i = 0; i < authenticationCredentials.length; i++)
+ {
+ String domain = authenticationCredentials[i]
+ .getProtectionDomainCategory();
+ Log.log("Protection domain: " + domain);
+ }
+ }
if (iJarFilename != null)
{
// Authenticate jar.
AuthenticationModule.getInstance().authenticateJar(
- null, suiteUid, null, iJarFilename,
+ suiteUid, null, iJarFilename,
FileUtils.isDrmProtected(iJarFilename));
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Mon Aug 23 14:24:31 2010 +0300
@@ -596,6 +596,8 @@
StopApplication());
// Update new application info in the following steps.
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
+ AddSecurityData());
+ table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
AddToStorage());
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
RegisterPush());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/AddSecurityData.java Mon Aug 23 14:24:31 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.midp2.install.steps;
+
+import com.nokia.mj.impl.installer.exetable.ExeBall;
+import com.nokia.mj.impl.installer.exetable.ExeStep;
+import com.nokia.mj.impl.installer.utils.Log;
+import com.nokia.mj.impl.security.midp.authentication.AuthenticationModule;
+import com.nokia.mj.impl.security.midp.authorization.PermissionGranter;
+
+/**
+ * Writes application's security data into storage.
+ */
+public class AddSecurityData extends ExeStep
+{
+ public void execute(ExeBall aBall)
+ {
+ InstallBall ball = (InstallBall)aBall;
+ ball.log("Writing security data...");
+ AuthenticationModule.getInstance().addSecurityData
+ (ball.iStorageHandler.getSession(), ball.iSuite.getUid(),
+ (ball.iOldSuite != null? ball.iOldSuite.getUid(): null));
+ PermissionGranter.getInstance().addSecurityData
+ (ball.iStorageHandler.getSession(), ball.iSuite.getUid(),
+ (ball.iOldSuite != null? ball.iOldSuite.getUid(): null));
+ }
+
+ public void cancel(ExeBall aBall)
+ {
+ // nop
+ }
+}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/AuthenticateJar.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/AuthenticateJar.java Mon Aug 23 14:24:31 2010 +0300
@@ -35,12 +35,12 @@
}
ball.log("Authenticating Jar...");
- AuthenticationModule.getInstance().authenticateJar
- (ball.iStorageHandler.getSession(),
- ball.iSuite.getUid(),
- (ball.iOldSuite != null? ball.iOldSuite.getUid(): null),
- ball.iJarFilename,
- (ball.iSuite.getContentInfo() == SuiteInfo.CONTENT_INFO_DRM? true: false));
+ ball.iAuthenticationCredentials =
+ AuthenticationModule.getInstance().authenticateJar
+ (ball.iSuite.getUid(),
+ (ball.iOldSuite != null? ball.iOldSuite.getUid(): null),
+ ball.iJarFilename,
+ (ball.iSuite.getContentInfo() == SuiteInfo.CONTENT_INFO_DRM? true: false));
ball.iJarAuthenticated = true;
// Unregister OCSP listener after Jar authentication.
AuthenticationModule.getInstance().unregisterOcspEventListener(
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java Mon Aug 23 14:24:31 2010 +0300
@@ -38,7 +38,6 @@
// the installation drive. This is needed to determine
// if tamper detection is needed.
AuthenticationModule.getInstance().setMediaId(
- ball.iStorageHandler.getSession(),
ball.iSuite.getUid(), ball.iSuite.getMediaId());
// Application package scanning must be skipped if instructed so
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/GrantJarPermissions.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/GrantJarPermissions.java Mon Aug 23 14:24:31 2010 +0300
@@ -45,9 +45,10 @@
}
ball.iSecurityAttributes.addManifestAttributes(ball.iJarAttributes);
PermissionGranter.getInstance().grantJarPermissions
- (ball.iStorageHandler.getSession(), ball.iSuite.getUid(),
+ (ball.iSuite.getUid(),
(ball.iOldSuite != null? ball.iOldSuite.getUid(): null),
- ball.iSecurityAttributes.getPermissionAttributes());
+ ball.iSecurityAttributes.getPermissionAttributes(),
+ ball.iAuthenticationCredentials);
ball.iJarPermissionsGranted = true;
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java Mon Aug 23 14:24:31 2010 +0300
@@ -102,6 +102,11 @@
}
for (int i = 1; true; i++)
{
+ if (apps.size() < i)
+ {
+ break;
+ }
+
String attrName = "Nokia-MIDlet-Auto-Start-" + i;
String attrValue = aBall.getAttributeValue(attrName);
@@ -122,9 +127,12 @@
if (attrValue != null)
{
- if (apps.size() < i)
+ if (!aBall.attributeExistsInJar(attrName))
{
- break;
+ // The attribute is only in .jad, ignore it.
+ Log.logWarning("Attribute " + attrName +
+ " ignored because it is not in Manifest");
+ continue;
}
// Check if MIDlet has permission for Auto-start
@@ -171,10 +179,6 @@
OtaStatusCode.INVALID_JAR));
}
}
- else
- {
- break;
- }
}
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/AutoStartPermission.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/AutoStartPermission.java Mon Aug 23 14:24:31 2010 +0300
@@ -75,6 +75,10 @@
*/
public boolean equals(Object obj)
{
+ if (!(obj instanceof AutoStartPermission))
+ {
+ return false;
+ }
return (obj.hashCode() == hashCode());
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/rt/installer/ApplicationUtilsImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -173,7 +173,9 @@
{
if (iSilent)
{
- // Do not prompt the user in case of silent installation.
+ // Do not prompt the user in case of silent installation
+ // -> don't enforce security, just query the permission
+ // to see if it is not allowed
int permissionResult =
iAccessController.checkPermission(aPermission.toString());
Log.log("ApplicationUtilsImpl.checkPermission: appUid: " +
@@ -188,7 +190,8 @@
}
else
{
- // Not a silent installation, display user prompt.
+ // Not a silent installation -> enforce security (an user
+ // prompt might be displayed)
iAccessController.checkPermission(aPermission);
Log.log("ApplicationUtilsImpl.checkPermission: appUid: " +
aAppUid + ", " + aPermission.toString() + " ok");
@@ -196,15 +199,17 @@
}
else
{
- // No user prompt allowed for this permission.
+ // No user prompt allowed for this permission -> don't enforce
+ // security, just query the permission to see if it is not
+ // allowed
int permissionResult =
iAccessController.checkPermission(aPermission.toString());
Log.log("ApplicationUtilsImpl.checkPermission: appUid: " +
aAppUid + ", " + aPermission.toString() +
" result " + permissionResult);
- if (permissionResult <= 0)
+ if (permissionResult == 0)
{
- // Permission is either denied or requires user prompt.
+ // Permission is denied
throw new AccessControlException(
"Permission " + aPermission.toString() + " not allowed");
}
--- a/javamanager/javainstaller/installer/src.s60/utils/sysutil.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/utils/sysutil.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -93,8 +93,8 @@
TUid repositoryUid = { aRepository };
CRepository* repository = CRepository::NewLC(repositoryUid);
RBuf buf;
- buf.Create(NCentralRepositoryConstants::KMaxUnicodeStringLength);
CleanupClosePushL(buf);
+ buf.CreateL(NCentralRepositoryConstants::KMaxUnicodeStringLength);
TInt err = repository->Get(aKey, buf) ;
if (KErrNone == err)
{
--- a/javamanager/javainstaller/installer/tsrc/testdata/installerengine/HelloWorld_3_midlets.jad Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/testdata/installerengine/HelloWorld_3_midlets.jad Mon Aug 23 14:24:31 2010 +0300
@@ -9,8 +9,8 @@
Nokia-MIDlet-UID-1: 0xefef0001
Nokia-MIDlet-UID-3: 0xefef0003
Nokia-MIDlet-On-Screen-Keypad: no
-Nokia-MIDlet-Auto-Start-1: true
-Nokia-MIDlet-Auto-Start-2: false
+Nokia-MIDlet-auto-start: true
+Nokia-MIDlet-auto-start-2: false
Nokia-MIDlet-Auto-Start-3: once
MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=CE00C90A2EF00F07C210A061BD15A4EC&tID=900_success
MIDlet-Delete-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=CE00C90A2EF00F07C210A061BD15A4EC&tID=912_deletion_notification
--- a/javamanager/javaqtrequest/src.s60/requestapp.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javaqtrequest/src.s60/requestapp.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -39,7 +39,8 @@
QUrl uri(uriString);
XQApplicationManager appMgr;
- XQAiwRequest *request = appMgr.create(uri);
+ // Make the request in non-embedded mode
+ XQAiwRequest *request = appMgr.create(uri, false);
if (!request)
{
// No handlers for the URI
--- a/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro Mon Aug 23 14:24:31 2010 +0300
@@ -21,8 +21,8 @@
TRANSLATIONS = javaruntimeapplicationsettings.ts
INCLUDEPATH += ../../../inc
-SOURCES += ..\src\javaapplicationsettingsview.cpp ..\src\javaapplicationsettingsview_p.cpp ..\src\javaapplicationsettings.cpp
-HEADERS += ..\src\javaapplicationsettingsview.h ..\src\javaapplicationsettingsview_p.h ..\src\javaapplicationsettings.h
+SOURCES += ../src/javaapplicationsettingsview.cpp ../src/javaapplicationsettingsview_p.cpp ../src/javaapplicationsettings.cpp
+HEADERS += ../src/javaapplicationsettingsview.h ../src/javaapplicationsettingsview_p.h ../src/javaapplicationsettings.h
symbian : plugin {
TARGET.EPOCALLOWDLLDATA = 1
--- a/javaruntimes/jvmargmodifier/file/build/javajvmargsmodifierfile.pro Thu Aug 05 16:07:57 2010 +0300
+++ b/javaruntimes/jvmargmodifier/file/build/javajvmargsmodifierfile.pro Mon Aug 23 14:24:31 2010 +0300
@@ -21,8 +21,4 @@
LIBS += -ljavafileutils
-symbian {
-LIBS += -laknnotify
-}
-
include(../../../../build/omj.pri)
--- a/javaruntimes/jvmargmodifier/file/src/jvmargsmodifier.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javaruntimes/jvmargmodifier/file/src/jvmargsmodifier.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: A default empty implementation for JvmArgs modifier.
+* Description: A file argument reader implementation for JvmArgs modifier.
*
*/
@@ -23,33 +23,17 @@
#include "jvmargsfilereader.h"
#include "argsmodifier.h"
-#ifdef __SYMBIAN32__
-#include <AknGlobalNote.h>
-_LIT(KArgsTxt, "Note! Modified VM arguments used!");
-#endif
-
void logArguments(std::wstring aArg)
{
WLOG1(EJavaRuntime, " '%S'", aArg.c_str());
}
-#ifdef __SYMBIAN32__
-void showWarningDialogL()
-{
- ::CAknGlobalNote* globalNote = CAknGlobalNote::NewL();
- CleanupStack::PushL(globalNote);
- globalNote->ShowNoteL(EAknGlobalInformationNote, KArgsTxt);
- CleanupStack::PopAndDestroy(globalNote);
-}
-#endif
-
-
OS_EXPORT
void java::runtime::modifyJvmArguments(const std::wstring& aIdentifier,
std::list<std::wstring>& aJvmArgs,
std::list<std::wstring>& aApplicationAndArgs)
{
- JELOG2(EJavaRuntime);
+ PLOG(EJavaRuntime, "JVM File Argument modifier in use");
#ifdef __SYMBIAN32__
// Open the extension directory of the J9 VM.
@@ -70,9 +54,6 @@
std::for_each(aJvmArgs.begin(), aJvmArgs.end(), logArguments);
WLOG(EJavaRuntime, "new App arguments");
std::for_each(aApplicationAndArgs.begin(), aApplicationAndArgs.end(), logArguments);
-#ifdef __SYMBIAN32__
- TRAP_IGNORE(showWarningDialogL());
-#endif
}
}
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/utils/CmdLineArgsPermission.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/utils/CmdLineArgsPermission.java Mon Aug 23 14:24:31 2010 +0300
@@ -77,6 +77,10 @@
*/
public boolean equals(Object obj)
{
+ if (!(obj instanceof CmdLineArgsPermission))
+ {
+ return false;
+ }
return (obj.hashCode() == hashCode());
}
--- a/javatools/javacontrolpanel/controlpanel/javasrc/com/nokia/mj/impl/rt/javacontrolpanel/ApplicationUtilsImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javatools/javacontrolpanel/controlpanel/javasrc/com/nokia/mj/impl/rt/javacontrolpanel/ApplicationUtilsImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -20,6 +20,7 @@
import com.nokia.mj.impl.rt.support.ApplicationInfo;
import com.nokia.mj.impl.rt.support.ApplicationUtils;
import com.nokia.mj.impl.utils.Uid;
+import com.nokia.mj.impl.utils.Logger;
import java.security.Permission;
import java.security.AccessControlException;
@@ -39,6 +40,8 @@
public void notifyExitCmd()
{
+ Logger.ILOG(Logger.EUtils, "notifyExitCmd() - exiting");
+ System.exit(0);
}
public void checkPermission(Permission aPermission)
--- a/javatools/tckrunner/runner/javasrc/com/nokia/mj/impl/rt/tckrunner/ApplicationUtilsImpl.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javatools/tckrunner/runner/javasrc/com/nokia/mj/impl/rt/tckrunner/ApplicationUtilsImpl.java Mon Aug 23 14:24:31 2010 +0300
@@ -20,6 +20,7 @@
import com.nokia.mj.impl.rt.support.ApplicationInfo;
import com.nokia.mj.impl.rt.support.ApplicationUtils;
import com.nokia.mj.impl.utils.Uid;
+import com.nokia.mj.impl.utils.Logger;
import java.security.Permission;
import java.security.AccessControlException;
@@ -39,6 +40,8 @@
public void notifyExitCmd()
{
+ Logger.ILOG(Logger.ETckRunner, "notifyExitCmd() - exiting");
+ System.exit(0);
}
public void checkPermission(Permission aPermission)
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/TextExtension.java Mon Aug 23 14:24:31 2010 +0300
@@ -342,8 +342,8 @@
String fetchEmail() {
int serviceRequest = OS.XQServiceRequest_new(
- "com.nokia.services.phonebookservices.Fetch",
- "fetch(QString,QString,QString)", false);
+ "phonebookservices.com.nokia.symbian.IContactsFetch",
+ "singleFetch(QString,QString)", false);
if (serviceRequest <= 0) {
return null;
}
@@ -370,8 +370,8 @@
QObjectDeleteWrapper.deleteSafely(handler);
QObjectDeleteWrapper.deleteSafely(serviceRequest);
return email;
- }
- }
+ }
+ }
QObjectDeleteWrapper.deleteSafely(handler);
QObjectDeleteWrapper.deleteSafely(serviceRequest);
return null;
@@ -380,8 +380,8 @@
String getPhoneNumber() {
int serviceRequest = OS.XQServiceRequest_new(
- "com.nokia.services.phonebookservices.Fetch",
- "fetch(QString,QString,QString)", false);
+ "phonebookservices.com.nokia.symbian.IContactsFetch",
+ "singleFetch(QString,QString)", false);
if (serviceRequest <= 0) {
return null;
}
@@ -658,6 +658,7 @@
void qt_signal_requestCompleted( int value ) {
+ System.out.println("qt_signal_requestCompleted "+value);
if (value < 1) {
serviceDone = true;
return;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp Thu Aug 05 16:07:57 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp Mon Aug 23 14:24:31 2010 +0300
@@ -11465,7 +11465,7 @@
JNIEXPORT void JNICALL OS_NATIVE( XQServiceRequest_1swt_1setArgumentsForFetchEmail )
#ifdef __SYMBIAN32__
-(JNIEnv* aJniEnv, jclass, jint aHandle, jstring aTitle, jstring aAction, jstring aFilter)
+(JNIEnv* aJniEnv, jclass, jint aHandle, jstring aTitle, jstring aAction, jstring)
#else
(JNIEnv* aJniEnv, jclass, jint, jstring, jstring, jstring)
#endif
@@ -11478,7 +11478,6 @@
XQServiceRequest* request = reinterpret_cast<XQServiceRequest*>(aHandle);
*request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle);
*request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aAction);
- *request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aFilter);
}
SWT_CATCH
#endif
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Mon Aug 23 14:24:31 2010 +0300
@@ -53,12 +53,10 @@
*/
static final int UPDATE_MAXVALUE = UPDATE_ITEM_MAX << 1;
static final int UPDATE_VALUE = UPDATE_ITEM_MAX << 2;
-
private int maxValue;
private int value;
private boolean interactive;
- private boolean isGaugeCreation;
/**
* Constructor.
@@ -68,75 +66,12 @@
* @param maxVal the maximum value.
* @param initVal the initial value.
*/
- public Gauge(String name, boolean interactive, int maxVal, int initVal)
- {
- setLabel(name);
- isGaugeCreation = true;
- this.interactive = interactive;
- setMaxValue(maxVal);
- setValue(initVal);
- isGaugeCreation = false;
- }
-
- /**
- * Check value validity.
- *
- * @param value the value.
- * @param maxVal the maximum value.
- * @return validated value.
- */
- private int checkValue(int value, int maxVal)
+ public Gauge(String aName, boolean aInteractive, int aMaxVal, int aInitVal)
{
- if(maxVal == INDEFINITE)
- {
- if(isGaugeCreation)
- {
- switch(value)
- {
- case CONTINUOUS_IDLE:
- case INCREMENTAL_IDLE:
- case CONTINUOUS_RUNNING:
- case INCREMENTAL_UPDATING:
- break;
- default:
- throw new IllegalArgumentException(
- MsgRepository.GAUGE_EXCEPTION_INVALID_VALUE);
- }
-
- return value;
- }
- else
- {
- return CONTINUOUS_IDLE;
- }
- }
- else
- {
- // make sure the value is in [0, maxValue] range
- value = (value < 0 ? 0 : value);
- value = (value > maxVal ? maxVal : value);
- return value;
- }
- }
-
- /**
- * Check maximum value validity.
- *
- * @param maxVal the maximum value.
- * @param interactive is interactive.
- * @return validated maximum value.
- */
- private static int checkMaxValue(int maxVal, boolean interactive)
- {
- if(interactive)
- {
- if(maxVal <= 0)
- {
- throw new IllegalArgumentException(
- MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
- }
- }
- return maxVal;
+ maxValue = validateMaxValue(aMaxVal, aInteractive);
+ value = validateValue(aInitVal, maxValue);
+ interactive = aInteractive;
+ setLabel(aName);
}
/**
@@ -144,7 +79,7 @@
*
* @param value New value. Must be between zero and maxvalue inclusive.
*/
- public void setValue(int value)
+ public void setValue(int aValue)
{
// TODO: eSWT support required
/*
@@ -152,7 +87,7 @@
* indefinite, we should update Gauge when this method is called, but
* that requires eSWT extension.
*/
- this.value = checkValue(value, this.maxValue);
+ value = validateValue(aValue, maxValue);
updateParent(UPDATE_VALUE);
}
@@ -171,10 +106,11 @@
*
* @param maxValue the maximum value.
*/
- public void setMaxValue(int maxValue)
+ public void setMaxValue(int aMaxValue)
{
- this.maxValue = checkMaxValue(maxValue, interactive);
- this.value = checkValue(getValue(), this.maxValue);
+ int oldMaxValue = maxValue;
+ maxValue = validateMaxValue(aMaxValue, interactive);
+ value = validateValue(getValue(), maxValue, oldMaxValue);
updateParent(UPDATE_MAXVALUE);
}
@@ -199,6 +135,147 @@
}
/**
+ * Check maximum value validity.
+ *
+ * @param aMaxVal the maximum value.
+ * @param aInteractive is interactive.
+ * @return validated maximum value.
+ */
+ private int validateMaxValue(int aMaxVal, boolean aInteractive)
+ {
+ if((!aInteractive) && (aMaxVal == INDEFINITE))
+ {
+ return aMaxVal;
+ }
+
+ if(aMaxVal <= 0)
+ {
+ throw new IllegalArgumentException(
+ MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
+ }
+
+ return aMaxVal;
+ }
+
+ /**
+ * Check value validity.
+ *
+ * @param aValue the value.
+ * @param aMaxVal the maximum value.
+ * @return validated value.
+ */
+ private int validateValue(int aValue, int aMaxVal)
+ {
+ if (aMaxVal == INDEFINITE)
+ {
+ switch (aValue)
+ {
+ case CONTINUOUS_IDLE:
+ case INCREMENTAL_IDLE:
+ case CONTINUOUS_RUNNING:
+ case INCREMENTAL_UPDATING:
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+ return aValue;
+ }
+ else
+ {
+ return clampValue(aValue, aMaxVal);
+ }
+ }
+
+ /**
+ * Check value validity.
+ *
+ * @param aValue the value.
+ * @param aNewMaxVal the new maximum value.
+ * @param aOlddMaxVal the old maximum value.
+ * @return validated value.
+ */
+ private int validateValue(int aValue, int aNewMaxVal, int aOlddMaxVal)
+ {
+ if (aNewMaxVal == INDEFINITE)
+ {
+ return CONTINUOUS_IDLE;
+ }
+ else if (aOlddMaxVal == INDEFINITE)
+ {
+ return 0;
+ }
+ else
+ {
+ return clampValue(aValue, aNewMaxVal);
+ }
+ }
+
+ /**
+ * Validates the value against the range.
+ *
+ * @param aValue the value.
+ * @param aMaxVal the maximum value.
+ * @return validated value.
+ */
+ private static int clampValue(int aValue, int aMaxVal)
+ {
+ aValue = Math.min(aValue, aMaxVal);
+ aValue = Math.max(aValue, 0);
+ return aValue;
+ }
+
+ /**
+ * @return if the Gauge is indefinite.
+ */
+ boolean isIndefinite()
+ {
+ return (maxValue == INDEFINITE);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.lcdui.Item#isFocusable()
+ */
+ boolean isFocusable()
+ {
+ return (isInteractive() || (getNumCommands() > 0));
+ }
+
+ /**
+ * Returns if this indicator meets the restrictions for its use in an Alert.
+ */
+ boolean isSuitableForAlert()
+ {
+ return (!isInteractive()
+ && getParent() == null
+ && getLabel() == null
+ && getLayout() == Item.LAYOUT_DEFAULT
+ && !isSizeLocked()
+ && getNumCommands() == 0
+ && getItemCommandListener() == null);
+ }
+
+ /**
+ * Called by widget listeners to update Item value.
+ */
+ void internalSetValue(int newValue)
+ {
+ value = validateValue(newValue, maxValue);
+ updateParent(UPDATE_VALUE);
+ // notify item state listener
+ notifyStateChanged();
+ }
+
+ /**
+ * Return layout with optional custom flags.
+ *
+ * @return layout directive
+ */
+ int internalGetLayout()
+ {
+ return super.internalGetLayout() | Item.LAYOUT_NEWLINE_BEFORE;
+ }
+
+ /**
* Updates Form or Alert.
*
* @see javax.microedition.lcdui.Item#updateParent(int)
@@ -235,54 +312,5 @@
return GaugeLayouter.calculatePreferredBounds(this);
}
- /**
- * Called by widget listeners to update Item value.
- */
- void internalSetValue(int newValue)
- {
- this.value = checkValue(newValue, this.maxValue);
- // notify item state listener
- notifyStateChanged();
- }
-
- /**
- * Return layout with optional custom flags.
- *
- * @return layout directive
- */
- int internalGetLayout()
- {
- return super.internalGetLayout() | Item.LAYOUT_NEWLINE_BEFORE;
- }
+}
- /**
- * @return if the Gauge is indefinite.
- */
- boolean isIndefinite()
- {
- return (maxValue == INDEFINITE);
- }
-
- /**
- * Returns if this indicator meets the restrictions for its use in an Alert.
- */
- boolean isSuitableForAlert()
- {
- return (!isInteractive()
- && getParent() == null
- && getLabel() == null
- && getLayout() == Item.LAYOUT_DEFAULT
- && !isSizeLocked()
- && getNumCommands() == 0
- && getItemCommandListener() == null);
- }
-
- /* (non-Javadoc)
- * @see javax.microedition.lcdui.Item#isFocusable()
- */
- boolean isFocusable()
- {
- return (isInteractive() || (getNumCommands() > 0));
- }
-
-}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java Mon Aug 23 14:24:31 2010 +0300
@@ -20,10 +20,13 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.*;
-
import org.eclipse.swt.layout.*;
import org.eclipse.swt.internal.extension.Style;
+import org.eclipse.ercp.swt.mobile.CaptionedControl;
+
+
/**
* Class for layouting gauges.
*/
@@ -33,7 +36,10 @@
/**
* Key name for selection listener.
*/
- private static final String SELECTION_LISTENER = "selection";
+ private static final String SELECTION_LISTENER = "SelectionListener";
+ private static final String MAX_LABEL_DATA = "MaxLabel";
+ private static final String CURRENT_LABEL_DATA = "CurrentLabel";
+
/**
* Constructor.
@@ -61,53 +67,47 @@
Gauge gauge = (Gauge) item;
// create an owning composite every time
Composite comp = new Composite(parent, SWT.NONE);
+ FormLayout layout = new FormLayout();
+ comp.setLayout(layout);
if(gauge.isInteractive())
{
- FormLayout layout = new FormLayout();
- layout.marginBottom = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTBOTTOMMARGIN);
- layout.marginTop = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTTOPMARGIN);
- layout.marginLeft = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTLEFTMARGIN);
- layout.marginRight = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTRIGHTMARGIN);
- layout.spacing = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTVERTICALSPACING);
- comp.setLayout(layout);
-
- // Current Value - Mutable Value
+ //Current Value Label
Label currentlabel = new Label(comp, SWT.WRAP);
currentlabel.setText(Integer.toString(gauge.getValue()));
currentlabel.setAlignment(SWT.LEAD);
-
+ currentlabel.setData(CURRENT_LABEL_DATA, CURRENT_LABEL_DATA);
+ //Current Value Label Data
FormData currLabelData = new FormData();
currLabelData.left = new FormAttachment(0);
currentlabel.setLayoutData(currLabelData);
-
+ //Slider
Slider slider = new Slider(comp, SWT.HORIZONTAL);
slider.setMinimum(0);
- slider.setMaximum(gauge.getMaxValue() + 1);
+ slider.setMaximum(gauge.getMaxValue());
slider.setSelection(gauge.getValue());
slider.setIncrement(1);
slider.setPageIncrement(1);
-
- FormData SliderLayoutData = new FormData();
- SliderLayoutData.right = new FormAttachment(100);
- SliderLayoutData.left = new FormAttachment(currentlabel);
- slider.setLayoutData(SliderLayoutData);
-
- // Min Value
+ //Slider Data
+ FormData sliderLayoutData = new FormData();
+ sliderLayoutData.right = new FormAttachment(100);
+ sliderLayoutData.left = new FormAttachment(currentlabel);
+ slider.setLayoutData(sliderLayoutData);
+ //Min Value Label
Label minlabel = new Label(comp, SWT.WRAP);
minlabel.setText("0");
minlabel.setAlignment(SWT.LEAD);
-
+ //Min Value Label Data
FormData minLabelData = new FormData();
minLabelData.left = new FormAttachment(slider, 0, SWT.LEFT);
minLabelData.top = new FormAttachment(slider);
minlabel.setLayoutData(minLabelData);
-
- // Max Value
+ //Max Value Label
Label maxlabel = new Label(comp, SWT.WRAP);
maxlabel.setText(Integer.toString(gauge.getMaxValue()));
maxlabel.setAlignment(SWT.LEAD);
-
+ maxlabel.setData(MAX_LABEL_DATA, MAX_LABEL_DATA);
+ //Max Value Label Data
FormData maxLabelData = new FormData();
maxLabelData.right = new FormAttachment(slider, 0, SWT.RIGHT);
maxLabelData.top = new FormAttachment(slider);
@@ -127,26 +127,24 @@
SWT.HORIZONTAL | SWT.INDETERMINATE);
break;
case Gauge.CONTINUOUS_RUNNING:
- // Gauge like busy-state indicator:
+ // Gauge like busy-state indicator with continuous activity:
progressBar = new ProgressBar(comp,
SWT.HORIZONTAL | SWT.INDETERMINATE);
break;
case Gauge.INCREMENTAL_IDLE:
// TODO: eSWT support required
- // Gauge like INCREMENTAL_UPDATING, but no activity.
+ // Gauge like icremental updating, but no activity.
progressBar = new ProgressBar(comp,
SWT.HORIZONTAL | SWT.INDETERMINATE);
break;
case Gauge.INCREMENTAL_UPDATING:
// TODO: eSWT support required
- // Gauge which is updated on calling Gauge.setValue().
+ //Gauge like icremental updating, with indefinite activity.
progressBar = new ProgressBar(comp,
SWT.HORIZONTAL | SWT.INDETERMINATE);
break;
default:
- // This is error and will cause NullPointerException
- // later in this method. Gauge-class takes care that
- // this is never executed.
+ // This is invalid case and should never occur, as Gauge should take care of it.
Logger.warning("Unexpected gauge value: " + gauge.getValue());
break;
}
@@ -154,24 +152,68 @@
else
{
progressBar = new ProgressBar(comp, SWT.HORIZONTAL);
- progressBar.setMaximum(gauge.getMaxValue() + 1);
+ progressBar.setMaximum(gauge.getMaxValue());
progressBar.setSelection(gauge.getValue());
}
+
+ if(progressBar != null)
+ {
+ FormData progressBarData = new FormData();
+ progressBarData.left = new FormAttachment(0);
+ progressBarData.right = new FormAttachment(100);
+ progressBar.setLayoutData(progressBarData);
+ }
+ }
+ parent.pack();
+ return parent;
+ }
+
+ /**
+ * returns the matching data Label of Gauge control.
+ */
+ Label eswtGetDataLabel(Control control, String data)
+ {
+ Control ret = null;
+
+ if(control instanceof Label)
+ {
+ if(data.equals((String)control.getData(data)))
+ ret = control;
+ }
+ else if(control instanceof Composite)
+ {
+ Control[] children = ((Composite) control).getChildren();
+ for(int i = 0; i < children.length; i++)
+ {
+ Control result = eswtGetDataLabel(children[i], data);
+ if(result != null)
+ {
+ ret = result;
+ break;
+ }
+ }
}
-
- return comp;
- }
+ return (Label)ret;
+ }
/**
* Set the size of the layouted Control.
*/
void eswtResizeControl(Item item, Control control, int width, int height)
{
- super.eswtResizeControl(item, control, width, height);
- control.getParent().setSize(width, height);
- // This will move gauge to the center of the screen:
- control.setLocation((width - control.getBounds().width) / 2,
- control.getLocation().y);
+ if((control instanceof Slider) || (control instanceof ProgressBar))
+ {
+ Control comp = control.getParent();
+ Control capt = comp.getParent();
+ comp.pack();
+ Point size = comp.computeSize(width, comp.getBounds().height);
+ comp.setSize(size.x, size.y);
+ Point loc = comp.getLocation();
+ if((height-size.y) != 0)
+ {
+ comp.setLocation(loc.x, loc.y + (height - size.y)/2);
+ }
+ }
}
/**
@@ -179,15 +221,19 @@
*/
void eswtAddSpecificListeners(Item item, Control control)
{
- super.eswtAddSpecificListeners(item, control);
- Gauge gauge = (Gauge) item;
- if(gauge.isInteractive())
- {
- Slider slider = (Slider) control;
- SelectionListener listener = new GaugeSelectionListener(gauge);
- slider.addSelectionListener(listener);
- slider.setData(SELECTION_LISTENER, listener);
- }
+ if(control instanceof Slider)
+ {
+ Slider slider = (Slider)control;
+ SelectionListener listener = (SelectionListener)slider.getData(SELECTION_LISTENER);
+ if(listener == null)
+ {
+ super.eswtAddSpecificListeners(item, control);
+ Gauge gauge = (Gauge)item;
+ listener = new GaugeSelectionListener(gauge);
+ slider.addSelectionListener(listener);
+ slider.setData(SELECTION_LISTENER, listener);
+ }
+ }
}
/**
@@ -195,19 +241,17 @@
*/
void eswtRemoveSpecificListeners(Item item, Control control)
{
- super.eswtRemoveSpecificListeners(item, control);
- Gauge gauge = (Gauge) item;
- if(gauge.isInteractive())
- {
- Slider slider = (Slider) control;
- SelectionListener listener = (SelectionListener) slider
- .getData(SELECTION_LISTENER);
- if(listener != null)
- {
- slider.removeSelectionListener(listener);
+ if(control instanceof Slider)
+ {
+ Slider slider = (Slider)control;
+ SelectionListener listener = (SelectionListener)slider.getData(SELECTION_LISTENER);
+ if(listener != null)
+ {
+ super.eswtRemoveSpecificListeners(item, control);
+ slider.removeSelectionListener(listener);
slider.setData(SELECTION_LISTENER, null);
- }
- }
+ }
+ }
}
/**
@@ -215,32 +259,102 @@
*/
boolean eswtIsSpecificControl(Item item, Control control)
{
- if(((Gauge) item).isInteractive())
- {
- return (control instanceof Slider);
- }
- else
- {
- return (control instanceof ProgressBar);
- }
+ return((control instanceof Slider) || (control instanceof ProgressBar));
}
/**
* Updates the values of Gauge.
*/
- void eswtUpdateItem(Item item, Control control, int reason, Object param)
+ void eswtUpdateItem(Item item, Control control, int aReason, Object param)
{
- Gauge gauge = (Gauge) item;
- if(control instanceof ProgressBar)
- {
- ((ProgressBar) control).setMaximum(gauge.getMaxValue() + 1);
- ((ProgressBar) control).setSelection(gauge.getValue());
- }
- else if(control instanceof Slider)
- {
- ((Slider) control).setMaximum(gauge.getMaxValue() + 1);
- ((Slider) control).setSelection(gauge.getValue());
- }
+ if(!(control instanceof CaptionedControl))
+ {
+ return;
+ }
+
+ Gauge gauge = (Gauge)item;
+ int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+ switch(reason)
+ {
+ case Item.UPDATE_NONE:
+ break;
+
+ case Item.UPDATE_LABEL:
+ {
+ String label = gauge.getLabel();
+ if(label == null)
+ {
+ label = "";
+ }
+
+ ((CaptionedControl)control).setText(label);
+ control.pack();
+ break;
+ }
+
+ case Gauge.UPDATE_VALUE:
+ {
+ //Setting the value to the control irrespective of the reason,
+ //as trade of for reason filtration.
+ Control ctrl = eswtFindSpecificControl(gauge, control);
+
+ if(ctrl instanceof Slider)
+ {
+ Slider slider = (Slider)ctrl;
+ slider.setSelection(gauge.getValue());
+ }
+ else if(ctrl instanceof ProgressBar)
+ {
+ ProgressBar progressbar = (ProgressBar)ctrl;
+ progressbar.setSelection(gauge.getValue());
+ }
+
+ Label currLabel = eswtGetDataLabel(control, CURRENT_LABEL_DATA);
+ if(currLabel != null)
+ {
+ currLabel.setText(Integer.toString(gauge.getValue()));
+ currLabel.getParent().layout();
+ }
+ break;
+ }
+
+ case Gauge.UPDATE_MAXVALUE:
+ {
+ Control ctrl = eswtFindSpecificControl(gauge, control);
+
+ if(ctrl instanceof Slider)
+ {
+ Slider slider = (Slider)ctrl;
+ slider.setMaximum(gauge.getMaxValue());
+ }
+ else if(ctrl instanceof ProgressBar)
+ {
+ ProgressBar progressbar = (ProgressBar)ctrl;
+ progressbar.setMaximum(gauge.getMaxValue());
+ }
+
+ Label maxLabel = eswtGetDataLabel(control, MAX_LABEL_DATA);
+ if(maxLabel != null)
+ {
+ maxLabel.setText(Integer.toString(gauge.getMaxValue()));
+ maxLabel.getParent().layout();
+ }
+
+ Label currLabel = eswtGetDataLabel(control, CURRENT_LABEL_DATA);
+ if(currLabel != null)
+ {
+ currLabel.setText(Integer.toString(gauge.getValue()));
+ }
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
}
/**
@@ -253,16 +367,23 @@
{
if(key == SWT.ARROW_RIGHT)
{
- gauge.internalSetValue(gauge.getValue() + 1);
- gauge.setLayout(gauge.internalGetLayout());
+ if(gauge.getValue() != gauge.getMaxValue())
+ {
+ gauge.internalSetValue(gauge.getValue() + 1);
+ gauge.setLayout(gauge.internalGetLayout());
+ return true;
+ }
}
else if(key == SWT.ARROW_LEFT)
{
- gauge.internalSetValue(gauge.getValue() -1);
- gauge.setLayout(gauge.internalGetLayout());
+ if(gauge.getValue() > 0)
+ {
+ gauge.internalSetValue(gauge.getValue() - 1);
+ gauge.setLayout(gauge.internalGetLayout());
+ return true;
+ }
}
- return true;
}
return false;
}
@@ -275,19 +396,25 @@
*/
static Point calculateMinimumBounds(final Gauge gauge)
{
- final Point minSize = new Point(0, 0);
+ final Point minSize = new Point(0, 0);
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
{
- Control comp = eswtCreateControl(eswtGetStaticShell(), gauge);
- minSize.x = getMaximumItemWidth(gauge);
- minSize.y = ((Composite) comp).computeSize(minSize.x, SWT.DEFAULT).y;
- applyMinMargins(gauge, minSize);
- comp.dispose();
+ CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+ if(gauge.hasLabel())
+ {
+ captioned.setText(MIN_TEXT);
+ }
+ eswtCreateControl(captioned, gauge);
+ int maxWidth = getMaximumItemWidth(gauge);
+ Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+ captioned.dispose();
+ minSize.x = size.x;
+ minSize.y = size.y;
}
});
- return minSize;
+ return minSize;
}
/**
@@ -297,22 +424,27 @@
* @return Preferred area needed to display Item. x is width
* and y is height.
*/
- static Point calculatePreferredBounds(Item item)
+ static Point calculatePreferredBounds(final Gauge gauge)
{
- final Point prefSize = new Point(0, 0);
- final Gauge gauge = (Gauge)item;
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- Control comp = eswtCreateControl(eswtGetStaticShell(), gauge);
- prefSize.x = getMaximumItemWidth(gauge);
- prefSize.y = ((Composite) comp).computeSize(prefSize.x, SWT.DEFAULT).y;
- applyPrefMargins(gauge, prefSize);
- comp.dispose();
- }
- });
- return prefSize;
+ final Point prefSize = new Point(0, 0);
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+ if(gauge.hasLabel())
+ {
+ captioned.setText(gauge.getLabel());
+ }
+ eswtCreateControl(captioned, gauge);
+ int maxWidth = getMaximumItemWidth(gauge);
+ Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+ captioned.dispose();
+ prefSize.x = size.x;
+ prefSize.y = size.y;
+ }
+ });
+ return prefSize;
}
/**
@@ -320,7 +452,6 @@
*/
class GaugeSelectionListener implements SelectionListener
{
-
private Gauge gauge;
/**
@@ -332,7 +463,10 @@
this.gauge = gauge;
}
- public void widgetDefaultSelected(SelectionEvent e) { }
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ Logger.method(this, "widgetDefaultSelected");
+ }
/**
* Called by eSWT when Slider's value is changed.
@@ -340,7 +474,9 @@
*/
public void widgetSelected(SelectionEvent e)
{
+ //Implement for other Gauge types with Commands
int newValue = ((Slider) e.getSource()).getSelection();
+
// Actions needed only if value is adjusted:
if(newValue != gauge.getValue())
{
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Thu Aug 05 16:07:57 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Mon Aug 23 14:24:31 2010 +0300
@@ -396,7 +396,7 @@
{
ret = control;
}
- else if(control != null && control instanceof Composite)
+ else if(control instanceof Composite)
{
Control[] children = ((Composite) control).getChildren();
for(int i = 0; i < children.length; i++)