]> gitweb.fluxo.info Git - firma.git/commitdiff
added back MimeWrapMessage; admin replies are now sent encrypted
authorrhatto <rhatto>
Thu, 12 Oct 2006 13:53:36 +0000 (13:53 +0000)
committerrhatto <rhatto>
Thu, 12 Oct 2006 13:53:36 +0000 (13:53 +0000)
firma

diff --git a/firma b/firma
index 713659bcdb8f3041935bcc44e384775be4b3e69d..0cc1983985a7bedf9af19267850b46e9b6324787 100755 (executable)
--- a/firma
+++ b/firma
@@ -1826,8 +1826,9 @@ function EmailListAdministration {
         ListAdministration $command
       fi
     done`"
-    # TODO: send encrypted
-    ComposeAndSendBounceMessage
+    GPG_MESSAGE="`echo -e "${PASSPHRASE}\n${MESSAGE_BODY}" | $GPG_ENCRYPT --recipient $SENDER_ADDRESS`"
+    MimeWrapMessage
+    echo "$MESSAGE" | $MAIL_AGENT $MAIL_AGENT_ARGS
   else
     # message was sent by a normal subscriber
     # this is the body of the message to be sent, so no indentation here
@@ -1874,6 +1875,58 @@ function AllowMessageProcessing {
   return $return_code
 }
 
+
+function MimeWrapMessage {
+  #-------------------------------------------------------------
+  # MIME wrap message to be sent, adding needed headers and body parts
+  #
+  # parameter(s): none
+  # depends on variable(s): RECIPIENTS, SUBJECT, GPG_MESSAGE
+  #
+  # returns: 0
+  #-------------------------------------------------------------
+
+  local boundary
+
+  boundary="`RandomString 15`"
+
+  # these are the headers of the message to be sent, so no indentation here
+  MESSAGE_HEADERS="\
+From: $LIST_ADDRESS
+To: ${RECIPIENTS}
+Reply-To: $LIST_ADDRESS
+Subject: ${SUBJECT_PREFIX}${SUBJECT}
+MIME-Version: 1.0
+Content-Type: multipart/encrypted;
+  protocol=\"application/pgp-encrypted\";
+  boundary=\"${boundary}\"
+Content-Disposition: inline"
+
+  # this is the body of the message to be sent, so no indentation here
+  MESSAGE_BODY="\
+This is an OpenPGP/MIME encrypted message (RFC 2440 and 3156)
+--$boundary
+Content-Type: application/pgp-encrypted
+Content-Description: PGP/MIME version identification
+
+Version: 1
+
+--$boundary
+Content-Type: application/octet-stream; name=\"encrypted.asc\"
+Content-Disposition: inline; filename=\"encrypted.asc\"
+Content-Description: OpenPGP encrypted message
+
+${GPG_MESSAGE}
+
+--${boundary}--"
+
+  # assemble entire message
+  MESSAGE="\
+${MESSAGE_HEADERS}
+
+${MESSAGE_BODY}"
+}
+
 #-------------------------------------------------------------
 # main()
 #-------------------------------------------------------------
@@ -1950,7 +2003,8 @@ FUNCTIONS="
   FixOwnership
   RandomString
   AdminLog
-  EmailListAdministration"
+  EmailListAdministration
+  MimeWrapMessage"
 
 for VAR in $GLOBAL_VARS; do
   declare $VAR