patch-2.2.0-pre2 linux/fs/lockd/svcsubs.c
Next file: linux/fs/nfsd/Makefile
Previous file: linux/fs/lockd/svcproc.c
Back to the patch index
Back to the overall index
- Lines: 29
- Date:
Tue Dec 29 11:42:25 1998
- Orig file:
v2.2.0-pre1/linux/fs/lockd/svcsubs.c
- Orig date:
Sun Jul 26 11:57:18 1998
diff -u --recursive --new-file v2.2.0-pre1/linux/fs/lockd/svcsubs.c linux/fs/lockd/svcsubs.c
@@ -52,6 +52,8 @@
struct nlm_file *file;
unsigned int hash;
u32 nfserr;
+ uid_t saved_cr_uid;
+ struct svc_cred *cred;
dprintk("lockd: nlm_file_lookup(%s/%u)\n",
kdevname(u32_to_kdev_t(fh->fh_dev)), fh->fh_ino);
@@ -80,11 +82,19 @@
/* Open the file. Note that this must not sleep for too long, else
* we would lock up lockd:-) So no NFS re-exports, folks.
+ *
+ * We have to make sure we have the right credential to open
+ * the file.
*/
+ cred = &rqstp->rq_cred;
+ saved_cr_uid = cred->cr_uid;
+ cred->cr_uid = 0;
if ((nfserr = nlmsvc_ops->fopen(rqstp, fh, &file->f_file)) != 0) {
dprintk("lockd: open failed (nfserr %ld)\n", ntohl(nfserr));
+ cred->cr_uid = saved_cr_uid;
goto out_free;
}
+ cred->cr_uid = saved_cr_uid;
file->f_next = nlm_files[hash];
nlm_files[hash] = file;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov