#include "globals.h"
#include "mutt_socket.h"
#include "mutt_tunnel.h"
-#if defined(USE_SSL) || defined(USE_GNUTLS) || defined(USE_NSS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
# include "mutt_ssl.h"
#endif
return -1;
}
- len = mutt_strlen (buf);
+ len = str_len (buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
debug_print (1, ("error writing, closing socket\n"));
mutt_socket_close (conn);
debug_print (dbg, ("< %s\n", buf));
- /* number of bytes read, not mutt_strlen */
+ /* number of bytes read, not str_len */
return i + 1;
}
/* head is special case, doesn't need prev updated */
if (iter == conn) {
Connections = iter->next;
- FREE (&iter);
+ mem_free (&iter);
return;
}
if (iter->next == conn) {
tmp = iter->next;
iter->next = tmp->next;
- FREE (&tmp);
+ mem_free (&tmp);
return;
}
iter = iter->next;
if (Tunnel && *Tunnel)
mutt_tunnel_socket_setup (conn);
else if (account->flags & M_ACCT_SSL) {
-#ifdef USE_SSL
- ssl_socket_setup (conn);
-#elif USE_NSS
- mutt_nss_socket_setup (conn);
-#elif USE_GNUTLS
- if (mutt_gnutls_socket_setup (conn) < 0) {
+#if defined (USE_SSL) || defined (USE_GNUTLS)
+ if (mutt_ssl_socket_setup (conn) < 0) {
mutt_socket_free (conn);
return NULL;
}
int rc;
int save_errno;
- if (mutt_strlen (Preconnect)) {
+ if (str_len (Preconnect)) {
debug_print (2, ("Executing preconnect: %s\n", Preconnect));
rc = mutt_system (Preconnect);
debug_print (2, ("Preconnect result: %d\n", rc));
{
CONNECTION *conn;
- conn = (CONNECTION *) safe_calloc (1, sizeof (CONNECTION));
+ conn = (CONNECTION *) mem_calloc (1, sizeof (CONNECTION));
conn->fd = -1;
return conn;
rc = getaddrinfo (host_idna, port, &hints, &res);
# ifdef HAVE_LIBIDN
- FREE (&host_idna);
+ mem_free (&host_idna);
# endif
if (rc) {
mutt_error (_("Could not find the host \"%s\""), conn->account.host);
+ mutt_sleep (2);
return -1;
}
if ((he = gethostbyname (host_idna)) == NULL) {
# ifdef HAVE_LIBIDN
- FREE (&host_idna);
+ mem_free (&host_idna);
# endif
mutt_error (_("Could not find the host \"%s\""), conn->account.host);
}
# ifdef HAVE_LIBIDN
- FREE (&host_idna);
+ mem_free (&host_idna);
# endif
mutt_message (_("Connecting to %s..."), conn->account.host);
if (fd >= 0) {
if ((rc = socket_connect (fd, (struct sockaddr *) &sin)) == 0) {
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
conn->fd = fd;
break;
}