acs_mail_lite::ValidBounceSignedId (private)
acs_mail_lite::ValidBounceSignedId address
Defined in packages/acs-mail-lite/tcl/email-inbound-procs.tcl
Returns the verified signed local part, with canonical signature case, or an empty string when validation fails.
- Parameters:
- address (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[string match "<*>" $address]} { set address [string range $address 1 end-1] } # Parse from the signature suffix; the identifier/prefix can contain '-'. # Require matching separators and the unbound signature generated by # unique_id_create. Reject whitespace and extra address delimiters. if {![regexp {^([^@<>\s]+)-([0-9]+)([+-])([0-9]+)\3([[:xdigit:]]{40})@([^@<>\s]+)$} $address unused uid token_id separator expiry hash domain]} { return "" } set prefix [acs_mail_lite::bounce_prefix] if {$prefix eq "" || [string first $prefix $uid] != 0 || ![string equal -nocase $domain [acs_mail_lite::address_domain]]} { return "" } if {![string is integer -strict $token_id]} { return "" } # Fetch the token explicitly: ad_verify_signature in newer OpenACS # versions turns all token-store errors into validation failures. try { set secret_token [sec_get_token $token_id] } on error {message options} { if {$message eq "Invalid token ID" && [dict get $options -errorcode] eq "NONE"} { return "" } return -options $options $message } # SMTP implementations can lowercase the hexadecimal hash. Keep the # signed identifier intact and support either case emitted by ns_sha1. foreach signature_hash [list [string toupper $hash] [string tolower $hash]] { set valid_p [ad_verify_signature -secret $secret_token $uid [list $token_id $expiry $signature_hash]] if {$valid_p} { return "$uid-$token_id$separator$expiry$separator$signature_hash" } } return ""XQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-mail-lite/tcl/email-inbound-procs.xql