Merge pull request #13989 from thematthopkins/virtualbox_shared_folder_win2k3

Expands fix for skipping loading security descriptors on filesystems where they aren't present to work on win2k8+ and Directories
This commit is contained in:
Thomas S Hatch 2014-07-07 14:56:26 -06:00
commit 5fdd29163e

View File

@ -343,7 +343,13 @@ def get_pgid(path, follow_symlinks=True):
# can't load a file descriptor for the file, we default
# to "Everyone" - http://support.microsoft.com/kb/243330
except MemoryError:
# generic memory error (win2k3+)
return 'S-1-1-0'
except pywinerror as exc:
# Incorrect function error (win2k8+)
if exc.winerror == 1:
return 'S-1-1-0'
raise
group_sid = secdesc.GetSecurityDescriptorGroup()
return win32security.ConvertSidToStringSid(group_sid)
@ -533,7 +539,13 @@ def get_uid(path, follow_symlinks=True):
path, win32security.OWNER_SECURITY_INFORMATION
)
except MemoryError:
# generic memory error (win2k3+)
return 'S-1-1-0'
except pywinerror as exc:
# Incorrect function error (win2k8+)
if exc.winerror == 1:
return 'S-1-1-0'
raise
owner_sid = secdesc.GetSecurityDescriptorOwner()
return win32security.ConvertSidToStringSid(owner_sid)