X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=crypt.c;h=c0c64ad4ab46d6edc3552251d4c3722ef2df23b9;hp=402a497dea615ed70386aaf3327775ef543c3450;hb=83532821ae9fab034d0d630b78330c9ea4ff4cf3;hpb=f5b0e714a215eddd4d9f8084b434b713f0a580b4 diff --git a/crypt.c b/crypt.c index 402a497..c0c64ad 100644 --- a/crypt.c +++ b/crypt.c @@ -16,18 +16,21 @@ # include "config.h" #endif +#include +#include +#include +#include +#include + +#include + #include "mutt.h" -#include "ascii.h" #include "handler.h" #include "mutt_curses.h" -#include "mime.h" #include "copy.h" #include "mutt_crypt.h" #include "pgp.h" -#include "lib/mem.h" -#include "lib/intl.h" -#include "lib/str.h" #include #include @@ -51,7 +54,7 @@ /* print the current time to avoid spoofing of the signature output */ -void crypt_current_time (STATE * s, char *app_name) +void crypt_current_time (STATE * s, const char *app_name) { time_t t; char p[STRING], tmp[STRING]; @@ -388,7 +391,7 @@ int mutt_is_application_smime (BODY * m) /* no .p7c, .p10 support yet. */ - len = str_len (t) - 4; + len = m_strlen(t) - 4; if (len > 0 && *(t + len) == '.') { len++; if (!ascii_strcasecmp ((t + len), "p7m")) @@ -487,7 +490,7 @@ int crypt_write_signed (BODY * a, STATE * s, const char *tempfile) return -1; } - fseek (s->fpin, a->hdr_offset, 0); + fseeko (s->fpin, a->hdr_offset, 0); bytes = a->length + a->offset - a->hdr_offset; hadcr = 0; while (bytes > 0) { @@ -530,7 +533,7 @@ void convert_to_7bit (BODY * a) convert_to_7bit (a->parts); } else if (a->type == TYPEMESSAGE && - str_casecmp (a->subtype, "delivery-status")) { + m_strcasecmp(a->subtype, "delivery-status")) { if (a->encoding != ENC7BIT) mutt_message_to_7bit (a, NULL); } @@ -553,7 +556,7 @@ void crypt_extract_keys_from_messages (HEADER * h) { int i; char tempfname[_POSIX_PATH_MAX], *mbox; - ADDRESS *tmp = NULL; + address_t *tmp = NULL; FILE *fpout; if (!WithCrypto) @@ -697,7 +700,7 @@ int crypt_get_keys (HEADER * msg, char **keylist) -static void crypt_fetch_signatures (BODY *** signatures, BODY * a, int *n) +static void crypt_fetch_signatures (BODY ***signatures, BODY * a, int *n) { if (!WithCrypto) return; @@ -707,7 +710,7 @@ static void crypt_fetch_signatures (BODY *** signatures, BODY * a, int *n) crypt_fetch_signatures (signatures, a->parts, n); else { if ((*n % 5) == 0) - mem_realloc (signatures, (*n + 6) * sizeof (BODY **)); + p_realloc(signatures, *n + 6); (*signatures)[(*n)++] = a; } @@ -748,7 +751,7 @@ int mutt_signed_handler (BODY * a, STATE * s) if ((protocol_minor = strchr (protocol, '/'))) protocol_minor++; - strfcpy (major, protocol, sizeof (major)); + m_strcpy(major, sizeof(major), protocol); if ((t = strchr (major, '/'))) *t = '\0'; @@ -758,7 +761,7 @@ int mutt_signed_handler (BODY * a, STATE * s) /* consistency check */ if (!(a && a->next && a->next->type == protocol_major && - !str_casecmp (a->next->subtype, protocol_minor))) { + !m_strcasecmp(a->next->subtype, protocol_minor))) { state_attach_puts (_("[-- Error: " "Inconsistent multipart/signed structure! --]\n\n"), s); @@ -768,13 +771,13 @@ int mutt_signed_handler (BODY * a, STATE * s) if ((WithCrypto & APPLICATION_PGP) && protocol_major == TYPEAPPLICATION - && !str_casecmp (protocol_minor, "pgp-signature")); + && !m_strcasecmp(protocol_minor, "pgp-signature")); else if ((WithCrypto & APPLICATION_SMIME) && protocol_major == TYPEAPPLICATION - && !(str_casecmp (protocol_minor, "x-pkcs7-signature") - && str_casecmp (protocol_minor, "pkcs7-signature"))); + && !(m_strcasecmp(protocol_minor, "x-pkcs7-signature") + && m_strcasecmp(protocol_minor, "pkcs7-signature"))); else if (protocol_major == TYPEMULTIPART - && !str_casecmp (protocol_minor, "mixed")); + && !m_strcasecmp(protocol_minor, "mixed")); else { state_printf (s, _("[-- Error: " "Unknown multipart/signed protocol %s! --]\n\n"), @@ -792,7 +795,7 @@ int mutt_signed_handler (BODY * a, STATE * s) for (i = 0; i < sigcnt; i++) { if ((WithCrypto & APPLICATION_PGP) && signatures[i]->type == TYPEAPPLICATION - && !str_casecmp (signatures[i]->subtype, "pgp-signature")) { + && !m_strcasecmp(signatures[i]->subtype, "pgp-signature")) { if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0) goodsig = 0; @@ -802,8 +805,8 @@ int mutt_signed_handler (BODY * a, STATE * s) if ((WithCrypto & APPLICATION_SMIME) && signatures[i]->type == TYPEAPPLICATION && - (!str_casecmp (signatures[i]->subtype, "x-pkcs7-signature") - || !str_casecmp (signatures[i]->subtype, + (!m_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature") + || !m_strcasecmp(signatures[i]->subtype, "pkcs7-signature"))) { if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0) goodsig = 0; @@ -826,7 +829,7 @@ int mutt_signed_handler (BODY * a, STATE * s) state_attach_puts (_("[-- The following data is signed --]\n\n"), s); - mem_free (&signatures); + p_delete(&signatures); } else state_attach_puts (_("[-- Warning: Can't find any signatures. --]\n\n"),