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

« back to all changes in this revision

Viewing changes to hw/xfree86/common/xf86Configure.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:
107
107
static void
108
108
bus_pci_newdev_configure(void *busData, int i, int *chipset)
109
109
{
110
 
        const char *VendorName;
111
 
        const char *CardName;
112
110
        char busnum[8];
113
111
    struct pci_device * pVideo = NULL;
114
112
 
116
114
 
117
115
        DevToConfig[i].pVideo = pVideo;
118
116
 
119
 
        VendorName = pci_device_get_vendor_name( pVideo );
120
 
        CardName = pci_device_get_device_name( pVideo );
121
 
 
122
 
        if (!VendorName) {
123
 
            VendorName = xnfalloc(15);
124
 
            sprintf((char*)VendorName, "Unknown Vendor");
125
 
        }
126
 
 
127
 
        if (!CardName) {
128
 
            CardName = xnfalloc(14);
129
 
            sprintf((char*)CardName, "Unknown Board");
130
 
        }
131
 
 
132
 
        DevToConfig[i].GDev.identifier =
133
 
            xnfalloc(strlen(VendorName) + strlen(CardName) + 2);
134
 
        sprintf(DevToConfig[i].GDev.identifier, "%s %s", VendorName, CardName);
135
 
 
136
 
        DevToConfig[i].GDev.vendor = (char *)VendorName;
137
 
        DevToConfig[i].GDev.board = (char *)CardName;
138
 
 
139
117
        DevToConfig[i].GDev.busID = xnfalloc(16);
140
118
        xf86FormatPciBusNumber(pVideo->bus, busnum);
141
119
        sprintf(DevToConfig[i].GDev.busID, "PCI:%s:%d:%d",
163
141
        if (promPath) {
164
142
            DevToConfig[i].GDev.busID = xnfalloc(strlen(promPath) + 6);
165
143
            sprintf(DevToConfig[i].GDev.busID, "SBUS:%s", promPath);
166
 
            xfree(promPath);
 
144
            free(promPath);
167
145
        } else {
168
146
            DevToConfig[i].GDev.busID = xnfalloc(12);
169
147
            sprintf(DevToConfig[i].GDev.busID, "SBUS:fb%d",
277
255
    mouse->inp_identifier = "Mouse0";
278
256
    mouse->inp_driver = "mouse";
279
257
    mouse->inp_option_lst = 
280
 
                xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"),
281
 
                                xstrdup(DFLT_MOUSE_PROTO));
 
258
                xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
 
259
                                strdup(DFLT_MOUSE_PROTO));
282
260
#ifndef __SCO__
283
261
    mouse->inp_option_lst = 
284
 
                xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"),
285
 
                                xstrdup(DFLT_MOUSE_DEV));
 
262
                xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
 
263
                                strdup(DFLT_MOUSE_DEV));
286
264
#endif
287
265
    mouse->inp_option_lst = 
288
 
                xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"),
289
 
                                xstrdup("4 5 6 7"));
 
266
                xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
 
267
                                strdup("4 5 6 7"));
290
268
    ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
291
269
    return ptr;
292
270
}
322
300
}
323
301
 
324
302
static const char* 
325
 
optionTypeToSting(OptionValueType type)
 
303
optionTypeToString(OptionValueType type)
326
304
{
327
305
    switch (type) {
328
306
    case OPTV_NONE:
339
317
        return "[<bool>]";
340
318
    case OPTV_FREQ:
341
319
        return "<freq>";
 
320
    case OPTV_PERCENT:
 
321
        return "<percent>";
342
322
    default:
343
323
        return "";
344
324
    }
355
335
    /* Move device info to parser structure */
356
336
    sprintf(identifier, "Card%d", screennum);
357
337
    ptr->dev_identifier = strdup(identifier);
358
 
/*    ptr->dev_identifier = DevToConfig[screennum].GDev.identifier;*/
359
 
    ptr->dev_vendor = DevToConfig[screennum].GDev.vendor;
360
 
    ptr->dev_board = DevToConfig[screennum].GDev.board;
361
338
    ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
362
339
    ptr->dev_busid = DevToConfig[screennum].GDev.busID;
363
340
    ptr->dev_driver = DevToConfig[screennum].GDev.driver;
384
361
            "        ### Available Driver options are:-\n"
385
362
            "        ### Values: <i>: integer, <f>: float, "
386
363
                        "<bool>: \"True\"/\"False\",\n"
387
 
            "        ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\"\n"
 
364
            "        ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
 
365
            "        ### <percent>: \"<f>%\"\n"
388
366
            "        ### [arg]: arg optional\n";
389
 
        ptr->dev_comment = xstrdup(descrip);
 
367
        ptr->dev_comment = strdup(descrip);
390
368
        if (ptr->dev_comment) {
391
369
            for (p = DevToConfig[screennum].GDev.options;
392
370
                 p->name != NULL; p++) {
394
372
                const char *prefix = "        #Option     ";
395
373
                const char *middle = " \t# ";
396
374
                const char *suffix = "\n";
397
 
                const char *opttype = optionTypeToSting(p->type);
 
375
                const char *opttype = optionTypeToString(p->type);
398
376
                char *optname;
399
377
                int len = strlen(ptr->dev_comment) + strlen(prefix) +
400
378
                          strlen(middle) + strlen(suffix) + 1;
401
379
                
402
 
                optname = xalloc(strlen(p->name) + 2 + 1);
 
380
                optname = malloc(strlen(p->name) + 2 + 1);
403
381
                if (!optname)
404
382
                    break;
405
383
                sprintf(optname, "\"%s\"", p->name);
407
385
                len += max(20, strlen(optname));
408
386
                len += strlen(opttype);
409
387
 
410
 
                ptr->dev_comment = xrealloc(ptr->dev_comment, len);
 
388
                ptr->dev_comment = realloc(ptr->dev_comment, len);
411
389
                if (!ptr->dev_comment)
412
390
                    break;
413
391
                p_e = ptr->dev_comment + strlen(ptr->dev_comment);
414
392
                sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
415
393
                        opttype, suffix);
416
 
                xfree(optname);
 
394
                free(optname);
417
395
            }
418
396
        }
419
397
    }
437
415
        iptr->iref_option_lst = NULL;
438
416
        iptr->iref_inputdev_str = "Mouse0";
439
417
        iptr->iref_option_lst =
440
 
                xf86addNewOption (iptr->iref_option_lst, xstrdup("CorePointer"), NULL);
 
418
                xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
441
419
        ptr->lay_input_lst = (XF86ConfInputrefPtr)
442
420
                xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
443
421
    }
450
428
        iptr->iref_option_lst = NULL;
451
429
        iptr->iref_inputdev_str = "Keyboard0";
452
430
        iptr->iref_option_lst =
453
 
                xf86addNewOption (iptr->iref_option_lst, xstrdup("CoreKeyboard"), NULL);
 
431
                xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
454
432
        ptr->lay_input_lst = (XF86ConfInputrefPtr)
455
433
                xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
456
434
    }
512
490
            ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
513
491
                                (glp)ptr->mod_load_lst, (glp)module);
514
492
        }
515
 
        xfree(elist);
 
493
        free(elist);
516
494
    }
517
495
 
518
496
    return ptr;
623
601
                             ptr);
624
602
 
625
603
    if (ConfiguredMonitor->features.dpms) {
626
 
      ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xstrdup("DPMS"), NULL);
 
604
      ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
627
605
    }
628
606
 
629
607
    return ptr;
658
636
    /* Load all the drivers that were found. */
659
637
    xf86LoadModules(vlist, NULL);
660
638
 
661
 
    xfree(vlist);
 
639
    free(vlist);
662
640
 
663
641
    for (i = 0; i < xf86NumDrivers; i++) {
664
642
        xorgHWFlags flags;
678
656
            xorgHWAccess = FALSE;
679
657
    }
680
658
 
681
 
    xf86FindPrimaryDevice();
682
 
 
683
659
    /* Create XF86Config file structure */
684
660
    xf86config = calloc(1, sizeof(XF86ConfigRec));
685
661
 
807
783
                }
808
784
            }
809
785
        }
810
 
        xfree(driverProbed);
 
786
        free(driverProbed);
811
787
    }
812
788
    
813
789
 
818
794
    }
819
795
 
820
796
    xf86PostProbe();
821
 
    xf86EntityInit();
822
797
 
823
798
    for (j = 0; j < xf86NumScreens; j++) {
824
799
        xf86Screens[j]->scrnIndex = j;
834
809
 
835
810
        ConfiguredMonitor = NULL;
836
811
 
837
 
        xf86EnableAccess(xf86Screens[dev2screen[j]]);
838
812
        if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], 
839
813
                                                   PROBE_DETECT) &&
840
814
            ConfiguredMonitor) {