X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-sys%2Fmutt_ssl.cpkg;h=a86eab1787a9b52081b9f7a9110dcd7217cb72d2;hp=1b9e5d1917548635a52d210da1acfc138422a4b4;hb=3438f31945bb94bc4f4b9603ac47fcde03d5c073;hpb=4f1b1414371cc373f50ca79a888928635a3a3763 diff --git a/lib-sys/mutt_ssl.cpkg b/lib-sys/mutt_ssl.cpkg index 1b9e5d1..a86eab1 100644 --- a/lib-sys/mutt_ssl.cpkg +++ b/lib-sys/mutt_ssl.cpkg @@ -12,11 +12,8 @@ #include #include -#ifdef HAVE_GNUTLS_OPENSSL_H -#include -#endif -#include +#include #include #include "mutt.h" @@ -62,7 +59,7 @@ ** the default from the GNUTLS library. */ - path_t cert_file = m_strdup("~/.cache/madmutt/certificates"); + path_t cert_file = luaM_pathnew("~/.cache/madmutt/certificates"); /* ** .pp ** This variable specifies the file where the certificates you trust @@ -150,7 +147,7 @@ static int tls_socket_read (CONNECTION * conn, char *buf, ssize_t len) } ret = gnutls_record_recv (data->state, buf, len); - if (gnutls_error_is_fatal (ret) == 1) { + if (ret < 0 && gnutls_error_is_fatal (ret) == 1) { mutt_error (_("tls_socket_read (%s)"), gnutls_strerror (ret)); mutt_sleep (4); return -1; @@ -170,7 +167,7 @@ static int tls_socket_write (CONNECTION * conn, const char *buf, ssize_t len) } ret = gnutls_record_send (data->state, buf, len); - if (gnutls_error_is_fatal (ret) == 1) { + if (ret < 0 && gnutls_error_is_fatal (ret) == 1) { mutt_error (_("tls_socket_write (%s)"), gnutls_strerror (ret)); mutt_sleep (4); return -1; @@ -432,16 +429,18 @@ static void tls_fingerprint (gnutls_digest_algorithm algo, static char *tls_make_date (time_t t, char *s, ssize_t len) { - struct tm *l = gmtime (&t); - - if (l) - snprintf (s, len, "%s, %d %s %d %02d:%02d:%02d UTC", - Weekdays[l->tm_wday], l->tm_mday, Months[l->tm_mon], - l->tm_year + 1900, l->tm_hour, l->tm_min, l->tm_sec); - else - m_strcpy(s, len, _("[invalid date]")); + struct tm *l = gmtime(&t); + + if (l) { + const char *loc; + loc = setlocale(LC_TIME, "C"); + strftime(s, len, "%a, %d %b %Y %T UTC", l); + setlocale(LC_TIME, loc); + } else { + m_strcpy(s, len, _("[invalid date]")); + } - return (s); + return (s); } static int tls_check_stored_hostname (const gnutls_datum * cert, @@ -496,8 +495,6 @@ static int tls_check_certificate (CONNECTION * conn) { tlssockdata *data = conn->sockdata; gnutls_session state = data->state; - char helpstr[STRING]; - char buf[STRING]; char fpbuf[STRING]; ssize_t buflen; char dn_common_name[STRING]; @@ -791,13 +788,6 @@ static int tls_check_certificate (CONNECTION * conn) menu->keys = _("ro"); } - helpstr[0] = '\0'; - mutt_make_help (buf, sizeof (buf), _("Exit "), MENU_GENERIC, OP_EXIT); - strncat (helpstr, buf, sizeof (helpstr)); - mutt_make_help (buf, sizeof (buf), _("Help"), MENU_GENERIC, OP_HELP); - strncat (helpstr, buf, sizeof (helpstr)); - menu->help = helpstr; - done = 0; set_option (OPTUNBUFFEREDINPUT); while (!done) {