diff --git a/bindings/java/jni/dataModel_SleuthkitJNI.cpp b/bindings/java/jni/dataModel_SleuthkitJNI.cpp index 76694d185a58d7e236981b371e8fe368a2881adc..18dd6b56e8368ecb0bbe449c53fc0663d48c6c18 100644 --- a/bindings/java/jni/dataModel_SleuthkitJNI.cpp +++ b/bindings/java/jni/dataModel_SleuthkitJNI.cpp @@ -1166,13 +1166,12 @@ Java_org_sleuthkit_datamodel_SleuthkitJNI_runAddImgNat(JNIEnv * env, env->ReleaseStringUTFChars(timeZone, time_zone); } - // Save the image handle to the TskAutoDb object + // Set up the TSK_IMG_INFO object TSK_IMG_INFO *img_info = castImgInfo(env, a_img_info); - tskAuto->openImageHandle(img_info); // Add the data source. uint8_t ret = 0; - if ((ret = tskAuto->startAddImage(device_id)) != 0) { + if ((ret = tskAuto->startAddImage(img_info, device_id)) != 0) { stringstream msgss; msgss << "Errors occured while ingesting image " << std::endl; vector<TskAuto::error_record> errors = tskAuto->getErrorList(); diff --git a/tsk/auto/auto_db.cpp b/tsk/auto/auto_db.cpp index 7d45c874d806a20fe7f557f972f396d650c33d6f..69dae039228ec3d3b935756f48e6ff94a11c8fc8 100644 --- a/tsk/auto/auto_db.cpp +++ b/tsk/auto/auto_db.cpp @@ -477,14 +477,15 @@ uint8_t * Start the process to add image/file metadata to database inside of a transaction. * User must call either commitAddImage() to commit the changes, * or revertAddImage() to revert them. -* This version of startAddImage assumes that m_img_info has already been set up. * +* @param img_info Previously initialized TSK_IMG_INFO object * @param deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID) * @return 0 for success, 1 for failure */ uint8_t -TskAutoDb::startAddImage(const char* deviceId) +TskAutoDb::startAddImage(TSK_IMG_INFO * img_info, const char* deviceId) { + openImageHandle(img_info); if (m_img_info == NULL) { return 1; diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h index 86e3cc91e69e6ab0cdb1c4f0d89422f7a28f9742..2a0f383d8829fa918a7b3d3418640dea8fccfb5d 100644 --- a/tsk/auto/tsk_case_db.h +++ b/tsk/auto/tsk_case_db.h @@ -101,8 +101,8 @@ class TskAutoDb:public TskAuto { */ uint8_t startAddImage(int numImg, const TSK_TCHAR * const imagePaths[], TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* deviceId = NULL); + uint8_t startAddImage(TSK_IMG_INFO * img_info, const char* deviceId = NULL); #ifdef WIN32 - uint8_t startAddImage(const char* deviceId = NULL); uint8_t startAddImage(int numImg, const char *const imagePaths[], TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* deviceId = NULL); #endif