Skip to content

Commit 5f7d3e4

Browse files
author
John Dumais
committed
If a file has no dacl entries, as may happen on a network-mounted file system, there wont be a principal entry. A principal is a combination of security provider, like NT AUTHORITY, and user name, e.g. NT AUTHORITY\Gracie. This code is looking for the user name -- the second half of the principal. With no principal, there is no second half of the principal.
1 parent 0e43396 commit 5f7d3e4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ds3-metadata/src/main/java/com/spectralogic/ds3client/metadata/WindowsMetadataStore.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,14 @@ private void saveWindowsfilePermissions(final Path file) throws IOException {
168168
final StringBuilder userDisplayList = new StringBuilder();
169169
final Map<String, Set<Integer>> stringSetMap = new HashMap<>();
170170
for (final AclEntry aclEntry : aclEntries) {
171-
userDisplay = aclEntry.principal().getName().split("\\\\")[1];
171+
final String[] principalFields = aclEntry.principal().getName().split("\\\\");
172+
173+
if (principalFields.length < 2) {
174+
continue;
175+
}
176+
177+
userDisplay = principalFields[1];
178+
172179
Set<Integer> newSet = stringSetMap.get(userDisplay);
173180
aclEntryPermissions = aclEntry.permissions();
174181
if (newSet == null) {

0 commit comments

Comments
 (0)