diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-03-27 20:58:05 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-03-27 20:58:05 -0700 |
commit | a36f1c4c25b9da052295ec26ed60fbfbd82339f0 (patch) | |
tree | 6ee4d1381f9d365c458b2d51d9cd672d8554f05b | |
parent | fe848eb41e777ce265f7e6b768c6d9952c11d60b (diff) | |
download | cash-a36f1c4c25b9da052295ec26ed60fbfbd82339f0.tar.gz cash-a36f1c4c25b9da052295ec26ed60fbfbd82339f0.zip |
mailcert.sh: Simplifying localpart-matching logic
-rwxr-xr-x | mailcert.sh | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/mailcert.sh b/mailcert.sh index d3301d5..6002a1e 100755 --- a/mailcert.sh +++ b/mailcert.sh @@ -39,9 +39,7 @@ 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 - USEREMAIL="${BASH_REMATCH[3]}"@"$EMAIL_DEFAULT_DOMAIN" - elif [[ "$USERCERT" =~ (.+/|())(.+)\..+ ]]; then + if [[ "$USERCERT" =~ (.+/|())(.+)(-|\.).+ ]]; then USEREMAIL="${BASH_REMATCH[3]}"@"$EMAIL_DEFAULT_DOMAIN" else echo "Cannot find email address!" |