diff -NabBur stunnel-3.8p4/common.h stunnel-3.8p4-olc/common.h
--- stunnel-3.8p4/common.h	Sun Jun 25 17:58:24 2000
+++ stunnel-3.8p4-olc/common.h	Tue Aug  1 14:18:58 2000
@@ -106,6 +106,25 @@
 #endif
 
 #include <syslog.h>
+/* Supported syslog facilities. */
+typedef enum {
+        SYSLOG_FACILITY_DAEMON,
+        SYSLOG_FACILITY_USER,
+        SYSLOG_FACILITY_AUTHPRIV,
+        SYSLOG_FACILITY_AUTH,
+        SYSLOG_FACILITY_MAIL,
+        SYSLOG_FACILITY_NEWS,
+        SYSLOG_FACILITY_CRON,
+        SYSLOG_FACILITY_LOCAL0,
+        SYSLOG_FACILITY_LOCAL1,
+        SYSLOG_FACILITY_LOCAL2,
+        SYSLOG_FACILITY_LOCAL3,
+        SYSLOG_FACILITY_LOCAL4,
+        SYSLOG_FACILITY_LOCAL5,
+        SYSLOG_FACILITY_LOCAL6,
+        SYSLOG_FACILITY_LOCAL7,
+        SYSLOG_FACILITY_NONE
+}       SyslogFacility;
 
 #endif /* USE_WIN32 */
 
@@ -173,6 +192,7 @@
     int random_bytes;	/* how many random bytes to read */
     char *pid_dir;
     int cert_defaults;
+    SyslogFacility log_facility;   /* defaults to SYSLOG_FACILITY_DAEMON */  
 } server_options;
 
 /* Prototypes for stunnel.c */
@@ -196,6 +216,12 @@
 void log_open();
 void log_close();
 void log(int, char *, ...);
+/* name to facility convertor */
+SyslogFacility log_facility_number(char *name);
+/* facility to name convertor */
+char *log_facility_name(SyslogFacility val);
+/* facility to syslog.h convertor */
+int log_facility_sysval(SyslogFacility val);
 
 /* Prototypes for sthreads.c */
 
diff -NabBur stunnel-3.8p4/log.c stunnel-3.8p4-olc/log.c
--- stunnel-3.8p4/log.c	Mon Feb 14 11:16:02 2000
+++ stunnel-3.8p4-olc/log.c	Wed Aug  2 13:14:58 2000
@@ -21,9 +21,65 @@
 #include "common.h"
 #include <stdio.h>
 #include <stdarg.h>
+#include <strings.h>
 
 extern server_options options;
 
+/* textual representation of log-facilities/levels */
+static struct {
+        char *name;
+        int sysval;
+        SyslogFacility val;
+} log_facilities[] = {
+#ifdef LOG_DAEMON
+        { "DAEMON",    LOG_DAEMON,      SYSLOG_FACILITY_DAEMON },
+#endif
+#ifdef LOG_USER
+        { "USER",      LOG_USER,        SYSLOG_FACILITY_USER },
+#endif 
+#ifdef LOG_AUTHPRIV
+        { "AUTHPRIV",  LOG_AUTHPRIV,    SYSLOG_FACILITY_AUTHPRIV },
+#endif
+#ifdef LOG_AUTH
+        { "AUTH",      LOG_AUTH,        SYSLOG_FACILITY_AUTH },
+#endif
+#ifdef LOG_MAIL
+        { "MAIL",      LOG_MAIL,        SYSLOG_FACILITY_MAIL },
+#endif
+#ifdef LOG_NEWS
+        { "NEWS",      LOG_NEWS,        SYSLOG_FACILITY_NEWS },
+#endif
+#ifdef LOG_CRON
+        { "CRON",      LOG_CRON,        SYSLOG_FACILITY_CRON },
+#endif
+#ifdef LOG_LOCAL0
+        { "LOCAL0",    LOG_LOCAL0,      SYSLOG_FACILITY_LOCAL0 },
+#endif
+#ifdef LOG_LOCAL1
+        { "LOCAL1",    LOG_LOCAL1,      SYSLOG_FACILITY_LOCAL1 },
+#endif
+#ifdef LOG_LOCAL2
+        { "LOCAL2",    LOG_LOCAL2,      SYSLOG_FACILITY_LOCAL2 },
+#endif
+#ifdef LOG_LOCAL3
+        { "LOCAL3",    LOG_LOCAL3,      SYSLOG_FACILITY_LOCAL3 },
+#endif
+#ifdef LOG_LOCAL4
+        { "LOCAL4",    LOG_LOCAL4,      SYSLOG_FACILITY_LOCAL4 },
+#endif
+#ifdef LOG_LOCAL5
+        { "LOCAL5",    LOG_LOCAL5,      SYSLOG_FACILITY_LOCAL5 },
+#endif
+#ifdef LOG_LOCAL6
+        { "LOCAL6",    LOG_LOCAL6,      SYSLOG_FACILITY_LOCAL6 },
+#endif
+#ifdef LOG_LOCAL7
+        { "LOCAL7",    LOG_LOCAL7,      SYSLOG_FACILITY_LOCAL7 },
+#endif
+        { NULL,        -1,              SYSLOG_FACILITY_NONE }
+};
+
+
 #ifdef USE_WIN32
 
 void log_open()
@@ -41,7 +97,7 @@
 #ifdef __ultrix__
     openlog("stunnel", LOG_PID);
 #else
-    openlog("stunnel", LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
+    openlog("stunnel", LOG_CONS | LOG_NDELAY | LOG_PID, log_facility_sysval(options.log_facility));
 #endif /* __ultrix__ */
 }
 
@@ -75,4 +131,45 @@
             level, process_id(), thread_id(), text);
     fflush(stderr);
 }
+
+/* find "our" log facility for a given logical name */
+SyslogFacility log_facility_number(char *name)
+{
+        int i;
+        if (name != NULL)
+                for (i = 0; log_facilities[i].name; i++)
+                        if (strcasecmp(log_facilities[i].name, name) == 0)
+                                return (log_facilities[i].val);
+        return (SYSLOG_FACILITY_NONE);
+}
+
+/* find logical name for "our" log facility */
+char *log_facility_name(SyslogFacility val)
+{
+        int i;
+	if (&val != NULL)
+	  for (i = 0; log_facilities[i].name; i++) {
+                       if (log_facilities[i].val == val)
+	                       return (log_facilities[i].name);
+	  }
+  return (NULL);
+}
+
+/* map "our" syslog facility onto facilities from syslog.h */
+int log_facility_sysval(SyslogFacility val)
+{
+        int i;
+	if (&val != NULL)
+	  for (i = 0; log_facilities[i].name; i++) {
+                       if (log_facilities[i].val == val)
+	                       return log_facilities[i].sysval;
+	  }
+  return (-1);
+}
+
+
+
+
+
+
 
diff -NabBur stunnel-3.8p4/stunnel.8.in stunnel-3.8p4-olc/stunnel.8.in
--- stunnel-3.8p4/stunnel.8.in	Sat Jun 24 17:37:59 2000
+++ stunnel-3.8p4-olc/stunnel.8.in	Mon Aug  7 10:27:10 2000
@@ -5,6 +5,7 @@
 .B stunnel
 [-c | -T]
 [-D level]
+[-F facility ]
 [-C cipherlist]
 [-p pemfile]
 [-v level]
@@ -51,6 +52,16 @@
 .RS
 Level is a number between 0 (no logging at all) and 7 (show
 lots of debugging info)
+.RE
+.PP
+.B -F facility
+Syslog facility name
+.RS
+Specify logging to a particular facility, per syslog(3). Default is
+"daemon"; other possibilities may include mail, cron, news, auth,
+local[0-7], and kern. (Names are case-insensitive.) Implentation
+varies by host operating system -- some facilities may not be
+available.
 .RE
 .PP
 .B -C cipherlist
diff -NabBur stunnel-3.8p4/stunnel.c stunnel-3.8p4-olc/stunnel.c
--- stunnel-3.8p4/stunnel.c	Sun Jun 25 17:58:34 2000
+++ stunnel-3.8p4-olc/stunnel.c	Wed Aug  2 13:18:14 2000
@@ -239,8 +239,10 @@
     options.rand_file=NULL;
     options.rand_write=1;
     options.random_bytes=RANDOM_BYTES;
+    options.log_facility=SYSLOG_FACILITY_DAEMON;
     opterr=0;
-    while ((c = getopt(argc, argv, "A:a:cp:v:d:fTl:L:r:s:g:t:u:n:N:hC:D:E:R:WB:VP:S:")) != EOF)
+
+    while ((c = getopt(argc, argv, "A:a:cp:v:d:fTl:L:r:s:g:t:u:n:N:hC:D:E:R:WB:VP:F:S:")) != EOF)
         switch (c) {
 	    case 'A':
 	    	safecopy(options.cert_file,optarg);
@@ -315,6 +317,13 @@
 		/* exit(1) ??? */
 #endif
 		break;
+	    case 'F':
+	        options.log_facility=log_facility_number(optarg);
+		if (options.log_facility == SYSLOG_FACILITY_NONE) {
+		    log(LOG_ERR, "-F: Unrecognized/unused log facility \"%s\"", optarg);
+		    print_help();
+		} 
+                break;
             case 'L':
                 options.option |= OPT_PTY;
             case 'l':
@@ -499,7 +508,7 @@
     close(0);
     close(1);
     close(2);
-#endif
+#endif /* HAVE_DAEMON */
 }
 
 static void create_pid()
@@ -533,7 +542,7 @@
     	safeconcat(options.pidfile, "stunnel.");
     	safeconcat(options.pidfile, options.servname);
 	safeconcat(options.pidfile, ".pid");
-#endif
+#endif /* HAVE_SNPRINTF */
     } else {
     	safecopy(options.pidfile, options.pid_dir);
     }
@@ -558,7 +567,7 @@
     if(unlink(options.pidfile)<0)
         ioerror(options.pidfile); /* not critical */
 }
-#endif /* defined USE_WIN32 */
+#endif /* ndefined USE_WIN32 */
 
 static int listen_local() /* bind and listen on local interface */
 {
@@ -999,6 +1008,7 @@
 	fprintf(stderr, "\t-B bytes\t%d\n", RANDOM_BYTES);
 	fprintf(stderr, "\t-D level\t%d\n", options.debug_level);
 #ifndef USE_WIN32
+	fprintf(stderr, "\t-F facility\t%s\n", log_facility_name(options.log_facility));
 	fprintf(stderr, "\t-P pid dir\t%s\n", options.pid_dir);
 #endif
 	fprintf(stderr, "\t-p pemfile\t"
@@ -1039,6 +1049,7 @@
 	"[-B bytes] "
 
 #ifndef USE_WIN32
+	"[-F facility] "
 	"[-P { dir/ | filename | none } ] "
 	"\n\t[-d [host:]port [-f] ] "
 	"\n\t[-r [host:]port | { -l | -L }  program [-- args] ] "
@@ -1103,6 +1114,7 @@
 #endif
 	"\n  -W\t\tDo not overwrite random seed datafiles with new random data"
         "\n  -D level\tdebug level (0-7)"
+        "\n  -F facility\tsyslog(3) facility for log entries (defaults to LOG_DAEMON)"
 	"\n"
 	"\nSee stunnel -V output for default values\n"
 	"\n");
