[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: more re: nfs openbsd setattr bug
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Re: more re: nfs openbsd setattr bug
- From: Otto Moerbeek <otto_(_at_)_drijf_(_dot_)_net>
- Date: Wed, 29 Mar 2006 09:24:39 +0200 (CEST)
- Cc: han_(_at_)_mijncomputer_(_dot_)_nl
On Tue, 28 Mar 2006, Otto Moerbeek wrote:
> On Tue, 28 Mar 2006, rick_(_at_)_snowhite_(_dot_)_cis_(_dot_)_uoguelph_(_dot_)_ca wrote:
>
> > > I can confirm your diff fixes things for me. I'm woried about one
> > > thing though: what if the client does atime TOSERVER mtime TOCLIENT?
> > > That should not be allowed.
> > >
> > > So here's a revised diff that catches that.
> >
> > Yep, I'd agree. It seems absurd that a client would do this, but I suppose
> > the server should be paranoid and protect against it. Your diff looks fine
> > to me.
>
> It's still not covering all cases: atime TOCLIENT mtime TOSERVER is
> allowed, while it should not. Will come up with a new diff tomorrow.
>
> But this is just fine-tuning, I'm glad we know what is going on now.
> Thanks,
So here's the promised diff.
-Otto
Index: nfs_serv.c
===================================================================
RCS file: /cvs/src/sys/nfs/nfs_serv.c,v
retrieving revision 1.39
diff -u -p -r1.39 nfs_serv.c
--- nfs_serv.c 18 Jun 2005 18:09:43 -0000 1.39
+++ nfs_serv.c 29 Mar 2006 07:13:26 -0000
@@ -233,6 +233,7 @@ nfsrv_setattr(nfsd, slp, procp, mrq)
nfsm_srvmtofh(fhp);
VATTR_NULL(&va);
if (v3) {
+ va.va_vaflags |= VA_UTIMES_NULL;
nfsm_srvsattr(&va);
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
gcheck = fxdr_unsigned(int, *tl);
Index: nfsm_subs.h
===================================================================
RCS file: /cvs/src/sys/nfs/nfsm_subs.h,v
retrieving revision 1.15
diff -u -p -r1.15 nfsm_subs.h
--- nfsm_subs.h 24 Jun 2004 19:35:26 -0000 1.15
+++ nfsm_subs.h 29 Mar 2006 07:13:26 -0000
@@ -467,6 +467,7 @@
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
case NFSV3SATTRTIME_TOCLIENT: \
+ (a)->va_vaflags &= ~VA_UTIMES_NULL; \
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_atime); \
break; \
@@ -477,6 +478,7 @@
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
case NFSV3SATTRTIME_TOCLIENT: \
+ (a)->va_vaflags &= ~VA_UTIMES_NULL; \
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_mtime); \
break; \
Visit your host, monkey.org