aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto>2005-08-07 15:24:07 +0000
committerrhatto <rhatto>2005-08-07 15:24:07 +0000
commit36fe5864c11681361d7c11cbede726c43ae17082 (patch)
tree8dda6fbeca68d10ffd69e8b0afda4e358ee51523
parentde1fd94358e27682736755fac6f98500c86dc7cf (diff)
downloadfirma-36fe5864c11681361d7c11cbede726c43ae17082.tar.gz
firma-36fe5864c11681361d7c11cbede726c43ae17082.tar.bz2
alteracao das funcoes anteriormente modificadas
-rwxr-xr-xfirma39
1 files changed, 20 insertions, 19 deletions
diff --git a/firma b/firma
index e7582c1..e81b6f3 100755
--- a/firma
+++ b/firma
@@ -91,30 +91,31 @@ function get_subscribers_list {
}
function get_message {
- n=0
+ LINES=0
while read STDIN; do
- MESSAGE[$n]="$STDIN\n"
- ((++n))
+ MESSAGE[$LINES]="$STDIN\n"
+ ((++LINES))
done
- echo $n
}
function get_gpg_message {
signal=0
- x=0; n=$1
- for ((count=0;count<=n;count++)); do
- if [[ $signal == "0" ]] && [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----BEGIN PGP MESSAGE-----")" == "" ]]; then
- GPG_MESSAGE[$x]=${MESSAGE[$count]}
- ((++x))
- signal=1
- elif [[ $signal == "1" ]]; then
- GPG_MESSAGE[$x]=${MESSAGE[$count]}
- ((++x))
- if [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----END PGP MESSAGE-----")" == "" ]]; then
- signal=0
+ if [ ! -z "$LINES" ]; then
+ x=0; n=$LINES
+ for ((count=0;count<=n;count++)); do
+ if [[ $signal == "0" ]] && [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----BEGIN PGP MESSAGE-----")" == "" ]]; then
+ GPG_MESSAGE[$x]=${MESSAGE[$count]}
+ ((++x))
+ signal=1
+ elif [[ $signal == "1" ]]; then
+ GPG_MESSAGE[$x]=${MESSAGE[$count]}
+ ((++x))
+ if [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----END PGP MESSAGE-----")" == "" ]]; then
+ signal=0
+ fi
fi
- fi
- done
+ done
+ fi
}
function get_message_headers {
@@ -184,9 +185,9 @@ $DATE
function process_message {
# process a message sent to the list
- lines=`get_message`
+ get_message
get_message_headers
- get_gpg_message $lines
+ get_gpg_message
# if signature is Good, encrypt and send it for each list subscriber
# todo: declare a function to decrypt, re-encrypt and send the list messages