http://code.google.com/p/yubikey-personalization/downloads/list
Happy hacking,
Richard & Simon
| We are proud to release version 1.0 of the yubikey-personalization
| project! After testing on a variety of platforms, we now consider it
| stable. Please download from:
|
| http://code.google.com/p/yubikey-personalization/downloads/list
Great! Uploaded to Debian.
I've found a bug though:
: tfheen@qurzaw ..personalization/git/build > ykpersonalize -h
[snip help output]
zsh: segmentation fault ykpersonalize -h
This is due to the libusb-1.0 backend not checking if libusb has been
initialised before trying to release it. If I copy the logic in
libusb_osx.c, it ends uplooking like:
: tfheen@qurzaw ..personalization/git/build > ykpersonalize -h
[snip help output]
USB error: Success (no error)
: tfheen@qurzaw ..personalization/git/build >
which is silly.
I'd suggest the following two patches to fix this, one to make libusb
not segfault and one to make ykpersonalize not spit out the silly
message:
diff --git a/ykcore/ykcore_libusb-1.0.c b/ykcore/ykcore_libusb-1.0.c
index 7fc9aee..35f7bb0 100644
--- a/ykcore/ykcore_libusb-1.0.c
+++ b/ykcore/ykcore_libusb-1.0.c
@@ -41,6 +41,7 @@
#define HID_SET_REPORT 0x09
static int ykl_errno;
+static int libusb_inited = 0;
/*************************************************************************
** function _ykusb_write **
@@ -135,13 +136,18 @@ int _ykusb_read(void *dev, int report_type, int report_number,
int _ykusb_start(void)
{
libusb_init(NULL);
+ libusb_inited = 1;
return 1;
}
extern int _ykusb_stop(void)
{
- libusb_exit(NULL);
- return 1;
+ if (libusb_inited == 1) {
+ libusb_exit(NULL);
+ return 1;
+ }
+ yk_errno = YK_EUSBERR;
+ return 0;
}
void *_ykusb_open_device(int vendor_id, int product_id)
diff --git a/ykpersonalize.c b/ykpersonalize.c
index aa637a7..0e8ca51 100644
--- a/ykpersonalize.c
+++ b/ykpersonalize.c
@@ -183,11 +183,6 @@ int main(int argc, char **argv)
ykp_errno = 0;
yk_errno = 0;
- if (argc == 2 && strcmp (argv[1], "-h") == 0) {
- fputs(usage, stderr);
- goto err;
- }
-
/* Assume the worst */
error = true;
@@ -196,6 +191,11 @@ int main(int argc, char **argv)
goto err;
}
+ if (argc == 2 && strcmp (argv[1], "-h") == 0) {
+ fputs(usage, stderr);
+ goto err;
+ }
+
if (!(yk = yk_open_first_key())) {
exit_code = 1;
goto err;
If you're ok with those, I'll commit. It'd be helpful if somebody on
Mac OSX could check if «ykpersonalize -h» gives out any error message as
the last line too, as I can't actually test there. (I'm not sure if you
need to be root to open the USB bus on Mac OS, it seems you can do
libusb_init() on Linux at least without any trouble, as a normal user.
--
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are
> ]] Simon Josefsson
>
> | We are proud to release version 1.0 of the yubikey-personalization
> | project! After testing on a variety of platforms, we now consider it
> | stable. Please download from:
> |
> | http://code.google.com/p/yubikey-personalization/downloads/list
>
> Great! Uploaded to Debian.
Thank you.
> I've found a bug though:
Richard also noticed that the ReadMe documentation on parameter values
doesn't reflect reality. It seems you never notice these things until
after v1.0... So we'll need a quick v1.1.
> : tfheen@qurzaw ..personalization/git/build > ykpersonalize -h
> [snip help output]
> zsh: segmentation fault ykpersonalize -h
Not seeing that here, strange...
> This is due to the libusb-1.0 backend not checking if libusb has been
> initialised before trying to release it.
Indeed.
> If you're ok with those, I'll commit.
Seems fine to me, thank you.
> It'd be helpful if somebody on Mac OSX could check if «ykpersonalize
> -h» gives out any error message as the last line too, as I can't
> actually test there. (I'm not sure if you need to be root to open the
> USB bus on Mac OS, it seems you can do libusb_init() on Linux at least
> without any trouble, as a normal user.
Let's release v1.1 and ask Mac OS X users to test it. Btw, if you have
a PGP key and wants to roll the release you can follow the steps at
http://code.google.com/p/yubikey-personalization/wiki/MakeRelease
otherwise I can do it too.
/Simon
--
Regards,
Patrick
| Tollef, I acted quickly. Too quickly in a way... I just commited the
| patch for you, didn't see that you intended to do so yourself. My
| apologies, I really didn't mean to step on your toes like that.
No worries. :-)
| OS X uses a different backend which is independent of libusb, or so I
| thought.
Yes, it does, but assuming I read the code correctly, you should get a
«USB error: Success (no error)» when running it with -h. Can somebody
with access to Mac OS X check that (with 1.0)?
>
> ]] Patrick Neave
>
> | OS X uses a different backend which is independent of libusb, or
> so I
> | thought.
>
> Yes, it does, but assuming I read the code correctly, you should get a
> «USB error: Success (no error)» when running it with -h. Can somebody
> with access to Mac OS X check that (with 1.0)?
patrick@Milhouse:~/Source/ykpers/ykpers-1.0> ykpersonalize -h
... <stuff snipped>...
(only with Yubikey II!)
-y always commit (do not prompt)
-v verbose
-h help (this text)
USB error: USB error
Yes I get the error message on OS X 10.6.1
-- Patrick