Accepting request 711647 from home:Andreas_Schwab:Factory

- nss-files-long-lines-2.patch: Remove obsolete patch

OBS-URL: https://build.opensuse.org/request/show/711647
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=529
This commit is contained in:
Andreas Schwab 2019-06-24 07:15:53 +00:00 committed by Git OBS Bridge
parent 2d58c46aab
commit c9be2cdeba
3 changed files with 5 additions and 167 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jun 12 12:10:59 UTC 2019 - Andreas Schwab <schwab@suse.de>
- nss-files-long-lines-2.patch: Remove obsolete patch
-------------------------------------------------------------------
Wed May 15 15:55:36 UTC 2019 - Andreas Schwab <schwab@suse.de>

View File

@ -308,8 +308,6 @@ Patch1015: wfile-sync-crash.patch
Patch2000: fix-locking-in-_IO_cleanup.patch
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
Patch2004: fnmatch-collating-elements.patch
# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991)
Patch2005: nss-files-long-lines-2.patch
# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830)
Patch2006: iconv-reset-input-buffer.patch
# PATCH-FIX-UPSTREAM Avoid concurrency problem in ldconfig (BZ #23973)
@ -530,7 +528,6 @@ makedb: A program to create a database for nss
%patch2000 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1

View File

@ -1,164 +0,0 @@
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.27/nss/nss_files/files-XXX.c
===================================================================
--- glibc-2.27.orig/nss/nss_files/files-XXX.c
+++ glibc-2.27/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
@@ -96,6 +100,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;
@@ -251,11 +264,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)
+ {
+ /* 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);
+ {
+ 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.27/nss/nss_files/files-alias.c
===================================================================
--- glibc-2.27.orig/nss/nss_files/files-alias.c
+++ glibc-2.27/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
@@ -69,6 +73,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;
@@ -353,7 +366,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)
{
@@ -363,6 +398,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);