Some little enhancements to Exim 0.54

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Piercarlo Grandi
Fecha:  
A: Mailing list for Exim users
Asunto: Some little enhancements to Exim 0.54
I have appended a patch file for Exim 0.54; it contains four
enhancements:

  * the locking logic is now encapsulated in its own function,
    'os_lock'. This cleans up the source a bit, and one can then
    define to use 'fcntl'-style locking or any other.


  * the patterns matching code special cases the patterns "*" and "!*"
    for speed.


  * The pid and log files are now given paths that can be specified in
    the Exim configuration file, they don't need to be under the Exim
    spool directory. For example:


      pid_fpath="/var/run/exim%s.pid"
      log_fpath="/var/log/exim_%s.log"


    These can also be set at configuration time in Local/Makefile


  * Two new configuration file variables, and two new command line
    options, allow one to define local parts (for local delivery) or
    domains (for remote forwarding) for whom delivery will happen
    immediately; otherwise delivery happens only on queue runs (-q) or
    when forced (-M). For example:


      quick_locals="*"
      quick_domains="!*"


    These are meant to complement/supplant the 'queue_only' and
    'queue_smtp' options. Their purpose is to allow deferring actual
    delivery to queue runs or forced deliveries for some/all local parts
    or remote domains, for example in the case of a gateway that is only
    intermittenly connected to the Internet or to parts of its local
    zone.


There are a couple of minor other corrections.

All the above enhancements are configured by default so that there is
not visible change in Exim's operation, with the single exception that
log file directories are not created automatically if they don't already
exist.

diff -ru ../exim-0.54/OS/os.h-Linux ./OS/os.h-Linux
--- ../exim-0.54/OS/os.h-Linux    Fri Jul 26 12:04:58 1996
+++ ./OS/os.h-Linux    Wed Jul 31 22:10:31 1996
@@ -5,6 +5,12 @@
 #define F_FREESP     O_TRUNC
 typedef struct flock flock_t;


+/* The latest Linux systems use flock for DBM files; also, using fcntl like
+ exim does by default badly interlocks with uses of flock. Thus we must provide
+ flock in fcntl guise to exim. */
+
+/*#define OS_USE_FLOCK*/
+
/* The latest Linux systems don't have dbm_pagfno(); see comments in dbhdr.h
for background to this. */

diff -ru ../exim-0.54/scripts/exim_install ./scripts/exim_install
--- ../exim-0.54/scripts/exim_install    Fri Jul 26 12:04:59 1996
+++ ./scripts/exim_install    Wed Jul 31 22:10:31 1996
@@ -105,8 +105,7 @@
       ${real} chown ${INST_UID} ${BIN_DIRECTORY}/exim
       if [ $? -ne 0 ]; then 
         echo $com "" 
-        echo $com "**** You must be ${INST_UID} to install exim ****"
-        exit 1
+        echo $com "**** You ought to be ${INST_UID} to install exim ****"
       fi    
       echo chmod a+x ${BIN_DIRECTORY}/exim
       ${real} chmod a+x ${BIN_DIRECTORY}/exim
diff -ru ../exim-0.54/src/EDITME ./src/EDITME
--- ../exim-0.54/src/EDITME    Fri Jul 26 12:04:59 1996
+++ ./src/EDITME    Wed Jul 31 22:10:31 1996
@@ -156,15 +156,6 @@
 # which can be defined here (default 0750).


# INPUT_DIRECTORY_MODE=0750
-
-
-# Exim log directory and files: Exim creates a directory called "log" inside
-# its spool directory. The mode defaults to 0750, but can be changed here.
-# The log files themselves are created with a default mode of 0640, but that
-# can also be changed here.
-
-# LOG_DIRECTORY_MODE=0750
-# LOG_MODE=0640


# Per-message logs: While a message is in the process of being delivered,
@@ -226,6 +217,28 @@
# relevant if you are going to run the Exim monitor.

# SPOOL_MODE=0600
+
+
+# Exim log prefix: Exim creates several log files. You can set here the
+# path of such files; it must contain a "%s" format specification.
+# The log files themselves are created with a default mode of 0640, but that
+# can also be changed here.
+
+# Many installations will want something like this
+# LOG_FPATH=/var/log/exim_%s.log
+
+LOG_FPATH=/usr/exim/spool/%slog
+
+# LOG_MODE=0640
+
+
+# Exim pid file: Exim records its process number in a pid file. You can set
+# here the path of the file; it must contain a "%s" format specification.
+
+# Many installations will want something like this
+# PID_FPATH=/var/lock/exim%s.pid
+
+PID_FPATH=/usr/exim/spool/exim-daemon%s.pid


 # If STDERR_FILE is defined then the -df command line option causes Exim to
diff -ru ../exim-0.54/src/accept.c ./src/accept.c
--- ../exim-0.54/src/accept.c    Fri Jul 26 12:04:59 1996
+++ ./src/accept.c    Thu Aug  1 16:27:06 1996
@@ -380,7 +380,6 @@
 BOOL extracted_bcc = FALSE;


BOOL first_open = TRUE;
-flock_t lock_data;

error_block *bad_addresses = NULL;

@@ -1171,9 +1170,7 @@
/* We now have data file open. Build a stream for it and lock it. */

data_file = fdopen(data_fd, "w+");
-lock_data.l_type = F_WRLCK;
-lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;
-if (fcntl(data_fd, F_SETLK, &lock_data) < 0)
+if (os_lock(data_fd, F_WRLCK) < 0)
log_write(LOG_MAIN | LOG_PANIC_DIE, "Cannot lock %s", spool_name);

 /* We have an open, locked data file. Read the remainder of the input of this
diff -ru ../exim-0.54/src/buildconfig.c ./src/buildconfig.c
--- ../exim-0.54/src/buildconfig.c    Fri Jul 26 12:04:59 1996
+++ ./src/buildconfig.c    Wed Jul 31 22:10:31 1996
@@ -214,6 +214,8 @@
       { 
       *t = 0;
       if (strcmp(s, "SPOOL_DIRECTORY") == 0 ||
+          strcmp(s, "PID_FPATH")   == 0 || 
+          strcmp(s, "LOG_FPATH")   == 0 || 
           strcmp(s, "BIN_DIRECTORY")   == 0 || 
           strcmp(s, "CONFIGURE_FILE")  == 0)
         {
diff -ru ../exim-0.54/src/config.h.defaults ./src/config.h.defaults
--- ../exim-0.54/src/config.h.defaults    Fri Jul 26 12:04:59 1996
+++ ./src/config.h.defaults    Wed Jul 31 22:10:31 1996
@@ -32,9 +32,6 @@


#define INPUT_DIRECTORY_MODE 0750

-#define LOG_DIRECTORY_MODE    0750
-#define LOG_MODE              0640
-
 #define MSGLOG_DIRECTORY_MODE 0750


 #define ROUTER_DOMAINLIST
@@ -46,6 +43,9 @@
 #define SPOOL_DIRECTORY
 #define SPOOL_DIRECTORY_MODE  0750
 #define SPOOL_MODE            0600
+#define LOG_FPATH
+#define LOG_MODE              0640
+#define PID_FPATH
 #define STDERR_FILE


 #define TRANSPORT_APPENDFILE
diff -ru ../exim-0.54/src/daemon.c ./src/daemon.c
--- ../exim-0.54/src/daemon.c    Fri Jul 26 12:04:59 1996
+++ ./src/daemon.c    Thu Aug  1 04:59:04 1996
@@ -421,9 +421,12 @@
 last started will get its pid written. */


if (smtp_port < 0)
- sprintf(buff, "%s/exim-daemon.pid", spool_directory);
+ sprintf(buff, pid_fpath, "");
else
- sprintf(buff, "%s/exim-daemon.%d.pid", spool_directory, smtp_port);
+ {
+ sprintf(buff, ".%d", smtp_port);
+ sprintf(buff, pid_fpath, buff);
+ }

 /* Close all open file descriptors and disconnect from the controlling
 terminal, if we are not debugging. Most modern Unixes seem to have setsid() for
diff -ru ../exim-0.54/src/db.c ./src/db.c
--- ../exim-0.54/src/db.c    Fri Jul 26 12:05:00 1996
+++ ./src/db.c    Thu Aug  1 16:34:12 1996
@@ -48,7 +48,7 @@
 db_open(char *name, int flags)
 {
 EXIM_DB *dbm;
-flock_t lock_data;
+int lock_type;
 int lock_count = 0;
 char buffer[256];


@@ -62,14 +62,13 @@
}
if (dbm == NULL) return NULL;

-lock_data.l_type =
+lock_type =
((flags & (O_RDONLY|O_WRONLY|O_RDWR)) == O_RDONLY)? F_RDLCK : F_WRLCK;
-lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;

/* EXIM_DBFD() yields a file descriptor; precisely which one when there
are two files is OS-dependent. */

-while (fcntl(EXIM_DBFD(dbm), F_SETLK, &lock_data) < 0)
+while (os_lock(EXIM_DBFD(dbm), lock_type) < 0)
   {
   if (lock_count++ > DB_LOCK_RETRIES)
     {
@@ -105,11 +104,7 @@
 void 
 db_close(EXIM_DB *dbm)
 {
-flock_t lock_data;
-lock_data.l_type = F_UNLCK;
-lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;
-
-if (fcntl(EXIM_DBFD(dbm), F_SETLK, &lock_data) < 0)
+if (os_lock(EXIM_DBFD(dbm), F_UNLCK) < 0)
   {
   log_write(LOG_MAIN, "Unlock failed for %s file: %s", EXIM_DBTYPE,
     strerror(errno));
diff -ru ../exim-0.54/src/deliver.c ./src/deliver.c
--- ../exim-0.54/src/deliver.c    Fri Jul 26 12:05:00 1996
+++ ./src/deliver.c    Thu Aug  1 16:25:05 1996
@@ -1738,6 +1738,18 @@
             DTYPE_DIRECTOR, '=');
           }


+    /* If we are not on a queue run, and the local part is not one of
+    the quick ones, defer directing to the next queue run */
+
+        else if (!(queue_interval >= 0 || deliver_force ||
+            match_isinlist(addr->local_part, quick_locals, &re_quick_locals)))
+          {
+          DEBUG(2) debug_printf("directing awaits for '%s'\n",addr->local_part);
+          addr->message = "waiting for next queue run";
+          post_process_single(addr, DEFER, LOG_MAIN,
+        FALSE, DTYPE_DIRECTOR, '=');
+          }
+
         /* Otherwise set up for directing. */


         else
@@ -1791,6 +1803,18 @@
           addr->message = "retry time not reached";
           post_process_single(addr, DEFER, LOG_MAIN, FALSE,
             DTYPE_ROUTER, '=');
+          }
+
+        /* If we are not on a queue run, and the domain is not one of
+        the quick ones, defer routing to the next queue run */
+
+        else if (!(queue_interval >= 0 || deliver_force ||
+            match_isinlist(addr->domain,quick_domains, &re_quick_domains)))
+          {
+          DEBUG(2) debug_printf("routing awaits for '%s'\n",addr->domain);
+          addr->message = "waiting for next queue run";
+          post_process_single(addr, DEFER, LOG_MAIN,
+        FALSE, DTYPE_ROUTER, '=');
           }


         /* Queue for routing, remembering whether there is a retry record or
diff -ru ../exim-0.54/src/exim.c ./src/exim.c
--- ../exim-0.54/src/exim.c    Fri Jul 26 12:05:01 1996
+++ ./src/exim.c    Thu Aug  1 15:02:35 1996
@@ -105,6 +105,8 @@
 BOOL address_test_mode = FALSE;
 BOOL arg_queue_only;
 BOOL arg_queue_smtp;
+char *arg_quick_locals;
+char *arg_quick_domains;
 BOOL extract_recipients = FALSE;
 BOOL forced_delivery = FALSE;
 BOOL deliver_give_up = FALSE;
@@ -114,6 +116,8 @@
 BOOL one_msg_action = FALSE;
 BOOL queue_only_set = FALSE;
 BOOL queue_smtp_set = FALSE;
+BOOL quick_locals_set = FALSE;
+BOOL quick_domains_set = FALSE;
 BOOL smtp_first = TRUE;
 BOOL synchronous_delivery = FALSE;
 BOOL verify_only = FALSE;
@@ -725,7 +729,23 @@
         }
       }
     }
-    
+
+  /* -Q[ld] <patterns>: set the patterns that determine which messages
+     are delivered instead of just left on the queue */
+
+  else if (strncmp(argv[i], "-Ql", 3) == 0)
+    {
+    arg_quick_locals = (argv[i][3] != '\0') ? argv[i]+3 : argv[++i];
+    quick_locals_set = TRUE;
+    }
+
+
+  else if (strncmp(argv[i], "-Qd", 3) == 0)
+    {
+    arg_quick_domains = (argv[i][3] != '\0') ? argv[i]+3 : argv[++i];
+    quick_domains_set = TRUE;
+    }
+   
   /* -R: Set string to match in addresses for forced queue run to
   pick out particular messages. */


@@ -999,6 +1019,8 @@

if (queue_only_set) queue_only = arg_queue_only;
if (queue_smtp_set) queue_smtp = arg_queue_smtp;
+if (quick_locals_set) quick_locals = arg_quick_locals;
+if (quick_domains_set) quick_domains = arg_quick_domains;
if (arg_accept_timeout >= 0) accept_timeout = arg_accept_timeout;


diff -ru ../exim-0.54/src/eximon.src ./src/eximon.src
--- ../exim-0.54/src/eximon.src    Fri Jul 26 12:05:02 1996
+++ ./src/eximon.src    Wed Jul 31 22:10:32 1996
@@ -94,6 +94,6 @@
 # just the one process, and let it run in parallel with whatever
 # called this script.


-exec ${EXIMON_BINARY} $* &
+exec ${EXIMON_BINARY} "$@"

 # End
diff -ru ../exim-0.54/src/functions.h ./src/functions.h
--- ../exim-0.54/src/functions.h    Fri Jul 26 12:05:02 1996
+++ ./src/functions.h    Thu Aug  1 16:27:24 1996
@@ -147,4 +147,6 @@
 extern void verify_setup_netlist(char *, ip_net_item **);
 extern void version_init(void);


+extern int os_lock(int fd, int ld);
+
 /* End of functions.h */
diff -ru ../exim-0.54/src/globals.c ./src/globals.c
--- ../exim-0.54/src/globals.c    Fri Jul 26 12:05:02 1996
+++ ./src/globals.c    Thu Aug  1 16:26:15 1996
@@ -194,10 +194,14 @@
 BOOL   queue_only             = FALSE;
 int    queue_run_max          = 5;
 BOOL   queue_smtp             = FALSE;
+char  *quick_locals           = NULL;
+char  *quick_domains          = NULL;


 char **raw_recipients         = NULL;


 re_block *re_local_domains    = NULL;
+re_block *re_quick_locals     = NULL;
+re_block *re_quick_domains    = NULL;
 re_block *re_percent_hack_domains = NULL;
 re_block *re_relay_domains    = NULL;
 re_block *re_remote_sort      = NULL;
@@ -330,6 +334,10 @@
 ip_net_item *smtp_reserve_netlist = NULL;
 char  *smtp_reserve_nets      = NULL;
 BOOL   smtp_verify            = FALSE;
+char  *pid_fpath              = PID_FPATH
+              "\0<--------------Space to patch spool_directory->";
+char  *log_fpath              = LOG_FPATH
+              "\0<--------------Space to patch spool_directory->";
 char  *spool_directory        = SPOOL_DIRECTORY
               "\0<--------------Space to patch spool_directory->";
 char  *stderr_filename        = 
diff -ru ../exim-0.54/src/globals.h ./src/globals.h
--- ../exim-0.54/src/globals.h    Fri Jul 26 12:05:02 1996
+++ ./src/globals.h    Thu Aug  1 16:26:24 1996
@@ -141,8 +141,12 @@
 extern BOOL   queue_only;             /* TRUE to disable immediate delivery */
 extern int    queue_run_max;          /* Max queue runners */
 extern BOOL   queue_smtp;             /* TRUE to disable immediate STMP delivery */
+extern char  *quick_locals;           /* Local parts delivered quickly */
+extern char  *quick_domains;          /* Domains delivered quickly */


 extern re_block *re_local_domains;    /* For keeping compiled regexps */
+extern re_block *re_quick_locals;     /* For keeping compiled regexps */
+extern re_block *re_quick_domains;    /* For keeping compiled regexps */
 extern re_block *re_percent_hack_domains;
 extern re_block *re_relay_domains;
 extern re_block *re_remote_sort;
@@ -248,6 +252,8 @@
 extern char  *smtp_reserve_nets;      /* Networks for reserved slots */
 extern BOOL   smtp_verify;            /* TRUE if VRFY permitted */
 extern char  *spool_directory;        /* Name of spool directory */
+extern char  *log_fpath;              /* Format string for log file path */
+extern char  *pid_fpath;              /* Format string for pid file path */
 extern char  *stderr_filename;        /* File for use with -df */
 extern tree_node *stringmatch_tree;   /* Tree of open files for stringmatch */
 extern BOOL   strip_excess_angle_brackets; /* Surrounding route-addrs */
diff -ru ../exim-0.54/src/log.c ./src/log.c
--- ../exim-0.54/src/log.c    Fri Jul 26 12:05:03 1996
+++ ./src/log.c    Wed Jul 31 22:10:32 1996
@@ -49,11 +49,6 @@
 /* Need to create */


*fd = open(name, O_CREAT|O_APPEND|O_WRONLY, LOG_MODE);
-if (*fd < 0 && errno == ENOENT)
- {
- directory_make(spool_directory, "log", LOG_DIRECTORY_MODE);
- *fd = open(name, O_CREAT|O_APPEND|O_WRONLY, LOG_MODE);
- }

 /* Creation succeeded; change owner if we are currently root, and ensure
 the mode is as specified. */
@@ -200,7 +195,7 @@
     }   
   if (mainlogfd < 0) 
     {
-    sprintf(mainlog_name, "%s/log/mainlog", spool_directory);
+    sprintf(mainlog_name, log_fpath, "main");
     open_log(&mainlogfd, mainlog_name);     /* No return on error */
     if (fstat(mainlogfd, &statbuf) >= 0) mainlog_inode = statbuf.st_ino; 
     }
@@ -217,7 +212,7 @@
   if (rejectlogfd < 0) 
     {
     char buffer[256]; 
-    sprintf(buffer, "%s/log/rejectlog", spool_directory);
+    sprintf(buffer, log_fpath, "reject");
     open_log(&rejectlogfd, buffer); /* No return on error */
     } 
   for (h = header_list; h != NULL; h = h->next)
@@ -242,7 +237,7 @@
   if (processlogfd < 0) 
     {
     char buffer[256];  
-    sprintf(buffer, "%s/log/processlog", spool_directory);
+    sprintf(buffer, log_fpath, "process");
     open_log(&processlogfd, buffer);  /* No return on error */
     } 
   write(processlogfd, log_buffer, ptr - log_buffer);  
@@ -272,7 +267,7 @@
     }


   panic_recurseflag = TRUE; 
-  sprintf(buffer, "%s/log/paniclog", spool_directory); 
+  sprintf(buffer, log_fpath, "panic"); 
   open_log(&paniclogfd, buffer);  /* Won't return on failure */
   panic_recurseflag = FALSE;
   write(paniclogfd, log_buffer, ptr - log_buffer); 
@@ -308,7 +303,7 @@
 #ifdef STAND_ALONE
 int main(void)
 {
-printf("spool directory = %s\n", spool_directory);
+printf("log_fpath = %s\n", log_fpath);
 log_write(LOG_MAIN, "Test output to the log file");
 return 0;
 }
diff -ru ../exim-0.54/src/match.c ./src/match.c
--- ../exim-0.54/src/match.c    Fri Jul 26 12:05:03 1996
+++ ./src/match.c    Thu Aug  1 15:27:52 1996
@@ -179,13 +179,20 @@
 BOOL
 match_isinlist(char *s, char *list, re_block **chain_ad)
 {
-char *ss = string_nextinlist(list, ':');
+if (list == NULL)        return FALSE;
+if (strcmp(list,"*") == 0)    return TRUE;
+if (strcmp(list,"!*") == 0)    return FALSE;


-while (ss != NULL)
   {
-  if (match_string(s, ss, chain_ad)) return TRUE;
-  if (ss[0] == '^' && *chain_ad != NULL) chain_ad = &((*chain_ad)->next);
-  ss = string_nextinlist(NULL, ':');
+  char *ss = string_nextinlist(list, ':');
+
+  while (ss != NULL)
+    {
+    if (match_string(s, ss, chain_ad)) return TRUE;
+    if (ss[0] == '^' && *chain_ad != NULL) chain_ad = &((*chain_ad)->next);
+    ss = string_nextinlist(NULL, ':');
+    }
+
   }


 return FALSE;
diff -ru ../exim-0.54/src/os.c ./src/os.c
--- ../exim-0.54/src/os.c    Fri Jul 26 12:05:03 1996
+++ ./src/os.c    Thu Aug  1 16:27:32 1996
@@ -51,5 +51,34 @@
 }
 #endif /* STRERROR_FROM_ERRLIST */


+#ifdef __linux__
+# ifndef OS_USE_FLOCK
+#  warning You should really use OS_USE_FLOCK with Linux
+# endif
+#endif
+
+#ifndef OS_USE_FLOCK
+int os_lock(int fd, int ld)
+{
+  flock_t lock_data;
+
+  lock_data.l_type = ld;
+  lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;
+
+  return fcntl(fd,F_SETLK,&lock_data)
+}
+#else
+#include <sys/file.h>
+int os_lock(int fd, int ld)
+{
+  const int lockt =
+    (ld == F_RDLCK) ? LOCK_SH
+    : (ld == F_WRLCK) ? LOCK_EX
+    : (ld == F_UNLCK) ? LOCK_UN
+    : (abort(),0);
+
+  return flock(fd, LOCK_NB | lockt);
+}
+#endif


 /* End of os.c */
diff -ru ../exim-0.54/src/readconf.c ./src/readconf.c
--- ../exim-0.54/src/readconf.c    Fri Jul 26 12:05:04 1996
+++ ./src/readconf.c    Thu Aug  1 04:57:25 1996
@@ -47,6 +47,7 @@
   { "local_domains",           opt_lcstringptr, &local_domains },
   { "local_domains_include_host", opt_bool,     &local_domains_include_host }, 
   { "local_domains_include_host_literals", opt_bool, &local_domains_include_host_literals }, 
+  { "log_fpath",               opt_stringptr,   &log_fpath },
   { "log_received_recipients", opt_bool,        &log_received_recipients },
   { "message_body_visible",    opt_mkint,       &message_body_visible }, 
   { "message_id_header_text",  opt_stringptr,   &message_id_text }, 
@@ -55,6 +56,7 @@
   { "nobody_group",            opt_gid,         &nobody_gid },
   { "nobody_user",             opt_uid,         &nobody_uid },
   { "percent_hack_domains",    opt_lcstringptr, &percent_hack_domains },
+  { "pid_fpath",               opt_stringptr,   &pid_fpath },
   { "preserve_message_logs",   opt_bool,        &preserve_message_logs }, 
   { "primary_hostname",        opt_lcstringptr, &primary_hostname },
   { "qualify_domain",          opt_lcstringptr, &qualify_domain_sender },
@@ -62,6 +64,8 @@
   { "queue_only",              opt_bool,        &queue_only },
   { "queue_run_max",           opt_int,         &queue_run_max },
   { "queue_smtp",              opt_bool,        &queue_smtp },
+  { "quick_domains",           opt_lcstringptr, &quick_domains },
+  { "quick_locals",            opt_lcstringptr, &quick_locals },
   { "received_header_text",    opt_stringptr,   &received_header_text },
   { "received_headers_max",    opt_int,         &received_headers_max },
   { "receiver_try_verify",     opt_bool,        &receiver_try_verify }, 
@@ -1375,6 +1379,15 @@
     }   
   local_domains[ptr] = 0;
   }   
+
+/* For backwords compatibility we do immediate delivery on all local parts
+   and all local hosts by default */
+
+if (quick_locals == NULL)
+  quick_locals = "*";
+
+if (quick_domains == NULL)
+  quick_domains = "*";


 /* Setting exim_user in the configuration sets the gid as well if a name is 
 given, but a numerical value does not. Also, we may have a compiled-in uid and
diff -ru ../exim-0.54/src/spool_in.c ./src/spool_in.c
--- ../exim-0.54/src/spool_in.c    Fri Jul 26 12:05:05 1996
+++ ./src/spool_in.c    Thu Aug  1 16:27:38 1996
@@ -26,7 +26,6 @@
 BOOL spool_open_datafile(char *id)
 {
 struct stat statbuf;
-flock_t lock_data;
 char spoolname[256];


sprintf(spoolname, "%s/input/%s-D", spool_directory, id);
@@ -43,10 +42,7 @@
return FALSE;
}

-lock_data.l_type = F_WRLCK;
-lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;
-
-if (fcntl(deliver_datafile, F_SETLK, &lock_data) < 0)
+if (os_lock(deliver_datafile, F_WRLCK) < 0)
   {
   if (message_id[0] == 0 || strcmp(message_id, id) != 0)
     log_write(LOG_MAIN, "Spool file %s-D is locked", id);
diff -ru ../exim-0.54/src/transports/appendfile.c ./src/transports/appendfile.c
--- ../exim-0.54/src/transports/appendfile.c    Fri Jul 26 12:05:06 1996
+++ ./src/transports/appendfile.c    Thu Aug  1 16:27:50 1996
@@ -870,8 +870,6 @@


   for (i = 0; i < ob->lock_retries; sleep(ob->lock_interval), i++)
     {
-    flock_t lock_data;
-
     /* Try to build a lock file if so configured */


     if (ob->use_lockfile)
@@ -913,10 +911,7 @@
     error but a lock file is not required. Now try to lock using fcntl. If we
     fail, get rid of any lock file we created. */


-    lock_fail_type = "fcntl";
-    lock_data.l_type = F_WRLCK;
-    lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0;
-    if (fcntl(fd, F_SETLK, &lock_data) >= 0) break;
+    if (os_lock(fd, F_WRLCK) >= 0) break;
     if (hd > 0) unlink(lockname);
     }


diff -ru ../exim-0.54/util/unknownuser.sh ./util/unknownuser.sh
--- ../exim-0.54/util/unknownuser.sh    Fri Jul 26 12:05:09 1996
+++ ./util/unknownuser.sh    Tue Jun 11 22:11:54 1996
@@ -23,9 +23,6 @@
 # give a bland message, demonstrating the availability of the variables
 # $LOCAL_PART and $DOMAIN.


-cat <<End
-$LOCAL_PART is not a known user mailbox in the domain $DOMAIN.
-End
-
-
-
+exec echo "
+'$LOCAL_PART' is not a known user mailbox in the domain '$DOMAIN'.
+"