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

« back to all changes in this revision

Viewing changes to unix/xc/programs/xdm/mitauth.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: mitauth.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1988, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
11
 
 
12
The above copyright notice and this permission notice shall be included
 
13
in all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
16
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
17
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
18
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
19
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
20
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
21
OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of The Open Group shall
 
24
not be used in advertising or otherwise to promote the sale, use or
 
25
other dealings in this Software without prior written authorization
 
26
from The Open Group.
 
27
 
 
28
*/
 
29
/* $XFree86: xc/programs/xdm/mitauth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */
 
30
 
 
31
/*
 
32
 * xdm - display manager daemon
 
33
 * Author:  Keith Packard, MIT X Consortium
 
34
 *
 
35
 * mitauth
 
36
 *
 
37
 * generate authorization keys
 
38
 * for MIT-MAGIC-COOKIE-1 type authorization
 
39
 */
 
40
 
 
41
# include   <X11/Xos.h>
 
42
 
 
43
# include   "dm.h"
 
44
# include   "dm_auth.h"
 
45
 
 
46
# define AUTH_DATA_LEN  16      /* bytes of authorization data */
 
47
static char     auth_name[256];
 
48
static int      auth_name_len;
 
49
 
 
50
void
 
51
MitInitAuth (unsigned short name_len, char *name)
 
52
{
 
53
    if (name_len > 256)
 
54
        name_len = 256;
 
55
    auth_name_len = name_len;
 
56
    memmove( auth_name, name, name_len);
 
57
}
 
58
 
 
59
Xauth *
 
60
MitGetAuth (unsigned short namelen, char *name)
 
61
{
 
62
    Xauth   *new;
 
63
    new = (Xauth *) malloc (sizeof (Xauth));
 
64
 
 
65
    if (!new)
 
66
        return (Xauth *) 0;
 
67
    new->family = FamilyWild;
 
68
    new->address_length = 0;
 
69
    new->address = 0;
 
70
    new->number_length = 0;
 
71
    new->number = 0;
 
72
 
 
73
    new->data = (char *) malloc (AUTH_DATA_LEN);
 
74
    if (!new->data)
 
75
    {
 
76
        free ((char *) new);
 
77
        return (Xauth *) 0;
 
78
    }
 
79
    new->name = (char *) malloc (namelen);
 
80
    if (!new->name)
 
81
    {
 
82
        free ((char *) new->data);
 
83
        free ((char *) new);
 
84
        return (Xauth *) 0;
 
85
    }
 
86
    memmove( (char *)new->name, name, namelen);
 
87
    new->name_length = namelen;
 
88
    GenerateAuthData (new->data, AUTH_DATA_LEN);
 
89
    new->data_length = AUTH_DATA_LEN;
 
90
    return new;
 
91
}