Blame SOURCES/cups-CVE-2014-3537.patch

5e7041
diff -up cups-1.6.3/scheduler/client.c.CVE-2014-3537 cups-1.6.3/scheduler/client.c
5e7041
--- cups-1.6.3/scheduler/client.c.CVE-2014-3537	2014-09-02 11:30:50.021384781 +0100
5e7041
+++ cups-1.6.3/scheduler/client.c	2014-09-02 11:31:00.606440125 +0100
5e7041
@@ -3197,7 +3197,7 @@ get_file(cupsd_client_t *con,		/* I  - C
5e7041
     if ((ptr = strchr(filename, '?')) != NULL)
5e7041
       *ptr = '\0';
5e7041
 
5e7041
-    if ((status = stat(filename, filestats)) != 0)
5e7041
+    if ((status = lstat(filename, filestats)) != 0)
5e7041
     {
5e7041
      /*
5e7041
       * Drop the language prefix and try the root directory...
5e7041
@@ -3209,12 +3209,33 @@ get_file(cupsd_client_t *con,		/* I  - C
5e7041
       if ((ptr = strchr(filename, '?')) != NULL)
5e7041
 	*ptr = '\0';
5e7041
 
5e7041
-      status = stat(filename, filestats);
5e7041
+      status = lstat(filename, filestats);
5e7041
     }
5e7041
   }
5e7041
 
5e7041
+  /*
5e7041
+   * If we've found a symlink, 404 the sucker to avoid disclosing information.
5e7041
+   */
5e7041
+ 
5e7041
+  if (!status && S_ISLNK(filestats->st_mode))
5e7041
+  {
5e7041
+    cupsdLogMessage(CUPSD_LOG_INFO, "[Client %d] Symlinks such as \"%s\" are not allowed.", con->http.fd, filename);
5e7041
+    return (NULL);
5e7041
+  }
5e7041
+
5e7041
+ /*
5e7041
+  * Similarly, if the file/directory does not have world read permissions, do
5e7041
+  * not allow access...
5e7041
+  */
5e7041
+
5e7041
+  if (!status && !(filestats->st_mode & S_IROTH))
5e7041
+  {
5e7041
+    cupsdLogMessage(CUPSD_LOG_INFO, "[Client %d] Files/directories such as \"%s\" must be world-readable.", con->http.fd, filename);
5e7041
+    return (NULL);
5e7041
+  }
5e7041
+
5e7041
  /*
5e7041
-  * If we're found a directory, get the index.html file instead...
5e7041
+  * If we've found a directory, get the index.html file instead...
5e7041
   */
5e7041
 
5e7041
   if (!status && S_ISDIR(filestats->st_mode))