X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=smime.c;h=a5d2fbc90e452d08ed07e0d02af0498b0f284879;hp=554f02e29a0b19d684953e56cf059f99633ef386;hb=207c707f2c7073a6fbd14124197a559d9d471f65;hpb=7f7a0be369840b290248e5b0302beb447fa1b3cd diff --git a/smime.c b/smime.c index 554f02e..a5d2fbc 100644 --- a/smime.c +++ b/smime.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "mutt.h" #include "enter.h" @@ -93,7 +94,7 @@ static char SmimeIntermediateToUse[_POSIX_PATH_MAX]; void smime_void_passphrase (void) { - memset (SmimePass, 0, sizeof (SmimePass)); + p_clear(SmimePass, sizeof(SmimePass)); SmimeExptime = 0; } @@ -147,7 +148,7 @@ static const char *_mutt_fmt_smime_command (char *dest, char buf1[LONG_STRING], buf2[LONG_STRING]; struct stat sb; - strfcpy (path, NONULL (SmimeCALocation), sizeof (path)); + m_strcpy(path, sizeof(path), NONULL(SmimeCALocation)); mutt_expand_path (path, sizeof (path)); mutt_quote_filename (buf1, sizeof (buf1), path); @@ -266,7 +267,7 @@ static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout, struct smime_command_context cctx; char cmd[HUGE_STRING]; - memset (&cctx, 0, sizeof (cctx)); + p_clear(&cctx, 1); if (!format || !*format) return (pid_t) - 1; @@ -375,7 +376,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) } fclose (index); - FOREVER { + for (;;) { *qry = 0; if (mutt_get_field (prompt, qry, sizeof (qry), 0)) return NULL; @@ -409,8 +410,8 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) Table[cur].hash = hash; Table[cur].suffix = hash_suffix; - strncpy (Table[cur].email, fields[0], sizeof (Table[cur].email)); - strncpy (Table[cur].nick, fields[2], sizeof (Table[cur].nick)); + m_strcpy(Table[cur].email, sizeof(Table[cur].email), fields[0]); + m_strcpy(Table[cur].nick, sizeof(Table[cur].nick), fields[2]); Table[cur].trust = *fields[4]; Table[cur].public = public; @@ -512,7 +513,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, } while (fgets (buf, sizeof (buf) - 1, fp) != NULL) - if (mailbox && !(str_ncasecmp (mailbox, buf, addr_len))) { + if (mailbox && !(m_strncasecmp(mailbox, buf, addr_len))) { numFields = sscanf (buf, MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " " @@ -552,7 +553,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, continue; } else if (choice == M_YES) { - strfcpy (key, fields[1], sizeof (key)); + m_strcpy(key, sizeof(key), fields[1]); ask = 0; break; } @@ -560,7 +561,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, else { if (public) key_trust_level = *fields[4]; - strfcpy (key, fields[1], sizeof (key)); + m_strcpy(key, sizeof(key), fields[1]); } found = 1; } @@ -574,15 +575,15 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, /* query = label: return certificate. */ if (numFields >= 3 && - !(str_ncasecmp (query, fields[2], query_len))) { + !(m_strncasecmp(query, fields[2], query_len))) { ask = 0; - strfcpy (key, fields[1], sizeof (key)); + m_strcpy(key, sizeof(key), fields[1]); } /* query = certificate: return intermediate certificate. */ else if (numFields >= 4 && - !(str_ncasecmp (query, fields[1], query_len))) { + !(m_strncasecmp(query, fields[1], query_len))) { ask = 0; - strfcpy (key, fields[3], sizeof (key)); + m_strcpy(key, sizeof(key), fields[3]); } } @@ -649,7 +650,7 @@ void _smime_getkeys (char *mailbox) if (k) { /* the key used last time. */ if (*SmimeKeyToUse && - !str_casecmp (k, SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) { + !m_strcasecmp(k, SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) { p_delete(&k); return; } @@ -662,7 +663,7 @@ void _smime_getkeys (char *mailbox) snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s", NONULL (SmimeCertificates), k); - if (str_casecmp (k, SmimeDefaultKey)) + if (m_strcasecmp(k, SmimeDefaultKey)) smime_void_passphrase (); p_delete(&k); @@ -670,7 +671,7 @@ void _smime_getkeys (char *mailbox) } if (*SmimeKeyToUse) { - if (!str_casecmp (SmimeDefaultKey, + if (!m_strcasecmp(SmimeDefaultKey, SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) return; @@ -834,7 +835,7 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, while ((fgets (email, sizeof (email), fpout))) { *(email + m_strlen(email) - 1) = '\0'; - if (str_ncasecmp (email, mailbox, m_strlen(mailbox)) == 0) + if (m_strncasecmp(email, mailbox, m_strlen(mailbox)) == 0) ret = 1; ret = ret < 0 ? 0 : ret; @@ -1564,7 +1565,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile) rewind (smimeerr); line = mutt_read_line (line, &linelen, smimeerr, &lineno); - if (linelen && !str_casecmp (line, "verification successful")) + if (linelen && !m_strcasecmp(line, "verification successful")) badsig = 0; p_delete(&line); @@ -1778,7 +1779,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) rewind (smimeerr); line = mutt_read_line (line, &linelen, smimeerr, &lineno); - if (linelen && !str_casecmp (line, "verification successful")) + if (linelen && !m_strcasecmp(line, "verification successful")) m->goodsig = 1; p_delete(&line); } @@ -1813,7 +1814,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur) if (b->parts) return -1; - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = fpin; fseeko (s.fpin, b->offset, 0);