summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
commit32c075e1f01849e161724bbd400ba77244e482cc (patch)
tree5f083a3f352104f32bb6c902d57fa3f294bd8d4d /sysdeps/posix
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
downloadglibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.gz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.xz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.zip
.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/euidaccess.c10
-rw-r--r--sysdeps/posix/getaddrinfo.c14
2 files changed, 13 insertions, 11 deletions
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index 76a09d455d..333870cdde 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -1,5 +1,5 @@
 /* Check if effective user id can access file
-   Copyright (C) 1990,1991,1995-2001,2005 Free Software Foundation, Inc.
+   Copyright (C) 1990,1991,1995-2001,2005,2007 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
@@ -128,10 +128,6 @@ euidaccess (path, mode)
 #ifdef	_LIBC
   uid_t euid;
   gid_t egid;
-
-  if (! __libc_enable_secure)
-    /* If we are not set-uid or set-gid, access does the same.  */
-    return __access (path, mode);
 #else
   if (have_ids == 0)
     {
@@ -162,6 +158,10 @@ euidaccess (path, mode)
   /* Now we need the IDs.  */
   euid = __geteuid ();
   egid = __getegid ();
+
+  if (__getuid () == euid && __getgid () == egid)
+    /* If we are not set-uid or set-gid, access does the same.  */
+    return __access (path, mode);
 #endif
 
   /* The super-user can read and write any file, and execute any file
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index b4966852a7..a7e1459c9c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1157,7 +1157,7 @@ get_scope (const struct sockaddr_storage *ss)
 	 169.254/16 and 127/8 are link-local.  */
       if ((addr[0] == 169 && addr[1] == 254) || addr[0] == 127)
 	scope = 2;
-      else if (addr[0] == 10 || (addr[0] == 172 && addr[1] == 16)
+      else if (addr[0] == 10 || (addr[0] == 172 && (addr[1] & 0xf0) == 16)
 	       || (addr[0] == 192 && addr[1] == 168))
 	scope = 5;
       else
@@ -1218,6 +1218,10 @@ static const struct prefixentry default_labels[] =
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       7, 6 },
     { { .in6_u
+	= { .u6_addr8 = { 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      32, 7 },
+    { { .in6_u
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       0, 1 }
@@ -2085,12 +2089,10 @@ getaddrinfo (const char *name, const char *service,
 
 		  if (q->ai_family == PF_INET6 && in6ai != NULL)
 		    {
-		      /* See whether the source address is the list of
-			 deprecated or temporary addresses.  */
+		      /* See whether the address is the list of deprecated
+			 or temporary addresses.  */
 		      struct in6addrinfo tmp;
-		      struct sockaddr_in6 *sin6p
-			= (struct sockaddr_in6 *) &results[i].source_addr;
-		      memcpy (tmp.addr, &sin6p->sin6_addr, IN6ADDRSZ);
+		      memcpy (tmp.addr, q->ai_addr, IN6ADDRSZ);
 
 		      struct in6addrinfo *found
 			= bsearch (&tmp, in6ai, in6ailen, sizeof (*in6ai),