Qsmtp
0.30dev
|
main functions of Qremote More...
#include <qremote/qremote.h>
#include <control.h>
#include <fmt.h>
#include <ipme.h>
#include <log.h>
#include <netio.h>
#include <qdns.h>
#include <qmaildir.h>
#include <qremote/client.h>
#include <qremote/conn.h>
#include <qremote/greeting.h>
#include <qremote/qrdata.h>
#include <qremote/starttlsr.h>
#include <sstring.h>
#include <tls.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <syslog.h>
#include <unistd.h>
Functions | |
void | quitmsg (void) |
send QUIT to the remote server and close the connection More... | |
void | net_conn_shutdown (const enum conn_shutdown_type sd_type) |
shutdown the connection and end the program More... | |
void | err_mem (const int doquit) |
void | err_conf (const char *errmsg) |
void | err_confn (const char **errmsg, void *freebuf) |
log a configuration error and exit More... | |
static void | setup (void) |
int | main (int argc, char *argv[]) |
Variables | |
int | socketd = -1 |
unsigned int | smtpext |
char * | rhost |
size_t | rhostlen |
char * | partner_fqdn |
main functions of Qremote
This file contains the main function, the configuration and error handling of Qremote, the drop-in replacement for qmail-remote.
void err_confn | ( | const char ** | errmsg, |
void * | freebuf | ||
) |
log a configuration error and exit
errmsg | array of strings to combine to the message to log |
freebuf | a pointer to a buffer passed to free() after logging |
Use freebuf if the contents of this buffer need to be part of errmsg. If you do not have anything to free just pass NULL.
void net_conn_shutdown | ( | const enum conn_shutdown_type | sd_type | ) |
shutdown the connection and end the program
sd_type | specifies the way the shutdown should be performed |
This is a forward declaration only, every program has to implement this function in a way that matches how it works.
A shutdown_clean shutdown is e.g. sending QUIT to the server and waiting for it's reply. A shutdown with shutdown_abort is e.g. hard dropping of the connection if the client sends spam and has a broken SMTP engine that does not react to error codes.
Calling this function even before the connection was established is fine.
void quitmsg | ( | void | ) |
send QUIT to the remote server and close the connection
This will properly shut down the connection to the remote server but will not terminate the program.
char* partner_fqdn |
the DNS name of the remote server (forward-lookup), or NULL if the connection was done by IP
char* rhost |
the DNS name (if present) and IP address of the remote server to be used in log messages
size_t rhostlen |
valid length of rhost
unsigned int smtpext |
the SMTP extensions supported by the remote server