aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/messaging.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-02-12 03:53:44 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:36 -0500
commitdddfa461fc8951f9b5f951c13565b6cac678635a (patch)
treeeaf51d6825bd97087b9c700f7010ed08e3f83047 /fs/ecryptfs/messaging.c
parent88b4a07e6610f4c93b08b0bb103318218db1e9f6 (diff)
[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:
243 * userspace. Returns zero upon delivery to desired context element; 243 * userspace. Returns zero upon delivery to desired context element;
244 * non-zero upon delivery failure or error. 244 * non-zero upon delivery failure or error.
245 */ 245 */
246int ecryptfs_process_response(struct ecryptfs_message *msg, pid_t pid, u32 seq) 246int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t uid,
247 pid_t pid, u32 seq)
247{ 248{
248 struct ecryptfs_daemon_id *id; 249 struct ecryptfs_daemon_id *id;
249 struct ecryptfs_msg_ctx *msg_ctx; 250 struct ecryptfs_msg_ctx *msg_ctx;
@@ -268,6 +269,13 @@ int ecryptfs_process_response(struct ecryptfs_message *msg, pid_t pid, u32 seq)
268 msg_ctx->task->euid, pid); 269 msg_ctx->task->euid, pid);
269 goto wake_up; 270 goto wake_up;
270 } 271 }
272 if (msg_ctx->task->euid != uid) {
273 rc = -EBADMSG;
274 ecryptfs_printk(KERN_WARNING, "Received message from user "
275 "[%d]; expected message from user [%d]\n",
276 uid, msg_ctx->task->euid);
277 goto unlock;
278 }
271 if (id->pid != pid) { 279 if (id->pid != pid) {
272 rc = -EBADMSG; 280 rc = -EBADMSG;
273 ecryptfs_printk(KERN_ERR, "User [%d] received a " 281 ecryptfs_printk(KERN_ERR, "User [%d] received a "