diff options
Diffstat (limited to 'lisp/international/textsec.el')
-rw-r--r-- | lisp/international/textsec.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el index 8095733e097..d0d435ed7dc 100644 --- a/lisp/international/textsec.el +++ b/lisp/international/textsec.el @@ -26,6 +26,8 @@ (require 'cl-lib) (require 'uni-confusable) (require 'ucs-normalize) +(require 'idna-mapping) +(require 'puny) (defvar textsec--char-scripts nil) @@ -222,6 +224,18 @@ STRING isn't a single script string." (textsec-single-script-p string1) (textsec-single-script-p string2))) +(defun textsec-domain-suspicious-p (domain) + (catch 'found + (seq-do + (lambda (char) + (when (eq (elt idna-mapping-table char) t) + (throw 'found (format "Disallowed character: `%s' (#x%x)" + (string char) char)))) + domain) + (unless (puny-highly-restrictive-domain-p domain) + (throw 'found "%s is not highly restrictive")) + nil)) + (provide 'textsec) ;;; textsec.el ends here |