~ubuntu-branches/ubuntu/natty/xorg/natty-updates

« back to all changes in this revision

Viewing changes to debian/local/xserver-wrapper.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-01-18 13:30:25 UTC
  • Revision ID: package-import@ubuntu.com-20120118133025-9mfkucvqunffcpbh
Tags: 1:7.6+4ubuntu3.2
* SECURITY UPDATE: console requirement bypass (LP: #918332)
  - debian/local/xserver-wrapper.c: drop alternative TTY support, and
    also reset effective group id. Patch obtained from Debian squeeze
    update.
  - CVE-2011-4613

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 *                 -showDefaultLibPath options (11 Aug 2009)
87
87
 * Julien Cristau: don't check the mode of the DRI device directory
88
88
 *                 (11 Aug 2009)
 
89
 * Julien Cristau: also drop group privileges (1 Nov 2011)
 
90
 * Julien Cristau: disallow major 5 again for consoles (15 Dec 2011)
89
91
 *
90
92
 * This is free software; you may redistribute it and/or modify
91
93
 * it under the terms of the GNU General Public License as
116
118
 
117
119
#if defined(__linux__)
118
120
#define TTY_MAJOR_DEV 4
119
 
#define ALT_TTY_MAJOR_DEV 5
120
121
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
121
122
#include <sys/consio.h>
122
123
#endif
165
166
    return FALSE;
166
167
  }
167
168
  if (S_ISCHR(s.st_mode) &&
168
 
        ((((s.st_rdev >> 8) & 0xff) == TTY_MAJOR_DEV &&
169
 
          (s.st_rdev & 0xff) < 64) ||
170
 
        (((s.st_rdev >> 8) & 0xff) == ALT_TTY_MAJOR_DEV &&
171
 
          (s.st_rdev & 0xff) < 64)
172
 
        )) {
 
169
        (((s.st_rdev >> 8) & 0xff) == TTY_MAJOR_DEV &&
 
170
          (s.st_rdev & 0xff) < 64)) {
173
171
    return TRUE;
174
172
  }
175
173
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
317
315
 
318
316
    for (i = 1; i < argc; i++) {
319
317
      if (strlen(argv[i]) > 256) {
320
 
        if (setuid(getuid())) {
 
318
        if (setgid(getgid()) || setuid(getuid())) {
321
319
          perror("X unable to drop setuid privileges for suspiciously long "
322
320
                 "argument");
323
321
          exit(1);
353
351
                         (strcmp(argv[1], "-version") == 0) ||
354
352
                         (strcmp(argv[1], "-showDefaultModulePath") == 0) ||
355
353
                         (strcmp(argv[1], "-showDefaultLibPath") == 0) ) ) {
356
 
          if (setuid(getuid())) {
 
354
          if (setgid(getgid()) || setuid(getuid())) {
357
355
              perror("X unable to drop setuid privileges");
358
356
              exit(1);
359
357
          }