* test/lisp/tramp-tests.el (tramp-test21-file-links): Special code for smb.

This commit is contained in:
Michael Albinus 2017-09-25 17:52:24 +02:00
parent b719f6b20b
commit 49cd561dc6
2 changed files with 14 additions and 7 deletions

View file

@ -535,7 +535,7 @@ pass to the OPERATION."
;; Reset the transfer process properties. ;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil) (tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil) (tramp-set-connection-property v "process-buffer" nil)
(when t1 (delete-directory tmpdir 'recurse)))) (when t1 (delete-directory tmpdir 'recursive))))
;; Handle KEEP-DATE argument. ;; Handle KEEP-DATE argument.
(when keep-date (when keep-date
@ -1583,6 +1583,10 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
"Read entries which match DIRECTORY. "Read entries which match DIRECTORY.
Either the shares are listed, or the `dir' command is executed. Either the shares are listed, or the `dir' command is executed.
Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)." Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
;; If CIFS capabilities are enabled, symlinks are not listed
;; by `dir'. This is a consequence of
;; <https://www.samba.org/samba/news/symlink_attack.html>. See also
;; <https://bugzilla.samba.org/show_bug.cgi?id=5116>.
(with-parsed-tramp-file-name (file-name-as-directory directory) nil (with-parsed-tramp-file-name (file-name-as-directory directory) nil
(setq localname (or localname "/")) (setq localname (or localname "/"))
(with-tramp-file-property v localname "file-entries" (with-tramp-file-property v localname "file-entries"

View file

@ -2653,8 +2653,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(tmp-name1 (tramp--test-make-temp-name nil quoted)) (tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted)) (tmp-name2 (tramp--test-make-temp-name nil quoted))
(tmp-name3 (tramp--test-make-temp-name 'local quoted)) (tmp-name3 (tramp--test-make-temp-name 'local quoted))
(tmp-name4 (tramp--test-make-temp-name nil quoted))) (tmp-name4 (tramp--test-make-temp-name nil quoted))
(tmp-name5
(expand-file-name (file-name-nondirectory tmp-name1) tmp-name4)))
;; Check `make-symbolic-link'. ;; Check `make-symbolic-link'.
(unwind-protect (unwind-protect
(tramp--test-ignore-make-symbolic-link-error (tramp--test-ignore-make-symbolic-link-error
@ -2716,9 +2717,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(funcall (funcall
(if quoted 'tramp-compat-file-name-unquote 'identity) (if quoted 'tramp-compat-file-name-unquote 'identity)
(file-remote-p tmp-name1 'localname)) (file-remote-p tmp-name1 'localname))
(file-symlink-p (file-symlink-p tmp-name5)))
(expand-file-name ;; `smbclient' does not show symlinks in directories, so
(file-name-nondirectory tmp-name1) tmp-name4))))) ;; we cannot delete a non-empty directory. We delete the
;; file explicitely.
(delete-file tmp-name5))
;; Cleanup. ;; Cleanup.
(ignore-errors (ignore-errors
@ -2737,7 +2740,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should-error (should-error
(add-name-to-file tmp-name1 tmp-name2) (add-name-to-file tmp-name1 tmp-name2)
:type 'file-already-exists) :type 'file-already-exists)
;; number means interactive case. ;; A number means interactive case.
(cl-letf (((symbol-function 'yes-or-no-p) 'ignore)) (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
(should-error (should-error
(add-name-to-file tmp-name1 tmp-name2 0) (add-name-to-file tmp-name1 tmp-name2 0)