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

« back to all changes in this revision

Viewing changes to src/buildconfig.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/buildconfig.c,v 1.15 2009/11/16 19:50:36 nm4 Exp $ */
 
1
/* $Cambridge: exim/src/src/buildconfig.c,v 1.21 2010/06/13 08:26:40 pdp Exp $ */
2
2
 
3
3
/*************************************************
4
4
*     Exim - an Internet mail transport agent    *
103
103
{
104
104
off_t test_off_t = 0;
105
105
time_t test_time_t = 0;
 
106
size_t test_size_t = 0;
 
107
unsigned long test_ulong_t = 0L;
 
108
long test_long_t = 0;
106
109
FILE *base;
107
110
FILE *new;
108
111
int last_initial = 'A';
145
148
This assumption is known to be OK for the common operating systems. */
146
149
 
147
150
fprintf(new, "#ifndef OFF_T_FMT\n");
148
 
if (sizeof(test_off_t) > 4)
 
151
if (sizeof(test_off_t) > sizeof(test_long_t))
149
152
  {
150
153
  fprintf(new, "#define OFF_T_FMT  \"%%lld\"\n");
151
154
  fprintf(new, "#define LONGLONG_T long long int\n");
163
166
off_t. */
164
167
 
165
168
fprintf(new, "#ifndef TIME_T_FMT\n");
166
 
if (sizeof(test_time_t) > 4)
 
169
if (sizeof(test_time_t) > sizeof(test_long_t))
167
170
  {
168
171
  fprintf(new, "#define TIME_T_FMT  \"%%lld\"\n");
169
172
  fprintf(new, "#undef  LONGLONG_T\n");
175
178
  }
176
179
fprintf(new, "#endif\n\n");
177
180
 
 
181
/* And for sizeof() results, size_t, which should with C99 be just %zu, deal
 
182
with C99 not being ubiquitous yet.  Unfortunately. */
 
183
 
 
184
#if __STDC_VERSION__ >= 199901L
 
185
fprintf(new, "#define SIZE_T_FMT  \"%%zu\"\n");
 
186
#else
 
187
if (sizeof(test_size_t) > sizeof (test_ulong_t))
 
188
  fprintf(new, "#define SIZE_T_FMT  \"%%llu\"\n");
 
189
else
 
190
  fprintf(new, "#define SIZE_T_FMT  \"%%lu\"\n");
 
191
#endif
 
192
 
178
193
/* Now search the makefile for certain settings */
179
194
 
180
195
base = fopen("Makefile", "rb");
356
371
    uid_t uid = 0;
357
372
    gid_t gid = 0;
358
373
    int gid_set = 0;
 
374
    int uid_not_set = 0;
359
375
    char *username = NULL;
360
376
    char *groupname = NULL;
361
377
    char *s;
410
426
      while (isspace(*user)) user++;
411
427
      username = user;
412
428
      gid_set = 1;
 
429
      uid_not_set = 1;
413
430
      }
414
431
 
415
432
    else
503
520
      return 1;
504
521
      }
505
522
 
 
523
    /* security sanity checks
 
524
    if ref: is being used, we can never be sure, but we can take reasonable
 
525
    steps to filter out the most obvious ones.  */
 
526
 
 
527
    if ((!uid_not_set && uid == 0) ||
 
528
        ((username != NULL) && (
 
529
          (strcmp(username, "root") == 0) ||
 
530
          (strcmp(username, "toor") == 0) )))
 
531
      {
 
532
      printf("\n*** Exim's internal user must not be root.\n\n");
 
533
      return 1;
 
534
      }
 
535
 
506
536
    /* Output user and group names or uid/gid. When names are set, uid/gid
507
537
    are set to zero but will be replaced at runtime. */
508
538
 
770
800
        fprintf(new, "\"%s\"\n", value);
771
801
        }
772
802
 
773
 
      /* Timezone values and HEADERS_CHARSET get quoted */
 
803
      /* Timezone values HEADERS_CHARSET, TCP_WRAPPERS_DAEMON_NAME and
 
804
      WHITELIST_D_MACROS get quoted */
774
805
 
775
806
      else if (strcmp(name, "TIMEZONE_DEFAULT") == 0||
776
 
               strcmp(name, "HEADERS_CHARSET") == 0)
 
807
               strcmp(name, "TCP_WRAPPERS_DAEMON_NAME") == 0||
 
808
               strcmp(name, "HEADERS_CHARSET") == 0||
 
809
               strcmp(name, "WHITELIST_D_MACROS") == 0)
777
810
        fprintf(new, "\"%s\"\n", value);
778
811
 
779
812
      /* For others, quote any paths and don't quote anything else */