/*
+ * Copyright notice from original mutt:
* Copyright (C) 2001,2002 Oliver Ehli <elmy@acm.org>
* Copyright (C) 2002 Mike Schiraldi <raldi@research.netsol.com>
* Copyright (C) 2004 g10 Code GmbH
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
*/
#if HAVE_CONFIG_H
#include "mime.h"
#include "copy.h"
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/debug.h"
+
#include <sys/wait.h>
#include <string.h>
#include <stdlib.h>
{
mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_smime_command,
(unsigned long) cctx, 0);
- dprint (2, (debugfile, "mutt_smime_command: %s\n", d));
+ debug_print (2, ("%s\n", d));
}
-
-
-
static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
FILE ** smimeerr, int smimeinfd, int smimeoutfd,
int smimeerrfd, const char *fname,
continue;
/* Check if query matches this certificate */
- if (!mutt_stristr (fields[0], qry) && !mutt_stristr (fields[2], qry))
+ if (!str_isstr (fields[0], qry) && !str_isstr (fields[2], qry))
continue;
Table[cur].hash = hash;
}
while (fgets (buf, sizeof (buf) - 1, fp) != NULL)
- if (mailbox && !(mutt_strncasecmp (mailbox, buf, addr_len))) {
+ if (mailbox && !(safe_strncasecmp (mailbox, buf, addr_len))) {
numFields = sscanf (buf,
MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
/* query = label: return certificate. */
if (numFields >= 3 &&
- !(mutt_strncasecmp (query, fields[2], query_len))) {
+ !(safe_strncasecmp (query, fields[2], query_len))) {
ask = 0;
strfcpy (key, fields[1], sizeof (key));
}
/* query = certificate: return intermediate certificate. */
else if (numFields >= 4 &&
- !(mutt_strncasecmp (query, fields[1], query_len))) {
+ !(safe_strncasecmp (query, fields[1], query_len))) {
ask = 0;
strfcpy (key, fields[3], sizeof (key));
}
if (k) {
/* the key used last time. */
if (*SmimeKeyToUse &&
- !mutt_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) {
+ !safe_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) {
FREE (&k);
return;
}
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL (SmimeCertificates), k);
- if (mutt_strcasecmp (k, SmimeDefaultKey))
+ if (safe_strcasecmp (k, SmimeDefaultKey))
smime_void_passphrase ();
FREE (&k);
}
if (*SmimeKeyToUse) {
- if (!mutt_strcasecmp (SmimeDefaultKey,
+ if (!safe_strcasecmp (SmimeDefaultKey,
SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1))
return;
while ((fgets (email, sizeof (email), fpout))) {
*(email + mutt_strlen (email) - 1) = '\0';
- if (mutt_strncasecmp (email, mailbox, mutt_strlen (mailbox)) == 0)
+ if (safe_strncasecmp (email, mailbox, mutt_strlen (mailbox)) == 0)
ret = 1;
ret = ret < 0 ? 0 : ret;
if ((thepid = smime_invoke_sign (&smimein, NULL, &smimeerr,
-1, fileno (smimeout), -1,
filetosign)) == -1) {
- mutt_perror _("Can't open OpenSSL subprocess!");
+ mutt_perror (_("Can't open OpenSSL subprocess!"));
fclose (smimeout);
mutt_unlink (signedfile);
rewind (smimeerr);
line = mutt_read_line (line, &linelen, smimeerr, &lineno);
- if (linelen && !mutt_strcasecmp (line, "verification successful"))
+ if (linelen && !safe_strcasecmp (line, "verification successful"))
badsig = 0;
FREE (&line);
rewind (smimeerr);
line = mutt_read_line (line, &linelen, smimeerr, &lineno);
- if (linelen && !mutt_strcasecmp (line, "verification successful"))
+ if (linelen && !safe_strcasecmp (line, "verification successful"))
m->goodsig = 1;
FREE (&line);
}
" 4: RC2-64, 5: RC2-128, or (f)orget it? "),
_("12345f"))) {
case 1:
- mutt_str_replace (&SmimeCryptAlg, "des");
+ str_replace (&SmimeCryptAlg, "des");
break;
case 2:
- mutt_str_replace (&SmimeCryptAlg, "des3");
+ str_replace (&SmimeCryptAlg, "des3");
break;
case 3:
- mutt_str_replace (&SmimeCryptAlg, "rc2-40");
+ str_replace (&SmimeCryptAlg, "rc2-40");
break;
case 4:
- mutt_str_replace (&SmimeCryptAlg, "rc2-64");
+ str_replace (&SmimeCryptAlg, "rc2-64");
break;
case 5:
- mutt_str_replace (&SmimeCryptAlg, "rc2-128");
+ str_replace (&SmimeCryptAlg, "rc2-128");
break;
case 6: /* forget it */
break;
if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
p[mutt_strlen (p) - 1] = '\0';
- mutt_str_replace (&SmimeDefaultKey, p);
+ str_replace (&SmimeDefaultKey, p);
msg->security |= SIGN;