Skip to content
Snippets Groups Projects
Commit afed1bb5 authored by Brian Carrier's avatar Brian Carrier
Browse files

added more tags to data strutures

parent da9101dd
No related branches found
No related tags found
No related merge requests found
-kr -psl -nce -ip2 -nlp -nut
......@@ -6,7 +6,7 @@ libtsk3jni_la_SOURCES = dataModel_SleuthkitJNI.cpp dataModel_SleuthkitJNI.h \
tskAutoDbJNI.cpp tskAutoDbJNI.h
indent:
indent *.c *.h
indent *.cpp *.h
clean-local:
-rm -f *.c~ *.h~
This diff is collapsed.
......@@ -54,7 +54,8 @@ tsk_fs_open_vol(const TSK_VS_PART_INFO * a_part_info,
tsk_error_set_errstr("tsk_fs_open_vol: Null vpart handle");
return NULL;
}
else if (a_part_info->vs == NULL) {
else if ((a_part_info->vs == NULL)
|| (a_part_info->vs->tag != TSK_VS_INFO_TAG)) {
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_FS_ARG);
tsk_error_set_errstr("tsk_fs_open_vol: Null vs handle");
......
......@@ -200,6 +200,7 @@ bsd_load_table(TSK_VS_INFO * a_vs)
static void
bsd_close(TSK_VS_INFO * a_vs)
{
a_vs->tag = 0;
tsk_vs_part_free(a_vs);
free(a_vs);
}
......@@ -224,6 +225,7 @@ tsk_vs_bsd_open(TSK_IMG_INFO * img_info, TSK_DADDR_T offset)
vs->img_info = img_info;
vs->vstype = TSK_VS_TYPE_BSD;
vs->tag = TSK_VS_INFO_TAG;
/* use the offset provided */
vs->offset = offset;
......
......@@ -1019,6 +1019,7 @@ dos_load_prim_table(TSK_VS_INFO * vs, uint8_t test)
static void
dos_close(TSK_VS_INFO * vs)
{
vs->tag = 0;
tsk_vs_part_free(vs);
free(vs);
}
......@@ -1047,6 +1048,7 @@ tsk_vs_dos_open(TSK_IMG_INFO * img_info, TSK_DADDR_T offset, uint8_t test)
return NULL;
vs->vstype = TSK_VS_TYPE_DOS;
vs->tag = TSK_VS_INFO_TAG;
vs->img_info = img_info;
vs->offset = offset;
......
......@@ -267,6 +267,7 @@ gpt_load_table(TSK_VS_INFO * vs)
static void
gpt_close(TSK_VS_INFO * vs)
{
vs->tag = 0;
tsk_vs_part_free(vs);
free(vs);
}
......@@ -285,6 +286,7 @@ tsk_vs_gpt_open(TSK_IMG_INFO * img_info, TSK_DADDR_T offset)
vs->img_info = img_info;
vs->vstype = TSK_VS_TYPE_GPT;
vs->tag = TSK_VS_INFO_TAG;
/* If an offset was given, then use that too */
vs->offset = offset;
......
......@@ -163,6 +163,7 @@ mac_load_table(TSK_VS_INFO * vs)
static void
mac_close(TSK_VS_INFO * vs)
{
vs->tag = 0;
tsk_vs_part_free(vs);
free(vs);
}
......@@ -185,6 +186,7 @@ tsk_vs_mac_open(TSK_IMG_INFO * img_info, TSK_DADDR_T offset)
vs->img_info = img_info;
vs->vstype = TSK_VS_TYPE_MAC;
vs->tag = TSK_VS_INFO_TAG;
/* If an offset was given, then use that too */
vs->offset = offset;
......
......@@ -50,6 +50,7 @@ tsk_vs_part_add(TSK_VS_INFO * a_vs, TSK_DADDR_T a_start, TSK_DADDR_T len,
part->flags = type;
part->vs = a_vs;
part->addr = 0;
part->tag = TSK_VS_PART_INFO_TAG;
/* is this the first entry in the list */
if (a_vs->part_list == NULL) {
......@@ -180,7 +181,7 @@ tsk_vs_part_free(TSK_VS_INFO * a_vs)
while (part) {
if (part->desc)
free(part->desc);
part->tag = 0;
part2 = part->next;
free(part);
part = part2;
......@@ -203,10 +204,11 @@ tsk_vs_part_get(const TSK_VS_INFO * a_vs, TSK_PNUM_T a_idx)
{
TSK_VS_PART_INFO *part;
if (a_vs == NULL) {
if ((a_vs == NULL) || (a_vs->tag != TSK_VS_INFO_TAG)) {
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_VS_ARG);
tsk_error_set_errstr("tsk_vs_part_get: pointer is NULL");
tsk_error_set_errstr
("tsk_vs_part_get: pointer is NULL or has unallocated structures");
return NULL;
}
......
......@@ -323,6 +323,7 @@ sun_load_table(TSK_VS_INFO * vs)
static void
sun_close(TSK_VS_INFO * vs)
{
vs->tag = 0;
tsk_vs_part_free(vs);
free(vs);
}
......@@ -341,6 +342,7 @@ tsk_vs_sun_open(TSK_IMG_INFO * img_info, TSK_DADDR_T offset)
vs->img_info = img_info;
vs->vstype = TSK_VS_TYPE_SUN;
vs->tag = TSK_VS_INFO_TAG;
vs->offset = offset;
......
......@@ -62,6 +62,7 @@ extern "C" {
* for open volume systems.
*/
struct TSK_VS_INFO {
int tag; ///< \internal Will be set to TSK_VS_INFO_TAG if structure is still allocated, 0 if not
TSK_IMG_INFO *img_info; ///< Pointer to disk image that VS is in
TSK_VS_TYPE_ENUM vstype; ///< Type of volume system / media management
TSK_DADDR_T offset; ///< Byte offset where VS starts in disk image
......@@ -76,7 +77,7 @@ extern "C" {
void (*close) (TSK_VS_INFO *); ///< \internal Progs should call tsk_vs_close().
};
#define TSK_VS_INFO_TAG 0x52301642
/***************************************************************
......@@ -98,6 +99,7 @@ extern "C" {
* Linked list entry that describes a volume in a generic way.
*/
struct TSK_VS_PART_INFO {
int tag;
TSK_VS_PART_INFO *prev; ///< Pointer to previous partition (or NULL)
TSK_VS_PART_INFO *next; ///< Pointer to next partition (or NULL)
TSK_VS_INFO *vs; ///< Pointer to parent volume system handle
......@@ -111,6 +113,7 @@ extern "C" {
TSK_VS_PART_FLAG_ENUM flags; ///< Flags for partition
};
#define TSK_VS_PART_INFO_TAG 0x90121253
// to and from type ids and names
extern TSK_VS_TYPE_ENUM tsk_vs_type_toid(const TSK_TCHAR *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment