[PATCH 7/9] NaCl: Don't try to use CSD, vsyslog, or setgroups
Kevin Cernekee
cernekee at gmail.com
Sun Feb 7 20:26:04 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 89528bc..21a9c83 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 20920e6..a34673d 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 cb45389..0363277 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;
--
1.9.1
More information about the openconnect-devel
mailing list