92 const int fd_null = open(
"/dev/null", O_RDWR);
93 if ((fd_null < 0) || (dup2(pout[0], STDIN_FILENO) < 0) ||
94 (dup2(pin[1], STDOUT_FILENO) < 0) || (dup2(fd_null, STDERR_FILENO) < 0))
122 if ((close(pin[1]) < 0) || (close(pout[0]) < 0))
125 fcntl(pin[0], F_SETFD, FD_CLOEXEC);
126 fcntl(pout[1], F_SETFD, FD_CLOEXEC);
137 if (c_tunnel_is_secure)
153 rc = read(tunnel->
fd_read, buf, count);
154 }
while (rc < 0 && errno == EINTR);
178 rc = write(tunnel->
fd_write, buf + sent, count - sent);
179 }
while (rc < 0 && errno == EINTR);
188 }
while (sent < count);
225 waitpid(tunnel->
pid, &status, 0);
226 if (!WIFEXITED(status) || WEXITSTATUS(status))
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
An open network connection (socket)
Convenience wrapper for the core headers.
char ** EnvList
Private copy of the environment variables.
static int tunnel_socket_close(struct Connection *conn)
Close a tunnel socket - Implements Connection::close() -.
static int tunnel_socket_open(struct Connection *conn)
Open a tunnel socket - Implements Connection::open() -.
int raw_socket_poll(struct Connection *conn, time_t wait_secs)
Check if any data is waiting on a socket - Implements Connection::poll() -.
static int tunnel_socket_poll(struct Connection *conn, time_t wait_secs)
Check if any data is waiting on a socket - Implements Connection::poll() -.
static int tunnel_socket_read(struct Connection *conn, char *buf, size_t count)
Read data from a tunnel socket - Implements Connection::read() -.
static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t count)
Write data to a tunnel socket - Implements Connection::write() -.
#define mutt_message(...)
#define MUTT_MEM_MALLOC(n, type)
Convenience wrapper for the library headers.
const char * mutt_str_sysexit(int err_num)
Return a string matching an error code.
void mutt_sig_reset_child_signals(void)
Reset ignored signals back to the default.
void mutt_sig_block_system(void)
Block signals before calling exec()
void mutt_sig_unblock_system(bool restore)
Restore previously blocked signals.
char host[128]
Server to login to.
void * sockdata
Backend-specific socket data.
int(* poll)(struct Connection *conn, time_t wait_secs)
int(* write)(struct Connection *conn, const char *buf, size_t count)
unsigned int ssf
Security strength factor, in bits (see notes)
int(* close)(struct Connection *conn)
struct ConnAccount account
Account details: username, password, etc.
int(* open)(struct Connection *conn)
int fd
Socket file descriptor.
int(* read)(struct Connection *conn, char *buf, size_t count)
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
A network tunnel (pair of sockets)
int fd_read
File descriptor to read from.
pid_t pid
Process ID of tunnel program.
int fd_write
File descriptor to write to.
void mutt_tunnel_socket_setup(struct Connection *conn)
Sets up tunnel connection functions.