~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/login-common/main.c

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* 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 restrictions
    - 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 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
   + debian/patches/dovecot-postfix.conf.diff:
     + 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.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <unistd.h>
20
20
#include <syslog.h>
21
21
 
22
 
bool disable_plaintext_auth, process_per_connection, greeting_capability;
 
22
bool disable_plaintext_auth, process_per_connection;
23
23
bool verbose_proctitle, verbose_ssl, verbose_auth, auth_debug;
24
 
bool ssl_require_client_cert;
 
24
bool ssl_required, ssl_require_client_cert;
25
25
const char *greeting, *log_format;
26
26
const char *const *log_format_elements;
 
27
const char *trusted_networks;
27
28
unsigned int max_connections;
28
29
unsigned int login_process_uid;
29
30
struct auth_client *auth_client;
66
67
        }
67
68
}
68
69
 
69
 
static void sig_die(int signo, void *context ATTR_UNUSED)
 
70
static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED)
70
71
{
71
72
        /* warn about being killed because of some signal, except SIGINT (^C)
72
73
           which is too common at least while testing :) */
73
 
        if (signo != SIGINT)
74
 
                i_warning("Killed with signal %d", signo);
 
74
        if (si->si_signo != SIGINT) {
 
75
                i_warning("Killed with signal %d (by pid=%s uid=%s code=%s)",
 
76
                          si->si_signo, dec2str(si->si_pid),
 
77
                          dec2str(si->si_uid),
 
78
                          lib_signal_code_to_str(si->si_signo, si->si_code));
 
79
        }
75
80
        io_loop_stop(ioloop);
76
81
}
77
82
 
128
133
                local_port = 0;
129
134
        }
130
135
 
 
136
        connection_queue_add(1);
 
137
 
131
138
        fd_ssl = ssl_proxy_new(fd, &remote_ip, &proxy);
132
139
        if (fd_ssl == -1)
133
140
                net_disconnect(fd);
264
271
                                     value == NULL ? LOG_MAIL : atoi(value));
265
272
        }
266
273
 
 
274
        value = getenv("DOVECOT_VERSION");
 
275
        if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
 
276
                i_fatal("Dovecot version mismatch: "
 
277
                        "Master is v%s, login is v"PACKAGE_VERSION" "
 
278
                        "(if you don't care, set version_ignore=yes)", value);
 
279
        }
 
280
 
267
281
        value = getenv("LOGIN_DIR");
268
282
        if (value == NULL)
269
283
                i_fatal("LOGIN_DIR environment missing");
301
315
{
302
316
        const char *value;
303
317
 
304
 
        value = getenv("DOVECOT_VERSION");
305
 
        if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
306
 
                i_fatal("Dovecot version mismatch: "
307
 
                        "Master is v%s, login is v"PACKAGE_VERSION" "
308
 
                        "(if you don't care, set version_ignore=yes)", value);
309
 
        }
310
 
 
311
318
        lib_signals_init();
312
319
        lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
313
320
        lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
314
321
        lib_signals_ignore(SIGPIPE, TRUE);
315
322
 
316
 
        disable_plaintext_auth = getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
317
323
        process_per_connection = getenv("PROCESS_PER_CONNECTION") != NULL;
318
324
        verbose_proctitle = getenv("VERBOSE_PROCTITLE") != NULL;
319
325
        verbose_ssl = getenv("VERBOSE_SSL") != NULL;
320
326
        verbose_auth = getenv("VERBOSE_AUTH") != NULL;
321
327
        auth_debug = getenv("AUTH_DEBUG") != NULL;
 
328
        ssl_required = getenv("SSL_REQUIRED") != NULL;
322
329
        ssl_require_client_cert = getenv("SSL_REQUIRE_CLIENT_CERT") != NULL;
 
330
        disable_plaintext_auth = ssl_required ||
 
331
                getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
323
332
 
324
333
        greeting = getenv("GREETING");
325
334
        if (greeting == NULL)
326
335
                greeting = PACKAGE" ready.";
327
 
        greeting_capability = getenv("GREETING_CAPABILITY") != NULL;
328
336
 
329
337
        value = getenv("LOG_FORMAT_ELEMENTS");
330
338
        if (value == NULL)
335
343
        if (log_format == NULL)
336
344
                log_format = "%$: %s";
337
345
 
 
346
        trusted_networks = getenv("TRUSTED_NETWORKS");
 
347
 
338
348
        value = getenv("PROCESS_UID");
339
349
        if (value == NULL)
340
350
                i_fatal("BUG: PROCESS_UID environment not given");
353
363
        auth_client = auth_client_new(login_process_uid);
354
364
        auth_client_set_connect_notify(auth_client, auth_connect_notify, NULL);
355
365
        clients_init();
 
366
        login_proxy_init();
356
367
 
357
368
        if (!ssl_initialized && ssl_listen_count > 0) {
358
369
                /* this shouldn't happen, master should have
432
443
 
433
444
        drop_privileges(&max_fds);
434
445
 
 
446
        if (argv[1] != NULL && strcmp(argv[1], "-D") == 0)
 
447
                restrict_access_allow_coredumps(TRUE);
 
448
 
435
449
        process_title_init(argv, envp);
436
450
        ioloop = io_loop_create();
437
451
        io_loop_set_max_fd_count(ioloop, max_fds);