From 0cfd91195bcfc4e12f43cf0966660867679d04c1 Mon Sep 17 00:00:00 2001
From: Oliver Spohngellert <oliver@basistech.net>
Date: Wed, 10 Feb 2016 12:51:04 -0500
Subject: [PATCH] Made device id fixes

---
 tsk/auto/db_postgresql.cpp   | 6 +++---
 tsk/auto/tsk_case_db.h       | 8 ++++----
 tsk/auto/tsk_db.h            | 2 +-
 tsk/auto/tsk_db_postgresql.h | 2 +-
 tsk/auto/tsk_db_sqlite.h     | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tsk/auto/db_postgresql.cpp b/tsk/auto/db_postgresql.cpp
index 847ef94c8..144209738 100755
--- a/tsk/auto/db_postgresql.cpp
+++ b/tsk/auto/db_postgresql.cpp
@@ -720,7 +720,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
     }
     objId = atoll(PQgetvalue(res, 0, 0));
 
-    // Add the data source to the tsk_image_info table.
+    // Add the device to the tsk_image_info table.
     char timeZone_local[MAX_DB_STRING_LENGTH];
     removeNonUtf8(timeZone_local, MAX_DB_STRING_LENGTH - 1, timezone.c_str());
     char md5_local[MAX_DB_STRING_LENGTH];
@@ -742,7 +742,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
         return ret;
     }
 
-    // Add the data source to the data_source_info table.
+    // Add the device to the data_source_info table.
     char *deviceId_sql = PQescapeLiteral(conn, deviceId.c_str(), strlen(deviceId.c_str()));
     if (!isEscapedStringValid(deviceId_sql, deviceId.c_str(), "TskDbPostgreSQL::addImageInfo: Unable to escape data source string: %s (Error: %s)\n")) {
         PQfreemem(deviceId_sql);
@@ -756,7 +756,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
     }
     snprintf(stmt, 2048, "INSERT INTO data_source_info (obj_id, device_id, time_zone) VALUES (%lld, %s, %s);",
         objId, deviceId_sql, timeZone_sql);
-    ret = attempt_exec(stmt, "Error adding data source id to data_source_info table: %s\n");
+    ret = attempt_exec(stmt, "Error adding device id to data_source_info table: %s\n");
     PQfreemem(deviceId_sql);
     PQfreemem(timeZone_sql);
     return ret;
diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h
index 90655d10f..5dd76bdcf 100644
--- a/tsk/auto/tsk_case_db.h
+++ b/tsk/auto/tsk_case_db.h
@@ -36,9 +36,9 @@ class TskAutoDb:public TskAuto {
     TskAutoDb(TskDb * a_db, TSK_HDB_INFO * a_NSRLDb, TSK_HDB_INFO * a_knownBadDb);
     virtual ~ TskAutoDb();
     virtual uint8_t openImage(int, const TSK_TCHAR * const images[],
-        TSK_IMG_TYPE_ENUM, unsigned int a_ssize, const char* dataSourceId = NULL);
+        TSK_IMG_TYPE_ENUM, unsigned int a_ssize, const char* deviceId = NULL);
     virtual uint8_t openImageUtf8(int, const char *const images[],
-        TSK_IMG_TYPE_ENUM, unsigned int a_ssize, const char* dataSourceId = NULL);
+        TSK_IMG_TYPE_ENUM, unsigned int a_ssize, const char* deviceId = NULL);
     virtual void closeImage();
     virtual void setTz(string tzone);
 
@@ -93,10 +93,10 @@ class TskAutoDb:public TskAuto {
      * 
      */
     uint8_t startAddImage(int numImg, const TSK_TCHAR * const imagePaths[],
-        TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* dataSourceId = NULL);
+        TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* deviceId = NULL);
 #ifdef WIN32
     uint8_t startAddImage(int numImg, const char *const imagePaths[],
-        TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* dataSourceId = NULL);
+        TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* deviceId = NULL);
 #endif
     void stopAddImage();
     int revertAddImage();
diff --git a/tsk/auto/tsk_db.h b/tsk/auto/tsk_db.h
index 4c1e0575f..698d131c0 100755
--- a/tsk/auto/tsk_db.h
+++ b/tsk/auto/tsk_db.h
@@ -162,7 +162,7 @@ class TskDb {
     virtual TSK_RETVAL_ENUM setConnectionInfo(CaseDbConnectionInfo * info);
     virtual int addImageInfo(int type, int size, int64_t & objId, const string & timezone) = 0;
     virtual int addImageInfo(int type, int size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5) = 0;
-    virtual int addImageInfo(int type, TSK_OFF_T size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5, const string& dataSourceId) = 0;
+    virtual int addImageInfo(int type, TSK_OFF_T size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5, const string& deviceId) = 0;
     virtual int addImageName(int64_t objId, char const *imgName, int sequence) = 0;
     virtual int addVsInfo(const TSK_VS_INFO * vs_info, int64_t parObjId, int64_t & objId) = 0;
     virtual int addVolumeInfo(const TSK_VS_PART_INFO * vs_part, int64_t parObjId, int64_t & objId) = 0;
diff --git a/tsk/auto/tsk_db_postgresql.h b/tsk/auto/tsk_db_postgresql.h
index 2905cf565..e558b2478 100755
--- a/tsk/auto/tsk_db_postgresql.h
+++ b/tsk/auto/tsk_db_postgresql.h
@@ -48,7 +48,7 @@ class TskDbPostgreSQL : public TskDb {
 
     int addImageInfo(int type, int size, int64_t & objId, const string & timezone);
     int addImageInfo(int type, int size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5);
-    int addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& dataSourceId);
+    int addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& deviceId);
     int addImageName(int64_t objId, char const *imgName, int sequence);
     int addVsInfo(const TSK_VS_INFO * vs_info, int64_t parObjId,
         int64_t & objId);
diff --git a/tsk/auto/tsk_db_sqlite.h b/tsk/auto/tsk_db_sqlite.h
index d47284567..d72ba898d 100755
--- a/tsk/auto/tsk_db_sqlite.h
+++ b/tsk/auto/tsk_db_sqlite.h
@@ -40,7 +40,7 @@ class TskDbSqlite : public TskDb {
     int close();
     int addImageInfo(int type, int size, int64_t & objId, const string & timezone);
     int addImageInfo(int type, int size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5);
-    int addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& dataSourceId);
+    int addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& deviceId);
     int addImageName(int64_t objId, char const *imgName, int sequence);
     int addVsInfo(const TSK_VS_INFO * vs_info, int64_t parObjId,
         int64_t & objId);
-- 
GitLab