Skip to content
Snippets Groups Projects
Commit 51564a01 authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

Merge branch 'develop' of github.com:sleuthkit/sleuthkit into 8440-new_table_load

parents e2bf518e 8ec89d77
Branches
No related tags found
No related merge requests found
...@@ -958,7 +958,8 @@ private void mergeOsAccounts(OsAccount sourceAccount, OsAccount destAccount, Cas ...@@ -958,7 +958,8 @@ private void mergeOsAccounts(OsAccount sourceAccount, OsAccount destAccount, Cas
s.executeUpdate(query); s.executeUpdate(query);
// TBD: We need to emit another event which tells CT that two accounts are being merged so it can updates other dedicated tables // register the merged accounts with the transaction to fire off an event
trans.registerMergedOsAccount(sourceAccount.getId(), destAccount.getId());
// Update the source account. Make a dummy signature to prevent problems with the unique constraint. // Update the source account. Make a dummy signature to prevent problems with the unique constraint.
String mergedSignature = makeMergedOsAccountSignature(); String mergedSignature = makeMergedOsAccountSignature();
......
...@@ -13757,6 +13757,7 @@ public static final class CaseDbTransaction { ...@@ -13757,6 +13757,7 @@ public static final class CaseDbTransaction {
private List<Host> hostsAdded = new ArrayList<>(); private List<Host> hostsAdded = new ArrayList<>();
private List<OsAccount> accountsChanged = new ArrayList<>(); private List<OsAccount> accountsChanged = new ArrayList<>();
private List<OsAccount> accountsAdded = new ArrayList<>(); private List<OsAccount> accountsAdded = new ArrayList<>();
private List<TskEvent.MergedAccountsPair> accountsMerged = new ArrayList<>();
   
private List<Long> deletedOsAccountObjectIds = new ArrayList<>(); private List<Long> deletedOsAccountObjectIds = new ArrayList<>();
private List<Long> deletedResultObjectIds = new ArrayList<>(); private List<Long> deletedResultObjectIds = new ArrayList<>();
...@@ -13844,6 +13845,16 @@ void registerAddedOsAccount(OsAccount account) { ...@@ -13844,6 +13845,16 @@ void registerAddedOsAccount(OsAccount account) {
} }
} }
   
/**
* Saves an account that has been merged as part of this transaction.
*
* @param sourceOsAccountObjId
* @param destinationOsAccountObjId
*/
void registerMergedOsAccount(long sourceOsAccountObjId, long destinationOsAccountObjId) {
accountsMerged.add(new TskEvent.MergedAccountsPair(sourceOsAccountObjId, destinationOsAccountObjId));
}
/** /**
* Saves an analysis result that has been deleted as a part of this * Saves an analysis result that has been deleted as a part of this
* transaction. * transaction.
...@@ -13920,6 +13931,9 @@ public void commit() throws TskCoreException { ...@@ -13920,6 +13931,9 @@ public void commit() throws TskCoreException {
if (!accountsChanged.isEmpty()) { if (!accountsChanged.isEmpty()) {
sleuthkitCase.fireTSKEvent(new TskEvent.OsAccountsUpdatedTskEvent(accountsChanged)); sleuthkitCase.fireTSKEvent(new TskEvent.OsAccountsUpdatedTskEvent(accountsChanged));
} }
if (!accountsMerged.isEmpty()) {
sleuthkitCase.fireTSKEvent(new TskEvent.OsAccountsMergedTskEvent(accountsMerged));
}
if (!deletedOsAccountObjectIds.isEmpty()) { if (!deletedOsAccountObjectIds.isEmpty()) {
sleuthkitCase.fireTSKEvent(new TskEvent.OsAccountsDeletedTskEvent(deletedOsAccountObjectIds)); sleuthkitCase.fireTSKEvent(new TskEvent.OsAccountsDeletedTskEvent(deletedOsAccountObjectIds));
} }
......
...@@ -307,6 +307,63 @@ public List<Long> getOsAccountObjectIds() { ...@@ -307,6 +307,63 @@ public List<Long> getOsAccountObjectIds() {
} }
/**
* An event published when one or more OS accounts are merged.
*/
public final static class OsAccountsMergedTskEvent extends TskObjectsEvent<MergedAccountsPair> {
/**
* Constructs an event published when one or more OS accounts are
* merged.
*
* @param mergedAccounts List of the merged OS accounts.
*/
OsAccountsMergedTskEvent(List<MergedAccountsPair> mergedAccounts) {
super(mergedAccounts);
}
/**
* Gets the pairs of merged accounts
*
* @return
*/
public List<MergedAccountsPair> getMergedAccountPairs() {
return getDataModelObjects();
}
}
/**
* Container to encapsulate the merged account ids, contains both the source and destination account ids.
*/
public final static class MergedAccountsPair {
private final Long sourceOsAccountId;
private final Long destinationOsAccountId;
public MergedAccountsPair(Long sourceOsAccountId, Long destinationOsAccountId) {
this.sourceOsAccountId = sourceOsAccountId;
this.destinationOsAccountId = destinationOsAccountId;
}
/**
* Gets the source os account id. This is the account that was marked as "MERGED"
* @return The TSK object ID of the source os account
*/
public Long getSourceOsAccountId() {
return sourceOsAccountId;
}
/**
* Gets the destination os account id. This is the account that the source was merged into.
* @return The TSK object ID of the destination os account
*/
public Long getDestinationOsAccountId() {
return destinationOsAccountId;
}
}
/** /**
* An event published when one or more OS account instances are added. * An event published when one or more OS account instances are added.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment