Last Comment Bug 496005 - some locales will not allow you Unload PKCS#11 Device
: some locales will not allow you Unload PKCS#11 Device
: intl
Product: Core
Classification: Components
Component: Security: PSM (show other bugs)
: Trunk
: All All
P2 normal (vote)
: mozilla17
Assigned To: Nobody; OK to take it and work on it
: David Keeler [:keeler] (use needinfo?)
: 385805 506686 521296 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2009-06-02 13:46 PDT by juan becerra [:juanb]
Modified: 2016-04-26 17:01 PDT (History)
13 users (show)
mbeltzner: blocking1.9.2-
mbeltzner: wanted1.9.2+
mbeltzner: blocking1.9.1-
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

fix (3.21 KB, patch)
2011-03-04 02:19 PST, Makoto Kato [:m_kato]
kaie: review+
rrelyea: review+
Details | Diff | Splinter Review

Description User image juan becerra [:juanb] 2009-06-02 13:46:30 PDT
While verifying bug 494899, I noticed some locales like fr or es-es will not allow you to unload a pkcs# device, according to the instructions in bug 494899, comment #18 in the aforementioned bug. This is inconsistent with the behavior in en-US and other locales like de.

You are, however, able to "Load" pkcs#11 devices if you follow that part of the instructions. 

I can see this problem in Fx2.0.0.20, Fx3.0.12pre, Fx3.1b3, and Fx3.5pre, across platforms on at least fr and es-es, but it probably happens with other locales as well.

1. Install the latest Fx3.5pre (fr locale)
2. Go to the equivalent of Options(Preferences), Advanced, Encryption, and click on Security Devices
3. Select the last item in the list and click on "Unload"
4. Click on OK to confirm that you want to unload the module.

Expected: The item disappears from the list.

Actual: You get a dialog saying it was not possible to unload the module.

Given this behavior has been there since Fx2.x times, this will likely not block, but I will request blocking to get it assessed.
Comment 1 User image Mike Beltzner [:beltzner, not reading bugmail] 2009-06-02 21:45:38 PDT
Not blocking 3.5 final, would take a fix for 3.5.x, should fix for .next.
Comment 2 User image u60234 2009-06-05 11:21:34 PDT
It looks like Device Manager have a problem with non-ASCII characters in the name of PKCS#11 devices. Fr and es-ES both have accented characters in their translation of "Builtin Roots Module", removing those fixes this problem.

Using non-ASCII characters in the name of a new module is also problematic. You can add such as module, but the name won't show up in Device Manager and you can't see any of the properties of the module.
Comment 3 User image Benjamin Smedberg [:bsmedberg] 2009-06-06 17:16:50 PDT
It appears that the string being passed in goes through truncation via ToNewCString:

I can't find docs for the format expected of the const char *moduleName parameter to SECMOD_AddNewModule but I'm pretty sure we just treats it as a sequence of octets and we could pass a UTF8-encoded string. We should probably just switch the nsPkcs11 code to use UTF8 throughout for module names.
Comment 4 User image Benjamin Smedberg [:bsmedberg] 2010-07-21 07:45:56 PDT
This is a bug, but it's not serious enough to block Firefox 4 release. I'd still take a patch, though.
Comment 5 User image Makoto Kato [:m_kato] 2011-02-03 23:46:10 PST
*** Bug 521296 has been marked as a duplicate of this bug. ***
Comment 6 User image Makoto Kato [:m_kato] 2011-03-04 02:19:24 PST
Created attachment 516846 [details] [diff] [review]
Comment 7 User image Robert Relyea 2012-08-15 10:10:57 PDT
Comment on attachment 516846 [details] [diff] [review]

r+ for the conversion to UTF8. All NSS/PKCS #11 calls are defined to be UTF8, so UTF16 values should all be converted.

Someone else should verify that the memory usage and xpcom standards are correct.

Comment 8 User image Kai Engert (:kaie) 2012-08-15 12:50:25 PDT
Comment on attachment 516846 [details] [diff] [review]

Thanks Bob.

r=kaie for the remainder of the patch
Comment 9 User image Kai Engert (:kaie) 2012-08-15 12:55:56 PDT
Makoto Kato, thank you very much for your contribution!
Comment 10 User image Ed Morley [:emorley] 2012-08-16 06:19:32 PDT
Comment 11 User image :Cykesiopka 2016-02-04 13:27:43 PST
*** Bug 385805 has been marked as a duplicate of this bug. ***
Comment 12 User image David Keeler [:keeler] (use needinfo?) 2016-04-26 17:01:42 PDT
*** Bug 506686 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.