[PATCH] Fix NO_LOCAL_CLIENT_CRED build

Jon TURNEY jon.turney at dronecode.org.uk
Mon Jun 29 15:08:18 PDT 2015


This is a build fix for MinGW

Commit 4b4b9086 "os: support new implicit local user access mode [CVE-2015-3164
2/3]" carefully places the relevant code it adds under !NO_LOCAL_CLIENT_CRED,
but unfortunately doesn't notice that NO_LOCAL_CLIENT_CRED is defined as a
side-effect in the middle of GetLocalClientCreds(), so many of these checks
precede it's definition.

Move the check if NO_LOCAL_CLIENT_CRED should be defined to before it's first
use.

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 include/os.h | 4 ++++
 os/access.c  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/os.h b/include/os.h
index b2b96c8..5f29c58 100644
--- a/include/os.h
+++ b/include/os.h
@@ -442,6 +442,10 @@ EnableLocalHost(void);
 extern _X_EXPORT void
 DisableLocalHost(void);
 
+#if !defined(HAVE_GETPEEREID) && !defined(HAVE_GETPEERUCRED) && !defined(SO_PEERCRED)
+#define NO_LOCAL_CLIENT_CRED
+#endif
+
 #ifndef NO_LOCAL_CLIENT_CRED
 extern _X_EXPORT void
 EnableLocalUser(void);
diff --git a/os/access.c b/os/access.c
index 75e7a69..54f0690 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1221,7 +1221,6 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec ** lccp)
 #endif
 #else
     /* No system call available to get the credentials of the peer */
-#define NO_LOCAL_CLIENT_CRED
     return -1;
 #endif
 }
-- 
2.1.4



More information about the xorg-devel mailing list