From c93877100eb98647c5b6b8556730d54677f730b6 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 8 Sep 2006 15:21:57 -0400 Subject: [PATCH 1/5] Don't need to allocate memory now that devPrivates are being used. --- Xext/security.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Xext/security.c b/Xext/security.c index 43f32fccc..54a2b3e3f 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -1131,12 +1131,6 @@ CALLBACK(SecurityClientStateCallback) XID authId = AuthorizationIDOfClient(client); SecurityAuthorizationPtr pAuth; - /* allocate space for security state */ - STATEPTR(client) = xalloc(sizeof(SecurityClientStateRec)); - if (!STATEPTR(client)) - FatalError("Client %d: couldn't allocate security state\n", - client->index); - TRUSTLEVEL(client) = XSecurityClientTrusted; AUTHID(client) = authId; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, From 0fba09cdfcc78161f5c92bef6cca53e5309656bd Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 8 Sep 2006 15:23:06 -0400 Subject: [PATCH 2/5] Include dix-config.h. --- Xext/xace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Xext/xace.c b/Xext/xace.c index 44aaa421d..14a5e7963 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -17,6 +17,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ********************************************************/ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include #include "windowstr.h" #include "scrnintstr.h" From cec392656cda1c938d5462e1949e6eef489f9168 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 8 Sep 2006 15:24:23 -0400 Subject: [PATCH 3/5] Zero out newly allocated ClientRec structures. This is required to initialize the devPrivates to a known state. --- dix/dispatch.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index aa67dc43e..7c4d539fa 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3612,8 +3612,13 @@ CloseDownRetainedResources() } } +extern int clientPrivateLen; +extern unsigned *clientPrivateSizes; +extern unsigned totalClientSize; + void InitClient(ClientPtr client, int i, pointer ospriv) { + bzero(client, totalClientSize); client->index = i; client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; @@ -3664,10 +3669,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv) #endif } -extern int clientPrivateLen; -extern unsigned *clientPrivateSizes; -extern unsigned totalClientSize; - int InitClientPrivates(ClientPtr client) { From 9deb579dc9366590203afe0576bf88643ab36c89 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 8 Sep 2006 15:25:17 -0400 Subject: [PATCH 4/5] Zero out newly created ExtensionEntry structures, but only after the devPrivates have been initialized. --- dix/extension.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dix/extension.c b/dix/extension.c index ee00ab9dc..f58c73138 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -80,7 +80,7 @@ extern int extensionPrivateLen; extern unsigned *extensionPrivateSizes; extern unsigned totalExtensionSize; -static int +static void InitExtensionPrivates(ExtensionEntry *ext) { register char *ptr; @@ -107,7 +107,6 @@ InitExtensionPrivates(ExtensionEntry *ext) else ppriv->ptr = (pointer)NULL; } - return 1; } _X_EXPORT ExtensionEntry * @@ -127,9 +126,10 @@ AddExtension(char *name, int NumEvents, int NumErrors, return((ExtensionEntry *) NULL); ext = (ExtensionEntry *) xalloc(totalExtensionSize); - if (!ext || !InitExtensionPrivates(ext)) + if (!ext) return((ExtensionEntry *) NULL); bzero(ext, totalExtensionSize); + InitExtensionPrivates(ext); ext->name = (char *)xalloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; From d1110c5c83a7f439158f369ab2f3ae614fa9d2a5 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 8 Sep 2006 15:28:48 -0400 Subject: [PATCH 5/5] Generalize the handling of configuration files that ship with extensions. --- Xext/Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Xext/Makefile.am b/Xext/Makefile.am index 4deb8e52c..6ea3d7445 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -33,6 +33,10 @@ MODULE_SRCS = \ sync.c \ xcmisc.c +# Extra configuration files ship with some extensions +SERVERCONFIGdir = $(libdir)/xserver +SERVERCONFIG_DATA = + # Optional sources included if extension enabled by configure.ac rules # MIT Shared Memory extension @@ -77,8 +81,7 @@ XCSECURITY_SRCS = security.c securitysrv.h if XCSECURITY BUILTIN_SRCS += $(XCSECURITY_SRCS) -SERVERCONFIGdir = $(libdir)/xserver -SERVERCONFIG_DATA = SecurityPolicy +SERVERCONFIG_DATA += SecurityPolicy AM_CFLAGS += -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGdir)/SecurityPolicy\" endif @@ -157,7 +160,7 @@ libXextmodule_la_SOURCES = $(MODULE_SRCS) endif EXTRA_DIST = \ - SecurityPolicy \ + $(SERVERCONFIG_DATA) \ $(MITSHM_SRCS) \ $(XV_SRCS) \ $(RES_SRCS) \