Function: nsm-check-plain-connection

nsm-check-plain-connection is a byte-compiled function defined in nsm.el.gz.

Signature

(nsm-check-plain-connection PROCESS HOST PORT SETTINGS WARN-UNENCRYPTED)

Source Code

;; Defined in /usr/src/emacs/lisp/net/nsm.el.gz
(defun nsm-check-plain-connection (process host port settings warn-unencrypted)
  (if (nsm-should-check host)
      ;; If this connection used to be TLS, but is now plain, then it's
      ;; possible that we're being Man-In-The-Middled by a proxy that's
      ;; stripping out STARTTLS announcements.
      (let ((fingerprints (plist-get settings :fingerprints)))
        (cond
         ((and fingerprints
	       (not (memq :none fingerprints))
	       (not
                (nsm-query
                 host port nil 'conditions '(:unencrypted)
                 (format-message
                  "The connection to %s:%s used to be an encrypted connection, but is now unencrypted.  This might mean that there's a man-in-the-middle tapping this connection."
                  host port))))
          (delete-process process)
          nil)
         ((and warn-unencrypted
	       (not (memq :unencrypted (plist-get settings :conditions)))
	       (not (nsm-query
                     host port nil 'conditions '(:unencrypted)
                     (format-message
                      "The connection to %s:%s is unencrypted."
                      host port))))
          (delete-process process)
          nil)
         (t
          process)))
    process))