1/* Auxiliary DKIM functions. 2 Copyright (C) 2007-2021 Sergey Poznyakoff 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17module 'dkim'. 18 19#pragma regex push +extended 20 21func dkim_signature_tag(string sig, string tag) 22 returns string 23do 24 if sig matches "(^|;)%tag=([^;]+)" 25 return \2 26 fi 27 switch tag 28 do 29 case 'c': 30 return 'simple/simple' 31 case 'q': 32 return 'dns/txt' 33 case 'i': 34 return '@' . dkim_signature_tag(sig, 'd') 35 done 36 return "" 37done 38 39func dkim_verified_signature_tag(string tag) 40 returns string 41do 42 return dkim_signature_tag(dkim_verified_signature, tag) 43done 44 45#pragma regex pop 46