copy a string over itself. The library routine is documented as not
supporting overlapping copies, and on MacOS it actually raised a SIGABRT.
+JH/32 For main options check_spool_space and check_inode_space, where the
+ platform supports 64b integers, support more than the previous 2^31 kB
+ (i.e. more than 2 TB). Accept E, P and T multipliers in addition to
+ the previous G, M, k.
+
Exim version 4.91
-----------------
extern BOOL receive_check_fs(int);
extern BOOL receive_check_set_sender(uschar *);
extern BOOL receive_msg(BOOL);
-extern int receive_statvfs(BOOL, int *);
+extern int_eximarith_t receive_statvfs(BOOL, int *);
extern void receive_swallow_smtp(void);
#ifdef WITH_CONTENT_SCAN
extern int regex(const uschar **);
uschar *callout_random_local_part = US"$primary_hostname-$tod_epoch-testing";
uschar *check_dns_names_pattern= US"(?i)^(?>(?(1)\\.|())[^\\W](?>[a-z0-9/_-]*[^\\W])?)+(\\.?)$";
int check_log_inodes = 100;
-int check_log_space = 10*1024; /* 10K Kbyte == 10MB */
+int_eximarith_t check_log_space = 10*1024; /* 10K Kbyte == 10MB */
int check_spool_inodes = 100;
-int check_spool_space = 10*1024; /* 10K Kbyte == 10MB */
+int_eximarith_t check_spool_space = 10*1024; /* 10K Kbyte == 10MB */
uschar *chunking_advertise_hosts = US"*";
unsigned chunking_datasize = 0;
extern uschar *callout_random_local_part; /* Local part to be used to check if server called will accept any local part */
extern uschar *check_dns_names_pattern;/* Regex for syntax check */
extern int check_log_inodes; /* Minimum for message acceptance */
-extern int check_log_space; /* Minimum for message acceptance */
+extern int_eximarith_t check_log_space; /* Minimum for message acceptance */
extern BOOL check_rfc2047_length; /* Check RFC 2047 encoded string length */
extern int check_spool_inodes; /* Minimum for message acceptance */
-extern int check_spool_space; /* Minimum for message acceptance */
+extern int_eximarith_t check_spool_space; /* Minimum for message acceptance */
extern uschar *chunking_advertise_hosts; /* RFC 3030 CHUNKING */
extern unsigned chunking_datasize;
extern unsigned chunking_data_left;
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "%sinteger expected for %s",
inttype, name);
- if (errno != ERANGE)
- if (tolower(*endptr) == 'k')
- {
- if (lvalue > INT_MAX/1024 || lvalue < INT_MIN/1024) errno = ERANGE;
- else lvalue *= 1024;
- endptr++;
- }
- else if (tolower(*endptr) == 'm')
- {
- if (lvalue > INT_MAX/(1024*1024) || lvalue < INT_MIN/(1024*1024))
- errno = ERANGE;
- else lvalue *= 1024*1024;
- endptr++;
- }
- else if (tolower(*endptr) == 'g')
- {
- if (lvalue > INT_MAX/(1024*1024*1024) || lvalue < INT_MIN/(1024*1024*1024))
- errno = ERANGE;
- else lvalue *= 1024*1024*1024;
- endptr++;
- }
+ if (errno != ERANGE && *endptr)
+ {
+ uschar * mp = US"GgMmKk\0"; /* YyZzEePpTtGgMmKk */
+
+ if ((mp = Ustrchr(mp, *endptr)))
+ {
+ endptr++;
+ do
+ {
+ if (lvalue > INT_MAX/1024 || lvalue < INT_MIN/1024)
+ {
+ errno = ERANGE;
+ break;
+ }
+ lvalue *= 1024;
+ }
+ while (*(mp += 2));
+ }
+ }
if (errno == ERANGE || lvalue > INT_MAX || lvalue < INT_MIN)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"absolute value of integer \"%s\" is too large (overflow)", s);
while (isspace(*endptr)) endptr++;
- if (*endptr != 0)
+ if (*endptr)
extra_chars_error(endptr, inttype, US"integer value for ", name);
value = (int)lvalue;
}
- if (data_block == NULL)
- *((int *)(ol->value)) = value;
+ if (data_block)
+ *(int *)(US data_block + (long int)ol->value) = value;
else
- *((int *)(US data_block + (long int)(ol->value))) = value;
+ *(int *)ol->value = value;
break;
- /* Integer held in K: again, allow octal and hex formats, and suffixes K, M
- and G. */
- /*XXX consider moving to int_eximarith_t (but mind the overflow test 0415) */
+ /* Integer held in K: again, allow octal and hex formats, and suffixes K, M,
+ G and T. */
case opt_Kint:
{
uschar *endptr;
errno = 0;
- value = strtol(CS s, CSS &endptr, intbase);
+ int_eximarith_t lvalue = strtol(CS s, CSS &endptr, intbase);
if (endptr == s)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "%sinteger expected for %s",
inttype, name);
- if (errno != ERANGE)
- if (tolower(*endptr) == 'g')
- {
- if (value > INT_MAX/(1024*1024) || value < INT_MIN/(1024*1024))
- errno = ERANGE;
- else
- value *= 1024*1024;
- endptr++;
- }
- else if (tolower(*endptr) == 'm')
- {
- if (value > INT_MAX/1024 || value < INT_MIN/1024)
- errno = ERANGE;
- else
- value *= 1024;
- endptr++;
- }
- else if (tolower(*endptr) == 'k')
- endptr++;
+ if (errno != ERANGE && *endptr)
+ {
+ uschar * mp = US"EePpTtGgMmKk\0"; /* YyZzEePpTtGgMmKk */
+
+ if ((mp = Ustrchr(mp, *endptr)))
+ {
+ endptr++;
+ do
+ {
+ if (lvalue > EXIM_ARITH_MAX/1024 || lvalue < EXIM_ARITH_MIN/1024)
+ {
+ errno = ERANGE;
+ break;
+ }
+ lvalue *= 1024;
+ }
+ while (*(mp += 2));
+ }
else
- value = (value + 512)/1024;
+ lvalue = (lvalue + 512)/1024;
+ }
if (errno == ERANGE) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"absolute value of integer \"%s\" is too large (overflow)", s);
while (isspace(*endptr)) endptr++;
if (*endptr != 0)
extra_chars_error(endptr, inttype, US"integer value for ", name);
- }
- if (data_block == NULL)
- *((int *)(ol->value)) = value;
- else
- *((int *)(US data_block + (long int)(ol->value))) = value;
- break;
+ if (data_block)
+ *(int_eximarith_t *)(US data_block + (long int)ol->value) = lvalue;
+ else
+ *(int_eximarith_t *)ol->value = lvalue;
+ break;
+ }
/* Fixed-point number: held to 3 decimal places. */
case opt_Kint:
{
- int x = *((int *)value);
+ int_eximarith_t x = *((int_eximarith_t *)value);
if (!no_labels) printf("%s = ", name);
if (x == 0) printf("0\n");
- else if ((x & 1023) == 0) printf("%dM\n", x >> 10);
- else printf("%dK\n", x);
+ else if ((x & ((1<<20)-1)) == 0) printf(PR_EXIM_ARITH "G\n", x >> 20);
+ else if ((x & ((1<<10)-1)) == 0) printf(PR_EXIM_ARITH "M\n", x >> 10);
+ else printf(PR_EXIM_ARITH "K\n", x);
}
break;
All values are -1 if the STATFS functions are not available.
*/
-int
+int_eximarith_t
receive_statvfs(BOOL isspool, int *inodeptr)
{
#ifdef HAVE_STATFS
/* Disks are getting huge. Take care with computing the size in kilobytes. */
-return (int)(((double)statbuf.F_BAVAIL * (double)statbuf.F_FRSIZE)/1024.0);
+return (int_eximarith_t)(((double)statbuf.F_BAVAIL * (double)statbuf.F_FRSIZE)/1024.0);
#else
/* Unable to find partition sizes in this environment. */
BOOL
receive_check_fs(int msg_size)
{
-int space, inodes;
+int_eximarith_t space;
+int inodes;
if (check_spool_space > 0 || msg_size > 0 || check_spool_inodes > 0)
{
DEBUG(D_receive)
debug_printf("spool directory space = %dK inodes = %d "
- "check_space = %dK inodes = %d msg_size = %d\n",
+ "check_space = " PR_EXIM_ARITH "K inodes = %d msg_size = %d\n",
space, inodes, check_spool_space, check_spool_inodes, msg_size);
if ((space >= 0 && space < check_spool_space) ||
DEBUG(D_receive)
debug_printf("log directory space = %dK inodes = %d "
- "check_space = %dK inodes = %d\n",
+ "check_space = " PR_EXIM_ARITH "K inodes = %d\n",
space, inodes, check_log_space, check_log_inodes);
if ((space >= 0 && space < check_log_space) ||
# Exim test configuration 0180
# Require immense amount of disk space, expecting to fail. Can unfortunately work on big filesystems.
-CSS=check_spool_space=400G
+CSS=check_spool_space=1024T
.include DIR/aux-var/std_conf_prefix
1999-03-02 09:44:33 Exim configuration error in line 15 of TESTSUITE/test-config:
- absolute value of integer "4000000M" is too large (overflow)
+ absolute value of integer "4000E" is too large (overflow)
1999-03-02 09:44:33 Exim configuration error in line 15 of TESTSUITE/test-config:
extra characters follow integer value for check_spool_space
1999-03-02 09:44:33 Exim configuration error in line 16 of TESTSUITE/test-config:
# overflow in integer options
1
-exim -DARG1=4000000M -bP check_spool_space
+exim -DARG1=4000E -bP check_spool_space
+****
+exim -DARG1=4000G -bP check_spool_space
****
1
exim -DARG1=40MK -bP check_spool_space
LOG: PANIC DIE
Exim configuration error in line 15 of TESTSUITE/test-config:
- absolute value of integer "4000000M" is too large (overflow)
+ absolute value of integer "4000E" is too large (overflow)
LOG: PANIC DIE
Exim configuration error in line 15 of TESTSUITE/test-config:
extra characters follow integer value for check_spool_space
+check_spool_space = 4096000G
finduser_retries = 0
finduser_retries = 999999999
finduser_retries = 1023998976