diff options
author | rhatto <rhatto> | 2006-10-10 20:42:14 +0000 |
---|---|---|
committer | rhatto <rhatto> | 2006-10-10 20:42:14 +0000 |
commit | dba1e3dc7e8fc4dca3ccf206840ebaa89e91ed58 (patch) | |
tree | 14f4c11a0f81dc6746d24721d9ce7f85aa9d6bcd | |
parent | 6c9997eaa2d3261ef461fa7d18255d1eff46d180 (diff) | |
download | firma-dba1e3dc7e8fc4dca3ccf206840ebaa89e91ed58.tar.gz firma-dba1e3dc7e8fc4dca3ccf206840ebaa89e91ed58.tar.bz2 |
started to code EmailAdminTask
-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 } |