lkml.org 
[lkml]   [2013]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH 1/6] ima: connect defined IMA templates through a linked list
Date
This patch connects defined templates through a linked list so that it
will be possible to append new descriptors when the functionality
of specifying a custom template in the policy will be introduced.
Template search by name is still performed by iterating over
'defined_templates' array items.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
---
security/integrity/ima/ima.h | 1 +
security/integrity/ima/ima_template.c | 5 +++++
2 files changed, 6 insertions(+)

diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index bf03c6a..5cbe881 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -67,6 +67,7 @@ struct ima_template_field {

/* IMA template descriptor definition */
struct ima_template_desc {
+ struct list_head list;
char *name;
char *fmt;
int num_fields;
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 5a95d06..33c911a 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -204,6 +204,7 @@ static int init_defined_templates(void)
int result = 0;

/* Init defined templates. */
+ INIT_LIST_HEAD(&defined_templates[0].list);
for (i = 0; i < ARRAY_SIZE(defined_templates); i++) {
struct ima_template_desc *template = &defined_templates[i];

@@ -219,6 +220,10 @@ static int init_defined_templates(void)
template->name : template->fmt), result);
return result;
}
+
+ if (i > 0)
+ list_add_tail(&defined_templates[i].list,
+ &defined_templates[0].list);
}
return result;
}
--
1.8.1.4
[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2013-11-07 17:01    [W:0.042 / U:2.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site