about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-03-14 12:59:57 +0000
committerRoland McGrath <roland@gnu.org>1999-03-14 12:59:57 +0000
commit8ea6a7aa50e9d4c81740c1fdb19dca0d8be748e2 (patch)
treec7ab987be88420577577a4554da58baae8ab48ac
parent91ea72b7d26907ddbfc5a155752ec506d926c804 (diff)
downloadglibc-8ea6a7aa50e9d4c81740c1fdb19dca0d8be748e2.tar.gz
glibc-8ea6a7aa50e9d4c81740c1fdb19dca0d8be748e2.tar.xz
glibc-8ea6a7aa50e9d4c81740c1fdb19dca0d8be748e2.zip
1999-03-14 Roland McGrath <roland@baalperazim.frob.com>
* hurd/hurdlookup.c (__hurd_file_name_lookup_retry): Under O_NOFOLLOW, 
check for root-owned symlinks and reject them too.
-rw-r--r--hurd/hurdlookup.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index 984a101579..0714e4aa86 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include "stdio-common/_itoa.h"
 #include <hurd/term.h>
+#include <hurd/paths.h>
 
 
 /* Translate the error from dir_lookup into the error the user sees.  */
@@ -197,9 +198,24 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
 		  struct stat st;
 		  err = __io_stat (*result, &st);
 		  if (!err
-		      && st.st_uid != 0
 		      && (st.st_mode & (S_IPTRANS|S_IATRANS)))
-		    err = ENOENT;
+		    {
+		      if (st.st_uid != 0)
+			err = ENOENT;
+		      else if (st.st_mode & S_IPTRANS)
+			{
+			  char buf[1024];
+			  char *trans = buf;
+			  size_t translen = sizeof buf;
+			  err = __file_get_translator (*result,
+						       &trans, &translen);
+			  if (!err
+			      && translen > sizeof _HURD_SYMLINK
+			      && !memcmp (trans,
+					  _HURD_SYMLINK, sizeof _HURD_SYMLINK))
+			    err = ENOENT;
+			}
+		    }
 		}
 
 	      /* We got a successful translation.  Now apply any open-time