summaryrefslogtreecommitdiff
path: root/comsat/comsat.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-11-01 10:56:08 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2017-11-01 10:56:08 +0200
commit4e7bcdbae346a26c1addf266a23c1f6cdc74533f (patch)
tree30f6721129f8a7688814b9dc88727e810770fbda /comsat/comsat.c
parenta5e929972db1342beec4b8f577399f2d8d9a76c2 (diff)
downloadmailutils-4e7bcdbae346a26c1addf266a23c1f6cdc74533f.tar.gz
mailutils-4e7bcdbae346a26c1addf266a23c1f6cdc74533f.tar.bz2
Improve socket and SMTP client API
Split formatting functions into two distinct families. Functions prefixed with mu_sys_sockadrr deal with struct sockaddr, wherease those starting with mu_sockaddr deal with struct mu_sockaddr. Introduce special format for SMTP EHLO. When sending EHLO to the remote party, use IP address in square brackets if hostname is empty. * libmailutils/sockaddr/Makefile.am (libsockaddr_la_SOURCES): Add fromsock.c * libmailutils/sockaddr/fromsock.c: New function. * libmailutils/sockaddr/str.c (mu_sockaddr_format): Rewrite. (mu_sys_sockaddr_format,mu_sys_sockaddr_to_astr): New functions. * include/mailutils/debug.h (mu_sockaddr_to_astr): Remove prototype. * include/mailutils/sockaddr.h (mu_sockaddr_format): New enum. (mu_sockaddr_format): change signature. (mu_sys_sockaddr_format,mu_sys_sockaddr_to_astr): New prototypes. (mu_sockaddr_from_socket): New prototype. * include/mailutils/stream.h (MU_IOCTL_TCPSTREAM): New ioctl family; (MU_IOCTL_TCP_GETSOCKNAME): New ioctl opcode. * comsat/comsat.c: Use mu_sys_sockaddr_ interface to handle struct sockaddr. * lib/tcpwrap.c: Likewise. * libmailutils/server/ipsrv.c: Likewise. * libmailutils/server/msrv.c: Likewise. * libmailutils/stream/tcp.c (_tcp_ioctl): Handle MU_IOCTL_TCPSTREAM. * libproto/mailer/smtp_ehlo.c (mu_smtp_ehlo): If hostname is empty, use IP address in square brackets.
Diffstat (limited to 'comsat/comsat.c')
-rw-r--r--comsat/comsat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/comsat/comsat.c b/comsat/comsat.c
index a60258a7b..d0fd5ad8b 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -18,6 +18,7 @@
#include "comsat.h"
#include "mailutils/syslog.h"
#include "mailutils/cli.h"
+#include "mailutils/sockaddr.h"
#ifndef PATH_DEV
# define PATH_DEV "/dev"
@@ -371,7 +372,7 @@ comsat_connection (int fd, struct sockaddr *sa, int salen,
return 0;
if (pconf->transcript)
{
- char *p = mu_sockaddr_to_astr (sa, salen);
+ char *p = mu_sys_sockaddr_to_astr (sa, salen);
mu_diag_output (MU_DIAG_INFO,
ngettext ("received %lu byte from %s",
"received %lu bytes from %s",

Return to:

Send suggestions and report system problems to the System administrator.