diff options
| author | Michael Albinus | 2015-10-29 14:05:55 +0100 |
|---|---|---|
| committer | Michael Albinus | 2015-10-29 14:05:55 +0100 |
| commit | 270a17fe4d357d64cfef7a3991e6a69db587a3fb (patch) | |
| tree | 16966fd72e6b98ab3c2feafde96d05d9bce188a2 | |
| parent | dc95cb8c2d646468186c5b379bd6d138c1ec1d1c (diff) | |
| download | emacs-270a17fe4d357d64cfef7a3991e6a69db587a3fb.tar.gz emacs-270a17fe4d357d64cfef7a3991e6a69db587a3fb.zip | |
Add "afp" method to Tramp
* doc/misc/tramp.texi (GVFS based methods): Describe `afp' method.
* lisp/net/tramp-gvfs.el (tramp-gvfs-methods): Add "afp" method.
(tramp-gvfs-handle-expand-file-name)
(tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec)
(tramp-gvfs-maybe-open-connection): Support also "afp".
(tramp-gvfs-handle-file-attributes): Handle the case of empty
"owner::user" and "owner::group" entries.
| -rw-r--r-- | doc/misc/tramp.texi | 17 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 69 |
3 files changed, 61 insertions, 29 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 8673b00b23d..07d34bd4d2f 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -1062,6 +1062,16 @@ Therefore, your @value{emacsname} must have D-Bus integration, | |||
| 1062 | @pxref{Top, , D-Bus, dbus}. | 1062 | @pxref{Top, , D-Bus, dbus}. |
| 1063 | 1063 | ||
| 1064 | @table @asis | 1064 | @table @asis |
| 1065 | @item @option{afp} | ||
| 1066 | @cindex method afp | ||
| 1067 | @cindex afp method | ||
| 1068 | |||
| 1069 | Access to Mac OS X volumes via the Apple Filing Protocol is offered by | ||
| 1070 | this method. The access must always be performed with a leading | ||
| 1071 | volume (share) name, like @file{@trampfn{afp, user, host, /volume}}. | ||
| 1072 | |||
| 1073 | |||
| 1074 | |||
| 1065 | @item @option{dav} | 1075 | @item @option{dav} |
| 1066 | @cindex method dav | 1076 | @cindex method dav |
| 1067 | @cindex method davs | 1077 | @cindex method davs |
| @@ -1107,9 +1117,10 @@ FUSE, it also needs the SYNCE-GVFS plugin. | |||
| 1107 | @vindex tramp-gvfs-methods | 1117 | @vindex tramp-gvfs-methods |
| 1108 | @defopt tramp-gvfs-methods | 1118 | @defopt tramp-gvfs-methods |
| 1109 | This custom option, a list, defines the external methods which shall | 1119 | This custom option, a list, defines the external methods which shall |
| 1110 | be used with GVFS@. Per default, these are @option{dav}, | 1120 | be used with GVFS@. Per default, these are @option{afp}, |
| 1111 | @option{davs}, @option{obex}, @option{sftp} and @option{synce}. Other | 1121 | @option{dav}, @option{davs}, @option{obex}, @option{sftp} and |
| 1112 | possible values are @option{ftp} and @option{smb}. | 1122 | @option{synce}. Other possible values are @option{ftp} and |
| 1123 | @option{smb}. | ||
| 1113 | @end defopt | 1124 | @end defopt |
| 1114 | @end ifset | 1125 | @end ifset |
| 1115 | 1126 | ||
| @@ -671,6 +671,10 @@ plist will contain a :peer element that has the output of | |||
| 671 | ** Tramp | 671 | ** Tramp |
| 672 | 672 | ||
| 673 | +++ | 673 | +++ |
| 674 | *** New connection method "afp", which allows to access Mac OS X | ||
| 675 | volumes via the Apple Filing Protocol. | ||
| 676 | |||
| 677 | +++ | ||
| 674 | *** New connection method "nc", which allows to access dumb busyboxes. | 678 | *** New connection method "nc", which allows to access dumb busyboxes. |
| 675 | 679 | ||
| 676 | +++ | 680 | +++ |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 177ccfc3712..c68b5e4c55c 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -110,11 +110,12 @@ | |||
| 110 | (require 'custom)) | 110 | (require 'custom)) |
| 111 | 111 | ||
| 112 | ;;;###tramp-autoload | 112 | ;;;###tramp-autoload |
| 113 | (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "sftp" "synce") | 113 | (defcustom tramp-gvfs-methods '("afp" "dav" "davs" "obex" "sftp" "synce") |
| 114 | "List of methods for remote files, accessed with GVFS." | 114 | "List of methods for remote files, accessed with GVFS." |
| 115 | :group 'tramp | 115 | :group 'tramp |
| 116 | :version "23.2" | 116 | :version "25.1" |
| 117 | :type '(repeat (choice (const "dav") | 117 | :type '(repeat (choice (const "afp") |
| 118 | (const "dav") | ||
| 118 | (const "davs") | 119 | (const "davs") |
| 119 | (const "ftp") | 120 | (const "ftp") |
| 120 | (const "obex") | 121 | (const "obex") |
| @@ -231,7 +232,8 @@ It has been changed in GVFS 1.14.") | |||
| 231 | ;; ARRAY BYTE mount_prefix | 232 | ;; ARRAY BYTE mount_prefix |
| 232 | ;; ARRAY | 233 | ;; ARRAY |
| 233 | ;; STRUCT mount_spec_item | 234 | ;; STRUCT mount_spec_item |
| 234 | ;; STRING key (server, share, type, user, host, port) | 235 | ;; STRING key (type, user, domain, host, server, |
| 236 | ;; share, volume, port, ssl) | ||
| 235 | ;; ARRAY BYTE value | 237 | ;; ARRAY BYTE value |
| 236 | ;; ARRAY BYTE default_location Since GVFS 1.5 only !!! | 238 | ;; ARRAY BYTE default_location Since GVFS 1.5 only !!! |
| 237 | 239 | ||
| @@ -770,7 +772,7 @@ file names." | |||
| 770 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) | 772 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) |
| 771 | (setq localname (concat "/" localname))) | 773 | (setq localname (concat "/" localname))) |
| 772 | ;; We do not pass "/..". | 774 | ;; We do not pass "/..". |
| 773 | (if (string-equal "smb" method) | 775 | (if (string-match "^\\(afp\\|smb\\)$" method) |
| 774 | (when (string-match "^/[^/]+\\(/\\.\\./?\\)" localname) | 776 | (when (string-match "^/[^/]+\\(/\\.\\./?\\)" localname) |
| 775 | (setq localname (replace-match "/" t t localname 1))) | 777 | (setq localname (replace-match "/" t t localname 1))) |
| 776 | (when (string-match "^/\\.\\./?" localname) | 778 | (when (string-match "^/\\.\\./?" localname) |
| @@ -825,8 +827,9 @@ file names." | |||
| 825 | (if (re-search-forward | 827 | (if (re-search-forward |
| 826 | "unix::uid:\\s-+\\([0-9]+\\)" nil t) | 828 | "unix::uid:\\s-+\\([0-9]+\\)" nil t) |
| 827 | (string-to-number (match-string 1))) | 829 | (string-to-number (match-string 1))) |
| 828 | (if (re-search-forward | 830 | (if (and |
| 829 | "owner::user:\\s-+\\(\\S-+\\)" nil t) | 831 | (re-search-forward "owner::user:\\s-+" nil t) |
| 832 | (re-search-forward "(\\S-+\\)" (point-at-eol) t)) | ||
| 830 | (match-string 1))) | 833 | (match-string 1))) |
| 831 | (tramp-get-local-uid id-format))) | 834 | (tramp-get-local-uid id-format))) |
| 832 | (setq res-gid | 835 | (setq res-gid |
| @@ -834,8 +837,9 @@ file names." | |||
| 834 | (if (re-search-forward | 837 | (if (re-search-forward |
| 835 | "unix::gid:\\s-+\\([0-9]+\\)" nil t) | 838 | "unix::gid:\\s-+\\([0-9]+\\)" nil t) |
| 836 | (string-to-number (match-string 1))) | 839 | (string-to-number (match-string 1))) |
| 837 | (if (re-search-forward | 840 | (if (and |
| 838 | "owner::group:\\s-+\\(\\S-+\\)" nil t) | 841 | (re-search-forward "owner::group:\\s-+" nil t) |
| 842 | (re-search-forward "(\\S-+\\)" (point-at-eol) t)) | ||
| 839 | (match-string 1))) | 843 | (match-string 1))) |
| 840 | (tramp-get-local-gid id-format))) | 844 | (tramp-get-local-gid id-format))) |
| 841 | ;; ... last access, modification and change time | 845 | ;; ... last access, modification and change time |
| @@ -1346,12 +1350,14 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"." | |||
| 1346 | (cadr (assoc "port" (cadr mount-spec))))) | 1350 | (cadr (assoc "port" (cadr mount-spec))))) |
| 1347 | (ssl (tramp-gvfs-dbus-byte-array-to-string | 1351 | (ssl (tramp-gvfs-dbus-byte-array-to-string |
| 1348 | (cadr (assoc "ssl" (cadr mount-spec))))) | 1352 | (cadr (assoc "ssl" (cadr mount-spec))))) |
| 1349 | (prefix (concat (tramp-gvfs-dbus-byte-array-to-string | 1353 | (prefix (concat |
| 1350 | (car mount-spec)) | 1354 | (tramp-gvfs-dbus-byte-array-to-string |
| 1351 | (tramp-gvfs-dbus-byte-array-to-string | 1355 | (car mount-spec)) |
| 1352 | (cadr (assoc "share" (cadr mount-spec))))))) | 1356 | (tramp-gvfs-dbus-byte-array-to-string |
| 1353 | (when (string-match "^smb" method) | 1357 | (or (cadr (assoc "share" (cadr mount-spec))) |
| 1354 | (setq method "smb")) | 1358 | (cadr (assoc "volume" (cadr mount-spec)))))))) |
| 1359 | (when (string-match "^\\(afp\\|smb\\)" method) | ||
| 1360 | (setq method (match-string 1 method))) | ||
| 1355 | (when (string-equal "obex" method) | 1361 | (when (string-equal "obex" method) |
| 1356 | (setq host (tramp-bluez-device host))) | 1362 | (setq host (tramp-bluez-device host))) |
| 1357 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) | 1363 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) |
| @@ -1428,12 +1434,15 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"." | |||
| 1428 | (cadr (assoc "port" (cadr mount-spec))))) | 1434 | (cadr (assoc "port" (cadr mount-spec))))) |
| 1429 | (ssl (tramp-gvfs-dbus-byte-array-to-string | 1435 | (ssl (tramp-gvfs-dbus-byte-array-to-string |
| 1430 | (cadr (assoc "ssl" (cadr mount-spec))))) | 1436 | (cadr (assoc "ssl" (cadr mount-spec))))) |
| 1431 | (prefix (concat (tramp-gvfs-dbus-byte-array-to-string | 1437 | (prefix (concat |
| 1432 | (car mount-spec)) | 1438 | (tramp-gvfs-dbus-byte-array-to-string |
| 1433 | (tramp-gvfs-dbus-byte-array-to-string | 1439 | (car mount-spec)) |
| 1434 | (cadr (assoc "share" (cadr mount-spec))))))) | 1440 | (tramp-gvfs-dbus-byte-array-to-string |
| 1435 | (when (string-match "^smb" method) | 1441 | (or |
| 1436 | (setq method "smb")) | 1442 | (cadr (assoc "share" (cadr mount-spec))) |
| 1443 | (cadr (assoc "volume" (cadr mount-spec)))))))) | ||
| 1444 | (when (string-match "^\\(afp\\|smb\\)" method) | ||
| 1445 | (setq method (match-string 1 method))) | ||
| 1437 | (when (string-equal "obex" method) | 1446 | (when (string-equal "obex" method) |
| 1438 | (setq host (tramp-bluez-device host))) | 1447 | (setq host (tramp-bluez-device host))) |
| 1439 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) | 1448 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) |
| @@ -1473,16 +1482,16 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1473 | (host (tramp-file-name-real-host vec)) | 1482 | (host (tramp-file-name-real-host vec)) |
| 1474 | (port (tramp-file-name-port vec)) | 1483 | (port (tramp-file-name-port vec)) |
| 1475 | (localname (tramp-file-name-localname vec)) | 1484 | (localname (tramp-file-name-localname vec)) |
| 1476 | (ssl (if (string-match "^davs" method) "true" "false")) | 1485 | (share (when (string-match "^/?\\([^/]+\\)" localname) |
| 1486 | (match-string 1 localname))) | ||
| 1487 | (ssl (when (string-match "^davs" method) "true" "false")) | ||
| 1477 | (mount-spec | 1488 | (mount-spec |
| 1478 | `(:array | 1489 | `(:array |
| 1479 | ,@(cond | 1490 | ,@(cond |
| 1480 | ((string-equal "smb" method) | 1491 | ((string-equal "smb" method) |
| 1481 | (string-match "^/?\\([^/]+\\)" localname) | ||
| 1482 | (list (tramp-gvfs-mount-spec-entry "type" "smb-share") | 1492 | (list (tramp-gvfs-mount-spec-entry "type" "smb-share") |
| 1483 | (tramp-gvfs-mount-spec-entry "server" host) | 1493 | (tramp-gvfs-mount-spec-entry "server" host) |
| 1484 | (tramp-gvfs-mount-spec-entry | 1494 | (tramp-gvfs-mount-spec-entry "share" share))) |
| 1485 | "share" (match-string 1 localname)))) | ||
| 1486 | ((string-equal "obex" method) | 1495 | ((string-equal "obex" method) |
| 1487 | (list (tramp-gvfs-mount-spec-entry "type" method) | 1496 | (list (tramp-gvfs-mount-spec-entry "type" method) |
| 1488 | (tramp-gvfs-mount-spec-entry | 1497 | (tramp-gvfs-mount-spec-entry |
| @@ -1491,6 +1500,10 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1491 | (list (tramp-gvfs-mount-spec-entry "type" "dav") | 1500 | (list (tramp-gvfs-mount-spec-entry "type" "dav") |
| 1492 | (tramp-gvfs-mount-spec-entry "host" host) | 1501 | (tramp-gvfs-mount-spec-entry "host" host) |
| 1493 | (tramp-gvfs-mount-spec-entry "ssl" ssl))) | 1502 | (tramp-gvfs-mount-spec-entry "ssl" ssl))) |
| 1503 | ((string-equal "afp" method) | ||
| 1504 | (list (tramp-gvfs-mount-spec-entry "type" "afp-volume") | ||
| 1505 | (tramp-gvfs-mount-spec-entry "host" host) | ||
| 1506 | (tramp-gvfs-mount-spec-entry "volume" share))) | ||
| 1494 | (t | 1507 | (t |
| 1495 | (list (tramp-gvfs-mount-spec-entry "type" method) | 1508 | (list (tramp-gvfs-mount-spec-entry "type" method) |
| 1496 | (tramp-gvfs-mount-spec-entry "host" host)))) | 1509 | (tramp-gvfs-mount-spec-entry "host" host)))) |
| @@ -1546,6 +1559,10 @@ connection if a previous connection has died for some reason." | |||
| 1546 | (string-equal localname "/")) | 1559 | (string-equal localname "/")) |
| 1547 | (tramp-error vec 'file-error "Filename must contain a Windows share")) | 1560 | (tramp-error vec 'file-error "Filename must contain a Windows share")) |
| 1548 | 1561 | ||
| 1562 | (when (and (string-equal method "afp") | ||
| 1563 | (string-equal localname "/")) | ||
| 1564 | (tramp-error vec 'file-error "Filename must contain an AFP volume")) | ||
| 1565 | |||
| 1549 | (with-tramp-progress-reporter | 1566 | (with-tramp-progress-reporter |
| 1550 | vec 3 | 1567 | vec 3 |
| 1551 | (if (zerop (length user)) | 1568 | (if (zerop (length user)) |
| @@ -1795,7 +1812,7 @@ They are retrieved from the hal daemon." | |||
| 1795 | 1812 | ||
| 1796 | ;;; TODO: | 1813 | ;;; TODO: |
| 1797 | 1814 | ||
| 1798 | ;; * Host name completion via smb-server or smb-network. | 1815 | ;; * Host name completion via afp-server, smb-server or smb-network. |
| 1799 | ;; * Check how two shares of the same SMB server can be mounted in | 1816 | ;; * Check how two shares of the same SMB server can be mounted in |
| 1800 | ;; parallel. | 1817 | ;; parallel. |
| 1801 | ;; * Apply SDP on bluetooth devices, in order to filter out obex | 1818 | ;; * Apply SDP on bluetooth devices, in order to filter out obex |