~ubuntu-branches/ubuntu/maverick/xorg-server/maverick-security

« back to all changes in this revision

Viewing changes to Xext/xtest.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2010-08-05 11:25:14 UTC
  • mfrom: (1.1.35 upstream) (0.1.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100805112514-q4efdgj3nblevos2
Tags: 2:1.8.99.905-1ubuntu1
* Merge from (unreleased) Debian experimental.  Remaining Ubuntu changes:
  - rules, control:
    + Disable SELinux, libaudit-dev is not in main yet (LP 406226).
      Drop libaudit-dev from build-deps.
  - rules: Enable xcsecurity (LP 247537).
  - local/xvfb-run*: Add correct docs about error codes (LP 328205)
  - rules: Add --with-extra-module-dir to support GL alternatives.
  - control: Xvfb depends on xauth, x11-xkb-utils. (LP 500102)
  - rules, local/64-xorg-xkb.rules: Don't use keyboard-configuration
    until it's available.
  - control: Update some versioned Breaks for Ubuntu versions.
  - debian/patches:
    + 100_rethrow_signals.patch:
      When aborting, re-raise signals for apport
    + 109_fix-swcursor-crash.patch:
      Avoid dereferencing null pointer while reloading cursors during
      resume. (LP 371405)
    + 111_armel-drv-fallbacks.patch:
      Add support for armel driver fallbacks.
    + 121_only_switch_vt_when_active.diff:
      Add a check to prevent the X server from changing the VT when killing
      GDM from the console.
    + 122_xext_fix_card32_overflow_in_xauth.patch:
      Fix server crash when “xauth generate” is called with large timeout.
    + 157_check_null_modes.patch, 162_null_crtc_in_rotation.patch,
      166_nullptr_xinerama_keyrepeat.patch, 167_nullptr_xisbread.patch
      169_mipointer_nullptr_checks.patch,
      172_cwgetbackingpicture_nullptr_check.patch:
      Fix various segfaults in xserver by checking pointers for NULL
      values before dereferencing them.
    + 165_man_xorg_conf_no_device_ident.patch
      Correct man page
    + 168_glibc_trace_to_stderr.patch:
      Report abort traces to stderr instead of terminal
    + 184_virtual_devices_autodetect.patch:
      Use vesa for qemu device, which is not supported by cirrus
    + 187_edid_quirk_hp_nc8430.patch:
      Quirk for another LPL monitor (LP 380009)
    + 188_default_primary_to_first_busid.patch:
      Pick the first device and carry on (LP 459512)
    + 189_xserver_1.5.0_bg_none_root.patch:
      Create a root window with no background.
    + 190_cache-xkbcomp_output_for_fast_start_up.patch:
      Cache keyboard settings.
    + 191-Xorg-add-an-extra-module-path.patch:
      Add support for the alternatives module path.
    + 197_xvfb-randr.patch:
      Adds xrandr support to xvfb. (LP 516123)
    + 198_nohwaccess.patch:
      Adds a -nohwaccess argument to make X not access the hardware
      ports directly.
    + 200_randr-null.patch:
      Clarify a pointer initialization.
* Update changelog entries for 1.8.1.902-1 which became 1.8.99.904-1
* Drop 196_xvfbscreeninit-handling.patch: it's semantically empty, and now 
  doesn't apply.  Merge remaining #include change into 197_xvfb-randr.patch
* New upstream version will start correctly when no outputs are connected,
  as long as the video driver can dynamically resize the framebuffer
  (true for all KMS drivers) (LP: #337889)
* New upstream version fixes crash on non-admin logout with KDE (LP: #569879)
* Refresh 111_armel-drv-fallbacks.patch to fix the build on armel

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 * other's memory */
63
63
static EventListPtr xtest_evlist;
64
64
 
65
 
/* Used to store if a device is an XTest Virtual device */
66
 
static int XTestDevicePrivateKeyIndex;
67
 
DevPrivateKey XTestDevicePrivateKey = &XTestDevicePrivateKeyIndex;
68
 
 
69
65
/**
70
66
 * xtestpointer
71
67
 * is the virtual pointer for XTest. It is the first slave
126
122
        swaps(&rep.minorVersion, n);
127
123
    }
128
124
    WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
129
 
    return(client->noClientException);
 
125
    return Success;
130
126
}
131
127
 
132
128
static int
153
149
        if (rc != Success)
154
150
        {
155
151
            client->errorValue = stuff->cursor;
156
 
            return (rc == BadValue) ? BadCursor : rc;
 
152
            return rc;
157
153
        }
158
154
    }
159
155
    rep.type = X_Reply;
164
160
        swaps(&rep.sequenceNumber, n);
165
161
    }
166
162
    WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
167
 
    return(client->noClientException);
 
163
    return Success;
168
164
}
169
165
 
170
166
static int
358
354
        activateTime.milliseconds = ms;
359
355
        ev->u.keyButtonPointer.time = 0;
360
356
 
361
 
        /* see mbuf.c:QueueDisplayRequest for code similar to this */
 
357
        /* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
 
358
         * extension) for code similar to this */
362
359
 
363
360
        if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
364
361
        {
456
453
 
457
454
    if (need_ptr_update)
458
455
        miPointerUpdateSprite(dev);
459
 
    return client->noClientException;
 
456
    return Success;
460
457
}
461
458
 
462
459
static int
468
465
    if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
469
466
    {
470
467
        client->errorValue = stuff->impervious;
471
 
        return(BadValue);
 
468
        return BadValue;
472
469
    }
473
470
    if (stuff->impervious)
474
471
        MakeClientGrabImpervious(client);
475
472
    else
476
473
        MakeClientGrabPervious(client);
477
 
    return(client->noClientException);
 
474
    return Success;
478
475
}
479
476
 
480
477
static int
636
633
{
637
634
    int retval;
638
635
    int len = strlen(name);
639
 
    char *xtestname = xcalloc(len + 7, 1 );
 
636
    char *xtestname = calloc(len + 7, 1 );
640
637
    char dummy = 1;
641
638
 
642
639
    strncpy( xtestname, name, len);
644
641
 
645
642
    retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
646
643
    if ( retval == Success ){
647
 
        dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_ptr->id);
648
 
        dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_keybd->id);
 
644
        (*ptr)->xtest_master_id = master_ptr->id;
 
645
        (*keybd)->xtest_master_id = master_keybd->id;
649
646
 
650
647
        XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
651
648
                XA_INTEGER, 8, PropModeReplace, 1, &dummy,
659
656
        XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
660
657
    }
661
658
 
662
 
    xfree( xtestname );
 
659
    free( xtestname );
663
660
 
664
661
    return retval;
665
662
}
673
670
BOOL
674
671
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
675
672
{
676
 
    int is_XTest = FALSE;
677
 
    int mid;
678
 
    void *tmp; /* shut up, gcc! */
679
 
 
680
673
    if (IsMaster(dev))
681
 
        return is_XTest;
682
 
 
683
 
    tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
684
 
    mid = (intptr_t)tmp;
 
674
        return FALSE;
685
675
 
686
676
    /* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
687
677
     * device */
688
 
    if ((!master && mid) ||
689
 
        (master && mid == master->id))
690
 
        is_XTest = TRUE;
 
678
    if (master)
 
679
        return dev->xtest_master_id == master->id;
691
680
 
692
 
    return is_XTest;
 
681
    return dev->xtest_master_id != 0;
693
682
}
694
683
 
695
684
/**