Function: tramp-ssh-or-plink-options

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

Signature

(tramp-ssh-or-plink-options VEC)

Documentation

Return additional arguments of the local ssh or plink.

Source Code

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

   ;; Use plink options.
   ((string-match-p
     (rx "plink" (? ".exe") eol)
     (tramp-get-method-parameter vec 'tramp-login-program))
    (concat
     (if (eq tramp-use-connection-share 'suppress)
	 "-noshare" "-share")
     ;; Since PuTTY 0.82.
     (when (tramp-plink-option-exists-p vec "-legacy-stdio-prompts")
       " -legacy-stdio-prompts")))

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

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

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

	 " -o ControlPath="
	 (if (eq tramp-use-connection-share 'suppress)
             "none"
           ;; Hashed tokens are introduced in OpenSSH 6.7.  On macOS
           ;; we cannot use an absolute file name, it is too long.
           ;; See Bug#19702.
	   (if (eq system-type 'darwin)
	       (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
		   "tramp.%%C" "tramp.%%r@%%h:%%p")
	     (expand-file-name
	      (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
		  "tramp.%%C" "tramp.%%r@%%h:%%p")
	      (or small-temporary-file-directory
		  tramp-compat-temporary-file-directory))))

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

   ;; Return a string, whatsoever.
   (t "")))