- Pack IPv4 servers at the start of nsaddr_list and

only track the number of IPV4 servers in EXT(statp->nscounti
(#808147)
  - Mark set*uid, set*gid as __wur (warn unused result) (#845960)
This commit is contained in:
Jeff Law 2012-08-06 11:46:20 -06:00
parent 64ea3f61e3
commit d985507603
3 changed files with 149 additions and 2 deletions

View File

@ -1,6 +1,36 @@
diff -rup a/resolv/res_init.c b/resolv/res_init.c
--- a/resolv/res_init.c 2012-07-26 15:10:45.655638776 -0600
+++ b/resolv/res_init.c 2012-07-26 15:11:27.731423002 -0600
@@ -314,9 +314,9 @@ __res_vinit(res_state statp, int preinit
cp++;
if ((*cp != '\0') && (*cp != '\n')
&& __inet_aton(cp, &a)) {
- statp->nsaddr_list[nservall].sin_addr = a;
- statp->nsaddr_list[nservall].sin_family = AF_INET;
- statp->nsaddr_list[nservall].sin_port =
+ statp->nsaddr_list[nserv].sin_addr = a;
+ statp->nsaddr_list[nserv].sin_family = AF_INET;
+ statp->nsaddr_list[nserv].sin_port =
htons(NAMESERVER_PORT);
nserv++;
#ifdef _LIBC
diff -rup a/resolv/res_send.c b/resolv/res_send.c
--- a/resolv/res_send.c 2010-05-04 05:27:23.000000000 -0600
+++ b/resolv/res_send.c 2012-03-01 12:11:13.065605342 -0700
+++ b/resolv/res_send.c 2012-07-26 15:34:58.398261659 -0600
@@ -421,10 +421,10 @@ __libc_res_nsend(res_state statp, const
EXT(statp).nsmap[n] = MAXNS;
}
}
- n = statp->nscount;
- if (statp->nscount > EXT(statp).nscount)
+ n = statp->nscount - EXT(statp).nscount6;
+ if (n > EXT(statp).nscount)
for (n = EXT(statp).nscount, ns = 0;
- n < statp->nscount; n++) {
+ n < statp->nscount - EXT(statp).nscount6; n++) {
while (ns < MAXNS
&& EXT(statp).nsmap[ns] != MAXNS)
ns++;
@@ -441,7 +441,7 @@ __libc_res_nsend(res_state statp, const
malloc(sizeof (struct sockaddr_in6));
if (EXT(statp).nsaddrs[n] != NULL) {

110
glibc-rh845960.patch Normal file
View File

@ -0,0 +1,110 @@
commit 7e66ee5142deda977163d0a858c3d2883cae3f07
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jul 24 13:45:59 2012 +0200
* posix/unistd.h (setuid, setreuid, seteuid, setresuid):
Declare with warn_unused_result.
(setgid, setregid, setegid, setresgid): Likewise.
* sysdeps/unix/sysv/linux/sys/fsuid.h (setfsuid, setfsgid):
Likewise.
* WUR-REPORT: Remove set*id functions.
diff --git a/WUR-REPORT b/WUR-REPORT
index ef407cf..d997bd0 100644
--- a/WUR-REPORT
+++ b/WUR-REPORT
@@ -4,17 +4,6 @@ lssek: Probably should be __wur but lseek(fd,SEEK_SET,0) will succeed if
the descriptor is fine.
lseek64: same
-setuid: will always succeed given correct privileges, so there might
- be places which don't check for it.
-setreuid: same
-seteuid: same
-setgid: same
-setregid: same
-setegid: same
-setresuid: same
-setresgid: same
-
-
<stdio.h>:
setvbuf: if stream and buffer are fine and other parameters constant,
diff --git a/posix/unistd.h b/posix/unistd.h
index 9839761..88d711a 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -719,34 +719,34 @@ extern int group_member (__gid_t __gid) __THROW;
If the calling process is the super-user, set the real
and effective user IDs, and the saved set-user-ID to UID;
if not, the effective user ID is set to UID. */
-extern int setuid (__uid_t __uid) __THROW;
+extern int setuid (__uid_t __uid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real user ID of the calling process to RUID,
and the effective user ID of the calling process to EUID. */
-extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective user ID of the calling process to UID. */
-extern int seteuid (__uid_t __uid) __THROW;
+extern int seteuid (__uid_t __uid) __THROW __wur;
#endif /* Use BSD. */
/* Set the group ID of the calling process to GID.
If the calling process is the super-user, set the real
and effective group IDs, and the saved set-group-ID to GID;
if not, the effective group ID is set to GID. */
-extern int setgid (__gid_t __gid) __THROW;
+extern int setgid (__gid_t __gid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real group ID of the calling process to RGID,
and the effective group ID of the calling process to EGID. */
-extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
+extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective group ID of the calling process to GID. */
-extern int setegid (__gid_t __gid) __THROW;
+extern int setegid (__gid_t __gid) __THROW __wur;
#endif /* Use BSD. */
#ifdef __USE_GNU
@@ -763,12 +763,12 @@ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
- __THROW;
+ __THROW __wur;
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
- __THROW;
+ __THROW __wur;
#endif
diff --git a/sysdeps/unix/sysv/linux/sys/fsuid.h b/sysdeps/unix/sysv/linux/sys/fsuid.h
index 2fd512e..4494baf 100644
--- a/sysdeps/unix/sysv/linux/sys/fsuid.h
+++ b/sysdeps/unix/sysv/linux/sys/fsuid.h
@@ -25,10 +25,10 @@ __BEGIN_DECLS
/* Change uid used for file access control to UID, without affecting
other privileges (such as who can send signals at the process). */
-extern int setfsuid (__uid_t __uid) __THROW;
+extern int setfsuid (__uid_t __uid) __THROW __wur;
/* Ditto for group id. */
-extern int setfsgid (__gid_t __gid) __THROW;
+extern int setfsgid (__gid_t __gid) __THROW __wur;
__END_DECLS

View File

@ -28,7 +28,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 6%{?dist}
Release: 7%{?dist}
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@ -109,6 +109,7 @@ Patch0034: %{name}-rh841318.patch
#
# Patches from upstream
#
Patch1035: %{name}-rh845960.patch
#
@ -422,6 +423,7 @@ rm -rf %{glibcportsdir}
%patch2032 -p1
%patch2033 -p1
%patch0034 -p1
%patch1035 -p1
# On powerpc32, hp timing is only available in power4/power6
# libs, not in base, so pre-power4 dynamic linker is incompatible
@ -1306,6 +1308,11 @@ rm -f *.filelist*
%endif
%changelog
* Wed Jul 25 2012 Jeff Law <law@redhat.com> - 2.16-7
- Pack IPv4 servers at the start of nsaddr_list and
only track the number of IPV4 servers in EXT(statp->nscounti (#808147)
- Mark set*uid, set*gid as __wur (warn unused result) (#845960)
* Wed Jul 25 2012 Jeff Law <law@redhat.com> - 2.16-6
- Revert patch for BZ696143, it made it impossible to use IPV6
addresses explicitly in getaddrinfo, which in turn broke