shortened fieldnames of pts_file_metadata_t struct

This commit is contained in:
Andreas Steffen
2011-11-28 14:39:52 +01:00
parent bd96953568
commit 8ddf76dd13
4 changed files with 50 additions and 54 deletions
@@ -420,13 +420,13 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
DBG1(DBG_IMV, " '%s' (%d bytes) owner %d, group %d, type %d", DBG1(DBG_IMV, " '%s' (%d bytes) owner %d, group %d, type %d",
entry->filename, entry->filename,
entry->filesize, entry->filesize,
entry->owner_id, entry->owner,
entry->group_id, entry->group,
entry->type); entry->type);
DBG1(DBG_IMV, " created %T, modified %T, accessed %T", DBG1(DBG_IMV, " created %T, modified %T, accessed %T",
&entry->create_time, utc, &entry->created, utc,
&entry->last_modify_time, utc, &entry->modified, utc,
&entry->last_access_time, utc); &entry->accessed, utc);
} }
e->destroy(e); e->destroy(e);
break; break;
+20 -24
View File
@@ -19,8 +19,6 @@
#include <crypto/hashers/hasher.h> #include <crypto/hashers/hasher.h>
#include <bio/bio_writer.h> #include <bio/bio_writer.h>
#include <bio/bio_reader.h> #include <bio/bio_reader.h>
/* for isdigit()*/
#include <ctype.h>
#include <trousers/tss.h> #include <trousers/tss.h>
#include <trousers/trousers.h> #include <trousers/trousers.h>
@@ -589,62 +587,60 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
static bool file_metadata(char *pathname, pts_file_metadata_t **entry) static bool file_metadata(char *pathname, pts_file_metadata_t **entry)
{ {
struct stat st; 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)) if (stat(pathname, &st))
{ {
DBG1(DBG_PTS, "Unable to obtain statistical information about %s", DBG1(DBG_PTS, "Unable to obtain statistics about '%s'", pathname);
pathname);
return FALSE; return FALSE;
} }
tmp->filename = strdup(pathname); this->filename = strdup(pathname);
tmp->meta_length = PTS_FILE_METADATA_SIZE + strlen(tmp->filename); this->meta_length = PTS_FILE_METADATA_SIZE + strlen(this->filename);
if (S_ISREG(st.st_mode)) if (S_ISREG(st.st_mode))
{ {
tmp->type = PTS_FILE_REGULAR; this->type = PTS_FILE_REGULAR;
} }
else if (S_ISDIR(st.st_mode)) else if (S_ISDIR(st.st_mode))
{ {
tmp->type = PTS_FILE_DIRECTORY; this->type = PTS_FILE_DIRECTORY;
} }
else if (S_ISCHR(st.st_mode)) 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)) 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)) else if (S_ISFIFO(st.st_mode))
{ {
tmp->type = PTS_FILE_FIFO; this->type = PTS_FILE_FIFO;
} }
else if (S_ISLNK(st.st_mode)) 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)) else if (S_ISSOCK(st.st_mode))
{ {
tmp->type = PTS_FILE_SOCKET; this->type = PTS_FILE_SOCKET;
} }
else else
{ {
tmp->type = PTS_FILE_OTHER; this->type = PTS_FILE_OTHER;
} }
tmp->filesize = (u_int64_t)st.st_size; this->filesize = st.st_size;
tmp->create_time = st.st_ctime; this->created = st.st_ctime;
tmp->last_modify_time = st.st_mtime; this->modified = st.st_mtime;
tmp->last_access_time = st.st_atime; this->accessed = st.st_atime;
tmp->owner_id = (u_int64_t)st.st_uid; this->owner = st.st_uid;
tmp->group_id = (u_int64_t)st.st_gid; this->group = st.st_gid;
*entry = tmp;
*entry = this;
return TRUE; return TRUE;
} }
+10 -10
View File
@@ -36,15 +36,15 @@ typedef struct pts_file_metadata_t pts_file_metadata_t;
* Structure holding file metadata * Structure holding file metadata
*/ */
struct pts_file_metadata_t { struct pts_file_metadata_t {
u_int16_t meta_length; u_int16_t meta_length;
pts_file_type_t type; pts_file_type_t type;
u_int64_t filesize; u_int64_t filesize;
time_t create_time; time_t created;
time_t last_modify_time; time_t modified;
time_t last_access_time; time_t accessed;
u_int64_t owner_id; u_int64_t owner;
u_int64_t group_id; u_int64_t group;
char *filename; char *filename;
}; };
/** /**
@@ -60,7 +60,7 @@ struct pts_file_meta_t {
int (*get_file_count)(pts_file_meta_t *this); 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 filename Name of measured file or directory
* @param metadata File metadata * @param metadata File metadata
+15 -15
View File
@@ -160,16 +160,16 @@ METHOD(pa_tnc_attr_t, build, void,
/* Write the 64 bit integer fields as two 32 bit parts */ /* Write the 64 bit integer fields as two 32 bit parts */
writer->write_uint32(writer, entry->filesize >> 32); writer->write_uint32(writer, entry->filesize >> 32);
writer->write_uint32(writer, entry->filesize & 0xffffffff); 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->created) >> 32);
writer->write_uint32(writer, ((u_int64_t)entry->create_time) & 0xffffffff); writer->write_uint32(writer, ((u_int64_t)entry->created) & 0xffffffff);
writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) >> 32); writer->write_uint32(writer, ((u_int64_t)entry->modified) >> 32);
writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) & 0xffffffff); writer->write_uint32(writer, ((u_int64_t)entry->modified) & 0xffffffff);
writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) >> 32); writer->write_uint32(writer, ((u_int64_t)entry->accessed) >> 32);
writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) & 0xffffffff); writer->write_uint32(writer, ((u_int64_t)entry->accessed) & 0xffffffff);
writer->write_uint32(writer, entry->owner_id >> 32); writer->write_uint32(writer, entry->owner >> 32);
writer->write_uint32(writer, entry->owner_id & 0xffffffff); writer->write_uint32(writer, entry->owner & 0xffffffff);
writer->write_uint32(writer, entry->group_id >> 32); writer->write_uint32(writer, entry->group >> 32);
writer->write_uint32(writer, entry->group_id & 0xffffffff); writer->write_uint32(writer, entry->group & 0xffffffff);
writer->write_data (writer, chunk_create(entry->filename, strlen(entry->filename))); writer->write_data (writer, chunk_create(entry->filename, strlen(entry->filename)));
} }
@@ -346,11 +346,11 @@ METHOD(pa_tnc_attr_t, process, status_t,
entry->meta_length = PTS_FILE_METADATA_SIZE + strlen(entry->filename); entry->meta_length = PTS_FILE_METADATA_SIZE + strlen(entry->filename);
entry->type = type; entry->type = type;
entry->filesize = filesize; entry->filesize = filesize;
entry->create_time = create_time_t; entry->created = create_time_t;
entry->last_modify_time = modify_time_t; entry->modified = modify_time_t;
entry->last_access_time = access_time_t; entry->accessed = access_time_t;
entry->owner_id = owner_id; entry->owner = owner_id;
entry->group_id = group_id; entry->group = group_id;
this->metadata->add(this->metadata, entry); this->metadata->add(this->metadata, entry);
} }