b=90956 Dot (.) instead of localized characters in pipnss module

r=ssaux sr=alecf
This commit is contained in:
kaie%netscape.com 2002-06-20 23:41:02 +00:00
Родитель 2c2f9c72d2
Коммит 1887483a18
8 изменённых файлов: 89 добавлений и 31 удалений

Просмотреть файл

@ -30,6 +30,8 @@ const nsIPKCS11ModuleDB = Components.interfaces.nsIPKCS11ModuleDB;
const nsIPK11Token = Components.interfaces.nsIPK11Token;
const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1";
const nsIPK11TokenDB = Components.interfaces.nsIPK11TokenDB;
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
const nsDialogParamBlock = "@mozilla.org/embedcomp/dialogparam;1";
var bundle;
var secmoddb;
@ -362,9 +364,11 @@ function doUnload()
function changePassword()
{
getSelectedItem();
window.open("changepassword.xul",
selected_slot.tokenName,
"chrome,resizable=1,modal=1,dialog=1");
var params = Components.classes[nsDialogParamBlock].createInstance(nsIDialogParamBlock);
params.SetString(1,selected_slot.tokenName);
window.openDialog("changepassword.xul",
"",
"chrome,resizable=1,modal=1,dialog=1",params);
showSlotInfo();
enableButtons();
}

Просмотреть файл

@ -40,10 +40,18 @@ function onLoad()
try {
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
tokenName = params.GetString(1);
}catch(exception)
{tokenName = self.name;}
} catch(exception) {
// this should not happen.
// previously we had self.name, but self.name was a bad idea
// as window name must be a subset of ascii, and the code was
// previously trying to assign unicode to the window's name.
// I checked all the places where we get a password prompt and
// all of them pass an argument as part of this patch.
tokenName="";
}
if(tokenName=="" || tokenName=="_blank") {
if(tokenName=="") {
var sectokdb = Components.classes[nsPK11TokenDB].getService(nsIPK11TokenDB);
var tokenList = sectokdb.listTokens();
var enumElement;

Просмотреть файл

@ -24,16 +24,40 @@
SignedBy=Signed by %S
CertPassPrompt=Please enter the master password for the %S.
# the following strings have special requirements:
# they must fit in a 32 or 64 byte buffer after being translated
# to UTF8. Note to translator. It's not easy for you to figure
# whether the escaped unicode string you produce will fit in
# the space allocated.
#
# 64 bytes long after conversion to UTF8
RootCertModuleName=Builtin Roots Module
#
# 32 bytes long after conversion to UTF8
ManufacturerID=Mozilla.org
#
# 32 bytes long after conversion to UTF8
LibraryDescription=PSM Internal Crypto Services
#
# 32 bytes long after conversion to UTF8
TokenDescription=Generic Crypto Services
#
# 32 bytes long after conversion to UTF8
PrivateTokenDescription=Software Security Device
#
# 64 bytes long after conversion to UTF8
SlotDescription=PSM Internal Cryptographic Services
#
# 64 bytes long after conversion to UTF8
PrivateSlotDescription=PSM Private Keys
#
# 64
FipsSlotDescription=PSM Internal FIPS-140-1 Cryptographic Services
# 64
FipsPrivateSlotDescription=PSM FIPS-140-1 User Private Key Services
# 32
InternalToken=Software Security Device
# End of size restriction.
VerifySSLClient=SSL Client Certificate
VerifySSLServer=SSL Server Certificate
VerifySSLStepUp=SSL Server with Step-up

Просмотреть файл

@ -172,7 +172,7 @@ PK11PasswordPrompt(PK11SlotInfo* slot, PRBool retry, void* arg) {
if (NS_FAILED(rv))
return nsnull;
const PRUnichar* formatStrings[1] = { ToNewUnicode(nsDependentCString(PK11_GetTokenName(slot))) };
const PRUnichar* formatStrings[1] = { ToNewUnicode(NS_ConvertUTF8toUCS2(PK11_GetTokenName(slot))) };
rv = nssComponent->PIPBundleFormatStringFromName(NS_LITERAL_STRING("CertPassPrompt").get(),
formatStrings, 1,
getter_Copies(promptString));

Просмотреть файл

@ -1323,7 +1323,7 @@ nsNSSCertificate::GetTokenName(PRUnichar **aTokenName)
#endif
char *token = PK11_GetTokenName(mCert->slot);
if (token) {
*aTokenName = ToNewUnicode(nsDependentCString(token));
*aTokenName = ToNewUnicode(NS_ConvertUTF8toUCS2(token));
}
} else {
nsresult rv;

Просмотреть файл

@ -388,11 +388,10 @@ nsNSSComponent::InstallLoadableRoots()
fullModuleName = PR_GetLibraryName(processDir.get(), "nssckbi");
#endif
/* If a module exists with the same name, delete it. */
char *modNameCString = ToNewCString(modName);
NS_ConvertUCS2toUTF8 modNameUTF8(modName);
int modType;
SECMOD_DeleteModule(modNameCString, &modType);
SECMOD_AddNewModule(modNameCString, fullModuleName, 0, 0);
nsMemory::Free(modNameCString);
SECMOD_DeleteModule(NS_CONST_CAST(char*, modNameUTF8.get()), &modType);
SECMOD_AddNewModule(NS_CONST_CAST(char*, modNameUTF8.get()), fullModuleName, 0, 0);
#ifndef XP_MAC
PR_Free(fullModuleName); // allocated by NSPR
#endif
@ -444,14 +443,14 @@ nsNSSComponent::ConfigureInternalPKCS11Token()
getter_Copies(fipsPrivateSlotDescription));
if (NS_FAILED(rv)) return rv;
PK11_ConfigurePKCS11(NS_LossyConvertUCS2toASCII(manufacturerID).get(),
NS_LossyConvertUCS2toASCII(libraryDescription).get(),
NS_LossyConvertUCS2toASCII(tokenDescription).get(),
NS_LossyConvertUCS2toASCII(privateTokenDescription).get(),
NS_LossyConvertUCS2toASCII(slotDescription).get(),
NS_LossyConvertUCS2toASCII(privateSlotDescription).get(),
NS_LossyConvertUCS2toASCII(fipsSlotDescription).get(),
NS_LossyConvertUCS2toASCII(fipsPrivateSlotDescription).get(),
PK11_ConfigurePKCS11(NS_ConvertUCS2toUTF8(manufacturerID).get(),
NS_ConvertUCS2toUTF8(libraryDescription).get(),
NS_ConvertUCS2toUTF8(tokenDescription).get(),
NS_ConvertUCS2toUTF8(privateTokenDescription).get(),
NS_ConvertUCS2toUTF8(slotDescription).get(),
NS_ConvertUCS2toUTF8(privateSlotDescription).get(),
NS_ConvertUCS2toUTF8(fipsSlotDescription).get(),
NS_ConvertUCS2toUTF8(fipsPrivateSlotDescription).get(),
0, 0);
return NS_OK;
}
@ -1956,3 +1955,4 @@ PSMContentListener::SetParentContentListener(nsIURIContentListener * aContentLis
mParentContentListener = aContentListener;
return NS_OK;
}

Просмотреть файл

@ -49,13 +49,22 @@ nsPK11Token::nsPK11Token(PK11SlotInfo *slot)
srv = PK11_GetTokenInfo(mSlot, &tok_info);
if (srv == SECSuccess) {
// Set the Label field
mTokenLabel.AssignWithConversion((char *)tok_info.label,
sizeof(tok_info.label));
const char *ccLabel = (const char*)tok_info.label;
const nsACString &cLabel = Substring(
ccLabel,
ccLabel+PL_strnlen(ccLabel, sizeof(tok_info.label)));
mTokenLabel = NS_ConvertUTF8toUCS2(cLabel);
mTokenLabel.Trim(" ", PR_FALSE, PR_TRUE);
// Set the Manufacturer field
mTokenManID.AssignWithConversion((char *)tok_info.manufacturerID,
sizeof(tok_info.manufacturerID));
const char *ccManID = (const char*)tok_info.manufacturerID;
const nsACString &cManID = Substring(
ccManID,
ccManID+PL_strnlen(ccManID, sizeof(tok_info.manufacturerID)));
mTokenManID = NS_ConvertUTF8toUCS2(cManID);
mTokenManID.Trim(" ", PR_FALSE, PR_TRUE);
// Set the Hardware Version field
mTokenHWVersion.AppendInt(tok_info.hardwareVersion.major);
mTokenHWVersion.Append(NS_LITERAL_STRING("."));
@ -65,8 +74,11 @@ nsPK11Token::nsPK11Token(PK11SlotInfo *slot)
mTokenFWVersion.Append(NS_LITERAL_STRING("."));
mTokenFWVersion.AppendInt(tok_info.firmwareVersion.minor);
// Set the Serial Number field
mTokenSerialNum.AssignWithConversion((char *)tok_info.serialNumber,
sizeof(tok_info.serialNumber));
const char *ccSerial = (const char*)tok_info.serialNumber;
const nsACString &cSerial = Substring(
ccSerial,
ccSerial+PL_strnlen(ccSerial, sizeof(tok_info.serialNumber)));
mTokenSerialNum = NS_ConvertUTF8toUCS2(cSerial);
mTokenSerialNum.Trim(" ", PR_FALSE, PR_TRUE);
}

Просмотреть файл

@ -59,12 +59,18 @@ nsPKCS11Slot::nsPKCS11Slot(PK11SlotInfo *slot)
CK_SLOT_INFO slot_info;
if (PK11_GetSlotInfo(mSlot, &slot_info) == SECSuccess) {
// Set the Description field
mSlotDesc.AssignWithConversion((char *)slot_info.slotDescription,
sizeof(slot_info.slotDescription));
const char *ccDesc = (const char*)slot_info.slotDescription;
const nsACString &cDesc = Substring(
ccDesc,
ccDesc+PL_strnlen(ccDesc, sizeof(slot_info.slotDescription)));
mSlotDesc = NS_ConvertUTF8toUCS2(cDesc);
mSlotDesc.Trim(" ", PR_FALSE, PR_TRUE);
// Set the Manufacturer field
mSlotManID.AssignWithConversion((char *)slot_info.manufacturerID,
sizeof(slot_info.manufacturerID));
const char *ccManID = (const char*)slot_info.manufacturerID;
const nsACString &cManID = Substring(
ccManID,
ccManID+PL_strnlen(ccManID, sizeof(slot_info.manufacturerID)));
mSlotManID = NS_ConvertUTF8toUCS2(cManID);
mSlotManID.Trim(" ", PR_FALSE, PR_TRUE);
// Set the Hardware Version field
mSlotHWVersion.AppendInt(slot_info.hardwareVersion.major);
@ -204,7 +210,11 @@ nsPKCS11Module::GetName(PRUnichar **aName)
NS_IMETHODIMP
nsPKCS11Module::GetLibName(PRUnichar **aName)
{
*aName = ToNewUnicode(NS_ConvertUTF8toUCS2(mModule->dllName));
if ( mModule->dllName ) {
*aName = ToNewUnicode(NS_ConvertUTF8toUCS2(mModule->dllName));
} else {
*aName = NULL;
}
return NS_OK;
}