summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-12-02 18:29:18 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-12-02 18:29:18 (GMT)
commit52173d4959a1c1e961efab2522e4ba8a22a3c7c6 (patch)
treea89463de7c0db84aa60ef25bc05caf8837e2cc33 /Doc/library/os.rst
parent02524629f39bb70f4ea00ab8e64d694e08719227 (diff)
downloadcpython-52173d4959a1c1e961efab2522e4ba8a22a3c7c6.zip
cpython-52173d4959a1c1e961efab2522e4ba8a22a3c7c6.tar.gz
cpython-52173d4959a1c1e961efab2522e4ba8a22a3c7c6.tar.bz2
Fix #9333. Expose os.symlink on Windows only when usable.
In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege is an account privilege that is required to be held by the user. Not only must the privilege be enabled for the account, the activated privileges for the currently running application must be adjusted to enable the requested privilege. Rather than exposing an additional function to be called prior to the user's first os.symlink call, we handle the AdjustTokenPrivileges Windows API call internally and only expose os.symlink when the privilege escalation was successful. Due to the change of only exposing os.symlink when it's available, we can go back to the original test skipping methods of checking via `hasattr`.
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst10
1 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 46a6f6e..d8b87fd 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1392,7 +1392,15 @@ Files and Directories
Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink`
will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0.
- The *SeCreateSymbolicLinkPrivilege* is required in order to create symlinks.
+
+ .. note::
+
+ The *SeCreateSymbolicLinkPrivilege* is required in order to create
+ symlinks, so the function is only available when the privilege is held.
+ This privilege is not typically granted to regular users but is available
+ to accounts which can escalate privileges to the administrator level.
+ Either obtaining the privilege or running your application as an
+ administrator are ways to successfully create symlinks.
Availability: Unix, Windows.