From dba1e3dc7e8fc4dca3ccf206840ebaa89e91ed58 Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 10 Oct 2006 20:42:14 +0000 Subject: started to code EmailAdminTask --- firma | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'firma') diff --git a/firma b/firma index 18264fe..90bf9d4 100755 --- a/firma +++ b/firma @@ -780,7 +780,7 @@ function ProcessMessage { GetSenderAddress - if [[ -n $(echo $LIST_ADMINS) || -n "$SENDER_ADDRESS" ]]; then + if [[ -n $(echo $LIST_ADMIN) || -n "$SENDER_ADDRESS" ]]; then ComposeAndSendWarningMessage fi @@ -1750,7 +1750,8 @@ function EmailAdminTask { # parse and execute admin tasks via email # # parameter(s): none - # depends on function(s): none + # depends on function(s): GetMessage, GetGpgMessage, GetSubscribersList, + # GetSenderAddress # returns: 0 on success :) # 1 on failure :/ #------------------------------------------------------------- @@ -1762,8 +1763,43 @@ function EmailAdminTask { # - call admin functions local -i return_code=0 + local sender found + ADMIN_MODE="non-interactive" + #TODO: else cases + # try to read message from STDIN + if GetMessage; then + + # check if the message was encrypted + if GetGpgMessage; then + + # if it was, parse gpg decrypt STDERR to decide what to do next + ParseGpgDecryptStderr + + # if the message was encrypted with the list's public key and + #+if the message signature is valid + if [[ $ENCRYPTED_TO_LIST == 1 && $GOOD_SIGNATURE == 1 ]]; then + GetSenderAddress + found=0 + for sender in $LIST_ADMIN; do + if [ "$sender" == "$SENDER_ADDRESS" ]; then + found=1 + break + fi + done + # TODO: check if the signature was made with the sender address pubkey + if [ "$found" == "1" ]; then + # message was sent by an admin + true + else + # message was sent by a normal subscriber + false + fi + fi + fi + fi + return $return_code } -- cgit v1.2.3