Merge pull request #1190 from karlmortensen/JNI_comms

JNI comms up and going
This commit is contained in:
Richard Cordovano 2015-04-13 17:56:06 -04:00
commit 40d2ff0070
13 changed files with 181 additions and 25 deletions

View File

@ -185,6 +185,7 @@ MissingImageDialog.confDlg.noFileSel.msg=No image file has been selected, are yo
MissingImageDialog.confDlg.noFileSel.title=Missing Image
NewCaseVisualPanel1.getName.text=Case Info
NewCaseVisualPanel1.caseDirBrowse.selectButton.text=Select
NewCaseVisualPanel1.badCredentials.text=Bad multi-user settings. See Tools, Options, Multi-user.
NewCaseVisualPanel2.getName.text=Additional Information
NewCaseWizardAction.closeCurCase.confMsg.msg=Do you want to save and close this case and proceed with the new case creation?
NewCaseWizardAction.closeCurCase.confMsg.title=Warning\: Closing the Current Case
@ -223,3 +224,4 @@ XMLCaseManagement.open.msgDlg.notAutCase.title=Error
AddImageWizardIngestConfigPanel.CANCEL_BUTTON.text=Cancel
NewCaseVisualPanel1.rbSingleUserCase.text=Single-user
NewCaseVisualPanel1.rbMultiUserCase.text=Multi-user
NewCaseVisualPanel1.lbBadMultiUserSettings.text=

View File

@ -355,7 +355,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
db = SleuthkitCase.newCase(dbName);
}
else if (caseType == CaseType.MULTI_USER_CASE) {
db = SleuthkitCase.newCase(dbName, UserPreferences.getDatabaseConnectionInfo());
db = SleuthkitCase.newCase(dbName, UserPreferences.getDatabaseConnectionInfo(), caseDir);
}
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error creating a case: " + caseName + " in dir " + caseDir, ex); //NON-NLS
@ -407,7 +407,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
JOptionPane.INFORMATION_MESSAGE);
}
} else {
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo());
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo(), caseDir);
if (null != db.getBackupDatabasePath()) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
@ -433,7 +433,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.open.exception.checkFile.msg", CASE_DOT_EXTENSION), ex);
} else {
throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.gen.msg"), ex);
throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.gen.msg")+". "+ex.getMessage(), ex);
}
}
}

View File

@ -26,6 +26,13 @@
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="rbSingleUserCase" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="rbMultiUserCase" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lbBadMultiUserSettings" max="32767" attributes="0"/>
</Group>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="caseDirLabel" min="-2" max="-2" attributes="0"/>
@ -42,11 +49,6 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="caseDirBrowseButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="rbSingleUserCase" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="rbMultiUserCase" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@ -76,6 +78,7 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="rbSingleUserCase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="rbMultiUserCase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbBadMultiUserSettings" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="16" max="32767" attributes="0"/>
</Group>
@ -166,5 +169,18 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbBadMultiUserSettings">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel1.lbBadMultiUserSettings.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -30,6 +30,7 @@ import javax.swing.event.DocumentListener;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.TskData.DbType;
/**
* The wizard panel for the new case creation.
@ -43,11 +44,12 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
NewCaseVisualPanel1(NewCaseWizardPanel1 wizPanel) {
initComponents();
lbBadMultiUserSettings.setText("");
this.wizPanel = wizPanel;
caseNameTextField.getDocument().addDocumentListener(this);
caseParentDirTextField.getDocument().addDocumentListener(this);
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
if (info.getDbType() == CaseDbConnectionInfo.DbType.UNKNOWN) {
if (info.getDbType() == DbType.UNKNOWN) {
rbSingleUserCase.setSelected(true);
rbSingleUserCase.setEnabled(false);
rbSingleUserCase.setVisible(false);
@ -67,6 +69,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
rbMultiUserCase.setSelected(true);
}
} else {
lbBadMultiUserSettings.setText(NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel1.badCredentials.text"));
rbSingleUserCase.setSelected(true);
rbSingleUserCase.setEnabled(false);
rbMultiUserCase.setEnabled(false);
@ -147,6 +150,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
caseDirTextField = new javax.swing.JTextField();
rbSingleUserCase = new javax.swing.JRadioButton();
rbMultiUserCase = new javax.swing.JRadioButton();
lbBadMultiUserSettings = new javax.swing.JLabel();
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(NewCaseVisualPanel1.class, "NewCaseVisualPanel1.jLabel1.text_1")); // NOI18N
@ -177,6 +181,10 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
caseTypeButtonGroup.add(rbMultiUserCase);
org.openide.awt.Mnemonics.setLocalizedText(rbMultiUserCase, org.openide.util.NbBundle.getMessage(NewCaseVisualPanel1.class, "NewCaseVisualPanel1.rbMultiUserCase.text")); // NOI18N
lbBadMultiUserSettings.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lbBadMultiUserSettings.setForeground(new java.awt.Color(255, 0, 0));
org.openide.awt.Mnemonics.setLocalizedText(lbBadMultiUserSettings, org.openide.util.NbBundle.getMessage(NewCaseVisualPanel1.class, "NewCaseVisualPanel1.lbBadMultiUserSettings.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -187,6 +195,12 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(rbSingleUserCase)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rbMultiUserCase)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lbBadMultiUserSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(caseDirLabel)
@ -198,11 +212,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
.addComponent(caseNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(caseDirTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(caseDirBrowseButton))
.addGroup(layout.createSequentialGroup()
.addComponent(rbSingleUserCase)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rbMultiUserCase)))
.addComponent(caseDirBrowseButton)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
@ -226,7 +236,8 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rbSingleUserCase)
.addComponent(rbMultiUserCase))
.addComponent(rbMultiUserCase)
.addComponent(lbBadMultiUserSettings))
.addContainerGap(16, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -266,6 +277,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
private javax.swing.ButtonGroup caseTypeButtonGroup;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel lbBadMultiUserSettings;
private javax.swing.JRadioButton rbMultiUserCase;
private javax.swing.JRadioButton rbSingleUserCase;
// End of variables declaration//GEN-END:variables

View File

@ -218,6 +218,13 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
Case.open(casePath); // open the case
}
} catch (CaseActionException ex) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.msg", caseName,
ex.getMessage()),
NbBundle.getMessage(this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.title"),
JOptionPane.ERROR_MESSAGE);
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
}
}

View File

@ -79,6 +79,10 @@ class RecentItems implements ActionListener {
try {
Case.open(casePath); // open the case
} catch (CaseActionException ex) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.msg", casePath,
ex.getMessage()), NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"),
JOptionPane.ERROR_MESSAGE);
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS
}
}

View File

@ -65,9 +65,9 @@ public class Installer extends ModuleInstall {
//We should update this if we officially switch to a new version of CRT/compiler
System.loadLibrary("msvcr100"); //NON-NLS
System.loadLibrary("msvcp100"); //NON-NLS
logger.log(Level.INFO, "MS CRT libraries loaded"); //NON-NLS
logger.log(Level.INFO, "MSVCR100 and MSVCP100 libraries loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ms crt libraries, ", e); //NON-NLS
logger.log(Level.SEVERE, "Error loading MSVCR100 and MSVCP100 libraries, ", e); //NON-NLS
}
try {
@ -83,7 +83,35 @@ public class Installer extends ModuleInstall {
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading EWF library, ", e); //NON-NLS
}
}
try {
System.loadLibrary("libeay32"); //NON-NLS
logger.log(Level.INFO, "LIBEAY32 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading LIBEAY32 library, ", e); //NON-NLS
}
try {
System.loadLibrary("ssleay32"); //NON-NLS
logger.log(Level.INFO, "SSLEAY32 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading SSLEAY32 library, ", e); //NON-NLS
}
try {
System.loadLibrary("libintl-8"); //NON-NLS
logger.log(Level.INFO, "libintl-8 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading libintl-8 library, ", e); //NON-NLS
}
try {
System.loadLibrary("libpq"); //NON-NLS
logger.log(Level.INFO, "LIBPQ library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading LIBPQ library, ", e); //NON-NLS
}
}
}
public Installer() {

View File

@ -22,7 +22,8 @@ import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
import org.openide.util.NbPreferences;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.CaseDbConnectionInfo.DbType;
import org.sleuthkit.datamodel.TskData.DbType;
/**
* Provides convenient access to a Preferences node for user preferences with

View File

@ -9,7 +9,7 @@ import java.awt.Color;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.CaseDbConnectionInfo.DbType;
import org.sleuthkit.datamodel.TskData.DbType;
import org.sleuthkit.autopsy.core.UserPreferences;
public class MultiUserSettingsPanel extends javax.swing.JPanel {

View File

@ -151,7 +151,7 @@ public class FileTypeNode extends DisplayableItemNode {
if (UserPreferences.hideKnownFilesInViewsTree()) {
query.append(" AND (known IS NULL OR known != ").append(TskData.FileKnown.KNOWN.getFileKnownValue()).append(")"); //NON-NLS
}
query.append(" AND (0"); //NON-NLS
query.append(" AND (NULL"); //NON-NLS
for (String s : filter.getFilter()) {
query.append(" OR name LIKE '%").append(s).append("'"); //NON-NLS
}

View File

@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.datamodel;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
@ -87,6 +86,7 @@ import org.sleuthkit.datamodel.TskCoreException;
try (CaseDbQuery dbQuery = skCase.executeQuery(query)) {
ResultSet resultSet = dbQuery.getResultSet();
resultSet.next();
result = resultSet.getLong(1);
} catch (TskCoreException | SQLException ex) {
logger.log(Level.WARNING, "Couldn't get recent files results: ", ex); //NON-NLS

View File

@ -8,7 +8,7 @@
<property name="i586" location="${basedir}/Core/release/modules/lib/i586" />
<property name="i686" location="${basedir}/Core/release/modules/lib/i686"/>
<property name="crt" location="${basedir}/thirdparty/crt" />
<import file="build-windows-installer.xml" />
<target name="makeBaseLibDirs" description="Set up folder hierarchy under release/modules/lib">
@ -29,8 +29,10 @@
<property name="win64.TskLib.path" value="${env.TSK_HOME}/win32/x64/Release"/>
<property name="win32.TskLib.path" value="${env.TSK_HOME}/win32/Release" />
<property name="win64.TskLib.path_postgres" value="${env.TSK_HOME}/win32/x64/Release_PostgreSql"/>
<available property="win64.TskLib.exists" type="dir" file="${win64.TskLib.path}" />
<available property="win32.TskLib.exists" type="dir" file="${win32.TskLib.path}" />
<available property="win64.TskLib_postgres.exists" type="dir" file="${win64.TskLib.path_postgres}" />
</target>
<!-- The following copy the libtsk_jni dependencies to the Autopsy
@ -41,6 +43,8 @@
<fileset dir="${win64.TskLib.path}" id="win64dlls">
<include name="libewf.dll" />
<include name="zlib.dll"/>
<include name="libpq.dll"/>
<include name="libintl-8.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
@ -53,6 +57,29 @@
</target>
<!-- The following copy the libtsk_jni dependencies to the Autopsy
folder structure. libtsk_jni is inside of the JAR file and contains
libtsk and the JNI code. -->
<!-- copy 64-bit dlls into the installer folder for Postgres build-->
<target name="copyWinTskLibs64_postgres_ToBaseDir" if="win64.TskLib_postgres.exists">
<fileset dir="${win64.TskLib.path_postgres}" id="win64_postgres_dlls">
<include name="libewf.dll" />
<include name="zlib.dll"/>
<include name="libpq.dll"/>
<include name="libintl-8.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
<fileset refid="win64_postgres_dlls" />
</copy>
<copy todir="${x86_64}" overwrite="true">
<fileset refid="win64_postgres_dlls" />
</copy>
</target>
<!-- copy 32-bit dlls into the installer folder -->
<target name="copyWinTskLibs32ToBaseDir" if="win32.TskLib.exists">
<fileset dir="${win32.TskLib.path}" id="win32dlls">
@ -84,7 +111,13 @@
<antcall target="copyWinTskLibs64ToBaseDir" inheritRefs="true" />
</target>
<!-- This gets called from the main build.xml -->
<target name="copyLibsToBaseDir_postgres" depends="checkTskLibDirs" description="Copy windows dlls to the correct location." >
<antcall target="makeBaseLibDirs" inheritRefs="true" />
<antcall target="copyWinTskLibs64_postgres_ToBaseDir" inheritRefs="true" />
</target>
<!-- CRT LIBS TO ZIP - gets called from build.xml -->
<target name="copyLibsToZip" depends="copyCRT32ToZIP,copyCRT64ToZIP"/>

View File

@ -54,7 +54,7 @@
<!-- This target will create a custom ZIP file for us. It first uses the general
ZIP target and then opens it up and adds in any files that we want. This is where we customize the
version number. -->
<target name="build-zip" depends="suite.build-zip"> <!--,findJRE" -->
<target name="build-zip" depends="doxygen, suite.build-zip"> <!--,findJRE" -->
<property name="release.dir" value="${nbdist.dir}/${app.name}"/>
@ -102,6 +102,10 @@
<include name="libtsk_jni.dll" />
<include name="libewf.dll" />
<include name="zlib.dll" />
<include name="libintl-8.dll"/>
<include name="ssleay32.dll"/>
<include name="libeay32.dll"/>
<include name="libpq.dll"/>
</fileset>
</delete>
@ -161,8 +165,30 @@
</condition>
</target>
<target name="-init_postgres" depends="-taskdefs,-convert-old-project,getProps,getJunit,copyLibsToBaseDir_postgres">
<convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id"/>
<sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
<property name="cluster" location="build/cluster"/>
<echo level="verbose">Suite in ${basedir} with clusters ${cluster.path.final}, build cluster ${cluster}, and sorted modules ${modules.sorted}</echo>
<!-- synchronize with SuiteProject -->
<property name="disabled.modules" value=""/>
<property name="enabled.clusters" value=""/>
<property name="disabled.clusters" value=""/>
<property name="branding.dir" location="branding"/>
<property name="dist.dir" location="dist"/>
<condition property="run.branding"> <!-- #84689 -->
<and>
<available file="${branding.dir}" type="dir"/>
<isset property="branding.token"/>
</and>
</condition>
</target>
<!-- override build to add branding -->
<target name="build" depends="build-brand,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" />
<target name="build_postgres" depends="build-brand_postgres,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" />
<target name="build-brand" depends="-init">
@ -189,6 +215,33 @@
<entry key="build.type" value="${build.type}" />
</propertyfile>
</target>
<target name="build-brand_postgres" depends="-init_postgres">
<echo>${app.name} branding</echo>
<propertyfile
file="${branding.dir}/core/core.jar/org/netbeans/core/startup/Bundle.properties"
comment="Updated by build script">
<entry key="currentVersion" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${branding.dir}/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties"
comment="Updated by build script">
<entry key="CTL_MainWindow_Title" value="${app.title} ${app.version}" />
<entry key="CTL_MainWindow_Title_No_Project" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${basedir}/Core/src/org/sleuthkit/autopsy/coreutils/Version.properties"
comment="Updated by build script">
<entry key="app.name" value="${app.title}" />
<entry key="app.version" value="${app.version}" />
<entry key="build.type" value="${build.type}" />
</propertyfile>
</target>
<!-- This seems really bad to be hard coded, but I couldn't find a better solution -->