smbcomflush.c 707 B

12345678910111213141516171819202122232425262728
  1. #include "headers.h"
  2. #include <String.h>
  3. SmbProcessResult
  4. smbcomflush(SmbSession *s, SmbHeader *h, uchar *pdata, SmbBuffer *)
  5. {
  6. SmbTree *t;
  7. SmbFile *f;
  8. ushort fid;
  9. Dir nulldir;
  10. if (h->wordcount != 1)
  11. return SmbProcessResultFormat;
  12. fid = smbnhgets(pdata);
  13. t = smbidmapfind(s->tidmap, h->tid);
  14. if (t == nil) {
  15. smbseterror(s, ERRSRV, ERRinvtid);
  16. return SmbProcessResultError;
  17. }
  18. f = smbidmapfind(s->fidmap, fid);
  19. if (f == nil) {
  20. smbseterror(s, ERRDOS, ERRbadfid);
  21. return SmbProcessResultError;
  22. }
  23. memset(&nulldir, 0xff, sizeof(nulldir));
  24. nulldir.name = nulldir.uid = nulldir.gid = nulldir.muid = nil;
  25. dirfwstat(f->fd, &nulldir);
  26. return smbbufferputack(s->response, h, &s->peerinfo);
  27. }