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

« back to all changes in this revision

Viewing changes to src/agent_shared.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Valroff, Julien Valroff, Thomas Preud'homme
  • Date: 2011-08-13 08:12:05 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20110813081205-cron89122k4fs2xe
Tags: 3.10.1+dfsg-1
[ Julien Valroff ]
* New upstream release:
  + Update copyright information following to upstream license switch from
    GPL-2 to AGPL-3+
  + Drop patches merged upstream
* Ensures system user is actually locked on purge, and unlocked in case
  the package is reinstalled
* Demote various MDA's from Depends to Recommends
* Add multiarch support:
  + Move the hash driver to as dedicated package
  + Clean .install files
  + Split debugging symbols into independent debug packages
  + Move dspam_pg2int8 to dspam (which introduces a new dependency on
  libpq5)
* Remove useless 001_drivers-in-usr_lib_dspam patch
* Remove useless calls to ucf in libdspam7-drv-{mysql,pgsql}.postinst
  scripts

[ Thomas Preud'homme ]
* Set build flags (CPPFLAGS, CFLAGS and LDFLAGS) using dpkg-buildflags.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: agent_shared.c,v 1.81 2010/08/22 20:16:54 sbajic Exp $ */
 
1
/* $Id: agent_shared.c,v 1.86 2011/07/11 22:05:48 sbajic Exp $ */
2
2
 
3
3
/*
4
4
 DSPAM
5
 
 COPYRIGHT (C) 2002-2010 DSPAM PROJECT
 
5
 COPYRIGHT (C) 2002-2011 DSPAM PROJECT
6
6
 
7
 
 This program is free software; you can redistribute it and/or
8
 
 modify it under the terms of the GNU General Public License
9
 
 as published by the Free Software Foundation; version 2
10
 
 of the License.
 
7
 This program is free software: you can redistribute it and/or modify
 
8
 it under the terms of the GNU Affero General Public License as
 
9
 published by the Free Software Foundation, either version 3 of the
 
10
 License, or (at your option) any later version.
11
11
 
12
12
 This program is distributed in the hope that it will be useful,
13
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 GNU General Public License for more details.
 
15
 GNU Affero General Public License for more details.
16
16
 
17
 
 You should have received a copy of the GNU General Public License
18
 
 along with this program; if not, write to the Free Software
19
 
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
17
 You should have received a copy of the GNU Affero General Public License
 
18
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
19
 
21
20
*/
22
21
 
94
93
 
95
94
int initialize_atx(AGENT_CTX *ATX) {
96
95
  memset(ATX, 0, sizeof(AGENT_CTX));
97
 
  ATX->training_mode   = DST_DEFAULT;
98
96
  ATX->training_buffer = 0;
99
97
  ATX->train_pristine  = 0;
100
98
  ATX->classification  = DSR_NONE;
237
235
    if (!strncmp (argv[i], "--mode=", 7))
238
236
    {
239
237
      char *mode = strchr(argv[i], '=')+1;
240
 
      process_mode(ATX, mode);
 
238
      if (process_mode(ATX, mode))
 
239
        return EINVAL;
 
240
      ATX->flags |= DAF_FIXED_TR_MODE;
241
241
      continue;
242
242
    }
243
243
 
446
446
    if (!strcmp (argv[i], "--version"))
447
447
    {
448
448
      printf ("\nDSPAM Anti-Spam Suite %s (agent/library)\n\n", VERSION);
449
 
      printf ("Copyright (c) 2002-2010 DSPAM Project\n");
 
449
      printf ("Copyright (C) 2002-2011 DSPAM Project\n");
450
450
      printf ("http://dspam.sourceforge.net.\n\n");
451
 
      printf ("DSPAM may be copied only under the terms of the GNU "
452
 
              "General Public License,\n");
453
 
      printf ("a copy of which can be found with the DSPAM distribution "
454
 
              "kit.\n\n");
 
451
      printf ("DSPAM may be copied only under the terms of the GNU Affero General Public\n");
 
452
      printf ("License, a copy of which can be found with the DSPAM distribution kit.\n\n");
455
453
#ifdef TRUSTED_USER_SECURITY
456
454
      if (ATX->trusted) {
457
455
#endif
590
588
 
591
589
  /* Training mode */
592
590
 
593
 
  if (ATX->training_mode == DST_DEFAULT) {
 
591
  if (!(ATX->flags & DAF_FIXED_TR_MODE)) {
594
592
    char *v = _ds_read_attribute(agent_config, "TrainingMode");
595
 
    process_mode(ATX, v);
 
593
    if (process_mode(ATX, v)) {
 
594
      LOG(LOG_ERR, ERR_AGENT_NO_TR_MODE);
 
595
      return EINVAL;
 
596
    }
596
597
  }
597
598
 
598
599
  /* Default delivery agent */
695
696
    return EINVAL;
696
697
  }
697
698
 
698
 
  if (ATX->training_mode == DST_DEFAULT)
699
 
  {
700
 
    LOG(LOG_ERR, ERR_AGENT_NO_TR_MODE);
701
 
    return EINVAL;
702
 
  }
703
 
 
704
699
  if (!_ds_match_attribute(agent_config, "ParseToHeaders", "on")) {
705
700
 
706
701
    if (ATX->users->items == 0)