Function: nsm-should-check

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

Signature

(nsm-should-check HOST)

Documentation

Determine whether NSM should check for TLS problems for HOST.

If nsm-trust-local-network is or returns non-nil, and if the host address is a localhost address, or in the same subnet as one of the local interfaces, this function returns nil. Non-nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/net/nsm.el.gz
(defun nsm-should-check (host)
  "Determine whether NSM should check for TLS problems for HOST.

If `nsm-trust-local-network' is or returns non-nil, and if the
host address is a localhost address, or in the same subnet as one
of the local interfaces, this function returns nil.  Non-nil
otherwise."
  (let ((addresses (network-lookup-address-info host))
        (network-interface-list (network-interface-list t))
        (off-net t))
    (when
     (or (and (functionp nsm-trust-local-network)
              (funcall nsm-trust-local-network))
         nsm-trust-local-network)
     (mapc
      (lambda (ip)
        (mapc
         (lambda (info)
           (let ((local-ip (nth 1 info))
                 (mask (nth 3 info)))
             (when
                 (nsm-network-same-subnet (substring local-ip 0 -1)
                                          (substring mask 0 -1)
                                          (substring ip 0 -1))
               (setq off-net nil))))
         network-interface-list))
      addresses))
     off-net))