forked from pool/glibc
Accepting request 334938 from home:Andreas_Schwab:Factory
- nss-files-long-lines-2.patch: Properly reread entry after failure in nss_files getent function (bsc#945779, BZ #18991) OBS-URL: https://build.opensuse.org/request/show/334938 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=416
This commit is contained in:
parent
7041efeaf1
commit
82cb193ae9
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 24 09:41:13 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
- nss-files-long-lines-2.patch: Properly reread entry after failure in
|
||||||
|
nss_files getent function (bsc#945779, BZ #18991)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
@ -256,6 +256,8 @@ Patch2006: ibm93x-redundant-shift-si.patch
|
|||||||
Patch2007: static-dlopen.patch
|
Patch2007: static-dlopen.patch
|
||||||
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
||||||
Patch2008: fnmatch-collating-elements.patch
|
Patch2008: fnmatch-collating-elements.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991)
|
||||||
|
Patch2009: nss-files-long-lines-2.patch
|
||||||
|
|
||||||
# Non-glibc patches
|
# Non-glibc patches
|
||||||
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
||||||
@ -467,6 +469,7 @@ rm nscd/s-stamp
|
|||||||
%patch2006 -p1
|
%patch2006 -p1
|
||||||
%patch2007 -p1
|
%patch2007 -p1
|
||||||
%patch2008 -p1
|
%patch2008 -p1
|
||||||
|
%patch2009 -p1
|
||||||
|
|
||||||
%patch3000
|
%patch3000
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 24 09:41:13 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
- nss-files-long-lines-2.patch: Properly reread entry after failure in
|
||||||
|
nss_files getent function (bsc#945779, BZ #18991)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
@ -255,6 +255,8 @@ Patch2006: ibm93x-redundant-shift-si.patch
|
|||||||
Patch2007: static-dlopen.patch
|
Patch2007: static-dlopen.patch
|
||||||
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
||||||
Patch2008: fnmatch-collating-elements.patch
|
Patch2008: fnmatch-collating-elements.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991)
|
||||||
|
Patch2009: nss-files-long-lines-2.patch
|
||||||
|
|
||||||
# Non-glibc patches
|
# Non-glibc patches
|
||||||
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
||||||
@ -467,6 +469,7 @@ rm nscd/s-stamp
|
|||||||
%patch2006 -p1
|
%patch2006 -p1
|
||||||
%patch2007 -p1
|
%patch2007 -p1
|
||||||
%patch2008 -p1
|
%patch2008 -p1
|
||||||
|
%patch2009 -p1
|
||||||
|
|
||||||
%patch3000
|
%patch3000
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 24 09:41:13 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
- nss-files-long-lines-2.patch: Properly reread entry after failure in
|
||||||
|
nss_files getent function (bsc#945779, BZ #18991)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
Wed Sep 16 10:21:43 UTC 2015 - schwab@suse.de
|
||||||
|
|
||||||
|
@ -256,6 +256,8 @@ Patch2006: ibm93x-redundant-shift-si.patch
|
|||||||
Patch2007: static-dlopen.patch
|
Patch2007: static-dlopen.patch
|
||||||
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
|
||||||
Patch2008: fnmatch-collating-elements.patch
|
Patch2008: fnmatch-collating-elements.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991)
|
||||||
|
Patch2009: nss-files-long-lines-2.patch
|
||||||
|
|
||||||
# Non-glibc patches
|
# Non-glibc patches
|
||||||
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
|
||||||
@ -467,6 +469,7 @@ rm nscd/s-stamp
|
|||||||
%patch2006 -p1
|
%patch2006 -p1
|
||||||
%patch2007 -p1
|
%patch2007 -p1
|
||||||
%patch2008 -p1
|
%patch2008 -p1
|
||||||
|
%patch2009 -p1
|
||||||
|
|
||||||
%patch3000
|
%patch3000
|
||||||
|
|
||||||
|
164
nss-files-long-lines-2.patch
Normal file
164
nss-files-long-lines-2.patch
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
Properly reread entry after failure in nss_files getent function (bug 18991)
|
||||||
|
|
||||||
|
* nss/nss_files/files-XXX.c (position, need_reread): New
|
||||||
|
variables.
|
||||||
|
(CONCAT(_nss_files_set,ENTNAME)): Initialize them.
|
||||||
|
(CONCAT(_nss_files_get,ENTNAME_r)): Likewise. Reposition stream
|
||||||
|
if last call was uncessful.
|
||||||
|
* nss/nss_files/files-alias.c (position, need_reread): New
|
||||||
|
variables.
|
||||||
|
(_nss_files_setaliasent): Initialize them.
|
||||||
|
(_nss_files_getaliasent_r): Likewise. Reposition stream if last
|
||||||
|
call was uncessful.
|
||||||
|
|
||||||
|
Index: glibc-2.19/nss/nss_files/files-XXX.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.19.orig/nss/nss_files/files-XXX.c
|
||||||
|
+++ glibc-2.19/nss/nss_files/files-XXX.c
|
||||||
|
@@ -65,6 +65,10 @@ __libc_lock_define_initialized (static,
|
||||||
|
getXXbyYY operations all use their own stream. */
|
||||||
|
|
||||||
|
static FILE *stream;
|
||||||
|
+/* Position after the last sucessfully read entry. */
|
||||||
|
+static fpos_t position;
|
||||||
|
+/* Whether we need to reread the last entry on the next call. */
|
||||||
|
+static bool need_reread;
|
||||||
|
|
||||||
|
/* Open database file if not already opened. */
|
||||||
|
static enum nss_status
|
||||||
|
@@ -131,6 +135,15 @@ CONCAT(_nss_files_set,ENTNAME) (int stay
|
||||||
|
|
||||||
|
status = internal_setent (&stream);
|
||||||
|
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
|
||||||
|
+ {
|
||||||
|
+ fclose (stream);
|
||||||
|
+ stream = NULL;
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ need_reread = false;
|
||||||
|
+
|
||||||
|
__libc_lock_unlock (lock);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
@@ -286,11 +299,42 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct
|
||||||
|
status = internal_setent (&stream);
|
||||||
|
|
||||||
|
__set_errno (save_errno);
|
||||||
|
+
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
|
||||||
|
+ {
|
||||||
|
+ fclose (stream);
|
||||||
|
+ stream = NULL;
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ }
|
||||||
|
+ need_reread = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == NSS_STATUS_SUCCESS)
|
||||||
|
- status = internal_getent (stream, result, buffer, buflen, errnop
|
||||||
|
- H_ERRNO_ARG EXTRA_ARGS_VALUE);
|
||||||
|
+ {
|
||||||
|
+ /* Reposition the stream if the last call was unsucessful. */
|
||||||
|
+ if (need_reread)
|
||||||
|
+ {
|
||||||
|
+ if (fsetpos (stream, &position) < 0)
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ else
|
||||||
|
+ need_reread = false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS)
|
||||||
|
+ {
|
||||||
|
+ status = internal_getent (stream, result, buffer, buflen, errnop
|
||||||
|
+ H_ERRNO_ARG EXTRA_ARGS_VALUE);
|
||||||
|
+
|
||||||
|
+ /* Remember this position if we were successful. If the
|
||||||
|
+ operation failed we give the user a chance to repeat the
|
||||||
|
+ operation (perhaps the buffer was too small). */
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS)
|
||||||
|
+ fgetpos (stream, &position);
|
||||||
|
+ else
|
||||||
|
+ /* We must make sure we reposition the stream the next call. */
|
||||||
|
+ need_reread = true;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
__libc_lock_unlock (lock);
|
||||||
|
|
||||||
|
Index: glibc-2.19/nss/nss_files/files-alias.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.19.orig/nss/nss_files/files-alias.c
|
||||||
|
+++ glibc-2.19/nss/nss_files/files-alias.c
|
||||||
|
@@ -38,6 +38,10 @@ __libc_lock_define_initialized (static,
|
||||||
|
getXXbyYY operations all use their own stream. */
|
||||||
|
|
||||||
|
static FILE *stream;
|
||||||
|
+/* Position after the last sucessfully read entry. */
|
||||||
|
+static fpos_t position;
|
||||||
|
+/* Whether we need to reread the last entry on the next call. */
|
||||||
|
+static bool need_reread;
|
||||||
|
|
||||||
|
|
||||||
|
static enum nss_status
|
||||||
|
@@ -104,6 +108,15 @@ _nss_files_setaliasent (void)
|
||||||
|
|
||||||
|
status = internal_setent (&stream);
|
||||||
|
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
|
||||||
|
+ {
|
||||||
|
+ fclose (stream);
|
||||||
|
+ stream = NULL;
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ need_reread = false;
|
||||||
|
+
|
||||||
|
__libc_lock_unlock (lock);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
@@ -388,7 +401,29 @@ _nss_files_getaliasent_r (struct aliasen
|
||||||
|
|
||||||
|
/* Be prepared that the set*ent function was not called before. */
|
||||||
|
if (stream == NULL)
|
||||||
|
- status = internal_setent (&stream);
|
||||||
|
+ {
|
||||||
|
+ status = internal_setent (&stream);
|
||||||
|
+
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
|
||||||
|
+ {
|
||||||
|
+ fclose (stream);
|
||||||
|
+ stream = NULL;
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ }
|
||||||
|
+ need_reread = false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS)
|
||||||
|
+ {
|
||||||
|
+ /* Reposition the stream if the last call way unsucessful. */
|
||||||
|
+ if (need_reread)
|
||||||
|
+ {
|
||||||
|
+ if (fsetpos (stream, &position) < 0)
|
||||||
|
+ status = NSS_STATUS_UNAVAIL;
|
||||||
|
+ else
|
||||||
|
+ need_reread = false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (status == NSS_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
@@ -398,6 +433,12 @@ _nss_files_getaliasent_r (struct aliasen
|
||||||
|
do
|
||||||
|
status = get_next_alias (stream, NULL, result, buffer, buflen, errnop);
|
||||||
|
while (status == NSS_STATUS_RETURN);
|
||||||
|
+
|
||||||
|
+ /* If we successfully read an entry remember this position. */
|
||||||
|
+ if (status == NSS_STATUS_SUCCESS)
|
||||||
|
+ fgetpos (stream, &position);
|
||||||
|
+ else
|
||||||
|
+ need_reread = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
__libc_lock_unlock (lock);
|
Loading…
Reference in New Issue
Block a user