Function: tramp-ssh-controlmaster-options

tramp-ssh-controlmaster-options is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-ssh-controlmaster-options VEC)

Documentation

Return the Control* arguments of the local ssh.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-ssh-controlmaster-options (vec)
  "Return the Control* arguments of the local ssh."
  (cond
   ;; No options to be computed.
   ((or (null tramp-use-ssh-controlmaster-options)
	(null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args))))
    "")

   ;; There is already a value to be used.
   ((and (eq tramp-use-ssh-controlmaster-options t)
         (stringp tramp-ssh-controlmaster-options))
    tramp-ssh-controlmaster-options)

   ;; We can't auto-compute the options.
   ((ignore-errors
      (not (tramp-ssh-option-exists-p vec "ControlMaster=auto")))
    "")

   ;; Determine the options.
   (t (ignore-errors
        ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9.
        (concat
         "-o ControlMaster="
         (if (eq tramp-use-ssh-controlmaster-options 'suppress)
             "no" "auto")

         " -o ControlPath="
         (if (eq tramp-use-ssh-controlmaster-options 'suppress)
             "none"
           ;; Hashed tokens are introduced in OpenSSH 6.7.
	   (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
	       "tramp.%%C" "tramp.%%r@%%h:%%p"))

         ;; ControlPersist option is introduced in OpenSSH 5.6.
	 (when (and (not (eq tramp-use-ssh-controlmaster-options 'suppress))
                    (tramp-ssh-option-exists-p vec "ControlPersist=no"))
	   " -o ControlPersist=no"))))))