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.
This commit is contained in:
Marco Trevisan (Treviño)
2024-02-13 15:17:04 +01:00
parent c64fa9c81b
commit 92c5fc4643
6 changed files with 26 additions and 26 deletions

4
NEWS
View File

@@ -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

View File

@@ -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;)
{

View File

@@ -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);

View File

@@ -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:

View File

@@ -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

View File

@@ -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'))