Skip to content

Commit

Permalink
#261: Allow 'Generic' as serial valueu
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdope committed Jan 18, 2025
1 parent 38a32d5 commit 2a5d3fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/CONFIGURATION
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The syntax is the following:
| `volume_uuid` | Element | UUID of the device's volume used to store pads | `6F6B-42FC` |

### Note:
Some cheap devices don't report a vendor and/or model. To use these devices you can use "Generic" for these values, then it won't be checked.
Some cheap devices don't report a vendor and/or model, some not even a serial (see https://github.com/mcdope/pam_usb/issues/261). To use these devices you can use "Generic" for these values, then it won't be checked.
Be aware that this reduces security if you have `one_time_pads` disabled since the device containing the volume won't be checked anymore (but these attributes could be faked with a custom firmware anyway).

### Example:
Expand Down
6 changes: 5 additions & 1 deletion src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ static int pusb_device_connected(t_pusb_options *opts, UDisksClient *udisks)
if (udisks_object_peek_drive(object))
{
drive = udisks_object_get_drive(object);
retval = strcmp(udisks_drive_get_serial(drive), opts->device_list[currentDevice].serial) == 0;

if (strcmp(opts->device_list[currentDevice].serial, "Generic") != 0)
{
retval = strcmp(udisks_drive_get_serial(drive), opts->device_list[currentDevice].serial) == 0;
}

if (strcmp(opts->device_list[currentDevice].vendor, "Generic") != 0)
{
Expand Down

0 comments on commit 2a5d3fa

Please sign in to comment.