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

« back to all changes in this revision

Viewing changes to pigeonhole/src/testsuite/testsuite-settings.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) 2002-2012 Pigeonhole authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
2
2
 */
3
3
 
4
4
#include "lib.h"
16
16
        char *value;
17
17
};
18
18
 
19
 
static struct hash_table *settings; 
 
19
static HASH_TABLE(const char *, struct testsuite_setting *) settings;
20
20
 
21
21
static const char *testsuite_setting_get
22
22
        (void *context, const char *identifier);
23
23
 
24
24
void testsuite_settings_init(void)
25
25
{
26
 
        settings = hash_table_create
27
 
                (default_pool, default_pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
 
26
        hash_table_create(&settings, default_pool, 0, str_hash, strcmp);
28
27
 
29
28
        sieve_tool_set_setting_callback(sieve_tool, testsuite_setting_get, NULL);
30
29
}
31
30
 
32
31
void testsuite_settings_deinit(void)
33
32
{
34
 
        struct hash_iterate_context *itx = 
 
33
        struct hash_iterate_context *itx =
35
34
                hash_table_iterate_init(settings);
36
 
        void *key; 
37
 
        void *value;
38
 
        
39
 
        while ( hash_table_iterate(itx, &key, &value) ) {
40
 
                struct testsuite_setting *setting = (struct testsuite_setting *) value;
 
35
        const char *key;
 
36
        struct testsuite_setting *setting;
41
37
 
 
38
        while ( hash_table_iterate(itx, settings, &key, &setting) ) {
42
39
                i_free(setting->identifier);
43
40
                i_free(setting->value);
44
41
                i_free(setting);
45
42
        }
46
43
 
47
 
        hash_table_iterate_deinit(&itx);        
 
44
        hash_table_iterate_deinit(&itx);
48
45
 
49
46
        hash_table_destroy(&settings);
50
47
}
52
49
static const char *testsuite_setting_get
53
50
(void *context ATTR_UNUSED, const char *identifier)
54
51
{
55
 
        struct testsuite_setting *setting = (struct testsuite_setting *) 
 
52
        struct testsuite_setting *setting =
56
53
                hash_table_lookup(settings, identifier);
57
54
 
58
55
        if ( setting == NULL ) {
64
61
 
65
62
void testsuite_setting_set(const char *identifier, const char *value)
66
63
{
67
 
        struct testsuite_setting *setting = (struct testsuite_setting *) 
 
64
        struct testsuite_setting *setting =
68
65
                hash_table_lookup(settings, identifier);
69
66
 
70
67
        if ( setting != NULL ) {
74
71
                setting = i_new(struct testsuite_setting, 1);
75
72
                setting->identifier = i_strdup(identifier);
76
73
                setting->value = i_strdup(value);
77
 
        
78
 
                hash_table_insert(settings, (void *) identifier, (void *) setting);
 
74
 
 
75
                hash_table_insert(settings, identifier, setting);
79
76
        }
80
77
}
81
78
 
82
79
void testsuite_setting_unset(const char *identifier)
83
80
{
84
 
        struct testsuite_setting *setting = (struct testsuite_setting *) 
 
81
        struct testsuite_setting *setting =
85
82
                hash_table_lookup(settings, identifier);
86
83
 
87
84
        if ( setting != NULL ) {