[Fedora-directory-commits] esc/src/app/xul/esc/chrome/content/esc ESC.js, 1.5, 1.6
Jack Magne (jmagne)
fedora-directory-commits at redhat.com
Fri Feb 9 21:48:09 UTC 2007
Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1619
Modified Files:
ESC.js
Log Message:
Add initial support for security mode. Cleanup.
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.5 -r 1.6 ESC.js
Index: ESC.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ESC.js 30 Nov 2006 18:33:19 -0000 1.5
+++ ESC.js 9 Feb 2007 21:48:07 -0000 1.6
@@ -26,10 +26,8 @@
var gEnrollmentPage = 0;
var gAdminPage = 0;
-var gUsesListBox = 0;
var gFactoryMode = 0;
var gHiddenPage = 0;
-var gHiddenPageDone = 0;
var gExternalUI = 0;
loadStringBundle();
@@ -44,11 +42,16 @@
const ISSUER_TAG = "IssuerName";
const SERVICE_INFO_TAG = "ServiceInfo";
const ENROLLED_TOKEN_BROWSER_URL = "EnrolledTokenBrowserURL";
+const ENROLLED_TOKEN_URL = "EnrolledTokenURL";
+const TOKEN_TYPE = "TokenType";
const RESET_PHONE_HOME = "ResetPhoneHome";
const ESC_IGNORE_TOKEN_BROWSER_URL = "esc.ignore.token.browser.url";
const ESC_TOKEN_BROWSER_URL_ESTABLISHED = "esc.token.browser.established";
const ESC_IGNORE_KEY_ISSUER_INFO = "esc.ignore.key.issuer.info";
+const ESC_FACE_TO_FACE_MODE = "esc.face.to.face.mode";
+const ESC_SECURITY_URL="esc.security.url";
+const CLEAN_TOKEN = "cleanToken";
const UNINITIALIZED = 1;
const UNINITIALIZED_NOAPPLET = 2;
const ESC_ENROLL_WIDTH = 600;
@@ -61,13 +64,11 @@
const WIN_XP_PROG_OPEN = "C:\\Windows\\system32\\cmd.exe";
const WIN_2000_PROG_OPEN = "C:\\WINNT\\system32\\cmd.exe";
-
//Window names
-
const ENROLL_WINDOW = "esc.xul";
const ADMIN_WINDOW = "settings.xul";
const HIDDEN_WINDOW = "hiddenWindow.xul";
-
+const SECURITY_WINDOW = "security.xul";
function getUIForKey(aKeyID)
{
@@ -93,7 +94,7 @@
QueryInterface: function(iid)
{
- <!-- alert("iid: " + iid); -->
+ // alert("iid: " + iid);
if(!iid.equals(Components.interfaces.rhIKeyNotify) &&
!iid.equals(Components.interfaces.nsISupports))
{
@@ -107,6 +108,8 @@
//
// Attach to the object.
//
+ var gNotify=null;
+
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
netkey = Components.classes["@redhat.com/rhCoolKey"].getService();
@@ -122,7 +125,6 @@
//
function cleanup()
{
-
TrayRemoveWindow(null);
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -133,12 +135,10 @@
}
-var gScreenName = "";
var gKeyEnrollmentType = "userKey";
var gCurrentSelectedRow = null;
-
var gCurKeyType = null;
var gCurKeyID = null;
@@ -202,35 +202,6 @@
getBundleString("errorESCNoTalkTokenReader")
);
-//silent set of the tps uri connection on startup
-
-function testTPSURISilent()
-
-{
-
- var tps_uri = null;
-
- if(netkey)
- {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- tps_uri = netkey.GetCoolKeyConfigValue("esc.tps.url");
-
-
- } catch(e) {
- MyAlert(getBundleString("errorConfigValue") + e);
- }
-
- if(tps_uri)
- {
- testTPSURI(tps_uri);
-
- }
- }
-
-}
-
// Main function that oversees obtaining Phone Home Info from the Server
function DoPhoneHome(keyType,keyID)
@@ -247,19 +218,14 @@
issuer = getBundleString("unknownIssuer");
TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
UpdateRowWithPhoneHomeData(keyType,keyID);
-
recordMessage("cached issuer " + issuer);
-
var browserURL = GetCachedEnrolledTokenBrowserURL(keyID);
-
recordMessage("Cached browserURL " + browserURL);
if(browserURL)
{
DoCoolKeySetConfigValue(ESC_TOKEN_BROWSER_URL_ESTABLISHED,"yes");
-
DoHandleEnrolledBrowserLaunch();
-
}
}
@@ -267,12 +233,20 @@
{
issuer = getBundleString("unknownIssuer");
TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
- //launchCONFIG(keyType,keyID);
}
}
- if(IsPhoneHomeCached(keyID))
+ recordMessage("Attempting phone home...");
+
+ var home = DoCoolKeyGetIssuerUrl(keyType,keyID);
+
+ recordMessage("Returned IssuerURL " + home);
+
+ if(IsPhoneHomeCached(keyID) && home)
{
+ var phoneHomeURI = GetCachedPhoneHomeURL(keyID);
+
+ recordMessage("Phone home info cached...");
issuer = GetCachedIssuer(keyID);
TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
@@ -287,17 +261,18 @@
return true;
}
- var home = DoCoolKeyGetIssuerUrl(keyType,keyID);
var homeRes = false;
if(home)
{
+ recordMessage("About to actually phone home for real...");
homeRes = phoneHome(home,keyID,callback);
}
if(!home)
{
+ recordMessage("About to launch CONFIG , non secmode...");
launchCONFIG(keyType,keyID);
}
@@ -329,7 +304,6 @@
{
MyAlert(getBundleString("noTpsConfigUrl"));
return;
-
}
if(!url.value)
@@ -348,12 +322,10 @@
{
MyAlert(getBundleString("tpsConfigError"));
[...2480 lines suppressed...]
phoneHomeIssuer = GetCachedIssuer(aKeyID);
-
if(!phoneHomeIssuer)
return false;
tpsURL = GetCachedTPSURL(aKeyID);
-
if(!tpsURL)
return false;
tpsUI = GetCachedTPSUI(aKeyID);
-
return true;
}
@@ -4281,7 +3556,6 @@
var theValue = ConfigValueWithKeyID(aKeyID,aValue);
-
if(!theValue)
return null;
@@ -4290,9 +3564,17 @@
return retValue;
}
-function GetCachedEnrolledTokenBrowserURL(aKeyID)
+function GetCachedTokenType(aKeyID)
{
+ return GetCachedPhoneHomeValue(aKeyID,TOKEN_TYPE);
+}
+function GetCachedEnrolledTokenURL(aKeyID)
+{
+ return GetCachedPhoneHomeValue(aKeyID,ENROLLED_TOKEN_URL);
+}
+function GetCachedEnrolledTokenBrowserURL(aKeyID)
+{
return GetCachedPhoneHomeValue(aKeyID,ENROLLED_TOKEN_BROWSER_URL);
}
@@ -4305,7 +3587,6 @@
var urlValue = ConfigValueWithKeyID(aKeyID,KEY_ISSUER_URL);
-
if(!urlValue)
return null;
@@ -4356,7 +3637,6 @@
var urlValue = ConfigValueWithKeyID(aKeyID,TPS_URL);
-
if(!urlValue)
return null;
@@ -4365,9 +3645,9 @@
return url;
}
+//Update display when phone home data comes in
function UpdateRowWithPhoneHomeData(keyType,keyID)
{
-
if(gEnrollmentPage)
{
UpdateEnrollmentArea(keyType,keyID,1);
@@ -4378,10 +3658,9 @@
SelectRowByKeyID(keyType, keyID);
UpdateAdminListRow(keyType,keyID);
}
-
}
-//Phone home and get values
+//Phone home and actually get data values
function phoneHome(theUrl,aKeyID,resultCB)
{
@@ -4457,8 +3736,17 @@
for (var i = 0; i < len; i++)
{
var oChild = servicesNodes.item(i);
- var name = oChild.nodeName;
- var value = oChild.firstChild.data;
+
+ var name=null;
+ var value = null;
+ if(oChild)
+ {
+ name = oChild.nodeName;
+
+ if(oChild.firstChild)
+ value = oChild.firstChild.data;
+
+ }
if(name && value)
{
@@ -4474,9 +3762,7 @@
}
recordMessage("Done writing out phone home config cache.");
-
var browserURL = GetCachedEnrolledTokenBrowserURL(aKeyID);
-
recordMessage("Cached browserURL " + browserURL);
if(browserURL)
@@ -4495,7 +3781,7 @@
var result = DoCoolKeySetConfigValue(issuer_config_value,url);
resultCB(true);
}
- return;
+ return true;
}
}
@@ -4507,7 +3793,6 @@
function ReadESCLog()
{
-
const logFileName = "esc.log";
// Get executable directory
@@ -4529,7 +3814,6 @@
return null;
}
-
// read lines into array
var line = {}, lines = [], hasmore;
do {
@@ -4609,7 +3893,6 @@
function DoMyAlert(message,title)
{
-
if(!message || !title)
return; try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -4619,13 +3902,10 @@
} catch(e) {
-
alert("Problem with nsIPromptService " + e);
}
-
}
-
//Utility function to sleep for a short time
function Sleep(milliSeconds)
@@ -4633,26 +3913,20 @@
var then = new Date(new Date().getTime() + milliSeconds ); while (new Date() < then) {}
}
-
function DoCopyAdvancedInfoToClipBoard()
{
var textinfo = window.document.getElementById("advanced-info");
-
CopyDataToClipboard(gDiagnosticsDataText);
}
-
function CopyDataToClipboard(aDataText)
{
-
if(!aDataText)
- return;
-
+ return false;
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
-
if (!str)
return false;
@@ -4674,8 +3948,10 @@
clip.setData(trans,null,clipid.kGlobalClipboard);
MyAlert(getBundleString("dataCopiedToClipboard") );
+ return true;
}
+//Write message to Javascript console if open
function recordMessage( message ) {
More information about the Fedora-directory-commits
mailing list