more documentation.
[apps/madmutt.git] / lib-crypt / pgp.c
index ea63f2c..08b8509 100644 (file)
@@ -130,7 +130,7 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
         rv = 0;
       }
 
-      if (strncmp (line, "[GNUPG:] ", 9) == 0)
+      if (m_strncmp (line, "[GNUPG:] ", 9) == 0)
         continue;
       fputs (line, fpout);
       fputc ('\n', fpout);
@@ -595,7 +595,7 @@ static void pgp_extract_keys_from_attachment (FILE * fp, BODY * top)
 
   tempfp = m_tempfile(tempfname, sizeof(tempfname), NONULL(Tempdir), NULL);
   if (tempfp == NULL) {
-    mutt_perror (tempfname);
+    mutt_perror (_("Can't create temporary file"));
     return;
   }
 
@@ -649,14 +649,14 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p)
   int rv;
 
   pgperr = m_tempfile(pgperrfile, sizeof(pgperrfile), NONULL(Tempdir), NULL);
-  if (pgperr == NULL) {
+  if (!pgperr) {
     mutt_perror (pgperrfile);
     return NULL;
   }
   unlink (pgperrfile);
 
   pgptmp = m_tempfile(pgptmpfile, sizeof(pgptmpfile), NONULL(Tempdir), NULL);
-  if (!pgptmp == NULL) {
+  if (!pgptmp) {
     mutt_perror (pgptmpfile);
     m_fclose(&pgperr);
     return NULL;
@@ -695,7 +695,7 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p)
   while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL) {
     len = m_strlen(buf);
     if (len > 1 && buf[len - 2] == '\r')
-      strcpy (buf + len - 2, "\n");     /* __STRCPY_CHECKED__ */
+      m_strcpy(buf + len - 2, len - 2,  "\n");
     fputs (buf, fpout);
   }
 
@@ -758,7 +758,7 @@ int pgp_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   s.fpin = fpin;
   *fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
   if (*fpout == NULL) {
-    mutt_perror (tempfile);
+    mutt_perror (_("Can't create temporary file"));
     return (-1);
   }
   unlink (tempfile);
@@ -974,7 +974,7 @@ BODY *pgp_sign_message (BODY * a)
 static short is_numerical_keyid (const char *s)
 {
   /* or should we require the "0x"? */
-  if (strncmp (s, "0x", 2) == 0)
+  if (m_strncmp (s, "0x", 2) == 0)
     s += 2;
   if (m_strlen(s) % 8)
     return 0;
@@ -1022,8 +1022,7 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
       last = &((*last)->next);
   }
 
-  if (fqdn)
-    rfc822_qualify (tmp, fqdn);
+  rfc822_qualify (tmp, fqdn);
 
   address_list_uniq(tmp);
 
@@ -1040,7 +1039,7 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
                 p->mailbox);
       if ((r = mutt_yesorno (buf, M_YES)) == M_YES) {
         if (is_numerical_keyid (keyID)) {
-          if (strncmp (keyID, "0x", 2) == 0)
+          if (m_strncmp (keyID, "0x", 2) == 0)
             keyID += 2;
           goto bypass_selection;        /* you don't see this. */
         }
@@ -1048,8 +1047,7 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
         /* check for e-mail address */
         if ((t = strchr (keyID, '@')) &&
             (addr = rfc822_parse_adrlist (NULL, keyID))) {
-          if (fqdn)
-            rfc822_qualify (addr, fqdn);
+          rfc822_qualify (addr, fqdn);
           q = addr;
         }
         else
@@ -1087,7 +1085,7 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
   bypass_selection:
     keylist_size += m_strlen(keyID) + 4;
     p_realloc(&keylist, keylist_size);
-    sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */
+    sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "",
              keyID);
     keylist_used = m_strlen(keylist);
 
@@ -1115,7 +1113,7 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign)
 
   fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
   if (fpout == NULL) {
-    mutt_perror (tempfile);
+    mutt_perror (_("Can't create temporary file"));
     return (NULL);
   }
 
@@ -1388,7 +1386,7 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist)
 int pgp_send_menu (HEADER * msg, int *redraw)
 {
   pgp_key_t p;
-  char input_signas[SHORT_STRING];
+  char input_signas[STRING];
 
   char prompt[LONG_STRING];
 
@@ -1426,11 +1424,6 @@ int pgp_send_menu (HEADER * msg, int *redraw)
 
       crypt_pgp_void_passphrase ();     /* probably need a different passphrase */
     }
-#if 0
-    else {
-      msg->security &= ~SIGN;
-    }
-#endif
 
     *redraw = REDRAW_FULL;
     break;