diff --git a/esc-1.0.1-ui-fixes-1.patch b/esc-1.0.1-ui-fixes-1.patch new file mode 100644 index 0000000..39bbb38 --- /dev/null +++ b/esc-1.0.1-ui-fixes-1.patch @@ -0,0 +1,1906 @@ +--- ./esc/src/lib/coolkey/NSSManager.cpp.fix4 2007-04-25 10:52:35.000000000 -0700 ++++ ./esc/src/lib/coolkey/NSSManager.cpp 2007-04-25 10:52:47.000000000 -0700 +@@ -51,6 +51,9 @@ + char tBuff[56]; + PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::NSSManager:\n",GetTStamp(tBuff,56))); + mpSCMonitoringThread = NULL; ++#ifdef LINUX ++ systemCertDB = NULL; ++#endif + } + + NSSManager::~NSSManager() +@@ -61,6 +64,7 @@ + delete mpSCMonitoringThread; + mpSCMonitoringThread = NULL; + } ++ + } + + HRESULT NSSManager::InitNSS(const char *aAppDir) +@@ -110,6 +114,21 @@ + return E_FAIL; + } + ++#ifdef LINUX ++ ++ // Load our Linux only database ++ ++ ++ const char *modspec = "configdir='/etc/pki/nssdb' tokenDescripton='SystemDB' flags='readOnly'"; ++ PK11SlotInfo *systemCertDB = SECMOD_OpenUserDB(modspec); ++ ++ if(!systemCertDB) ++ { ++ PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager::InitNSS problem loading Linux System Cert Database!\n",GetTStamp(tBuff,56))); ++ } ++ ++#endif ++ + mpSCMonitoringThread = new SmartCardMonitoringThread(userModule); + if (!mpSCMonitoringThread) { + SECMOD_UnloadUserModule(userModule); +@@ -132,6 +151,17 @@ + + // Logout all tokens. + PK11_LogoutAll(); ++ ++#ifdef LINUX ++ if(systemCertDB) ++ { ++ SECMOD_CloseUserDB(systemCertDB); ++ ++ PK11_FreeSlot(systemCertDB); ++ systemCertDB = NULL; ++ } ++ ++#endif + } + + bool +@@ -326,7 +356,7 @@ + return S_OK; + } + +-HRESULT NSSManager::GetKeyIssuedTo(const CoolKey *aKey, char *aBuf, int aBufLength) ++HRESULT NSSManager::GetKeyIssuer(const CoolKey *aKey, char *aBuf, int aBufLength) + { + char tBuff[56]; + if(!aBuf) +@@ -337,17 +367,89 @@ + PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::GetKeyIssuedTo \n",GetTStamp(tBuff,56))); + + if(!aKey ) +- { + return E_FAIL; +- } + + PK11SlotInfo *slot = GetSlotForKeyID(aKey); + + if (!slot) ++ return E_FAIL; ++ ++ CERTCertList *certs = PK11_ListCerts(PK11CertListAll,NULL); ++ ++ if (!certs) + { ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%sNSSManager::GetKeyIssuer no certs found! \n",GetTStamp(tBuff,56))); ++ PK11_FreeSlot(slot); + return E_FAIL; + } + ++ CERTCertListNode *node= NULL; ++ ++ char *orgID = NULL; ++ ++ for( node = CERT_LIST_HEAD(certs); ++ ! CERT_LIST_END(node, certs); ++ node = CERT_LIST_NEXT(node)) ++ { ++ if(node->cert) ++ { ++ CERTCertificate *cert = node->cert; ++ ++ if(cert) ++ { ++ if(cert->slot == slot) ++ { ++ if(IsCACert(cert)) ++ { ++ continue; ++ } ++ orgID = CERT_GetOrgName(&cert->subject); ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::GetKeyIssuedTo ourSlot %p curSlot %p org %s \n",GetTStamp(tBuff,56),slot,cert->slot,orgID)); ++ ++ } ++ ++ if(orgID) ++ break; ++ } ++ } ++ ++ } ++ ++ if(orgID && ((int)strlen(orgID) < aBufLength)) ++ { ++ strcpy(aBuf,orgID); ++ } ++ ++ if(certs) ++ CERT_DestroyCertList(certs); ++ ++ if(slot) ++ PK11_FreeSlot(slot); ++ ++ if(orgID) ++ PORT_Free(orgID); ++ ++ return S_OK; ++} ++ ++HRESULT NSSManager::GetKeyIssuedTo(const CoolKey *aKey, char *aBuf, int aBufLength) ++{ ++ char tBuff[56]; ++ if(!aBuf) ++ return E_FAIL; ++ ++ aBuf[0]=0; ++ ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::GetKeyIssuedTo \n",GetTStamp(tBuff,56))); ++ ++ if(!aKey ) ++ return E_FAIL; ++ ++ PK11SlotInfo *slot = GetSlotForKeyID(aKey); ++ ++ if (!slot) ++ return E_FAIL; ++ + CERTCertList *certs = PK11_ListCerts(PK11CertListAll,NULL); + + if (!certs) +@@ -373,8 +475,14 @@ + { + if(cert->slot == slot) + { ++ if(IsCACert(cert)) ++ { ++ continue; ++ } ++ + certID = CERT_GetCommonName(&cert->subject); +- PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::GetKeyIssuedTo ourSlot %p curSlot %p certID %s \n",GetTStamp(tBuff,56),slot,cert->slot,certID)); ++ ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::GetKeyIssuedTo ourSlot %p curSlot %p certID %s \n",GetTStamp(tBuff,56),slot,cert->slot,certID)); + + } + +@@ -627,3 +735,41 @@ + + return isAuthenticated; + } ++ ++bool ++NSSManager::IsCACert(CERTCertificate *cert) ++{ ++ char tBuff[56]; ++ bool isCA = false; ++ ++ if(!cert) ++ return isCA; ++ ++ SECItem basicItem; ++ basicItem.data = 0; ++ ++ SECStatus s = CERT_FindCertExtension(cert, SEC_OID_X509_BASIC_CONSTRAINTS, &basicItem); ++ ++ if(s != SECSuccess || !basicItem.data) ++ return isCA; ++ ++ CERTBasicConstraints basic_value; ++ ++ s = CERT_DecodeBasicConstraintValue(&basic_value,&basicItem); ++ ++ if(s != SECSuccess) ++ return isCA; ++ ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%sNSSManager::GetKeyIssuedTo isCA %d \n",GetTStamp(tBuff,56),basic_value.isCA)); ++ ++ if(basic_value.isCA) ++ { ++ PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%sNSSManager::GetKeyIssuedTo found a CA cert , skipping! \n",GetTStamp(tBuff,56))); ++ isCA = true; ++ } ++ ++ PORT_Free(basicItem.data); ++ basicItem.data = NULL; ++ ++ return isCA; ++} +--- ./esc/src/lib/coolkey/CoolKey.h.fix4 2007-04-25 10:52:20.000000000 -0700 ++++ ./esc/src/lib/coolkey/CoolKey.h 2007-04-25 11:02:56.000000000 -0700 +@@ -134,6 +134,7 @@ + COOLKEY_API HRESULT CoolKeyGetCertInfo(const CoolKey *aKey, char *aCertNickname, std::string & aCertInfo); + + COOLKEY_API HRESULT CoolKeyGetIssuedTo(const CoolKey *aKey, char *aBuf, int aBufLength); ++COOLKEY_API HRESULT CoolKeyGetIssuer(const CoolKey *aKey, char *aBuf, int aBufLength); + + COOLKEY_API bool CoolKeyRequiresAuthentication(const CoolKey *aKey); + COOLKEY_API bool CoolKeyIsAuthenticated(const CoolKey *aKey); +--- ./esc/src/lib/coolkey/CoolKey.cpp.fix4 2007-04-25 10:51:58.000000000 -0700 ++++ ./esc/src/lib/coolkey/CoolKey.cpp 2007-04-25 10:52:06.000000000 -0700 +@@ -844,6 +844,16 @@ + return NSSManager::GetKeyIssuedTo(aKey,aBuf,aBufLength); + } + ++HRESULT ++CoolKeyGetIssuer(const CoolKey *aKey, char *aBuf, int aBufLength) ++{ ++ if (!aKey || !aKey->mKeyID || !aBuf || aBufLength < 1) ++ return E_FAIL; ++ ++ return NSSManager::GetKeyIssuer(aKey,aBuf,aBufLength); ++} ++ ++ + HRESULT CoolKeyGetATR(const CoolKey *aKey, char *aBuf, int aBufLen) + { + char tBuff[56]; +--- ./esc/src/lib/coolkey/NSSManager.h.fix4 2007-04-25 11:08:44.000000000 -0700 ++++ ./esc/src/lib/coolkey/NSSManager.h 2007-04-25 10:53:08.000000000 -0700 +@@ -68,11 +68,16 @@ + + static HRESULT GetKeyIssuedTo(const CoolKey *aKey, char *aBuf, int aBufLength); + +- ++ static HRESULT GetKeyIssuer(const CoolKey *aKey, char *aBuf, int aBufLength); + + + private: + ++ static bool IsCACert(CERTCertificate *cert); ++ ++#ifdef LINUX ++ PK11SlotInfo *systemCertDB; ++#endif + SmartCardMonitoringThread *mpSCMonitoringThread; + }; + +--- ./esc/src/app/xpcom/rhICoolKey.idl.fix4 2007-04-25 10:41:08.000000000 -0700 ++++ ./esc/src/app/xpcom/rhICoolKey.idl 2007-04-25 10:41:36.000000000 -0700 +@@ -66,9 +66,13 @@ + string GetCoolKeyCertInfo(in unsigned long aKeyType, in string aKeyID, in string aCertNickname); + + string GetCoolKeyIssuedTo(in unsigned long aKeyType, in string aKeyID); ++ ++ string GetCoolKeyIssuer(in unsigned long aKeyType, in string aKeyID); + + string GetCoolKeyATR(in unsigned long aKeyType, in string aKeyID); + ++ string GetCoolKeyTokenName(in unsigned long aKeyType, in string aKeyID); ++ + boolean GetCoolKeyRequiresAuthentication(in unsigned long aKeyType,in string aKeyID); + + boolean GetCoolKeyIsAuthenticated(in unsigned long aKeyType,in string aKeyID); +--- ./esc/src/app/xpcom/rhCoolKey.cpp.fix4 2007-04-25 10:40:43.000000000 -0700 ++++ ./esc/src/app/xpcom/rhCoolKey.cpp 2007-04-25 10:40:53.000000000 -0700 +@@ -1074,7 +1074,7 @@ + char tBuff[56]; + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::GetCoolKeyIsReallyCoolKey thread: %p \n",GetTStamp(tBuff,56),PR_GetCurrentThread())); + +- if (ASCCoolKeyIsAvailable(aKeyType, (char *) aKeyID)) { ++ if (aKeyType && aKeyID && ASCCoolKeyIsAvailable(aKeyType, (char *) aKeyID)) { + if (aKeyID) { + AutoCoolKey key(aKeyType, aKeyID); + PRBool isCool = CoolKeyIsReallyCoolKey(&key); +@@ -1164,6 +1164,34 @@ + return NS_OK; + } + ++/* string GetCoolKeyTokenName (in unsigned long aKeyType, in string aKeyID); */ ++ NS_IMETHODIMP rhCoolKey::GetCoolKeyTokenName(PRUint32 aKeyType, const char *aKeyID, char **_retval) ++{ ++ char tBuff[56]; ++ ++ *_retval = NULL; ++ ++ if(!aKeyType && !aKeyID) ++ return NS_OK; ++ ++ AutoCoolKey key(aKeyType,aKeyID); ++ ++ char *tokenName = NULL; ++ ++ tokenName = (char *) CoolKeyGetTokenName(&key); ++ ++ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::GetCoolKeyTokenName %s \n",GetTStamp(tBuff,56),tokenName)); ++ if(tokenName) ++ { ++ char *temp = (char *) nsMemory::Clone(tokenName,sizeof(char) * strlen((char *)tokenName) + 1); ++ *_retval = temp; ++ ++ } ++ ++ return NS_OK; ++ ++} ++ + /* string GetCoolKeyIssuerInfo (in unsigned long aKeyType, in string aKeyID); */ NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuerInfo(PRUint32 aKeyType, const char *aKeyID, char **_retval) + { + char tBuff[56]; +@@ -1251,6 +1279,40 @@ + return NS_OK; + + } ++ ++/* string GetCoolKeyIssuer (in unsigned long aKeyType, in string aKeyID); */ ++NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuer(PRUint32 aKeyType, const char *aKeyID, char **issuer) ++{ ++ char tBuff[56]; ++ if (!aKeyID) { ++ return NS_ERROR_FAILURE; ++ } ++ ++ AutoCoolKey key(aKeyType, ( char *)aKeyID); ++ ++ // const char *keyName = CoolKeyGetTokenName(&key); ++ ++ char buff[512]; ++ int bufLength = 512; ++ buff[0] = 0; ++ ++ CoolKeyGetIssuer(&key, (char *) buff, bufLength); ++ ++ if(!buff[0]) ++ { ++ return NS_OK; ++ } ++ ++ PR_LOG(coolKeyLog,PR_LOG_DEBUG,("%s rhCoolKey::RhGetCoolKeyGetIssuer %s \n",GetTStamp(tBuff,56),(char *) buff)); ++ ++ char *temp = (char *) nsMemory::Clone(buff,sizeof(char) * strlen(buff) + 1); ++ ++ *issuer = temp; ++ ++ return NS_OK; ++ ++} ++ + /* boolean SetCoolKeyConfigValue (in string aName, in string aValue); */ + NS_IMETHODIMP rhCoolKey::SetCoolKeyConfigValue(const char *aName, const char *aValue, PRBool *_retval) + { +--- ./esc/src/app/xpcom/tray/rhTray.h.fix4 2007-04-25 10:55:28.000000000 -0700 ++++ ./esc/src/app/xpcom/tray/rhTray.h 2007-04-25 10:55:35.000000000 -0700 +@@ -263,6 +263,7 @@ + // Icon menu related + + static GtkWidget *mIconMenu; ++ static GtkWidget *mIconBoxWidget; + static void IconMenuCBProc(GtkWidget *widget, gpointer data); + HRESULT CreateIconMenu(); + +--- ./esc/src/app/xpcom/tray/rhLinuxTray.cpp.fix4 2007-04-25 10:42:40.000000000 -0700 ++++ ./esc/src/app/xpcom/tray/rhLinuxTray.cpp 2007-04-25 10:42:51.000000000 -0700 +@@ -22,11 +22,13 @@ + #include + #include "notifytray.h" + #include "intl/nsIStringBundle.h" ++#include + + NS_IMPL_ISUPPORTS1(rhTray, rhITray) + + GtkWidget* rhTray::mWnd = NULL; + GtkWidget* rhTray::mIconMenu = NULL; ++GtkWidget* rhTray::mIconBoxWidget = NULL; + + int rhTray::mInitialized = 0; + +@@ -37,6 +39,44 @@ + + static PRLogModuleInfo *trayLog = PR_NewLogModule("tray"); + ++static void popup_position(GtkMenu *menu, ++ gint *x, ++ gint *y, ++ gboolean *push_in, ++ gpointer user_data) ++{ ++ ++ char tBuff[56]; ++ GtkWidget *icon_box_widget = GTK_WIDGET(user_data); ++ ++ if(icon_box_widget) ++ { ++ GdkWindow* window = icon_box_widget->window; ++ ++ gint width; ++ gint height; ++ ++ gint px; ++ gint py; ++ ++ gdk_drawable_get_size(window,&width,&height); ++ ++ gdk_window_get_position(window, ++ &px, ++ &py); ++ ++ PR_LOG( trayLog, PR_LOG_DEBUG, ("%s popup_position width %d height %d px %d py %d \n",GetTStamp(tBuff,56),width,height,px,py)); ++ ++ ++ gint x_coord = px; ++ gint y_coord = (py + height); ++ ++ *x = x_coord; ++ *y = y_coord; ++ ++ } ++ ++} + + rhTray::rhTray() + { +@@ -232,11 +272,12 @@ + return E_FAIL; + } + +- GtkWidget *icon_widget = notify_icon_get_box_widget(); ++ mIconBoxWidget = notify_icon_get_box_widget(); + +- if(icon_widget) ++ if(mIconBoxWidget) + { +- g_signal_connect(G_OBJECT(icon_widget), "button-press-event", G_CALLBACK(rhTray::IconCBProc), NULL); ++ g_signal_connect(G_OBJECT(mIconBoxWidget), "button-press-event", G_CALLBACK(rhTray::IconCBProc), NULL); ++ + } + + res = CreateEventWindow(); +@@ -352,11 +393,23 @@ + + GtkWidget *min_item = gtk_menu_item_new_with_label ("Hide"); + GtkWidget *max_item = gtk_menu_item_new_with_label ("Manage Keys"); +- GtkWidget *exit_item = gtk_menu_item_new_with_label ("Exit"); ++ GtkWidget *exit_item = gtk_image_menu_item_new_with_label ("Exit"); + +- gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), max_item); ++ GtkWidget* quit_icon = gtk_image_new_from_stock(GTK_STOCK_QUIT,GTK_ICON_SIZE_SMALL_TOOLBAR); ++ ++ if(max_item) ++ gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), max_item); + //gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), min_item); +- gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), exit_item); ++ if(exit_item) ++ { ++ gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), exit_item); ++ ++ if(quit_icon) ++ { ++ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(exit_item), quit_icon); ++ ++ } ++ } + + g_signal_connect(G_OBJECT (min_item), "activate", + G_CALLBACK (rhTray::IconMenuCBProc), +@@ -404,8 +457,8 @@ + gtk_menu_popup(GTK_MENU(mIconMenu), + NULL, + NULL, +- NULL, +- NULL, ++ (GtkMenuPositionFunc) popup_position, ++ mIconBoxWidget, + event->button, + event->time); + +@@ -725,6 +778,7 @@ + + if(widget->window) + { ++ gdk_x11_window_set_user_time (widget->window, gdk_x11_get_server_time (widget->window)); + if(GTK_WIDGET_VISIBLE(mWnd)) + { + gdk_window_show(widget->window); +--- ./esc/src/app/xul/esc/application.ini.fix4 2007-04-25 10:43:17.000000000 -0700 ++++ ./esc/src/app/xul/esc/application.ini 2007-04-25 10:44:00.000000000 -0700 +@@ -19,13 +19,13 @@ + ; + ; This field specifies your organization's name. This field is recommended, + ; but optional. +-Vendor=RedHat ++Vendor=RedHat + ; + ; This field specifies your application's name. This field is required. + Name=ESC + ; + ; This field specifies your application's version. This field is optional. +-Version=1.0.0 ++Version=1.0.1-3 + ; + ; This field specifies your application's build ID (timestamp). This field is + ; required. +--- ./esc/src/app/xul/esc/chrome/content/esc/security.xul.fix4 2007-04-25 10:48:49.000000000 -0700 ++++ ./esc/src/app/xul/esc/chrome/content/esc/security.xul 2007-04-25 10:48:59.000000000 -0700 +@@ -38,6 +38,6 @@ + + + +-