diff options
author | user <user@Nokia-N900-42-11.(none)> | 2011-03-27 21:10:57 -0700 |
---|---|---|
committer | user <user@Nokia-N900-42-11.(none)> | 2011-03-27 21:10:57 -0700 |
commit | cd57e60f5b4e73e6300df682824611247fe68aaf (patch) | |
tree | c7d97a69fede64d612095f6b13d675ed948c17cd /mailcert.sh | |
parent | a36f1c4c25b9da052295ec26ed60fbfbd82339f0 (diff) | |
download | cash-cd57e60f5b4e73e6300df682824611247fe68aaf.tar.gz cash-cd57e60f5b4e73e6300df682824611247fe68aaf.zip |
Revert "mailcert.sh: Simplifying localpart-matching logic"
This reverts commit a36f1c4c25b9da052295ec26ed60fbfbd82339f0.
Diffstat (limited to 'mailcert.sh')
-rwxr-xr-x | mailcert.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mailcert.sh b/mailcert.sh index 6002a1e..d3301d5 100755 --- a/mailcert.sh +++ b/mailcert.sh @@ -39,7 +39,9 @@ CACERT="$CA"/ca/"$CA".crt # attempt to work out where to send the certificate if ! [ "$USEREMAIL" ]; then # address from cmdline if ! USEREMAIL="$(openssl x509 -in "$USERCERT" -text | sed -ne '{s/.*Subject.\+emailAddress=\(.\+\)/\1/p}' | head -n 1 | grep . )"; then # address from cert - if [[ "$USERCERT" =~ (.+/|())(.+)(-|\.).+ ]]; then + if [[ "$USERCERT" =~ (.+/|())(.+)-.+ ]]; then + USEREMAIL="${BASH_REMATCH[3]}"@"$EMAIL_DEFAULT_DOMAIN" + elif [[ "$USERCERT" =~ (.+/|())(.+)\..+ ]]; then USEREMAIL="${BASH_REMATCH[3]}"@"$EMAIL_DEFAULT_DOMAIN" else echo "Cannot find email address!" |