s->serv will resolve to the first share in the session, having multiple ones gives wrong context in some operations. use tid lookup to get the right one. Reference: /n/sources/patch/applied/aquarela-multi-shares Date: Sun Aug 22 23:38:06 CES 2010 Signed-off-by: cinap_lenrek@gmx.de --- /sys/src/cmd/aquarela/smbcomcreatedir.c Sun Aug 22 23:35:54 2010 +++ /sys/src/cmd/aquarela/smbcomcreatedir.c Sun Aug 22 23:35:51 2010 @@ -6,6 +6,7 @@ int fd; char *path; char *fullpath = nil; + SmbTree *t; uchar fmt; if (h->wordcount != 0) @@ -13,7 +14,12 @@ if (!smbbuffergetb(b, &fmt) || fmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &path)) return SmbProcessResultFormat; smblogprint(h->command, "smbcomcreatedirectory: %s\n", path); - smbstringprint(&fullpath, "%s%s", s->serv->path, path); + t = smbidmapfind(s->tidmap, h->tid); + if (t == nil) { + smbseterror(s, ERRSRV, ERRinvtid); + return SmbProcessResultError; + } + smbstringprint(&fullpath, "%s%s", t->serv->path, path); fd = create(fullpath, OREAD, DMDIR | 0775); if (fd < 0) { smblogprint(h->command, "smbcomcreatedirectory failed: %r\n"); --- /sys/src/cmd/aquarela/smbcomdeletedir.c Sun Aug 22 23:35:58 2010 +++ /sys/src/cmd/aquarela/smbcomdeletedir.c Sun Aug 22 23:35:56 2010 @@ -6,6 +6,7 @@ int rv; char *path; char *fullpath = nil; + SmbTree *t; uchar fmt; if (h->wordcount != 0) @@ -13,7 +14,12 @@ if (!smbbuffergetb(b, &fmt) || fmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &path)) return SmbProcessResultFormat; smblogprint(h->command, "smbcomdeletedirectory: %s\n", path); - smbstringprint(&fullpath, "%s%s", s->serv->path, path); + t = smbidmapfind(s->tidmap, h->tid); + if (t == nil) { + smbseterror(s, ERRSRV, ERRinvtid); + return SmbProcessResultError; + } + smbstringprint(&fullpath, "%s%s", t->serv->path, path); rv = remove(fullpath); if (rv < 0) { smblogprint(h->command, "smbcomdeletedirectory failed: %r\n"); --- /sys/src/cmd/aquarela/smbcomrename.c Sun Aug 22 23:36:02 2010 +++ /sys/src/cmd/aquarela/smbcomrename.c Sun Aug 22 23:36:00 2010 @@ -10,6 +10,7 @@ char *olddir, *newdir; char *oldname, *newname; uchar oldfmt, newfmt; + SmbTree *t; Dir d; SmbProcessResult pr; @@ -19,8 +20,13 @@ || !smbbuffergetb(b, &newfmt) || newfmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &new)) return SmbProcessResultFormat; - smbstringprint(&oldpath, "%s%s", s->serv->path, old); - smbstringprint(&newpath, "%s%s", s->serv->path, new); + t = smbidmapfind(s->tidmap, h->tid); + if (t == nil) { + smbseterror(s, ERRSRV, ERRinvtid); + return SmbProcessResultError; + } + smbstringprint(&oldpath, "%s%s", t->serv->path, old); + smbstringprint(&newpath, "%s%s", t->serv->path, new); smblogprint(h->command, "smbcomrename: %s to %s\n", oldpath, newpath); smbpathsplit(oldpath, &olddir, &oldname);