Fix Key search
Signed-off-by: Tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
parent
8ca48344a8
commit
9fcb7dc001
2 changed files with 11 additions and 8 deletions
17
src/attach.c
17
src/attach.c
|
@ -57,6 +57,10 @@ struct email_t* mail_from_text(char* message, size_t length,
|
||||||
char * mime_type = get_value_from_key(&value_length,
|
char * mime_type = get_value_from_key(&value_length,
|
||||||
cont_type - mail->message, mail);
|
cont_type - mail->message, mail);
|
||||||
if(mime_type != NULL){
|
if(mime_type != NULL){
|
||||||
|
if(verbose){
|
||||||
|
printf("Found content type: %.*s\n",
|
||||||
|
value_length, mime_type);
|
||||||
|
}
|
||||||
if(strncasecmp(mime_type, MULTIPART_MIME,
|
if(strncasecmp(mime_type, MULTIPART_MIME,
|
||||||
strlen(MULTIPART_MIME)) == 0){
|
strlen(MULTIPART_MIME)) == 0){
|
||||||
/* We have multiple messages cramped inside this
|
/* We have multiple messages cramped inside this
|
||||||
|
@ -104,14 +108,13 @@ void redetect_body_head(struct email_t* mail){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In that case we only have a body and no header, or something along
|
/* Really this is something that SHOULD NOT HAPPEN during transport, but
|
||||||
* those lines... In any case, if postfix delivers that to us, something
|
* enigmail produces a weirdly formatted signing here which has ONLY a
|
||||||
* is probably wrong!
|
* header and no body. So we need that for multipart messages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(body_start == NULL) {
|
if(body_start == NULL) {
|
||||||
fprintf(stderr, "Received message without header!\n");
|
mail->header_len = mail->message_length;
|
||||||
mail->header_len = 0;
|
|
||||||
mail->body_offset = 0;
|
mail->body_offset = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -242,12 +245,12 @@ char* attach_files(char* message, size_t len){
|
||||||
}
|
}
|
||||||
/* Check if mails are signed/encrypted, and abort if nescessary */
|
/* Check if mails are signed/encrypted, and abort if nescessary */
|
||||||
if(abort_on_pgp && detect_pgp(email)){
|
if(abort_on_pgp && detect_pgp(email)){
|
||||||
printf("PGP detected, aborting...");
|
printf("PGP detected, aborting...\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
/* Check if mails are signed/encrypted, and abort if nescessary */
|
/* Check if mails are signed/encrypted, and abort if nescessary */
|
||||||
if(abort_on_dkim && detect_dkim(email)){
|
if(abort_on_dkim && detect_dkim(email)){
|
||||||
printf("DKIM signature detected, aborting...");
|
printf("DKIM signature detected, aborting...\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ char* search_header_key(struct email_t* mail, const char* key){
|
||||||
size_t keylen = strlen(key);
|
size_t keylen = strlen(key);
|
||||||
|
|
||||||
for(size_t i = 0; i < (mail->header_len - keylen); i++){
|
for(size_t i = 0; i < (mail->header_len - keylen); i++){
|
||||||
if(mail->message[i] == '\n'){
|
if(mail->message[i] == '\n' || i == 0){
|
||||||
if(strncasecmp(&mail->message[i+1], key, keylen) == 0){
|
if(strncasecmp(&mail->message[i+1], key, keylen) == 0){
|
||||||
return &mail->message[i+1];
|
return &mail->message[i+1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue