nsswitch: handle missing actions properly
Andreas Schwab
schwab@linux-m68k.org
Thu Dec 10 08:35:59 GMT 2020
On Dez 09 2020, DJ Delorie via Libc-alpha wrote:
> diff --git a/grp/initgroups.c b/grp/initgroups.c
> index a60ca1c395..a0a836d862 100644
> --- a/grp/initgroups.c
> +++ b/grp/initgroups.c
> @@ -72,11 +72,13 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
>
> nss_action_list nip;
>
> - if (__nss_database_get (nss_database_initgroups, &nip))
> + if (__nss_database_get (nss_database_initgroups, &nip)
> + && nip != NULL)
> {
> use_initgroups_entry = true;
> }
> - else if (__nss_database_get (nss_database_group, &nip))
> + else if (__nss_database_get (nss_database_group, &nip)
> + && nip != NULL)
Indentation is off here.
> diff --git a/nss/nsswitch.c b/nss/nsswitch.c
> index 40109c744d..921062e04f 100644
> --- a/nss/nsswitch.c
> +++ b/nss/nsswitch.c
> @@ -81,7 +81,7 @@ __nss_database_lookup2 (const char *database, const char *alternate_name,
> if (database_names[database_id] == NULL)
> return -1;
>
> - if (__nss_database_get (database_id, ni))
> + if (__nss_database_get (database_id, ni) && *ni)
No implicit boolean coercion.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
More information about the Libc-alpha
mailing list