Blame SOURCES/esc-1.1.0-fix22.patch

4fc85a
diff -up ./esc/src/app/xul/esc/application.ini.fix22 ./esc/src/app/xul/esc/application.ini
4fc85a
--- ./esc/src/app/xul/esc/application.ini.fix22	2013-11-27 14:14:24.118638587 -0800
4fc85a
+++ ./esc/src/app/xul/esc/application.ini	2013-11-27 14:14:24.132638588 -0800
4fc85a
@@ -25,11 +25,11 @@ Vendor=RedHat
4fc85a
 Name=ESC
4fc85a
 ;
4fc85a
 ; This field specifies your application's version.  This field is optional.
4fc85a
-Version=1.1.0-25
4fc85a
+Version=1.1.0-26
4fc85a
 ;
4fc85a
 ; This field specifies your application's build ID (timestamp).  This field is
4fc85a
 ; required.
4fc85a
-BuildID=0000001025
4fc85a
+BuildID=0000001026
4fc85a
 ;
4fc85a
 ; This ID is just an example.  Every XUL app ought to have it's own unique ID.
4fc85a
 ; You can use the microsoft "guidgen" or "uuidgen" tools, or go on
4fc85a
diff -up ./esc/src/app/xul/esc/chrome/content/esc/ESC.js.fix22 ./esc/src/app/xul/esc/chrome/content/esc/ESC.js
4fc85a
--- ./esc/src/app/xul/esc/chrome/content/esc/ESC.js.fix22	2013-11-27 14:14:24.016638584 -0800
4fc85a
+++ ./esc/src/app/xul/esc/chrome/content/esc/ESC.js	2013-11-27 14:30:07.758668142 -0800
4fc85a
@@ -57,6 +57,7 @@ const  ESC_SECURITY_URL="esc.security.ur
4fc85a
 const  ESC_SECURE_URL="esc.secure.url";
4fc85a
 const  ESC_GLOBAL_PHONE_HOME_URL= "esc.global.phone.home.url";
4fc85a
 const  ESC_HIDE_FORMAT="esc.hide.format";
4fc85a
+const  ESC_ALLOW_NOTIFICATIONS="esc.allow.notifications";
4fc85a
 
4fc85a
 const  CLEAN_TOKEN = "cleanToken";
4fc85a
 const  UNINITIALIZED        = 1;
4fc85a
@@ -76,6 +77,7 @@ const ENROLL_WINDOW      = "esc.xul";
4fc85a
 const ADMIN_WINDOW       = "settings.xul";
4fc85a
 const HIDDEN_WINDOW      = "hiddenWindow.xul";
4fc85a
 const SECURITY_WINDOW    = "security.xul";
4fc85a
+const PHONE_WINDOW       = "config.xul";
4fc85a
 
4fc85a
 
4fc85a
 //Log level constants
4fc85a
@@ -230,10 +232,14 @@ var Status_Messages = new Array(
4fc85a
 function DoPhoneHome(keyType,keyID)
4fc85a
 {
4fc85a
   CoolKeyLogMsg(PR_LOG_ALWAYS,"Attempting to phone home for Key " + keyID); 
4fc85a
+  var allowNotify = null;
4fc85a
   var callback = function (aResult) {
4fc85a
 
4fc85a
     recordMessage("In DoPhoneHome callback");
4fc85a
 
4fc85a
+    var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
4fc85a
+
4fc85a
+
4fc85a
     var issuer = "";
4fc85a
     if(aResult == true)
4fc85a
     {
4fc85a
@@ -241,7 +247,10 @@ function DoPhoneHome(keyType,keyID)
4fc85a
         if(!issuer)
4fc85a
             issuer = getBundleString("unknownIssuer");
4fc85a
         recordMessage("In DoPhoneHome callback success issuer " + issuer);
4fc85a
-        TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+
4fc85a
+        if(allowNotify == "yes") {
4fc85a
+            TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+        }
4fc85a
         LogKeyInfo(keyType,keyID,"Key Inserted ...");
4fc85a
         UpdateRowWithPhoneHomeData(keyType,keyID);
4fc85a
         recordMessage("cached issuer " + issuer);
4fc85a
@@ -262,7 +271,9 @@ function DoPhoneHome(keyType,keyID)
4fc85a
         if(!issuer)
4fc85a
             issuer = getBundleString("unknownIssuer");
4fc85a
         recordMessage("Phone home callback failed , issuer " + issuer);
4fc85a
-        TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+        if (allowNotify == "yes") {
4fc85a
+            TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+        }
4fc85a
         LogKeyInfo(keyType,keyID,"Key Inserted ...");
4fc85a
     }
4fc85a
   }
4fc85a
@@ -271,6 +282,7 @@ function DoPhoneHome(keyType,keyID)
4fc85a
 
4fc85a
   var home = DoCoolKeyGetIssuerUrl(keyType,keyID);
4fc85a
 
4fc85a
+  //home = null;
4fc85a
   recordMessage("Returned IssuerURL " + home);
4fc85a
 
4fc85a
   if(IsPhoneHomeCached(keyID) && home)
4fc85a
@@ -279,7 +291,12 @@ function DoPhoneHome(keyType,keyID)
4fc85a
 
4fc85a
       recordMessage("Phone home info cached...");
4fc85a
       issuer = GetCoolKeyIssuer(keyType,keyID);
4fc85a
-      TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+
4fc85a
+      allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
4fc85a
+      if (allowNotify == "yes") {
4fc85a
+          TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+      }
4fc85a
+
4fc85a
       LogKeyInfo(keyType,keyID,"Key Inserted ...");
4fc85a
 
4fc85a
       var launchBrowserURL =  GetCachedEnrolledTokenBrowserURL(keyID);
4fc85a
@@ -534,7 +551,11 @@ function GetAuthDataFromPopUp(aKeyType,a
4fc85a
    keyUITable[aKeyID] = aUiData;
4fc85a
    keyTypeTable[aKeyID] = aKeyType;
4fc85a
 
4fc85a
-   var child =  window.open("chrome://esc/content/GenericAuth.xul", aKeyID, "chrome,centerscreen,width=400,height=250");
4fc85a
+   var child =  window.open("chrome://esc/content/GenericAuth.xul", aKeyID, "chrome,centerscreen,width=400,height=250,dialog");
4fc85a
+
4fc85a
+   if (child) {
4fc85a
+       child.setTimeout("focus()", 1000);
4fc85a
+   }
4fc85a
  
4fc85a
    curChildWindow = child; 
4fc85a
 }
4fc85a
@@ -1275,7 +1296,7 @@ function UpdateEnrollmentArea(keyType,ke
4fc85a
 
4fc85a
       var numUnenrolledKeys = DoGetNumUnenrolledCoolKeys();
4fc85a
 
4fc85a
-      //alert("inserted " + inserted + " showFulUI " + showFullUI + " showExternalUI " + showExternalUI + " already enrolled " + alreadyEnrolled + " numUnenrolledKeys " + numUnenrolledKeys);
4fc85a
+     // alert("inserted " + inserted + " showFulUI " + showFullUI + " showExternalUI " + showExternalUI + " already enrolled " + alreadyEnrolled + " numUnenrolledKeys " + numUnenrolledKeys);
4fc85a
 
4fc85a
 
4fc85a
      var ui_id = document.getElementById("esc-ui");
4fc85a
@@ -1290,7 +1311,7 @@ function UpdateEnrollmentArea(keyType,ke
4fc85a
          {
4fc85a
              if(!numUnenrolledKeys)
4fc85a
              {
4fc85a
-               ui_id.setAttribute("src",null);
4fc85a
+                ui_id.setAttribute("src","");
4fc85a
              }
4fc85a
              else
4fc85a
              {
4fc85a
@@ -1427,14 +1448,19 @@ function UpdateEnrollmentArea(keyType,ke
4fc85a
          HideItem(no_key_area);
4fc85a
      }
4fc85a
 
4fc85a
+
4fc85a
     if(!alreadyEnrolled  && inserted && showExternalUI)
4fc85a
      {
4fc85a
          UpdateESCSize();
4fc85a
+         gEnrollmentPage.setTimeout("focus();",3500);
4fc85a
          return;
4fc85a
      }
4fc85a
 
4fc85a
      if(!showExternalUI)
4fc85a
          UpdateESCSize();
4fc85a
+
4fc85a
+     gEnrollmentPage.setTimeout("focus();",3500);
4fc85a
+     
4fc85a
 }
4fc85a
 
4fc85a
 //Evaulate Password Quality
4fc85a
@@ -2006,7 +2032,7 @@ function SelectESCPage(keyType,keyID,pho
4fc85a
        break;
4fc85a
    }
4fc85a
 
4fc85a
-   //alert("SelectESCPage  initialized " + keyUninitialized + " gEnrollmentPage " + gEnrollmentPage + " gFactoryMode " + gFactoryMode + " gHiddenPage " + gHiddenPage);
4fc85a
+   //alert("SelectESCPage  uninitialized " + keyUninitialized + " gEnrollmentPage " + gEnrollmentPage + " gFactoryMode " + gFactoryMode + " gHiddenPage " + gHiddenPage + " phoneHomeFailed " + phoneHomeFailed + " no_launch_external_ui " + no_launch_external_ui);
4fc85a
 
4fc85a
    //Get the primary page windows if present
4fc85a
 
4fc85a
@@ -2022,14 +2048,7 @@ function SelectESCPage(keyType,keyID,pho
4fc85a
 
4fc85a
    if(keyUninitialized == UNINITIALIZED && !phoneHomeFailed && !no_launch_external_ui )  //formatted uninitialized card
4fc85a
    {
4fc85a
-       if(enrollWnd)   //Enrollment window is  already up
4fc85a
-       {
4fc85a
-          enrollWnd.focus();
4fc85a
-       }
4fc85a
-       else
4fc85a
-       {
4fc85a
-          launchESC();
4fc85a
-       }
4fc85a
+       launchESC();
4fc85a
    }
4fc85a
    else
4fc85a
    {
4fc85a
@@ -2975,8 +2994,9 @@ function OnCoolKeyInserted(keyType, keyI
4fc85a
 
4fc85a
   var uninitialized = 0;
4fc85a
 
4fc85a
-  recordMessage("Key inserted!" + "Window " + IdentifyWindow());
4fc85a
+  var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
4fc85a
 
4fc85a
+  recordMessage("Key inserted!" + "Window " + IdentifyWindow());
4fc85a
   if(gHiddenPage)
4fc85a
   {
4fc85a
       TrayShowNotificationIcon();
4fc85a
@@ -2993,6 +3013,7 @@ function OnCoolKeyInserted(keyType, keyI
4fc85a
 
4fc85a
         gCurrentSelectedRow = row;
4fc85a
         UpdateEnrollmentArea(keyType,keyID,1);
4fc85a
+
4fc85a
    }
4fc85a
 
4fc85a
    if(gAdminPage)
4fc85a
@@ -3017,7 +3038,9 @@ function OnCoolKeyInserted(keyType, keyI
4fc85a
           if(!issuer )
4fc85a
               issuer = getBundleString("unknownIssuer");
4fc85a
 
4fc85a
-          TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+          if( allowNotify) {
4fc85a
+              TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+          }
4fc85a
 
4fc85a
       }
4fc85a
 
4fc85a
@@ -3037,6 +3060,8 @@ function OnCoolKeyRemoved(keyType, keyID
4fc85a
 
4fc85a
   var  row = GetRowForKey(keyType, keyID);
4fc85a
 
4fc85a
+  var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
4fc85a
+
4fc85a
   if(gHiddenPage)
4fc85a
   {
4fc85a
       if(curChildWindow)
4fc85a
@@ -3047,7 +3072,9 @@ function OnCoolKeyRemoved(keyType, keyID
4fc85a
       var issuer = GetCoolKeyIssuer(keyType,keyID);
4fc85a
       if(!issuer)
4fc85a
           issuer = getBundleString("unknownIssuer");
4fc85a
-      TraySendNotificationMessage(getBundleString("keyRemoved"),"\"" + issuer + "\"" + " " + getBundleString("keyRemovedComputer"),1,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+      if (allowNotify == "yes") {
4fc85a
+          TraySendNotificationMessage(getBundleString("keyRemoved"),"\"" + issuer + "\"" + " " + getBundleString("keyRemovedComputer"),1,4000,GetESCNotifyIconPath(keyType,keyID));
4fc85a
+      }
4fc85a
        LogKeyInfo(keyType,keyID, "Key Removed ...");
4fc85a
 
4fc85a
   }
4fc85a
@@ -3345,6 +3372,7 @@ uiListener =
4fc85a
 
4fc85a
             if(url != esc_enroll_uri)
4fc85a
             {
4fc85a
+
4fc85a
                 MyAlert(getBundleString("errorEnrollmentUI"));
4fc85a
 
4fc85a
                 if(uiListener)
4fc85a
@@ -3978,17 +4006,24 @@ function launchCONFIG(keyType,keyID)
4fc85a
         platform = "mac";
4fc85a
     }
4fc85a
 
4fc85a
-    var wind = null;
4fc85a
+    var wind  = IsPageWindowPresent(PHONE_WINDOW);
4fc85a
 
4fc85a
-    if(platform == "mac")
4fc85a
-    {
4fc85a
-        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=no");
4fc85a
-    }
4fc85a
-    else
4fc85a
-    {
4fc85a
-        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=yes");
4fc85a
+    if (!wind) {
4fc85a
+        if(platform == "mac")
4fc85a
+        {
4fc85a
+            wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=no");
4fc85a
+        }
4fc85a
+        else
4fc85a
+        {
4fc85a
+            wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable");
4fc85a
+
4fc85a
+        }
4fc85a
+    } 
4fc85a
 
4fc85a
+    if(wind) {
4fc85a
+        wind.setTimeout("focus();",1500);
4fc85a
     }
4fc85a
+    
4fc85a
 }
4fc85a
 
4fc85a
 //Launch cert viewer if key has certs
4fc85a
@@ -4046,12 +4081,12 @@ function launchESC()
4fc85a
 
4fc85a
     if(!enrollWnd)
4fc85a
     {
4fc85a
-        var wind = window.open("chrome://esc/content/esc.xul","","chrome,resizable,centerscreen,dialog");
4fc85a
+        enrollWnd = window.open("chrome://esc/content/esc.xul","","chrome,resizable,centerscreen,dialog");
4fc85a
 
4fc85a
     }
4fc85a
-    else
4fc85a
-    {
4fc85a
-        enrollWnd.focus();
4fc85a
+
4fc85a
+    if(enrollWnd) {
4fc85a
+         enrollWnd.setTimeout("focus();",1500);
4fc85a
     }
4fc85a
 
4fc85a
 }
4fc85a
diff -up ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js.fix22 ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js
4fc85a
--- ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js.fix22	2009-03-28 17:54:57.000000000 -0700
4fc85a
+++ ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js	2013-11-27 14:14:24.133638588 -0800
4fc85a
@@ -29,6 +29,10 @@ pref("esc.tps.message.timeout","90");
4fc85a
 
4fc85a
 pref("esc.windows.do.capi","yes");
4fc85a
 
4fc85a
+#Do we allow card notifications? Default no.
4fc85a
+
4fc85a
+pref("esc.allow.notifications", "no");
4fc85a
+
4fc85a
 
4fc85a
 #Sample Security Officer Enrollment UI
4fc85a