[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64296: 30.0.50; problem with gnus-summary-resend-message
From: |
Andrew Cohen |
Subject: |
bug#64296: 30.0.50; problem with gnus-summary-resend-message |
Date: |
Tue, 27 Jun 2023 15:10:51 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>>>> "PM" == Peter Münster <pm@a16n.net> writes:
PM> Hi, When using "gnus-summary-resend-message" (keypress "SDr") on
PM> a message with such a header: "To: undisclosed-recipients:;" ,
PM> the function stops with an error:
PM> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
PM> string-match("@" nil 0) split-string(nil "@")
PM> textsec-email-address-suspicious-p(nil)
PM> textsec-email-address-header-suspicious-p("undisclosed-recipients:;")
PM> textsec-suspicious-p("undisclosed-recipients:;"
PM> email-address-header) message-send-mail()
PM> message-resend("email@address.com")
PM> gnus-summary-resend-message("email@address.com" nil)
PM> funcall-interactively(gnus-summary-resend-message
PM> "email@address.com" nil)
PM> call-interactively(gnus-summary-resend-message nil nil)
PM> command-execute(gnus-summary-resend-message)
PM> How could this be fixed please?
The problem is in the parsing of email headers. According to RFC5322 the
"To", "Cc", and "Bcc" headers may contain a comma-separated list of
addresses, where an address is either a mailbox or a group. A group is
an identifier followed by a list of mailboxes (this list is sandwiched
between a colon and a semi-colon). For example in your case the
identifier is "undisclosed-recipients" and the list of mailboxes is
empty.
It appears that this group syntax for these headers is simply not
implemented. I have tried a quick hack to get this working. Can you
replace `ietf-drums-parse-addresses' with the function definition below
and see if that works? I have only done some very rudimentary testing
so it is possible that it fails to properly parse some existing headers.
#+begin_src emacs-lisp
(defun ietf-drums-parse-addresses (string &optional rawp)
"Parse STRING and return a list of MAILBOX / DISPLAY-NAME pairs.
If RAWP, don't actually parse the addresses, but instead return
a list of address strings."
(if (null string)
nil
(with-temp-buffer
(ietf-drums-init string)
(let ((beg (point))
pairs c address)
(while (not (eobp))
(setq c (char-after))
(cond
((eq c '?:)
(setq beg (1+ (point)))
(skip-chars-forward "^;")
(when-let ((address
(condition-case nil
(ietf-drums-parse-addresses
(buffer-substring beg (point)) rawp)
(error nil))))
(if (listp address)
(setq pairs (append address pairs))
(push address pairs)))
(forward-char 1)
(setq beg (point)))
((memq c '(?\" ?< ?\())
(condition-case nil
(forward-sexp 1)
(error
(skip-chars-forward "^,"))))
((eq c ?,)
(setq address
(if rawp
(buffer-substring beg (point))
(condition-case nil
(ietf-drums-parse-address
(buffer-substring beg (point)))
(error nil))))
(when (or (consp address) (and (stringp address) (< 0 (length
address))))
(push address pairs))
(forward-char 1)
(setq beg (point)))
(t
(forward-char 1))))
(setq address
(if rawp
(buffer-substring beg (point))
(condition-case nil
(ietf-drums-parse-address
(buffer-substring beg (point)))
(error nil))))
(when (or (consp address) (and (stringp address) (< 0 (length
address))))
(push address pairs))
(nreverse pairs)))))
#+end_src
--
Andrew Cohen