smbcomflush.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "headers.h"
  10. #include <String.h>
  11. SmbProcessResult
  12. smbcomflush(SmbSession *s, SmbHeader *h, uint8_t *pdata, SmbBuffer *sb)
  13. {
  14. SmbTree *t;
  15. SmbFile *f;
  16. uint16_t fid;
  17. Dir nulldir;
  18. if (h->wordcount != 1)
  19. return SmbProcessResultFormat;
  20. fid = smbnhgets(pdata);
  21. t = smbidmapfind(s->tidmap, h->tid);
  22. if (t == nil) {
  23. smbseterror(s, ERRSRV, ERRinvtid);
  24. return SmbProcessResultError;
  25. }
  26. f = smbidmapfind(s->fidmap, fid);
  27. if (f == nil) {
  28. smbseterror(s, ERRDOS, ERRbadfid);
  29. return SmbProcessResultError;
  30. }
  31. memset(&nulldir, 0xff, sizeof(nulldir));
  32. nulldir.name = nulldir.uid = nulldir.gid = nulldir.muid = nil;
  33. dirfwstat(f->fd, &nulldir);
  34. return smbbufferputack(s->response, h, &s->peerinfo);
  35. }