~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002110912

« back to all changes in this revision

Viewing changes to src/lib/lib-signals.c

  • Committer: Chuck Short
  • Date: 2010-01-21 20:21:25 UTC
  • mfrom: (4.1.11 squeeze)
  • Revision ID: zulcss@ubuntu.com-20100121202125-pme73o491kfwj5nc
* Merge from debian testing, remaining changes:
  + Add new binary pkg dovecot-postfix that integrates postfix and dovecot
    automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restriction
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
  + debian/dovecot-postfix.dirs: create backup directory for postfix's config
    configuration
  + restart postfix and dovecot.
  + debian/dovecot-postfix.postrm:
    - remove all dovecot related configuration from postfix.
    - restart postfix and dovecot.
  + debian/dovecot-common.init:
    - check if /etc/dovecot/dovecot-postfix.conf exists and use it
      as the configuration file if so.
  + debian/patches/warning-ubuntu-postfix.dpatch
    - add warning about dovecot-postfix.conf in dovecot default
      configuration file
  + debian/patches/dovecot-postfix.conf.diff:
    - Ubuntu server custom changes to the default dovecot configuration for
      better interfation with postfix.
    - enable sieve plugin.
    - Ubuntu server custom changes to the default dovecot configuration for
      better integration with postfix:
      - enable imap, pop3, imaps, pop3s and managesieve by default.
      - enable dovecot LDA (deliver).
      - enable SASL auth socket in postfix private directory
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules: install profile.
     - debian/control: suggest ufw.
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). (LP: #254721)
   + debian/control: Update Vcs-* headers.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
* New upstream release.
* debian/patches/gold-fix.patch: Removed. Fixed upstream.
* Moved libexec to lib corrections in dovecot-managesieve.patch and
  dovecot-managesieve-dist.patch to dovecot-example.patch
* debian/patches/dovecot-mboxlocking.patch: Regenerated to avoid FTBFS
  when quilt isn't installed.
* debian/patches/quota-mountpoint.patch: Removed. Not needed anymore.
* debian/patches/dovecot-quota.patch: Removed. Quotas aren't properly
  enabled unless mail_plugins = quota imap_quota.
* debian/patches/gold-fix.patch: Fixed configure script to build even
  with binutils-gold or --no-add-needed linker flag (Closes: #554306)
* debian/dovecot-common.init: fixed LSB headers. Thanks to Pascal Volk.
  (Closes: #558040)
* debian/changelog: added CVE references to previous changelog entry.
* debian/rules: checked up the build system. It's not fragile anymore.
  (Closes: 493803)
* debian/dovecot-common.postinst: Now invoking dpkg-reconfigure
  on dovecot-common is enough to generate new certificates
  if the previous ones were removed. (Closes: #545582)
* debian/rules: No longer install convert-tool in /usr/bin.
  It isn't an user utility and it should stay in /usr/lib/dovecot
  like all other similar tool.
* New upstream release. (Closes: #557601)
* [SECURITY] Fixes local information disclosure and denial of service.
  (see: http://www.dovecot.org/list/dovecot-news/2009-November/000143.html
  and CVE-2009-3897)
* Added myself to uploaders.
* Switched to the new source format "3.0 (quilt)":
  - removed dpatch from build-depends
  - removed debian/README.source because now we use only standard
    dpkg features
  - regenerated all patches
* Prepared to switch to multi-origin source:
  - recreated dovecot-libsieve.patch and dovecot-managesieve-dist.patch
    starting from the upstream tarball
  - removed all autotools related build-depends and build-conflict
  - renamed dovecot-libsieve and dovecot-managesieve directories
    to libsieve and managesieve.
* debian/rules: Moved the configuration of libsieve and managesieve from
  the build phase to the configuration phase
* Added dovecot-dbg package  with debugging symbols.  Thanks Stephan Bosch.
  (Closes: #554710)
* Fixed some stray libexec'isms in the default configuration.
* New upstream release.
* debian/dovecot-common.init:
  - use $CONF when starting the daemon. (Closes: #549944)
  - always output start/stop messages. (Closes: #523810)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include "lib.h"
4
4
#include "ioloop.h"
5
5
#include "fd-close-on-exec.h"
 
6
#include "fd-set-nonblock.h"
6
7
#include "lib-signals.h"
7
8
 
8
9
#include <signal.h>
10
11
 
11
12
#define MAX_SIGNAL_VALUE 31
12
13
 
 
14
#if !defined(SA_SIGINFO) && !defined(SI_NOINFO)
 
15
/* without SA_SIGINFO we don't know what the real code is. we need SI_NOINFO
 
16
   to make sure lib_signal_code_to_str() returns "". */
 
17
#  define SI_NOINFO -1
 
18
#endif
 
19
 
13
20
struct signal_handler {
14
21
        signal_handler_t *handler;
15
22
        void *context;
74
81
        return t_strdup_printf("unknown %d", sicode);
75
82
}
76
83
 
 
84
#ifdef SA_SIGINFO
77
85
static void sig_handler(int signo, siginfo_t *si, void *context ATTR_UNUSED)
 
86
#else
 
87
static void sig_handler(int signo)
 
88
#endif
78
89
{
79
90
        struct signal_handler *h;
80
91
        char c = 0;
81
92
 
82
 
#ifdef SI_NOINFO
 
93
#if defined(SI_NOINFO) || !defined(SA_SIGINFO)
 
94
#ifndef SA_SIGINFO
 
95
        siginfo_t *si = NULL;
 
96
#endif
83
97
        siginfo_t tmp_si;
84
98
 
85
99
        if (si == NULL) {
114
128
        }
115
129
}
116
130
 
 
131
#ifdef SA_SIGINFO
117
132
static void sig_ignore(int signo ATTR_UNUSED, siginfo_t *si ATTR_UNUSED,
118
133
                       void *context ATTR_UNUSED)
 
134
#else
 
135
static void sig_ignore(int signo ATTR_UNUSED)
 
136
#endif
119
137
{
120
138
        /* if we used SIG_IGN instead of this function,
121
139
           the system call might be restarted */
172
190
 
173
191
        if (sigemptyset(&act.sa_mask) < 0)
174
192
                i_fatal("sigemptyset(): %m");
 
193
#ifdef SA_SIGINFO
175
194
        act.sa_flags = SA_SIGINFO;
176
195
        act.sa_sigaction = ignore ? sig_ignore : sig_handler;
 
196
#else
 
197
        act.sa_flags = 0;
 
198
        act.sa_handler = ignore ? sig_ignore : sig_handler;
 
199
#endif
177
200
        if (sigaction(signo, &act, NULL) < 0)
178
201
                i_fatal("sigaction(%d): %m", signo);
179
202
}
197
220
                /* first delayed handler */
198
221
                if (pipe(sig_pipe_fd) < 0)
199
222
                        i_fatal("pipe() failed: %m");
 
223
                fd_set_nonblock(sig_pipe_fd[0], TRUE);
 
224
                fd_set_nonblock(sig_pipe_fd[1], TRUE);
200
225
                fd_close_on_exec(sig_pipe_fd[0], TRUE);
201
226
                fd_close_on_exec(sig_pipe_fd[1], TRUE);
202
227
                if (signals_initialized) {
232
257
                act.sa_flags = SA_RESTART;
233
258
                act.sa_handler = SIG_IGN;
234
259
        } else {
 
260
#ifdef SA_SIGINFO
235
261
                act.sa_flags = SA_SIGINFO;
236
262
                act.sa_sigaction = sig_ignore;
 
263
#else
 
264
                act.sa_flags = 0;
 
265
                act.sa_handler = sig_ignore;
 
266
#endif
237
267
        }
238
268
 
239
269
        if (sigaction(signo, &act, NULL) < 0)