[PATCH 02/12] nss_compat: Use 'denylist' instead of 'blacklist' in code.

Carlos O'Donell carlos@redhat.com
Tue May 20 11:45:15 GMT 2025


Use more inclusive language for structure and function names.
---
 nss/nss_compat/compat-grp.c        | 90 ++++++++++++++--------------
 nss/nss_compat/compat-initgroups.c | 92 ++++++++++++++---------------
 nss/nss_compat/compat-pwd.c        | 92 ++++++++++++++---------------
 nss/nss_compat/compat-spwd.c       | 94 +++++++++++++++---------------
 4 files changed, 184 insertions(+), 184 deletions(-)

diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c
index 86a46d0622..e6312183ab 100644
--- a/nss/nss_compat/compat-grp.c
+++ b/nss/nss_compat/compat-grp.c
@@ -48,9 +48,9 @@ static enum nss_status (*endgrent_impl) (void);
 #include <nss/nss_files/files-parse.c>
 
 /* Structure for remembering -group members ... */
-#define BLACKLIST_INITIAL_SIZE 512
-#define BLACKLIST_INCREMENT 256
-struct blacklist_t
+#define DENYLIST_INITIAL_SIZE 512
+#define DENYLIST_INCREMENT 256
+struct denylist_t
 {
   char *data;
   int current;
@@ -62,7 +62,7 @@ struct ent_t
   bool files;
   enum nss_status setent_status;
   FILE *stream;
-  struct blacklist_t blacklist;
+  struct denylist_t denylist;
 };
 typedef struct ent_t ent_t;
 
@@ -72,8 +72,8 @@ static ent_t ext_ent = { true, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 }};
 __libc_lock_define_initialized (static, lock)
 
 /* Prototypes for local functions.  */
-static void blacklist_store_name (const char *, ent_t *);
-static bool in_blacklist (const char *, int, ent_t *);
+static void denylist_store_name (const char *, ent_t *);
+static bool in_denylist (const char *, int, ent_t *);
 
 /* Initialize the NSS interface/functions. The calling function must
    hold the lock.  */
@@ -97,14 +97,14 @@ internal_setgrent (ent_t *ent, int stayopen, int needent)
 
   ent->files = true;
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -150,14 +150,14 @@ internal_endgrent (ent_t *ent)
       ent->stream = NULL;
     }
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   return NSS_STATUS_SUCCESS;
 }
@@ -208,7 +208,7 @@ getgrent_next_nss (struct group *result, ent_t *ent, char *buffer,
 	  != NSS_STATUS_SUCCESS)
 	return status;
     }
-  while (in_blacklist (result->gr_name, strlen (result->gr_name), ent));
+  while (in_denylist (result->gr_name, strlen (result->gr_name), ent));
 
   return NSS_STATUS_SUCCESS;
 }
@@ -226,7 +226,7 @@ getgrnam_plusgroup (const char *name, struct group *result, ent_t *ent,
   if (status != NSS_STATUS_SUCCESS)
     return status;
 
-  if (in_blacklist (result->gr_name, strlen (result->gr_name), ent))
+  if (in_denylist (result->gr_name, strlen (result->gr_name), ent))
     return NSS_STATUS_NOTFOUND;
 
   /* We found the entry.  */
@@ -292,7 +292,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
       if (result->gr_name[0] == '-' && result->gr_name[1] != '\0'
 	  && result->gr_name[1] != '@')
 	{
-	  blacklist_store_name (&result->gr_name[1], ent);
+	  denylist_store_name (&result->gr_name[1], ent);
 	  continue;
 	}
 
@@ -304,12 +304,12 @@ getgrent_next_file (struct group *result, ent_t *ent,
 	  char buf[len];
 	  enum nss_status status;
 
-	  /* Store the group in the blacklist for the "+" at the end of
+	  /* Store the group in the denylist for the "+" at the end of
 	     /etc/group */
 	  memcpy (buf, &result->gr_name[1], len);
 	  status = getgrnam_plusgroup (&result->gr_name[1], result, ent,
 				       buffer, buflen, errnop);
-	  blacklist_store_name (buf, ent);
+	  denylist_store_name (buf, ent);
 	  if (status == NSS_STATUS_SUCCESS)	/* We found the entry. */
 	    break;
 	  else if (status == NSS_STATUS_RETURN /* We couldn't parse the entry*/
@@ -560,7 +560,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
       /* -group */
       if (result->gr_name[0] == '-' && result->gr_name[1] != '\0')
 	{
-	  blacklist_store_name (&result->gr_name[1], ent);
+	  denylist_store_name (&result->gr_name[1], ent);
 	  continue;
 	}
 
@@ -572,12 +572,12 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
 	  char buf[len];
 	  enum nss_status status;
 
-	  /* Store the group in the blacklist for the "+" at the end of
+	  /* Store the group in the denylist for the "+" at the end of
 	     /etc/group */
 	  memcpy (buf, &result->gr_name[1], len);
 	  status = getgrnam_plusgroup (&result->gr_name[1], result, ent,
 				       buffer, buflen, errnop);
-	  blacklist_store_name (buf, ent);
+	  denylist_store_name (buf, ent);
 	  if (status == NSS_STATUS_SUCCESS && result->gr_gid == gid)
 	    break;
 	  else
@@ -629,62 +629,62 @@ _nss_compat_getgrgid_r (gid_t gid, struct group *grp,
 /* Support routines for remembering -@netgroup and -user entries.
    The names are stored in a single string with `|' as separator. */
 static void
-blacklist_store_name (const char *name, ent_t *ent)
+denylist_store_name (const char *name, ent_t *ent)
 {
   int namelen = strlen (name);
   char *tmp;
 
   /* first call, setup cache */
-  if (ent->blacklist.size == 0)
+  if (ent->denylist.size == 0)
     {
-      ent->blacklist.size = MAX (BLACKLIST_INITIAL_SIZE, 2 * namelen);
-      ent->blacklist.data = malloc (ent->blacklist.size);
-      if (ent->blacklist.data == NULL)
+      ent->denylist.size = MAX (DENYLIST_INITIAL_SIZE, 2 * namelen);
+      ent->denylist.data = malloc (ent->denylist.size);
+      if (ent->denylist.data == NULL)
 	return;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
-      ent->blacklist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
+      ent->denylist.current = 1;
     }
   else
     {
-      if (in_blacklist (name, namelen, ent))
+      if (in_denylist (name, namelen, ent))
 	return;			/* no duplicates */
 
-      if (ent->blacklist.current + namelen + 1 >= ent->blacklist.size)
+      if (ent->denylist.current + namelen + 1 >= ent->denylist.size)
 	{
-	  ent->blacklist.size += MAX (BLACKLIST_INCREMENT, 2 * namelen);
-	  tmp = realloc (ent->blacklist.data, ent->blacklist.size);
+	  ent->denylist.size += MAX (DENYLIST_INCREMENT, 2 * namelen);
+	  tmp = realloc (ent->denylist.data, ent->denylist.size);
 	  if (tmp == NULL)
 	    {
-	      free (ent->blacklist.data);
-	      ent->blacklist.size = 0;
+	      free (ent->denylist.data);
+	      ent->denylist.size = 0;
 	      return;
 	    }
-	  ent->blacklist.data = tmp;
+	  ent->denylist.data = tmp;
 	}
     }
 
-  tmp = stpcpy (ent->blacklist.data + ent->blacklist.current, name);
+  tmp = stpcpy (ent->denylist.data + ent->denylist.current, name);
   *tmp++ = '|';
   *tmp = '\0';
-  ent->blacklist.current += namelen + 1;
+  ent->denylist.current += namelen + 1;
 
   return;
 }
 
-/* Return whether ent->blacklist contains name.  */
+/* Return whether ent->denylist contains name.  */
 static bool
-in_blacklist (const char *name, int namelen, ent_t *ent)
+in_denylist (const char *name, int namelen, ent_t *ent)
 {
   char buf[namelen + 3];
   char *cp;
 
-  if (ent->blacklist.data == NULL)
+  if (ent->denylist.data == NULL)
     return false;
 
   buf[0] = '|';
   cp = stpcpy (&buf[1], name);
   *cp++ = '|';
   *cp = '\0';
-  return strstr (ent->blacklist.data, buf) != NULL;
+  return strstr (ent->denylist.data, buf) != NULL;
 }
diff --git a/nss/nss_compat/compat-initgroups.c b/nss/nss_compat/compat-initgroups.c
index faff0e098b..43f793905e 100644
--- a/nss/nss_compat/compat-initgroups.c
+++ b/nss/nss_compat/compat-initgroups.c
@@ -58,9 +58,9 @@ __libc_lock_define_initialized (static, lock)
 #include <nss/nss_files/files-parse.c>
 
 /* Structure for remembering -group members ... */
-#define BLACKLIST_INITIAL_SIZE 512
-#define BLACKLIST_INCREMENT 256
-struct blacklist_t
+#define DENYLIST_INITIAL_SIZE 512
+#define DENYLIST_INCREMENT 256
+struct denylist_t
 {
   char *data;
   int current;
@@ -73,13 +73,13 @@ struct ent_t
   bool need_endgrent;
   bool skip_initgroups_dyn;
   FILE *stream;
-  struct blacklist_t blacklist;
+  struct denylist_t denylist;
 };
 typedef struct ent_t ent_t;
 
 /* Prototypes for local functions.  */
-static void blacklist_store_name (const char *, ent_t *);
-static bool in_blacklist (const char *, int, ent_t *);
+static void denylist_store_name (const char *, ent_t *);
+static bool in_denylist (const char *, int, ent_t *);
 
 /* Initialize the NSS interface/functions. The calling function must
    hold the lock.  */
@@ -113,14 +113,14 @@ internal_setgrent (ent_t *ent)
   if (ni == NULL)
     init_nss_interface ();
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   ent->stream = __nss_files_fopen ("/etc/group");
 
@@ -140,14 +140,14 @@ internal_endgrent (ent_t *ent)
       ent->stream = NULL;
     }
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   if (ent->need_endgrent && endgrent_impl != NULL)
     endgrent_impl ();
@@ -246,7 +246,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 
       /* For every gid in the list we get from the NSS module,
 	 get the whole group entry. We need to do this, since we
-	 need the group name to check if it is in the blacklist.
+	 need the group name to check if it is in the denylist.
 	 In worst case, this is as twice as slow as stepping with
 	 getgrent_r through the whole group database. But for large
 	 group databases this is faster, since the user can only be
@@ -256,9 +256,9 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	{
 	  status = NSS_STATUS_NOTFOUND;
 
-	  /* If there is no blacklist we can trust the underlying
+	  /* If there is no denylist we can trust the underlying
 	     initgroups implementation.  */
-	  if (ent->blacklist.current <= 1)
+	  if (ent->denylist.current <= 1)
 	    for (int i = 0; i < mystart; i++)
 	      add_group (start, size, groupsp, limit, mygroups[i]);
 	  else
@@ -303,7 +303,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 		      if (__builtin_expect  (status != NSS_STATUS_SUCCESS, 0))
 		        goto done;
 
-		      if (!in_blacklist (grpbuf.gr_name,
+		      if (!in_denylist (grpbuf.gr_name,
 					 strlen (grpbuf.gr_name), ent)
 			  && check_and_add_group (user, group, start, size,
 						  groupsp, limit, &grpbuf))
@@ -345,7 +345,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 	  != NSS_STATUS_SUCCESS)
 	break;
     }
-  while (in_blacklist (grpbuf.gr_name, strlen (grpbuf.gr_name), ent));
+  while (in_denylist (grpbuf.gr_name, strlen (grpbuf.gr_name), ent));
 
   if (status == NSS_STATUS_SUCCESS)
     check_and_add_group (user, group, start, size, groupsp, limit, &grpbuf);
@@ -419,7 +419,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
       if (grpbuf.gr_name[0] == '-' && grpbuf.gr_name[1] != '\0'
 	  && grpbuf.gr_name[1] != '@')
 	{
-	  blacklist_store_name (&grpbuf.gr_name[1], ent);
+	  denylist_store_name (&grpbuf.gr_name[1], ent);
 	  continue;
 	}
 
@@ -427,12 +427,12 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
       if (grpbuf.gr_name[0] == '+' && grpbuf.gr_name[1] != '\0'
 	  && grpbuf.gr_name[1] != '@')
 	{
-	  if (in_blacklist (&grpbuf.gr_name[1],
+	  if (in_denylist (&grpbuf.gr_name[1],
 			    strlen (&grpbuf.gr_name[1]), ent))
 	    continue;
-	  /* Store the group in the blacklist for the "+" at the end of
+	  /* Store the group in the denylist for the "+" at the end of
 	     /etc/group */
-	  blacklist_store_name (&grpbuf.gr_name[1], ent);
+	  denylist_store_name (&grpbuf.gr_name[1], ent);
 	  if (getgrnam_r_impl == NULL)
 	    return NSS_STATUS_UNAVAIL;
 	  else if (getgrnam_r_impl (&grpbuf.gr_name[1], &grpbuf, buffer,
@@ -517,62 +517,62 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
 /* Support routines for remembering -@netgroup and -user entries.
    The names are stored in a single string with `|' as separator. */
 static void
-blacklist_store_name (const char *name, ent_t *ent)
+denylist_store_name (const char *name, ent_t *ent)
 {
   int namelen = strlen (name);
   char *tmp;
 
   /* First call, setup cache.  */
-  if (ent->blacklist.size == 0)
+  if (ent->denylist.size == 0)
     {
-      ent->blacklist.size = MAX (BLACKLIST_INITIAL_SIZE, 2 * namelen);
-      ent->blacklist.data = malloc (ent->blacklist.size);
-      if (ent->blacklist.data == NULL)
+      ent->denylist.size = MAX (DENYLIST_INITIAL_SIZE, 2 * namelen);
+      ent->denylist.data = malloc (ent->denylist.size);
+      if (ent->denylist.data == NULL)
 	return;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
-      ent->blacklist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
+      ent->denylist.current = 1;
     }
   else
     {
-      if (in_blacklist (name, namelen, ent))
+      if (in_denylist (name, namelen, ent))
 	return;			/* no duplicates */
 
-      if (ent->blacklist.current + namelen + 1 >= ent->blacklist.size)
+      if (ent->denylist.current + namelen + 1 >= ent->denylist.size)
 	{
-	  ent->blacklist.size += MAX (BLACKLIST_INCREMENT, 2 * namelen);
-	  tmp = realloc (ent->blacklist.data, ent->blacklist.size);
+	  ent->denylist.size += MAX (DENYLIST_INCREMENT, 2 * namelen);
+	  tmp = realloc (ent->denylist.data, ent->denylist.size);
 	  if (tmp == NULL)
 	    {
-	      free (ent->blacklist.data);
-	      ent->blacklist.size = 0;
+	      free (ent->denylist.data);
+	      ent->denylist.size = 0;
 	      return;
 	    }
-	  ent->blacklist.data = tmp;
+	  ent->denylist.data = tmp;
 	}
     }
 
-  tmp = stpcpy (ent->blacklist.data + ent->blacklist.current, name);
+  tmp = stpcpy (ent->denylist.data + ent->denylist.current, name);
   *tmp++ = '|';
   *tmp = '\0';
-  ent->blacklist.current += namelen + 1;
+  ent->denylist.current += namelen + 1;
 
   return;
 }
 
-/* Return whether ent->blacklist contains name.  */
+/* Return whether ent->denylist contains name.  */
 static bool
-in_blacklist (const char *name, int namelen, ent_t *ent)
+in_denylist (const char *name, int namelen, ent_t *ent)
 {
   char buf[namelen + 3];
   char *cp;
 
-  if (ent->blacklist.data == NULL)
+  if (ent->denylist.data == NULL)
     return false;
 
   buf[0] = '|';
   cp = stpcpy (&buf[1], name);
   *cp++ = '|';
   *cp = '\0';
-  return strstr (ent->blacklist.data, buf) != NULL;
+  return strstr (ent->denylist.data, buf) != NULL;
 }
diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c
index 7da6dc99f7..aba0190985 100644
--- a/nss/nss_compat/compat-pwd.c
+++ b/nss/nss_compat/compat-pwd.c
@@ -52,9 +52,9 @@ static enum nss_status (*endpwent_impl) (void);
 #include <nss/nss_files/files-parse.c>
 
 /* Structure for remembering -@netgroup and -user members ... */
-#define BLACKLIST_INITIAL_SIZE 512
-#define BLACKLIST_INCREMENT 256
-struct blacklist_t
+#define DENYLIST_INITIAL_SIZE 512
+#define DENYLIST_INCREMENT 256
+struct denylist_t
 {
   char *data;
   int current;
@@ -68,7 +68,7 @@ struct ent_t
   bool files;
   enum nss_status setent_status;
   FILE *stream;
-  struct blacklist_t blacklist;
+  struct denylist_t denylist;
   struct passwd pwd;
   struct __netgrent netgrdata;
 };
@@ -82,8 +82,8 @@ static ent_t ext_ent = { false, false, true, NSS_STATUS_SUCCESS, NULL,
 __libc_lock_define_initialized (static, lock)
 
 /* Prototypes for local functions.  */
-static void blacklist_store_name (const char *, ent_t *);
-static bool in_blacklist (const char *, int, ent_t *);
+static void denylist_store_name (const char *, ent_t *);
+static bool in_denylist (const char *, int, ent_t *);
 
 /* Initialize the NSS interface/functions. The calling function must
    hold the lock.  */
@@ -212,14 +212,14 @@ internal_setpwent (ent_t *ent, int stayopen, int needent)
   if (ent->netgroup)
     __internal_endnetgrent (&ent->netgrdata);
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -272,14 +272,14 @@ internal_endpwent (ent_t *ent)
 
   ent->first = ent->netgroup = false;
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   give_pwd_free (&ent->pwd);
 
@@ -382,11 +382,11 @@ getpwent_next_nss_netgr (const char *name, struct passwd *result, ent_t *ent,
 	  != NSS_STATUS_SUCCESS)
 	continue;
 
-      if (!in_blacklist (result->pw_name, strlen (result->pw_name), ent))
+      if (!in_denylist (result->pw_name, strlen (result->pw_name), ent))
 	{
-	  /* Store the User in the blacklist for possible the "+" at the
+	  /* Store the User in the denylist for possible the "+" at the
 	     end of /etc/passwd */
-	  blacklist_store_name (result->pw_name, ent);
+	  denylist_store_name (result->pw_name, ent);
 	  copy_pwd_changes (result, &ent->pwd, p2, p2len);
 	  break;
 	}
@@ -430,7 +430,7 @@ getpwent_next_nss (struct passwd *result, ent_t *ent, char *buffer,
 	  != NSS_STATUS_SUCCESS)
 	return status;
     }
-  while (in_blacklist (result->pw_name, strlen (result->pw_name), ent));
+  while (in_denylist (result->pw_name, strlen (result->pw_name), ent));
 
   copy_pwd_changes (result, &ent->pwd, p2, p2len);
 
@@ -464,7 +464,7 @@ getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
   if (status != NSS_STATUS_SUCCESS)
     return status;
 
-  if (in_blacklist (result->pw_name, strlen (result->pw_name), ent))
+  if (in_denylist (result->pw_name, strlen (result->pw_name), ent))
     return NSS_STATUS_NOTFOUND;
 
   copy_pwd_changes (result, &pwd, p, plen);
@@ -543,7 +543,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 					   buf2, sizeof (buf2), errnop))
 	    {
 	      if (user != NULL && user[0] != '-')
-		blacklist_store_name (user, ent);
+		denylist_store_name (user, ent);
 	    }
 	  __internal_endnetgrent (&netgrdata);
 	  continue;
@@ -572,7 +572,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
       if (result->pw_name[0] == '-' && result->pw_name[1] != '\0'
 	  && result->pw_name[1] != '@')
 	{
-	  blacklist_store_name (&result->pw_name[1], ent);
+	  denylist_store_name (&result->pw_name[1], ent);
 	  continue;
 	}
 
@@ -584,12 +584,12 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 	  char buf[len];
 	  enum nss_status status;
 
-	  /* Store the User in the blacklist for the "+" at the end of
+	  /* Store the User in the denylist for the "+" at the end of
 	     /etc/passwd */
 	  memcpy (buf, &result->pw_name[1], len);
 	  status = getpwnam_plususer (&result->pw_name[1], result, ent,
 				      buffer, buflen, errnop);
-	  blacklist_store_name (buf, ent);
+	  denylist_store_name (buf, ent);
 
 	  if (status == NSS_STATUS_SUCCESS)	/* We found the entry. */
 	    break;
@@ -1078,62 +1078,62 @@ _nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
 /* Support routines for remembering -@netgroup and -user entries.
    The names are stored in a single string with `|' as separator. */
 static void
-blacklist_store_name (const char *name, ent_t *ent)
+denylist_store_name (const char *name, ent_t *ent)
 {
   int namelen = strlen (name);
   char *tmp;
 
   /* first call, setup cache */
-  if (ent->blacklist.size == 0)
+  if (ent->denylist.size == 0)
     {
-      ent->blacklist.size = MAX (BLACKLIST_INITIAL_SIZE, 2 * namelen);
-      ent->blacklist.data = malloc (ent->blacklist.size);
-      if (ent->blacklist.data == NULL)
+      ent->denylist.size = MAX (DENYLIST_INITIAL_SIZE, 2 * namelen);
+      ent->denylist.data = malloc (ent->denylist.size);
+      if (ent->denylist.data == NULL)
 	return;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
-      ent->blacklist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
+      ent->denylist.current = 1;
     }
   else
     {
-      if (in_blacklist (name, namelen, ent))
+      if (in_denylist (name, namelen, ent))
 	return;			/* no duplicates */
 
-      if (ent->blacklist.current + namelen + 1 >= ent->blacklist.size)
+      if (ent->denylist.current + namelen + 1 >= ent->denylist.size)
 	{
-	  ent->blacklist.size += MAX (BLACKLIST_INCREMENT, 2 * namelen);
-	  tmp = realloc (ent->blacklist.data, ent->blacklist.size);
+	  ent->denylist.size += MAX (DENYLIST_INCREMENT, 2 * namelen);
+	  tmp = realloc (ent->denylist.data, ent->denylist.size);
 	  if (tmp == NULL)
 	    {
-	      free (ent->blacklist.data);
-	      ent->blacklist.size = 0;
+	      free (ent->denylist.data);
+	      ent->denylist.size = 0;
 	      return;
 	    }
-	  ent->blacklist.data = tmp;
+	  ent->denylist.data = tmp;
 	}
     }
 
-  tmp = stpcpy (ent->blacklist.data + ent->blacklist.current, name);
+  tmp = stpcpy (ent->denylist.data + ent->denylist.current, name);
   *tmp++ = '|';
   *tmp = '\0';
-  ent->blacklist.current += namelen + 1;
+  ent->denylist.current += namelen + 1;
 
   return;
 }
 
-/* Returns whether ent->blacklist contains name.  */
+/* Returns whether ent->denylist contains name.  */
 static bool
-in_blacklist (const char *name, int namelen, ent_t *ent)
+in_denylist (const char *name, int namelen, ent_t *ent)
 {
   char buf[namelen + 3];
   char *cp;
 
-  if (ent->blacklist.data == NULL)
+  if (ent->denylist.data == NULL)
     return false;
 
   buf[0] = '|';
   cp = stpcpy (&buf[1], name);
   *cp++ = '|';
   *cp = '\0';
-  return strstr (ent->blacklist.data, buf) != NULL;
+  return strstr (ent->denylist.data, buf) != NULL;
 }
diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c
index 7784438251..6ec0a66d31 100644
--- a/nss/nss_compat/compat-spwd.c
+++ b/nss/nss_compat/compat-spwd.c
@@ -49,9 +49,9 @@ static enum nss_status (*endspent_impl) (void);
 #include <nss/nss_files/files-parse.c>
 
 /* Structure for remembering -@netgroup and -user members ... */
-#define BLACKLIST_INITIAL_SIZE 512
-#define BLACKLIST_INCREMENT 256
-struct blacklist_t
+#define DENYLIST_INITIAL_SIZE 512
+#define DENYLIST_INCREMENT 256
+struct denylist_t
 {
   char *data;
   int current;
@@ -65,7 +65,7 @@ struct ent_t
   bool first;
   enum nss_status setent_status;
   FILE *stream;
-  struct blacklist_t blacklist;
+  struct denylist_t denylist;
   struct spwd pwd;
   struct __netgrent netgrdata;
 };
@@ -79,8 +79,8 @@ static ent_t ext_ent = { false, true, false, NSS_STATUS_SUCCESS, NULL,
 __libc_lock_define_initialized (static, lock)
 
 /* Prototypes for local functions.  */
-static void blacklist_store_name (const char *, ent_t *);
-static bool in_blacklist (const char *, int, ent_t *);
+static void denylist_store_name (const char *, ent_t *);
+static bool in_denylist (const char *, int, ent_t *);
 
 /* Initialize the NSS interface/functions. The calling function must
    hold the lock.  */
@@ -167,14 +167,14 @@ internal_setspent (ent_t *ent, int stayopen, int needent)
   if (ent->netgroup)
     __internal_endnetgrent (&ent->netgrdata);
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -228,14 +228,14 @@ internal_endspent (ent_t *ent)
   ent->first = ent->netgroup = false;
   ent->files = true;
 
-  if (ent->blacklist.data != NULL)
+  if (ent->denylist.data != NULL)
     {
-      ent->blacklist.current = 1;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
+      ent->denylist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
     }
   else
-    ent->blacklist.current = 0;
+    ent->denylist.current = 0;
 
   give_spwd_free (&ent->pwd);
 
@@ -340,11 +340,11 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent,
 	  != NSS_STATUS_SUCCESS)
 	continue;
 
-      if (!in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
+      if (!in_denylist (result->sp_namp, strlen (result->sp_namp), ent))
 	{
-	  /* Store the User in the blacklist for possible the "+" at the
+	  /* Store the User in the denylist for possible the "+" at the
 	     end of /etc/passwd */
-	  blacklist_store_name (result->sp_namp, ent);
+	  denylist_store_name (result->sp_namp, ent);
 	  copy_spwd_changes (result, &ent->pwd, p2, p2len);
 	  break;
 	}
@@ -379,7 +379,7 @@ getspent_next_nss (struct spwd *result, ent_t *ent,
 	  != NSS_STATUS_SUCCESS)
 	return status;
     }
-  while (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent));
+  while (in_denylist (result->sp_namp, strlen (result->sp_namp), ent));
 
   copy_spwd_changes (result, &ent->pwd, p2, p2len);
 
@@ -418,7 +418,7 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
   if (status != NSS_STATUS_SUCCESS)
     return status;
 
-  if (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
+  if (in_denylist (result->sp_namp, strlen (result->sp_namp), ent))
     return NSS_STATUS_NOTFOUND;
 
   copy_spwd_changes (result, &pwd, p, plen);
@@ -496,7 +496,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
 					   errnop))
 	    {
 	      if (user != NULL && user[0] != '-')
-		blacklist_store_name (user, ent);
+		denylist_store_name (user, ent);
 	    }
 	  __internal_endnetgrent (&netgrdata);
 	  continue;
@@ -525,7 +525,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
       if (result->sp_namp[0] == '-' && result->sp_namp[1] != '\0'
 	  && result->sp_namp[1] != '@')
 	{
-	  blacklist_store_name (&result->sp_namp[1], ent);
+	  denylist_store_name (&result->sp_namp[1], ent);
 	  continue;
 	}
 
@@ -537,12 +537,12 @@ getspent_next_file (struct spwd *result, ent_t *ent,
 	  char buf[len];
 	  enum nss_status status;
 
-	  /* Store the User in the blacklist for the "+" at the end of
+	  /* Store the User in the denylist for the "+" at the end of
 	     /etc/passwd */
 	  memcpy (buf, &result->sp_namp[1], len);
 	  status = getspnam_plususer (&result->sp_namp[1], result, ent,
 				      buffer, buflen, errnop);
-	  blacklist_store_name (buf, ent);
+	  denylist_store_name (buf, ent);
 
 	  if (status == NSS_STATUS_SUCCESS)	/* We found the entry. */
 	    break;
@@ -690,7 +690,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
 
       /* -@netgroup */
       /* If the loaded NSS module does not support this service, add
-         all users from a +@netgroup entry to the blacklist, too.  */
+         all users from a +@netgroup entry to the denylist, too.  */
       if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@'
 	  && result->sp_namp[2] != '\0')
 	{
@@ -801,63 +801,63 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
 /* Support routines for remembering -@netgroup and -user entries.
    The names are stored in a single string with `|' as separator. */
 static void
-blacklist_store_name (const char *name, ent_t *ent)
+denylist_store_name (const char *name, ent_t *ent)
 {
   int namelen = strlen (name);
   char *tmp;
 
   /* first call, setup cache */
-  if (ent->blacklist.size == 0)
+  if (ent->denylist.size == 0)
     {
-      ent->blacklist.size = MAX (BLACKLIST_INITIAL_SIZE, 2 * namelen);
-      ent->blacklist.data = malloc (ent->blacklist.size);
-      if (ent->blacklist.data == NULL)
+      ent->denylist.size = MAX (DENYLIST_INITIAL_SIZE, 2 * namelen);
+      ent->denylist.data = malloc (ent->denylist.size);
+      if (ent->denylist.data == NULL)
 	return;
-      ent->blacklist.data[0] = '|';
-      ent->blacklist.data[1] = '\0';
-      ent->blacklist.current = 1;
+      ent->denylist.data[0] = '|';
+      ent->denylist.data[1] = '\0';
+      ent->denylist.current = 1;
     }
   else
     {
-      if (in_blacklist (name, namelen, ent))
+      if (in_denylist (name, namelen, ent))
 	return;			/* no duplicates */
 
-      if (ent->blacklist.current + namelen + 1 >= ent->blacklist.size)
+      if (ent->denylist.current + namelen + 1 >= ent->denylist.size)
 	{
-	  ent->blacklist.size += MAX (BLACKLIST_INCREMENT, 2 * namelen);
-	  tmp = realloc (ent->blacklist.data, ent->blacklist.size);
+	  ent->denylist.size += MAX (DENYLIST_INCREMENT, 2 * namelen);
+	  tmp = realloc (ent->denylist.data, ent->denylist.size);
 	  if (tmp == NULL)
 	    {
-	      free (ent->blacklist.data);
-	      ent->blacklist.size = 0;
+	      free (ent->denylist.data);
+	      ent->denylist.size = 0;
 	      return;
 	    }
-	  ent->blacklist.data = tmp;
+	  ent->denylist.data = tmp;
 	}
     }
 
-  tmp = stpcpy (ent->blacklist.data + ent->blacklist.current, name);
+  tmp = stpcpy (ent->denylist.data + ent->denylist.current, name);
   *tmp++ = '|';
   *tmp = '\0';
-  ent->blacklist.current += namelen + 1;
+  ent->denylist.current += namelen + 1;
 
   return;
 }
 
 
-/* Returns whether ent->blacklist contains name.  */
+/* Returns whether ent->denylist contains name.  */
 static bool
-in_blacklist (const char *name, int namelen, ent_t *ent)
+in_denylist (const char *name, int namelen, ent_t *ent)
 {
   char buf[namelen + 3];
   char *cp;
 
-  if (ent->blacklist.data == NULL)
+  if (ent->denylist.data == NULL)
     return false;
 
   buf[0] = '|';
   cp = stpcpy (&buf[1], name);
   *cp++ = '|';
   *cp = '\0';
-  return strstr (ent->blacklist.data, buf) != NULL;
+  return strstr (ent->denylist.data, buf) != NULL;
 }
-- 
2.49.0



More information about the Libc-alpha mailing list