check if owner-X-bit is there for mkdir draft
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Sat, 09 Nov 2019 10:59:52 +0900
changeset 81063 7a6ed8d4c68b2ca7f30bdb4f4452d126fec9568c
parent 81062 e78fd22c9457e24c787382e1e890b48f8c6b3c4a
child 81064 c9f0a1c73aa991348c0cc39dd66386f2e854c3db
push id9744
push userishikawa@yk.rim.or.jp
push dateSat, 09 Nov 2019 02:01:06 +0000
treeherdertry-comm-central@56c83244ac0e [default view] [failures only]
check if owner-X-bit is there for mkdir
mozilla-M-C-001-check-if-owner-X-bit-is-there.patch
new file mode 100644
--- /dev/null
+++ b/mozilla-M-C-001-check-if-owner-X-bit-is-there.patch
@@ -0,0 +1,37 @@
+# HG changeset patch
+# User ISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
+# Parent  44bff14fb30471ecc8534a7cf50e0c7978a6254c
+check if owner-X-bit is there for mkdir
+
+diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
+--- a/xpcom/io/nsLocalFileUnix.cpp
++++ b/xpcom/io/nsLocalFileUnix.cpp
+@@ -426,16 +426,28 @@ static int do_create(const char* aPath, 
+                      PRFileDesc** aResult) {
+   *aResult = PR_Open(aPath, aFlags, aMode);
+   return *aResult ? 0 : -1;
+ }
+ 
+ static int do_mkdir(const char* aPath, int aFlags, mode_t aMode,
+                     PRFileDesc** aResult) {
+   *aResult = nullptr;
++#ifdef DEBUG
++  if (!(aMode & 0100)) {  // No exec bit for its own creator
++    fprintf(stderr,"(debug) do_mkdir called with no X bit. <<%s>> mode=0%03o\n", aPath, aMode);
++    // Assertion is too strong.
++    // We need to allow enough loop holes to hang oneself if the user wants.
++    // An xpcshell test, netwerk/test/unit/test_unix_domain.js, calls
++    // this function with various permissions to test the access to
++    // unix socket (under its names), etc.  The permissions include
++    // values with no X bit, too.
++    // NS_ASSERTION(aMode & 0100, "no x bit for directory creation");
++  }
++#endif
+   return mkdir(aPath, aMode);
+ }
+ 
+ nsresult nsLocalFile::CreateAndKeepOpen(uint32_t aType, int aFlags,
+                                         uint32_t aPermissions,
+                                         PRFileDesc** aResult) {
+   if (!FilePreferences::IsAllowedPath(mPath)) {
+     return NS_ERROR_FILE_ACCESS_DENIED;