From f749d54a087644cb5452e8b448330899bae1a4b5 Mon Sep 17 00:00:00 2001
From: Kelly Kelly <kelly@basistech.com>
Date: Wed, 7 Jul 2021 17:30:31 -0400
Subject: [PATCH] Fixed os account realm issues

---
 Core/src/org/sleuthkit/autopsy/datamodel/OsAccounts.java      | 2 +-
 .../org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/OsAccounts.java b/Core/src/org/sleuthkit/autopsy/datamodel/OsAccounts.java
index 75a6eb971b..9e1d7962d2 100755
--- a/Core/src/org/sleuthkit/autopsy/datamodel/OsAccounts.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/OsAccounts.java
@@ -207,7 +207,7 @@ public void propertyChange(PropertyChangeEvent evt) {
                                 Bundle.OsAccounts_accountRealmNameProperty_name(),
                                 Bundle.OsAccounts_accountRealmNameProperty_displayName(),
                                 Bundle.OsAccounts_accountRealmNameProperty_desc(),
-                                ""));
+                                realmNames.get(0)));
                     }
                 }
             }
diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
index 092cea047d..e3df208180 100644
--- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
+++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
@@ -1995,7 +1995,7 @@ private void createOrUpdateOsAccount(AbstractFile file, String sid, String userN
         } else {
             osAccount = optional.get();
             if (userName != null && !userName.isEmpty()) {
-                OsAccountUpdateResult updateResult= accountMgr.updateCoreWindowsOsAccountAttributes(osAccount, null, userName, null, host);
+                OsAccountUpdateResult updateResult= accountMgr.updateCoreWindowsOsAccountAttributes(osAccount, null, userName, domainName.isEmpty() ? null : domainName, host);
                 osAccount = updateResult.getUpdatedAccount().orElse(osAccount);
             }
         }
@@ -2187,7 +2187,7 @@ private void updateOsAccount(OsAccount osAccount, Map<String, String> userInfo,
         accountMgr.addExtendedOsAccountAttributes(osAccount, attributes);
          
         // update the loginname
-        accountMgr.updateCoreWindowsOsAccountAttributes(osAccount, null, loginName, null, host);
+        accountMgr.updateCoreWindowsOsAccountAttributes(osAccount, null, loginName, domainName.isEmpty() ? null : domainName, host);
         
         // update other standard attributes  -  fullname, creationdate
         accountMgr.updateStandardOsAccountAttributes(osAccount, fullName, null, null, creationTime);
-- 
GitLab