_nss_nis_initgroups_dyn: Return error status

Message ID 54EF320A.90409@redhat.com
State Committed
Headers

Commit Message

Florian Weimer Feb. 26, 2015, 2:47 p.m. UTC
  This seems to have been an oversight.  An error can be returned if the
function is left with “goto done;”.

2015-02-26  Florian Weimer  <fweimer@redhat.com>

	* nis/nss_nis/nis-initgroups.c (_nss_nis_initgroups_dyn):
	Return error status.
  

Comments

Mike Frysinger March 1, 2015, 7:18 p.m. UTC | #1
On 26 Feb 2015 15:47, Florian Weimer wrote:
> This seems to have been an oversight.  An error can be returned if the
> function is left with “goto done;”.

lgtm
-mike
  
Andreas Schwab June 16, 2016, 9:31 a.m. UTC | #2
Florian Weimer <fweimer@redhat.com> writes:

> This seems to have been an oversight.  An error can be returned if the
> function is left with “goto done;”.
>
> 2015-02-26  Florian Weimer  <fweimer@redhat.com>
>
> 	* nis/nss_nis/nis-initgroups.c (_nss_nis_initgroups_dyn):
> 	Return error status.
>
> diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
> index d22b241..ed5c26b 100644
> --- a/nis/nss_nis/nis-initgroups.c
> +++ b/nis/nss_nis/nis-initgroups.c
> @@ -326,5 +326,5 @@ done:
>        free (intern.next);
>      }
>
> -  return NSS_STATUS_SUCCESS;
> +  return status;
>  }

This causes _nss_nis_initgroups_dyn to always return
NSS_STATUS_NOTFOUND.

Andreas.
  
Florian Weimer June 16, 2016, 9:35 a.m. UTC | #3
On 06/16/2016 11:31 AM, Andreas Schwab wrote:
> Florian Weimer <fweimer@redhat.com> writes:
>
>> This seems to have been an oversight.  An error can be returned if the
>> function is left with “goto done;”.
>>
>> 2015-02-26  Florian Weimer  <fweimer@redhat.com>
>>
>> 	* nis/nss_nis/nis-initgroups.c (_nss_nis_initgroups_dyn):
>> 	Return error status.
>>
>> diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
>> index d22b241..ed5c26b 100644
>> --- a/nis/nss_nis/nis-initgroups.c
>> +++ b/nis/nss_nis/nis-initgroups.c
>> @@ -326,5 +326,5 @@ done:
>>        free (intern.next);
>>      }
>>
>> -  return NSS_STATUS_SUCCESS;
>> +  return status;
>>  }
>
> This causes _nss_nis_initgroups_dyn to always return
> NSS_STATUS_NOTFOUND.

What is the expectation behavior of this function?  Always return 
NSS_STATUS_NOTFOUND, even in case of an error?

Thanks,
Florian
  
Andreas Schwab June 16, 2016, 11:24 a.m. UTC | #4
Florian Weimer <fweimer@redhat.com> writes:

> What is the expectation behavior of this function?

Return NSS_STATUS_SUCCESS when done.

Andreas.
  

Patch

diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index d22b241..ed5c26b 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -326,5 +326,5 @@  done:
       free (intern.next);
     }

-  return NSS_STATUS_SUCCESS;
+  return status;
 }