v2.1.5: Using "~/" as mail_location or elsewhere failed to actually

expand it to home directory.
- dbox: Fixed potential assert-crash when reading dbox files.
- trash plugin: Fixed behavior when quota is already over limit.
- Proxying to backend server with SSL: Verifying server certificate
  name always failed, because it was compared to an IP address.
This commit is contained in:
Michal Hlavinka 2012-05-09 10:26:49 +02:00
parent c9cc177990
commit 04f6a1d889
4 changed files with 11 additions and 106 deletions

1
.gitignore vendored
View File

@ -47,3 +47,4 @@ pigeonhole-snap0592366457df.tar.bz2
/dovecot-2.1.3.tar.gz
/dovecot-2.1.4.tar.gz
/dovecot-2.1.5.tar.gz
/dovecot-2.1.6.tar.gz

View File

@ -1,102 +0,0 @@
diff -up dovecot-2.0.20/src/master/service-listen.c.systemdfix dovecot-2.0.20/src/master/service-listen.c
--- dovecot-2.0.20/src/master/service-listen.c.systemdfix 2011-12-13 12:38:27.000000000 +0100
+++ dovecot-2.0.20/src/master/service-listen.c 2012-04-13 18:29:37.724290656 +0200
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#define MIN_BACKLOG 4
#define MAX_BACKLOG 511
@@ -231,16 +232,90 @@ static int service_listen(struct service
return ret;
}
+static int get_socket_info(int fd, unsigned int *family, unsigned int *port)
+{
+ union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in in4;
+ struct sockaddr_in6 in6;
+ } sockaddr;
+ socklen_t l;
+
+ if (port) *port = -1;
+ if (family) *family = -1;
+
+ memset(&sockaddr, 0, sizeof(sockaddr));
+ l = sizeof(sockaddr);
+
+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
+ return -errno;
+
+ if (family) *family = sockaddr.sa.sa_family;
+ if (port) {
+ if (sockaddr.sa.sa_family == AF_INET) {
+ if (l < sizeof(struct sockaddr_in))
+ return -EINVAL;
+
+ *port = ntohs(sockaddr.in4.sin_port);
+ } else {
+ if (l < sizeof(struct sockaddr_in6))
+ return -EINVAL;
+
+ *port = ntohs(sockaddr.in6.sin6_port);
+ }
+ }
+ return 0;
+}
+
int services_listen(struct service_list *service_list)
{
struct service *const *services;
int ret = 1, ret2;
array_foreach(&service_list->services, services) {
ret2 = service_listen(*services);
if (ret2 < ret)
ret = ret2;
}
+
+ static int sd_fds = -1;
+ int fd, fd_max;
+
+ if (sd_fds < 0) {
+ sd_fds = sd_listen_fds(0);
+ if (sd_fds == -1) {
+ i_error("sd_listen_fds() failed: %m");
+ return -1;
+ }
+ }
+
+ fd_max = SD_LISTEN_FDS_START + sd_fds - 1;
+ for (fd = SD_LISTEN_FDS_START; fd <= fd_max; fd++) {
+ if (sd_is_socket_inet(fd, 0, SOCK_STREAM, 1, 0) > 0) {
+ int found = FALSE;
+ unsigned int port, family;
+ get_socket_info(fd, &family, &port);
+
+ array_foreach(&service_list->services, services) {
+ struct service_listener *const *listeners;
+ array_foreach(&(*services)->listeners, listeners) {
+ struct service_listener *l = *listeners;
+ if (l->type != SERVICE_LISTENER_INET) continue;
+ if (l->set.inetset.set->port == port && l->set.inetset.ip.family == family) {
+ found = TRUE;
+ break;
+ }
+ }
+ if (found) break;
+ }
+ if (!found) {
+ i_error("we've got socket that listens on port %d, but it's not configured. Closing.",port);
+ if (shutdown(fd,SHUT_RDWR) < 0 && errno != ENOTCONN) i_error("shutdown() failed: %m");
+ close(fd);
+ }
+ }
+ }
+
return ret;
}

View File

@ -1,7 +1,7 @@
Summary: Secure imap and pop3 server
Name: dovecot
Epoch: 1
Version: 2.1.5
Version: 2.1.6
#global prever .rc6
Release: 1%{?dist}
#dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2
@ -27,7 +27,6 @@ Patch1: dovecot-2.0-defaultconfig.patch
Patch2: dovecot-1.0.beta2-mkcert-permissions.patch
Patch3: dovecot-1.0.rc7-mkcert-paths.patch
Patch4: dovecot-2.1-privatetmp.patch
Patch6: dovecot-2.0.19-systemdfix.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel, pam-devel, zlib-devel, bzip2-devel, libcap-devel
@ -112,7 +111,6 @@ This package provides the development files for dovecot.
%patch2 -p1 -b .mkcert-permissions
%patch3 -p1 -b .mkcert-paths
%patch4 -p1 -b .privatetmp
%patch6 -p1 -b .systemdfix
sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src/plugins/fts-lucene/Makefile.in
%build
@ -429,6 +427,14 @@ make check
%{_libdir}/%{name}/dict/libdriver_pgsql.so
%changelog
* Wed May 09 2012 Michal Hlavinka <mhlavink@redhat.com> - 1:2.1.6-1
- v2.1.5: Using "~/" as mail_location or elsewhere failed to actually
expand it to home directory.
- dbox: Fixed potential assert-crash when reading dbox files.
- trash plugin: Fixed behavior when quota is already over limit.
- Proxying to backend server with SSL: Verifying server certificate
name always failed, because it was compared to an IP address.
* Tue Apr 24 2012 Michal Hlavinka <mhlavink@redhat.com> - 1:2.1.5-1
- IMAP: Several fixes related to mailbox listing in some configs
- director: A lot of fixes and performance improvements

View File

@ -1,2 +1,2 @@
c857e3442f2f14b3e46f1154b13b0b4b dovecot-2.1.5.tar.gz
56d2a8d5273d39caa41d6a8dd9f4442c dovecot-2.1.6.tar.gz
a3e19701b775bfe1d8059c1dffd43f80 dovecot-2.1-pigeonhole-0.3.0.tar.gz