Hubert Hoffmann
2020-May-14 14:07 UTC
[Samba] open 2nd pdf on dfs share with Acrobat Reader not possible
Hello everybody, after updating samba from Version 4.9.1 to 4.10.4 (Centos 7) opening a PDF Document in Acrobat Reader with a double click, when the document resides on a dfs share, is only possible for the 1st document. I know, this is not not a samba bug, because windows 2019 Server behaves the same, i just want to share my findings. https://community.adobe.com/t5/acrobat-reader/open-two-pdfs-from-dfs-server-2019/td-p/10332133?page=1&profile.language=de This behavior was introduced in samba 4.9.10 with the following Patch: * BUG 13919: smbd: Implement SMB_FILE_NORMALIZED_NAME_INFORMATION handling. when "unpatching" the following patch the behavior is as "expected" diff -Npur samba-4.9.9/source3/smbd/trans2.c samba-4.9.10/source3/smbd/trans2.c --- samba-4.9.9/source3/smbd/trans2.c 2019-05-01 07:49:16.000000000 +0200 +++ samba-4.9.10/source3/smbd/trans2.c 2019-07-02 11:59:02.000000000 +0200 @@ -5208,6 +5208,63 @@ NTSTATUS smbd_do_qfilepathinfo(connectio break; } + case SMB_FILE_NORMALIZED_NAME_INFORMATION: + { + char *nfname = NULL; + + if (!fsp->conn->sconn->using_smb2) { + return NT_STATUS_INVALID_LEVEL; + } + + nfname = talloc_strdup(mem_ctx, smb_fname->base_name); + if (nfname == NULL) { + return NT_STATUS_NO_MEMORY; + } + + if (ISDOT(nfname)) { + nfname[0] = '\0'; + } + string_replace(nfname, '/', '\\'); + + if (smb_fname->stream_name != NULL) { + const char *s = smb_fname->stream_name; + const char *e = NULL; + size_t n; + + SMB_ASSERT(s[0] != '\0'); + + /* + * smb_fname->stream_name is in form + * of ':StrEam:$DATA', but we should only + * append ':StrEam' here. + */ + + e = strchr(&s[1], ':'); + if (e == NULL) { + n = strlen(s); + } else { + n = PTR_DIFF(e, s); + } + nfname = talloc_strndup_append(nfname, s, n); + if (nfname == NULL) { + return NT_STATUS_NO_MEMORY; + } + } + + status = srvstr_push(dstart, flags2, + pdata+4, nfname, + PTR_DIFF(dend, pdata+4), + STR_UNICODE, &len); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_NORMALIZED_NAME_INFORMATION\n")); + data_size = 4 + len; + SIVAL(pdata,0,len); + *fixed_portion = 8; + break; + } + case SMB_FILE_ALLOCATION_INFORMATION: case SMB_QUERY_FILE_ALLOCATION_INFO: DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_ALLOCATION_INFORMATION\n")); greetings, Hubert