~ubuntu-branches/ubuntu/oneiric/exim4/oneiric

« back to all changes in this revision

Viewing changes to src/readconf.c

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2010-12-28 22:20:17 UTC
  • mfrom: (2.3.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20101228222017-r6vg4eqlqy2fk4ul
Tags: 4.73~rc1-1ubuntu1
* Merge from debian unstable.  Remaining changes: (LP: #697934)
  - debian/patches/71_exiq_grep_error_on_messages_without_size.patch:
    + Improve handling of broken messages when "exim4 -bp" (mailq)
      reports lines without size info.
  - debian/control: Don't declare a Provides: default-mta; in Ubuntu,
    we want postfix to be the default.
  - debian/{control,rules}: Add and enable hardened build for PIE.
    (Closes: #542726)
* Drop B-D on libmysqlclient15-dev, resolved in Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Cambridge: exim/exim-src/src/readconf.c,v 1.39 2009/11/16 19:50:37 nm4 Exp $ */
 
1
/* $Cambridge: exim/src/src/readconf.c,v 1.45 2010/06/12 17:56:32 jetmore Exp $ */
2
2
 
3
3
/*************************************************
4
4
*     Exim - an Internet mail transport agent    *
294
294
  { "mysql_servers",            opt_stringptr,   &mysql_servers },
295
295
#endif
296
296
  { "never_users",              opt_uidlist,     &never_users },
 
297
#ifdef SUPPORT_TLS
 
298
  { "openssl_options",          opt_stringptr,   &openssl_options },
 
299
#endif
297
300
#ifdef LOOKUP_ORACLE
298
301
  { "oracle_servers",           opt_stringptr,   &oracle_servers },
299
302
#endif
399
402
  { "system_filter_reply_transport",opt_stringptr,&system_filter_reply_transport },
400
403
  { "system_filter_user",       opt_uid,         &system_filter_uid },
401
404
  { "tcp_nodelay",              opt_bool,        &tcp_nodelay },
 
405
#ifdef USE_TCP_WRAPPERS
 
406
  { "tcp_wrappers_daemon_name", opt_stringptr,   &tcp_wrappers_daemon_name },
 
407
#endif
402
408
  { "timeout_frozen_after",     opt_time,        &timeout_frozen_after },
403
409
  { "timezone",                 opt_stringptr,   &timezone_string },
404
410
#ifdef SUPPORT_TLS
1358
1364
gid_t gid;
1359
1365
BOOL boolvalue = TRUE;
1360
1366
BOOL freesptr = TRUE;
 
1367
BOOL extra_condition = FALSE;
1361
1368
optionlist *ol, *ol2;
1362
1369
struct passwd *pw;
1363
1370
void *reset_point;
1365
1372
uschar *inttype = US"";
1366
1373
uschar *sptr;
1367
1374
uschar *s = buffer;
 
1375
uschar *saved_condition, *strtemp;
 
1376
uschar **str_target;
1368
1377
uschar name[64];
1369
1378
uschar name2[64];
1370
1379
 
1422
1431
  {
1423
1432
  uschar *mname = name;
1424
1433
  if (Ustrncmp(mname, "no_", 3) == 0) mname += 3;
1425
 
  log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
1426
 
    "\"%s\" option set for the second time", mname);
 
1434
  if (Ustrcmp(mname, "condition") == 0)
 
1435
    extra_condition = TRUE;
 
1436
  else
 
1437
    log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
 
1438
      "\"%s\" option set for the second time", mname);
1427
1439
  }
1428
1440
 
1429
1441
ol->type |= opt_set | issecure;
1504
1516
    control block and flags word. */
1505
1517
 
1506
1518
    case opt_stringptr:
 
1519
    if (data_block == NULL)
 
1520
      str_target = (uschar **)(ol->value);
 
1521
    else
 
1522
      str_target = (uschar **)((uschar *)data_block + (long int)(ol->value));
 
1523
    if (extra_condition)
 
1524
      {
 
1525
      /* We already have a condition, we're conducting a crude hack to let
 
1526
      multiple condition rules be chained together, despite storing them in
 
1527
      text form. */
 
1528
      saved_condition = *str_target;
 
1529
      strtemp = string_sprintf("${if and{{bool_lax{%s}}{bool_lax{%s}}}}",
 
1530
          saved_condition, sptr);
 
1531
      *str_target = string_copy_malloc(strtemp);
 
1532
      /* TODO(pdp): there is a memory leak here when we set 3 or more
 
1533
      conditions; I still don't understand the store mechanism enough
 
1534
      to know what's the safe way to free content from an earlier store.
 
1535
      AFAICT, stores stack, so freeing an early stored item also stores
 
1536
      all data alloc'd after it.  If we knew conditions were adjacent,
 
1537
      we could survive that, but we don't.  So I *think* we need to take
 
1538
      another bit from opt_type to indicate "malloced"; this seems like
 
1539
      quite a hack, especially for this one case.  It also means that
 
1540
      we can't ever reclaim the store from the *first* condition.
 
1541
 
 
1542
      Because we only do this once, near process start-up, I'm prepared to
 
1543
      let this slide for the time being, even though it rankles.  */
 
1544
      }
 
1545
    else
 
1546
      {
 
1547
      *str_target = sptr;
 
1548
      freesptr = FALSE;
 
1549
      }
 
1550
    break;
 
1551
 
1507
1552
    case opt_rewrite:
1508
1553
    if (data_block == NULL)
1509
1554
      *((uschar **)(ol->value)) = sptr;
2832
2877
      "configuration file %s", filename));
2833
2878
  }
2834
2879
 
2835
 
/* Check the status of the file we have opened, unless it was specified on
2836
 
the command line, in which case privilege was given away at the start. */
 
2880
/* Check the status of the file we have opened, if we have retained root
 
2881
privileges. */
2837
2882
 
2838
 
if (!config_changed)
 
2883
if (trusted_config)
2839
2884
  {
2840
2885
  if (fstat(fileno(config_file), &statbuf) != 0)
2841
2886
    log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to stat configuration file %s",
2842
2887
      big_buffer);
2843
2888
 
2844
 
  if ((statbuf.st_uid != root_uid &&             /* owner not root */
2845
 
       statbuf.st_uid != exim_uid                /* owner not exim */
 
2889
  if ((statbuf.st_uid != root_uid                /* owner not root */
2846
2890
       #ifdef CONFIGURE_OWNER
2847
2891
       && statbuf.st_uid != config_uid           /* owner not the special one */
2848
2892
       #endif
2849
2893
         ) ||                                    /* or */
2850
 
      (statbuf.st_gid != exim_gid                /* group not exim & */
 
2894
      (statbuf.st_gid != root_gid                /* group not root & */
2851
2895
       #ifdef CONFIGURE_GROUP
2852
2896
       && statbuf.st_gid != config_gid           /* group not the special one */
2853
2897
       #endif
3159
3203
  log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
3160
3204
    "tls_%sverify_hosts is set, but tls_verify_certificates is not set",
3161
3205
    (tls_verify_hosts != NULL)? "" : "try_");
 
3206
 
 
3207
/* If openssl_options is set, validate it */
 
3208
if (openssl_options != NULL)
 
3209
  {
 
3210
# ifdef USE_GNUTLS
 
3211
  log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
 
3212
    "openssl_options is set but we're using GnuTLS");
 
3213
# else
 
3214
  long dummy;
 
3215
  if (!(tls_openssl_options_parse(openssl_options, &dummy)))
 
3216
    log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
 
3217
      "openssl_options parse error: %s", openssl_options);
 
3218
# endif
 
3219
  }
3162
3220
#endif
3163
3221
}
3164
3222