Commit 35c3d36e authored by Michael Albinus's avatar Michael Albinus
Browse files

* 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.
parent 9a650e62
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.
......
......@@ -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))
......
......@@ -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)
......
......@@ -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.
......
......@@ -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))
......
......@@ -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))
......
......@@ -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))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment