3 Copyright 1988, 1998 The Open Group
4 Copyright 2003 Oswald Buddenhagen <ossi@kde.org>
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
12 The above copyright notice and this permission notice shall be included
13 in all copies or substantial portions of the Software.
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 COPYRIGHT HOLDERS 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.
23 Except as contained in this notice, the name of a copyright holder 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 copyright holder.
31 * xdm - display manager daemon
32 * Author: Keith Packard, MIT X Consortium
34 * generate authorization keys
35 * for MIT-MAGIC-COOKIE-1 type authorization
41 #define AUTH_DATA_LEN 16 /* bytes of authorization data */
42 static char authName
[256];
45 mitInitAuth( unsigned short name_len
, const char *name
)
49 memmove( authName
, name
, name_len
);
53 mitGetAuth( unsigned short namelen
, const char *name
)
56 new = (Xauth
*)Malloc( sizeof(Xauth
) );
60 new->family
= FamilyWild
;
61 new->address_length
= 0;
63 new->number_length
= 0;
66 new->data
= (char *)Malloc( AUTH_DATA_LEN
);
71 new->name
= (char *)Malloc( namelen
);
73 free( (char *)new->data
);
77 memmove( (char *)new->name
, name
, namelen
);
78 new->name_length
= namelen
;
79 if (!generateAuthData( new->data
, AUTH_DATA_LEN
)) {
80 free( (char *)new->name
);
81 free( (char *)new->data
);
85 new->data_length
= AUTH_DATA_LEN
;