summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/messaging.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-02-12 09:53:44 +0100
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 18:48:36 +0100
commitdddfa461fc8951f9b5f951c13565b6cac678635a (patch)
treeeaf51d6825bd97087b9c700f7010ed08e3f83047 /fs/ecryptfs/messaging.c
parent[PATCH] eCryptfs: Public key transport mechanism (diff)
downloadlinux-dddfa461fc8951f9b5f951c13565b6cac678635a.tar.xz
linux-dddfa461fc8951f9b5f951c13565b6cac678635a.zip
[PATCH] eCryptfs: Public key; packet management
Public key support code. This reads and writes packets in the header that contain public key encrypted file keys. It calls the messaging code in the previous patch to send and receive encryption and decryption request packets from the userspace daemon. [akpm@osdl.org: cleab fix] Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/messaging.c')
-rw-r--r--fs/ecryptfs/messaging.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index c22b32fc8e8c..e8ba6278ad2c 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -243,7 +243,8 @@ unlock:
* userspace. Returns zero upon delivery to desired context element;
* non-zero upon delivery failure or error.
*/
-int ecryptfs_process_response(struct ecryptfs_message *msg, pid_t pid, u32 seq)
+int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t uid,
+ pid_t pid, u32 seq)
{
struct ecryptfs_daemon_id *id;
struct ecryptfs_msg_ctx *msg_ctx;
@@ -268,6 +269,13 @@ int ecryptfs_process_response(struct ecryptfs_message *msg, pid_t pid, u32 seq)
msg_ctx->task->euid, pid);
goto wake_up;
}
+ if (msg_ctx->task->euid != uid) {
+ rc = -EBADMSG;
+ ecryptfs_printk(KERN_WARNING, "Received message from user "
+ "[%d]; expected message from user [%d]\n",
+ uid, msg_ctx->task->euid);
+ goto unlock;
+ }
if (id->pid != pid) {
rc = -EBADMSG;
ecryptfs_printk(KERN_ERR, "User [%d] received a "