]> code.delx.au - gnu-emacs/blobdiff - lisp/net/tramp-smb.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / net / tramp-smb.el
index b4bf10d471513c253037df742c40b0c9fe37d678..0f143100906d502339b95a8a88d1ab265e21b8c8 100644 (file)
@@ -195,6 +195,7 @@ See `tramp-actions-before-shell' for more info.")
     (dired-uncache . tramp-handle-dired-uncache)
     (expand-file-name . tramp-smb-handle-expand-file-name)
     (file-accessible-directory-p . tramp-smb-handle-file-directory-p)
+    (file-acl . tramp-smb-handle-file-acl)
     (file-attributes . tramp-smb-handle-file-attributes)
     (file-directory-p .  tramp-smb-handle-file-directory-p)
     (file-executable-p . tramp-handle-file-exists-p)
@@ -227,8 +228,9 @@ See `tramp-actions-before-shell' for more info.")
     (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
     (process-file . tramp-smb-handle-process-file)
     (rename-file . tramp-smb-handle-rename-file)
+    (set-file-acl . ignore)
     (set-file-modes . tramp-smb-handle-set-file-modes)
-    ;; `set-file-selinux-context' performed by default handler.
+    (set-file-selinux-context . ignore)
     (set-file-times . ignore)
     (set-visited-file-modtime . ignore)
     (shell-command . tramp-handle-shell-command)
@@ -265,6 +267,8 @@ This can be used to disable echo etc."
   :type 'string
   :version "24.3")
 
+;; It must be a `defsubst' in order to push the whole code into
+;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-smb-file-name-p (filename)
   "Check if it's a filename for SMB servers."
@@ -485,10 +489,10 @@ pass to the OPERATION."
 
 (defun tramp-smb-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
-           preserve-uid-gid preserve-selinux-context)
+           preserve-uid-gid preserve-extended-attributes)
   "Like `copy-file' for Tramp files.
 KEEP-DATE has no effect in case NEWNAME resides on an SMB server.
-PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
+PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
   (setq filename (expand-file-name filename)
        newname (expand-file-name newname))
   (with-tramp-progress-reporter
@@ -637,6 +641,22 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
        method user host
        (tramp-run-real-handler 'expand-file-name (list localname))))))
 
+(defun tramp-smb-handle-file-acl (filename)
+  "Like `file-acl' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-acl"
+      (when (tramp-smb-send-command
+            v (format "getfacl \"%s\"" (tramp-smb-get-localname v)))
+       (with-current-buffer (tramp-get-connection-buffer v)
+         (goto-char (point-min))
+         (while (looking-at-p "^#")
+           (forward-line)
+           (delete-region (point-min) (point)))
+         (goto-char (point-max))
+         (delete-blank-lines)
+         (when (> (point-max) (point-min))
+           (substring-no-properties (buffer-string))))))))
+
 (defun tramp-smb-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))