summaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 19:14:56 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 19:14:56 +0200
commitf76453c31593957fec1a99b986bfa5506618b79c (patch)
treeda353c882fb9b2261c9871bcb9e3876a3e6ed7f6 /nis
parent58695b88a9deaecbcf7794760cc333177edaa2b4 (diff)
parent78bd7499af46d739ce94410eaeea006e874ca9e5 (diff)
Merge tag 'glibc-2.22' into baseline
The GNU C Library ================= The GNU C Library version 2.22 is now available. The GNU C Library is used as *the* C library in the GNU system and in GNU/Linux systems, as well as many other systems that use Linux as the kernel. The GNU C Library is primarily designed to be a portable and high performance C library. It follows all relevant standards including ISO C11 and POSIX.1-2008. It is also internationalized and has one of the most complete internationalization interfaces known. The GNU C Library webpage is at http://www.gnu.org/software/libc/ Packages for the 2.22 release may be downloaded from: http://ftpmirror.gnu.org/libc/ http://ftp.gnu.org/gnu/libc/ The mirror list is at http://www.gnu.org/order/ftp.html NEWS for version 2.22 ===================== * The following bugs are resolved with this release: 438, 4719, 6544, 6792, 11216, 12836, 13028, 13064, 13151, 13152, 14094, 14292, 14841, 14906, 14958, 15319, 15467, 15790, 15969, 16159, 16339, 16350, 16351, 16352, 16353, 16361, 16512, 16526, 16538, 16559, 16560, 16704, 16783, 16850, 17053, 17090, 17195, 17269, 17293, 17322, 17403, 17475, 17523, 17542, 17569, 17581, 17588, 17596, 17620, 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17833, 17836, 17841, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967, 17969, 17977, 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029, 18030, 18032, 18034, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18116, 18125, 18128, 18134, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217, 18219, 18220, 18221, 18234, 18244, 18245, 18247, 18287, 18319, 18324, 18333, 18346, 18371, 18383, 18397, 18400, 18409, 18410, 18412, 18418, 18422, 18434, 18444, 18457, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18502, 18507, 18508, 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546, 18547, 18549, 18553, 18557, 18558, 18569, 18583, 18585, 18586, 18592, 18593, 18594, 18602, 18612, 18613, 18619, 18633, 18641, 18643, 18648, 18657, 18676, 18694, 18696. * Cache information can be queried via sysconf() function on s390 e.g. with _SC_LEVEL1_ICACHE_SIZE as argument. * A buffer overflow in gethostbyname_r and related functions performing DNS requests has been fixed. If the NSS functions were called with a misaligned buffer, the buffer length change due to pointer alignment was not taken into account. This could result in application crashes or, potentially arbitrary code execution, using crafted, but syntactically valid DNS responses. (CVE-2015-1781) * The time zone file parser has been made more robust against crafted time zone files, avoiding heap buffer overflows related to the processing of the tzh_ttisstdcnt and tzh_ttisgmtcnt fields, and a stack overflow due to large time zone data files. Overly long time zone specifiers in the TZ variable no longer result in stack overflows and crashes. * A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors for LD and GD on x86 and x86-64, has been implemented. You will need binutils-2.24 or later to enable this optimization. * Character encoding and ctype tables were updated to Unicode 7.0.0, using new generator scripts contributed by Pravin Satpute and Mike FABIAN (Red Hat). These updates cause user visible changes, such as the fix for bug 17998. * CVE-2014-8121 The NSS backends shared internal state between the getXXent and getXXbyYY NSS calls for the same database, causing a denial-of-service condition in some applications. * Added vector math library named libmvec with the following vectorized x86_64 implementations: cos, cosf, sin, sinf, sincos, sincosf, log, logf, exp, expf, pow, powf. The library can be disabled with --disable-mathvec. Use of the functions is enabled with -fopenmp -ffast-math starting from -O1 for GCC version >= 4.9.0. Shared library libmvec.so is linked in as needed when using -lm (no need to specify -lmvec explicitly for not static builds). Visit <https://sourceware.org/glibc/wiki/libmvec> for detailed information. * A new fmemopen implementation has been added with the goal of POSIX compliance. The new implementation fixes the following long-standing issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and BZ#14292. The old implementation is still present for use be by existing binaries. * The 32-bit sparc sigaction ABI was inadvertently broken in the 2.20 and 2.21 releases. It has been fixed to match 2.19 and older, but binaries built against 2.20 and 2.21 might need to be recompiled. See BZ#18694. * Port to Native Client running on ARMv7-A (--host=arm-nacl). Contributed by Roland McGrath (Google). Contributors ============ This release was made possible by the contributions of many people. The maintainers are grateful to everyone who has contributed changes or bug reports. These include: Adhemerval Zanella Alan Modra Alexandre Oliva Andreas Schwab Andrew Senkevich Andriy Rysin Arjun Shankar Aurelien Jarno Benno Schulenberg Brad Hubbard Carlos O'Donell Chris Metcalf Christian Schmidt Chung-Lin Tang Cong Wang Cyril Hrubis Daniel Marjamäki David S. Miller Dmitry V. Levin Eric Rannaud Evangelos Foutras Feng Gao Florian Weimer Gleb Fotengauer-Malinovskiy H.J. Lu Igor Zamyatin J William Piggott James Cowgill James Lemke John David Anglin Joseph Myers Kevin Easton Khem Raj Leonhard Holz Mark Wielaard Marko Myllynen Martin Galvan Martin Sebor Matthew Fortune Mel Gorman Mike Frysinger Miroslav Lichvar Nathan Lynch Ondřej Bílka Paul Eggert Paul Pluzhnikov Pavel Kopyl Pravin Satpute Rajalakshmi Srinivasaraghavan Rical Jasan Richard Henderson Roland McGrath Rüdiger Sonderfeld Samuel Thibault Siddhesh Poyarekar Stefan Liebler Steve Ellcey Szabolcs Nagy Torvald Riegel Tulio Magno Quites Machado Filho Vincent Bernat Wilco Dijkstra Yaakov Selkowitz Zack Weinberg
Diffstat (limited to 'nis')
-rw-r--r--nis/Makefile6
-rw-r--r--nis/libnsl.h2
-rw-r--r--nis/nis_add.c2
-rw-r--r--nis/nis_addmember.c2
-rw-r--r--nis/nis_call.c4
-rw-r--r--nis/nis_callback.c12
-rw-r--r--nis/nis_checkpoint.c2
-rw-r--r--nis/nis_clone_dir.c2
-rw-r--r--nis/nis_clone_obj.c2
-rw-r--r--nis/nis_clone_res.c2
-rw-r--r--nis/nis_creategroup.c4
-rw-r--r--nis/nis_defaults.c2
-rw-r--r--nis/nis_destroygroup.c2
-rw-r--r--nis/nis_domain_of.c2
-rw-r--r--nis/nis_domain_of_r.c4
-rw-r--r--nis/nis_error.c2
-rw-r--r--nis/nis_file.c2
-rw-r--r--nis/nis_findserv.c6
-rw-r--r--nis/nis_free.c2
-rw-r--r--nis/nis_getservlist.c14
-rw-r--r--nis/nis_hash.c2
-rw-r--r--nis/nis_intern.h2
-rw-r--r--nis/nis_ismember.c2
-rw-r--r--nis/nis_local_names.c2
-rw-r--r--nis/nis_lookup.c6
-rw-r--r--nis/nis_mkdir.c2
-rw-r--r--nis/nis_modify.c2
-rw-r--r--nis/nis_ping.c2
-rw-r--r--nis/nis_print.c2
-rw-r--r--nis/nis_print_group_entry.c2
-rw-r--r--nis/nis_remove.c2
-rw-r--r--nis/nis_removemember.c2
-rw-r--r--nis/nis_rmdir.c2
-rw-r--r--nis/nis_server.c2
-rw-r--r--nis/nis_subr.c16
-rw-r--r--nis/nis_table.c20
-rw-r--r--nis/nis_util.c2
-rw-r--r--nis/nis_verifygroup.c2
-rw-r--r--nis/nis_xdr.c4
-rw-r--r--nis/nis_xdr.h2
-rw-r--r--nis/nisplus-parser.h2
-rw-r--r--nis/nss-default.c2
-rw-r--r--nis/nss-nis.c2
-rw-r--r--nis/nss-nis.h2
-rw-r--r--nis/nss-nisplus.c2
-rw-r--r--nis/nss-nisplus.h2
-rw-r--r--nis/nss_compat/compat-grp.c20
-rw-r--r--nis/nss_compat/compat-initgroups.c37
-rw-r--r--nis/nss_compat/compat-pwd.c22
-rw-r--r--nis/nss_compat/compat-spwd.c28
-rw-r--r--nis/nss_nis/nis-alias.c18
-rw-r--r--nis/nss_nis/nis-ethers.c18
-rw-r--r--nis/nss_nis/nis-grp.c26
-rw-r--r--nis/nss_nis/nis-hosts.c50
-rw-r--r--nis/nss_nis/nis-initgroups.c19
-rw-r--r--nis/nss_nis/nis-netgrp.c8
-rw-r--r--nis/nss_nis/nis-network.c33
-rw-r--r--nis/nss_nis/nis-proto.c18
-rw-r--r--nis/nss_nis/nis-publickey.c6
-rw-r--r--nis/nss_nis/nis-pwd.c32
-rw-r--r--nis/nss_nis/nis-rpc.c20
-rw-r--r--nis/nss_nis/nis-service.c46
-rw-r--r--nis/nss_nis/nis-spwd.c14
-rw-r--r--nis/nss_nisplus/nisplus-alias.c6
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c10
-rw-r--r--nis/nss_nisplus/nisplus-grp.c12
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c10
-rw-r--r--nis/nss_nisplus/nisplus-initgroups.c6
-rw-r--r--nis/nss_nisplus/nisplus-netgrp.c2
-rw-r--r--nis/nss_nisplus/nisplus-network.c6
-rw-r--r--nis/nss_nisplus/nisplus-parser.c2
-rw-r--r--nis/nss_nisplus/nisplus-proto.c6
-rw-r--r--nis/nss_nisplus/nisplus-publickey.c2
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c12
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c4
-rw-r--r--nis/nss_nisplus/nisplus-service.c12
-rw-r--r--nis/nss_nisplus/nisplus-spwd.c8
-rw-r--r--nis/rpcsvc/nislib.h2
-rw-r--r--nis/rpcsvc/ypclnt.h2
-rw-r--r--nis/ypclnt.c10
80 files changed, 360 insertions, 333 deletions
diff --git a/nis/Makefile b/nis/Makefile
index 15f86baaa9..037e674d6b 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2015 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -20,10 +20,10 @@
#
subdir := nis
-aux := nis_hash
-
include ../Makeconfig
+aux := nis_hash
+
ifeq ($(link-obsolete-rpc),yes)
headers := $(wildcard rpcsvc/*.[hx])
endif
diff --git a/nis/libnsl.h b/nis/libnsl.h
index f3d8ebc21d..af8e655cc5 100644
--- a/nis/libnsl.h
+++ b/nis/libnsl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/nis/nis_add.c b/nis/nis_add.c
index f3f3e4f045..9bf712ca6b 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
diff --git a/nis/nis_addmember.c b/nis/nis_addmember.c
index 147d2ea0a7..0aa382d0f1 100644
--- a/nis/nis_addmember.c
+++ b/nis/nis_addmember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_call.c b/nis/nis_call.c
index c437732c69..970415b505 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -797,7 +797,7 @@ __prepare_niscall (const_nis_name name, directory_obj **dirp,
dir_binding *bptrp, unsigned int flags)
{
nis_error retcode = __nisfind_server (name, 1, dirp, bptrp, flags);
- if (__builtin_expect (retcode != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (retcode != NIS_SUCCESS))
return retcode;
do
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 958c49f122..602ce2ff26 100644
--- a/nis/nis_callback.c
+++ b/nis/nis_callback.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -271,18 +271,18 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
cb = (struct nis_cb *) calloc (1,
sizeof (struct nis_cb) + sizeof (nis_server));
- if (__builtin_expect (cb == NULL, 0))
+ if (__glibc_unlikely (cb == NULL))
goto failed;
cb->serv = (nis_server *) (cb + 1);
cb->serv->name = strdup (nis_local_principal ());
- if (__builtin_expect (cb->serv->name == NULL, 0))
+ if (__glibc_unlikely (cb->serv->name == NULL))
goto failed;
cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));
- if (__builtin_expect (cb->serv->ep.ep_val == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val == NULL))
goto failed;
cb->serv->ep.ep_len = 1;
cb->serv->ep.ep_val[0].family = strdup ("inet");
- if (__builtin_expect (cb->serv->ep.ep_val[0].family == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val[0].family == NULL))
goto failed;
cb->callback = callback;
cb->userdata = userdata;
@@ -314,7 +314,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
}
cb->serv->ep.ep_val[0].proto = strdup ((flags & USE_DGRAM) ? "udp" : "tcp");
- if (__builtin_expect (cb->serv->ep.ep_val[0].proto == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val[0].proto == NULL))
goto failed;
cb->xprt = ((flags & USE_DGRAM)
? svcudp_bufcreate (sock, 100, 8192)
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 05fec4d42a..0c82323307 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_clone_dir.c b/nis/nis_clone_dir.c
index 13154c8632..e4f1a75bd7 100644
--- a/nis/nis_clone_dir.c
+++ b/nis/nis_clone_dir.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_clone_obj.c b/nis/nis_clone_obj.c
index 32dfa2f9eb..f8736e4eb0 100644
--- a/nis/nis_clone_obj.c
+++ b/nis/nis_clone_obj.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_clone_res.c b/nis/nis_clone_res.c
index 388b892a5a..3f200701e8 100644
--- a/nis/nis_clone_res.c
+++ b/nis/nis_clone_res.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index a9167348c3..f69d90d906 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -46,7 +46,7 @@ nis_creategroup (const_nis_name group, unsigned int flags)
return NIS_BADNAME;
obj = calloc (1, sizeof (nis_object));
- if (__builtin_expect (obj == NULL, 0))
+ if (__glibc_unlikely (obj == NULL))
return NIS_NOMEMORY;
obj->zo_oid.ctime = obj->zo_oid.mtime = time (NULL);
diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c
index 7e92a800de..dc0099f885 100644
--- a/nis/nis_defaults.c
+++ b/nis/nis_defaults.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_destroygroup.c b/nis/nis_destroygroup.c
index 53486fbd5f..be0a2be32f 100644
--- a/nis/nis_destroygroup.c
+++ b/nis/nis_destroygroup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_domain_of.c b/nis/nis_domain_of.c
index 79382e43e1..5b43af9fda 100644
--- a/nis/nis_domain_of.c
+++ b/nis/nis_domain_of.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c
index 52af9cc9cd..fb5567783c 100644
--- a/nis/nis_domain_of_r.c
+++ b/nis/nis_domain_of_r.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -50,7 +50,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
return strcpy (buffer, ".");
}
- if (__builtin_expect (cptr_len >= buflen, 0))
+ if (__glibc_unlikely (cptr_len >= buflen))
{
__set_errno (ERANGE);
return NULL;
diff --git a/nis/nis_error.c b/nis/nis_error.c
index cf94003507..e280f01066 100644
--- a/nis/nis_error.c
+++ b/nis/nis_error.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_file.c b/nis/nis_file.c
index 6cd88e2793..d56a1c2c80 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index b566425015..d2744890fe 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -89,7 +89,7 @@ __nis_findfastest_with_timeout (dir_binding *bind,
pings = malloc (sizeof (struct findserv_req) * pings_max);
xid_seed = (u_int32_t) (time (NULL) ^ getpid ());
- if (__builtin_expect (pings == NULL, 0))
+ if (__glibc_unlikely (pings == NULL))
return -1;
memset (&sin, '\0', sizeof (sin));
@@ -118,7 +118,7 @@ __nis_findfastest_with_timeout (dir_binding *bind,
pings_max += 10;
new_pings = realloc (pings, sizeof (struct findserv_req) *
pings_max);
- if (__builtin_expect (new_pings == NULL, 0))
+ if (__glibc_unlikely (new_pings == NULL))
{
free (pings);
return -1;
diff --git a/nis/nis_free.c b/nis/nis_free.c
index cd834eb42f..c2d3459be6 100644
--- a/nis/nis_free.c
+++ b/nis/nis_free.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index ac9278e227..9e34ec95f5 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -38,7 +38,7 @@ nis_getservlist (const_nis_name dir)
serv =
malloc (sizeof (nis_server *) *
(NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
- if (__builtin_expect (serv == NULL, 0))
+ if (__glibc_unlikely (serv == NULL))
{
nis_freeresult (res);
return NULL;
@@ -50,7 +50,7 @@ nis_getservlist (const_nis_name dir)
server =
&NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
serv[i] = calloc (1, sizeof (nis_server));
- if (__builtin_expect (serv[i] == NULL, 0))
+ if (__glibc_unlikely (serv[i] == NULL))
{
free_all:
while (i-- > 0)
@@ -81,7 +81,7 @@ nis_getservlist (const_nis_name dir)
if (server->name != NULL)
{
serv[i]->name = strdup (server->name);
- if (__builtin_expect (serv[i]->name == NULL, 0))
+ if (__glibc_unlikely (serv[i]->name == NULL))
{
++i;
goto free_all;
@@ -95,7 +95,7 @@ nis_getservlist (const_nis_name dir)
serv[i]->ep.ep_val =
malloc (server->ep.ep_len * sizeof (endpoint));
- if (__builtin_expect (serv[i]->ep.ep_val == NULL, 0))
+ if (__glibc_unlikely (serv[i]->ep.ep_val == NULL))
{
++i;
goto free_all;
@@ -126,7 +126,7 @@ nis_getservlist (const_nis_name dir)
if (server->pkey.n_len > 0)
{
serv[i]->pkey.n_bytes = malloc (server->pkey.n_len);
- if (__builtin_expect (serv[i]->pkey.n_bytes == NULL, 0))
+ if (__glibc_unlikely (serv[i]->pkey.n_bytes == NULL))
{
++i;
goto free_all;
@@ -140,7 +140,7 @@ nis_getservlist (const_nis_name dir)
else
{
serv = malloc (sizeof (nis_server *));
- if (__builtin_expect (serv != NULL, 0))
+ if (__glibc_unlikely (serv != NULL))
serv[0] = NULL;
}
diff --git a/nis/nis_hash.c b/nis/nis_hash.c
index dc5d6337f7..c1792c241c 100644
--- a/nis/nis_hash.c
+++ b/nis/nis_hash.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index 7210a687c9..6fc09d7c68 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_ismember.c b/nis/nis_ismember.c
index 09d7890817..b230293acf 100644
--- a/nis/nis_ismember.c
+++ b/nis/nis_ismember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index 5c0e0344a7..6e97e7f22f 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index a41f121855..64e2cc7d03 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -63,7 +63,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
req.ns_object.ns_object_val = NULL;
status = __prepare_niscall (req.ns_name, &dir, &bptr, flags);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = status;
goto out;
@@ -147,7 +147,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
dir = NULL;
status = __prepare_niscall (req.ns_name, &dir,
&bptr, flags);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = status;
goto out;
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index a233996e34..ada87e2b8f 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 8469f49417..54b6909b57 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index 633231f169..d07c50e6a0 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_print.c b/nis/nis_print.c
index 1efa0e989a..7d94069e96 100644
--- a/nis/nis_print.c
+++ b/nis/nis_print.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_print_group_entry.c b/nis/nis_print_group_entry.c
index ffb8ed2433..136f0e1942 100644
--- a/nis/nis_print_group_entry.c
+++ b/nis/nis_print_group_entry.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index 4faaaf4b4e..88bae6cf1e 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 79e380ef7d..b37efea529 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index 2e28aad44b..044a7fc3bf 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_server.c b/nis/nis_server.c
index 70510c3002..aff16f2741 100644
--- a/nis/nis_server.c
+++ b/nis/nis_server.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 4a4580a1e6..6c09f530a0 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -38,7 +38,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
while (name[i] != '.' && name[i] != '\0')
i++;
- if (__builtin_expect (i >= buflen, 0))
+ if (__glibc_unlikely (i >= buflen))
{
__set_errno (ERANGE);
return NULL;
@@ -118,7 +118,7 @@ nis_getnames (const_nis_name name)
int count = 2;
nis_name *getnames = malloc ((count + 1) * sizeof (char *));
- if (__builtin_expect (getnames == NULL, 0))
+ if (__glibc_unlikely (getnames == NULL))
return NULL;
/* Do we have a fully qualified NIS+ name ? If yes, give it back */
@@ -200,12 +200,12 @@ nis_getnames (const_nis_name name)
count += 5;
nis_name *newp = realloc (getnames,
(count + 1) * sizeof (char *));
- if (__builtin_expect (newp == NULL, 0))
+ if (__glibc_unlikely (newp == NULL))
goto free_null;
getnames = newp;
}
tmp = malloc (strlen (cptr) + local_domain_len + name_len + 2);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
getnames[pos] = tmp;
@@ -235,7 +235,7 @@ nis_getnames (const_nis_name name)
char *p;
tmp = malloc (cplen + local_domain_len + name_len + 2);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
p = __stpcpy (tmp, name);
@@ -251,7 +251,7 @@ nis_getnames (const_nis_name name)
char *p;
tmp = malloc (cplen + name_len + 3);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
p = __mempcpy (tmp, name, name_len);
@@ -267,7 +267,7 @@ nis_getnames (const_nis_name name)
count += 5;
nis_name *newp = realloc (getnames,
(count + 1) * sizeof (char *));
- if (__builtin_expect (newp == NULL, 0))
+ if (__glibc_unlikely (newp == NULL))
goto free_null;
getnames = newp;
}
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 9344a1f7b3..7b7422c5e1 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -92,7 +92,7 @@ __create_ib_request (const_nis_name name, unsigned int flags)
if (cptr != NULL)
*cptr++ = '\0';
- if (__builtin_expect (val == NULL, 0))
+ if (__glibc_unlikely (val == NULL))
{
nis_free_request (ibreq);
return NULL;
@@ -282,7 +282,7 @@ nis_list (const_nis_name name, unsigned int flags,
}
while (__nisbind_connect (&bptr) != NIS_SUCCESS)
- if (__builtin_expect (__nisbind_next (&bptr) != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (__nisbind_next (&bptr) != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
goto fail;
@@ -302,7 +302,7 @@ nis_list (const_nis_name name, unsigned int flags,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, RPCTIMEOUT);
- if (__builtin_expect (clnt_status != RPC_SUCCESS, 0))
+ if (__glibc_unlikely (clnt_status != RPC_SUCCESS))
NIS_RES_STATUS (res) = NIS_RPCERROR;
else
switch (NIS_RES_STATUS (res))
@@ -316,7 +316,7 @@ nis_list (const_nis_name name, unsigned int flags,
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
/* If we hit the link limit, bail. */
- if (__builtin_expect (count_links > NIS_MAXLINKS, 0))
+ if (__glibc_unlikely (count_links > NIS_MAXLINKS))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -491,7 +491,7 @@ nis_list (const_nis_name name, unsigned int flags,
/* Try the next domainname if we don't follow a link. */
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
- if (__builtin_expect (count_links, 0))
+ if (__glibc_unlikely (count_links))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -597,7 +597,7 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
(caddr_t) ibreq,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -654,7 +654,7 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2,
(xdrproc_t) _xdr_ib_request,
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -739,7 +739,7 @@ nis_first_entry (const_nis_name name)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -782,7 +782,7 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
if (cookie != NULL)
diff --git a/nis/nis_util.c b/nis/nis_util.c
index 193f3093be..d0e42b138e 100644
--- a/nis/nis_util.c
+++ b/nis/nis_util.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nis_verifygroup.c b/nis/nis_verifygroup.c
index 79fb962ac0..54a9ecfcf6 100644
--- a/nis/nis_verifygroup.c
+++ b/nis/nis_verifygroup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index d7ca81910e..d89b84999f 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -75,7 +75,7 @@ xdr_endpoint (XDR *xdrs, endpoint *objp)
if (__builtin_expect (res, TRUE))
{
res = xdr_string (xdrs, &objp->family, ~0);
- if (__builtin_expect (res, 1))
+ if (__glibc_likely (res))
res = xdr_string (xdrs, &objp->proto, ~0);
}
return res;
diff --git a/nis/nis_xdr.h b/nis/nis_xdr.h
index 2ac1e9f53f..3b0d257e8c 100644
--- a/nis/nis_xdr.h
+++ b/nis/nis_xdr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
diff --git a/nis/nisplus-parser.h b/nis/nisplus-parser.h
index 5f39d749f0..3f33069a44 100644
--- a/nis/nisplus-parser.h
+++ b/nis/nisplus-parser.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nss-default.c b/nis/nss-default.c
index 1b7bee10fb..bffac5a133 100644
--- a/nis/nss-default.c
+++ b/nis/nss-default.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/nis/nss-nis.c b/nis/nss-nis.c
index ea1a3fc5d8..b3bd05aa20 100644
--- a/nis/nss-nis.c
+++ b/nis/nss-nis.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/nis/nss-nis.h b/nis/nss-nis.h
index ec24d6491c..e1c35342f6 100644
--- a/nis/nss-nis.h
+++ b/nis/nss-nis.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/nis/nss-nisplus.c b/nis/nss-nisplus.c
index 0ed4be2a78..044259b1e4 100644
--- a/nis/nss-nisplus.c
+++ b/nis/nss-nisplus.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
diff --git a/nis/nss-nisplus.h b/nis/nss-nisplus.h
index 349529ad36..fadfea7023 100644
--- a/nis/nss-nisplus.h
+++ b/nis/nss-nisplus.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 2d57461fed..d8ef4be63b 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -194,9 +194,6 @@ _nss_compat_setgrent (int stayopen)
static enum nss_status
internal_endgrent (ent_t *ent)
{
- if (nss_endgrent)
- nss_endgrent ();
-
if (ent->stream != NULL)
{
fclose (ent->stream);
@@ -222,6 +219,9 @@ _nss_compat_endgrent (void)
__libc_lock_lock (lock);
+ if (nss_endgrent)
+ nss_endgrent ();
+
result = internal_endgrent (&ext_ent);
__libc_lock_unlock (lock);
@@ -288,7 +288,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -321,7 +321,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -421,7 +421,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -454,7 +454,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -552,7 +552,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -585,7 +585,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index fa1523891e..eaff0f676c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -16,7 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <alloca.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -30,6 +29,7 @@
#include <nsswitch.h>
#include <bits/libc-lock.h>
#include <kernel-features.h>
+#include <scratch_buffer.h>
static service_user *ni;
/* Type of the lookup function. */
@@ -214,7 +214,7 @@ add_group (long int *start, long int *size, gid_t **groupsp, long int limit,
gid_t *groups = *groupsp;
/* Matches user. Insert this group. */
- if (__builtin_expect (*start == *size, 0))
+ if (__glibc_unlikely (*start == *size))
{
/* Need a bigger buffer. */
gid_t *newgroups;
@@ -420,7 +420,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -453,7 +453,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
!(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -528,46 +528,31 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
long int *size, gid_t **groupsp, long int limit,
int *errnop)
{
- size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
- char *tmpbuf;
enum nss_status status;
ent_t intern = { true, false, false, NULL, {NULL, 0, 0} };
- bool use_malloc = false;
status = internal_setgrent (&intern);
if (status != NSS_STATUS_SUCCESS)
return status;
- tmpbuf = __alloca (buflen);
+ struct scratch_buffer tmpbuf;
+ scratch_buffer_init (&tmpbuf);
do
{
- while ((status = internal_getgrent_r (&intern, tmpbuf, buflen,
+ while ((status = internal_getgrent_r (&intern, tmpbuf.data, tmpbuf.length,
user, group, start, size,
groupsp, limit, errnop))
== NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
- if (__libc_use_alloca (buflen * 2))
- tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
- else
- {
- buflen *= 2;
- char *newbuf = realloc (use_malloc ? tmpbuf : NULL, buflen);
- if (newbuf == NULL)
- {
- status = NSS_STATUS_TRYAGAIN;
- goto done;
- }
- use_malloc = true;
- tmpbuf = newbuf;
- }
+ if (!scratch_buffer_grow (&tmpbuf))
+ goto done;
}
while (status == NSS_STATUS_SUCCESS);
status = NSS_STATUS_SUCCESS;
done:
- if (use_malloc)
- free (tmpbuf);
+ scratch_buffer_free (&tmpbuf);
internal_endgrent (&intern);
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 021fb18d19..9b1d671d17 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -311,9 +311,6 @@ _nss_compat_setpwent (int stayopen)
static enum nss_status
internal_endpwent (ent_t *ent)
{
- if (nss_endpwent)
- nss_endpwent ();
-
if (ent->stream != NULL)
{
fclose (ent->stream);
@@ -346,6 +343,9 @@ _nss_compat_endpwent (void)
__libc_lock_lock (lock);
+ if (nss_endpwent)
+ nss_endpwent ();
+
result = internal_endpwent (&ext_ent);
__libc_lock_unlock (lock);
@@ -528,7 +528,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -561,7 +561,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -578,7 +578,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
char *user, *host, *domain;
struct __netgrent netgrdata;
- bzero (&netgrdata, sizeof (struct __netgrent));
+ memset (&netgrdata, 0, sizeof (struct __netgrent));
__internal_setnetgrent (&result->pw_name[2], &netgrdata);
while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
buf2, sizeof (buf2), errnop))
@@ -727,7 +727,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -761,7 +761,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -934,7 +934,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -967,7 +967,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 1c2ec3d875..5e4bf78e47 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -169,7 +169,7 @@ copy_spwd_changes (struct spwd *dest, struct spwd *src,
}
static enum nss_status
-internal_setspent (ent_t *ent, int stayopen)
+internal_setspent (ent_t *ent, int stayopen, int needent)
{
enum nss_status status = NSS_STATUS_SUCCESS;
@@ -239,7 +239,7 @@ internal_setspent (ent_t *ent, int stayopen)
give_spwd_free (&ent->pwd);
- if (status == NSS_STATUS_SUCCESS && nss_setspent)
+ if (needent && status == NSS_STATUS_SUCCESS && nss_setspent)
ent->setent_status = nss_setspent (stayopen);
return status;
@@ -256,7 +256,7 @@ _nss_compat_setspent (int stayopen)
if (ni == NULL)
init_nss_interface ();
- result = internal_setspent (&ext_ent, stayopen);
+ result = internal_setspent (&ext_ent, stayopen, 1);
__libc_lock_unlock (lock);
@@ -267,9 +267,6 @@ _nss_compat_setspent (int stayopen)
static enum nss_status
internal_endspent (ent_t *ent)
{
- if (nss_endspent)
- nss_endspent ();
-
if (ent->stream != NULL)
{
fclose (ent->stream);
@@ -303,6 +300,9 @@ _nss_compat_endspent (void)
__libc_lock_lock (lock);
+ if (nss_endspent)
+ nss_endspent ();
+
result = internal_endspent (&ext_ent);
__libc_lock_unlock (lock);
@@ -485,7 +485,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -515,7 +515,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
|| !(parse_res = _nss_files_parse_spent (p, result, data,
buflen, errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -532,7 +532,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
char *user, *host, *domain;
struct __netgrent netgrdata;
- bzero (&netgrdata, sizeof (struct __netgrent));
+ memset (&netgrdata, 0, sizeof (struct __netgrent));
__internal_setnetgrent (&result->sp_namp[2], &netgrdata);
while (__internal_getnetgrent_r (&host, &user, &domain,
&netgrdata, buf2, sizeof (buf2),
@@ -658,7 +658,7 @@ _nss_compat_getspent_r (struct spwd *pwd, char *buffer, size_t buflen,
init_nss_interface ();
if (ext_ent.stream == NULL)
- result = internal_setspent (&ext_ent, 1);
+ result = internal_setspent (&ext_ent, 1, 1);
if (result == NSS_STATUS_SUCCESS)
result = internal_getspent_r (pwd, &ext_ent, buffer, buflen, errnop);
@@ -685,7 +685,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -718,7 +718,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_spent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -830,7 +830,7 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
__libc_lock_unlock (lock);
- result = internal_setspent (&ent, 0);
+ result = internal_setspent (&ent, 0, 0);
if (result == NSS_STATUS_SUCCESS)
result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 2f708c185c..4f23118183 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -125,7 +125,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
alias->alias_local = 0;
@@ -147,7 +147,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -156,7 +156,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -170,7 +170,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*errnop = ERANGE;
@@ -213,7 +213,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
size_t namlen = strlen (name);
@@ -244,7 +244,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
if (!use_alloca)
free (name2);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -253,7 +253,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -269,7 +269,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
alias->alias_local = 0;
int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index a803c27ac6..1c18d0f79d 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -188,7 +188,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -196,7 +196,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -205,7 +205,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -220,7 +220,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -241,7 +241,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[33];
@@ -257,7 +257,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
int len;
int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -266,7 +266,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -281,7 +281,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 53368073a7..19fe8cfc44 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -85,7 +85,7 @@ internal_nis_setgrent (void)
{
/* We have to read all the data now. */
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct ypall_callback ypcb;
@@ -152,7 +152,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
handle_batch_read:
bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -191,7 +191,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
yperr = yp_next (domain, "group.byname", oldkey, oldkeylen,
&outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -201,7 +201,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
}
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
if (!batch_read)
free (result);
@@ -218,7 +218,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
if (!batch_read)
free (outkey);
@@ -267,7 +267,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -275,7 +275,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
int yperr = yp_match (domain, "group.byname", name, strlen (name), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -284,7 +284,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -314,7 +314,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -324,7 +324,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
int len;
int yperr = yp_match (domain, "group.bygid", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -333,7 +333,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -348,7 +348,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index f73a0eccb2..6a9e8e8c31 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -136,14 +136,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
int af, int flags)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
buffer += pad;
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -168,7 +168,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -188,7 +188,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*h_errnop = NETDB_INTERNAL;
@@ -203,7 +203,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
free (result);
parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*h_errnop = NETDB_INTERNAL;
@@ -270,6 +270,13 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
@@ -281,7 +288,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
int len;
int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -296,7 +303,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
}
const size_t linebuflen = buffer + buflen - data->linebuffer;
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*h_errnop = NETDB_INTERNAL;
@@ -312,7 +319,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
int parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
- if (__builtin_expect (parse_res < 1 || host->h_addrtype != af, 0))
+ if (__glibc_unlikely (parse_res < 1 || host->h_addrtype != af))
{
if (parse_res == -1)
{
@@ -373,14 +380,14 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int *errnop, int *h_errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
buffer += pad;
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -395,7 +402,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int yperr = yp_match (domain, "hosts.byaddr", buf, strlen (buf), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -411,7 +418,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
}
const size_t linebuflen = buffer + buflen - data->linebuffer;
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*errnop = ERANGE;
@@ -428,7 +435,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int parse_res = parse_line (p, host, data, buflen, errnop, af,
((_res.options & RES_USE_INET6)
? AI_V4MAPPED : 0));
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -461,6 +468,13 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
@@ -472,7 +486,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
int len;
int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -493,7 +507,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
{
erange:
free (result);
@@ -512,14 +526,14 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
goto erange;
buflen -= pad;
struct hostent host;
int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC,
0);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 30bc90f691..ed5c26b20d 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -72,7 +72,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (intern->offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern->offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -88,7 +88,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
++intern->offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -106,7 +106,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern->offset += len;
@@ -150,6 +150,13 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
gid_t **groupsp, long int limit, int *errnop,
const char *domainname)
{
+ /* Limit domainname length to the maximum size of an RPC packet. */
+ if (strlen (domainname) > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
/* Prepare the key. The form is "unix.UID@DOMAIN" with the UID and
DOMAIN field filled in appropriately. */
char key[sizeof ("unix.@") + sizeof (uid_t) * 3 + strlen (domainname)];
@@ -160,7 +167,7 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
int reslen;
int yperr = yp_match (domainname, "netid.byname", key, keylen, &result,
&reslen);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
return yperr2nss (yperr);
/* Parse the result: following the colon is a comma separated list of
@@ -319,5 +326,5 @@ done:
free (intern.next);
}
- return NSS_STATUS_SUCCESS;
+ return status;
}
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index d4b2e569d3..44faab7c29 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -54,16 +54,16 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp)
status = NSS_STATUS_SUCCESS;
- if (__builtin_expect (group == NULL || group[0] == '\0', 0))
+ if (__glibc_unlikely (group == NULL || group[0] == '\0'))
return NSS_STATUS_UNAVAIL;
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group),
&netgrp->data, &len));
- if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
+ if (__glibc_likely (status == NSS_STATUS_SUCCESS))
{
/* Our implementation of yp_match already allocates a buffer
which is one byte larger than the value in LEN specifies
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index da28860003..2679f955e6 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -74,7 +74,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
struct parser_data *data = (void *) buffer;
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* Get the next entry until we found a correct one. */
@@ -94,7 +94,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
yperr = yp_next (domain, "networks.byname", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -106,7 +106,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -121,7 +121,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
free (result);
parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*herrnop = NETDB_INTERNAL;
@@ -166,7 +166,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct parser_data *data = (void *) buffer;
@@ -179,6 +179,13 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
@@ -191,7 +198,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
int yperr = yp_match (domain, "networks.byname", name2, namlen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -203,7 +210,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -219,7 +226,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
int parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
@@ -237,7 +244,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int *herrnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct in_addr in = { .s_addr = htonl (addr) };
@@ -252,7 +259,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int yperr = yp_match (domain, "networks.byaddr", buf, blen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -277,7 +284,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
}
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -294,7 +301,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int parse_res = _nss_files_parse_netent (p, net, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index eff2eddd6c..f525c6e34a 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -185,7 +185,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -193,7 +193,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
int yperr = yp_match (domain, "protocols.byname", name, strlen (name),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -202,7 +202,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -217,7 +217,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -232,7 +232,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -243,7 +243,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
int yperr = yp_match (domain, "protocols.bynumber", buf, nlen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -252,7 +252,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -267,7 +267,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index cec43e2b24..6fff55dda7 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -56,7 +56,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -102,7 +102,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 6726efde57..9c5d39c450 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -57,7 +57,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (bucket == NULL, 0))
+ if (__glibc_unlikely (bucket == NULL))
{
#define MINSIZE 4096 - 4 * sizeof (void *)
const size_t minsize = MAX (MINSIZE, 2 * (invallen + 1));
@@ -92,7 +92,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval,
}
char *p = mempcpy (&bucket->mem[intern->offset], inval, invallen);
- if (__builtin_expect (p[-1] != '\0', 0))
+ if (__glibc_unlikely (p[-1] != '\0'))
{
*p = '\0';
++invallen;
@@ -143,7 +143,7 @@ internal_nis_setpwent (void)
{
/* We have to read all the data now. */
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct ypall_callback ypcb;
@@ -210,7 +210,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
handle_batch_read:
bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -249,7 +249,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
yperr = yp_next (domain, "passwd.byname", oldkey, oldkeylen,
&outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -312,7 +312,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -330,7 +330,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
if (!batch_read)
free (outkey);
@@ -379,7 +379,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
size_t namelen = strlen (name);
@@ -388,7 +388,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
int len;
int yperr = yp_match (domain, "passwd.byname", name, namelen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -447,7 +447,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -464,7 +464,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -480,7 +480,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -490,7 +490,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
int len;
int yperr = yp_match (domain, "passwd.byuid", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -552,7 +552,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -569,7 +569,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index a2fff630c4..28cf1333c7 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -124,7 +124,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (intern->offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern->offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -139,7 +139,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
++intern->offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -156,7 +156,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
p = memcpy (buffer, &bucket->mem[intern->offset], len);
parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern->offset += len;
@@ -193,7 +193,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
intern_t data = { NULL, NULL, 0 };
enum nss_status status = internal_nis_setrpcent (&data);
- if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NSS_STATUS_SUCCESS))
return status;
int found = 0;
@@ -222,7 +222,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
internal_nis_endrpcent (&data);
- if (__builtin_expect (!found && status == NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (!found && status == NSS_STATUS_SUCCESS))
return NSS_STATUS_NOTFOUND;
return status;
@@ -233,7 +233,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -243,7 +243,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
int len;
int yperr = yp_match (domain, "rpc.bynumber", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -252,7 +252,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -267,7 +267,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
int parse_res = _nss_files_parse_rpcent (p, rpc, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index fd79d3fe07..2092588977 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -56,12 +56,12 @@ dosearch (int instatus, char *inkey, int inkeylen, char *inval,
{
struct search_t *req = (struct search_t *) indata;
- if (__builtin_expect (instatus != YP_TRUE, 0))
+ if (__glibc_unlikely (instatus != YP_TRUE))
return 1;
if (inkey && inkeylen > 0 && inval && invallen > 0)
{
- if (__builtin_expect ((size_t) (invallen + 1) > req->buflen, 0))
+ if (__glibc_unlikely ((size_t) (invallen + 1) > req->buflen))
{
*req->errnop = ERANGE;
req->status = NSS_STATUS_TRYAGAIN;
@@ -196,7 +196,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
{
struct response_t *bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -211,7 +211,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
++intern.offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -228,7 +228,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
p = memcpy (buffer, &bucket->mem[intern.offset], len);
parse_res = _nss_files_parse_servent (p, serv, pdata, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern.offset += len;
@@ -265,12 +265,19 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* If the protocol is given, we could try if our NIS server knows
about services.byservicename map. If yes, we only need one query. */
size_t keylen = strlen (name) + (protocol ? 1 + strlen (protocol) : 0);
+ /* Limit key length to the maximum size of an RPC packet. */
+ if (keylen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char key[keylen + 1];
/* key is: "name/proto" */
@@ -289,9 +296,9 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (__builtin_expect (status == YPERR_SUCCESS, 1))
+ if (__glibc_likely (status == YPERR_SUCCESS))
{
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -306,7 +313,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 0, 0))
+ if (__glibc_unlikely (parse_res < 0))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -336,7 +343,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
req.status = NSS_STATUS_NOTFOUND;
status = yp_all (domain, "services.byname", &ypcb);
- if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (status != YPERR_SUCCESS))
return yperr2nss (status);
return req.status;
@@ -348,13 +355,20 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* If the protocol is given, we only need one query.
Otherwise try first port/tcp, then port/udp and then fallback
to sequential scanning of services.byname. */
const char *proto = protocol != NULL ? protocol : "tcp";
+ /* Limit protocol name length to the maximum size of an RPC packet. */
+ if (strlen (proto) > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
do
{
/* key is: "port/proto" */
@@ -370,9 +384,9 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (__builtin_expect (status == YPERR_SUCCESS, 1))
+ if (__glibc_likely (status == YPERR_SUCCESS))
{
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -386,7 +400,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
free (result);
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 0, 0))
+ if (__glibc_unlikely (parse_res < 0))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -417,7 +431,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
req.status = NSS_STATUS_NOTFOUND;
int status = yp_all (domain, "services.byname", &ypcb);
- if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (status != YPERR_SUCCESS))
return yperr2nss (status);
return req.status;
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index d024c0d22c..7a70dbe543 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -71,7 +71,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* Get the next entry until we found a correct one. */
@@ -102,7 +102,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
? "passwd.adjunct.byname" : "shadow.byname"),
oldkey, oldkeylen, &outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -177,7 +177,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
const size_t name_len = strlen (name);
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
bool adjunct_used = false;
@@ -194,7 +194,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
adjunct_used = true;
}
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -203,7 +203,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
return retval;
}
- if (__builtin_expect ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -224,7 +224,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
int parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index e3a82ffc49..4b9f2ffae1 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -310,7 +310,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -323,7 +323,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index cc7695f037..b874ea8268 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -264,7 +264,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -277,7 +277,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
@@ -331,7 +331,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -344,7 +344,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index 8667532977..49f9a34355 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -242,7 +242,7 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_grent (&result, gr,
buffer, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
*errnop = ERANGE;
retval = NSS_STATUS_TRYAGAIN;
@@ -316,7 +316,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -326,7 +326,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -371,7 +371,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -384,7 +384,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 62440f2459..d86e06d4bc 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -439,7 +439,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
}
int retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -543,7 +543,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
}
retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -587,7 +587,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host,
buffer, buflen,
errnop, herrnop, 0);
- if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
+ if (__glibc_likely (status == NSS_STATUS_SUCCESS))
{
if (*pat == NULL)
{
@@ -596,7 +596,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
{
free (result);
*errnop = ERANGE;
diff --git a/nis/nss_nisplus/nisplus-initgroups.c b/nis/nss_nisplus/nisplus-initgroups.c
index 9df9643a28..0fc9b7e358 100644
--- a/nis/nss_nisplus/nisplus-initgroups.c
+++ b/nis/nss_nisplus/nisplus-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -67,7 +67,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -98,7 +98,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start,
gid_t gid;
char *endp;
- if (__builtin_expect (numstr[len - 1] != '\0', 0))
+ if (__glibc_unlikely (numstr[len - 1] != '\0'))
{
char numstrbuf[len + 1];
memcpy (numstrbuf, numstr, len);
diff --git a/nis/nss_nisplus/nisplus-netgrp.c b/nis/nss_nisplus/nisplus-netgrp.c
index 1027be1db6..cb83cb45b0 100644
--- a/nis/nss_nisplus/nisplus-netgrp.c
+++ b/nis/nss_nisplus/nisplus-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index ed4a8f35e4..e3218cd683 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -376,7 +376,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
}
retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -447,7 +447,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
return NSS_STATUS_TRYAGAIN;
}
enum nss_status retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (b2len > 2 && buf2[b2len - 2] == '.' && buf2[b2len - 1] == '0')
{
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index 42f49e036b..4ae5fcdd1e 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index 358d7de216..85997cd15e 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -347,7 +347,7 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -408,7 +408,7 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c
index 4aef42450c..eccbab7eed 100644
--- a/nis/nss_nisplus/nisplus-publickey.c
+++ b/nis/nss_nisplus/nisplus-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index 1a732bc813..b8eaa10ffe 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -243,7 +243,7 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_pwent (&result, pw, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
*errnop = ERANGE;
retval = NSS_STATUS_TRYAGAIN;
@@ -317,7 +317,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -331,7 +331,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -376,7 +376,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -390,7 +390,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 5604a5f850..3273cf858a 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -351,7 +351,7 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index 805ccfb2fb..05055e5735 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@@ -258,7 +258,7 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
parse_res = _nss_nisplus_parse_servent (result, serv, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
nis_freeresult (result);
result = saved_res;
@@ -360,7 +360,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -374,7 +374,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -429,7 +429,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -443,7 +443,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol,
errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c
index 5b671e2681..91e539b5c0 100644
--- a/nis/nss_nisplus/nisplus-spwd.c
+++ b/nis/nss_nisplus/nisplus-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -124,7 +124,7 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_spent (result, sp, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
nis_freeresult (result);
result = saved_res;
@@ -189,7 +189,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -202,7 +202,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
index 3c6c33f03c..68cfa06304 100644
--- a/nis/rpcsvc/nislib.h
+++ b/nis/rpcsvc/nislib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
diff --git a/nis/rpcsvc/ypclnt.h b/nis/rpcsvc/ypclnt.h
index 3217299be0..c822288334 100644
--- a/nis/rpcsvc/ypclnt.h
+++ b/nis/rpcsvc/ypclnt.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 400db0a7ee..de8c1ffbaa 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -183,7 +183,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
{
is_new = 1;
ysd = (dom_binding *) calloc (1, sizeof *ysd);
- if (__builtin_expect (ysd == NULL, 0))
+ if (__glibc_unlikely (ysd == NULL))
return YPERR_RESRC;
}
@@ -471,7 +471,7 @@ yp_match (const char *indomain, const char *inmap, const char *inkey,
*outvallen = resp.val.valdat_len;
*outval = malloc (*outvallen + 1);
int status = YPERR_RESRC;
- if (__builtin_expect (*outval != NULL, 1))
+ if (__glibc_likely (*outval != NULL))
{
memcpy (*outval, resp.val.valdat_val, *outvallen);
(*outval)[*outvallen] = '\0';
@@ -770,7 +770,7 @@ yp_all (const char *indomain, const char *inmap,
(caddr_t) &req, (xdrproc_t) __xdr_ypresp_all,
(caddr_t) &data, RPCTIMEOUT);
- if (__builtin_expect (result != RPC_SUCCESS, 0))
+ if (__glibc_unlikely (result != RPC_SUCCESS))
{
/* Print the error message only on the last try. */
if (try == MAXTRIES - 1)
@@ -811,7 +811,7 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist)
(caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist,
(caddr_t) &resp);
- if (__builtin_expect (result == YPERR_SUCCESS, 1))
+ if (__glibc_likely (result == YPERR_SUCCESS))
{
*outmaplist = resp.maps;
/* We don't free the list, this will be done by ypserv