projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make MAlias public. migrate $signature, so that I can test the new MCore.folder_hook...
[apps/madmutt.git]
/
lib-crypt
/
gnupgparse.c
diff --git
a/lib-crypt/gnupgparse.c
b/lib-crypt/gnupgparse.c
index
03bab1a
..
6be9f16
100644
(file)
--- a/
lib-crypt/gnupgparse.c
+++ b/
lib-crypt/gnupgparse.c
@@
-18,32
+18,15
@@
*
*/
*
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <ctype.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
+#include <lib-lib/lib-lib.h>
#include <lib-mime/mime.h>
#include <lib-mime/mime.h>
+#include <lib-sys/unix.h>
+#include <lib-ui/curses.h>
-#include "mutt.h"
#include "pgp.h"
#include "charset.h"
#include "pgp.h"
#include "charset.h"
-#include "lib/debug.h"
-
/****************
* Read the GNUPG keys. For now we read the complete keyring by
* calling gnupg in a special mode.
/****************
* Read the GNUPG keys. For now we read the complete keyring by
* calling gnupg in a special mode.
@@
-81,7
+64,7
@@
static void fix_uid (char *uid)
}
*d = '\0';
}
*d = '\0';
- if (_chs && (cd = mutt_iconv_open (_chs, "utf-8", 0)) !=
(iconv_t) - 1
) {
+ if (_chs && (cd = mutt_iconv_open (_chs, "utf-8", 0)) !=
MUTT_ICONV_ERROR
) {
int n = s - uid + 1; /* chars available in original buffer */
char *buf;
const char *ib;
int n = s - uid + 1; /* chars available in original buffer */
char *buf;
const char *ib;
@@
-116,8
+99,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
if (!*buf)
return NULL;
if (!*buf)
return NULL;
- debug_print (2, ("buf = `%s'\n", buf));
-
for (p = buf; p; p = pend) {
if ((pend = strchr (p, ':')))
*pend++ = 0;
for (p = buf; p; p = pend) {
if ((pend = strchr (p, ':')))
*pend++ = 0;
@@
-128,8
+109,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
switch (field) {
case 1: /* record type */
{
switch (field) {
case 1: /* record type */
{
- debug_print (2, ("record type: %s\n", p));
-
if (!m_strcmp(p, "pub"));
else if (!m_strcmp(p, "sub"))
*is_subkey = 1;
if (!m_strcmp(p, "pub"));
else if (!m_strcmp(p, "sub"))
*is_subkey = 1;
@@
-148,8
+127,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
}
case 2: /* trust info */
{
}
case 2: /* trust info */
{
- debug_print (2, ("trust info: %s\n", p));
-
switch (*p) { /* look only at the first letter */
case 'e':
flags |= KEYFLAG_EXPIRED;
switch (*p) { /* look only at the first letter */
case 'e':
flags |= KEYFLAG_EXPIRED;
@@
-181,18
+158,12
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
}
case 3: /* key length */
{
}
case 3: /* key length */
{
-
- debug_print (2, ("key len: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
k->keylen = atoi (p); /* fixme: add validation checks */
break;
}
case 4: /* pubkey algo */
{
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
k->keylen = atoi (p); /* fixme: add validation checks */
break;
}
case 4: /* pubkey algo */
{
-
- debug_print (2, ("pubkey algorithm: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB))) {
k->numalg = atoi (p);
k->algorithm = pgp_pkalgbytype (atoi (p));
if (!(*is_subkey && option (OPTPGPIGNORESUB))) {
k->numalg = atoi (p);
k->algorithm = pgp_pkalgbytype (atoi (p));
@@
-201,8
+172,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
}
case 5: /* 16 hex digits with the long keyid. */
{
}
case 5: /* 16 hex digits with the long keyid. */
{
- debug_print (2, ("key id: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
m_strreplace(&k->keyid, p);
break;
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
m_strreplace(&k->keyid, p);
break;
@@
-213,8
+182,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
char tstr[11];
struct tm st_time;
char tstr[11];
struct tm st_time;
- debug_print (2, ("time stamp: %s\n", p));
-
if (!p)
break;
st_time.tm_sec = 0;
if (!p)
break;
st_time.tm_sec = 0;
@@
-244,8
+211,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))
break;
if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))
break;
- debug_print (2, ("user ID: %s\n", p));
-
uid = p_new(pgp_uid_t, 1);
fix_uid (p);
uid->addr = m_strdup(p);
uid = p_new(pgp_uid_t, 1);
fix_uid (p);
uid->addr = m_strdup(p);
@@
-265,8
+230,6
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
case 11: /* signature class */
break;
case 12: /* key capabilities */
case 11: /* signature class */
break;
case 12: /* key capabilities */
- debug_print (2, ("capabilities info: %s\n", p));
-
while (*p) {
switch (*p++) {
case 'D':
while (*p) {
switch (*p++) {
case 'D':
@@
-298,7
+261,7
@@
static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
return k;
}
return k;
}
-pgp_key_t pgp_get_candidates (pgp_ring_t keyring,
LIST
* hints)
+pgp_key_t pgp_get_candidates (pgp_ring_t keyring,
string_list_t
* hints)
{
FILE *fp;
pid_t thepid;
{
FILE *fp;
pid_t thepid;
@@
-310,7
+273,7
@@
pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
if ((devnull = open ("/dev/null", O_RDWR)) == -1)
return NULL;
if ((devnull = open ("/dev/null", O_RDWR)) == -1)
return NULL;
- m_strreplace(&_chs,
C
harset);
+ m_strreplace(&_chs,
MCharset.c
harset);
thepid = pgp_invoke_list_keys (NULL, &fp, NULL, -1, -1, devnull,
keyring, hints);
thepid = pgp_invoke_list_keys (NULL, &fp, NULL, -1, -1, devnull,
keyring, hints);
@@
-347,7
+310,7
@@
pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
if (ferror (fp))
mutt_perror ("fgets");
if (ferror (fp))
mutt_perror ("fgets");
-
fclose (
fp);
+
m_fclose(&
fp);
mutt_wait_filter (thepid);
close (devnull);
mutt_wait_filter (thepid);
close (devnull);