~ubuntu-branches/ubuntu/precise/dspam/precise

« back to all changes in this revision

Viewing changes to src/tools/dspam_merge.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Valroff, Julien Valroff, Thomas Preud'homme
  • Date: 2011-05-08 13:43:52 UTC
  • mfrom: (1.2.1 upstream) (8.2.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20110508134352-dxjx9m6tx1cbzlhq
Tags: 3.9.1~rc1+git20110419.29261fb+dfsg-1
[ Julien Valroff ]
* New git snapshot
* Install all dspam_* tools setgid so that they can be used by standard
  users
* Add symbols file for libdspam7
* Upload to unstable

[ Thomas Preud'homme ]
* Fix permissions on dspam_stats and missing opt-{in,out} directories
  (Closes: #394443)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: dspam_merge.c,v 1.15 2006/05/13 01:13:01 jonz Exp $ */
 
1
/* $Id: dspam_merge.c,v 1.156 2010/08/10 01:21:30 sbajic Exp $ */
2
2
 
3
3
/*
4
4
 DSPAM
5
 
 COPYRIGHT (C) 2002-2006 JONATHAN A. ZDZIARSKI
 
5
 COPYRIGHT (C) 2002-2010 DSPAM PROJECT
6
6
 
7
7
 This program is free software; you can redistribute it and/or
8
8
 modify it under the terms of the GNU General Public License
76
76
  agent_config = read_config(NULL);
77
77
  if (!agent_config) {
78
78
    LOG(LOG_ERR, ERR_AGENT_READ_CONFIG);
 
79
    fprintf (stderr, ERR_AGENT_READ_CONFIG "\n");
79
80
    exit(EXIT_FAILURE);
80
81
  }
81
82
                                                                                
82
83
  if (!_ds_read_attribute(agent_config, "Home")) {
83
84
    LOG(LOG_ERR, ERR_AGENT_DSPAM_HOME);
 
85
    fprintf (stderr, ERR_AGENT_DSPAM_HOME "\n");
84
86
    _ds_destroy_config(agent_config);
85
87
    exit(EXIT_FAILURE);
86
88
  }
87
89
                                                                                
88
 
  libdspam_init(_ds_read_attribute(agent_config, "StorageDriver"));
 
90
  if (libdspam_init(_ds_read_attribute(agent_config, "StorageDriver")) != 0) {
 
91
    LOG(LOG_ERR, ERR_DRV_INIT);
 
92
    fprintf (stderr, ERR_DRV_INIT "\n");
 
93
    _ds_destroy_config(agent_config);
 
94
    exit(EXIT_FAILURE);
 
95
  }
89
96
 
90
97
#ifndef _WIN32
91
98
#ifdef TRUSTED_USER_SECURITY
125
132
    {
126
133
      if (!_ds_match_attribute(agent_config, "Profile", argv[i]+10)) {
127
134
        LOG(LOG_ERR, ERR_AGENT_NO_SUCH_PROFILE, argv[i]+10);
 
135
        fprintf (stderr, ERR_AGENT_NO_SUCH_PROFILE "\n", argv[i]+10);
128
136
        goto bail;
129
137
      } else {
130
138
        _ds_overwrite_attribute(agent_config, "DefaultProfile", argv[i]+10);
156
164
  set_libdspam_attributes(CTX);
157
165
  if (dspam_attach(CTX, NULL)) {
158
166
    LOG (LOG_WARNING, "unable to attach dspam context");
 
167
    fprintf (stderr, "Unable to attach DSPAM context\n");
159
168
    goto bail;
160
169
  }
161
170
 
187
196
    set_libdspam_attributes(MTX);
188
197
    if (dspam_attach(MTX, NULL)) {
189
198
      LOG (LOG_WARNING, "unable to attach dspam context");
 
199
      fprintf (stderr, "Unable to attach DSPAM context\n");
190
200
      goto bail;
191
201
    }
192
202
 
245
255
  exit (EXIT_SUCCESS);
246
256
 
247
257
bail:
 
258
  if (merge1 != NULL)
 
259
    ds_diction_destroy(merge1);
 
260
  if (merge2 != NULL)
 
261
    ds_diction_destroy(merge2);
248
262
  if (open_ctx != NULL)
249
263
    dspam_destroy (open_ctx);
250
264
  if (open_mtx != NULL)
251
265
    dspam_destroy (open_mtx);
252
266
  dspam_shutdown_driver (NULL);
253
 
  nt_destroy(users);
 
267
  if (users != NULL)
 
268
    nt_destroy(users);
254
269
  _ds_destroy_config(agent_config);
255
270
  libdspam_shutdown();
256
271
  exit (EXIT_FAILURE);
259
274
void
260
275
dieout (int signal)
261
276
{
 
277
  signal = signal; /* Keep compile happy */
262
278
  fprintf (stderr, "terminated.\n");
263
279
  if (open_ctx != NULL)
264
280
    dspam_destroy (open_ctx);
267
283
  _ds_destroy_config(agent_config);
268
284
  exit (EXIT_SUCCESS);
269
285
}
270