diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-03-28 18:46:25 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-03-28 18:46:25 -0700 |
commit | 54f3c980df8d4f05ac0ff5013870578961d14574 (patch) | |
tree | f438ddb8645942f94d8d7913333d4125038f5a7f | |
parent | 94486adcec799489c9d4118ea36152327e975584 (diff) | |
parent | cd57e60f5b4e73e6300df682824611247fe68aaf (diff) | |
download | cash-54f3c980df8d4f05ac0ff5013870578961d14574.tar.gz cash-54f3c980df8d4f05ac0ff5013870578961d14574.zip |
Merge branch 'master' of piny.be:/srv/git/cash
-rwxr-xr-x | mailcert.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mailcert.sh b/mailcert.sh index 33a8467..7767be6 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!" |