diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-08 22:24:37 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-08 23:18:21 +0000 |
commit | 691ca88ca06899e02e77cb28fbf075de450607bc (patch) | |
tree | 48f660b58f68cc34bdd9f4a0a6846adcec54aa0a /src | |
parent | 8cfc4d82fc84825b3a673aa140fc561042e32b70 (diff) |
Default notifier socket name to spooldir-dependent path even for abstract names
Diffstat (limited to 'src')
-rw-r--r-- | src/src/daemon.c | 22 | ||||
-rw-r--r-- | src/src/expand.c | 7 | ||||
-rw-r--r-- | src/src/globals.c | 1 | ||||
-rw-r--r-- | src/src/globals.h | 3 | ||||
-rw-r--r-- | src/src/queue.c | 6 | ||||
-rw-r--r-- | src/src/readconf.c | 1 |
6 files changed, 25 insertions, 15 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c index ac507b023..2813a50d1 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -972,7 +972,7 @@ if (daemon_notifier_fd >= 0) daemon_notifier_fd = -1; #ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS { - uschar * s = string_sprintf("%s/%s", spool_directory, NOTIFIER_SOCKET_NAME); + uschar * s = expand_string(notifier_socket); DEBUG(D_any) debug_printf("unlinking notifier socket %s\n", s); Uunlink(s); } @@ -1010,7 +1010,14 @@ const uschar * where; struct sockaddr_un sa_un = {.sun_family = AF_UNIX}; int len; -DEBUG(D_any) debug_printf("creating notifier socket "); +if (override_local_interfaces && !override_pid_file_path) + { + DEBUG(D_any) + debug_printf("-oX used without -oP so not creating notifier socket\n"); + return; + } + +DEBUG(D_any) debug_printf("creating notifier socket\n"); #ifdef SOCK_CLOEXEC if ((fd = socket(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) @@ -1024,13 +1031,14 @@ if ((fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) #ifdef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS sa_un.sun_path[0] = 0; /* Abstract local socket addr - Linux-specific? */ len = offsetof(struct sockaddr_un, sun_path) + 1 - + snprintf(sa_un.sun_path+1, sizeof(sa_un.sun_path)-1, "%s", NOTIFIER_SOCKET_NAME); -DEBUG(D_any) debug_printf("@%s\n", sa_un.sun_path+1); + + snprintf(sa_un.sun_path+1, sizeof(sa_un.sun_path)-1, "%s", + expand_string(notifier_socket)); +DEBUG(D_any) debug_printf(" @%s\n", sa_un.sun_path+1); #else /* filesystem-visible and persistent; will neeed removal */ len = offsetof(struct sockaddr_un, sun_path) - + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s/%s", - spool_directory, NOTIFIER_SOCKET_NAME); -DEBUG(D_any) debug_printf("%s\n", sa_un.sun_path); + + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s", + expand_string(notifier_socket)); +DEBUG(D_any) debug_printf(" %s\n", sa_un.sun_path); #endif if (bind(fd, (const struct sockaddr *)&sa_un, len) < 0) diff --git a/src/src/expand.c b/src/src/expand.c index 3c3184347..4377ea1aa 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1791,11 +1791,12 @@ debug_printf("local addr '%s%s'\n", #ifdef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS sa_un.sun_path[0] = 0; /* Abstract local socket addr - Linux-specific? */ len = offsetof(struct sockaddr_un, sun_path) + 1 - + snprintf(sa_un.sun_path+1, sizeof(sa_un.sun_path)-1, "%s", NOTIFIER_SOCKET_NAME); + + snprintf(sa_un.sun_path+1, sizeof(sa_un.sun_path)-1, "%s", + expand_string(notifier_socket)); #else len = offsetof(struct sockaddr_un, sun_path) - + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s/%s", - spool_directory, NOTIFIER_SOCKET_NAME); + + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s", + expand_string(notifier_socket)); #endif if (connect(fd, (const struct sockaddr *)&sa_un, len) < 0) diff --git a/src/src/globals.c b/src/src/globals.c index 4ce15acaa..a771f1193 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1164,6 +1164,7 @@ int mime_part_count = -1; #endif uid_t *never_users = NULL; +uschar *notifier_socket = US"$spool_directory/" NOTIFIER_SOCKET_NAME ; const int on = 1; /* for setsockopt */ const int off = 0; diff --git a/src/src/globals.h b/src/src/globals.h index 1fea9c9b0..28d170cdc 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -735,8 +735,7 @@ extern int mime_part_count; extern BOOL mua_wrapper; /* TRUE when Exim is wrapping an MUA */ extern uid_t *never_users; /* List of uids never to be used */ -#ifdef WITH_CONTENT_SCAN -#endif +extern uschar *notifier_socket; /* Name for daemon notifier unix-socket */ extern const int on; /* For setsockopt */ extern const int off; diff --git a/src/src/queue.c b/src/src/queue.c index 53dc6e026..1b70c02b6 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -1536,12 +1536,12 @@ if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) #ifdef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS int len = offsetof(struct sockaddr_un, sun_path) + 1 + snprintf(sa_un.sun_path+1, sizeof(sa_un.sun_path)-1, "%s", - NOTIFIER_SOCKET_NAME); + expand_string(notifier_socket)); sa_un.sun_path[0] = 0; #else int len = offsetof(struct sockaddr_un, sun_path) - + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s/%s", - spool_directory, NOTIFIER_SOCKET_NAME); + + snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s", + expand_string(notifier_socket)); #endif if (sendto(fd, buf, sizeof(buf), 0, (struct sockaddr *)&sa_un, len) < 0) diff --git a/src/src/readconf.c b/src/src/readconf.c index c8a3dffba..a506d9f1d 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -227,6 +227,7 @@ static optionlist optionlist_config[] = { { "mysql_servers", opt_stringptr, {&mysql_servers} }, #endif { "never_users", opt_uidlist, {&never_users} }, + { "notifier_socket", opt_stringptr, {¬ifier_socket} }, #ifndef DISABLE_TLS { "openssl_options", opt_stringptr, {&openssl_options} }, #endif |