[PATCH V2 09/11] NaCl: Don't try to use CSD, vsyslog, or setgroups

Kevin Cernekee cernekee at gmail.com
Mon Feb 8 22:34:15 PST 2016


NaCl doesn't currently support forking, syslog, or user identities.
There are stub functions under glibc, but not under newlib.  This
patch allows building openconnect with either libc.

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 auth.c     | 6 +++---
 main.c     | 8 +++++---
 mainloop.c | 2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/auth.c b/auth.c
index 89528bc4266c..21a9c83a1b2d 100644
--- a/auth.c
+++ b/auth.c
@@ -968,9 +968,9 @@ static int fetch_config(struct openconnect_info *vpninfo)
 
 static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int buflen)
 {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__native_client__)
 	vpn_progress(vpninfo, PRG_ERR,
-		     _("Error: Running the 'Cisco Secure Desktop' trojan on Windows is not yet implemented.\n"));
+		     _("Error: Running the 'Cisco Secure Desktop' trojan on this platform is not yet implemented.\n"));
 	return -EPERM;
 #else
 	char fname[64];
@@ -1167,7 +1167,7 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
 
 	http_add_cookie(vpninfo, "sdesktop", vpninfo->csd_token, 1);
 	return 0;
-#endif /* !_WIN32 */
+#endif /* !_WIN32 && !__native_client__ */
 }
 
 
diff --git a/main.c b/main.c
index 20920e6e9ff1..a34673dbaf24 100644
--- a/main.c
+++ b/main.c
@@ -123,12 +123,12 @@ static void __attribute__ ((format(printf, 3, 4)))
 	}
 }
 #define openlog(...)  /* */
-#elif defined(_WIN32)
+#elif defined(_WIN32) || defined(__native_client__)
 /*
  * FIXME: Perhaps we could implement syslog_progress() using these APIs:
  * http://msdn.microsoft.com/en-us/library/windows/desktop/aa364148%28v=vs.85%29.aspx
  */
-#else /* !__ANDROID__ && !_WIN32 */
+#else /* !__ANDROID__ && !_WIN32 && !__native_client__ */
 #include <syslog.h>
 static void  __attribute__ ((format(printf, 3, 4)))
     syslog_progress(void *_vpninfo, int level, const char *fmt, ...)
@@ -1408,12 +1408,14 @@ int main(int argc, char **argv)
 	if (proxy && openconnect_set_http_proxy(vpninfo, strdup(proxy)))
 		exit(1);
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__native_client__)
 	if (use_syslog) {
 		openlog("openconnect", LOG_PID, LOG_DAEMON);
 		vpninfo->progress = syslog_progress;
 	}
+#endif /* !_WIN32 && !__native_client__ */
 
+#ifndef _WIN32
 	memset(&sa, 0, sizeof(sa));
 
 	sa.sa_handler = handle_signal;
diff --git a/mainloop.c b/mainloop.c
index 264abc504322..60a2356b993a 100644
--- a/mainloop.c
+++ b/mainloop.c
@@ -125,7 +125,7 @@ static int setup_tun_device(struct openconnect_info *vpninfo)
 		return ret;
 	}
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__native_client__)
 	if (vpninfo->uid != getuid()) {
 		int e;
 
-- 
2.7.0




More information about the openconnect-devel mailing list