From 92c5fc464373d7b70600a22301b30701e76764a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 13 Feb 2024 15:17:04 +0100 Subject: [PATCH] cleanup: Use allow/deny lists instead of color based ones There was nothing racist on those names here (what? Do human races even exist?!), but let's avoid any confusion. --- NEWS | 4 ++-- libfprint/fp-context.c | 20 ++++++++++---------- libfprint/fprint-list-udev-hwdb.c | 20 ++++++++++---------- tests/create-driver-test.py.in | 2 +- tests/egis0570/device | 2 +- tests/meson.build | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index 1b87665e..103740f6 100644 --- a/NEWS +++ b/NEWS @@ -357,7 +357,7 @@ tests of the drivers using umockdev. - Mark fp_dscv_print functions as deprecated * Udev rules: - - Add some unsupported devices to the whitelist + - Add some unsupported devices to the allowlist 2017-05-14: v0.7.0 release * Drivers: @@ -407,7 +407,7 @@ tests of the drivers using umockdev. - Fix possible race condition, and cancellation in uru4000 driver * Udev rules: - - Add Microsoft keyboard to the suspend blacklist + - Add Microsoft keyboard to the suspend denylist * Plenty of build fixes diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c index 34fcdda8..f6c386df 100644 --- a/libfprint/fp-context.c +++ b/libfprint/fp-context.c @@ -67,29 +67,29 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; static const char * -get_drivers_whitelist_env (void) +get_drivers_allowlist_env (void) { - return g_getenv ("FP_DRIVERS_WHITELIST"); + return g_getenv ("FP_DRIVERS_ALLOWLIST"); } static gboolean is_driver_allowed (const gchar *driver) { - g_auto(GStrv) whitelisted_drivers = NULL; - const char *fp_drivers_whitelist_env; + g_auto(GStrv) allowlisted_drivers = NULL; + const char *fp_drivers_allowlist_env; int i; g_return_val_if_fail (driver, TRUE); - fp_drivers_whitelist_env = get_drivers_whitelist_env (); + fp_drivers_allowlist_env = get_drivers_allowlist_env (); - if (!fp_drivers_whitelist_env) + if (!fp_drivers_allowlist_env) return TRUE; - whitelisted_drivers = g_strsplit (fp_drivers_whitelist_env, ":", -1); + allowlisted_drivers = g_strsplit (fp_drivers_allowlist_env, ":", -1); - for (i = 0; whitelisted_drivers[i]; ++i) - if (g_strcmp0 (driver, whitelisted_drivers[i]) == 0) + for (i = 0; allowlisted_drivers[i]; ++i) + if (g_strcmp0 (driver, allowlisted_drivers[i]) == 0) return TRUE; return FALSE; @@ -364,7 +364,7 @@ fp_context_init (FpContext *self) priv->drivers = fpi_get_driver_types (); - if (get_drivers_whitelist_env ()) + if (get_drivers_allowlist_env ()) { for (i = 0; i < priv->drivers->len;) { diff --git a/libfprint/fprint-list-udev-hwdb.c b/libfprint/fprint-list-udev-hwdb.c index 7c41050b..3eca8040 100644 --- a/libfprint/fprint-list-udev-hwdb.c +++ b/libfprint/fprint-list-udev-hwdb.c @@ -24,7 +24,7 @@ #include "fpi-context.h" #include "fpi-device.h" -static const FpIdEntry whitelist_id_table[] = { +static const FpIdEntry allowlist_id_table[] = { /* Currently known and unsupported devices. * You can generate this list from the wiki page using e.g.: * gio cat https://gitlab.freedesktop.org/libfprint/wiki/-/wikis/Unsupported-Devices.md | sed -n 's!|.*\([0-9a-fA-F]\{4\}\):\([0-9a-fA-F]\{4\}\).*|.*! { .vid = 0x\1, .pid = 0x\2 },!p' @@ -138,18 +138,18 @@ static const FpIdEntry whitelist_id_table[] = { { .vid = 0 }, }; -static const FpIdEntry blacklist_id_table[] = { +static const FpIdEntry denylist_id_table[] = { { .vid = 0x0483, .pid = 0x2016 }, /* https://bugs.freedesktop.org/show_bug.cgi?id=66659 */ { .vid = 0x045e, .pid = 0x00bb }, { .vid = 0 }, }; -static const FpDeviceClass whitelist = { +static const FpDeviceClass allowlist = { .type = FP_DEVICE_TYPE_USB, - .id_table = whitelist_id_table, - .id = "whitelist", - .full_name = "Hardcoded whitelist" + .id_table = allowlist_id_table, + .id = "allowlist", + .full_name = "Hardcoded allowlist" }; GHashTable *printed = NULL; @@ -168,7 +168,7 @@ print_driver (const FpDeviceClass *cls) const FpIdEntry *bl_entry; char *key; - for (bl_entry = blacklist_id_table; bl_entry->vid != 0; bl_entry++) + for (bl_entry = denylist_id_table; bl_entry->vid != 0; bl_entry++) if (entry->vid == bl_entry->vid && entry->pid == bl_entry->pid) break; @@ -179,7 +179,7 @@ print_driver (const FpDeviceClass *cls) if (g_hash_table_lookup (printed, key) != NULL) { - if (cls == &whitelist) + if (cls == &allowlist) g_warning ("%s implemented by driver %s", key, (const char *) g_hash_table_lookup (printed, key)); g_free (key); @@ -190,7 +190,7 @@ print_driver (const FpDeviceClass *cls) if (num_printed == 0) { - if (cls != &whitelist) + if (cls != &allowlist) g_print ("\n# Supported by libfprint driver %s\n", cls->id); else g_print ("\n# Known unsupported devices\n"); @@ -244,7 +244,7 @@ main (int argc, char **argv) print_driver (cls); } - print_driver (&whitelist); + print_driver (&allowlist); g_hash_table_destroy (printed); diff --git a/tests/create-driver-test.py.in b/tests/create-driver-test.py.in index 8173271f..64d96db4 100755 --- a/tests/create-driver-test.py.in +++ b/tests/create-driver-test.py.in @@ -44,7 +44,7 @@ if len(sys.argv) > 3: sys.exit(1) driver_name = sys.argv[1] -os.environ['FP_DRIVERS_WHITELIST'] = driver_name +os.environ['FP_DRIVERS_ALLOWLIST'] = driver_name test_variant = None if len(sys.argv) == 3: diff --git a/tests/egis0570/device b/tests/egis0570/device index 5247b785..3001bd98 100644 --- a/tests/egis0570/device +++ b/tests/egis0570/device @@ -24,7 +24,7 @@ E: ID_USB_INTERFACES=:ff0000: E: ID_VENDOR_FROM_DATABASE=LighTuning Technology Inc. E: ID_PATH=pci-0000:00:14.0-usb-0:9 E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_9 -E: LIBFPRINT_DRIVER=Hardcoded whitelist +E: LIBFPRINT_DRIVER=Hardcoded allowlist A: authorized=1\n A: avoid_reset_quirk=0\n A: bConfigurationValue=1\n diff --git a/tests/meson.build b/tests/meson.build index 48c83037..199500d2 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -15,7 +15,7 @@ envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint') envs.set('FP_DEVICE_EMULATION', '1') # Set a colon-separated list of native drivers we enable in tests -envs.set('FP_DRIVERS_WHITELIST', ':'.join([ +envs.set('FP_DRIVERS_ALLOWLIST', ':'.join([ 'virtual_image', 'virtual_device', 'virtual_device_storage', @@ -159,7 +159,7 @@ if get_option('introspection') foreach driver_test: drivers_tests driver_name = driver_test.split('-')[0] driver_envs = envs - driver_envs.set('FP_DRIVERS_WHITELIST', driver_name) + driver_envs.set('FP_DRIVERS_ALLOWLIST', driver_name) if (driver_name in supported_drivers and gusb_dep.version().version_compare('>= 0.3.0'))