1 #include "headers.h" 2 3 SmbProcessResult 4 smbcomcreatedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b) 5 { 6 int fd; 7 char *path; 8 char *fullpath = nil; 9 uchar fmt; 10 11 if (h->wordcount != 0) 12 return SmbProcessResultFormat; 13 if (!smbbuffergetb(b, &fmt) || fmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &path)) 14 return SmbProcessResultFormat; 15 smblogprint(h->command, "smbcomcreatedirectory: %s\n", path); 16 smbstringprint(&fullpath, "%s%s", s->serv->path, path); 17 fd = create(fullpath, OREAD, DMDIR | 0775); 18 if (fd < 0) { 19 smblogprint(h->command, "smbcomcreatedirectory failed: %r\n"); 20 smbseterror(s, ERRDOS, ERRnoaccess); 21 free(path); 22 return SmbProcessResultError; 23 } 24 close(fd); 25 free(fullpath); 26 free(path); 27 return smbbufferputack(s->response, h, &s->peerinfo); 28 } 29