~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/anvil/anvil-connection.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/{control,rules}: enable PIE hardening.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2009-2011 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2009-2012 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "common.h"
4
4
#include "llist.h"
29
29
        unsigned int version_received:1;
30
30
        unsigned int handshaked:1;
31
31
        unsigned int master:1;
 
32
        unsigned int fifo:1;
32
33
};
33
34
 
34
35
struct anvil_connection *anvil_connections = NULL;
39
40
        const char *line;
40
41
 
41
42
        line = i_stream_next_line(conn->input);
42
 
        return line == NULL ? NULL : t_strsplit(line, "\t");
 
43
        return line == NULL ? NULL : t_strsplit_tab(line);
43
44
}
44
45
 
45
46
static int
149
150
 
150
151
                if (!version_string_verify(line, "anvil",
151
152
                                ANVIL_CLIENT_PROTOCOL_MAJOR_VERSION)) {
 
153
                        if (anvil_restarted && (conn->master || conn->fifo)) {
 
154
                                /* old pending data. ignore input until we get
 
155
                                   the handshake. */
 
156
                                anvil_connection_input(context);
 
157
                                return;
 
158
                        }
152
159
                        i_error("Anvil client not compatible with this server "
153
 
                                "(mixed old and new binaries?)");
 
160
                                "(mixed old and new binaries?) %s", line);
154
161
                        anvil_connection_destroy(conn);
155
162
                        return;
156
163
                }
180
187
                conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
181
188
        conn->io = io_add(fd, IO_READ, anvil_connection_input, conn);
182
189
        conn->master = master;
 
190
        conn->fifo = fifo;
183
191
        DLLIST_PREPEND(&anvil_connections, conn);
184
192
        return conn;
185
193
}
186
194
 
187
195
void anvil_connection_destroy(struct anvil_connection *conn)
188
196
{
 
197
        bool fifo = conn->fifo;
 
198
 
189
199
        DLLIST_REMOVE(&anvil_connections, conn);
190
200
 
191
201
        io_remove(&conn->io);
196
206
                i_error("close(anvil conn) failed: %m");
197
207
        i_free(conn);
198
208
 
199
 
        master_service_client_connection_destroyed(master_service);
 
209
        if (!fifo)
 
210
                master_service_client_connection_destroyed(master_service);
200
211
}
201
212
 
202
213
void anvil_connections_destroy_all(void)