Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Feb 2021 16:35:57 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a46d7192f41a - stable/12 - libc/nss: Ensure that setgroupent(3) actually works as advertised
Message-ID:  <202102201635.11KGZvoc028877@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a46d7192f41aa977a49bb3aae2947131186878ca

commit a46d7192f41aa977a49bb3aae2947131186878ca
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-01-21 19:30:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-02-20 16:35:32 +0000

    libc/nss: Ensure that setgroupent(3) actually works as advertised
    
    Because the "files" and "compat" implementations failed to set the
    "stayopen", keyed lookups would close the database handle, contrary to
    the purpose of setgroupent(3).  setpassent(3)'s implementation does not
    have this bug.
    
    PR:             165527
    Submitted by:   Andrey Simonenko
    
    (cherry picked from commit 48a186863431ec7a23c6174bc376cafa59dd5fbf)
---
 lib/libc/gen/getgrent.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 6abccea30c6b..afb89cab308b 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -824,6 +824,7 @@ files_setgrent(void *retval, void *mdata, va_list ap)
 			rewind(st->fp);
 		else if (stayopen)
 			st->fp = fopen(_PATH_GROUP, "re");
+		st->stayopen = stayopen;
 		break;
 	case ENDGRENT:
 		if (st->fp != NULL) {
@@ -1271,6 +1272,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap)
 			rewind(st->fp);
 		else if (stayopen)
 			st->fp = fopen(_PATH_GROUP, "re");
+		st->stayopen = stayopen;
 		set_setent(dtab, mdata);
 		(void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, "setgrent",
 		    compatsrc, 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102201635.11KGZvoc028877>