Skip to content

Commit

Permalink
NaCl: Don't try to use CSD, vsyslog, or setgroups
Browse files Browse the repository at this point in the history
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@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
cernekee authored and David Woodhouse committed Mar 8, 2016
1 parent 4b960af commit 3c5887b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions auth.c
Expand Up @@ -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];
Expand Down Expand Up @@ -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__ */
}


Expand Down
8 changes: 5 additions & 3 deletions main.c
Expand Up @@ -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, ...)
Expand Down Expand Up @@ -1414,12 +1414,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;
Expand Down
2 changes: 1 addition & 1 deletion mainloop.c
Expand Up @@ -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;

Expand Down

0 comments on commit 3c5887b

Please sign in to comment.