FreeBSD Bugzilla – Attachment 220877 Details for
Bug 252094
nss "compat": getpw(nam|uid)_r(3) inadvertently reset next entry key for getpwent_r(3)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
getpwent.diff (text/plain), 1.40 KB, created by
Viktor Dukhovni
on 2020-12-24 01:25:37 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Viktor Dukhovni
Created:
2020-12-24 01:25:37 UTC
Size:
1.40 KB
patch
obsolete
>Index: lib/libc/gen/getpwent.c >=================================================================== >--- lib/libc/gen/getpwent.c (revision 367119) >+++ lib/libc/gen/getpwent.c (working copy) >@@ -1726,6 +1726,7 @@ > { > char keybuf[MAXLOGNAME + 1]; > DBT key, entry; >+ pwkeynum keynum; > struct compat_state *st; > enum nss_lookup_type how; > const char *name; >@@ -1776,9 +1777,10 @@ > rv = NS_NOTFOUND; > goto fin; > } >+ keynum = st->keynum; > stayopen = 1; > } else { >- st->keynum = 0; >+ keynum = 0; > stayopen = st->stayopen; > } > docompat: >@@ -1822,13 +1824,13 @@ > } > key.data = keybuf; > rv = NS_NOTFOUND; >- while (st->keynum >= 0) { >- st->keynum++; >+ while (keynum >= 0) { >+ keynum++; > if (st->version < _PWD_CURRENT_VERSION) { >- memcpy(&keybuf[1], &st->keynum, sizeof(st->keynum)); >- key.size = sizeof(st->keynum) + 1; >+ memcpy(&keybuf[1], &keynum, sizeof(keynum)); >+ key.size = sizeof(keynum) + 1; > } else { >- store = htonl(st->keynum); >+ store = htonl(keynum); > memcpy(&keybuf[1], &store, sizeof(store)); > key.size = sizeof(store) + 1; > } >@@ -1839,7 +1841,7 @@ > rv = NS_UNAVAIL; > goto fin; > } else if (rv == 1) { >- st->keynum = -1; >+ keynum = -1; > rv = NS_NOTFOUND; > goto fin; > } >@@ -1924,6 +1926,8 @@ > break; > } > fin: >+ if (how == nss_lt_all) >+ st->keynum = keynum; > if (st->db != NULL && !stayopen) { > (void)st->db->close(st->db); > st->db = NULL;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 252094
: 220877 |
221404
|
221407
|
221430