]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133562: Skip security descriptors on unsupported Windows API partitions (GH-133563)
authorMax Bachmann <max.bachmann@iracing.com>
Wed, 14 May 2025 11:34:41 +0000 (13:34 +0200)
committerGitHub <noreply@github.com>
Wed, 14 May 2025 11:34:41 +0000 (11:34 +0000)
Misc/NEWS.d/next/Windows/2025-05-07-09-02-19.gh-issue-133562.lqqNW1.rst [new file with mode: 0644]
Modules/posixmodule.c

diff --git a/Misc/NEWS.d/next/Windows/2025-05-07-09-02-19.gh-issue-133562.lqqNW1.rst b/Misc/NEWS.d/next/Windows/2025-05-07-09-02-19.gh-issue-133562.lqqNW1.rst
new file mode 100644 (file)
index 0000000..884425b
--- /dev/null
@@ -0,0 +1 @@
+Disable handling of security descriptors by :func:`os.mkdir` with mode ``0o700`` on WinAPI partitions that do not support it. This only affects custom builds for specialized targets.
index 9cc0533f0dcfd1329e490cd42184a05b4b78f59c..bb3bfe802b93e87f3ee00009d6092a4a9116e4c7 100644 (file)
@@ -5736,6 +5736,9 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
 
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
+    // For API sets that don't support these APIs, we have no choice
+    // but to silently create a directory with default ACL.
+#if defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
     if (mode == 0700 /* 0o700 */) {
         ULONG sdSize;
         pSecAttr = &secAttr;
@@ -5751,6 +5754,7 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
             error = GetLastError();
         }
     }
+#endif
     if (!error) {
         result = CreateDirectoryW(path->wide, pSecAttr);
         if (secAttr.lpSecurityDescriptor &&