Yubico / php-u2flib-server

(OBSOLETE) U2F library in PHP
https://developers.yubico.com/php-u2flib-server/
BSD 2-Clause "Simplified" License
289 stars 68 forks source link

Support single files for attestation #60

Closed francislavoie closed 6 years ago

francislavoie commented 6 years ago

Wrapping the $dir condition with is_dir, otherwise it throws a PHP warning if a string that isn't a directory is passed to opendir. Adds an elseif to check if the path is a valid file, if so add it to the files list.

This is the minimal possible changeset for this, I can add tests if needed. I think $attestDir can be renamed to $attestPath to better match what it does, if this is a change you'd be open to merge. Please let me know if I should make those additional changes.

klali commented 6 years ago

LGTM. A test would be nice if you can add.

francislavoie commented 6 years ago

Sorry it took so long, added a test.

It's just the same test as the one right above, except uses the path to the .pem file directly instead of the parent directory. I ensured that the test fails without the change to get_certs.

klali commented 6 years ago

Thanks! merging.