Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2790
Modified Files:
ESC.js
Log Message:
Add aol special phone home feature, and pass CUID token ID along with the phone home request. Bugs #352991, #418391.
Index: ESC.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ESC.js 7 Jun 2007 21:17:58 -0000 1.15
+++ ESC.js 4 Mar 2008 23:39:54 -0000 1.16
@@ -51,6 +51,8 @@
const ESC_FACE_TO_FACE_MODE = "esc.face.to.face.mode";
const ESC_SECURITY_URL="esc.security.url";
const ESC_SECURE_URL="esc.secure.url";
+const ESC_GLOBAL_PHONE_HOME_URL= "esc.global.phone.home.url";
+const SPECIAL_ATR="3B76940000FF6276010000";
const CLEAN_TOKEN = "cleanToken";
const UNINITIALIZED = 1;
@@ -288,6 +290,11 @@
return true;
}
+ //Check for special key since we have no phone home info.
+
+ if(!home) {
+ home = GetGlobalPhoneHomeUrl(keyType,keyID);
+ }
var homeRes = false;
@@ -309,6 +316,44 @@
return homeRes;
}
+
+//Get global phone home url only for a special key
+
+function GetGlobalPhoneHomeUrl(keyType,keyID)
+{
+
+ var globalIssuerURL=null;
+ var specialATR=SPECIAL_ATR;
+ var phonHomeURL= DoCoolKeyGetATR(keyType,keyID);
+
+ var specialAppletVerMaj=1;
+ var specialAppletVerMin=1;
+
+
+ var appletVerMaj = DoGetCoolKeyGetAppletVer(keyType, keyID , true);
+ var appletVerMin = DoGetCoolKeyGetAppletVer(keyType, keyID, false);
+
+
+ if( (appletVerMaj != specialAppletVerMaj) ||
+ ( appletVerMin > specialAppletVerMin)) {
+
+ return null;
+ }
+
+ var keyATR = DoCoolKeyGetATR(keyType,keyID);
+
+
+ if( keyATR != specialATR) {
+ return null;
+ }
+
+ globalIssuerURL = DoCoolKeyGetConfigValue(ESC_GLOBAL_PHONE_HOME_URL);
+
+
+ return globalIssuerURL;
+
+}
+
//Test Phone Home url in config UI
function DoPhoneHomeTest()
@@ -3561,12 +3606,18 @@
function DoCoolKeyGetIssuerUrl(keyType,keyID)
{
var url = null;
+ var isMac = 0;
+ var agent = navigator.userAgent.toLowerCase();
//Back door for testing, ignore the value if so configured
+ if(agent && agent.indexOf("mac") != -1) {
+ isMac = 1;
+ }
+
var ignoreIssuer = DoCoolKeyGetConfigValue(ESC_IGNORE_KEY_ISSUER_INFO);
- recordMessage("DoCoolKeyGetIssuerUrl ignoreIssuer: " + ignoreIssuer);
+ recordMessage("DoCoolKeyGetIssuerUrl agent " + agent);
if(ignoreIssuer == "yes")
{
@@ -3576,17 +3627,21 @@
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
+
var tries = 0;
- while(tries < 3)
+ while(tries < 3 )
{
url = netkey.GetCoolKeyIssuerInfo(keyType, keyID);
- if(url.length < 10) // Check for bogus junk
+ if(!isMac) {
+ break;
+ }
+
+ if(!url || url.length < 10) // Check for bogus junk
{
recordMessage("Bogus url found ....");
url = null;
- Sleep(150);
+ Sleep(250);
recordMessage("Going to try again... ");
}
else
@@ -3609,11 +3664,14 @@
{
url = netkey.GetCoolKeyIssuerInfo(keyType, keyID);
- if(url.length < 10) // Check for bogus junk
+ if(!isMac) {
+ break;
+ }
+ if(!url || url.length < 10) // Check for bogus junk
{
recordMessage("Bogus url found from exception....");
url = null;
- sleep(150);
+ sleep(250);
recordMessage("From exception. Going to try again... ");
}
else
@@ -3621,12 +3679,18 @@
tries ++;
}
+ if(url)
+ {
+ var issuer_config_value_exp = ConfigValueWithKeyID(keyID,KEY_ISSUER_URL);
+ var result_exp = DoCoolKeySetConfigValue(issuer_config_value_exp,url);
+ }
recordMessage("From exception returning " + url);
return url;
}
return url;
}
+
//Get ATR value of card
function DoCoolKeyGetATR(keyType,keyID)
{
@@ -4111,8 +4175,9 @@
if(!theUrl || !aKeyID)
return false;
- if(theUrl != null)
- url = theUrl;
+ if(theUrl != null) {
+ url = theUrl + "?cuid=" + aKeyID;
+ }
var req = new XMLHttpRequest();
req.overrideMimeType('text/xml');