[PATCH 4/4] integrity: replace task uid with cred uid

Mimi Zohar
2008-11-20T16:44:53Z

This patch addresses the credential merge changes in the
security-testing-2.6/next tree.

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
---
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
index f62f2b7..4d59a86 100644
--- a/security/integrity/ima/ima_crypto.c
+++ b/security/integrity/ima/ima_crypto.c
@@ -44,7 +44,7 @@ static int update_file_hash(struct file *f, struct path *path,
rc = -EINVAL;
goto out;
}
- file = dentry_open(de, mnt, O_RDONLY);
+ file = dentry_open(de, mnt, O_RDONLY, current->cred);
if (IS_ERR(file)) {
ima_info("%s dentry_open failed\n", de->d_name.name);
rc = PTR_ERR(file);
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 2e95c35..867bfaf 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -95,7 +95,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule,
if ((rule->flags & IMA_FSMAGIC)
&& rule->fsmagic != inode->i_sb->s_magic)
return false;
- if ((rule->flags & IMA_UID) && rule->uid != tsk->uid)
+ if ((rule->flags & IMA_UID) && rule->uid != tsk->cred->uid)
return false;
for (i = 0; i < MAX_LSM_RULES; i++) {
int rc;
diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
index 758e5dd..8e32d84 100644
--- a/security/integrity/integrity_audit.c
+++ b/security/integrity/integrity_audit.c
@@ -49,7 +49,7 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,

ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
audit_log_format(ab, "integrity: pid=%d uid=%u auid=%u",
- current->pid, current->uid,
+ current->pid, current->cred->uid,
audit_get_loginuid(current));
audit_log_task_context(ab);
switch (audit_msgno) {
--
1.5.6.5