~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/plugins/stats/stats-connection.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-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/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.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2011-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2011-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "hostpid.h"
5
 
#include "network.h"
 
5
#include "net.h"
6
6
#include "str.h"
7
7
#include "strescape.h"
 
8
#include "master-service.h"
8
9
#include "mail-storage.h"
9
10
#include "stats-plugin.h"
10
11
#include "stats-connection.h"
23
24
        if (conn->open_failed)
24
25
                return FALSE;
25
26
 
26
 
        conn->fd = open(conn->path, O_WRONLY);
 
27
        conn->fd = open(conn->path, O_WRONLY | O_NONBLOCK);
27
28
        if (conn->fd == -1) {
28
29
                i_error("stats: open(%s) failed: %m", conn->path);
29
30
                conn->open_failed = TRUE;
40
41
        conn = i_new(struct stats_connection, 1);
41
42
        conn->refcount = 1;
42
43
        conn->path = i_strdup(path);
43
 
        stats_connection_open(conn);
 
44
        (void)stats_connection_open(conn);
44
45
        return conn;
45
46
}
46
47
 
71
72
        static bool pipe_warned = FALSE;
72
73
        ssize_t ret;
73
74
 
 
75
        /* if master process has been stopped (and restarted), don't even try
 
76
           to notify the stats process anymore. even if one exists, it doesn't
 
77
           know about us. */
 
78
        if (master_service_is_master_stopped(master_service))
 
79
                return;
 
80
 
74
81
        if (conn->fd == -1) {
75
82
                if (!stats_connection_open(conn))
76
83
                        return;
108
115
        /* required fields */
109
116
        str_append(str, guid_128_to_string(suser->session_guid));
110
117
        str_append_c(str, '\t');
111
 
        str_tabescape_write(str, user->username);
 
118
        str_append_tabescaped(str, user->username);
112
119
        str_append_c(str, '\t');
113
 
        str_tabescape_write(str, user->service);
 
120
        str_append_tabescaped(str, user->service);
114
121
        str_printfa(str, "\t%s", my_pid);
115
122
 
116
123
        /* optional fields */