glibc/nss-database.patch
Tomáš Chvátal 5b108142b5 Accepting request 186878 from Base:System
- Update to glibc 2.18 release
  * No source change
- strcoll-overflow.patch: fix buffer overflow in strcoll (CVE-2012-4412,
  bnc#779320)
- readdir_r-overflow.patch: fix readdir_r with long file names
  (CVE-2013-4237, bnc#834594) (forwarded request 186872 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/186878
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=153
2013-08-13 09:36:50 +00:00

113 lines
3.3 KiB
Diff

From a6856a042a0669ac3f8bc675e8e1de14b5d09b94 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 24 Jan 2013 12:32:09 +0100
Subject: [PATCH] Properly cache the result from looking up the nss database
config
[BZ #15048]
* nscd/aicache.c (addhstaiX): Properly use the cache variable for
the nss database lookup.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
---
nscd/aicache.c | 15 +++++++--------
nscd/initgrcache.c | 15 +++++++--------
sysdeps/posix/getaddrinfo.c | 14 ++++++--------
3 files changed, 20 insertions(+), 24 deletions(-)
Index: glibc-2.17.90/nscd/aicache.c
===================================================================
--- glibc-2.17.90.orig/nscd/aicache.c
+++ glibc-2.17.90/nscd/aicache.c
@@ -86,20 +86,19 @@ addhstaiX (struct database_dyn *db, int
}
static service_user *hosts_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
int rc6 = 0;
int rc4 = 0;
int herrno = 0;
- if (hosts_database != NULL)
- {
- nip = hosts_database;
- no_more = 0;
- }
- else
+ if (hosts_database == NULL)
no_more = __nss_database_lookup ("hosts", NULL,
- "dns [!UNAVAIL=return] files", &nip);
+ "dns [!UNAVAIL=return] files",
+ &hosts_database);
+ else
+ no_more = 0;
+ nip = hosts_database;
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;
Index: glibc-2.17.90/nscd/initgrcache.c
===================================================================
--- glibc-2.17.90.orig/nscd/initgrcache.c
+++ glibc-2.17.90/nscd/initgrcache.c
@@ -80,17 +80,16 @@ addinitgroupsX (struct database_dyn *db,
}
static service_user *group_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
- if (group_database != NULL)
- {
- nip = group_database;
- no_more = 0;
- }
- else
+ if (group_database == NULL)
no_more = __nss_database_lookup ("group", NULL,
- "compat [NOTFOUND=return] files", &nip);
+ "compat [NOTFOUND=return] files",
+ &group_database);
+ else
+ no_more = 0;
+ nip = group_database;
/* We always use sysconf even if NGROUPS_MAX is defined. That way, the
limit can be raised in the kernel configuration without having to
Index: glibc-2.17.90/sysdeps/posix/getaddrinfo.c
===================================================================
--- glibc-2.17.90.orig/sysdeps/posix/getaddrinfo.c
+++ glibc-2.17.90/sysdeps/posix/getaddrinfo.c
@@ -558,7 +558,7 @@ gaih_inet (const char *name, const struc
struct gaih_addrtuple **pat = &at;
int no_data = 0;
int no_inet6_data = 0;
- service_user *nip = NULL;
+ service_user *nip;
enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
@@ -791,15 +791,13 @@ gaih_inet (const char *name, const struc
}
#endif
- if (__nss_hosts_database != NULL)
- {
- no_more = 0;
- nip = __nss_hosts_database;
- }
- else
+ if (__nss_hosts_database == NULL)
no_more = __nss_database_lookup ("hosts", NULL,
"dns [!UNAVAIL=return] files",
- &nip);
+ &__nss_hosts_database);
+ else
+ no_more = 0;
+ nip = __nss_hosts_database;
/* Initialize configurations. */
if (__builtin_expect (!_res_hconf.initialized, 0))