DBG1(DBG_IMV, " '%s' (%d bytes) owner %d, group %d, type %d",
entry->filename,
entry->filesize,
- entry->owner_id,
- entry->group_id,
+ entry->owner,
+ entry->group,
entry->type);
DBG1(DBG_IMV, " created %T, modified %T, accessed %T",
- &entry->create_time, utc,
- &entry->last_modify_time, utc,
- &entry->last_access_time, utc);
+ &entry->created, utc,
+ &entry->modified, utc,
+ &entry->accessed, utc);
}
e->destroy(e);
break;
#include <crypto/hashers/hasher.h>
#include <bio/bio_writer.h>
#include <bio/bio_reader.h>
-/* for isdigit()*/
-#include <ctype.h>
#include <trousers/tss.h>
#include <trousers/trousers.h>
static bool file_metadata(char *pathname, pts_file_metadata_t **entry)
{
struct stat st;
- pts_file_metadata_t *tmp;
+ pts_file_metadata_t *this;
- tmp = malloc_thing(pts_file_metadata_t);
+ this = malloc_thing(pts_file_metadata_t);
if (stat(pathname, &st))
{
- DBG1(DBG_PTS, "Unable to obtain statistical information about %s",
- pathname);
+ DBG1(DBG_PTS, "Unable to obtain statistics about '%s'", pathname);
return FALSE;
}
- tmp->filename = strdup(pathname);
- tmp->meta_length = PTS_FILE_METADATA_SIZE + strlen(tmp->filename);
+ this->filename = strdup(pathname);
+ this->meta_length = PTS_FILE_METADATA_SIZE + strlen(this->filename);
if (S_ISREG(st.st_mode))
{
- tmp->type = PTS_FILE_REGULAR;
+ this->type = PTS_FILE_REGULAR;
}
else if (S_ISDIR(st.st_mode))
{
- tmp->type = PTS_FILE_DIRECTORY;
+ this->type = PTS_FILE_DIRECTORY;
}
else if (S_ISCHR(st.st_mode))
{
- tmp->type = PTS_FILE_CHAR_SPEC;
+ this->type = PTS_FILE_CHAR_SPEC;
}
else if (S_ISBLK(st.st_mode))
{
- tmp->type = PTS_FILE_BLOCK_SPEC;
+ this->type = PTS_FILE_BLOCK_SPEC;
}
else if (S_ISFIFO(st.st_mode))
{
- tmp->type = PTS_FILE_FIFO;
+ this->type = PTS_FILE_FIFO;
}
else if (S_ISLNK(st.st_mode))
{
- tmp->type = PTS_FILE_SYM_LINK;
+ this->type = PTS_FILE_SYM_LINK;
}
else if (S_ISSOCK(st.st_mode))
{
- tmp->type = PTS_FILE_SOCKET;
+ this->type = PTS_FILE_SOCKET;
}
else
{
- tmp->type = PTS_FILE_OTHER;
+ this->type = PTS_FILE_OTHER;
}
- tmp->filesize = (u_int64_t)st.st_size;
- tmp->create_time = st.st_ctime;
- tmp->last_modify_time = st.st_mtime;
- tmp->last_access_time = st.st_atime;
- tmp->owner_id = (u_int64_t)st.st_uid;
- tmp->group_id = (u_int64_t)st.st_gid;
-
- *entry = tmp;
+ this->filesize = st.st_size;
+ this->created = st.st_ctime;
+ this->modified = st.st_mtime;
+ this->accessed = st.st_atime;
+ this->owner = st.st_uid;
+ this->group = st.st_gid;
+ *entry = this;
return TRUE;
}
* Structure holding file metadata
*/
struct pts_file_metadata_t {
- u_int16_t meta_length;
- pts_file_type_t type;
- u_int64_t filesize;
- time_t create_time;
- time_t last_modify_time;
- time_t last_access_time;
- u_int64_t owner_id;
- u_int64_t group_id;
- char *filename;
+ u_int16_t meta_length;
+ pts_file_type_t type;
+ u_int64_t filesize;
+ time_t created;
+ time_t modified;
+ time_t accessed;
+ u_int64_t owner;
+ u_int64_t group;
+ char *filename;
};
/**
int (*get_file_count)(pts_file_meta_t *this);
/**
- * Add a PTS File Metadata
+ * Add PTS File Metadata
*
* @param filename Name of measured file or directory
* @param metadata File metadata
/* Write the 64 bit integer fields as two 32 bit parts */
writer->write_uint32(writer, entry->filesize >> 32);
writer->write_uint32(writer, entry->filesize & 0xffffffff);
- writer->write_uint32(writer, ((u_int64_t)entry->create_time) >> 32);
- writer->write_uint32(writer, ((u_int64_t)entry->create_time) & 0xffffffff);
- writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) >> 32);
- writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) & 0xffffffff);
- writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) >> 32);
- writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) & 0xffffffff);
- writer->write_uint32(writer, entry->owner_id >> 32);
- writer->write_uint32(writer, entry->owner_id & 0xffffffff);
- writer->write_uint32(writer, entry->group_id >> 32);
- writer->write_uint32(writer, entry->group_id & 0xffffffff);
+ writer->write_uint32(writer, ((u_int64_t)entry->created) >> 32);
+ writer->write_uint32(writer, ((u_int64_t)entry->created) & 0xffffffff);
+ writer->write_uint32(writer, ((u_int64_t)entry->modified) >> 32);
+ writer->write_uint32(writer, ((u_int64_t)entry->modified) & 0xffffffff);
+ writer->write_uint32(writer, ((u_int64_t)entry->accessed) >> 32);
+ writer->write_uint32(writer, ((u_int64_t)entry->accessed) & 0xffffffff);
+ writer->write_uint32(writer, entry->owner >> 32);
+ writer->write_uint32(writer, entry->owner & 0xffffffff);
+ writer->write_uint32(writer, entry->group >> 32);
+ writer->write_uint32(writer, entry->group & 0xffffffff);
writer->write_data (writer, chunk_create(entry->filename, strlen(entry->filename)));
}
entry->meta_length = PTS_FILE_METADATA_SIZE + strlen(entry->filename);
entry->type = type;
entry->filesize = filesize;
- entry->create_time = create_time_t;
- entry->last_modify_time = modify_time_t;
- entry->last_access_time = access_time_t;
- entry->owner_id = owner_id;
- entry->group_id = group_id;
+ entry->created = create_time_t;
+ entry->modified = modify_time_t;
+ entry->accessed = access_time_t;
+ entry->owner = owner_id;
+ entry->group = group_id;
this->metadata->add(this->metadata, entry);
}