* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
if (sig->signature_header != NULL) free(sig->signature_header);
if (sig->sha1_body != NULL) free(sig->sha1_body);
if (sig->sha2_body != NULL) free(sig->sha2_body);
if (sig->signature_header != NULL) free(sig->signature_header);
if (sig->sha1_body != NULL) free(sig->sha1_body);
if (sig->sha2_body != NULL) free(sig->sha2_body);
"start". Returns the position of the header name in
the list. */
int header_name_match(char *header,
"start". Returns the position of the header name in
the list. */
int header_name_match(char *header,
char *hcolon = strchr(header,':');
if (hcolon == NULL) return rc; /* This isn't a header */
hname = malloc((hcolon-header)+1);
if (hname == NULL) return PDKIM_ERR_OOM;
memset(hname,0,(hcolon-header)+1);
strncpy(hname,header,(hcolon-header));
char *hcolon = strchr(header,':');
if (hcolon == NULL) return rc; /* This isn't a header */
hname = malloc((hcolon-header)+1);
if (hname == NULL) return PDKIM_ERR_OOM;
memset(hname,0,(hcolon-header)+1);
strncpy(hname,header,(hcolon-header));
- if (pos >= start) {
- if (strcasecmp(p,hname) == 0) {
- rc = pos;
- goto BAIL;
- }
+
+ if (strcasecmp(p,hname) == 0) {
+ rc = PDKIM_OK;
+ /* Invalidate header name instance in tick-off list */
+ if (do_tick) tick[p-lcopy] = '_';
+ goto BAIL;
- if (pos >= start) {
- if (strcasecmp(p,hname) == 0)
- rc = pos;
+
+ if (strcasecmp(p,hname) == 0) {
+ rc = PDKIM_OK;
+ /* Invalidate header name instance in tick-off list */
+ if (do_tick) tick[p-lcopy] = '_';
- int rc = header_name_match(ctx->cur_header->str,
- sig->headernames,
- sig->headernames_pos);
- /* Header is not included or out-of-sequence */
- if (rc < 0) goto NEXT_SIG;
- sig->headernames_pos = rc;
+ /* Header is not included or all instances were already 'ticked off' */
+ if (header_name_match(ctx->cur_header->str,
+ sig->hnames_check, 1) != PDKIM_OK) goto NEXT_SIG;