Browse Source

Enable compilation of coturn on Solaris 11.4 (#951)

Unfortunately, PR #789 breaks the possibility to compile coturn in Oracle Solaris 11.4 (SRU 48). It is caused by the fact that LOG_FTP is not defined in Oracle Solaris' "/usr/include/sys/syslog.h". 

They define the following syslog facility codes:
```
#define LOG_KERN        (0<<3)  /* kernel messages */
#define LOG_USER        (1<<3)  /* random user-level messages */
#define LOG_MAIL        (2<<3)  /* mail system */
#define LOG_DAEMON      (3<<3)  /* system daemons */
#define LOG_AUTH        (4<<3)  /* security/authorization messages */
#define LOG_SYSLOG      (5<<3)  /* messages generated internally by syslogd */
#define LOG_LPR         (6<<3)  /* line printer subsystem */
#define LOG_NEWS        (7<<3)  /* netnews subsystem */
#define LOG_UUCP        (8<<3)  /* uucp subsystem */
#define LOG_AUTHPRIV    (10<<3) /* sensitive/private security/auth messages */
#define LOG_AUDIT       (13<<3) /* audit subsystem */
#define LOG_CRON        (15<<3) /* cron/at subsystem */
        /* other codes through 15 reserved for system use */
#define LOG_LOCAL0      (16<<3) /* reserved for local use */
#define LOG_LOCAL1      (17<<3) /* reserved for local use */
#define LOG_LOCAL2      (18<<3) /* reserved for local use */
#define LOG_LOCAL3      (19<<3) /* reserved for local use */
#define LOG_LOCAL4      (20<<3) /* reserved for local use */
#define LOG_LOCAL5      (21<<3) /* reserved for local use */
#define LOG_LOCAL6      (22<<3) /* reserved for local use */
#define LOG_LOCAL7      (23<<3) /* reserved for local use */
```

So omitting LOG_FTP should fix this for Solaris. As I really doubt that it is needed, I hereby submit a PR which omits LOG_FTP for all operating systems. Other Solaris derivatives (OpenIndiana Hipster, OmniOS) don't seem to be affected, I've checked and found that in their recent versions, LOG_FTP is defined. FreeBSD does also define LOG_FTP.
Gustavo Garcia 3 years ago
parent
commit
4909e506ae
2 changed files with 13 additions and 2 deletions
  1. 2 2
      src/apps/common/ns_turn_utils.c
  2. 11 0
      src/apps/relay/netengine.c

+ 2 - 2
src/apps/common/ns_turn_utils.c

@@ -154,7 +154,7 @@ static char* str_fac[]={"LOG_AUTH","LOG_CRON","LOG_DAEMON",
 			"LOG_LOCAL2","LOG_LOCAL3","LOG_LOCAL4","LOG_LOCAL5",
 			"LOG_LOCAL6","LOG_LOCAL7","LOG_LPR","LOG_MAIL",
 			"LOG_NEWS","LOG_USER","LOG_UUCP",
-			"LOG_AUTHPRIV","LOG_FTP","LOG_SYSLOG",
+			"LOG_AUTHPRIV","LOG_SYSLOG",
 			0};
 
 static int int_fac[]={LOG_AUTH ,  LOG_CRON , LOG_DAEMON ,
@@ -162,7 +162,7 @@ static int int_fac[]={LOG_AUTH ,  LOG_CRON , LOG_DAEMON ,
 		    LOG_LOCAL2 , LOG_LOCAL3 , LOG_LOCAL4 , LOG_LOCAL5 ,
 		    LOG_LOCAL6 , LOG_LOCAL7 , LOG_LPR , LOG_MAIL ,
 		    LOG_NEWS , LOG_USER , LOG_UUCP,
-		    LOG_AUTHPRIV,LOG_FTP,LOG_SYSLOG,
+		    LOG_AUTHPRIV,LOG_SYSLOG,
 		    0};
 
 static int syslog_facility = 0;

+ 11 - 0
src/apps/relay/netengine.c

@@ -30,6 +30,17 @@
 
 #include "mainrelay.h"
 
+//////////// Backward compatibility with OpenSSL 1.0.x //////////////
+#define HAVE_OPENSSL11_API (!(OPENSSL_VERSION_NUMBER < 0x10100001L || defined LIBRESSL_VERSION_NUMBER))
+
+#ifndef HAVE_SSL_CTX_UP_REF
+#define HAVE_SSL_CTX_UP_REF HAVE_OPENSSL11_API
+#endif
+
+#if !HAVE_SSL_CTX_UP_REF
+#define SSL_CTX_up_ref(ctx) CRYPTO_add(&(ctx)->references, 1, CRYPTO_LOCK_SSL_CTX)
+#endif
+
 //////////// Barrier for the threads //////////////
 
 #if !defined(TURN_NO_THREAD_BARRIERS)