Skip to contentSkip to conversation

Fix X11 authorization problem when VMX domain use SDL

PATCH New Hiromichi Itou 1 participant 1 message Dec 27, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix X11 authorization problem when VMX domain use SDL

Hi,

This patch fixes an X11 authorization problem when VMX domain use SDL.

In my environment, the VMX domain that used SDL did not operate. Because xend has not passed to qemu-dm a necessary environment variable for X11 authorization.

I was using xhost command as workaround until I made this patch.
ex.
xhost local: (this command add non-network local connections to access control list)

But this workaround is not good for security.

---
Begi.net (http://Begi.net)
Director of Engineering Department
Hiromichi Itou ([email protected])

tools/python/xen/xend/image.py +3 -0
diff -r 829517be689f tools/python/xen/xend/image.py
@@ -194,6 +194,7 @@
         if not self.device_model:
             raise VmError("vmx: missing device model")
         self.display = sxp.child_value(imageConfig, 'display')
+        self.xauthority = sxp.child_value(imageConfig, 'xauthority')
 
         self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
                         ("image/device-model", self.device_model),
@@ -340,6 +341,8 @@
         env = dict(os.environ)
         if self.display:
             env['DISPLAY'] = self.display
+        if self.xauthority:
+            env['XAUTHORITY'] = self.xauthority
         log.info("spawning device models: %s %s",  

self.device_model, args)
self.pid = os.spawnve(os.P_NOWAIT, self.device_model, args,
env)
log.info("device model pid: %d", self.pid)

tools/python/xen/xm/create.py +4 -0
diff -r 829517be689f tools/python/xen/xm/create.py
@@ -387,6 +387,10 @@
 gopts.var('display', val='DISPLAY',
           fn=set_value, default=None,
           use="X11 display to use")
+
+gopts.var('xauthority', val='XAUTHORITY',
+          fn=set_value, default=None,
+          use="X11 Authority to use")
 
 
 def err(msg):
@@ -526,7 +530,8 @@
     """
     args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic',  

'audio',
- 'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
+ 'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic' ,
+ 'xauthority' ]

     for a in args:
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])

@@ -801,6 +806,9 @@
if not gopts.vals.display:
gopts.vals.display = os.getenv("DISPLAY")

+ if not gopts.vals.xauthority:
+ gopts.vals.xauthority = os.getenv("XAUTHORITY")
+
# Process remaining args as config variables. for arg in args:
if '=' in arg: