components/proftpd/patches/19575647.patch
author Tomas Klacko <tomas.klacko@oracle.com>
Mon, 03 Nov 2014 02:24:15 -0800
branchs11u2-sru
changeset 3451 502e4e1a770e
permissions -rw-r--r--
19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3451
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     1
diff --git a/include/pr-syslog.h b/include/pr-syslog.h
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     2
index 3eea2be..774a3b0 100644
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     3
--- a/include/pr-syslog.h
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     4
+++ b/include/pr-syslog.h
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     5
@@ -68,7 +68,7 @@
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     6
 #elif defined(__hpux)
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     7
 # define PR_PATH_LOG	"/dev/log.un"
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     8
 #else
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     9
-# define PR_PATH_LOG	"/dev/log"
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    10
+# define PR_PATH_LOG	"/dev/conslog"
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    11
 #endif
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    12
 
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    13
 /* Close desriptor used to write to system logger. */
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    14
diff --git a/lib/pr-syslog.c b/lib/pr-syslog.c
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    15
index 3a62956..2b3d747 100644
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    16
--- a/lib/pr-syslog.c
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    17
+++ b/lib/pr-syslog.c
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    18
@@ -265,7 +265,7 @@ static void pr_vsyslog(int sockfd, int pri, register const char *fmt,
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    19
   send(sockfd, logbuf, buflen, 0);
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    20
 #else
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    21
 
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    22
-  /* Prepare the structs for use by putmsg(). As /dev/log is a STREAMS
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    23
+  /* Prepare the structs for use by putmsg(). As /dev/conslog is a STREAMS
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    24
    * device on Solaris (and possibly other platforms?), putmsg() is
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    25
    * used so that syslog facility and level are properly honored; write()
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    26
    * does not seem to work as desired.
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    27
@@ -347,22 +347,11 @@ int pr_openlog(const char *ident, int opts, int facility) {
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    28
   }
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    29
 #else
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    30
   sockfd = open(PR_PATH_LOG, O_WRONLY);
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    31
-
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    32
-# ifdef SOLARIS2
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    33
-  /* Workaround for a /dev/log bug (SunSolve bug #4817079) on Solaris. */
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    34
-  if (sockfd >= 0) {
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    35
-    struct strioctl ic;
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    36
-
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    37
-    ic.ic_cmd = I_ERRLOG;
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    38
-    ic.ic_timout = 0;
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    39
-    ic.ic_len = 0;
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    40
-    ic.ic_dp = NULL;
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    41
-
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    42
-    if (ioctl(sockfd, I_STR, &ic) < 0)
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    43
-      fprintf(stderr, "error setting I_ERRLOG on " PR_PATH_LOG ": %s\n",
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    44
-        strerror(errno));
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    45
+  if (sockfd < 0) {
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    46
+    fprintf(stderr, "failed to open %s: %d, %s\n",
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    47
+      PR_PATH_LOG, errno, strerror(errno));
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    48
+    exit(EXIT_FAILURE);
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    49
   }
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    50
-# endif /* SOLARIS2 */
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    51
 #endif
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    52
 
502e4e1a770e 19575647 Proftpd misses log entries and fails in open(2) of /dev/log
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    53
   return sockfd;