Ver código fonte

Only convert LF to CRLF when encrypting with S/MIME

When only signing with S/MIME, `message-encode-message-body` complained about
not being able to find \n\n.  However, we only need the conversion when
encrypting with S/MIME, and apparently the LF → CRLF conversion hack is working
in that case.

However, I think there should be some way to fix this properly within Gnus,
maybe via some configuration … I think I have to write to the Gnus Usenet group
for this.
master
Daniel 2 meses atrás
pai
commit
5348856628
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados
1 arquivos alterados com 15 adições e 3 exclusões
  1. 15
    3
      init.el

+ 15
- 3
init.el Ver arquivo

@@ -1750,11 +1750,23 @@
1750 1750
   :config (progn
1751 1751
             ;; Outlook seems to expect \r\n in PKCS#7 encrypted containers, but
1752 1752
             ;; Gnus is only sending \n; so let's artificially replace \n by \r\n
1753
-            ;; after, well, signing?  Seems to work at least in the case where
1754
-            ;; we are sending S/MIME encrypted and signed messages.
1753
+            ;; after, well, signing?  But only if we are encrypting with S/MIME,
1754
+            ;; as otherwise the search for \n\n in `message-encode-message-body'
1755
+            ;; will break.  However, I think this is not the right way to do it
1756
+            ;; … isn't there some way to specify the encoding of the the
1757
+            ;; relevant MML buffers to be some nasty cp1252 or something?
1758
+
1759
+            ;; A previous version of this worked, but the following has not been
1760
+            ;; tested with Outlook proper.
1761
+
1762
+            (defun db/smime-add-crlf-when-pkcs7 (cont)
1763
+              "If CONT signifies encryption with smime, replace all \n with \r\n."
1764
+              (when (and (eq (car cont) 'part)
1765
+                         (string= "smime" (or (cdr (assq 'encrypt cont)) "")))
1766
+                (db/convert-lf-to-crlf-in-buffer)))
1755 1767
 
1756 1768
             (advice-add 'mml-smime-epg-sign
1757
-                        :after #'db/convert-lf-to-crlf-in-buffer) ))
1769
+                        :after #'db/smime-add-crlf-when-pkcs7)))
1758 1770
 
1759 1771
 ;; Archiving
1760 1772
 

Carregando…
Cancelar
Salvar