summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2013-09-13 08:03:06 +0200
committerMichael Albinus <michael.albinus@gmx.de>2013-09-13 08:03:06 +0200
commit35c3d36e0ed6c7f5104946dd966ca46d0495f640 (patch)
tree3e308e57d3c75c19789061009624d64ca776a901
parent9a650e62c8bd9ab1040db70e22683bc94e918cc8 (diff)
downloademacs-35c3d36e0ed6c7f5104946dd966ca46d0495f640.tar.gz
* net/tramp.el (tramp-check-proper-method-and-host): Rename it from
`tramp-check-proper-host'. Check for a valid method name. * net/tramp-adb.el (tramp-adb-maybe-open-connection): * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): * net/tramp-sh.el (tramp-maybe-open-connection): * net/tramp-smb.el (tramp-smb-maybe-open-connection): Call it. * net/tramp-cache.el (tramp-cache-print): Don't print text properties also for hash values.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/net/tramp-adb.el2
-rw-r--r--lisp/net/tramp-cache.el22
-rw-r--r--lisp/net/tramp-gvfs.el2
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/net/tramp-smb.el2
-rw-r--r--lisp/net/tramp.el12
7 files changed, 37 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7dea339d669..de9b8d91516 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
+2013-09-13 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-check-proper-method-and-host): Rename it from
+ `tramp-check-proper-host'. Check for a valid method name.
+
+ * net/tramp-adb.el (tramp-adb-maybe-open-connection):
+ * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
+ * net/tramp-sh.el (tramp-maybe-open-connection):
+ * net/tramp-smb.el (tramp-smb-maybe-open-connection): Call it.
+
+ * net/tramp-cache.el (tramp-cache-print): Don't print text properties
+ also for hash values.
+
2013-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
* term/ns-win.el (parameters): Don't declare as dynamic.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 595037ab943..132ffaa27a8 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1092,7 +1092,7 @@ FMT and ARGS are passed to `error'."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
- (tramp-check-proper-host vec)
+ (tramp-check-proper-method-and-host vec)
(let* ((buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf))
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index b4e5e4ffd0f..7407f83e92b 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -285,16 +285,18 @@ KEY identifies the connection, it is either a process or a vector."
(let (result)
(maphash
(lambda (key value)
- ;; Remove text properties from KEY.
- (when (vectorp key)
- (dotimes (i (length key))
- (when (stringp (aref key i))
- (aset key i
- (funcall
- ;; `substring-no-properties' does not exist in XEmacs.
- (if (functionp 'substring-no-properties)
- 'substring-no-properties 'identity)
- (aref key i))))))
+ ;; Remove text properties from KEY and VALUE.
+ ;; `substring-no-properties' does not exist in XEmacs.
+ (when (functionp 'substring-no-properties)
+ (when (vectorp key)
+ (dotimes (i (length key))
+ (when (stringp (aref key i))
+ (aset key i (funcall 'substring-no-properties (aref key i))))))
+ (when (stringp key)
+ (setq key (funcall 'substring-no-properties key)))
+ (when (stringp value)
+ (setq value (funcall 'substring-no-properties value))))
+ ;; Dump.
(let ((tmp (format
"(%s %s)"
(if (processp key)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index e764e4767dd..8f79e495420 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1465,7 +1465,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
- (tramp-check-proper-host vec)
+ (tramp-check-proper-method-and-host vec)
;; We set the file name, in case there are incoming D-Bus signals or
;; D-Bus errors.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f91cbb29a1d..e37c34e0df9 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4286,7 +4286,7 @@ Gateway hops are already opened."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
- (tramp-check-proper-host vec)
+ (tramp-check-proper-method-and-host vec)
(let ((p (tramp-get-connection-process vec))
(process-name (tramp-get-connection-property vec "process-name" nil))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 27f3bd41e9c..03ad62be0a5 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1566,7 +1566,7 @@ Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason.
If ARGUMENT is non-nil, use it as argument for
`tramp-smb-winexe-program', and suppress any checks."
- (tramp-check-proper-host vec)
+ (tramp-check-proper-method-and-host vec)
(let* ((share (tramp-smb-get-share vec))
(buf (tramp-get-connection-buffer vec))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fe4f7b8bb54..48420aad5a3 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1265,15 +1265,19 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
lhost)
tramp-default-host))
-(defun tramp-check-proper-host (vec)
- "Check host name of VEC."
+(defun tramp-check-proper-method-and-host (vec)
+ "Check method and host name of VEC."
(let ((method (tramp-file-name-method vec))
(user (tramp-file-name-user vec))
- (host (tramp-file-name-host vec)))
+ (host (tramp-file-name-host vec))
+ (methods (mapcar 'car tramp-methods)))
+ (when (and method (not (member method methods)))
+ (tramp-cleanup-connection vec)
+ (tramp-user-error vec "Unknown method \"%s\"" method))
(when (and (equal tramp-syntax 'ftp) host
(or (null method) (get-text-property 0 'tramp-default method))
(or (null user) (get-text-property 0 'tramp-default user))
- (member host (mapcar 'car tramp-methods)))
+ (member host methods))
(tramp-cleanup-connection vec)
(tramp-user-error vec "Host name must not match method \"%s\"" host))))