After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651251 - Bluetooth passkey not formatted correctly
Bluetooth passkey not formatted correctly
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal critical
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-05-27 13:42 UTC by Bastien Nocera
Modified: 2012-06-06 16:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bluetooth: zero-pad PIN (1.15 KB, patch)
2012-05-17 17:20 UTC, Florian Müllner
committed Details | Review
messageTray: Allow to make notification buttons insensitive (2.40 KB, patch)
2012-05-17 19:22 UTC, Florian Müllner
committed Details | Review
bluetooth: Enforce a PIN length of 6 digits (2.14 KB, patch)
2012-05-17 19:22 UTC, Florian Müllner
committed Details | Review

Description Bastien Nocera 2011-05-27 13:42:28 UTC
The SSP passkey should be prepended with zeros to have the exact 6-digit length.

I have no idea if something like that would work:
- this.addBody(_("Please confirm whether the PIN '%s' matches the one on the device.").format(pin));
+ this.addBody(_("Please confirm whether the PIN '%06d' matches the one on the device.").pin);

See:
http://git.gnome.org/browse/gnome-bluetooth/commit/?id=a9a5b6f82e0623ff9828278a21b900226c2ec9ae
Comment 1 Bastien Nocera 2011-05-27 13:44:57 UTC
And in PinNotification.prototype, we need to ensure that the OK button is only enabled if 6 digits were typed in the entry.
Comment 2 Florian Müllner 2011-05-27 13:50:35 UTC
(In reply to comment #0)
> I have no idea if something like that would work:
> - this.addBody(_("Please confirm whether the PIN '%s' matches the one on the
> device.").format(pin));
> + this.addBody(_("Please confirm whether the PIN '%06d' matches the one on the
> device.").pin);

Yes, see http://git.gnome.org/browse/gnome-shell/commit?id=a84e2e33072f684.
Comment 3 Bastien Nocera 2011-05-27 13:58:38 UTC
+ this.addBody(_("Please confirm whether the PIN '%06d' matches the one on the
device.").format(pin));
then.
Comment 4 Florian Müllner 2011-05-27 14:00:33 UTC
Yeah, I assumed the ().pin was a typo on your part ...
Comment 5 Bastien Nocera 2011-05-27 14:09:48 UTC
(In reply to comment #4)
> Yeah, I assumed the ().pin was a typo on your part ...

Nope, I thought format() was only for int->string conversion. I stand corrected :)
Comment 6 Florian Müllner 2012-05-17 17:20:06 UTC
Created attachment 214268 [details] [review]
bluetooth: zero-pad PIN

Bluetooth PINs always consist of 6 digits, so make sure to add
leading zeros as necessary.

Obvious patch for issue #1
Comment 7 Florian Müllner 2012-05-17 19:22:23 UTC
Created attachment 214274 [details] [review]
messageTray: Allow to make notification buttons insensitive

The availability of a notification action may depend on conditions,
so add a method to control the sensitivity of buttons which have
been added with addButton().
Comment 8 Florian Müllner 2012-05-17 19:22:29 UTC
Created attachment 214275 [details] [review]
bluetooth: Enforce a PIN length of 6 digits

Bluetooth PINs are required to have 6 digits, so enforce that
condition by making the PIN request notification's confirm
button insensitive unless the entered PIN has the correct length.
Comment 9 drago01 2012-05-18 14:54:48 UTC
Review of attachment 214268 [details] [review]:

Looks good.
Comment 10 drago01 2012-05-18 14:56:46 UTC
Review of attachment 214274 [details] [review]:

Looks good.
Comment 11 drago01 2012-05-18 15:00:33 UTC
Review of attachment 214275 [details] [review]:

Looks good, I just don't like the name of the function.

::: js/ui/status/bluetooth.js
@@ +488,3 @@
     },
 
+    _canActivateOk: function() {

I'd call this "_canActiveOkButton" just "ok" somehow sounds odd.
Comment 12 Florian Müllner 2012-05-18 15:42:45 UTC
Attachment 214268 [details] pushed as 76616dc - bluetooth: zero-pad PIN
Attachment 214274 [details] pushed as 6190d6c - messageTray: Allow to make notification buttons insensitive
Attachment 214275 [details] pushed as 48d6eb1 - bluetooth: Enforce a PIN length of 6 digits

(In reply to comment #11)
> +    _canActivateOk: function() {
> 
> I'd call this "_canActiveOkButton" just "ok" somehow sounds odd.

I reckon you mean "canActiv*at*eOkButton" - pushed with that change.
Comment 13 drago01 2012-05-18 15:48:57 UTC
(In reply to comment #12)
> Attachment 214268 [details] pushed as 76616dc - bluetooth: zero-pad PIN
> Attachment 214274 [details] pushed as 6190d6c - messageTray: Allow to make notification
> buttons insensitive
> Attachment 214275 [details] pushed as 48d6eb1 - bluetooth: Enforce a PIN length of 6
> digits
> 
> (In reply to comment #11)
> > +    _canActivateOk: function() {
> > 
> > I'd call this "_canActiveOkButton" just "ok" somehow sounds odd.
> 
> I reckon you mean "canActiv*at*eOkButton" - pushed with that change.

err... yeah ;)
Comment 14 Mantas Mikulėnas (grawity) 2012-05-19 18:05:20 UTC
(In reply to comment #8)
> Created an attachment (id=214275) [details] [review]
> bluetooth: Enforce a PIN length of 6 digits
> 
> Bluetooth PINs are required to have 6 digits, so enforce that
> condition by making the PIN request notification's confirm
> button insensitive unless the entered PIN has the correct length.

I may be an idiot, but ... where is this requirement defined? And will this patch affect /all/ Bluetooth pairings? I clearly remember having paired devices using both numeric and alphanumeric PINs of varying lengths, and even have a device with a hardcoded 4-digit PIN.
Comment 15 Bastien Nocera 2012-06-06 16:13:44 UTC
(In reply to comment #14)
> (In reply to comment #8)
> > Created an attachment (id=214275) [details] [review] [details] [review]
> > bluetooth: Enforce a PIN length of 6 digits
> > 
> > Bluetooth PINs are required to have 6 digits, so enforce that
> > condition by making the PIN request notification's confirm
> > button insensitive unless the entered PIN has the correct length.
> 
> I may be an idiot, but ... where is this requirement defined?

In the Bluetooth specs, for SimplePairing passkeys. See:
http://en.wikipedia.org/wiki/Bluetooth#Pairing_mechanisms