X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/69358f0206debf14a18c7e798e23133d304232b6..dcd3e9553bf120cf570ec1d51e6c7121dbb7e2c3:/src/src/exim.c diff --git a/src/src/exim.c b/src/src/exim.c index c8d1917a4..80857a698 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim.c,v 1.5 2004/10/19 11:04:26 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim.c,v 1.9.2.1 2004/12/02 09:15:11 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -196,9 +196,9 @@ os_non_restarting_signal(SIGALRM, sigalrm_handler); /* This function is called by millisleep() and exim_wait_tick() to wait for a period of time that may include a fraction of a second. The coding is somewhat -tedious. We do not expect setitimer() ever to fail, but if it does, the process -will wait for ever, so we panic in this instance. (There was a case of this -when a bug in a function that calls milliwait() caused it to pass invalid data. +tedious. We do not expect setitimer() ever to fail, but if it does, the process +will wait for ever, so we panic in this instance. (There was a case of this +when a bug in a function that calls milliwait() caused it to pass invalid data. That's when I added the check. :-) Argument: an itimerval structure containing the interval @@ -214,8 +214,8 @@ sigset_t old_sigmask; (void)sigaddset(&sigmask, SIGALRM); /* Add SIGALRM */ (void)sigprocmask(SIG_BLOCK, &sigmask, &old_sigmask); /* Block SIGALRM */ if (setitimer(ITIMER_REAL, itval, NULL) < 0) /* Start timer */ - log_write(0, LOG_MAIN|LOG_PANIC_DIE, - "setitimer() failed: %s", strerror(errno)); + log_write(0, LOG_MAIN|LOG_PANIC_DIE, + "setitimer() failed: %s", strerror(errno)); (void)sigfillset(&sigmask); /* All signals */ (void)sigdelset(&sigmask, SIGALRM); /* Remove SIGALRM */ (void)sigsuspend(&sigmask); /* Until SIGALRM */ @@ -640,7 +640,7 @@ if (address == NULL) else { int rc = verify_address(deliver_make_addr(address,TRUE), stdout, flags, -1, - -1, NULL, NULL, NULL); + -1, -1, NULL, NULL, NULL); if (rc == FAIL) *exit_value = 2; else if (rc == DEFER && *exit_value == 0) *exit_value = 1; } @@ -839,6 +839,9 @@ fprintf(f, "Support for:"); fprintf(f, " OpenSSL"); #endif #endif +#ifdef WITH_CONTENT_SCAN + fprintf(f, " Content_Scanning"); +#endif fprintf(f, "\n"); fprintf(f, "Lookups:"); @@ -1863,7 +1866,8 @@ for (i = 1; i < argc; i++) break; /* -d: Set debug level (see also -v below) or set the drop_cr option. - The latter is now a no-opt, retained for compatibility only. */ + The latter is now a no-op, retained for compatibility only. If -dd is used, + debugging subprocesses of the daemon is disabled. */ case 'd': if (Ustrcmp(argrest, "ropcr") == 0) @@ -1879,6 +1883,11 @@ for (i = 1; i < argc; i++) unsigned int selector = D_default; debug_selector = 0; debug_file = NULL; + if (*argrest == 'd') + { + debug_daemon = TRUE; + argrest++; + } if (*argrest != 0) decode_bits(&selector, NULL, argrest, debug_options, debug_options_count, US"debug"); @@ -2837,21 +2846,21 @@ else strerror(errno)); rlp.rlim_cur = rlp.rlim_max = 0; } - - /* I originally chose 1000 as a nice big number that was unlikely to + + /* I originally chose 1000 as a nice big number that was unlikely to be exceeded. It turns out that some older OS have a fixed upper limit of 256. */ - + if (rlp.rlim_cur < 1000) { rlp.rlim_cur = rlp.rlim_max = 1000; if (setrlimit(RLIMIT_NOFILE, &rlp) < 0) - { + { rlp.rlim_cur = rlp.rlim_max = 256; if (setrlimit(RLIMIT_NOFILE, &rlp) < 0) log_write(0, LOG_MAIN|LOG_PANIC, "setrlimit(RLIMIT_NOFILE) failed: %s", strerror(errno)); - } + } } #endif @@ -4088,10 +4097,22 @@ call to find the ident for. */ if (host_checking) { + int x[4]; + int size; + sender_ident = NULL; if (running_in_test_harness && sender_host_port != 0 && interface_address != NULL && interface_port != 0) verify_get_ident(1413); + + /* In case the given address is a non-canonical IPv6 address, canonicize + it. The code works for both IPv4 and IPv6, as it happens. */ + + size = host_aton(sender_host_address, x); + sender_host_address = store_get(48); /* large enough for full IPv6 */ + (void)host_nmtoa(size, x, -1, sender_host_address, ':'); + + /* Now set up for testing */ host_build_sender_fullhost(); smtp_input = TRUE; @@ -4393,11 +4414,11 @@ while (more) int rcount = 0; int count = argc - recipients_arg; uschar **list = argv + recipients_arg; - + /* These options cannot be changed dynamically for non-SMTP messages */ - + active_local_sender_retain = local_sender_retain; - active_local_from_check = local_from_check; + active_local_from_check = local_from_check; /* Save before any rewriting */ @@ -4602,11 +4623,16 @@ while (more) /* Else do the delivery unless the ACL or local_scan() called for queue only or froze the message. Always deliver in a separate process. A fork failure is not a disaster, as the delivery will eventually happen on a subsequent queue - run. */ + run. The search cache must be tidied before the fork, as the parent will + do it before exiting. The child will trigger a lookup failure and + thereby defer the delivery if it tries to use (for example) a cached ldap + connection that the parent has called unbind on. */ else if (!queue_only_policy && !deliver_freeze) { pid_t pid; + search_tidyup(); + if ((pid = fork()) == 0) { int rc;