diff options
-rwxr-xr-x | firma | 40 |
1 files changed, 38 insertions, 2 deletions
@@ -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 } |