~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xnest/Args.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: Args.c,v 1.3 2000/08/17 19:53:26 cpqbld Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1993 by Davor Matic
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software
 
7
and its documentation for any purpose is hereby granted without fee,
 
8
provided that the above copyright notice appear in all copies and that
 
9
both that copyright notice and this permission notice appear in
 
10
supporting documentation.  Davor Matic makes no representations about
 
11
the suitability of this software for any purpose.  It is provided "as
 
12
is" without express or implied warranty.
 
13
 
 
14
*/
 
15
#include "X.h"
 
16
#include "Xproto.h"
 
17
#include "screenint.h"
 
18
#include "input.h"
 
19
#include "misc.h"
 
20
#include "scrnintstr.h"
 
21
#include "servermd.h"
 
22
 
 
23
#include "Xnest.h"
 
24
 
 
25
#include "Display.h"
 
26
#include "Args.h"
 
27
 
 
28
char *xnestDisplayName = NULL;        
 
29
Bool xnestSynchronize = False;
 
30
Bool xnestFullGeneration = False;
 
31
int xnestDefaultClass;                
 
32
Bool xnestUserDefaultClass = False;
 
33
int xnestDefaultDepth;
 
34
Bool xnestUserDefaultDepth = False;
 
35
Bool xnestSoftwareScreenSaver = False;
 
36
int xnestX;                    
 
37
int xnestY;                    
 
38
unsigned int xnestWidth;
 
39
unsigned int xnestHeight;
 
40
int xnestUserGeometry = 0;
 
41
int xnestBorderWidth; 
 
42
Bool xnestUserBorderWidth = False;
 
43
char *xnestWindowName = NULL;        
 
44
int xnestNumScreens = 0;
 
45
Bool xnestDoDirectColormaps = False;
 
46
Window xnestParentWindow = 0;
 
47
 
 
48
int ddxProcessArgument (argc, argv, i)
 
49
    int argc;
 
50
    char *argv[] ;
 
51
    int i;
 
52
{
 
53
  if (!strcmp(argv[i], "-display")) {
 
54
    if (++i < argc) {
 
55
      xnestDisplayName = argv[i];
 
56
      return 2;
 
57
    }
 
58
    return 0;
 
59
  }
 
60
  if (!strcmp(argv[i], "-sync")) {
 
61
    xnestSynchronize = True;
 
62
    return 1;
 
63
  }
 
64
  if (!strcmp(argv[i], "-full")) {
 
65
    xnestFullGeneration = True;
 
66
    return 1;
 
67
  }
 
68
  if (!strcmp(argv[i], "-class")) {
 
69
    if (++i < argc) {
 
70
      if (!strcmp(argv[i], "StaticGray")) {
 
71
        xnestDefaultClass = StaticGray;
 
72
        xnestUserDefaultClass = True;
 
73
        return 2;
 
74
      }
 
75
      else if (!strcmp(argv[i], "GrayScale")) {
 
76
        xnestDefaultClass = GrayScale;
 
77
        xnestUserDefaultClass = True;
 
78
        return 2;
 
79
      }
 
80
      else if (!strcmp(argv[i], "StaticColor")) {
 
81
        xnestDefaultClass = StaticColor;
 
82
        xnestUserDefaultClass = True;
 
83
        return 2;
 
84
      }
 
85
      else if (!strcmp(argv[i], "PseudoColor")) {
 
86
        xnestDefaultClass = PseudoColor;
 
87
        xnestUserDefaultClass = True;
 
88
        return 2;
 
89
      }
 
90
      else if (!strcmp(argv[i], "TrueColor")) {
 
91
        xnestDefaultClass = TrueColor;
 
92
        xnestUserDefaultClass = True;
 
93
        return 2;
 
94
      }
 
95
      else if (!strcmp(argv[i], "DirectColor")) {
 
96
        xnestDefaultClass = DirectColor;
 
97
        xnestUserDefaultClass = True;
 
98
        return 2;
 
99
      }
 
100
    }
 
101
    return 0;
 
102
  }
 
103
  if (!strcmp(argv[i], "-cc")) {
 
104
    if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
 
105
      if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
 
106
        xnestUserDefaultClass = True;
 
107
        /* lex the OS layer process it as well, so return 0 */
 
108
      }
 
109
    }
 
110
    return 0;
 
111
  }
 
112
  if (!strcmp(argv[i], "-depth")) {
 
113
    if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
 
114
      if (xnestDefaultDepth > 0) {
 
115
        xnestUserDefaultDepth = True;
 
116
        return 2;
 
117
      }
 
118
    }
 
119
    return 0;
 
120
  }
 
121
  if (!strcmp(argv[i], "-sss")) {
 
122
    xnestSoftwareScreenSaver = True;
 
123
    return 1;
 
124
  }
 
125
  if (!strcmp(argv[i], "-geometry")) {
 
126
    if (++i < argc) {
 
127
      xnestUserGeometry = XParseGeometry(argv[i],
 
128
                                         &xnestX, &xnestY,
 
129
                                         &xnestWidth, &xnestHeight);
 
130
      if (xnestUserGeometry) return 2;
 
131
    }
 
132
    return 0;
 
133
  }
 
134
  if (!strcmp(argv[i], "-bw")) {
 
135
    if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
 
136
      if (xnestBorderWidth >= 0) {
 
137
        xnestUserBorderWidth = True;
 
138
        return 2;
 
139
      }
 
140
    }
 
141
    return 0;
 
142
  }
 
143
  if (!strcmp(argv[i], "-name")) {
 
144
    if (++i < argc) {
 
145
      xnestWindowName = argv[i];
 
146
      return 2;
 
147
    }
 
148
    return 0;
 
149
  }
 
150
  if (!strcmp(argv[i], "-scrns")) {
 
151
    if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
 
152
      if (xnestNumScreens > 0) {
 
153
        if (xnestNumScreens > MAXSCREENS) {
 
154
          ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
 
155
          xnestNumScreens = MAXSCREENS;
 
156
        }
 
157
        return 2;
 
158
      }
 
159
    }
 
160
    return 0;
 
161
  }
 
162
  if (!strcmp(argv[i], "-install")) {
 
163
    xnestDoDirectColormaps = True;
 
164
    return 1;
 
165
  }
 
166
  if (!strcmp(argv[i], "-parent")) {
 
167
    if (++i < argc) {
 
168
      xnestParentWindow = (XID) strtol (argv[i], (char**)NULL, 0);
 
169
      return 2;
 
170
    }
 
171
  }
 
172
  return 0;
 
173
}
 
174
 
 
175
void ddxUseMsg()
 
176
{
 
177
  ErrorF("-display string        display name of the real server\n");
 
178
  ErrorF("-sync                  sinchronize with the real server\n");
 
179
  ErrorF("-full                  utilize full regeneration\n");
 
180
  ErrorF("-class string          default visual class\n");
 
181
  ErrorF("-depth int             default depth\n");
 
182
  ErrorF("-sss                   use software screen saver\n");
 
183
  ErrorF("-geometry WxH+X+Y      window size and position\n");
 
184
  ErrorF("-bw int                window border width\n");
 
185
  ErrorF("-name string           window name\n");
 
186
  ErrorF("-scrns int             number of screens to generate\n");
 
187
  ErrorF("-install               instal colormaps directly\n");
 
188
}