From a599db02e0c5527fec6b9e6af50b2a9cc33cc214 Mon Sep 17 00:00:00 2001 From: Nick Parrin Date: Wed, 21 Nov 2018 20:01:21 +0000 Subject: [PATCH 1/3] Update auth-juniper.c --- auth-juniper.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/auth-juniper.c b/auth-juniper.c index 30ceb3ae..66f77a0e 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -368,11 +368,21 @@ static int tncc_preauth(struct openconnect_info *vpninfo) _("Failed to allocate memory for communication with TNCC\n")); return buf_free(buf); } + +#ifdef __APPLE__ + // Equally, you cannot use SOCK_SEQPACKET with AF_UNIX on Mac OS + // https://stackoverflow.com/questions/13287333/sock-seqpacket-availability + + const int flags = SOCK_STREAM; +#else + const int flags = SOCK_SEQPACKET; +#endif + #ifdef SOCK_CLOEXEC - if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sockfd)) + if (socketpair(AF_UNIX, flags | SOCK_CLOEXEC, 0, sockfd)) #endif { - if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockfd)) { + if (socketpair(AF_UNIX, flags, 0, sockfd)) { buf_free(buf); return -errno; } -- GitLab From f3f5a527a958c4adc9db751c77c8dab4c5ae474d Mon Sep 17 00:00:00 2001 From: Nick Parrin Date: Thu, 29 Nov 2018 21:19:36 +0000 Subject: [PATCH 2/3] move flags declaration to top of function for ISO C90 --- auth-juniper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/auth-juniper.c b/auth-juniper.c index 66f77a0e..41396c96 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -345,6 +345,7 @@ static int tncc_preauth(struct openconnect_info *vpninfo) const char *dspreauth = NULL, *dssignin = "null"; char recvbuf[1024], *p; int len; + const int flags; for (cookie = vpninfo->cookies; cookie; cookie = cookie->next) { if (!strcmp(cookie->option, "DSPREAUTH")) @@ -373,9 +374,9 @@ static int tncc_preauth(struct openconnect_info *vpninfo) // Equally, you cannot use SOCK_SEQPACKET with AF_UNIX on Mac OS // https://stackoverflow.com/questions/13287333/sock-seqpacket-availability - const int flags = SOCK_STREAM; + flags = SOCK_STREAM; #else - const int flags = SOCK_SEQPACKET; + flags = SOCK_SEQPACKET; #endif #ifdef SOCK_CLOEXEC -- GitLab From 994d9ec2873f3a642c148c5b38b91752d54a841f Mon Sep 17 00:00:00 2001 From: Nick Parrin Date: Thu, 29 Nov 2018 21:22:46 +0000 Subject: [PATCH 3/3] remove const from flags declaration --- auth-juniper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auth-juniper.c b/auth-juniper.c index 41396c96..7c92b2d9 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -344,8 +344,7 @@ static int tncc_preauth(struct openconnect_info *vpninfo) struct oc_vpn_option *cookie; const char *dspreauth = NULL, *dssignin = "null"; char recvbuf[1024], *p; - int len; - const int flags; + int len, flags; for (cookie = vpninfo->cookies; cookie; cookie = cookie->next) { if (!strcmp(cookie->option, "DSPREAUTH")) -- GitLab