nss_db: Propagate ERANGE error if parse_line fails [BZ #19837]

Message ID 56EAFD10.9040705@redhat.com
State Committed
Headers

Commit Message

Florian Weimer March 17, 2016, 6:53 p.m. UTC
  Other call sites of parse_line already use these error codes (including
one earlier in this file).

The symptom is that getgrent (without _r) would not retry reading with a
larger buffer.

It's not possible to write a test for  this without resorting to chroot.

Thanks,
Florian
  

Comments

Florian Weimer March 29, 2016, 8:34 a.m. UTC | #1
On 03/17/2016 07:53 PM, Florian Weimer wrote:
> 	[BZ #19837]
> 	* nss/nss_db/db-XXX.c (_nss_db_getENTNAME_r): Propagate ERANGE
> 	error if parse_line fails.

Ping?

  <https://sourceware.org/ml/libc-alpha/2016-03/msg00456.html>

Thanks,
Florian
  
Andreas Schwab March 29, 2016, 9:03 a.m. UTC | #2
Florian Weimer <fweimer@redhat.com> writes:

> 	[BZ #19837]
> 	* nss/nss_db/db-XXX.c (_nss_db_getENTNAME_r): Propagate ERANGE
> 	error if parse_line fails.

Ok.

Andreas.
  

Patch

2016-03-17  Florian Weimer  <fweimer@redhat.com>

	[BZ #19837]
	* nss/nss_db/db-XXX.c (_nss_db_getENTNAME_r): Propagate ERANGE
	error if parse_line fails.

diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 03c18d7..125a5e9 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -288,8 +288,8 @@  CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
 	    }
 	  if (err < 0)
 	    {
-	      H_ERRNO_SET (HOST_NOT_FOUND);
-	      status = NSS_STATUS_NOTFOUND;
+	      H_ERRNO_SET (NETDB_INTERNAL);
+	      status = NSS_STATUS_TRYAGAIN;
 	      break;
 	    }