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

« back to all changes in this revision

Viewing changes to src/director/director-host.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) 2010-2011 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
29
29
        struct director_host *host;
30
30
 
31
31
        host = i_new(struct director_host, 1);
 
32
        host->dir = dir;
 
33
        host->refcount = 1;
32
34
        host->ip = *ip;
33
35
        host->port = port;
34
36
        host->name = i_strdup_printf("%s:%u", net_ip2addr(ip), port);
41
43
        return host;
42
44
}
43
45
 
44
 
void director_host_free(struct director_host *host)
45
 
{
 
46
void director_host_free(struct director_host **_host)
 
47
{
 
48
        struct director_host *host = *_host;
 
49
 
 
50
        i_assert(host->refcount == 1);
 
51
 
 
52
        *_host = NULL;
 
53
        director_host_unref(host);
 
54
}
 
55
 
 
56
void director_host_ref(struct director_host *host)
 
57
{
 
58
        i_assert(host->refcount > 0);
 
59
        host->refcount++;
 
60
}
 
61
 
 
62
void director_host_unref(struct director_host *host)
 
63
{
 
64
        struct director_host *const *hosts;
 
65
        unsigned int i, count;
 
66
 
 
67
        i_assert(host->refcount > 0);
 
68
 
 
69
        if (--host->refcount > 0)
 
70
                return;
 
71
 
 
72
        hosts = array_get(&host->dir->dir_hosts, &count);
 
73
        for (i = 0; i < count; i++) {
 
74
                if (hosts[i] == host) {
 
75
                        array_delete(&host->dir->dir_hosts, i, 1);
 
76
                        break;
 
77
                }
 
78
        }
46
79
        i_free(host->name);
47
80
        i_free(host);
48
81
}