Nico Golde:
[apps/madmutt.git] / crypt.c
diff --git a/crypt.c b/crypt.c
index 39fead1..fbe984a 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright notice from original mutt:
  * Copyright (C) 1996,1997 Michael R. Elkins <me@mutt.org>
  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
  * Copyright (C) 2001  Thomas Roessler <roessler@does-not-exist.org>
@@ -6,19 +7,9 @@
  * Copyright (C) 2003  Werner Koch <wk@gnupg.org>
  * Copyright (C) 2004 g10code 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 "mutt_crypt.h"
 #include "pgp.h"
 
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+
 #include <sys/wait.h>
 #include <string.h>
 #include <stdlib.h>
@@ -391,7 +386,7 @@ int mutt_is_application_smime (BODY * m)
 
     /* no .p7c, .p10 support yet. */
 
-    len = mutt_strlen (t) - 4;
+    len = safe_strlen (t) - 4;
     if (len > 0 && *(t + len) == '.') {
       len++;
       if (!ascii_strcasecmp ((t + len), "p7m"))
@@ -533,7 +528,7 @@ void convert_to_7bit (BODY * a)
         convert_to_7bit (a->parts);
     }
     else if (a->type == TYPEMESSAGE &&
-             mutt_strcasecmp (a->subtype, "delivery-status")) {
+             safe_strcasecmp (a->subtype, "delivery-status")) {
       if (a->encoding != ENC7BIT)
         mutt_message_to_7bit (a, NULL);
     }
@@ -760,7 +755,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
   /* consistency check */
 
   if (!(a && a->next && a->next->type == protocol_major &&
-        !mutt_strcasecmp (a->next->subtype, protocol_minor))) {
+        !safe_strcasecmp (a->next->subtype, protocol_minor))) {
     state_attach_puts (_("[-- Error: "
                          "Inconsistent multipart/signed structure! --]\n\n"),
                        s);
@@ -771,13 +766,13 @@ void mutt_signed_handler (BODY * a, STATE * s)
 
   if ((WithCrypto & APPLICATION_PGP)
       && protocol_major == TYPEAPPLICATION
-      && !mutt_strcasecmp (protocol_minor, "pgp-signature"));
+      && !safe_strcasecmp (protocol_minor, "pgp-signature"));
   else if ((WithCrypto & APPLICATION_SMIME)
            && protocol_major == TYPEAPPLICATION
-           && !(mutt_strcasecmp (protocol_minor, "x-pkcs7-signature")
-                && mutt_strcasecmp (protocol_minor, "pkcs7-signature")));
+           && !(safe_strcasecmp (protocol_minor, "x-pkcs7-signature")
+                && safe_strcasecmp (protocol_minor, "pkcs7-signature")));
   else if (protocol_major == TYPEMULTIPART
-           && !mutt_strcasecmp (protocol_minor, "mixed"));
+           && !safe_strcasecmp (protocol_minor, "mixed"));
   else {
     state_printf (s, _("[-- Error: "
                        "Unknown multipart/signed protocol %s! --]\n\n"),
@@ -796,7 +791,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
         for (i = 0; i < sigcnt; i++) {
           if ((WithCrypto & APPLICATION_PGP)
               && signatures[i]->type == TYPEAPPLICATION
-              && !mutt_strcasecmp (signatures[i]->subtype, "pgp-signature")) {
+              && !safe_strcasecmp (signatures[i]->subtype, "pgp-signature")) {
             if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0)
               goodsig = 0;
 
@@ -806,8 +801,8 @@ void mutt_signed_handler (BODY * a, STATE * s)
           if ((WithCrypto & APPLICATION_SMIME)
               && signatures[i]->type == TYPEAPPLICATION
               &&
-              (!mutt_strcasecmp (signatures[i]->subtype, "x-pkcs7-signature")
-               || !mutt_strcasecmp (signatures[i]->subtype,
+              (!safe_strcasecmp (signatures[i]->subtype, "x-pkcs7-signature")
+               || !safe_strcasecmp (signatures[i]->subtype,
                                     "pkcs7-signature"))) {
             if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
               goodsig = 0;