diff -u --recursive --new-file linux-2.5.32-vfscred/drivers/isdn/hysdn/hysdn_procconf.c linux-2.5.32-file/drivers/isdn/hysdn/hysdn_procconf.c --- linux-2.5.32-vfscred/drivers/isdn/hysdn/hysdn_procconf.c Fri Aug 16 00:01:13 2002 +++ linux-2.5.32-file/drivers/isdn/hysdn/hysdn_procconf.c Mon Sep 2 08:26:29 2002 @@ -265,7 +265,7 @@ } if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", - filep->f_uid, filep->f_gid, filep->f_mode); + filep->f_cred->uid, filep->f_cred->gid, filep->f_mode); if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { /* write only access -> write boot file or conf line */ @@ -350,7 +350,7 @@ } if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", - filep->f_uid, filep->f_gid, filep->f_mode); + filep->f_cred->uid, filep->f_cred->gid, filep->f_mode); if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { /* write only access -> write boot file or conf line */ diff -u --recursive --new-file linux-2.5.32-vfscred/fs/file_table.c linux-2.5.32-file/fs/file_table.c --- linux-2.5.32-vfscred/fs/file_table.c Sat Aug 31 12:48:31 2002 +++ linux-2.5.32-file/fs/file_table.c Mon Sep 2 09:57:39 2002 @@ -52,8 +52,6 @@ } atomic_set(&f->f_count,1); f->f_version = ++event; - f->f_uid = current->vfscred->uid; - f->f_gid = current->vfscred->gid; list_add(&f->f_list, &anon_list); file_list_unlock(); return f; @@ -96,8 +94,6 @@ filp->f_mode = mode; atomic_set(&filp->f_count, 1); filp->f_dentry = dentry; - filp->f_uid = current->vfscred->uid; - filp->f_gid = current->vfscred->gid; filp->f_op = dentry->d_inode->i_fop; if (filp->f_op->open) return filp->f_op->open(dentry->d_inode, filp); @@ -128,6 +124,8 @@ fops_put(file->f_op); if (file->f_mode & FMODE_WRITE) put_write_access(inode); + if (file->f_cred) + put_vfscred(file->f_cred); file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; diff -u --recursive --new-file linux-2.5.32-vfscred/fs/intermezzo/vfs.c linux-2.5.32-file/fs/intermezzo/vfs.c --- linux-2.5.32-vfscred/fs/intermezzo/vfs.c Sat Aug 31 12:48:31 2002 +++ linux-2.5.32-file/fs/intermezzo/vfs.c Mon Sep 2 10:29:39 2002 @@ -1885,6 +1885,7 @@ f->f_dentry = dentry; f->f_pos = 0; f->f_op = NULL; + f->f_cred = get_current_vfscred(); if (inode->i_op) /* XXX should we set to presto ops, or leave at cache ops? */ f->f_op = inode->i_fop; diff -u --recursive --new-file linux-2.5.32-vfscred/fs/nfsd/vfs.c linux-2.5.32-file/fs/nfsd/vfs.c --- linux-2.5.32-vfscred/fs/nfsd/vfs.c Sat Aug 31 12:48:31 2002 +++ linux-2.5.32-file/fs/nfsd/vfs.c Mon Sep 2 09:36:44 2002 @@ -465,6 +465,7 @@ if (!err) { filp->f_flags = flags; filp->f_vfsmnt = fhp->fh_export->ex_mnt; + filp->f_cred = get_current_vfscred(); } else if (access & MAY_WRITE) put_write_access(inode); @@ -488,6 +489,7 @@ filp->f_op->release(inode, filp); if (filp->f_mode & FMODE_WRITE) put_write_access(inode); + put_vfscred(filp->f_cred); } /* diff -u --recursive --new-file linux-2.5.32-vfscred/fs/open.c linux-2.5.32-file/fs/open.c --- linux-2.5.32-vfscred/fs/open.c Sat Aug 31 17:32:23 2002 +++ linux-2.5.32-file/fs/open.c Mon Sep 2 15:09:07 2002 @@ -644,6 +644,7 @@ } f->f_ra.ra_pages = inode->i_mapping->backing_dev_info->ra_pages; + f->f_cred = get_current_vfscred(); f->f_dentry = dentry; f->f_vfsmnt = mnt; f->f_pos = 0; @@ -673,8 +674,10 @@ if (f->f_mode & FMODE_WRITE) put_write_access(inode); file_move(f, &kill_list); /* out of the way.. */ + put_vfscred(f->f_cred); f->f_dentry = NULL; f->f_vfsmnt = NULL; + f->f_cred = NULL; cleanup_file: put_filp(f); cleanup_dentry: diff -u --recursive --new-file linux-2.5.32-vfscred/include/linux/fs.h linux-2.5.32-file/include/linux/fs.h --- linux-2.5.32-vfscred/include/linux/fs.h Thu Aug 22 00:34:01 2002 +++ linux-2.5.32-file/include/linux/fs.h Mon Sep 2 22:37:28 2002 @@ -279,6 +279,7 @@ */ struct page; struct address_space; +struct vfs_cred; struct address_space_operations { int (*writepage)(struct page *); @@ -494,7 +495,7 @@ mode_t f_mode; loff_t f_pos; struct fown_struct f_owner; - unsigned int f_uid, f_gid; + struct vfs_cred * f_cred; int f_error; struct file_ra_state f_ra; diff -u --recursive --new-file linux-2.5.32-vfscred/net/ipv4/netfilter/ipt_owner.c linux-2.5.32-file/net/ipv4/netfilter/ipt_owner.c --- linux-2.5.32-vfscred/net/ipv4/netfilter/ipt_owner.c Mon Aug 19 20:51:30 2002 +++ linux-2.5.32-file/net/ipv4/netfilter/ipt_owner.c Mon Sep 2 08:23:37 2002 @@ -124,13 +124,13 @@ return 0; if(info->match & IPT_OWNER_UID) { - if((skb->sk->socket->file->f_uid != info->uid) ^ + if((skb->sk->socket->file->f_cred->uid != info->uid) ^ !!(info->invert & IPT_OWNER_UID)) return 0; } if(info->match & IPT_OWNER_GID) { - if((skb->sk->socket->file->f_gid != info->gid) ^ + if((skb->sk->socket->file->f_cred->gid != info->gid) ^ !!(info->invert & IPT_OWNER_GID)) return 0; } diff -u --recursive --new-file linux-2.5.32-vfscred/net/ipv6/netfilter/ip6t_owner.c linux-2.5.32-file/net/ipv6/netfilter/ip6t_owner.c --- linux-2.5.32-vfscred/net/ipv6/netfilter/ip6t_owner.c Tue Feb 5 08:54:00 2002 +++ linux-2.5.32-file/net/ipv6/netfilter/ip6t_owner.c Mon Sep 2 08:23:07 2002 @@ -96,13 +96,13 @@ return 0; if(info->match & IP6T_OWNER_UID) { - if((skb->sk->socket->file->f_uid != info->uid) ^ + if((skb->sk->socket->file->f_cred->uid != info->uid) ^ !!(info->invert & IP6T_OWNER_UID)) return 0; } if(info->match & IP6T_OWNER_GID) { - if((skb->sk->socket->file->f_gid != info->gid) ^ + if((skb->sk->socket->file->f_cred->gid != info->gid) ^ !!(info->invert & IP6T_OWNER_GID)) return 0; } diff -u --recursive --new-file linux-2.5.32-vfscred/net/socket.c linux-2.5.32-file/net/socket.c --- linux-2.5.32-vfscred/net/socket.c Sat Aug 31 12:48:31 2002 +++ linux-2.5.32-file/net/socket.c Mon Sep 2 10:36:15 2002 @@ -396,6 +396,7 @@ file->f_mode = 3; file->f_flags = O_RDWR; file->f_pos = 0; + file->f_cred = get_current_vfscred(); fd_install(fd, file); }